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

Method run

git-p4.py:4046–4266  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

4044 self.gitStream = None
4045
4046 def run(self, args):
4047 if self.importIntoRemotes:
4048 self.refPrefix = "refs/remotes/p4/"
4049 else:
4050 self.refPrefix = "refs/heads/p4/"
4051
4052 self.sync_origin_only()
4053
4054 branch_arg_given = bool(self.branch)
4055 if len(self.branch) == 0:
4056 self.branch = self.refPrefix + "master"
4057 if gitBranchExists("refs/heads/p4") and self.importIntoRemotes:
4058 system(["git", "update-ref", self.branch, "refs/heads/p4"])
4059 system(["git", "branch", "-D", "p4"])
4060
4061 # accept either the command-line option, or the configuration variable
4062 if self.useClientSpec:
4063 # will use this after clone to set the variable
4064 self.useClientSpec_from_options = True
4065 else:
4066 if gitConfigBool("git-p4.useclientspec"):
4067 self.useClientSpec = True
4068 if self.useClientSpec:
4069 self.clientSpecDirs = getClientSpec()
4070
4071 # TODO: should always look at previous commits,
4072 # merge with previous imports, if possible.
4073 if args == []:
4074 if self.hasOrigin:
4075 createOrUpdateBranchesFromOrigin(self.refPrefix, self.silent)
4076
4077 # branches holds mapping from branch name to sha1
4078 branches = p4BranchesInGit(self.importIntoRemotes)
4079
4080 # restrict to just this one, disabling detect-branches
4081 if branch_arg_given:
4082 short = shortP4Ref(self.branch, self.importIntoRemotes)
4083 if short in branches:
4084 self.p4BranchesInGit = [short]
4085 elif self.branch.startswith('refs/') and \
4086 branchExists(self.branch) and \
4087 '[git-p4:' in extractLogMessageFromGitCommit(self.branch):
4088 self.p4BranchesInGit = [self.branch]
4089 else:
4090 self.p4BranchesInGit = branches.keys()
4091
4092 if len(self.p4BranchesInGit) > 1:
4093 if not self.silent:
4094 print("Importing from/into multiple branches")
4095 self.detectBranches = True
4096 for branch in branches.keys():
4097 self.initialParents[self.refPrefix + branch] = \
4098 branches[branch]
4099
4100 if self.verbose:
4101 print("branches: %s" % self.p4BranchesInGit)
4102
4103 p4Change = 0

Callers 4

runMethod · 0.95
runMethod · 0.95
runMethod · 0.45
mainFunction · 0.45

Calls 15

sync_origin_onlyMethod · 0.95
readOptionsMethod · 0.95
getLabelsMethod · 0.95
guessProjectNameMethod · 0.95
getBranchMappingMethod · 0.95
openStreamsMethod · 0.95
importHeadRevisionMethod · 0.95
importRevisionsMethod · 0.95
importP4LabelsMethod · 0.95
closeStreamsMethod · 0.95
gitBranchExistsFunction · 0.85

Tested by

no test coverage detected