Add utilities to compare DiffCommits and FileDiffs for equivalence

Review Request #8313 — Created July 27, 2016 and submitted

Information

Review Board
dvcs

Reviewers

Two FileDiffs are equivalent if and only if they have the same diff
content (including headers). Instead of directly comparing the diff
contents we can instead see that they point at the same
RawFileDiffData object, as any two identical FileDiffs must have
identical RawFileDiffData instances.

Two DiffCommits are equivalent if and only if they have the same
author, committer, and diff contents. That is, every FileDiff in
DiffCommit A will have a corresponding equivalent Filediff in
DiffCommit B if A and B are equivalent. We cache the result of this
comparison in the extra_data of each DiffCommit to save future
database queries.

Ran unit tests.

Description From Last Updated

Do we need to list the full module path of FileDiff here?

daviddavid

Same question.

daviddavid

There's an extra line here.

daviddavid

This is doing a bitwise comparison. We should just have this be: else: if not self_diff.is_equivalent_to(other_diff): equivalent = False

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/tests.py
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/diffviewer/models.py (Diff revision 1)
     
     

    Do we need to list the full module path of FileDiff here?

    1. No, because FileDiff is defined in this module.

  3. reviewboard/diffviewer/models.py (Diff revision 1)
     
     

    Same question.

  4. reviewboard/diffviewer/models.py (Diff revision 1)
     
     

    There's an extra line here.

  5. reviewboard/diffviewer/models.py (Diff revision 1)
     
     
     

    This is doing a bitwise comparison. We should just have this be:

    else:
        if not self_diff.is_equivalent_to(other_diff):
            equivalent = False
    
  6. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/tests.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to dvcs (d609151)
Loading...