changeset 21712:51035af2c0bf

backout: accept '--edit' like other commands creating new changeset After this patch, users can invoke editor for the commit message by '--edit' option regardless of '--message'/'--logfile'.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 01 Jun 2014 00:08:32 +0900
parents 0986af9e7006
children 7a51bced398b
files mercurial/commands.py tests/test-backout.t tests/test-completion.t
diffstat 3 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jun 01 00:08:32 2014 +0900
+++ b/mercurial/commands.py	Sun Jun 01 00:08:32 2014 +0900
@@ -386,6 +386,7 @@
     ('', 'parent', '',
      _('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
     ('r', 'rev', '', _('revision to backout'), _('REV')),
+    ('e', 'edit', False, _('invoke editor on commit messages')),
     ] + mergetoolopts + walkopts + commitopts + commitopts2,
     _('[OPTION]... [-r] REV'))
 def backout(ui, repo, node=None, rev=None, **opts):
@@ -488,7 +489,7 @@
 
 
         def commitfunc(ui, repo, message, match, opts):
-            e = cmdutil.getcommiteditor()
+            e = cmdutil.getcommiteditor(**opts)
             if not message:
                 # we don't translate commit messages
                 message = "Backed out changeset %s" % short(node)
--- a/tests/test-backout.t	Sun Jun 01 00:08:32 2014 +0900
+++ b/tests/test-backout.t	Sun Jun 01 00:08:32 2014 +0900
@@ -355,9 +355,21 @@
   update: (current)
 
 with --merge
+(this also tests that editor is invoked if '--edit' is specified
+explicitly regardless of '--message')
+
   $ hg update -qC
-  $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true
+  $ HGEDITOR=cat hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true --edit
   removing file1
+  backout on branch1
+  
+  
+  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  HG: Leave message empty to abort commit.
+  HG: --
+  HG: user: test
+  HG: branch 'branch2'
+  HG: removed file1
   created new head
   changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
   merging with changeset 3:d4e8f6db59fb
--- a/tests/test-completion.t	Sun Jun 01 00:08:32 2014 +0900
+++ b/tests/test-completion.t	Sun Jun 01 00:08:32 2014 +0900
@@ -215,7 +215,7 @@
   update: clean, check, date, rev, tool
   addremove: similarity, include, exclude, dry-run
   archive: no-decode, prefix, rev, type, subrepos, include, exclude
-  backout: merge, parent, rev, tool, include, exclude, message, logfile, date, user
+  backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user
   bisect: reset, good, bad, skip, extend, command, noupdate
   bookmarks: force, rev, delete, rename, inactive
   branch: force, clean