MCPcopy Create free account
hub / github.com/git/git / p4BranchesInGit

Function p4BranchesInGit

git-p4.py:1133–1164  ·  view source on GitHub ↗

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.

(branchesAreInRemotes=True)

Source from the content-addressed store, hash-verified

1131 return incomingRef
1132
1133def p4BranchesInGit(branchesAreInRemotes=True):
1134 """Find all the branches whose names start with "p4/", looking
1135 in remotes or heads as specified by the argument. Return
1136 a dictionary of { branch: revision } for each one found.
1137 The branch names are the short names, without any
1138 "p4/" prefix.
1139 """
1140
1141 branches = {}
1142
1143 cmdline = ["git", "rev-parse", "--symbolic"]
1144 if branchesAreInRemotes:
1145 cmdline.append("--remotes")
1146 else:
1147 cmdline.append("--branches")
1148
1149 for line in read_pipe_lines(cmdline):
1150 line = line.strip()
1151
1152 # only import to p4/
1153 if not line.startswith('p4/'):
1154 continue
1155 # special symbolic ref to p4/master
1156 if line == "p4/HEAD":
1157 continue
1158
1159 # strip off p4/ prefix
1160 branch = line[len("p4/"):]
1161
1162 branches[branch] = parseRevision(line)
1163
1164 return branches
1165
1166
1167def branch_exists(branch):

Callers 4

findUpstreamBranchPointFunction · 0.85
runMethod · 0.85
runMethod · 0.85

Calls 3

read_pipe_linesFunction · 0.85
parseRevisionFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected