Patchwork [1,of,5] rcutil: directly call win32.executablepath()

login
register
mail settings
Submitter Yuya Nishihara
Date March 24, 2018, 9:53 a.m.
Message ID <9bfb1ec8fb375630cfca.1521885233@mimosa>
Download mbox | patch
Permalink /patch/29812/
State Accepted
Headers show

Comments

Yuya Nishihara - March 24, 2018, 9:53 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521865850 -32400
#      Sat Mar 24 13:30:50 2018 +0900
# Node ID 9bfb1ec8fb375630cfca0e42b17676e1892bd90a
# Parent  3f765e4cbf4c1e53e0fd88992c079b321749d837
rcutil: directly call win32.executablepath()

Since it isn't supported on POSIX platform, we don't need to double the
compatibility layers.
Pulkit Goyal - March 24, 2018, 10:54 a.m.
On Sat, Mar 24, 2018 at 3:23 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1521865850 -32400
> #      Sat Mar 24 13:30:50 2018 +0900
> # Node ID 9bfb1ec8fb375630cfca0e42b17676e1892bd90a
> # Parent  3f765e4cbf4c1e53e0fd88992c079b321749d837
> rcutil: directly call win32.executablepath()
>
> Since it isn't supported on POSIX platform, we don't need to double the
> compatibility layers.

Looks good to me. Queued the series. Many thanks!

Patch

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -626,9 +626,6 @@  class cachestat(object):
     def __ne__(self, other):
         return not self == other
 
-def executablepath():
-    return None # available on Windows only
-
 def statislink(st):
     '''check whether a stat result is a symlink'''
     return st and stat.S_ISLNK(st.st_mode)
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -21,7 +21,7 @@  fallbackpager = 'more'
 def systemrcpath():
     '''return default os-specific hgrc search path'''
     rcpath = []
-    filename = util.executablepath()
+    filename = win32.executablepath()
     # Use mercurial.ini found in directory with hg.exe
     progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
     rcpath.append(progrc)
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -108,7 +108,6 @@  cachestat = platform.cachestat
 checkexec = platform.checkexec
 checklink = platform.checklink
 copymode = platform.copymode
-executablepath = platform.executablepath
 expandglobs = platform.expandglobs
 explainexit = platform.explainexit
 findexe = platform.findexe
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -31,7 +31,6 @@  except ImportError:
 
 osutil = policy.importmod(r'osutil')
 
-executablepath = win32.executablepath
 getfsmountpoint = win32.getvolumename
 getfstype = win32.getfstype
 getuser = win32.getuser