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

Method importNewBranch

git-p4.py:3769–3790  ·  view source on GitHub ↗
(self, branch, maxChange)

Source from the content-addressed store, hash-verified

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
3771 # command so that we can try to find the branch parent in the git history
3772 self.gitStream.write("checkpoint\n\n")
3773 self.gitStream.flush()
3774 branchPrefix = self.depotPaths[0] + branch + "/"
3775 range = "@1,%s" % maxChange
3776 changes = p4ChangesForPaths([branchPrefix], range, self.changes_block_size)
3777 if len(changes) <= 0:
3778 return False
3779 firstChange = changes[0]
3780 sourceBranch = self.knownBranches[branch]
3781 sourceDepotPath = self.depotPaths[0] + sourceBranch
3782 sourceRef = self.gitRefForBranch(sourceBranch)
3783
3784 branchParentChange = int(p4Cmd(["changes", "-m", "1", "%s...@1,%s" % (sourceDepotPath, firstChange)])["change"])
3785 gitParent = self.gitCommitByP4Change(sourceRef, branchParentChange)
3786 if len(gitParent) > 0:
3787 self.initialParents[self.gitRefForBranch(branch)] = gitParent
3788
3789 self.importChanges(changes)
3790 return True
3791
3792 def searchParent(self, parent, branch, target):
3793 targetTree = read_pipe(["git", "rev-parse",

Callers 1

importChangesMethod · 0.95

Calls 7

gitRefForBranchMethod · 0.95
gitCommitByP4ChangeMethod · 0.95
importChangesMethod · 0.95
p4ChangesForPathsFunction · 0.85
p4CmdFunction · 0.85
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected