Skip to content

Commit 09d89de

Browse files
committed
Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: Simon Hausmann <[email protected]>
1 parent 1a2edf4 commit 09d89de

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,31 @@ class P4Clone(P4Sync):
14651465

14661466
return True
14671467

1468+
class P4Branches(Command):
1469+
def __init__(self):
1470+
Command.__init__(self)
1471+
self.options = [ ]
1472+
self.description = ("Shows the git branches that hold imports and their "
1473+
+ "corresponding perforce depot paths")
1474+
self.verbose = False
1475+
1476+
def run(self, args):
1477+
cmdline = "git rev-parse --symbolic "
1478+
cmdline += " --remotes"
1479+
1480+
for line in read_pipe_lines(cmdline):
1481+
line = line.strip()
1482+
1483+
if not line.startswith('p4/') or line == "p4/HEAD":
1484+
continue
1485+
branch = line
1486+
1487+
log = extractLogMessageFromGitCommit("refs/remotes/%s" % branch)
1488+
settings = extractSettingsGitLog(log)
1489+
1490+
print "%s <= %s (%s)" % (branch, ",".join(settings["depot-paths"]), settings["change"])
1491+
return True
1492+
14681493
class HelpFormatter(optparse.IndentedHelpFormatter):
14691494
def __init__(self):
14701495
optparse.IndentedHelpFormatter.__init__(self)
@@ -1489,7 +1514,8 @@ commands = {
14891514
"sync" : P4Sync,
14901515
"rebase" : P4Rebase,
14911516
"clone" : P4Clone,
1492-
"rollback" : P4RollBack
1517+
"rollback" : P4RollBack,
1518+
"branches" : P4Branches
14931519
}
14941520

14951521

0 commit comments

Comments
 (0)