mercurial/posix.py
changeset 18143 242d2f4ec01c
parent 18097 ae54cff742e2
child 18288 0d5a22f73a1f
--- a/mercurial/posix.py	Fri Dec 28 11:55:45 2012 +0100
+++ b/mercurial/posix.py	Fri Dec 28 11:55:57 2012 +0100
@@ -443,9 +443,13 @@
 def makedir(path, notindexed):
     os.mkdir(path)
 
-def unlinkpath(f):
+def unlinkpath(f, ignoremissing=False):
     """unlink and remove the directory if it is empty"""
-    os.unlink(f)
+    try:
+        os.unlink(f)
+    except OSError, e:
+        if not (ignoremissing and e.errno == errno.ENOENT):
+            raise
     # try removing directories that might now be empty
     try:
         os.removedirs(os.path.dirname(f))