@matheusbsbs / matheus-bagliano / commits / 09d89de2e3
Fork 0

Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.

Signed-off-by: Simon Hausmann <simon@lst.de>

Simon Hausmann committed Jun 20, 2007 at 23:10 UTC 09d89de2e31ed4d62b6ff344e9ad9ef29550121b
1 file changed +27 -1
contrib/fast-import/git-p4
+27 -1
@@ -1465,6 +1465,31 @@ class P4Clone(P4Sync):
1465
1466 return True
1467
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 +
1493 class HelpFormatter(optparse.IndentedHelpFormatter):
1494 def __init__(self):
1495 optparse.IndentedHelpFormatter.__init__(self)
@@ -1489,7 +1514,8 @@ commands = {
1514 "sync" : P4Sync,
1515 "rebase" : P4Rebase,
1516 "clone" : P4Clone,
1492 - "rollback" : P4RollBack
1517 + "rollback" : P4RollBack,
1518 + "branches" : P4Branches
1519 }
1520
1521