[PATCH 1 of 1] Fix shell quoting on p4 conversion

Frank Kingswood frank at kingswood-consulting.co.uk
Mon Jun 14 10:40:47 CDT 2010


# HG changeset patch
# User Frank Kingswood <frank at kingswood-consulting.co.uk>
# Date 1276529916 -3600
# Node ID 0ba0ef1e350ae296366992b4aa7b589e14985ea2
# Parent  285bcf40e04bf8ec0980d3238a4d71e886054ed9
Fix shell quoting on p4 conversion

diff -r 285bcf40e04b -r 0ba0ef1e350a hgext/convert/p4.py
--- a/hgext/convert/p4.py	Fri Jun 11 18:54:10 2010 +0200
+++ b/hgext/convert/p4.py	Mon Jun 14 16:38:36 2010 +0100
@@ -53,7 +53,7 @@
 
     def _parse_view(self, path):
         "Read changes affecting the path"
-        cmd = 'p4 -G changes -s submitted "%s"' % path
+        cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
         stdout = util.popen(cmd, mode='rb')
         for d in loaditer(stdout):
             c = d.get("change", None)
@@ -72,7 +72,7 @@
             else:
                 views = {"//": ""}
         else:
-            cmd = 'p4 -G client -o "%s"' % path
+            cmd = 'p4 -G client -o %s' % util.shellquote(path)
             clientspec = marshal.load(util.popen(cmd, mode='rb'))
 
             views = {}
@@ -148,7 +148,7 @@
         return self.heads
 
     def getfile(self, name, rev):
-        cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev)
+        cmd = 'p4 -G print %s' % util.shellquote("%s#%s"%(self.depotname[name], rev))
         stdout = util.popen(cmd, mode='rb')
 
         mode = None


More information about the Mercurial-devel mailing list