comparison hgext/convert/p4.py @ 11347:18680b0e20a7

Fix shell quoting on p4 conversion
author Frank Kingswood <frank@kingswood-consulting.co.uk>
date Mon, 14 Jun 2010 16:38:36 +0100
parents 33010ff1fd6f
children ad0a334eef16
comparison
equal deleted inserted replaced
11346:e740f36cfb4b 11347:18680b0e20a7
51 51
52 self._parse(ui, path) 52 self._parse(ui, path)
53 53
54 def _parse_view(self, path): 54 def _parse_view(self, path):
55 "Read changes affecting the path" 55 "Read changes affecting the path"
56 cmd = 'p4 -G changes -s submitted "%s"' % path 56 cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
57 stdout = util.popen(cmd, mode='rb') 57 stdout = util.popen(cmd, mode='rb')
58 for d in loaditer(stdout): 58 for d in loaditer(stdout):
59 c = d.get("change", None) 59 c = d.get("change", None)
60 if c: 60 if c:
61 self.p4changes[c] = True 61 self.p4changes[c] = True
70 if path.startswith("//") and path.endswith("/..."): 70 if path.startswith("//") and path.endswith("/..."):
71 views = {path[:-3]:""} 71 views = {path[:-3]:""}
72 else: 72 else:
73 views = {"//": ""} 73 views = {"//": ""}
74 else: 74 else:
75 cmd = 'p4 -G client -o "%s"' % path 75 cmd = 'p4 -G client -o %s' % util.shellquote(path)
76 clientspec = marshal.load(util.popen(cmd, mode='rb')) 76 clientspec = marshal.load(util.popen(cmd, mode='rb'))
77 77
78 views = {} 78 views = {}
79 for client in clientspec: 79 for client in clientspec:
80 if client.startswith("View"): 80 if client.startswith("View"):
146 146
147 def getheads(self): 147 def getheads(self):
148 return self.heads 148 return self.heads
149 149
150 def getfile(self, name, rev): 150 def getfile(self, name, rev):
151 cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev) 151 cmd = 'p4 -G print %s' % util.shellquote("%s#%s"%(self.depotname[name], rev))
152 stdout = util.popen(cmd, mode='rb') 152 stdout = util.popen(cmd, mode='rb')
153 153
154 mode = None 154 mode = None
155 contents = "" 155 contents = ""
156 keywords = None 156 keywords = None