##// END OF EJS Templates
convert: if getting a file from Perforce fails try to get it one more time...
Eugene Baranov -
r25775:220d9ae6 default
parent child Browse files
Show More
@@ -196,6 +196,9 b' class p4_source(converter_source):'
196 def getfile(self, name, rev):
196 def getfile(self, name, rev):
197 cmd = 'p4 -G print %s' \
197 cmd = 'p4 -G print %s' \
198 % util.shellquote("%s#%s" % (self.depotname[name], rev))
198 % util.shellquote("%s#%s" % (self.depotname[name], rev))
199
200 lasterror = None
201 while True:
199 stdout = util.popen(cmd, mode='rb')
202 stdout = util.popen(cmd, mode='rb')
200
203
201 mode = None
204 mode = None
@@ -207,7 +210,14 b' class p4_source(converter_source):'
207 data = d.get("data")
210 data = d.get("data")
208
211
209 if code == "error":
212 if code == "error":
210 raise IOError(d["generic"], data)
213 # if this is the first time error happened
214 # re-attempt getting the file
215 if not lasterror:
216 lasterror = IOError(d["generic"], data)
217 # this will exit inner-most for-loop
218 break
219 else:
220 raise lasterror
211
221
212 elif code == "stat":
222 elif code == "stat":
213 action = d.get("action")
223 action = d.get("action")
@@ -216,7 +226,8 b' class p4_source(converter_source):'
216 p4type = self.re_type.match(d["type"])
226 p4type = self.re_type.match(d["type"])
217 if p4type:
227 if p4type:
218 mode = ""
228 mode = ""
219 flags = (p4type.group(1) or "") + (p4type.group(3) or "")
229 flags = ((p4type.group(1) or "")
230 + (p4type.group(3) or ""))
220 if "x" in flags:
231 if "x" in flags:
221 mode = "x"
232 mode = "x"
222 if p4type.group(2) == "symlink":
233 if p4type.group(2) == "symlink":
@@ -229,6 +240,11 b' class p4_source(converter_source):'
229 elif code == "text" or code == "binary":
240 elif code == "text" or code == "binary":
230 contents += data
241 contents += data
231
242
243 lasterror = None
244
245 if not lasterror:
246 break
247
232 if mode is None:
248 if mode is None:
233 return None, None
249 return None, None
234
250
General Comments 0
You need to be logged in to leave comments. Login now