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

Method importChanges

git-p4.py:3806–3887  ·  view source on GitHub ↗
(self, changes, origin_revision=0)

Source from the content-addressed store, hash-verified

3804 return None
3805
3806 def importChanges(self, changes, origin_revision=0):
3807 cnt = 1
3808 for change in changes:
3809 description = p4_describe(change)
3810 self.updateOptionDict(description)
3811
3812 if not self.silent:
3813 sys.stdout.write("\rImporting revision %s (%d%%)" % (
3814 change, (cnt * 100) // len(changes)))
3815 sys.stdout.flush()
3816 cnt = cnt + 1
3817
3818 try:
3819 if self.detectBranches:
3820 branches = self.splitFilesIntoBranches(description)
3821 for branch in branches.keys():
3822 # HACK --hwn
3823 branchPrefix = self.depotPaths[0] + branch + "/"
3824 self.branchPrefixes = [branchPrefix]
3825
3826 parent = ""
3827
3828 filesForCommit = branches[branch]
3829
3830 if self.verbose:
3831 print("branch is %s" % branch)
3832
3833 self.updatedBranches.add(branch)
3834
3835 if branch not in self.createdBranches:
3836 self.createdBranches.add(branch)
3837 parent = self.knownBranches[branch]
3838 if parent == branch:
3839 parent = ""
3840 else:
3841 fullBranch = self.projectName + branch
3842 if fullBranch not in self.p4BranchesInGit:
3843 if not self.silent:
3844 print("\n Importing new branch %s" % fullBranch)
3845 if self.importNewBranch(branch, change - 1):
3846 parent = ""
3847 self.p4BranchesInGit.append(fullBranch)
3848 if not self.silent:
3849 print("\n Resuming with change %s" % change)
3850
3851 if self.verbose:
3852 print("parent determined through known branches: %s" % parent)
3853
3854 branch = self.gitRefForBranch(branch)
3855 parent = self.gitRefForBranch(parent)
3856
3857 if self.verbose:
3858 print("looking for initial parent for %s; current parent is %s" % (branch, parent))
3859
3860 if len(parent) == 0 and branch in self.initialParents:
3861 parent = self.initialParents[branch]
3862 del self.initialParents[branch]
3863

Callers 2

importNewBranchMethod · 0.95
importRevisionsMethod · 0.95

Calls 12

updateOptionDictMethod · 0.95
importNewBranchMethod · 0.95
gitRefForBranchMethod · 0.95
commitMethod · 0.95
checkpointMethod · 0.95
searchParentMethod · 0.95
p4_describeFunction · 0.85
appendMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected