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)
| 1131 | return incomingRef |
| 1132 | |
| 1133 | def 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 | |
| 1167 | def branch_exists(branch): |
no test coverage detected