Strip symlink mode information from files on Git-style Mercurial diffs.

Review Request #12061 — Created Feb. 17, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

Git-style Mercurial diffs, like normal Git diffs, contain symlink mode
information. We've hit issues in the past with the server applying
patches containing symlink modes.

Since a Git-style diff otherwise represents a symlink change as a
standard file change, with the content being the old/new target names,
we addressed this problem by stripping out the symlink mode and treating
it as a normal file when patching for display in the diff viewer.

This is by no means a perfect solution (that is in development, with
initial steps having been done in Review Board 4.0.5), but it addresses
the issue in Git.

This change brings that fix over to Mercurial when working with
Git-style diffs. The code in Git has been split out into a common
function that both can call, simplifying maintenance and allowing both
to benefit from any future bug fixes.

Unit tests pass.

Tested with a customer who hit this problem. Verified that they were able to
review symlinks in Mercurial.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Strip symlink mode information from files on Git-style Mercurial diffs.
Git-style Mercurial diffs, like normal Git diffs, contain symlink mode information. We've hit issues in the past with the server applying patches containing symlink modes. Since a Git-style diff otherwise represents a symlink change as a standard file change, with the content being the old/new target names, we addressed this problem by stripping out the symlink mode and treating it as a normal file when patching for display in the diff viewer. This is by no means a perfect solution (that is in development, with initial steps having been done in Review Board 4.0.5), but it addresses the issue in Git. This change brings that fix over to Mercurial when working with Git-style diffs. The code in Git has been split out into a common function that both can call, simplifying maintenance and allowing both to benefit from any future bug fixes.
6aba5b5ff4de5218e0c19cb69b479c95d686d51d Christian Hammond
reviewboard/scmtools/git.py
reviewboard/scmtools/hg.py
reviewboard/scmtools/tests/test_git.py
reviewboard/scmtools/tests/test_hg.py
Loading...