--- a/mercurial/localrepo.py Sun Jan 06 15:40:32 2008 +0100
+++ b/mercurial/localrepo.py Mon Jan 07 15:26:12 2008 -0600
@@ -525,9 +525,11 @@
except IOError:
ds = ""
self.opener("journal.dirstate", "w").write(ds)
+ self.opener("journal.branch", "w").write(self.dirstate.branch())
renames = [(self.sjoin("journal"), self.sjoin("undo")),
- (self.join("journal.dirstate"), self.join("undo.dirstate"))]
+ (self.join("journal.dirstate"), self.join("undo.dirstate")),
+ (self.join("journal.branch"), self.join("undo.branch"))]
tr = transaction.transaction(self.ui.warn, self.sopener,
self.sjoin("journal"),
aftertrans(renames))
@@ -557,6 +559,8 @@
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)
self.invalidate()
self.dirstate.invalidate()
else:
--- a/tests/test-hup.out Sun Jan 06 15:40:32 2008 +0100
+++ b/tests/test-hup.out Mon Jan 07 15:26:12 2008 -0600
@@ -4,4 +4,4 @@
transaction abort!
rollback completed
killed!
-.hg/00changelog.i .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a
+.hg/00changelog.i .hg/journal.branch .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a
--- a/tests/test-rollback Sun Jan 06 15:40:32 2008 +0100
+++ b/tests/test-rollback Mon Jan 07 15:26:12 2008 -0600
@@ -13,3 +13,9 @@
hg verify
hg parents
hg status
+
+# Test issue 902
+hg commit -m "test"
+hg branch test
+hg rollback
+hg branch
--- a/tests/test-rollback.out Sun Jan 06 15:40:32 2008 +0100
+++ b/tests/test-rollback.out Mon Jan 07 15:26:12 2008 -0600
@@ -16,3 +16,6 @@
checking files
0 files, 0 changesets, 0 total revisions
A a
+marked working directory as branch test
+rolling back last transaction
+default