changeset 44867:8e8fd938ca07

cleanup: eliminate procutil.quotecommand() After some compatibility code was removed, the function was the identity function on all platforms.
author Manuel Jacob <me@manueljacob.de>
date Fri, 29 May 2020 03:56:07 +0200
parents 5258bffdb1d6
children 3aed7d262bdf
files hgext/convert/cvs.py hgext/convert/gnuarch.py hgext/convert/subversion.py hgext/extdiff.py mercurial/chgserver.py mercurial/posix.py mercurial/sshpeer.py mercurial/utils/procutil.py mercurial/windows.py
diffstat 9 files changed, 6 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/cvs.py	Fri May 29 03:43:08 2020 +0200
+++ b/hgext/convert/cvs.py	Fri May 29 03:56:07 2020 +0200
@@ -226,8 +226,7 @@
                     cmd = [rsh, host] + cmd
 
             # popen2 does not support argument lists under Windows
-            cmd = [procutil.shellquote(arg) for arg in cmd]
-            cmd = procutil.quotecommand(b' '.join(cmd))
+            cmd = b' '.join(procutil.shellquote(arg) for arg in cmd)
             self.writep, self.readp = procutil.popen2(cmd)
 
         self.realroot = root
--- a/hgext/convert/gnuarch.py	Fri May 29 03:43:08 2020 +0200
+++ b/hgext/convert/gnuarch.py	Fri May 29 03:56:07 2020 +0200
@@ -217,7 +217,7 @@
         cmdline = [procutil.shellquote(arg) for arg in cmdline]
         bdevnull = pycompat.bytestr(os.devnull)
         cmdline += [b'>', bdevnull, b'2>', bdevnull]
-        cmdline = procutil.quotecommand(b' '.join(cmdline))
+        cmdline = b' '.join(cmdline)
         self.ui.debug(cmdline, b'\n')
         return os.system(pycompat.rapply(procutil.tonativestr, cmdline))
 
--- a/hgext/convert/subversion.py	Fri May 29 03:43:08 2020 +0200
+++ b/hgext/convert/subversion.py	Fri May 29 03:56:07 2020 +0200
@@ -1235,7 +1235,7 @@
         arg = encodeargs(args)
         hgexe = procutil.hgexecutable()
         cmd = b'%s debugsvnlog' % procutil.shellquote(hgexe)
-        stdin, stdout = procutil.popen2(procutil.quotecommand(cmd))
+        stdin, stdout = procutil.popen2(cmd)
         stdin.write(arg)
         try:
             stdin.close()
--- a/hgext/extdiff.py	Fri May 29 03:43:08 2020 +0200
+++ b/hgext/extdiff.py	Fri May 29 03:56:07 2020 +0200
@@ -233,7 +233,6 @@
     ''' like 'procutil.system', but returns the Popen object directly
         so we don't have to wait on it.
     '''
-    cmd = procutil.quotecommand(cmd)
     env = procutil.shellenviron(environ)
     proc = subprocess.Popen(
         procutil.tonativestr(cmd),
--- a/mercurial/chgserver.py	Fri May 29 03:43:08 2020 +0200
+++ b/mercurial/chgserver.py	Fri May 29 03:56:07 2020 +0200
@@ -320,7 +320,7 @@
         self.channel = channel
 
     def __call__(self, cmd, environ, cwd=None, type=b'system', cmdtable=None):
-        args = [type, procutil.quotecommand(cmd), os.path.abspath(cwd or b'.')]
+        args = [type, cmd, os.path.abspath(cwd or b'.')]
         args.extend(b'%s=%s' % (k, v) for k, v in pycompat.iteritems(environ))
         data = b'\0'.join(args)
         self.out.write(struct.pack(b'>cI', self.channel, len(data)))
--- a/mercurial/posix.py	Fri May 29 03:43:08 2020 +0200
+++ b/mercurial/posix.py	Fri May 29 03:56:07 2020 +0200
@@ -538,10 +538,6 @@
     return pycompat.shlexsplit(s, posix=True)
 
 
-def quotecommand(cmd):
-    return cmd
-
-
 def testpid(pid):
     '''return False if pid dead, True if running or not sure'''
     if pycompat.sysplatform == b'OpenVMS':
--- a/mercurial/sshpeer.py	Fri May 29 03:43:08 2020 +0200
+++ b/mercurial/sshpeer.py	Fri May 29 03:56:07 2020 +0200
@@ -179,7 +179,6 @@
     )
 
     ui.debug(b'running %s\n' % cmd)
-    cmd = procutil.quotecommand(cmd)
 
     # no buffer allow the use of 'select'
     # feel free to remove buffering and select usage when we ultimately
--- a/mercurial/utils/procutil.py	Fri May 29 03:43:08 2020 +0200
+++ b/mercurial/utils/procutil.py	Fri May 29 03:56:07 2020 +0200
@@ -73,7 +73,6 @@
 getuser = platform.getuser
 getpid = os.getpid
 hidewindow = platform.hidewindow
-quotecommand = platform.quotecommand
 readpipe = platform.readpipe
 setbinary = platform.setbinary
 setsignalhandler = platform.setsignalhandler
@@ -138,7 +137,7 @@
 
 def _popenreader(cmd, bufsize):
     p = subprocess.Popen(
-        tonativestr(quotecommand(cmd)),
+        tonativestr(cmd),
         shell=True,
         bufsize=bufsize,
         close_fds=closefds,
@@ -149,7 +148,7 @@
 
 def _popenwriter(cmd, bufsize):
     p = subprocess.Popen(
-        tonativestr(quotecommand(cmd)),
+        tonativestr(cmd),
         shell=True,
         bufsize=bufsize,
         close_fds=closefds,
@@ -395,7 +394,6 @@
         stdout.flush()
     except Exception:
         pass
-    cmd = quotecommand(cmd)
     env = shellenviron(environ)
     if out is None or isstdout(out):
         rc = subprocess.call(
--- a/mercurial/windows.py	Fri May 29 03:43:08 2020 +0200
+++ b/mercurial/windows.py	Fri May 29 03:56:07 2020 +0200
@@ -474,11 +474,6 @@
     return pycompat.maplist(_unquote, pycompat.shlexsplit(s, posix=False))
 
 
-def quotecommand(cmd):
-    """Build a command string suitable for os.popen* calls."""
-    return cmd
-
-
 # if you change this stub into a real check, please try to implement the
 # username and groupname functions above, too.
 def isowner(st):