git p4: add comments to p4BranchesInGit
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
991a2de45a
commit
2c8037edee
25
git-p4.py
25
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)
|
_gitConfig[key] = read_pipe("git config --get-all %s" % key, ignore_error=True).strip().split(os.linesep)
|
||||||
return _gitConfig[key]
|
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 = {}
|
branches = {}
|
||||||
|
|
||||||
cmdline = "git rev-parse --symbolic "
|
cmdline = "git rev-parse --symbolic "
|
||||||
if branchesAreInRemotes:
|
if branchesAreInRemotes:
|
||||||
cmdline += " --remotes"
|
cmdline += "--remotes"
|
||||||
else:
|
else:
|
||||||
cmdline += " --branches"
|
cmdline += "--branches"
|
||||||
|
|
||||||
for line in read_pipe_lines(cmdline):
|
for line in read_pipe_lines(cmdline):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
||||||
## only import to p4/
|
# only import to p4/
|
||||||
if not line.startswith('p4/') or line == "p4/HEAD":
|
if not line.startswith('p4/'):
|
||||||
|
continue
|
||||||
|
# special symbolic ref to p4/master
|
||||||
|
if line == "p4/HEAD":
|
||||||
continue
|
continue
|
||||||
branch = line
|
|
||||||
|
|
||||||
# strip off p4
|
# strip off p4/ prefix
|
||||||
branch = re.sub ("^p4/", "", line)
|
branch = line[len("p4/"):]
|
||||||
|
|
||||||
branches[branch] = parseRevision(line)
|
branches[branch] = parseRevision(line)
|
||||||
|
|
||||||
return branches
|
return branches
|
||||||
|
|
||||||
def findUpstreamBranchPoint(head = "HEAD"):
|
def findUpstreamBranchPoint(head = "HEAD"):
|
||||||
|
Loading…
Reference in New Issue
Block a user