diff options
author | Christian Aistleitner <christian@quelltextlich.at> | 2014-04-10 14:30:22 +0200 |
---|---|---|
committer | Christian Aistleitner <christian@quelltextlich.at> | 2014-04-10 14:30:22 +0200 |
commit | 980c5bf9ef4f27cc8d25cb0c4aebf8d54b9cc47f (patch) | |
tree | dd8f3f74419b37bc67c674858dbca54dc5594bb8 | |
parent | cecf90acc1e6926a6cc58b9efcd9eadbd41a9c37 (diff) |
Set uploader to current user in "patchset-created" event upon cherry-picking
When using the web ui (both old and new ChangeScreen) to cherry-pick a
change to a branch that already has this change (e.g.: cherry-picking
on the same branch to get rid of dependencies), the corresponding
patchset-created event had its patchSet.uploader set to the Change's
owner instead of the current user. We now set it to the current user,
so stream-events consumers can properly detect who uploaded the
rebased patch set.
Change-Id: I0613ecae06b7843b8ca0294f83378c3917c26810
-rw-r--r-- | gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java index bf848a6767..a5c7c69c4d 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java @@ -175,7 +175,7 @@ public class CherryPickChange { // The change key exists on the destination branch. The cherry pick // will be added as a new patch set. return insertPatchSet(git, revWalk, destChanges.get(0), patchSetId, - cherryPickCommit, refControl); + cherryPickCommit, refControl, currentUser); } else { // Change key not found on destination branch. We can create a new // change. @@ -192,8 +192,9 @@ public class CherryPickChange { private Change.Id insertPatchSet(Repository git, RevWalk revWalk, Change change, PatchSet.Id patchSetId, RevCommit cherryPickCommit, - RefControl refControl) throws InvalidChangeOperationException, - IOException, OrmException, NoSuchChangeException { + RefControl refControl, IdentifiedUser uploader) + throws InvalidChangeOperationException, IOException, OrmException, + NoSuchChangeException { final PatchSetInserter inserter = patchSetInserterFactory .create(git, revWalk, refControl, currentUser, change, cherryPickCommit); final PatchSet.Id newPatchSetId = inserter.getPatchSetId(); @@ -201,6 +202,7 @@ public class CherryPickChange { inserter .setMessage("Uploaded patch set " + newPatchSetId.get() + ".") .setDraft(current.isDraft()) + .setUploader(uploader.getAccountId()) .insert(); return change.getId(); } |