graft: add --edit
authorMatt Mackall <mpm@selenic.com>
Wed, 12 Oct 2011 18:46:03 -0500
changeset 15239 f5d9d0d0f588
parent 15238 2d710c12ffc0
child 15240 bfb93963bb39
graft: add --edit
mercurial/commands.py
tests/test-debugcomplete.t
--- a/mercurial/commands.py	Wed Oct 12 18:45:36 2011 -0500
+++ b/mercurial/commands.py	Wed Oct 12 18:46:03 2011 -0500
@@ -2448,7 +2448,7 @@
     return errs
 
 @command('graft',
-    [],
+    [('e', 'edit', False, _('invoke editor on commit messages'))],
     _('[OPTION]... REVISION...'))
 def graft(ui, repo, rev, *revs, **opts):
     '''copy changes from other branches onto the current branch
@@ -2466,6 +2466,10 @@
 
     cmdutil.bailifchanged(repo)
 
+    editor = None
+    if opts.get('edit'):
+        editor = cmdutil.commitforceeditor
+
     revs = [rev] + list(revs)
     revs = scmutil.revrange(repo, revs)
 
@@ -2512,7 +2516,7 @@
         # commit
         extra = {'source': ctx.hex()}
         repo.commit(text=ctx.description(), user=ctx.user(),
-                    date=ctx.date(), extra=extra)
+                    date=ctx.date(), extra=extra, editor=editor)
 
     return 0
 
--- a/tests/test-debugcomplete.t	Wed Oct 12 18:45:36 2011 -0500
+++ b/tests/test-debugcomplete.t	Wed Oct 12 18:46:03 2011 -0500
@@ -243,7 +243,7 @@
   debugsub: rev
   debugwalk: include, exclude
   debugwireargs: three, four, five, ssh, remotecmd, insecure
-  graft: 
+  graft: edit
   grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
   heads: rev, topo, active, closed, style, template
   help: extension, command