Preserve form feed characters in diffs.

Review Request #6839 — Created Jan. 29, 2015 and submitted

Information

Review Board
release-2.0.x
7314dcc...

Reviewers

Unicode strings treat form feed characters as newlines when calling
splitlines(). This behavior doesn't match byte strings, and definitely
doesn't match patch's logic. Form feed characters, from patch and diff's
point of view, are valid characters like any other, and only \r and
\n should be used as line endings.

We now have our own string splitting function that looks for the
patterns of newlines that we and patch support. This gives us more
specific, testable behavior that won't vary based on the underlying
string type or encoding.

Added a unit test, which passes (along with all other tests).

Tested with a diff containing a form feed character. Previously, it would
turn into a newline, corrupting the diff and angering patch. After, the
character was preserved and came along with the patch.

Went through nearly all my local review requests containing diffs. None of them
broke.

Description From Last Updated

redefinition of unused 'FileDiffMigrationTests' from line 691

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/processors.py
        reviewboard/diffviewer/tests.py
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/diffutils.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/processors.py
        reviewboard/diffviewer/tests.py
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/diffutils.py
    
    
  2. reviewboard/diffviewer/tests.py (Diff revision 1)
     
     
    Show all issues
     redefinition of unused 'FileDiffMigrationTests' from line 691
    
  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (9019c60)
Loading...