changeset 1293:dc5528e04c06

inhibit: remove book -D dependency on cmdprune Bookmark -D was relying on the prune command to be registered, which isn't the case if we've disabled evolve commands. Instead, let's just hard code the arguments. The real fix would be to abstract away the 'I want to prune commits' functionality in evolve to a reusable function, but this will do for now.
author Durham Goode <durham@fb.com>
date Tue, 07 Apr 2015 14:08:18 -0700
parents 62229e7451f7
children d1c29db2e055
files hgext/inhibit.py
diffstat 1 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inhibit.py	Mon Apr 06 15:44:00 2015 -0700
+++ b/hgext/inhibit.py	Tue Apr 07 14:08:18 2015 -0700
@@ -81,25 +81,20 @@
 
 def _bookmark(orig, ui, repo, *bookmarks, **opts):
     """ Add a -D option to the bookmark command, map it to prune -B """
-    def getdefaultopts(module, command):
-        """ Get default options of a command from a module """
-        cmds = [v for k,v in module.cmdtable.items() if command in k]
-        assert len(cmds) == 1, "Ambiguous command"
-        # Options of the first command that matched
-        cmdopts = cmds[0][1]
-        optsdict = {}
-        for d in cmdopts:
-            optsdict[d[1]] = d[2]
-        return optsdict
-
     haspruneopt = opts.get('prune', False)
-
     if not haspruneopt:
         return orig(ui, repo, *bookmarks, **opts)
+
     # Call prune -B
     evolve = extensions.find('evolve')
-    optsdict = getdefaultopts(evolve, 'prune|obsolete')
-    optsdict['bookmark'] = bookmarks[0]
+    optsdict = {
+        'new': [],
+        'succ': [],
+        'rev': [],
+        'bookmark': bookmarks[0],
+        'keep': None,
+        'biject': False,
+    }
     evolve.cmdprune(ui, repo, **optsdict)
 
 # obsolescence inhibitor