[PATCH 2 of 2 evolve-ext] inhibit: remove unused bookmark operation wrapping
Laurent Charignon
lcharignon at fb.com
Wed Nov 25 01:19:06 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1448414187 28800
# Tue Nov 24 17:16:27 2015 -0800
# Node ID dd2cc071061254f329a96d4bf87ed1279653b676
# Parent 6d694642bfce2d39320f5f1b1d354e902b7fc39c
inhibit: remove unused bookmark operation wrapping
Before this patch, inhibit was wrapping bookmarks.write and
bookmarks.recordchange. Since all the usage of bookmarks.write are not replaced
by bookmarks.recordchange all bookmarks operation happen in a transaction.
Inhibit already wraps the transaction mechanism to make sure that no revision
can end up being obsolete and visible. This makes the wrapping of
bookmarks.write superfluous.
Wrapping bookmarks.recordchange was wrong in the first place and redundant with
wrapping transactions.
diff --git a/hgext/inhibit.py b/hgext/inhibit.py
--- a/hgext/inhibit.py
+++ b/hgext/inhibit.py
@@ -22,7 +22,6 @@ from mercurial import error
from mercurial import scmutil
from mercurial import commands
from mercurial import lock as lockmod
-from mercurial import bookmarks
from mercurial import util
from mercurial.i18n import _
@@ -73,13 +72,6 @@ def _update(orig, ui, repo, *args, **kwa
finally:
lockmod.release(wlock)
-def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
- """ Add inhibition markers to every obsolete bookmarks """
- repo = bkmstoreinst._repo
- bkmstorenodes = [repo[v].node() for v in bkmstoreinst.values()]
- _inhibitmarkers(repo, bkmstorenodes)
- return orig(bkmstoreinst, *args, **kwargs)
-
def _bookmark(orig, ui, repo, *bookmarks, **opts):
""" Add a -D option to the bookmark command, map it to prune -B """
haspruneopt = opts.get('prune', False)
@@ -228,10 +220,6 @@ def extsetup(ui):
# wrap update to make sure that no obsolete commit is visible after an
# update
extensions.wrapcommand(commands.table, 'update', _update)
- # There are two ways to save bookmark changes during a transation, we
- # wrap both to add inhibition markers.
- extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged)
- extensions.wrapfunction(bookmarks.bmstore, 'write', _bookmarkchanged)
# Add bookmark -D option
entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark)
entry[1].append(('D','prune',None,
diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -653,7 +653,7 @@ check that pruning and inhibited node do
adding manifests
adding file changes
added 2 changesets with 1 changes to 2 files (+1 heads)
- (run 'hg heads' to see heads, 'hg merge' to merge)
+ (run 'hg heads .' to see heads, 'hg merge' to merge)
Only allow direct access and check that evolve works like before
(also disable evolve commands to avoid hint about using evolve)
More information about the Mercurial-devel
mailing list