summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2013-01-15 00:46:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-15 17:46:29 (GMT)
commit2c8037edeef9ae6f510335587c04081e58564758 (patch)
tree4b07bcc7ec08260fba2c11afbf25966108953d65 /git-p4.py
parent991a2de45af713ad6476c3d03aefb30ba5599bfe (diff)
downloadgit-2c8037edeef9ae6f510335587c04081e58564758.zip
git-2c8037edeef9ae6f510335587c04081e58564758.tar.gz
git-2c8037edeef9ae6f510335587c04081e58564758.tar.bz2
git p4: add comments to p4BranchesInGit
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/git-p4.py b/git-p4.py
index e912731..de88680 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -547,27 +547,36 @@ def gitConfigList(key):
_gitConfig[key] = read_pipe("git config --get-all %s" % key, ignore_error=True).strip().split(os.linesep)
return _gitConfig[key]
-def p4BranchesInGit(branchesAreInRemotes = True):
+def p4BranchesInGit(branchesAreInRemotes=True):
+ """Find all the branches whose names start with "p4/", looking
+ in remotes or heads as specified by the argument. Return
+ a dictionary of { branch: revision } for each one found.
+ The branch names are the short names, without any
+ "p4/" prefix."""
+
branches = {}
cmdline = "git rev-parse --symbolic "
if branchesAreInRemotes:
- cmdline += " --remotes"
+ cmdline += "--remotes"
else:
- cmdline += " --branches"
+ cmdline += "--branches"
for line in read_pipe_lines(cmdline):
line = line.strip()
- ## only import to p4/
- if not line.startswith('p4/') or line == "p4/HEAD":
+ # only import to p4/
+ if not line.startswith('p4/'):
+ continue
+ # special symbolic ref to p4/master
+ if line == "p4/HEAD":
continue
- branch = line
- # strip off p4
- branch = re.sub ("^p4/", "", line)
+ # strip off p4/ prefix
+ branch = line[len("p4/"):]
branches[branch] = parseRevision(line)
+
return branches
def findUpstreamBranchPoint(head = "HEAD"):