changeset 21240:1a833fcf5a14

amend: use "editor" argument for "memctx.__init__" to save commit message This patch uses "editor" argument of "memctx.__init__" to save commit message, instead of explicit editor invocation and saving commit message by "localrepository.savecommitmessage()". By passing one of "commiteditor" or "commitforceeditor" as "editor", "memctx.__init__" saves commit message, even when editor invocation is not needed.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 05 May 2014 21:26:40 +0900
parents 19d98da5c018
children 244b177a152e
files mercurial/cmdutil.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon May 05 21:26:40 2014 +0900
+++ b/mercurial/cmdutil.py	Mon May 05 21:26:40 2014 +0900
@@ -2045,12 +2045,12 @@
 
                 user = opts.get('user') or old.user()
                 date = opts.get('date') or old.date()
-            editmsg = False
+            editor = commiteditor
             if not message:
-                editmsg = True
+                editor = commitforceeditor
                 message = old.description()
             elif opts.get('edit'):
-                editmsg = True
+                editor = commitforceeditor
 
             pureextra = extra.copy()
             extra['amend_source'] = old.hex()
@@ -2062,10 +2062,8 @@
                                  filectxfn=filectxfn,
                                  user=user,
                                  date=date,
-                                 extra=extra)
-            if editmsg:
-                new._text = commitforceeditor(repo, new, [])
-            repo.savecommitmessage(new.description())
+                                 extra=extra,
+                                 editor=editor)
 
             newdesc =  changelog.stripdesc(new.description())
             if ((not node)