[PATCH] merge: do not try to delete several times the same directory

Adrian Buehlmann adrian at cadifra.com
Sun Nov 7 07:50:53 CST 2010


On 07.11.2010 14:18, Nicolas Dumazet wrote:
> 2010/11/7 Nicolas Dumazet <nicdumz at gmail.com>:
> 
>> +                maybeempty.add(os.path.dirname(fn))
> 
> Not perfect because os.path.dirname can raise OSError(EISDIR).

Hmm. You say os.path.dirname can raise OSError(EISDIR).

I'm wondering how. Can you give an example for that claim?

I failed to achieve it with:

$ python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.dirname(r"C:\Users\adi\tmp\a.txt")
'C:\\Users\\adi\\tmp'
>>> os.path.dirname("C:\\Users\\adi\\tmp\\a.txt\\")
'C:\\Users\\adi\\tmp\\a.txt'
>>> os.path.dirname("C:\\Users\\adi\\tmp")
'C:\\Users\\adi'
>>> os.path.dirname("C:\\Users\\adi\\tmp\\foo")
'C:\\Users\\adi\\tmp'
>>> os.path.dirname("C:\\Users\\xadi\\tmp\\foo")
'C:\\Users\\xadi\\tmp'


More information about the Mercurial-devel mailing list