MCPcopy Index your code
hub / github.com/git/git / gitCommitByP4Change

Method gitCommitByP4Change

git-p4.py:3733–3767  ·  view source on GitHub ↗
(self, ref, change)

Source from the content-addressed store, hash-verified

3731 return self.refPrefix + self.projectName + branch
3732
3733 def gitCommitByP4Change(self, ref, change):
3734 if self.verbose:
3735 print("looking in ref " + ref + " for change %s using bisect..." % change)
3736
3737 earliestCommit = ""
3738 latestCommit = parseRevision(ref)
3739
3740 while True:
3741 if self.verbose:
3742 print("trying: earliest %s latest %s" % (earliestCommit, latestCommit))
3743 next = read_pipe(["git", "rev-list", "--bisect",
3744 latestCommit, earliestCommit]).strip()
3745 if len(next) == 0:
3746 if self.verbose:
3747 print("argh")
3748 return ""
3749 log = extractLogMessageFromGitCommit(next)
3750 settings = extractSettingsGitLog(log)
3751 currentChange = int(settings['change'])
3752 if self.verbose:
3753 print("current change %s" % currentChange)
3754
3755 if currentChange == change:
3756 if self.verbose:
3757 print("found %s" % next)
3758 return next
3759
3760 if currentChange < change:
3761 earliestCommit = "^%s" % next
3762 else:
3763 if next == latestCommit:
3764 die("Infinite loop while looking in ref %s for change %s. Check your branch mappings" % (ref, change))
3765 latestCommit = "%s^@" % next
3766
3767 return ""
3768
3769 def importNewBranch(self, branch, maxChange):
3770 # make fast-import flush all changes to disk and update the refs using the checkpoint

Callers 1

importNewBranchMethod · 0.95

Calls 5

parseRevisionFunction · 0.85
read_pipeFunction · 0.85
extractSettingsGitLogFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected