diff mercurial/patch.py @ 18143:242d2f4ec01c

util: fold ENOENT check into unlinkpath, controlled by new ignoremissing flag Refactor a common pattern.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 28 Dec 2012 11:55:57 +0100
parents b35e3364f94a
children f0d55e1b4855
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Dec 28 11:55:45 2012 +0100
+++ b/mercurial/patch.py	Fri Dec 28 11:55:57 2012 +0100
@@ -439,11 +439,7 @@
                 util.setflags(self._join(fname), False, True)
 
     def unlink(self, fname):
-        try:
-            util.unlinkpath(self._join(fname))
-        except OSError, inst:
-            if inst.errno != errno.ENOENT:
-                raise
+        util.unlinkpath(self._join(fname), ignoremissing=True)
 
     def writerej(self, fname, failed, total, lines):
         fname = fname + ".rej"