Skip to content

Commit 84d3591

Browse files
authored
Add documentation on how to fix a local patch during revendoring (#11918)
1 parent 295a35b commit 84d3591

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/pip/_vendor/README.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,30 @@ Vendoring is automated via the `vendoring <https://pypi.org/project/vendoring/>`
118118
``pip/_vendor/vendor.txt`` and the different patches in
119119
``tools/vendoring/patches``.
120120
Launch it via ``vendoring sync . -v`` (requires ``vendoring>=0.2.2``).
121+
Tool configuration is done via ``pyproject.toml``.
122+
123+
124+
Managing Local Patches
125+
======================
126+
127+
The ``vendoring`` tool automatically applies our local patches, but updating,
128+
the patches sometimes no longer apply cleanly. In that case, the update will
129+
fail. To resolve this, take the following steps:
130+
131+
1. Revert any incomplete changes in the revendoring branch, to ensure you have
132+
a clean starting point.
133+
2. Run the revendoring of the library with a problem again: ``nox -s vendoring
134+
-- --upgrade <library_name>``.
135+
3. This will fail again, but you will have the original source in your working
136+
directory. Review the existing patch against the source, and modify the patch
137+
to reflect the new version of the source. If you ``git add`` the changes the
138+
vendoring made, you can modify the source to reflect the patch file and then
139+
generate a new patch with ``git diff``.
140+
4. Now, revert everything *except* the patch file changes. Leave the modified
141+
patch file unstaged but saved in the working tree.
142+
5. Re-run the vendoring. This time, it should pick up the changed patch file
143+
and apply it cleanly. The patch file changes will be committed along with the
144+
revendoring, so the new commit should be ready to test and publish as a PR.
121145

122146

123147
Debundling

0 commit comments

Comments
 (0)