Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git p4: add comments to p4BranchesInGit
author
Pete Wyckoff
<pw@padd.com>
Tue, 15 Jan 2013 00:46:57 +0000
(19:46 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 15 Jan 2013 17:46:29 +0000
(09:46 -0800)
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
991a2de
)
diff --git
a/git-p4.py
b/git-p4.py
index e9127319d4620d27ac148412bed0b12b1fdae2bc..de88680f2c5ada77d395f3cf0a2ac76da25ef98f 100755
(executable)
--- 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]
_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:
branches = {}
cmdline = "git rev-parse --symbolic "
if branchesAreInRemotes:
- cmdline += "
--remotes"
+ cmdline += "--remotes"
else:
else:
- cmdline += "
--branches"
+ cmdline += "--branches"
for line in read_pipe_lines(cmdline):
line = line.strip()
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
continue
- branch = line
- # strip off p4
- branch =
re.sub ("^p4/", "", line)
+ # strip off p4
/ prefix
+ branch =
line[len("p4/"):]
branches[branch] = parseRevision(line)
branches[branch] = parseRevision(line)
+
return branches
def findUpstreamBranchPoint(head = "HEAD"):
return branches
def findUpstreamBranchPoint(head = "HEAD"):