Mercurial > hg-stable
comparison mercurial/transaction.py @ 26587:56b2bcea2529
error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.
For great justice.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:55:45 -0700 |
parents | 9e0aaac0d9eb |
children | 96dd93de548c |
comparison
equal
deleted
inserted
replaced
26586:d51c658d3f04 | 26587:56b2bcea2529 |
---|---|
69 try: | 69 try: |
70 vfs.unlink(target) | 70 vfs.unlink(target) |
71 except (IOError, OSError) as inst: | 71 except (IOError, OSError) as inst: |
72 if inst.errno != errno.ENOENT: | 72 if inst.errno != errno.ENOENT: |
73 raise | 73 raise |
74 except (IOError, OSError, util.Abort) as inst: | 74 except (IOError, OSError, error.Abort) as inst: |
75 if not c: | 75 if not c: |
76 raise | 76 raise |
77 | 77 |
78 opener.unlink(journal) | 78 opener.unlink(journal) |
79 backuppath = "%s.backupfiles" % journal | 79 backuppath = "%s.backupfiles" % journal |
81 opener.unlink(backuppath) | 81 opener.unlink(backuppath) |
82 try: | 82 try: |
83 for f in backupfiles: | 83 for f in backupfiles: |
84 if opener.exists(f): | 84 if opener.exists(f): |
85 opener.unlink(f) | 85 opener.unlink(f) |
86 except (IOError, OSError, util.Abort) as inst: | 86 except (IOError, OSError, error.Abort) as inst: |
87 # only pure backup file remains, it is sage to ignore any error | 87 # only pure backup file remains, it is sage to ignore any error |
88 pass | 88 pass |
89 | 89 |
90 class transaction(object): | 90 class transaction(object): |
91 def __init__(self, report, opener, vfsmap, journalname, undoname=None, | 91 def __init__(self, report, opener, vfsmap, journalname, undoname=None, |
415 continue | 415 continue |
416 vfs = self._vfsmap[l] | 416 vfs = self._vfsmap[l] |
417 if not f and b and vfs.exists(b): | 417 if not f and b and vfs.exists(b): |
418 try: | 418 try: |
419 vfs.unlink(b) | 419 vfs.unlink(b) |
420 except (IOError, OSError, util.Abort) as inst: | 420 except (IOError, OSError, error.Abort) as inst: |
421 if not c: | 421 if not c: |
422 raise | 422 raise |
423 # Abort may be raise by read only opener | 423 # Abort may be raise by read only opener |
424 self.report("couldn't remote %s: %s\n" | 424 self.report("couldn't remote %s: %s\n" |
425 % (vfs.join(b), inst)) | 425 % (vfs.join(b), inst)) |
438 continue | 438 continue |
439 vfs = self._vfsmap[l] | 439 vfs = self._vfsmap[l] |
440 if b and vfs.exists(b): | 440 if b and vfs.exists(b): |
441 try: | 441 try: |
442 vfs.unlink(b) | 442 vfs.unlink(b) |
443 except (IOError, OSError, util.Abort) as inst: | 443 except (IOError, OSError, error.Abort) as inst: |
444 if not c: | 444 if not c: |
445 raise | 445 raise |
446 # Abort may be raise by read only opener | 446 # Abort may be raise by read only opener |
447 self.report("couldn't remote %s: %s\n" | 447 self.report("couldn't remote %s: %s\n" |
448 % (vfs.join(b), inst)) | 448 % (vfs.join(b), inst)) |