[PATCH evolve-ext] inhibit: backout 23a34dce5131 remove unused bookmark operation wrapping

Laurent Charignon lcharignon at fb.com
Thu Dec 10 23:34:48 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1449790474 28800
#      Thu Dec 10 15:34:34 2015 -0800
# Node ID 5466978e969b47c0620f082b67bb340ead6fbb78
# Parent  ed63bf62ff02cf5a1c9c12841b3ed0dfa7eccf2c
inhibit: backout 23a34dce5131 remove unused bookmark operation wrapping

This breaks potentially a lot of things. Let's give a change to extensions
maintainers to adapt to the new bookmarks.write api before removing this code
right away.

diff --git a/hgext/inhibit.py b/hgext/inhibit.py
--- a/hgext/inhibit.py
+++ b/hgext/inhibit.py
@@ -22,6 +22,7 @@ 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 _
 
@@ -72,6 +73,13 @@ 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)
@@ -255,6 +263,10 @@ def extsetup(ui):
                                     _computeobsoletenotrebasedwrap)
     except KeyError:
         pass
+    # 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,


More information about the Mercurial-devel mailing list