[PATCH 4 of 4] py3: remove a couple of superfluous calls to pycompat.rapply()

Matt Harbison mharbison72 at gmail.com
Wed Sep 26 00:06:04 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1537932336 14400
#      Tue Sep 25 23:25:36 2018 -0400
# Node ID d43b27e125e4554a0c741805bd4a96c23341dc8e
# Parent  50c1d7b011486167aa39dec26aa6642938010ef2
py3: remove a couple of superfluous calls to pycompat.rapply()

These places can only be strings.

diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -402,7 +402,7 @@ class commandline(object):
 
     def _run(self, cmd, *args, **kwargs):
         def popen(cmdline):
-            p = subprocess.Popen(pycompat.rapply(procutil.tonativestr, cmdline),
+            p = subprocess.Popen(procutil.tonativestr(cmdline),
                                  shell=True, bufsize=-1,
                                  close_fds=procutil.closefds,
                                  stdout=subprocess.PIPE)
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -452,7 +452,7 @@ def fixfile(ui, opts, fixers, fixctx, pa
                 continue
             ui.debug('subprocess: %s\n' % (command,))
             proc = subprocess.Popen(
-                pycompat.rapply(procutil.tonativestr, command),
+                procutil.tonativestr(command),
                 shell=True,
                 cwd=procutil.tonativestr(b'/'),
                 stdin=subprocess.PIPE,
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -66,7 +66,7 @@ def uisetup(ui):
             # we can't use close_fds *and* redirect stdin. I'm not sure that we
             # need to because the detached process has no console connection.
             subprocess.Popen(
-                pycompat.rapply(procutil.tonativestr, script),
+                procutil.tonativestr(script),
                 shell=True, env=procutil.tonativeenv(env), close_fds=True,
                 creationflags=_creationflags)
     else:
@@ -87,7 +87,7 @@ def uisetup(ui):
                 # connect stdin to devnull to make sure the subprocess can't
                 # muck up that stream for mercurial.
                 subprocess.Popen(
-                    pycompat.rapply(procutil.tonativestr, script),
+                    procutil.tonativestr(script),
                     shell=True, stdin=open(os.devnull, 'r'),
                     env=procutil.tonativeenv(env),
                     close_fds=True, **newsession)
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1339,7 +1339,7 @@ def extdatasource(repo, source):
         if spec.startswith("shell:"):
             # external commands should be run relative to the repo root
             cmd = spec[6:]
-            proc = subprocess.Popen(pycompat.rapply(procutil.tonativestr, cmd),
+            proc = subprocess.Popen(procutil.tonativestr(cmd),
                                     shell=True, bufsize=-1,
                                     close_fds=procutil.closefds,
                                     stdout=subprocess.PIPE,
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -137,7 +137,7 @@ def popen2(cmd, env=None):
     # Setting bufsize to -1 lets the system decide the buffer size.
     # The default for bufsize is 0, meaning unbuffered. This leads to
     # poor performance on Mac OS X: http://bugs.python.org/issue4194
-    p = subprocess.Popen(pycompat.rapply(tonativestr, cmd),
+    p = subprocess.Popen(tonativestr(cmd),
                          shell=True, bufsize=-1,
                          close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
@@ -149,7 +149,7 @@ def popen3(cmd, env=None):
     return stdin, stdout, stderr
 
 def popen4(cmd, env=None, bufsize=-1):
-    p = subprocess.Popen(pycompat.rapply(tonativestr, cmd),
+    p = subprocess.Popen(tonativestr(cmd),
                          shell=True, bufsize=bufsize,
                          close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
@@ -159,7 +159,7 @@ def popen4(cmd, env=None, bufsize=-1):
 
 def pipefilter(s, cmd):
     '''filter string S through command CMD, returning its output'''
-    p = subprocess.Popen(pycompat.rapply(tonativestr, cmd),
+    p = subprocess.Popen(tonativestr(cmd),
                          shell=True, close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
     pout, perr = p.communicate(s)
@@ -351,12 +351,12 @@ def system(cmd, environ=None, cwd=None, 
     cmd = quotecommand(cmd)
     env = shellenviron(environ)
     if out is None or isstdout(out):
-        rc = subprocess.call(pycompat.rapply(tonativestr, cmd),
+        rc = subprocess.call(tonativestr(cmd),
                              shell=True, close_fds=closefds,
                              env=tonativeenv(env),
                              cwd=pycompat.rapply(tonativestr, cwd))
     else:
-        proc = subprocess.Popen(pycompat.rapply(tonativestr, cmd),
+        proc = subprocess.Popen(tonativestr(cmd),
                                 shell=True, close_fds=closefds,
                                 env=tonativeenv(env),
                                 cwd=pycompat.rapply(tonativestr, cwd),


More information about the Mercurial-devel mailing list