Add formal storage of symlink targets when parsing diffs.

Review Request #12066 — Created Feb. 20, 2022 and submitted

Information

Review Board
release-4.0.x

Reviewers

ParsedDiffFile and FileDiff both contained information on whether a
file was a symlink, but nothing more than that. There was no information
on targets, meaning that it was up to the diff implementation and
patch to generate a suitable symlink for display or when applying a
patch. This wasn't ideal.

ParsedDiffFile now contains typed attributes for old and new symlink
targets. These are optional, but can be set by the diff parser. The
DiffX parser is currently the only one that sets these.

FileDiff provides attributes for getting or setting all symlink state.
These are is_symlink, old_symlink_target, and new_symlink_target.
These all wrap extra_data, giving us a formal way of working with
these attributes.

An upcoming SCM will need thess. A separate upcoming change will enable
this support for Git (and Mercurial by extension). Eventually, we'll be
able to use these to avoid some hacks we're currently using to render
symlink changes in diffs.

This will also be useful for Review Bot and RBTools, which will benefit
from being able to know how to correctly manage symlinks.

Unit tests pass.

Summary ID
Add formal storage of symlink targets when parsing diffs.
`ParsedDiffFile` and `FileDiff` both contained information on whether a file was a symlink, but nothing more than that. There was no information on targets, meaning that it was up to the diff implementation and `patch` to generate a suitable symlink for display or when applying a patch. This wasn't ideal. `ParsedFileDiff` now contains typed attributes for old and new symlink targets. These are optional, but can be set by the diff parser. The DiffX parser is currently the only one that sets these. `FileDiff` provides attributes for getting or setting all symlink state. These are `is_symlink`, `old_symlink_target`, and `new_symlink_target`. These all wrap `extra_data`, giving us a formal way of working with these attributes. An upcoming SCM will need thess. A separate upcoming change will enable this support for Git (and Mercurial by extension). Eventually, we'll be able to use these to avoid some hacks we're currently using to render symlink changes in diffs. This will also be useful for Review Bot and RBTools, which will benefit from being able to know how to correctly manage symlinks.
c72f8aeb64c60920357e5e84098449f7cc8d86f8
Description From Last Updated

E122 continuation line missing indentation or outdented

reviewbotreviewbot

E122 continuation line missing indentation or outdented

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Fixed some issues in new docstrings.

Commits:
Summary ID
Add formal storage of symlink targets when parsing diffs.
`ParsedFileDiff` and `FileDiff` both contained information on whether a file was a symlink, but nothing more than that. There was no information on targets, meaning that it was up to the diff implementation and `patch` to generate a suitable symlink for display or when applying a patch. This wasn't ideal. `ParsedFileDiff` now contains typed attributes for old and new symlink targets. These are optional, but can be set by the diff parser. The DiffX parser is currently the only one that sets these. `FileDiff` provides attributes for getting or setting all symlink state. These are `is_symlink`, `old_symlink_target`, and `new_symlink_target`. These all wrap `extra_data`, giving us a formal way of working with these attributes. An upcoming SCM will need thess. A separate upcoming change will enable this support for Git (and Mercurial by extension). Eventually, we'll be able to use these to avoid some hacks we're currently using to render symlink changes in diffs. This will also be useful for Review Bot and RBTools, which will benefit from being able to know how to correctly manage symlinks.
78a00e684d8faaed99ad7760423f9edd3f2a7ad2
Add formal storage of symlink targets when parsing diffs.
`ParsedFileDiff` and `FileDiff` both contained information on whether a file was a symlink, but nothing more than that. There was no information on targets, meaning that it was up to the diff implementation and `patch` to generate a suitable symlink for display or when applying a patch. This wasn't ideal. `ParsedFileDiff` now contains typed attributes for old and new symlink targets. These are optional, but can be set by the diff parser. The DiffX parser is currently the only one that sets these. `FileDiff` provides attributes for getting or setting all symlink state. These are `is_symlink`, `old_symlink_target`, and `new_symlink_target`. These all wrap `extra_data`, giving us a formal way of working with these attributes. An upcoming SCM will need thess. A separate upcoming change will enable this support for Git (and Mercurial by extension). Eventually, we'll be able to use these to avoid some hacks we're currently using to render symlink changes in diffs. This will also be useful for Review Bot and RBTools, which will benefit from being able to know how to correctly manage symlinks.
e07f58b77bcea51808d0941ccc92af108797d694

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (c758bb7)