# HG changeset patch # User Thomas Arendsen Hein # Date 1202582341 -3600 # Node ID 88b4d726332a1301e43d7e4285a8b44f18a187bc # Parent 218d5b9aa46637c86de577473e486233b509ecdb Do not abort rollback if undo.branch isn't available, but warn. diff -r 218d5b9aa466 -r 88b4d726332a mercurial/localrepo.py --- a/mercurial/localrepo.py Sat Feb 09 19:13:57 2008 +0100 +++ b/mercurial/localrepo.py Sat Feb 09 19:39:01 2008 +0100 @@ -579,8 +579,13 @@ self.ui.status(_("rolling back last transaction\n")) transaction.rollback(self.sopener, self.sjoin("undo")) util.rename(self.join("undo.dirstate"), self.join("dirstate")) - branch = self.opener("undo.branch").read() - self.dirstate.setbranch(branch) + try: + branch = self.opener("undo.branch").read() + self.dirstate.setbranch(branch) + except IOError: + self.ui.warn(_("Named branch could not be reset, " + "current branch still is: %s\n") + % util.tolocal(self.dirstate.branch())) self.invalidate() self.dirstate.invalidate() else: diff -r 218d5b9aa466 -r 88b4d726332a tests/test-rollback --- a/tests/test-rollback Sat Feb 09 19:13:57 2008 +0100 +++ b/tests/test-rollback Sat Feb 09 19:39:01 2008 +0100 @@ -14,8 +14,15 @@ hg parents hg status -# Test issue 902 +echo % Test issue 902 hg commit -m "test" hg branch test hg rollback hg branch + +echo % Test rollback of hg before issue 902 was fixed +hg commit -m "test" +hg branch test +rm .hg/undo.branch +hg rollback +hg branch diff -r 218d5b9aa466 -r 88b4d726332a tests/test-rollback.out --- a/tests/test-rollback.out Sat Feb 09 19:13:57 2008 +0100 +++ b/tests/test-rollback.out Sat Feb 09 19:39:01 2008 +0100 @@ -16,6 +16,12 @@ checking files 0 files, 0 changesets, 0 total revisions A a +% Test issue 902 marked working directory as branch test rolling back last transaction default +% Test rollback of hg before issue 902 was fixed +marked working directory as branch test +rolling back last transaction +Named branch could not be reset, current branch still is: test +test