Fix up SVN patcher behavior when basedirs don't overlap.
Review Request #14343 — Created Feb. 12, 2025 and submitted — Latest diff uploaded
The new SVN patcher implementation tried to be very smart when the patch
base directory was not the same as the client base directory, filtering
out files that are not patchable. This would happen, for example, if a
patch was created in /trunk/ but the local checkout only contained
/trunk/project1/.Unfortunately, this completely broke the use case where a patch is
created in a directory that has no overlap at all with the client (for
example, the patch was created in /trunk/project1/ but the local
checkout is /branches/release/project1/). In this case, we'd filter out
everything, attempt to apply an empty patch, and error out.This change updates the patcher behavior to be smarter about how base
directories are dealt with. If the client is a subdirectory of the patch
base directory, we do exactly as before: filter out any files from the
patch which are not present in the client's root, and try to patch. In
all other cases, we now do two new things:
- The prefix level will be computed from the patch base directory
instead of the client's.- We just take the patch as-is (with the computed prefix level) and try
to apply it. If there are any conflicts, it'll be up to the user to
figure out why.
- Ran unit tests, including two new tests for the subdirectory and
no-overlap scenarios. - Checked out /trunk/ and /branches/1.14.x/ from the apache SVN
repository. Posted one change from trunk, and then usedrbt patch
to
apply it into the branch. Before this would error out with the empty
patch, after it works correctly.
rbtools/clients/svn.py |
---|
rbtools/clients/tests/test_svn.py |
---|