# HG changeset patch # User Steve Borho # Date 1270851815 18000 # Node ID a685011ed38ee101caaf9c5c06e1ef241c989999 # Parent 4775fc1e04a8c083a83d54336f8485b357cb4894 localrepo: add desc parameter to transaction All callers to localrepo.transaction() must supply a transaction description. The description and the existing repository tip are then stored (transactionally) into .hg/undo.desc; where rollback can later find it. diff -r 4775fc1e04a8 -r a685011ed38e hgext/mq.py --- a/hgext/mq.py Fri Apr 09 15:16:52 2010 +0200 +++ b/hgext/mq.py Fri Apr 09 17:23:35 2010 -0500 @@ -610,7 +610,7 @@ try: wlock = repo.wlock() lock = repo.lock() - tr = repo.transaction() + tr = repo.transaction("qpush") try: ret = self._apply(repo, series, list, update_status, strict, patchdir, merge, all_files=all_files) diff -r 4775fc1e04a8 -r a685011ed38e mercurial/localrepo.py --- a/mercurial/localrepo.py Fri Apr 09 15:16:52 2010 +0200 +++ b/mercurial/localrepo.py Fri Apr 09 17:23:35 2010 -0500 @@ -554,7 +554,7 @@ def wwritedata(self, filename, data): return self._filter("decode", filename, data) - def transaction(self): + def transaction(self, desc): tr = self._transref and self._transref() or None if tr and tr.running(): return tr.nest() @@ -571,10 +571,12 @@ ds = "" self.opener("journal.dirstate", "w").write(ds) self.opener("journal.branch", "w").write(self.dirstate.branch()) + self.opener("journal.desc", "w").write("%d,%s" % (len(self), desc)) renames = [(self.sjoin("journal"), self.sjoin("undo")), (self.join("journal.dirstate"), self.join("undo.dirstate")), - (self.join("journal.branch"), self.join("undo.branch"))] + (self.join("journal.branch"), self.join("undo.branch")), + (self.join("journal.desc"), self.join("undo.desc"))] tr = transaction.transaction(self.ui.warn, self.sopener, self.sjoin("journal"), aftertrans(renames), @@ -890,7 +892,7 @@ lock = self.lock() try: - tr = self.transaction() + tr = self.transaction("commit") trp = weakref.proxy(tr) # check in files @@ -2003,7 +2005,7 @@ cl.delayupdate() oldheads = len(cl.heads()) - tr = self.transaction() + tr = self.transaction(",".join([srctype, url])) try: trp = weakref.proxy(tr) # pull off the changeset group diff -r 4775fc1e04a8 -r a685011ed38e mercurial/repair.py --- a/mercurial/repair.py Fri Apr 09 15:16:52 2010 +0200 +++ b/mercurial/repair.py Fri Apr 09 17:23:35 2010 -0500 @@ -114,7 +114,7 @@ mfst = repo.manifest - tr = repo.transaction() + tr = repo.transaction("strip") offset = len(tr.entries) tr.startgroup() diff -r 4775fc1e04a8 -r a685011ed38e tests/test-fncache.out --- a/tests/test-fncache.out Fri Apr 09 15:16:52 2010 +0200 +++ b/tests/test-fncache.out Fri Apr 09 17:23:35 2010 -0500 @@ -54,6 +54,7 @@ .hg/requires .hg/undo .hg/undo.branch +.hg/undo.desc .hg/undo.dirstate % non fncache repo adding tst.d/Foo @@ -70,4 +71,5 @@ .hg/store/data/tst.d.hg/_foo.i .hg/store/undo .hg/undo.branch +.hg/undo.desc .hg/undo.dirstate diff -r 4775fc1e04a8 -r a685011ed38e tests/test-hup.out --- a/tests/test-hup.out Fri Apr 09 15:16:52 2010 +0200 +++ b/tests/test-hup.out Fri Apr 09 17:23:35 2010 -0500 @@ -4,4 +4,4 @@ transaction abort! rollback completed killed! -.hg/00changelog.i .hg/journal.branch .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a +.hg/00changelog.i .hg/journal.branch .hg/journal.desc .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a diff -r 4775fc1e04a8 -r a685011ed38e tests/test-inherit-mode.out --- a/tests/test-inherit-mode.out Fri Apr 09 15:16:52 2010 +0200 +++ b/tests/test-inherit-mode.out Fri Apr 09 17:23:35 2010 -0500 @@ -26,6 +26,7 @@ 00660 ./.hg/store/fncache 00660 ./.hg/store/undo 00660 ./.hg/undo.branch +00660 ./.hg/undo.desc 00660 ./.hg/undo.dirstate 00700 ./dir/ 00600 ./dir/bar @@ -54,4 +55,5 @@ 00660 ../push/.hg/store/fncache 00660 ../push/.hg/store/undo 00660 ../push/.hg/undo.branch +00660 ../push/.hg/undo.desc 00660 ../push/.hg/undo.dirstate