Patchwork [2,of,2,evolve-ext-V2] inhibit: remove unused bookmark operation wrapping

login
register
mail settings
Submitter Laurent Charignon
Date Dec. 1, 2015, 6:33 p.m.
Message ID <4a6935e229c9eb1016f4.1448994807@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/11725/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Laurent Charignon - Dec. 1, 2015, 6:33 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1448414187 28800
#      Tue Nov 24 17:16:27 2015 -0800
# Node ID 4a6935e229c9eb1016f454e1abc894a61246dea7
# Parent  fe1bd6c36f65c9d8c09362a97c24adcdb75c9f1c
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.
Pierre-Yves David - Dec. 2, 2015, 9:16 p.m.
On 12/01/2015 10:33 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1448414187 28800
> #      Tue Nov 24 17:16:27 2015 -0800
> # Node ID 4a6935e229c9eb1016f454e1abc894a61246dea7
> # Parent  fe1bd6c36f65c9d8c09362a97c24adcdb75c9f1c
> inhibit: remove unused bookmark operation wrapping

pushed to main, thanks.

Patch

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
@@ -686,7 +686,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)