A client view can be used to remap folder locations in the workspace. To support this when branch detection is enabled it is necessary to get the client path through "p4 where". This patch does two things to achieve this: 1. Force usage of "p4 where" when P4 branches exist in the git repository. 2. Search for mappings that contain the depot path, instead of requiring an exact match. Signed-off-by: Vitor Antunes <vitor.hda@xxxxxxxxx> --- git-p4.py | 11 +++++++---- t/t9801-git-p4-branch.sh | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/git-p4.py b/git-p4.py index 549022e..6954549 100755 --- a/git-p4.py +++ b/git-p4.py @@ -502,12 +502,12 @@ 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: + if entry["depotFile"].find(depotPath) >= 0: output = entry break elif "data" in entry: @@ -1627,7 +1627,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: diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh index 2f0361a..4fe4e18 100755 --- a/t/t9801-git-p4-branch.sh +++ b/t/t9801-git-p4-branch.sh @@ -585,7 +585,7 @@ test_expect_success 'git p4 clone simple branches with base folder on server sid ' # Now update a file in one of the branches in git and submit to P4 -test_expect_failure 'Update a file in git side and submit to P4 using client view' ' +test_expect_success 'Update a file in git side and submit to P4 using client view' ' test_when_finished cleanup_git && ( cd "$git" && -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html