Patchwork [10,of,19] commit: use "getcommiteditor()" instead of explicit editor choice

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 10, 2014, 4:08 p.m.
Message ID <04c05644ea80a8547a73.1399738125@feefifofum>
Download mbox | patch
Permalink /patch/4711/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - May 10, 2014, 4:08 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1399736976 -32400
#      Sun May 11 00:49:36 2014 +0900
# Node ID 04c05644ea80a8547a73523b2384f342801793a7
# Parent  6d924c0096511eb1918cc9746a2acacff8be77e6
commit: use "getcommiteditor()" instead of explicit editor choice

This patch also eliminates "forceeditor" no more referred.

This patch doesn't change any tests like as preceding patches, because
editor invocation is already tested well.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1345,8 +1345,6 @@ 
 
     Returns 0 on success, 1 if nothing changed.
     """
-    forceeditor = opts.get('edit')
-
     if opts.get('subrepos'):
         if opts.get('amend'):
             raise util.Abort(_('cannot amend with --subrepos'))
@@ -1408,10 +1406,6 @@ 
                     bookmarks.setcurrent(repo, bm)
             newmarks.write()
     else:
-        e = cmdutil.commiteditor
-        if forceeditor:
-            e = cmdutil.commitforceeditor
-
         def commitfunc(ui, repo, message, match, opts):
             try:
                 if opts.get('secret'):
@@ -1421,7 +1415,9 @@ 
                                           'commit')
 
                 return repo.commit(message, opts.get('user'), opts.get('date'),
-                                   match, editor=e, extra=extra)
+                                   match,
+                                   editor=cmdutil.getcommiteditor(**opts),
+                                   extra=extra)
             finally:
                 ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit')
                 repo.baseui.setconfig('phases', 'new-commit', oldcommitphase,