record: add interactive option to the commit command
authorLaurent Charignon <lcharignon@fb.com>
Wed, 11 Mar 2015 15:22:04 -0700
changeset 24278 0b94b68aace9
parent 24277 22d560fe1516
child 24279 7cf9a9e0cf89
record: add interactive option to the commit command
hgext/record.py
mercurial/commands.py
tests/test-completion.t
--- a/hgext/record.py	Tue Mar 10 16:26:13 2015 -0700
+++ b/hgext/record.py	Wed Mar 11 15:22:04 2015 -0700
@@ -18,7 +18,8 @@
 
 @command("record",
          # same options as commit + white space diff options
-         commands.table['^commit|ci'][1][:] + commands.diffwsopts,
+        [c for c in commands.table['^commit|ci'][1][:]
+            if c[1] != "interactive"] + commands.diffwsopts,
           _('hg record [OPTION]... [FILE]...'))
 def record(ui, repo, *pats, **opts):
     '''interactively select changes to commit
--- a/mercurial/commands.py	Tue Mar 10 16:26:13 2015 -0700
+++ b/mercurial/commands.py	Wed Mar 11 15:22:04 2015 -0700
@@ -1383,6 +1383,7 @@
     ('', 'amend', None, _('amend the parent of the working dir')),
     ('s', 'secret', None, _('use the secret phase for committing')),
     ('e', 'edit', None, _('invoke editor on commit messages')),
+    ('i', 'interactive', None, _('use interactive mode')),
     ] + walkopts + commitopts + commitopts2 + subrepoopts,
     _('[OPTION]... [FILE]...'),
     inferrepo=True)
@@ -1422,6 +1423,11 @@
 
     Returns 0 on success, 1 if nothing changed.
     """
+    if opts.get('interactive'):
+        opts.pop('interactive')
+        cmdutil.dorecord(ui, repo, commit, 'commit', False, *pats, **opts)
+        return
+
     if opts.get('subrepos'):
         if opts.get('amend'):
             raise util.Abort(_('cannot amend with --subrepos'))
--- a/tests/test-completion.t	Tue Mar 10 16:26:13 2015 -0700
+++ b/tests/test-completion.t	Wed Mar 11 15:22:04 2015 -0700
@@ -202,7 +202,7 @@
   add: include, exclude, subrepos, dry-run
   annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
-  commit: addremove, close-branch, amend, secret, edit, include, exclude, message, logfile, date, user, subrepos
+  commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
   diff: rev, change, text, git, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos
   export: output, switch-parent, rev, text, git, nodates
   forget: include, exclude