import: add --edit switch
authorMatt Mackall <mpm@selenic.com>
Tue, 11 Oct 2011 08:32:04 -0500
changeset 15221 269374b89b74
parent 15220 f7db54b832af
child 15222 73015301db86
import: add --edit switch
mercurial/commands.py
tests/test-debugcomplete.t
--- 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'):
--- a/tests/test-debugcomplete.t	Mon Oct 10 23:07:09 2011 -0500
+++ b/tests/test-debugcomplete.t	Tue Oct 11 08:32:04 2011 -0500
@@ -246,7 +246,7 @@
   heads: rev, topo, active, closed, style, template
   help: extension, command
   identify: rev, num, id, branch, tags, bookmarks
-  import: strip, base, force, no-commit, bypass, exact, import-branch, message, logfile, date, user, similarity
+  import: strip, base, edit, force, no-commit, bypass, exact, import-branch, message, logfile, date, user, similarity
   incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   locate: rev, print0, fullpath, include, exclude
   manifest: rev, all