[PATCH 12 of 13 V3] ui: simplify geteditor

Jun Wu quark at fb.com
Wed Mar 22 13:23:44 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 cc9d6ca646db2ee51920abdfd2f235b55e0f28d4
# Parent  486b23fa9d4e82b3d01aad8663895b5448f54d88
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r cc9d6ca646db
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
@@ -1309,7 +1309,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