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)
     
     
    Show all issues

    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)
     
     
    Show all issues

    Same question.

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

    There's an extra line here.

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

    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:
Completed
Change Summary:
Pushed to dvcs (d609151)