Generate diffs between base and tip commits

Review Request #10130 — Created Aug. 27, 2018 and submitted

brennie
Review Board
release-4.0.x
10124
45b9779...
reviewboard

The get_diff_files utility can now generate a list of files to diff
that exist between two commits in a diffset. This allows us to generate
diffs between two commits (and therefore to see the diff of any
individual commit). There is currently no UI support for this behaviour,
but that is comming in a future patch.

Ran unit tests.

  • 0
  • 0
  • 16
  • 0
  • 16
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

brennie
chipx86
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 2)
     
     

    Missing space between the backtick and "diffsets".

  3. reviewboard/diffviewer/diffutils.py (Diff revision 2)
     
     

    Here, too.

  4. reviewboard/diffviewer/diffutils.py (Diff revision 2)
     
     
     

    Missing blank line.

  5. reviewboard/diffviewer/tests/test_diffutils.py (Diff revision 2)
     
     
     
     

    No blank line needed here.

  6. reviewboard/diffviewer/tests/test_diffutils.py (Diff revision 2)
     
     
     
     
     
     

    Given the repeated complexity of this, it would be nice to make this whole expected_results building into a private utility method.

  7. 
      
brennie
chipx86
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 3)
     
     
     

    Redundant "diffsets" in this sentence.

  3. reviewboard/diffviewer/diffutils.py (Diff revision 3)
     
     
     

    Same here.

  4. reviewboard/diffviewer/diffutils.py (Diff revision 3)
     
     

    Can you compare explicitly against 0?

  5. reviewboard/diffviewer/diffutils.py (Diff revision 3)
     
     

    Here, too.

  6. Should be .. code-block:: python (note the ::).

  7. reviewboard/diffviewer/tests/test_diffutils.py (Diff revision 3)
     
     
     
     
     
     
     

    This doesn't match.

    1. Weird, I must've missed committing the docs change because I have it locally.

  8. 
      
brennie
david
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 4)
     
     

    Syntax is super wonky here (0and). Does this even run?

    1. Looks like I goofed it up before committing. Oops.

  3. 
      
brennie
david
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 5)
     
     

    Should be "base commit"

  3. reviewboard/diffviewer/diffutils.py (Diff revision 5)
     
     
     
     
     
     
     
     
     

    This is a little too fancy. How about:

    for ancestor in reversed(ancestors):
        if ancestor.commit_id <= base_commit.pk:
            base_filediff = ancestor
            break
    
  4. 
      
brennie
chipx86
  1. 
      
  2. reviewboard/diffviewer/tests/test_diffutils.py (Diff revision 6)
     
     
     
     
     
     

    This looks like a fancy way of just doing by_details.get(base_filediff_details).

  3. 
      
brennie
chipx86
  1. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (5820e10)
Loading...