1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-03 23:36:11 +02:00

git-p4: Fix bug in p4Where method.

When running:

p4 where //depot/SomePath/...

The result can in some situations look like:

//depot/SomePath/... //client/SomePath/... /home/user/p4root/SomePath/...
-//depot/SomePath/UndesiredSubdir/... //client/SomePath/UndesiredSubdir/... /home/user/p4root/SomePath/UndesiredSubdir/...

This depends on the users Client view. The current p4Where method will now
return /home/user/p4root/SomePath/UndesiredSubdir/... which is not what we
want. This patch loops through the results from "p4 where", and picks the one
where the depotFile exactly matches the given depotPath (//depot/SomePath/...
in this example).

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Tor Arvid Lund 2008-12-04 14:37:33 +01:00 committed by Junio C Hamano
parent 304dcf262e
commit 7f705dc368

View File

@ -245,7 +245,15 @@ def p4Cmd(cmd):
def p4Where(depotPath):
if not depotPath.endswith("/"):
depotPath += "/"
output = p4Cmd("where %s..." % depotPath)
depotPath = depotPath + "..."
outputList = p4CmdList("where %s" % depotPath)
output = None
for entry in outputList:
if entry["depotFile"] == depotPath:
output = entry
break
if output == None:
return ""
if output["code"] == "error":
return ""
clientPath = ""