Add some flexibility and extensibility to RawDiffChunkGenerator.

Review Request #7122 — Created March 25, 2015 and submitted

Information

Review Board
release-2.5.x
b0c081a...

Reviewers

RawDiffChunkGenerator now accepts either strings or lists of lines for
input, instead of requiring strings. When using lists of lines, we trust
that the content is already properly normalized and rendered to whatever
representative state may be wanted by the caller.

The caller can further customize behavior by changing normalization and
by overriding the logic to determine changes within a line.

This will make it easier for us to have specializations on chunk
generation behavior for specific cases.

Unit tests pass.

Used some of these new capabilities in an upcoming change.

Description From Last Updated

How about "strings each consisting of at least one line of text or lists of lines" ?

brenniebrennie

Do you really want to only do this stuff if we're operating on strings?

daviddavid
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/chunk_generator.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/chunk_generator.py
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/diffviewer/chunk_generator.py (Diff revision 1)
     
     
     
     
    Show all issues

    Do you really want to only do this stuff if we're operating on strings?

    1. If we're operating on lists, it's a lot harder and more expensive to cleanly apply the syntax highlighting. Right now, in the cases where we're operating on lists, the strings are already marked up (rendered content), so we wouldn't want to anyway.

      I figure we can revisit this later if we need syntax highlighting on lists, but I can't think of why we'd want to do that and not just pass in strings at that point.

  3. 
      
brennie
  1. 
      
  2. reviewboard/diffviewer/chunk_generator.py (Diff revision 1)
     
     
     
    Show all issues

    How about "strings each consisting of at least one line of text or lists of lines" ?

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/chunk_generator.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/chunk_generator.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (c27e5b7)
Loading...