inhibit: remove unused bookmark operation wrapping
authorLaurent Charignon <lcharignon@fb.com>
Tue, 24 Nov 2015 17:16:27 -0800
changeset 1541 23a34dce5131
parent 1540 5a1cfb1160a6
child 1542 333e056b3034
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.
hgext/inhibit.py
--- a/hgext/inhibit.py	Tue Dec 01 10:25:38 2015 -0800
+++ b/hgext/inhibit.py	Tue Nov 24 17:16:27 2015 -0800
@@ -21,7 +21,6 @@
 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 _
 
@@ -72,13 +71,6 @@
     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)
@@ -241,10 +233,6 @@
     # 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,