Show More
@@ -196,38 +196,54 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 | stdout = util.popen(cmd, mode='rb') |
|
|||
200 |
|
199 | |||
201 |
|
|
200 | lasterror = None | |
202 | contents = "" |
|
201 | while True: | |
203 | keywords = None |
|
202 | stdout = util.popen(cmd, mode='rb') | |
|
203 | ||||
|
204 | mode = None | |||
|
205 | contents = "" | |||
|
206 | keywords = None | |||
204 |
|
207 | |||
205 | for d in loaditer(stdout): |
|
208 | for d in loaditer(stdout): | |
206 | code = d["code"] |
|
209 | code = d["code"] | |
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") | |
214 | if action in ["purge", "delete", "move/delete"]: |
|
224 | if action in ["purge", "delete", "move/delete"]: | |
215 | return None, None |
|
225 | return None, None | |
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 "") |
|
229 | flags = ((p4type.group(1) or "") | |
220 | if "x" in flags: |
|
230 | + (p4type.group(3) or "")) | |
221 |
|
|
231 | if "x" in flags: | |
222 |
|
|
232 | mode = "x" | |
223 |
|
|
233 | if p4type.group(2) == "symlink": | |
224 |
|
|
234 | mode = "l" | |
225 | keywords = self.re_keywords_old |
|
235 | if "ko" in flags: | |
226 | elif "k" in flags: |
|
236 | keywords = self.re_keywords_old | |
227 |
|
|
237 | elif "k" in flags: | |
|
238 | keywords = self.re_keywords | |||
228 |
|
239 | |||
229 | elif code == "text" or code == "binary": |
|
240 | elif code == "text" or code == "binary": | |
230 | contents += data |
|
241 | contents += data | |
|
242 | ||||
|
243 | lasterror = None | |||
|
244 | ||||
|
245 | if not lasterror: | |||
|
246 | break | |||
231 |
|
247 | |||
232 | if mode is None: |
|
248 | if mode is None: | |
233 | return None, None |
|
249 | return None, None |
General Comments 0
You need to be logged in to leave comments.
Login now