mercurial/windows.py
changeset 18143 242d2f4ec01c
parent 18041 f0cfa27c712a
child 18868 cafa447a7d3b
--- a/mercurial/windows.py	Fri Dec 28 11:55:45 2012 +0100
+++ b/mercurial/windows.py	Fri Dec 28 11:55:57 2012 +0100
@@ -275,9 +275,13 @@
             break
         head, tail = os.path.split(head)
 
-def unlinkpath(f):
+def unlinkpath(f, ignoremissing=False):
     """unlink and remove the directory if it is empty"""
-    unlink(f)
+    try:
+        unlink(f)
+    except OSError, e:
+        if not (ignoremissing and e.errno == errno.ENOENT):
+            raise
     # try removing directories that might now be empty
     try:
         _removedirs(os.path.dirname(f))