diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-03 14:08:12 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-03 14:08:12 -0700 |
commit | e61f75fe19250f96003357b3568d81d0e3cf5cc2 (patch) | |
tree | c7e621a469f055bbff365bd2f2c2cbfbd7128c6d /git-p4.py | |
parent | Merge branch 'en/merge-fixes' (diff) | |
parent | git-p4: add P4 jobs to git commit message (diff) | |
download | tgif-e61f75fe19250f96003357b3568d81d0e3cf5cc2.tar.xz |
Merge branch 'jd/p4-jobs-in-commit'
"git p4" learned to record P4 jobs in Git commit that imports from
the history in Perforce.
* jd/p4-jobs-in-commit:
git-p4: add P4 jobs to git commit message
git-p4: clean-up code style in tests
Diffstat (limited to 'git-p4.py')
-rwxr-xr-x | git-p4.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -2320,6 +2320,15 @@ class P4Sync(Command, P4UserMap): fnum = fnum + 1 return files + def extractJobsFromCommit(self, commit): + jobs = [] + jnum = 0 + while commit.has_key("job%s" % jnum): + job = commit["job%s" % jnum] + jobs.append(job) + jnum = jnum + 1 + return jobs + def stripRepoPath(self, path, prefixes): """When streaming files, this is called to map a p4 depot path to where it should go in git. The prefixes are either @@ -2665,6 +2674,7 @@ class P4Sync(Command, P4UserMap): def commit(self, details, files, branch, parent = ""): epoch = details["time"] author = details["user"] + jobs = self.extractJobsFromCommit(details) if self.verbose: print('commit into {0}'.format(branch)) @@ -2692,6 +2702,8 @@ class P4Sync(Command, P4UserMap): self.gitStream.write("data <<EOT\n") self.gitStream.write(details["desc"]) + if len(jobs) > 0: + self.gitStream.write("\nJobs: %s" % (' '.join(jobs))) self.gitStream.write("\n[git-p4: depot-paths = \"%s\": change = %s" % (','.join(self.branchPrefixes), details["change"])) if len(details['options']) > 0: |