git-p4: Fix regression in p4Where method.
Unfortunately, I introduced a bug in commit 7f705dc36 (git-p4: Fix bug in p4Where method). This happens because sometimes the result from "p4 where <somepath>" doesn't contain a "depotFile" key, but instead a "data" key that needs further parsing. This commit should ensure that both of these cases are checked. Signed-off-by: Tor Arvid Lund <torarvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tor Arvid Lund committed
Dec 9, 2008 at 16:41 UTC
75bc9573b0e332c34bc1c3d97306077fda573083
1 file changed
+10
-3
contrib/fast-import/git-p4
+10
-3
@@ -249,9 +249,16 @@ def p4Where(depotPath):
249
outputList = p4CmdList("where %s" % depotPath)
250
output = None
251
for entry in outputList:
252
- if entry["depotFile"] == depotPath:
253
- output = entry
254
- break
252
+ if "depotFile" in entry:
253
+ if entry["depotFile"] == depotPath:
254
+ output = entry
255
+ break
256
+ elif "data" in entry:
257
+ data = entry.get("data")
258
+ space = data.find(" ")
259
+ if data[:space] == depotPath:
260
+ output = entry
261
+ break
262
if output == None:
263
return ""
264
if output["code"] == "error":