Skip to content

Commit

Permalink
git-p4: Fix regression in p4Where method.
Browse files Browse the repository at this point in the history
Unfortunately, I introduced a bug in commit 7f705dc (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>
  • Loading branch information
Tor Arvid Lund authored and Junio C Hamano committed Dec 10, 2008
1 parent 29b802a commit 75bc957
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,16 @@ def p4Where(depotPath):
outputList = p4CmdList("where %s" % depotPath)
output = None
for entry in outputList:
if entry["depotFile"] == depotPath:
output = entry
break
if "depotFile" in entry:
if entry["depotFile"] == depotPath:
output = entry
break
elif "data" in entry:
data = entry.get("data")
space = data.find(" ")
if data[:space] == depotPath:
output = entry
break
if output == None:
return ""
if output["code"] == "error":
Expand Down

0 comments on commit 75bc957

Please sign in to comment.