Add --commit to comment-added as there was previously no way to know which change was being commented on.

This commit is contained in:
Shane Mc Cormack
2010-01-25 00:28:58 +00:00
parent 891a8f9829
commit 0681f2460a
4 changed files with 7 additions and 4 deletions

View File

@@ -142,11 +142,12 @@ public class ChangeHookRunner {
* Fire the Comment Added Hook.
*
* @param change The change itself.
* @param patchSet The patchset this comment is related to.
* @param account The gerrit user who commited the change.
* @param comment The comment given.
* @param approvals Map of Approval Categories and Scores
*/
public void doCommentAddedHook(final Change change, final Account account, final String comment, final Map<ApprovalCategory.Id, ApprovalCategoryValue.Id> approvals) {
public void doCommentAddedHook(final Change change, final Account account, final PatchSet patchSet, final String comment, final Map<ApprovalCategory.Id, ApprovalCategoryValue.Id> approvals) {
final List<String> args = new ArrayList<String>();
args.add(commentAddedHook.getAbsolutePath());
@@ -158,6 +159,8 @@ public class ChangeHookRunner {
args.add(change.getDest().getShortName());
args.add("--author");
args.add(getDisplayName(account));
args.add("--commit");
args.add(patchSet.getRevision().get());
args.add("--comment");
args.add(comment == null ? "" : comment);
for (Map.Entry<ApprovalCategory.Id, ApprovalCategoryValue.Id> approval : approvals.entrySet()) {

View File

@@ -291,6 +291,6 @@ public class PublishComments implements Callable<VoidResult> {
changed.put(v.getParentKey(), v);
}
hooks.doCommentAddedHook(change, user.getAccount(), messageText, changed);
hooks.doCommentAddedHook(change, user.getAccount(), patchSet, messageText, changed);
}
}