Closed Bug 1135215 Opened 11 years ago Closed 10 years ago

Preserve commit history in parent review requests

Categories

(MozReview Graveyard :: General, defect)

Production
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1142615

People

(Reporter: mcote, Unassigned)

References

Details

Attachments

(1 obsolete file)

For various reasons, we should keep a full commit history of all children, current, discarded, or replaced, in the parent's extra_data.
Attached file MozReview Request: bz://1135215/mcote (obsolete) —
/r/4109 - Bug 1135215 - Add historical_commits to parent rr's extra_data. Pull down this commit: hg pull review -r 6da7370931947d52496d2a772820889e24f7a82a
Attachment #8567281 - Flags: review?(smacleod)
https://reviewboard.mozilla.org/r/4107/#review3281 I've only updated one test. There are many others that need to be updated, but I wanted some feedback first to make sure my fix makes sense.
Comment on attachment 8567281 [details] MozReview Request: bz://1135215/mcote /r/4109 - Bug 1135215 - Add historical_commits to parent rr's extra_data. Pull down this commit: hg pull review -r 426e9666bd336b903469a3484532eb29ad1ab574
https://reviewboard.mozilla.org/r/4109/#review3453 ::: pylib/reviewboardmods/reviewboardmods/pushhooks.py (Diff revision 2) > + historical_commits += [tuple(x) for x in commit_list if tuple(x) not in Nit: += on lists is generally discouraged. Use .extend() instead. ::: pylib/reviewboardmods/reviewboardmods/pushhooks.py (Diff revision 2) > + historical_commits += [tuple(x) for x in commit_list if tuple(x) not in > + historical_commits] > + historical_commits_json = json.dumps( > + sorted(historical_commits, key=lambda x: x[0])) Use sets and much of this complexity just disappears. historical_commits = set(get_historical_commits(squashed_rr)) historical_commits |= {tuple(x) for x in commit_list} historical_commits_json = json.dumps(sorted(historical_commits)) Sorting by commit SHA-1 is also a bit wonky. IMO I like review id sorting: historical_commits_json = json.dumps(sorted(historical_commits, key=operator.itemgetter(1)))
Comment on attachment 8567281 [details] MozReview Request: bz://1135215/mcote https://reviewboard.mozilla.org/r/4107/#review3455 Ship It!
Attachment #8567281 - Flags: review+
https://reviewboard.mozilla.org/r/4109/#review3459 > Use sets and much of this complexity just disappears. > > historical_commits = set(get_historical_commits(squashed_rr)) > > historical_commits |= {tuple(x) for x in commit_list} > > historical_commits_json = json.dumps(sorted(historical_commits)) > > Sorting by commit SHA-1 is also a bit wonky. IMO I like review id sorting: > > historical_commits_json = json.dumps(sorted(historical_commits, key=operator.itemgetter(1))) Huh yeah, for some reason I was thinking the tuples wouldn't easily work with a set, but I dunno what I was thinking. Your way works perfectly. :) Also thanks for the itemgetter() usage; I knew there must be a better way than defining a lambda.
Comment on attachment 8567281 [details] MozReview Request: bz://1135215/mcote /r/4109 - Bug 1135215 - Add historical_commits to parent rr's extra_data. Pull down this commit: hg pull review -r 415d7aaa2de7d0085a4bfd7c75d5e164cbb5fbb0
Attachment #8567281 - Flags: review+
https://reviewboard.mozilla.org/r/4109/#review3493 We're throwing information away here about the order of pushes and commits being introduced. Which is fine for the current use case. We're still going to need to reimplement this to use a proper field down the line though. This looks like it gives us enough info to implement the confidential stuff, so Ship It.
Comment on attachment 8567281 [details] MozReview Request: bz://1135215/mcote https://reviewboard.mozilla.org/r/4107/#review3495 Ship It!
Attachment #8567281 - Flags: review?(smacleod) → review+
Being handled better in bug 1142615.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Attachment #8567281 - Attachment is obsolete: true
Product: Developer Services → MozReview
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: