diff mercurial/ui.py @ 22205:9fa429723f26

ui: invoke editor for committing with HGEDITFORM environment variable At the external editor invocation for committing, the value specified as "editform" for "cmdutil.getcommiteditor" is in "HGEDITFORM". This enables external editor to do own customization according to commit types.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 15 Aug 2014 23:05:53 +0900
parents 6dfb78f18bdb
children 3b39e1522d8f
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Aug 15 04:37:46 2014 +0200
+++ b/mercurial/ui.py	Fri Aug 15 23:05:53 2014 +0900
@@ -728,7 +728,7 @@
         if self.debugflag:
             opts['label'] = opts.get('label', '') + ' ui.debug'
             self.write(*msg, **opts)
-    def edit(self, text, user, extra={}):
+    def edit(self, text, user, extra={}, editform=None):
         (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt",
                                       text=True)
         try:
@@ -743,6 +743,8 @@
                 if label in extra:
                     environ.update({'HGREVISION': extra[label]})
                     break
+            if editform:
+                environ.update({'HGEDITFORM': editform})
 
             editor = self.geteditor()