diff hgext/transplant.py @ 21411:afff78be4361

transplant: use "getcommiteditor()" instead of explicit editor choice This patch also enhances "test-transplant.t", because "hg transplant" hasn't been explicitly tested around editor invocation and "--edit" option.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 11 May 2014 00:49:35 +0900
parents 8c2f1e2a11ff
children 7e71a65bf94f
line wrap: on
line diff
--- a/hgext/transplant.py	Sun May 11 00:49:35 2014 +0900
+++ b/hgext/transplant.py	Sun May 11 00:49:35 2014 +0900
@@ -80,13 +80,13 @@
             self.dirty = True
 
 class transplanter(object):
-    def __init__(self, ui, repo):
+    def __init__(self, ui, repo, opts):
         self.ui = ui
         self.path = repo.join('transplant')
         self.opener = scmutil.opener(self.path)
         self.transplants = transplants(self.path, 'transplants',
                                        opener=self.opener)
-        self.editor = None
+        self.editor = cmdutil.getcommiteditor(**opts)
 
     def applied(self, repo, node, parent):
         '''returns True if a node is already an ancestor of parent
@@ -599,9 +599,7 @@
     if not opts.get('filter'):
         opts['filter'] = ui.config('transplant', 'filter')
 
-    tp = transplanter(ui, repo)
-    if opts.get('edit'):
-        tp.editor = cmdutil.commitforceeditor
+    tp = transplanter(ui, repo, opts)
 
     cmdutil.checkunfinished(repo)
     p1, p2 = repo.dirstate.parents()