diff mercurial/commands.py @ 15221:269374b89b74

import: add --edit switch
author Matt Mackall <mpm@selenic.com>
date Tue, 11 Oct 2011 08:32:04 -0500
parents fad02a84c4ac
children fc035e5370ca
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 10 23:07:09 2011 -0500
+++ b/mercurial/commands.py	Tue Oct 11 08:32:04 2011 -0500
@@ -3185,6 +3185,7 @@
      _('directory strip option for patch. This has the same '
        'meaning as the corresponding patch option'), _('NUM')),
     ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')),
+    ('e', 'edit', False, _('invoke editor on commit messages')),
     ('f', 'force', None, _('skip check for outstanding uncommitted changes')),
     ('', 'no-commit', None,
      _("don't commit, just update the working directory")),
@@ -3264,6 +3265,10 @@
     if date:
         opts['date'] = util.parsedate(date)
 
+    editor = cmdutil.commiteditor
+    if opts.get('edit'):
+        editor = cmdutil.commitforceeditor
+
     update = not opts.get('bypass')
     if not update and opts.get('no_commit'):
         raise util.Abort(_('cannot use --no-commit with --bypass'))
@@ -3350,7 +3355,7 @@
                         m = scmutil.matchfiles(repo, files or [])
                     n = repo.commit(message, opts.get('user') or user,
                                     opts.get('date') or date, match=m,
-                                    editor=cmdutil.commiteditor)
+                                    editor=editor)
                     checkexact(repo, n, nodeid)
             else:
                 if opts.get('exact') or opts.get('import_branch'):