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

@@ -36,7 +36,7 @@ comment-added
This is called whenever a comment is added to a change.
====
comment-added --change <change id> --project <project name> --branch <branch> --author <comment author> --comment <comment> [--<approval category id> <score> --<approval category id> <score> ...]
comment-added --change <change id> --project <project name> --branch <branch> --author <comment author> --commit <commit> --comment <comment> [--<approval category id> <score> --<approval category id> <score> ...]
====
change-merged

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);
}
}

View File

@@ -208,7 +208,7 @@ public class ApproveCommand extends BaseCommand {
ChangeUtil.touch(change, db);
sendMail(change, change.currentPatchSetId(), cm);
hooks.doCommentAddedHook(change, currentUser.getAccount(), changeComment,
hooks.doCommentAddedHook(change, currentUser.getAccount(), db.patchSets().get(patchSetId), changeComment,
approvalsMap);
}