Patchwork [09,of,10,V5] ui: simplify geteditor

login
register
mail settings
Submitter Jun Wu
Date March 27, 2017, 6:02 a.m.
Message ID <a354f13a30b939436352.1490594528@localhost.localdomain>
Download mbox | patch
Permalink /patch/19749/
State Accepted
Headers show

Comments

Jun Wu - March 27, 2017, 6:02 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490589702 25200
#      Sun Mar 26 21:41:42 2017 -0700
# Node ID a354f13a30b93943635224fcd90f43019241e23e
# Parent  0c745bb07fd82bb9383698c60c042101ee45f4ab
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r a354f13a30b9
ui: simplify geteditor

Now $EDITOR and $VISUAL will affect ui.editor directly. So it's no longer
necessary to test them in ui.geteditor.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1327,7 +1327,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