From f39c35d0a40c37dd7aa97a4acd2381a8f969872c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 15 2018 13:07:16 +0000 Subject: [PATCH 1/2] Send dedicated notifications when a PR is updated or rebased Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 585214d..83d5cb6 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -1935,6 +1935,7 @@ def diff_pull_request( ): request.merge_status = None if request.commit_start: + pr_action = "updated" new_commits_count = 0 commenttext = "" for i in diff_commits: @@ -1959,6 +1960,7 @@ def diff_pull_request( request.commit_start and request.commit_start != first_commit.oid.hex ): + pr_action = "rebased" commenttext = "rebased onto %s" % first_commit.oid.hex request.commit_start = first_commit.oid.hex request.commit_stop = diff_commits[0].oid.hex @@ -1975,6 +1977,16 @@ def diff_pull_request( if commenttext: tasks.link_pr_to_ticket.delay(request.uid) if notify: + if pr_action: + pagure.lib.notify.log( + request.project, + topic="pull-request.%s" % pr_action, + msg=dict( + pullrequest=request.to_json( + with_comments=False, public=True), + agent='pagure', + ), + ) pagure.lib.query.add_pull_request_comment( session, request, From 7bd0fa98d46e27b2418d80d9e3fad80bcd774d6e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 15 2018 13:07:16 +0000 Subject: [PATCH 2/2] Load the Pagure CI plugin so project.ci_hook is accessible Without this the worker fails to access this attribute and the method fails. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/query.py b/pagure/lib/query.py index 236e305..19c1167 100644 --- a/pagure/lib/query.py +++ b/pagure/lib/query.py @@ -1360,6 +1360,9 @@ def add_pull_request_comment( # Send notification to the CI server, if the comment added was a # notification and the PR is still open and project is not private + ci_hook = pagure.lib.plugins.get_plugin("Pagure CI") + ci_hook.db_object() + ci_triggered = False if ( notification