-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nag to close leave-open bugs only when no deps or deps are all closed #850
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,8 @@ | |||||||||||||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||||||||||||||||||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||||||||||||||||||
|
||||||||||||||||||
from libmozdata.bugzilla import Bugzilla | ||||||||||||||||||
|
||||||||||||||||||
from auto_nag import utils | ||||||||||||||||||
from auto_nag.bzcleaner import BzCleaner | ||||||||||||||||||
from auto_nag.people import People | ||||||||||||||||||
|
@@ -40,8 +42,39 @@ def get_mail_to_auto_ni(self, bug): | |||||||||||||||||
|
||||||||||||||||||
return None | ||||||||||||||||||
|
||||||||||||||||||
def handle_bug(self, bug, data): | ||||||||||||||||||
bugid = str(bug["id"]) | ||||||||||||||||||
data[bugid] = {"id": bugid, "depends_on": bug["depends_on"]} | ||||||||||||||||||
return bug | ||||||||||||||||||
|
||||||||||||||||||
def filter_deps(self, bugs): | ||||||||||||||||||
def handler(bug, data): | ||||||||||||||||||
if bug["resolution"] == "": | ||||||||||||||||||
data.add(bug["id"]) | ||||||||||||||||||
|
||||||||||||||||||
bugids = set() | ||||||||||||||||||
for info in bugs.values(): | ||||||||||||||||||
bugids.update(info["depends_on"]) | ||||||||||||||||||
bugids = list(bugids) | ||||||||||||||||||
Comment on lines
+55
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
Comment on lines
+55
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you rename the variable |
||||||||||||||||||
open_bugs = set() | ||||||||||||||||||
|
||||||||||||||||||
Bugzilla( | ||||||||||||||||||
bugids=bugids, | ||||||||||||||||||
include_fields=["id", "resolution"], | ||||||||||||||||||
bughandler=handler, | ||||||||||||||||||
bugdata=open_bugs, | ||||||||||||||||||
).get_data().wait() | ||||||||||||||||||
|
||||||||||||||||||
to_fix = {} | ||||||||||||||||||
for bugid, info in bugs.items(): | ||||||||||||||||||
deps = set(info["depends_on"]) | ||||||||||||||||||
if not (deps & open_bugs): | ||||||||||||||||||
to_fix[bugid] = info | ||||||||||||||||||
|
||||||||||||||||||
return to_fix | ||||||||||||||||||
Comment on lines
+68
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
def get_bz_params(self, date): | ||||||||||||||||||
fields = ["assigned_to", "triage_owner"] | ||||||||||||||||||
fields = ["assigned_to", "triage_owner", "depends_on"] | ||||||||||||||||||
params = { | ||||||||||||||||||
"include_fields": fields, | ||||||||||||||||||
"resolution": "---", | ||||||||||||||||||
|
@@ -61,6 +94,12 @@ def get_bz_params(self, date): | |||||||||||||||||
|
||||||||||||||||||
return params | ||||||||||||||||||
|
||||||||||||||||||
def get_bugs(self, date="today", bug_ids=[]): | ||||||||||||||||||
bugs = super(LeaveOpenNoActivity, self).get_bugs(date=date, bug_ids=bug_ids) | ||||||||||||||||||
bugs = self.filter_deps(bugs) | ||||||||||||||||||
|
||||||||||||||||||
return bugs | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
if __name__ == "__main__": | ||||||||||||||||||
LeaveOpenNoActivity().run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could filter out closed bugs at query time directly