summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-11 14:23:48 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-11 14:23:48 -0700
commit04959836795da4c82bc9b12bebdfb294ea12943f (patch)
tree1e8ddc2a9abb9ccc9fedc49777047aebb30069e9 /git-p4.py
parent331fe94fedb40851de29f0954026c705118102b3 (diff)
parentcd88410618d9068f17ba5de0f9959e4ec4f42789 (diff)
downloadgit-04959836795da4c82bc9b12bebdfb294ea12943f.tar.gz
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
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/git-p4.py b/git-p4.py
index a57a28f4ba..41a77e6648 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -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: