[PATCH 1 of 3] localrepo: add desc parameter to transaction
Steve Borho
steve at borho.org
Sat Apr 10 15:11:42 CDT 2010
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1270851815 18000
# Node ID dd64d3da6a634126950747695823fa2ae0cf0bc2
# 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 dd64d3da6a63 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 dd64d3da6a63 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(srctype)
try:
trp = weakref.proxy(tr)
# pull off the changeset group
diff -r 4775fc1e04a8 -r dd64d3da6a63 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()
More information about the Mercurial-devel
mailing list