Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hg.py @ 785:46a8dd3145cc
Fix undo after aborted commit bug
Commit would overwrite undo.dirstate unconditionally, so an undo after
an aborted commit would restore the dirstate from the aborted commit
and not the prior transaction.
This copies dirstate to journal.dirstate and moves it after a
successful transaction.
author | mpm@selenic.com |
---|---|
date | Wed, 27 Jul 2005 18:16:20 -0800 |
parents | 26f3d353851f |
children | 902b12d55751 |
comparison
equal
deleted
inserted
replaced
784:853bfbf1a312 | 785:46a8dd3145cc |
---|---|
673 # save dirstate for undo | 673 # save dirstate for undo |
674 try: | 674 try: |
675 ds = self.opener("dirstate").read() | 675 ds = self.opener("dirstate").read() |
676 except IOError: | 676 except IOError: |
677 ds = "" | 677 ds = "" |
678 self.opener("undo.dirstate", "w").write(ds) | 678 self.opener("journal.dirstate", "w").write(ds) |
679 | 679 |
680 return transaction.transaction(self.ui.warn, | 680 def after(): |
681 self.opener, self.join("journal"), | 681 util.rename(self.join("journal"), self.join("undo")) |
682 self.join("undo")) | 682 util.rename(self.join("journal.dirstate"), |
683 self.join("undo.dirstate")) | |
684 | |
685 return transaction.transaction(self.ui.warn, self.opener, | |
686 self.join("journal"), after) | |
683 | 687 |
684 def recover(self): | 688 def recover(self): |
685 lock = self.lock() | 689 lock = self.lock() |
686 if os.path.exists(self.join("journal")): | 690 if os.path.exists(self.join("journal")): |
687 self.ui.status("rolling back interrupted transaction\n") | 691 self.ui.status("rolling back interrupted transaction\n") |