diff mercurial/commands.py @ 21021:422981492ace

commit: --edit/-e to force edit of otherwise-supplied commit message The --edit/-e option for the 'commit' command forces editor, even when a commit message has been provided already by other means, such as by the -m or -l options.
author "Bradley M. Kuhn" <bkuhn@ebb.org>
date Sun, 08 Sep 2013 19:02:08 -0400
parents 2db41f95c4a2
children 67b6f1144e90
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Apr 12 00:38:15 2014 -0400
+++ b/mercurial/commands.py	Sun Sep 08 19:02:08 2013 -0400
@@ -1324,6 +1324,8 @@
      _('mark a branch as closed, hiding it from the branch list')),
     ('', 'amend', None, _('amend the parent of the working dir')),
     ('s', 'secret', None, _('use the secret phase for committing')),
+    ('e', 'edit', None,
+     _('further edit commit message already specified')),
     ] + walkopts + commitopts + commitopts2 + subrepoopts,
     _('[OPTION]... [FILE]...'))
 def commit(ui, repo, *pats, **opts):
@@ -1362,6 +1364,8 @@
 
     Returns 0 on success, 1 if nothing changed.
     """
+    forceeditor = opts.get('force_editor') or opts.get('edit')
+
     if opts.get('subrepos'):
         if opts.get('amend'):
             raise util.Abort(_('cannot amend with --subrepos'))
@@ -1400,7 +1404,7 @@
             raise util.Abort(_('cannot amend changeset with children'))
 
         e = cmdutil.commiteditor
-        if opts.get('force_editor'):
+        if forceeditor:
             e = cmdutil.commitforceeditor
 
         # commitfunc is used only for temporary amend commit by cmdutil.amend
@@ -1435,7 +1439,7 @@
             newmarks.write()
     else:
         e = cmdutil.commiteditor
-        if opts.get('force_editor'):
+        if forceeditor:
             e = cmdutil.commitforceeditor
 
         def commitfunc(ui, repo, message, match, opts):