git-p4: support multiple depot paths in p4 submit

When submitting from a repository that was cloned using a client spec, use the full list of paths when ruling out files that are outside the view. This fixes a bug where only files pertaining to the first path would be included in the p4 submit. Signed-off-by: Sam Hocevar <sam@hocevar.net> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sam Hocevar committed Dec 19, 2015 at 09:39 UTC cbc692425cb8824b603da90929909ee8f4a8e0e0
1 file changed +9 -2
git-p4.py
+9 -2
@@ -1458,6 +1458,8 @@ class P4Submit(Command, P4UserMap):
1458 Remove lines in the Files section that show changes to files
1459 outside the depot path we're committing into."""
1460
1461 + [upstream, settings] = findUpstreamBranchPoint()
1462 +
1463 template = ""
1464 inFilesSection = False
1465 for line in p4_read_pipe_lines(['change', '-o']):
@@ -1470,8 +1472,13 @@ class P4Submit(Command, P4UserMap):
1472 lastTab = path.rfind("\t")
1473 if lastTab != -1:
1474 path = path[:lastTab]
1473 - if not p4PathStartsWith(path, self.depotPath):
1474 - continue
1475 + if settings.has_key('depot-paths'):
1476 + if not [p for p in settings['depot-paths']
1477 + if p4PathStartsWith(path, p)]:
1478 + continue
1479 + else:
1480 + if not p4PathStartsWith(path, self.depotPath):
1481 + continue
1482 else:
1483 inFilesSection = False
1484 else: