diff mercurial/cmdutil.py @ 21417:308aaeb956e2

import: use "getcommiteditor()" instead of explicit editor choice This patch also enhances "test-import-bypass.t" and "test-import.t", because "hg import" hasn't been explicitly tested around editor invocation and "--edit" option. This patch explicitly tests below: - with "--bypass" (regardless of "--edit"): - not invoked, if the patch contains the commit message - not invoked, if the commit message is explicitly specified - invoked, otherwise (just adding comment) - without "--bypass": - with "--edit": - not invoked, if "--no-commit" is not specified - invoked, otherwise - without "--edit": - not invoked, if the patch contains the commit message - not invoked, if "--message" or "--logfile" is specified (just adding comment) - invoked, otherwise
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 11 May 2014 00:49:36 +0900
parents 0b5d6c062774
children 272785489ed3
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun May 11 00:49:36 2014 +0900
+++ b/mercurial/cmdutil.py	Sun May 11 00:49:36 2014 +0900
@@ -569,9 +569,7 @@
     tmpname, message, user, date, branch, nodeid, p1, p2 = \
         patch.extract(ui, hunk)
 
-    editor = commiteditor
-    if opts.get('edit'):
-        editor = commitforceeditor
+    editor = getcommiteditor(**opts)
     update = not opts.get('bypass')
     strip = opts["strip"]
     sim = float(opts.get('similarity') or 0)
@@ -660,7 +658,7 @@
                                             opts.get('user') or user,
                                             opts.get('date') or date,
                                             branch, files, store,
-                                            editor=commiteditor)
+                                            editor=getcommiteditor())
                 n = memctx.commit()
             finally:
                 store.close()