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.
--- a/hgext/inhibit.py Fri Dec 11 10:51:04 2015 +0000
+++ b/hgext/inhibit.py Thu Dec 10 15:34:34 2015 -0800
@@ -22,6 +22,7 @@
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 @@
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 @@
_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,