-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathtracking.py
More file actions
129 lines (102 loc) · 3.99 KB
/
tracking.py
File metadata and controls
129 lines (102 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# This Source Code Form is subject to the terms of the Mozilla Public
# 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 bugbot import utils
from bugbot.bzcleaner import BzCleaner
from bugbot.nag_me import Nag
class Tracking(BzCleaner, Nag):
def __init__(self, channel, untouched):
# since it's used in name() we must have it before to call parent ctor
self.untouched = untouched
super(Tracking, self).__init__()
self.channel = channel
self.assignees = {}
if not self.init_versions():
return
self.version = self.versions[self.channel]
def description(self):
if self.untouched:
return (
"Bugs which are tracked in {} and untouched in the last 3 days".format(
self.channel
)
)
return "Bugs which are tracked in {}".format(self.channel)
def name(self):
return "tracking" + ("_untouched" if self.untouched else "")
def template(self):
return "tracking.html"
def nag_template(self):
return "tracking_nag.html"
def has_last_comment_time(self):
return True
def has_default_products(self):
return False
def has_needinfo(self):
return True
def has_assignee(self):
return True
def get_extra_for_template(self):
return {
"channel": "nightly" if self.channel == "central" else self.channel,
"version": self.version,
"untouched": self.untouched,
"next_release": (utils.get_next_release_date() - self.nag_date).days,
}
def get_extra_for_nag_template(self):
return self.get_extra_for_template()
def columns(self):
return ["id", "summary", "needinfos", "assignee", "last_comment"]
def columns_nag(self):
return ["id", "summary", "needinfos", "To", "last_comment"]
def set_people_to_nag(self, bug, buginfo):
priority = self.get_priority(bug)
if not self.filter_bug(priority):
return None
assignee = bug["assigned_to"]
real = bug["assigned_to_detail"]["real_name"]
buginfo["to"] = assignee
buginfo["To"] = real
if not self.add(assignee, buginfo, priority=priority):
self.add_no_manager(buginfo["id"])
return bug
def get_bz_params(self, date):
status = utils.get_flag(self.version, "status", self.channel)
self.tracking = utils.get_flag(self.version, "tracking", self.channel)
tracking_value = (
"+,blocking" if self.channel != "esr" else self.versions["beta"] + "+"
)
fields = [self.tracking]
params = {
"include_fields": fields,
"f1": self.tracking,
"o1": "anywords",
"v1": tracking_value,
"f2": status,
"o2": "nowordssubstr",
"v2": ",".join(["wontfix", "fixed", "disabled", "verified", "unaffected"]),
"f3": self.tracking,
"o3": "changedbefore",
"v3": "-1d",
"n4": 1,
"f4": self.tracking,
"o4": "changedafter",
"v4": "-1d",
}
if self.channel == "central":
tracking = utils.get_flag(self.versions["beta"], "tracking", "beta")
params.update({"f5": tracking, "o5": "nowordssubstr", "v5": "+,blocking"})
elif self.channel != "esr":
approval = utils.get_flag(self.version, "approval", self.channel)
params.update(
{"f5": "flagtypes.name", "o5": "notsubstring", "v5": approval + "?"}
)
if self.untouched:
params.update({"f6": "days_elapsed", "o6": "greaterthan", "v6": 3})
return params
if __name__ == "__main__":
Tracking("beta", False).run()
Tracking("beta", True).run()
Tracking("central", False).run()
Tracking("central", True).run()
Tracking("esr", False).run()