diff hgext/evolve.py @ 1296:23819e1d61fd stable

evolve: add -i flag to amend command The -i flag was missing because it is not a global flag of the commit command. We can't make it a global flag yet as it is used in many places where it would not be appropriate so we just add it for this occurrence. Also, we only want to add it when commit supports it (otherwise it wouldn't work with older versions of mercurial)
author Laurent Charignon <lcharignon@fb.com>
date Thu, 23 Apr 2015 17:45:46 -0700
parents 891c3ce894fa
children 14587fbcba93 765286e47619
line wrap: on
line diff
--- a/hgext/evolve.py	Wed Apr 29 10:20:04 2015 -0700
+++ b/hgext/evolve.py	Thu Apr 23 17:45:46 2015 -0700
@@ -86,7 +86,12 @@
 else:
     raise ImportError('evolve needs version %s or above' % min(testedwith.split()))
 
-
+aliases, entry = cmdutil.findcmd('commit', commands.table)
+hasinteractivemode = util.any(['interactive' in e for e in entry[1]])
+if hasinteractivemode:
+    interactiveopt = [['i', 'interactive', None, _('use interactive mode')]]
+else:
+    interactiveopt = []
 # This extension contains the following code
 #
 # - Extension Helper code
@@ -1830,7 +1835,7 @@
     ('', 'close-branch', None,
      _('mark a branch as closed, hiding it from the branch list')),
     ('s', 'secret', None, _('use the secret phase for committing')),
-    ] + walkopts + commitopts + commitopts2 + commitopts3,
+    ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
     _('[OPTION]... [FILE]...'))
 def amend(ui, repo, *pats, **opts):
     """combine a changeset with updates and replace it with a new one