Strip symlink mode information from files on Git-style Mercurial diffs.
Review Request #12061 — Created Feb. 17, 2022 and submitted
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.
Removed an unused import.
Revision 2 (+722 -48)
Checks run (2 succeeded)