##// END OF EJS Templates
restore branch after rollback (issue 902)
Alexandre Vassalotti -
r5814:dd5a501c default
parent child Browse files
Show More
@@ -525,9 +525,11 b' class localrepository(repo.repository):'
525 except IOError:
525 except IOError:
526 ds = ""
526 ds = ""
527 self.opener("journal.dirstate", "w").write(ds)
527 self.opener("journal.dirstate", "w").write(ds)
528 self.opener("journal.branch", "w").write(self.dirstate.branch())
528
529
529 renames = [(self.sjoin("journal"), self.sjoin("undo")),
530 renames = [(self.sjoin("journal"), self.sjoin("undo")),
530 (self.join("journal.dirstate"), self.join("undo.dirstate"))]
531 (self.join("journal.dirstate"), self.join("undo.dirstate")),
532 (self.join("journal.branch"), self.join("undo.branch"))]
531 tr = transaction.transaction(self.ui.warn, self.sopener,
533 tr = transaction.transaction(self.ui.warn, self.sopener,
532 self.sjoin("journal"),
534 self.sjoin("journal"),
533 aftertrans(renames))
535 aftertrans(renames))
@@ -557,6 +559,8 b' class localrepository(repo.repository):'
557 self.ui.status(_("rolling back last transaction\n"))
559 self.ui.status(_("rolling back last transaction\n"))
558 transaction.rollback(self.sopener, self.sjoin("undo"))
560 transaction.rollback(self.sopener, self.sjoin("undo"))
559 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
561 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
562 branch = self.opener("undo.branch").read()
563 self.dirstate.setbranch(branch)
560 self.invalidate()
564 self.invalidate()
561 self.dirstate.invalidate()
565 self.dirstate.invalidate()
562 else:
566 else:
@@ -4,4 +4,4 b' adding changesets'
4 transaction abort!
4 transaction abort!
5 rollback completed
5 rollback completed
6 killed!
6 killed!
7 .hg/00changelog.i .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a
7 .hg/00changelog.i .hg/journal.branch .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a
@@ -13,3 +13,9 b' hg rollback'
13 hg verify
13 hg verify
14 hg parents
14 hg parents
15 hg status
15 hg status
16
17 # Test issue 902
18 hg commit -m "test"
19 hg branch test
20 hg rollback
21 hg branch
@@ -16,3 +16,6 b' crosschecking files in changesets and ma'
16 checking files
16 checking files
17 0 files, 0 changesets, 0 total revisions
17 0 files, 0 changesets, 0 total revisions
18 A a
18 A a
19 marked working directory as branch test
20 rolling back last transaction
21 default
General Comments 0
You need to be logged in to leave comments. Login now