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

Method commit

git-p4.py:3448–3536  ·  view source on GitHub ↗
(self, details, files, branch, parent="", allow_empty=False)

Source from the content-addressed store, hash-verified

3446 'type': record['headType']})
3447
3448 def commit(self, details, files, branch, parent="", allow_empty=False):
3449 epoch = details["time"]
3450 author = details["user"]
3451 jobs = self.extractJobsFromCommit(details)
3452
3453 if self.verbose:
3454 print('commit into {0}'.format(branch))
3455
3456 files = [f for f in files
3457 if self.hasBranchPrefix(decode_path(f['path']))]
3458 self.findShadowedFiles(files, details['change'])
3459
3460 if self.clientSpecDirs:
3461 self.clientSpecDirs.update_client_spec_path_cache(files)
3462
3463 files = [f for f in files if self.inClientSpec(decode_path(f['path']))]
3464
3465 if gitConfigBool('git-p4.keepEmptyCommits'):
3466 allow_empty = True
3467
3468 if not files and not allow_empty:
3469 print('Ignoring revision {0} as it would produce an empty commit.'
3470 .format(details['change']))
3471 return
3472
3473 self.gitStream.write("commit %s\n" % branch)
3474 self.gitStream.write("mark :%s\n" % details["change"])
3475 self.committedChanges.add(int(details["change"]))
3476 if author not in self.users:
3477 self.getUserMapFromPerforceServer()
3478
3479 self.gitStream.write("committer ")
3480 self.gitStream.write(self.make_email(author))
3481 self.gitStream.write(" %s %s\n" % (epoch, self.tz))
3482
3483 self.gitStream.write("data <<EOT\n")
3484 self.gitStream.write(details["desc"])
3485 if len(jobs) > 0:
3486 self.gitStream.write("\nJobs: %s" % (' '.join(jobs)))
3487
3488 if not self.suppress_meta_comment:
3489 self.gitStream.write("\n[git-p4: depot-paths = \"%s\": change = %s" %
3490 (','.join(self.branchPrefixes), details["change"]))
3491 if len(details['options']) > 0:
3492 self.gitStream.write(": options = %s" % details['options'])
3493 self.gitStream.write("]\n")
3494
3495 self.gitStream.write("EOT\n\n")
3496
3497 if len(parent) > 0:
3498 if self.verbose:
3499 print("parent %s" % parent)
3500 self.gitStream.write("from %s\n" % parent)
3501
3502 self.streamP4Files(files)
3503 self.gitStream.write("\n")
3504
3505 change = int(details["change"])

Callers 5

importChangesMethod · 0.95
importHeadRevisionMethod · 0.95
runMethod · 0.95
createShelveParentMethod · 0.80
odb_transaction_commitFunction · 0.80

Calls 13

extractJobsFromCommitMethod · 0.95
hasBranchPrefixMethod · 0.95
findShadowedFilesMethod · 0.95
inClientSpecMethod · 0.95
make_emailMethod · 0.95
streamP4FilesMethod · 0.95
streamTagMethod · 0.95
decode_pathFunction · 0.85
gitConfigBoolFunction · 0.85
p4CmdListFunction · 0.85

Tested by

no test coverage detected