Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
18142:11d1a9143adb | 18143:242d2f4ec01c |
---|---|
437 self.opener.write(fname, data) | 437 self.opener.write(fname, data) |
438 if isexec: | 438 if isexec: |
439 util.setflags(self._join(fname), False, True) | 439 util.setflags(self._join(fname), False, True) |
440 | 440 |
441 def unlink(self, fname): | 441 def unlink(self, fname): |
442 try: | 442 util.unlinkpath(self._join(fname), ignoremissing=True) |
443 util.unlinkpath(self._join(fname)) | |
444 except OSError, inst: | |
445 if inst.errno != errno.ENOENT: | |
446 raise | |
447 | 443 |
448 def writerej(self, fname, failed, total, lines): | 444 def writerej(self, fname, failed, total, lines): |
449 fname = fname + ".rej" | 445 fname = fname + ".rej" |
450 self.ui.warn( | 446 self.ui.warn( |
451 _("%d out of %d hunks FAILED -- saving rejects to file %s\n") % | 447 _("%d out of %d hunks FAILED -- saving rejects to file %s\n") % |