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

Method splitFilesIntoBranches

git-p4.py:3064–3106  ·  view source on GitHub ↗

Look at each depotFile in the commit to figure out to what branch it belongs.

(self, commit)

Source from the content-addressed store, hash-verified

3062 return path
3063
3064 def splitFilesIntoBranches(self, commit):
3065 """Look at each depotFile in the commit to figure out to what branch it
3066 belongs.
3067 """
3068
3069 if self.clientSpecDirs:
3070 files = self.extractFilesFromCommit(commit)
3071 self.clientSpecDirs.update_client_spec_path_cache(files)
3072
3073 branches = {}
3074 fnum = 0
3075 while "depotFile%s" % fnum in commit:
3076 raw_path = commit["depotFile%s" % fnum]
3077 path = decode_path(raw_path)
3078 found = self.isPathWanted(path)
3079 if not found:
3080 fnum = fnum + 1
3081 continue
3082
3083 file = {}
3084 file["path"] = raw_path
3085 file["rev"] = commit["rev%s" % fnum]
3086 file["action"] = commit["action%s" % fnum]
3087 file["type"] = commit["type%s" % fnum]
3088 fnum = fnum + 1
3089
3090 # start with the full relative path where this file would
3091 # go in a p4 client
3092 if self.useClientSpec:
3093 relPath = decode_path(self.clientSpecDirs.map_in_client(path))
3094 else:
3095 relPath = self.stripRepoPath(path, self.depotPaths)
3096
3097 for branch in self.knownBranches.keys():
3098 # add a trailing slash so that a commit into qt/4.2foo
3099 # doesn't end up in qt/4.2, e.g.
3100 if p4PathStartsWith(relPath, branch + "/"):
3101 if branch not in branches:
3102 branches[branch] = []
3103 branches[branch].append(file)
3104 break
3105
3106 return branches
3107
3108 def writeToGitStream(self, gitMode, relPath, contents):
3109 self.gitStream.write(encode_text_stream(u'M {} inline {}\n'.format(gitMode, relPath)))

Callers 1

importChangesMethod · 0.95

Calls 8

isPathWantedMethod · 0.95
stripRepoPathMethod · 0.95
decode_pathFunction · 0.85
p4PathStartsWithFunction · 0.85
map_in_clientMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected