diff mercurial/cmdutil.py @ 22278:ffaaa80fa724

import: avoid editor invocation when importing with "--exact" for exact-ness Before this patch, external editor is invoked when imported patch has no commit message, even if "--exact" is specified. Then, exact-ness is broken, because empty commit message causes failure of committing. This patch avoids editor invocation at importing with "--exact" for exact-ness, because commit message in the patch should be kept as it is in such case, even if it is empty.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 23 Aug 2014 23:03:50 +0900
parents 2229d757802d
children 650b5b6e75ed
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sat Aug 23 23:03:50 2014 +0900
+++ b/mercurial/cmdutil.py	Sat Aug 23 23:03:50 2014 +0900
@@ -688,7 +688,10 @@
                 else:
                     m = scmutil.matchfiles(repo, files or [])
                 editform = mergeeditform(repo[None], 'import.normal')
-                editor = getcommiteditor(editform=editform, **opts)
+                if opts.get('exact'):
+                    editor = None
+                else:
+                    editor = getcommiteditor(editform=editform, **opts)
                 n = repo.commit(message, opts.get('user') or user,
                                 opts.get('date') or date, match=m,
                                 editor=editor, force=partial)
@@ -705,7 +708,10 @@
                                     files, eolmode=None)
                 except patch.PatchError, e:
                     raise util.Abort(str(e))
-                editor = getcommiteditor(editform='import.bypass')
+                if opts.get('exact'):
+                    editor = None
+                else:
+                    editor = getcommiteditor(editform='import.bypass')
                 memctx = context.makememctx(repo, (p1.node(), p2.node()),
                                             message,
                                             opts.get('user') or user,