[copy_duplicate_info] Drop disabled code (#2224)

This commit is contained in:
Suhaib Mujahid 2023-09-23 06:24:38 -04:00 коммит произвёл GitHub
Родитель 8bfc1593ab
Коммит 8e8587cef0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 8 добавлений и 75 удалений

Просмотреть файл

@ -16,10 +16,7 @@ class CopyDuplicateInfo(BzCleaner):
def description(self):
return "Bugs which are DUPLICATE and some info haven't been moved"
def has_product_component(self):
return True
def set_autofix(self, bugs, dups, signatures, pcs):
def set_autofix(self, bugs, dups, signatures):
for bugid, missed_sgns in signatures.items():
sgns = dups[bugid]["signature"]
sgns = utils.add_signatures(sgns, missed_sgns)
@ -28,43 +25,6 @@ class CopyDuplicateInfo(BzCleaner):
"comment": {"body": "Copying crash signatures from duplicate bugs."},
}
for bugid, pc in pcs.items():
if bugid in self.autofix_data:
self.autofix_data[bugid].update(pc)
else:
self.autofix_data[bugid] = pc
def get_fixed_bugs(self, bugs, dups, signatures, pcs):
res = {}
for bugid in signatures.keys():
res[bugid] = info = dups[bugid]
info["update_signature"] = "Yes"
for bugid in pcs.keys():
if bugid in res:
res[bugid]["update_pc"] = "Yes"
else:
res[bugid] = info = bugs[bugid]
info["update_pc"] = "Yes"
for info in res.values():
if "update_pc" not in info:
info["update_pc"] = "No"
if "update_signature" not in info:
info["update_signature"] = "No"
return res
def columns(self):
return ["id", "summary", "update_signature", "update_pc"]
def sort_columns(self):
return lambda p: (
0 if p[2] == "Yes" else 1,
0 if p[3] == "Yes" else 1,
-int(p[0]),
)
def get_autofix_change(self):
return self.autofix_data
@ -75,18 +35,12 @@ class CopyDuplicateInfo(BzCleaner):
"summary": self.get_summary(bug),
"signature": bug.get("cf_crash_signature", ""),
"dupe": str(bug["dupe_of"]),
"product": bug["product"],
"component": bug["component"],
"version": bug["version"],
"is_private": bool(bug["groups"]),
}
return bug
def get_dups(self, bugs):
def handler(bug, data):
if bug["product"] in self.get_config("products"):
self.handle_bug(bug, data)
bugids = [info["dupe"] for info in bugs.values()]
data = {}
@ -95,14 +49,12 @@ class CopyDuplicateInfo(BzCleaner):
include_fields=[
"cf_crash_signature",
"dupe_of",
"product",
"component",
"id",
"summary",
"groups",
"version",
],
bughandler=handler,
bughandler=self.handle_bug,
bugdata=data,
).get_data().wait()
@ -112,7 +64,6 @@ class CopyDuplicateInfo(BzCleaner):
# each bug in bugs is the dup of one in dups
# so the characteristics of this bug should be in the dup
signatures = {}
pcs = {}
for bugid, info in bugs.items():
dupid = info["dupe"]
if dupid not in dups:
@ -129,20 +80,7 @@ class CopyDuplicateInfo(BzCleaner):
if not bs.issubset(ds):
signatures[dupid] = bs - ds
pc = {}
for x in ["product", "component"]:
if info[x] != dup[x]:
pc[x] = dup[x]
if pc:
# when we change the product, we change the version too
# to avoid incompatible version in the new product
if "product" in pc and info["version"] != dup["version"]:
pc["version"] = dup["version"]
pcs[bugid] = pc
# Don't move product/component for now
# return signatures, pcs
return signatures, {}
return signatures
def get_bz_params(self, date):
start_date, end_date = self.get_dates(date)
@ -160,12 +98,11 @@ class CopyDuplicateInfo(BzCleaner):
def get_bugs(self, date="today", bug_ids=[]):
bugs = super(CopyDuplicateInfo, self).get_bugs(date=date, bug_ids=bug_ids)
dups = self.get_dups(bugs)
signatures, pcs = self.compare(bugs, dups)
signatures = self.compare(bugs, dups)
self.set_autofix(bugs, dups, signatures, pcs)
bugs = self.get_fixed_bugs(bugs, dups, signatures, pcs)
self.set_autofix(bugs, dups, signatures)
return bugs
return {bugid: dups[bugid] for bugid in signatures}
if __name__ == "__main__":

Просмотреть файл

@ -1,17 +1,15 @@
<p>
The following {{ plural('bug has', data, pword='bugs have') }} been fixed as DUPLICATE and some information haven't been moved:
The following {{ plural('bug has', data, pword='bugs have') }} been fixed as DUPLICATE and some crash signatures haven't been moved:
</p>
<table {{ table_attrs }}>
<thead>
<tr>
<th>Bug</th>
<th>Summary</th>
<th>Update signature</th>
<th>Update product::component</th>
</tr>
</thead>
<tbody>
{% for i, (bugid, summary, update_signature, update_pc) in enumerate(data) -%}
{% for i, (bugid, summary) in enumerate(data) -%}
<tr {% if i % 2 == 0 %}bgcolor="#E0E0E0"
{% endif -%}
>
@ -19,8 +17,6 @@
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{ bugid }}">{{ bugid }}</a>
</td>
<td>{{ summary | e }}</td>
<td>{{ update_signature }}</td>
<td>{{ update_pc }}</td>
</tr>
{% endfor -%}
</tbody>