Mercurial > hg
comparison mercurial/localrepo.py @ 8294:48a382c23226
transaction: refactor transaction.abort and rollback to use the same code
This adds a change to the way that abort is processed, as it will not continue
truncating files beyond the first failure, otherwise the respective
functionality is maintained, i.e. abort will not unlink files, but rollback
will.
Co-contributor: Sune Foldager <cryo@cyanite.org>
author | Henrik Stuart <hg@hstuart.dk> |
---|---|
date | Mon, 04 May 2009 15:31:57 +0200 |
parents | c214a895f62c |
children | b87a50b7125c |
comparison
equal
deleted
inserted
replaced
8293:f00573bc93f8 | 8294:48a382c23226 |
---|---|
622 def recover(self): | 622 def recover(self): |
623 lock = self.lock() | 623 lock = self.lock() |
624 try: | 624 try: |
625 if os.path.exists(self.sjoin("journal")): | 625 if os.path.exists(self.sjoin("journal")): |
626 self.ui.status(_("rolling back interrupted transaction\n")) | 626 self.ui.status(_("rolling back interrupted transaction\n")) |
627 transaction.rollback(self.sopener, self.sjoin("journal")) | 627 transaction.rollback(self.sopener, self.sjoin("journal"), self.ui.warn) |
628 self.invalidate() | 628 self.invalidate() |
629 return True | 629 return True |
630 else: | 630 else: |
631 self.ui.warn(_("no interrupted transaction available\n")) | 631 self.ui.warn(_("no interrupted transaction available\n")) |
632 return False | 632 return False |
638 try: | 638 try: |
639 wlock = self.wlock() | 639 wlock = self.wlock() |
640 lock = self.lock() | 640 lock = self.lock() |
641 if os.path.exists(self.sjoin("undo")): | 641 if os.path.exists(self.sjoin("undo")): |
642 self.ui.status(_("rolling back last transaction\n")) | 642 self.ui.status(_("rolling back last transaction\n")) |
643 transaction.rollback(self.sopener, self.sjoin("undo")) | 643 transaction.rollback(self.sopener, self.sjoin("undo"), self.ui.warn) |
644 util.rename(self.join("undo.dirstate"), self.join("dirstate")) | 644 util.rename(self.join("undo.dirstate"), self.join("dirstate")) |
645 try: | 645 try: |
646 branch = self.opener("undo.branch").read() | 646 branch = self.opener("undo.branch").read() |
647 self.dirstate.setbranch(branch) | 647 self.dirstate.setbranch(branch) |
648 except IOError: | 648 except IOError: |