Closed
Bug 1173560
Opened 10 years ago
Closed 4 months ago
De-duplicate bug numbers in the newly added metadata shown on hgweb
Categories
(Developer Services :: Mercurial: hg.mozilla.org, defect)
Developer Services
Mercurial: hg.mozilla.org
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1247314
People
(Reporter: KWierso, Unassigned)
References
Details
Attachments
(2 files)
1.11 KB,
patch
|
gps
:
review+
|
Details | Diff | Splinter Review |
40 bytes,
text/x-review-board-request
|
Details |
The metadata shows the same bug number multiple times if it finds multiple instances in the commit information (eg https://hg.mozilla.org/integration/b2g-inbound/rev/dbf3b1ad8240 shows "bugs: 30507, 1169861, 1169861, 1169861")
It'd be nice if it would only list each bug once no matter how many times it finds it in the commit.
Reporter | ||
Comment 1•10 years ago
|
||
I think this is all that would be needed?
Assignee: nobody → wkocher
Attachment #8620646 -
Flags: review?(gps)
Reporter | ||
Comment 2•10 years ago
|
||
Or should this be on the commit parser's side?
Comment 3•10 years ago
|
||
Comment on attachment 8620646 [details] [diff] [review]
Pass the list of bugs through set() to remove duplicates.
Yes, this is all that is needed. Although commit message order may get lost. I don't think we care though.
Attachment #8620646 -
Flags: review?(gps) → review+
Reporter | ||
Comment 4•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 5•10 years ago
|
||
Hrm, it's still listing duplicates. Do I need to get rid of the list() part to make sure set() remains a unique list?
Flags: needinfo?(gps)
Comment 6•10 years ago
|
||
Look at the line below. Why we're making two calls to parse bugs, I don't know. How I missed this in code review, I can't believe.
This is why you write tests.
Status: RESOLVED → REOPENED
Flags: needinfo?(gps)
Resolution: FIXED → ---
Reporter | ||
Comment 7•10 years ago
|
||
Bug 1173560 - Really remove duplicate bug numbers from the metadata before it gets displayed.
For some reason, there were two attempts to parse bugs, but it looks like only the second attempt is actually used for anything, while my first patch only changed the first attempt.
This version removes that first, apparently unused parse, and removes the duplicates from the actually-used parse.
Reporter | ||
Comment 8•10 years ago
|
||
^ is totally untested by me. Don't know if calling set() like that changes things too much beyond what hg expects. I'm also unsure exactly how to test it. Please don't let me land this without someone making sure it doesn't break everything. :)
Reporter | ||
Updated•9 years ago
|
Attachment #8621242 -
Flags: review?(gps)
Comment 9•9 years ago
|
||
Comment on attachment 8621242 [details]
MozReview Request: Bug 1173560 - Really remove duplicate bug numbers from the metadata before it gets displayed.
https://reviewboard.mozilla.org/r/10925/#review9855
::: hgext/hgmo/__init__.py:33
(Diff revision 1)
> + d['bugs'] = set(d['bugs']);
We prefer to keep the ordering of this list. Plus, doing a set() on a list of dicts doesn't work because set() works by looking at hash(<object>) and hash({}) doesn't work. I suspect you would have discovered this had you ran the tests:
$ ./run-tests hgext/hgmo
You'll want to introduce a new variable to track which bugs have been seen. e.g.:
d['bugs'] = []
seen_bugs = set()
for bug in ...:
if bug in seen_bugs:
continue
seen_bugs.add(bug)
d['bugs'].append({...})
::: hgext/hgmo/__init__.py:41
(Diff revision 1)
> + d['reviewers'] = set(d['reviewers']);
Ditto.
Attachment #8621242 -
Flags: review?(gps)
Updated•8 years ago
|
QA Contact: hwine → klibby
Updated•7 years ago
|
Assignee: kwierso → nobody
Updated•4 months ago
|
Status: REOPENED → RESOLVED
Closed: 10 years ago → 4 months ago
Duplicate of bug: 1247314
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•