(head="HEAD")
| 1178 | |
| 1179 | |
| 1180 | def findUpstreamBranchPoint(head="HEAD"): |
| 1181 | branches = p4BranchesInGit() |
| 1182 | # map from depot-path to branch name |
| 1183 | branchByDepotPath = {} |
| 1184 | for branch in branches.keys(): |
| 1185 | tip = branches[branch] |
| 1186 | log = extractLogMessageFromGitCommit(tip) |
| 1187 | settings = extractSettingsGitLog(log) |
| 1188 | if "depot-paths" in settings: |
| 1189 | git_branch = "remotes/p4/" + branch |
| 1190 | paths = ",".join(settings["depot-paths"]) |
| 1191 | branchByDepotPath[paths] = git_branch |
| 1192 | if "change" in settings: |
| 1193 | paths = paths + ";" + settings["change"] |
| 1194 | branchByDepotPath[paths] = git_branch |
| 1195 | |
| 1196 | settings = None |
| 1197 | parent = 0 |
| 1198 | while parent < 65535: |
| 1199 | commit = head + "~%s" % parent |
| 1200 | log = extractLogMessageFromGitCommit(commit) |
| 1201 | settings = extractSettingsGitLog(log) |
| 1202 | if "depot-paths" in settings: |
| 1203 | paths = ",".join(settings["depot-paths"]) |
| 1204 | if "change" in settings: |
| 1205 | expaths = paths + ";" + settings["change"] |
| 1206 | if expaths in branchByDepotPath: |
| 1207 | return [branchByDepotPath[expaths], settings] |
| 1208 | if paths in branchByDepotPath: |
| 1209 | return [branchByDepotPath[paths], settings] |
| 1210 | |
| 1211 | parent = parent + 1 |
| 1212 | |
| 1213 | return ["", settings] |
| 1214 | |
| 1215 | |
| 1216 | def createOrUpdateBranchesFromOrigin(localRefPrefix="refs/remotes/p4/", silent=True): |
no test coverage detected