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

Method streamP4Files

git-p4.py:3302–3346  ·  view source on GitHub ↗

Stream directly from "p4 files" into "git fast-import.

(self, files)

Source from the content-addressed store, hash-verified

3300 self.stream_have_file_info = True
3301
3302 def streamP4Files(self, files):
3303 """Stream directly from "p4 files" into "git fast-import."""
3304
3305 filesForCommit = []
3306 filesToRead = []
3307 filesToDelete = []
3308
3309 for f in files:
3310 filesForCommit.append(f)
3311 if f['action'] in self.delete_actions:
3312 filesToDelete.append(f)
3313 else:
3314 filesToRead.append(f)
3315
3316 # deleted files...
3317 for f in filesToDelete:
3318 self.streamOneP4Deletion(f)
3319
3320 if len(filesToRead) > 0:
3321 self.stream_file = {}
3322 self.stream_contents = []
3323 self.stream_have_file_info = False
3324
3325 # curry self argument
3326 def streamP4FilesCbSelf(entry):
3327 self.streamP4FilesCb(entry)
3328
3329 fileArgs = []
3330 for f in filesToRead:
3331 if 'shelved_cl' in f:
3332 # Handle shelved CLs using the "p4 print file@=N" syntax to print
3333 # the contents
3334 fileArg = f['path'] + encode_text_stream('@={}'.format(f['shelved_cl']))
3335 else:
3336 fileArg = f['path'] + encode_text_stream('#{}'.format(f['rev']))
3337
3338 fileArgs.append(fileArg)
3339
3340 p4CmdList(["-x", "-", "print"],
3341 stdin=fileArgs,
3342 cb=streamP4FilesCbSelf)
3343
3344 # do the last chunk
3345 if 'depotFile' in self.stream_file:
3346 self.streamOneP4File(self.stream_file, self.stream_contents)
3347
3348 def make_email(self, userid):
3349 if userid in self.users:

Callers 1

commitMethod · 0.95

Calls 5

streamOneP4DeletionMethod · 0.95
streamOneP4FileMethod · 0.95
encode_text_streamFunction · 0.85
p4CmdListFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected