Added SHA256 hashes for original and patched files in FileDiffs.

Review Request #1832 — Created Jan. 23, 2020 and updated

guest9870
Review Board
a78f960...
demo
Back in Review Board 2.0, we introduced SHA1 hashes in FileDiffs, which
were in part used to determine if filediffs and interfilediffs matched.
SHA1 is not technically safe anymore (though there's little harm it can
do in our situation, aside from generate patch errors in the diff
viewer), and we want to move to SHA256 where possible.

This change adds storage and properties for SHA256 hashes on FileDiff,
and updates our FileDiff comparison logic to prioritize them over SHA1
hashes (though it will still check SHA1 if the SHA256 hashes are
missing, since they're created only when viewing the diff for the first
time).

The comparison logic has been moved into a new `get_filediffs_match()`
function, and unit tests were added.

Testing Done:
Unit tests pass.

Didn't see any regressions when viewing interdiffs.

Verified that FileDiffs were recording the SHA256 hashes.

Reviewed at https://reviews.reviewboard.org/r/10767/


Description From Last Updated

Did you really want to do this?

guest8518guest8518

a problem in here, confirm your programm again

guest3081guest3081

ACHTUNG

guest5285guest5285

We should foo the bar.

guest9870guest9870

you need to check the logic agian to ensure the logic is going according to the plan

guest3081guest3081

test

guest9870guest9870

bad here

guest8972guest8972
guest9870
  1. 
      
  2. reviewboard/diffviewer/chunk_generator.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     

    We should foo the bar.

  3. reviewboard/diffviewer/tests/test_diffutils.py (Diff revision 1)
     
     
     
     
     
     
  4. 
      
guest9870
guest8157
  1. Ship It!
  2. 
      
guest8157
  1. Ship It!
  2. 
      
guest5285
  1. Yeah, very important

  2. reviewboard/diffviewer/chunk_generator.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     

    Sausage

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

    ACHTUNG

  4. 
      
guest5285
  1. Ship It!
  2. 
      
guest8518
  1. 
      
  2. Did you really want to do this?

  3. 
      
guest6875
  1. Ship It!
  2. 
      
guest449
  1. 
      
  2. reviewboard/diffviewer/diffutils.py (Diff revision 1)
     
     

    why this funtion was added?

  3. 
      
guest6347
  1. Ship It!
  2. 
      
guest6474
  1. Ship It!
  2. 
      
guest3081
  1. 
      
  2. a problem in here, confirm your programm again

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

    you need to check the logic agian to ensure the logic is going according to the plan

  4. 
      
guest8972
  1. 
      
  2. 
      
guest8972
Loading...