Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 10881:a685011ed38e
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.
author | Steve Borho <steve@borho.org> |
---|---|
date | Fri, 09 Apr 2010 17:23:35 -0500 |
parents | dc097666de01 |
children | f0bfe42c7b1f |
line wrap: on
line diff
--- 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