提交 09d89de2 编写于 作者: S Simon Hausmann

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

Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: NSimon Hausmann <simon@lst.de>
上级 1a2edf4e
...@@ -1465,6 +1465,31 @@ class P4Clone(P4Sync): ...@@ -1465,6 +1465,31 @@ class P4Clone(P4Sync):
return True return True
class P4Branches(Command):
def __init__(self):
Command.__init__(self)
self.options = [ ]
self.description = ("Shows the git branches that hold imports and their "
+ "corresponding perforce depot paths")
self.verbose = False
def run(self, args):
cmdline = "git rev-parse --symbolic "
cmdline += " --remotes"
for line in read_pipe_lines(cmdline):
line = line.strip()
if not line.startswith('p4/') or line == "p4/HEAD":
continue
branch = line
log = extractLogMessageFromGitCommit("refs/remotes/%s" % branch)
settings = extractSettingsGitLog(log)
print "%s <= %s (%s)" % (branch, ",".join(settings["depot-paths"]), settings["change"])
return True
class HelpFormatter(optparse.IndentedHelpFormatter): class HelpFormatter(optparse.IndentedHelpFormatter):
def __init__(self): def __init__(self):
optparse.IndentedHelpFormatter.__init__(self) optparse.IndentedHelpFormatter.__init__(self)
...@@ -1489,7 +1514,8 @@ commands = { ...@@ -1489,7 +1514,8 @@ commands = {
"sync" : P4Sync, "sync" : P4Sync,
"rebase" : P4Rebase, "rebase" : P4Rebase,
"clone" : P4Clone, "clone" : P4Clone,
"rollback" : P4RollBack "rollback" : P4RollBack,
"branches" : P4Branches
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册