Correctly request and return FileDiffs with base FileDiff IDs

Review Request #10245 — Created Oct. 19, 2018 and submitted

Information

Review Board
release-4.0.x
1cd0436...

Reviewers

The logic to request a diff fragment with a base FileDiff ID was never
actually implemented. The RB.DiffReviewable model generated a URL with
an invalid query string and, even if it were valid, the
DiffFragmentView did not know how to ask for a single FileDiff with a
base FileDiff.

The RB.DiffReviewable model now generates a correct URL and the
DiffFragmentView can parse this into a call into get_diff_files with
the appropriate parameters.

Additionally, the base FileDiff determination in get_diff_files was
incorrect: it returned an ancestor that was too old. This has been
corrected to return the least recent FileDiff from after the specified
base commit.

Ran unit tests.

Description From Last Updated

E201 whitespace after '('

reviewbotreviewbot

Typo: "provded" -> "provided"

chipx86chipx86

No blank line.

chipx86chipx86

assertIsNone

chipx86chipx86

assertIsNone

chipx86chipx86

Do we have proper checks and test coverage here? It's crucial that nobody can get to other people's diffs through …

chipx86chipx86

This doesn't seem like a suitable message.

chipx86chipx86

Nor this.

chipx86chipx86

Let's pull the index out. This is a lengthy expression to put into a template literal. Debugging is easier if …

chipx86chipx86

No trailing comma here. (File isn't ES6).

chipx86chipx86

E999 SyntaxError: invalid syntax

reviewbotreviewbot

E113 unexpected indentation

reviewbotreviewbot

W391 blank line at end of file

reviewbotreviewbot

Col: 48 Unnecessary semicolon.

reviewbotreviewbot

Col: 47 Missing semicolon.

reviewbotreviewbot

Col: 17 Missing semicolon.

reviewbotreviewbot

Col: 48 Unnecessary semicolon.

reviewbotreviewbot

Col: 47 Missing semicolon.

reviewbotreviewbot

Col: 17 Missing semicolon.

reviewbotreviewbot

W391 blank line at end of file

reviewbotreviewbot

Col: 17 Missing semicolon.

reviewbotreviewbot

Col: 47 Missing semicolon.

reviewbotreviewbot

Col: 48 Unnecessary semicolon.

reviewbotreviewbot

Let's use the IDs instead of %r, to avoid any chance of leaking details on filenames to those who shouldn't …

chipx86chipx86

Typo: "Test sfor" -> "Tests for"

chipx86chipx86

Alphabetical order.

chipx86chipx86

Can you pass this with data= specifically?

chipx86chipx86
brennie
Review request changed
Change Summary:

Fixed unit tests. Added JS test.

Summary:
WIP: Correctly request and return FileDiffs with base FileDiff IDs
Correctly request and return FileDiffs with base FileDiff IDs
Testing Done:
   

Ran unit tests.

-  
-  

TODO: Add more unit tests

-   TODO: Add more JS tests.

Commit:
c948c3912e33581c77b79af82cdf365a46fb2663
fa0439896578d7f7c60c592d176d102ebcf92d15

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
chipx86
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 3)
     
     
    Show all issues

    Typo: "provded" -> "provided"

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

    No blank line.

  4. Show all issues

    assertIsNone

  5. Show all issues

    assertIsNone

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

    Do we have proper checks and test coverage here? It's crucial that nobody can get to other people's diffs through this.

    1. We do have proper checks in place (line 619):

              elif base_filediff_id:
                  interfilediff = None
                  base_filediff = get_object_or_404(FileDiff, pk=base_filediff_id,
                                                    diffset=diffset)
      

      but I will add some test coverage.

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

    This doesn't seem like a suitable message.

    1. IDK, seems fine to me.

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

    Nor this.

  9. Show all issues

    Let's pull the index out. This is a lengthy expression to put into a template literal. Debugging is easier if we keep the literals very small.

  10. Show all issues

    No trailing comma here. (File isn't ES6).

  11. 
      
brennie
Review request changed
Commit:
48fcd287b1fd201293b4d7895f5d7134198e2bb1
330e7fe43a3b6628fa6aba4d35a1eb524d89e75a

Checks run (2 failed)

flake8 failed.
JSHint failed.

flake8

JSHint

brennie
Review request changed
Commit:
330e7fe43a3b6628fa6aba4d35a1eb524d89e75a
a789b9e03e6231f7bd3a1749348a05bc567ca5a6

Checks run (1 failed, 1 succeeded)

flake8 passed.
JSHint failed.

JSHint

brennie
Review request changed
Commit:
a789b9e03e6231f7bd3a1749348a05bc567ca5a6
bd7adc68819449a9bf089dd1843d9a95a9601a93

Checks run (2 failed)

flake8 failed.
JSHint failed.

flake8

JSHint

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

    Let's use the IDs instead of %r, to avoid any chance of leaking details on filenames to those who shouldn't know them.

  3. Show all issues

    Typo: "Test sfor" -> "Tests for"

  4. Show all issues

    Alphabetical order.

  5. Show all issues

    Can you pass this with data= specifically?

  6. 
      
brennie
chipx86
  1. Ship It!
  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (fcce703)