Formalize diff line-level metadata and prepare for new state.

Review Request #11902 — Created Jan. 4, 2022 and submitted

Information

Review Board
release-5.0.x

Reviewers

Lines in a rendered diff have a dictionary field for storing move
information, and we have a couple other fields for other interesting
state. What we don't have is a field for general metadata, and this will
be important soon.

It will also be important not to completely break anything consuming
this line information. So, the moved information field is being
repurposed for general metadata, preserving to and from as moved
to/from keys.

For the moment, this is mostly a documentation change within the chunk
generator. However, the diff_line template tag has also been updated
to prepare for some uses of this metadata field. This consists of
pulling out the field into a variable, and changing some processing to
avoid repeating logic (which will be important for the upcoming code
safety checks feature).

Unit tests passed.

Made use of this in the upcoming code safety checkers feature.

Summary ID
Formalize diff line-level metadata and prepare for new state.
Lines in a rendered diff have a dictionary field for storing move information, and we have a couple other fields for other interesting state. What we don't have is a field for general metadata, and this will be important soon. It will also be important not to completely break anything consuming this line information. So, the moved information field is being repurposed for general metadata, preserving `to` and `from` as moved to/from keys. For the moment, this is mostly a documentation change within the chunk generator. However, the `diff_line` template tag has also been updated to prepare for some uses of this metadata field. This consists of pulling out the field into a variable, and changing some processing to avoid repeating logic (which will be important for the upcoming code safety checks feature).
799199c194f9206b965e0766f929c2b1820b9905
Description From Last Updated

typo: i a line -> if a line

daviddavid

I feel like this could all be coalesced together. There's no need to reassign to line_html_sides if we don't do …

daviddavid
david
  1. 
      
  2. typo: i a line -> if a line

  3. reviewboard/diffviewer/templatetags/difftags.py (Diff revision 1)
     
     
     
     
     
     
     
     

    I feel like this could all be coalesced together. There's no need to reassign to line_html_sides if we don't do any processing:

    if line_html and len(line_html) < STYLED_MAX_LINE_LEN:
        line_html_sides[side_i] = showextrawhitespace(line_html)
    
  4. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (f738871)
Loading...