mercurial/posix.py
changeset 18143 242d2f4ec01c
parent 18097 ae54cff742e2
child 18288 0d5a22f73a1f
equal deleted inserted replaced
18142:11d1a9143adb 18143:242d2f4ec01c
   441     return 80
   441     return 80
   442 
   442 
   443 def makedir(path, notindexed):
   443 def makedir(path, notindexed):
   444     os.mkdir(path)
   444     os.mkdir(path)
   445 
   445 
   446 def unlinkpath(f):
   446 def unlinkpath(f, ignoremissing=False):
   447     """unlink and remove the directory if it is empty"""
   447     """unlink and remove the directory if it is empty"""
   448     os.unlink(f)
   448     try:
       
   449         os.unlink(f)
       
   450     except OSError, e:
       
   451         if not (ignoremissing and e.errno == errno.ENOENT):
       
   452             raise
   449     # try removing directories that might now be empty
   453     # try removing directories that might now be empty
   450     try:
   454     try:
   451         os.removedirs(os.path.dirname(f))
   455         os.removedirs(os.path.dirname(f))
   452     except OSError:
   456     except OSError:
   453         pass
   457         pass