[PATCH 10 of 11 V2] ui: simplify geteditor

Jun Wu quark at fb.com
Wed Mar 22 03:50:59 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 713d562d0a2426c8658675a66158e6c412ae9dcc
# Parent  9f90c479585c75ece920043c220093058d968b97
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 713d562d0a24
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
@@ -1308,7 +1308,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