[PATCH 2 of 2] histedit: add transaction for cleanup when obsmarkers are enabled
Laurent Charignon
lcharignon at fb.com
Mon Aug 3 15:07:53 CDT 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1438026262 25200
# Mon Jul 27 12:44:22 2015 -0700
# Branch stable
# Node ID 70b33c794a0d59186243378c6c492a7157c463c9
# Parent 1ce021437a02319df153e5e535c0ce9885160e89
histedit: add transaction for cleanup when obsmarkers are enabled
This patch adds transaction for the cleanup phase.
Before this patch, the histedit cleanup was creating markers on replaced nodes
first and then on temp nodes.
If we prune the replaced nodes first they will be obsolete but kept visible
until we prune the temp nodes. This is particularly concerning in the case of
inhibit where these nodes would be made visible outside of the duration of the
histedit command.
We should do both operations within one transaction to avoid this issue.
We don't open a transaction when createmarkers is not enabled as strip does
not work within transactions.
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -169,6 +169,7 @@ from mercurial import context
from mercurial import exchange
from mercurial import extensions
from mercurial import hg
+from mercurial import lock as lockmod
from mercurial import node
from mercurial import repair
from mercurial import scmutil
@@ -908,7 +909,16 @@ def _histedit(ui, repo, state, *freeargs
for n in succs[1:]:
ui.debug(m % node.short(n))
- cleanup(ui, repo, state, mapping, ntm, supportsmarkers, tmpnodes)
+ lock, tr = None, None
+ try:
+ if supportsmarkers:
+ lock = repo.lock()
+ tr = repo.transaction("cleanup")
+ cleanup(ui, repo, state, mapping, ntm, supportsmarkers, tmpnodes)
+ if tr is not None:
+ tr.close()
+ finally:
+ lockmod.release(tr, lock)
def bootstrapcontinue(ui, state, opts):
repo = state.repo
More information about the Mercurial-devel
mailing list