Fix up SVN patcher behavior when basedirs don't overlap.
Review Request #14343 — Created Feb. 12, 2025 and submitted
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.
Summary | ID |
---|---|
bd989b6d99044fab476df564f0c8a07571b2b76c |
Description | From | Last Updated |
---|---|---|
line too long (80 > 79 characters) Column: 80 Error code: E501 |
![]() |
|
Add , optional |
![]() |
|
The second line of the bullet point must be aligned with the content of the first line. |
|
|
Missing Version Added. |
|
|
Rather than invoking the whole command twice, let's just compute what base_dir value we want to use. |
|
|
Should probably be a Sequence. |
|
|
undefined name 'Sequence' Column: 18 Error code: F821 |
![]() |
- Commits:
-
Summary ID 52a401727156494414d8afc091726aabcce9a97c dbe48f15d9f4db0e974d936cfef0ace4dafad741 - Diff:
-
Revision 2 (+458 -106)
Checks run (2 succeeded)
- Commits:
-
Summary ID dbe48f15d9f4db0e974d936cfef0ace4dafad741 6fb5c396bda71236511e4ba5a53130c27836cfaa - Diff:
-
Revision 3 (+458 -106)
Checks run (2 succeeded)
- Commits:
-
Summary ID 6fb5c396bda71236511e4ba5a53130c27836cfaa bd989b6d99044fab476df564f0c8a07571b2b76c - Diff:
-
Revision 4 (+470 -110)