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

Method stripRepoPath

git-p4.py:3032–3062  ·  view source on GitHub ↗

When streaming files, this is called to map a p4 depot path to where it should go in git. The prefixes are either self.depotPaths, or self.branchPrefixes in the case of branch detection.

(self, path, prefixes)

Source from the content-addressed store, hash-verified

3030 return jobs
3031
3032 def stripRepoPath(self, path, prefixes):
3033 """When streaming files, this is called to map a p4 depot path to where
3034 it should go in git. The prefixes are either self.depotPaths, or
3035 self.branchPrefixes in the case of branch detection.
3036 """
3037
3038 if self.useClientSpec:
3039 # branch detection moves files up a level (the branch name)
3040 # from what client spec interpretation gives
3041 path = decode_path(self.clientSpecDirs.map_in_client(path))
3042 if self.detectBranches:
3043 for b in self.knownBranches:
3044 if p4PathStartsWith(path, b + "/"):
3045 path = path[len(b)+1:]
3046
3047 elif self.keepRepoPath:
3048 # Preserve everything in relative path name except leading
3049 # //depot/; just look at first prefix as they all should
3050 # be in the same depot.
3051 depot = re.sub(r"^(//[^/]+/).*", r'\1', prefixes[0])
3052 if p4PathStartsWith(path, depot):
3053 path = path[len(depot):]
3054
3055 else:
3056 for p in prefixes:
3057 if p4PathStartsWith(path, p):
3058 path = path[len(p):]
3059 break
3060
3061 path = wildcard_decode(path)
3062 return path
3063
3064 def splitFilesIntoBranches(self, commit):
3065 """Look at each depotFile in the commit to figure out to what branch it

Callers 3

streamOneP4FileMethod · 0.95
streamOneP4DeletionMethod · 0.95

Calls 4

decode_pathFunction · 0.85
p4PathStartsWithFunction · 0.85
wildcard_decodeFunction · 0.85
map_in_clientMethod · 0.80

Tested by

no test coverage detected