[PATCH 09 of 10] ui: simplify geteditor

Jun Wu quark at fb.com
Mon Mar 13 23:44:54 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1489456194 25200
#      Mon Mar 13 18:49:54 2017 -0700
# Node ID fca9187f1dbaaf17305878e9310e332373589c14
# Parent  a0cff9968a6041c3c47a8417637c79959f9ba408
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r fca9187f1dba
ui: simplify geteditor

Now $EDITOR and $VISUAL will affect ui.editor directly. The logic can be
simplified.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1362,7 +1362,5 @@ class ui(object):
             editor = 'vi'
         return (encoding.environ.get("HGEDITOR") or
-                self.config("ui", "editor") or
-                encoding.environ.get("VISUAL") or
-                encoding.environ.get("EDITOR", editor))
+                self.config("ui", "editor", editor))
 
     @util.propertycache


More information about the Mercurial-devel mailing list