Merge branch 'va/p4-client-path'

git p4 attempts to better handle branches in Perforce.

* va/p4-client-path:
  git-p4: improve client path detection when branches are used
  t9801: check git-p4's branch detection with client spec enabled
This commit is contained in:
Junio C Hamano
2015-05-11 14:23:48 -07:00
2 changed files with 115 additions and 4 deletions

View File

@ -502,12 +502,14 @@ def p4Cmd(cmd):
def p4Where(depotPath):
if not depotPath.endswith("/"):
depotPath += "/"
depotPath = depotPath + "..."
outputList = p4CmdList(["where", depotPath])
depotPathLong = depotPath + "..."
outputList = p4CmdList(["where", depotPathLong])
output = None
for entry in outputList:
if "depotFile" in entry:
if entry["depotFile"] == depotPath:
# Search for the base client side depot path, as long as it starts with the branch's P4 path.
# The base path always ends with "/...".
if entry["depotFile"].find(depotPath) == 0 and entry["depotFile"][-4:] == "/...":
output = entry
break
elif "data" in entry:
@ -1653,7 +1655,10 @@ class P4Submit(Command, P4UserMap):
if self.useClientSpec:
self.clientSpecDirs = getClientSpec()
if self.useClientSpec:
# Check for the existance of P4 branches
branchesDetected = (len(p4BranchesInGit().keys()) > 1)
if self.useClientSpec and not branchesDetected:
# all files are relative to the client spec
self.clientPath = getClientRoot()
else: