Show commit changes in interdiffs

Review Request #10126 — Created Aug. 24, 2018 and submitted

Information

Review Board
release-4.0.x
25b7f10...

Reviewers

When an interdiff is displayed in the diffviewer, we now show a history
of how the commits changed from the diffset to the interdiffset. The
implementation of diffing between two histories is very basic at the
moment. We currently only directly compare commit IDs as our metric of
whether or not two commits are equivalent. Once any commit IDs differ,
we assume the rest of the commits in the old history will be removed and
the remaining new commits are all added. This is because commit IDs
depend on prior commit IDs in most DVCS systems. Ideally we would use
use commit ancestor information (which is trivally obtainable from
Mercurial and less so from Git).

  • Ran JS tests.
  • Ran unit tests.

Description From Last Updated

Can you flesh out the description, describe how it's basic and what's missing?

chipx86chipx86

E501 line too long (89 > 79 characters)

reviewbotreviewbot

Col: 54 Expected a 'break' statement before 'default'.

reviewbotreviewbot

Col: 13 Unexpected ')'.

reviewbotreviewbot

Col: 13 Expected an identifier and instead saw ')'.

reviewbotreviewbot

Col: 17 Expected ')' and instead saw ';'.

reviewbotreviewbot

Col: 18 Missing semicolon.

reviewbotreviewbot

Col: 21 It's not necessary to initialize 'rowClass' to 'undefined'.

reviewbotreviewbot

Col: 17 Unexpected ')'.

reviewbotreviewbot

Col: 17 Expected an identifier and instead saw ')'.

reviewbotreviewbot

Col: 21 Expected ')' and instead saw ';'.

reviewbotreviewbot

Col: 22 Missing semicolon.

reviewbotreviewbot

Col: 13 Expected an identifier and instead saw ')'.

reviewbotreviewbot

Col: 13 Unexpected ')'.

reviewbotreviewbot

Col: 19 Missing semicolon.

reviewbotreviewbot

Col: 18 Expected ')' and instead saw ';'.

reviewbotreviewbot

E501 line too long (81 > 79 characters)

reviewbotreviewbot

This seems unnecessary. Can't we just move that stuff into an __init__ in this class?

chipx86chipx86

Needs to be the full type path.

chipx86chipx86

Can you pass as keyword arguments, so this is self-describing? Same with all below.

chipx86chipx86

Is it really worth having these? The construction is pretty simple.

chipx86chipx86

Why aren't we just using __init__? This class is feeling unnecessarily complicated, and I don't have a sense as to …

chipx86chipx86

Full type path, here and below.

chipx86chipx86

No , or or in these.

chipx86chipx86

Same here.

chipx86chipx86

Can we say "Iterate through the diff between ...", so it's a bit more clear?

chipx86chipx86

No blank line.

chipx86chipx86

Doesn't seem like we'd need this namedtuple either. They kinda came out of nowhere, and I'm not sure they're appropriate …

chipx86chipx86

This should be a list so that ordering is consistent in the query. That allows the database to cache the …

chipx86chipx86

This can easily be one line.

chipx86chipx86

These should be on the same line.

chipx86chipx86

We have a trailing comma here, but this isn't a .es6.js file. Let's rename it.

chipx86chipx86

Blank line between these.

chipx86chipx86

Wrong number of spaces for indents.

chipx86chipx86

Missing docstring.

chipx86chipx86

You can use isEmpty().

chipx86chipx86

It's always good to have a break, even in the last case.

chipx86chipx86

These can start on the line with the call.

chipx86chipx86

Typo: "cellection" -> "collection".

chipx86chipx86

F401 'collections.namedtuple' imported but unused

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F401 'collections.namedtuple' imported but unused

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

F401 'collections.namedtuple' imported but unused

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F821 undefined name 'cls'

reviewbotreviewbot

F401 'collections.namedtuple' imported but unused

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

No trailing period.

chipx86chipx86

No trailing period.

chipx86chipx86

__init__ doesn't return.

chipx86chipx86

Parameters should align.

chipx86chipx86

No spaces within {..}

chipx86chipx86

E501 line too long (83 > 79 characters)

reviewbotreviewbot

This doesn't look right.

chipx86chipx86

Are i and j ever different? They start as 0, are both incremented at the same time, and never seem …

chipx86chipx86

Can you put the full module path? Looks like it'd fit.

chipx86chipx86

We always compare the result to the expectation. A failure here with these values backwards could be confusing to debug …

chipx86chipx86

""" on the next line.

chipx86chipx86

Alphabetical order.

chipx86chipx86

Alphabetical order.

chipx86chipx86

Alphabetical order.

chipx86chipx86

Lookups would be faster if we just have a mapping defined (say, on RB.CommitHistoryDiffEntry, not the prototype) that mapped the …

chipx86chipx86

Can you use the expanded form?

chipx86chipx86

Same here.

chipx86chipx86

E501 line too long (83 > 79 characters)

reviewbotreviewbot

F821 undefined name 'j'

reviewbotreviewbot

Col: 2 Missing semicolon.

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

Docstring?

daviddavid

Docstring?

daviddavid

Babel turns this into a monster. We'll need to do it with a bunch of assignments instead.

daviddavid

We don't need the $() here, since append() can take an HTML string.

daviddavid

Same here with $()

daviddavid

And here.

daviddavid

E501 line too long (83 > 79 characters)

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

It's best to also provide __ne__ for Python 2.x. On 3.x, we get this for free.

chipx86chipx86

Typo: "attribtues" -> "attributes"

chipx86chipx86

Kind of confused by the wording here around the double enumerate.

chipx86chipx86

Can you wrap this at the "at"? It's slightly too long.

chipx86chipx86

We can reduce the generated HTML and the test changes needed if we do: <th<% if (showExpandCollapse) { %>colspan="2"<% } …

chipx86chipx86

These are a too long for the lines. How about building the response payload higher up, before the return maybe, …

chipx86chipx86

E501 line too long (83 > 79 characters)

reviewbotreviewbot

Similar to above, let's only add the attribute if we have something other than "1" to set.

chipx86chipx86

This isn't a boolean.

chipx86chipx86

E501 line too long (83 > 79 characters)

reviewbotreviewbot
Checks run (2 failed)
flake8 failed.
JSHint failed.

flake8

JSHint

brennie
Review request changed
brennie
chipx86
  1. 
      
  2. Show all issues

    Can you flesh out the description, describe how it's basic and what's missing?

  3. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
     
     
     
     
    Show all issues

    This seems unnecessary. Can't we just move that stuff into an __init__ in this class?

  4. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
    Show all issues

    Needs to be the full type path.

  5. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
    Show all issues

    Can you pass as keyword arguments, so this is self-describing?

    Same with all below.

  6. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
     
    Show all issues

    Is it really worth having these? The construction is pretty simple.

  7. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
    Show all issues

    Why aren't we just using __init__? This class is feeling unnecessarily complicated, and I don't have a sense as to why it needs to be.

  8. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
    Show all issues

    Full type path, here and below.

  9. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
     
    Show all issues

    No , or or in these.

  10. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
     
    Show all issues

    Same here.

  11. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
    Show all issues

    Can we say "Iterate through the diff between ...", so it's a bit more clear?

  12. reviewboard/diffviewer/commit_utils.py (Diff revision 3)
     
     
     
     
    Show all issues

    No blank line.

  13. Show all issues

    Doesn't seem like we'd need this namedtuple either. They kinda came out of nowhere, and I'm not sure they're appropriate for this work.

  14. reviewboard/diffviewer/views.py (Diff revision 3)
     
     
     
     
     
    Show all issues

    This should be a list so that ordering is consistent in the query. That allows the database to cache the queryset.

  15. reviewboard/diffviewer/views.py (Diff revision 3)
     
     
     
     
     
    Show all issues

    This can easily be one line.

  16. reviewboard/diffviewer/views.py (Diff revision 3)
     
     
     
    Show all issues

    These should be on the same line.

  17. Show all issues

    We have a trailing comma here, but this isn't a .es6.js file. Let's rename it.

  18. Show all issues

    Blank line between these.

  19. Show all issues

    Wrong number of spaces for indents.

  20. Show all issues

    Missing docstring.

  21. Show all issues

    You can use isEmpty().

  22. Show all issues

    It's always good to have a break, even in the last case.

  23. Show all issues

    These can start on the line with the call.

  24. Show all issues

    Typo: "cellection" -> "collection".

  25. 
      
brennie
Review request changed
Change Summary:

Addressed feedback.

Description:
   

When an interdiff is displayed in the diffviewer, we now show a history

    of how the commits changed from the diffset to the interdiffset. The
    implementation of diffing between two histories is very basic at the
~   moment.

  ~ moment. We currently only directly compare commit IDs as our metric of
  + whether or not two commits are equivalent. Once any commit IDs differ,
  + we assume the rest of the commits in the old history will be removed and
  + the remaining new commits are all added. This is because commit IDs
  + depend on prior commit IDs in most DVCS systems. Ideally we would use
  + use commit ancestor information (which is trivally obtainable from
  + Mercurial and less so from Git).

Commit:
833175cae00e9fb725f52a6059ef10f3827780d5
e292e377e3ed8798546ce2fe49612c1771839c95

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
Review request changed
Commit:
e292e377e3ed8798546ce2fe49612c1771839c95
010afb49c7ff8b44f36263063bd95b9c1b3b8f77

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
Review request changed
chipx86
  1. 
      
  2. reviewboard/diffviewer/commit_utils.py (Diff revision 6)
     
     
    Show all issues

    No trailing period.

  3. reviewboard/diffviewer/commit_utils.py (Diff revision 6)
     
     
    Show all issues

    No trailing period.

  4. reviewboard/diffviewer/commit_utils.py (Diff revision 6)
     
     
     
     
    Show all issues

    __init__ doesn't return.

  5. Show all issues

    Parameters should align.

  6. Show all issues

    No spaces within {..}

  7. reviewboard/staticbundles.py (Diff revision 6)
     
     
     
    Show all issues

    This doesn't look right.

  8. 
      
brennie
Review request changed
Change Summary:

Addressed feedback

Commit:
169d810be8845d28d10a7b482c921ecd485c1c57
7e488185aba379d628598723d5d12b86132bc950

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
  1. 
      
  2. reviewboard/diffviewer/commit_utils.py (Diff revision 7)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Are i and j ever different? They start as 0, are both incremented at the same time, and never seem to otherwise change.

  3. Show all issues

    Can you put the full module path? Looks like it'd fit.

  4. Show all issues

    We always compare the result to the expectation. A failure here with these values backwards could be confusing to debug at first. These should all be fixed to follow the typical argument order.

  5. Show all issues

    """ on the next line.

  6. Show all issues

    Alphabetical order.

  7. Show all issues

    Alphabetical order.

  8. Show all issues

    Alphabetical order.

  9. reviewboard/static/rb/js/diffviewer/models/commitHistoryDiffEntry.es6.js (Diff revision 7)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Lookups would be faster if we just have a mapping defined (say, on RB.CommitHistoryDiffEntry, not the prototype) that mapped the entryType values to the symbols. Lookups are faster, and getSymbol() could just wrap this.

  10. Show all issues

    Can you use the expanded form?

  11. Show all issues

    Same here.

  12. 
      
brennie
Review request changed
Change Summary:

Addressed feedback

Commit:
7e488185aba379d628598723d5d12b86132bc950
c31a8cded7083aa379529eea98e700381da77f80

Checks run (2 failed)

flake8 failed.
JSHint failed.

flake8

JSHint

brennie
Review request changed
Change Summary:

Fixes from accidental publish

Commit:
c31a8cded7083aa379529eea98e700381da77f80
a1163880fc94cce4b4dad15a54b2400c7e110aed

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
Review request changed
Change Summary:

Unit test changes from /r/10125/

Commit:
a1163880fc94cce4b4dad15a54b2400c7e110aed
f1885c258e7e68b106525cee3ff5db86385970f6

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
  1. 
      
  2. reviewboard/diffviewer/commit_utils.py (Diff revision 10)
     
     
    Show all issues

    Docstring?

  3. reviewboard/diffviewer/commit_utils.py (Diff revision 10)
     
     
    Show all issues

    Docstring?

  4. Show all issues

    Babel turns this into a monster. We'll need to do it with a bunch of assignments instead.

  5. Show all issues

    We don't need the $() here, since append() can take an HTML string.

  6. Show all issues

    Same here with $()

  7. Show all issues

    And here.

  8. 
      
brennie
Review request changed
Change Summary:

Addressed feedback.

Commit:
f1885c258e7e68b106525cee3ff5db86385970f6
9ab5d747cbd915338cf92fcb942d2ed77e92b06a

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
Review request changed
Change Summary:

Fix unit test

Commit:
9ab5d747cbd915338cf92fcb942d2ed77e92b06a
3dc0db202fecbba4a5aa4069bd385712396f5a5e

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
  1. 
      
  2. reviewboard/diffviewer/commit_utils.py (Diff revision 12)
     
     
    Show all issues

    It's best to also provide __ne__ for Python 2.x. On 3.x, we get this for free.

  3. reviewboard/diffviewer/commit_utils.py (Diff revision 12)
     
     
    Show all issues

    Typo: "attribtues" -> "attributes"

  4. reviewboard/diffviewer/commit_utils.py (Diff revision 12)
     
     
     
    Show all issues

    Kind of confused by the wording here around the double enumerate.

    1. I think it got garbled while reflowing it, oops

  5. Show all issues

    Can you wrap this at the "at"? It's slightly too long.

  6. Show all issues

    We can reduce the generated HTML and the test changes needed if we do:

    <th<% if (showExpandCollapse) { %>colspan="2"<% } %>>
    
  7. reviewboard/static/rb/js/pages/views/tests/diffViewerPageViewTests.es6.js (Diff revision 12)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    These are a too long for the lines. How about building the response payload higher up, before the return maybe, and just doing cb(responsePayload) or something.

  8. Show all issues

    Similar to above, let's only add the attribute if we have something other than "1" to set.

  9. 
      
brennie
Review request changed
Change Summary:

Addressed feedback.

Commit:
3dc0db202fecbba4a5aa4069bd385712396f5a5e
25b7f10ec2b345ad34876050ec08c19803ffd79e

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
  1. 
      
  2. Show all issues

    This isn't a boolean.

  3. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (76f671a)