-
-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple patches per package #43
Comments
Cool feature request! I'd love to have this as an option for power users. I'm happy to provide guidance if you're interested in working on this. Probably won't get around to it myself any time soon. |
I'd be happy to do the implementation if you're okay with me just tackling the patch application portion first. How does that sound to you? (And any pointers would be appreciated.) |
I think that's the trivial part and it makes sense to prototype the patch generation/updating first, since design decisions there might affect how the patch application works. |
Aw shucks, you're gonna make me eat my vegetables before I get my steak. Alright then. I probably won't circle back to this for a while yet, but we'll see. |
Hah, sorry, I was in work mode. I forgot that people also code for fun :-)
If you want to build the patch application first, go for it. Often doing
the easier bits first is a great way to get motivated for tackling the
larger problem.
…On Wed, 28 Feb 2018, 23:29 James Reggio, ***@***.***> wrote:
Aw shucks, you're gonna make me eat my vegetables before I get my steak.
Alright then. I probably won't circle back to this for a while yet, but
we'll see.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABL1qfZe4oYEo3wT8VfkGiXUl5oEx194ks5tZeFdgaJpZM4SXIiJ>
.
|
Sounds good. I slept on it and think that a good approach to capturing the patch would be similar to In summary, I'd add the following options to the CLI:
The applicator would then be modified to lexically sort the patches and then ignore the name's patch segment (though It would echo the name it as it reports status). // The patch filename regex would go from this:
/^(.+?)(:|\+)(.+)\.patch$/
// to this:
/^(.+?)(:|\+)(.+)(?:(:|\+)(.+))?\.patch$/
// In case you haven't seen it before, (?:[pattern]) indicates a non-captured group. WDYT of that approach? |
This would be really helpful in normal usage as well. I see added #37 to fix a bug with cached node_modules and partially applied patches. A sequence of multiple patches to be applied would also be helpful there, and shouldn't require reverting old patches. |
Bump, we would also need this feature. |
Workaround for us at the moment: some sort of structured collection which I am currently building at https://github.com/DanielRuf/patches |
Should similar or same like it is done in https://github.com/cweagans/composer-patches |
Bump, I would love to see this features live. |
Not sure whether I want to support this feature or not. On the one hand, it makes it easier to group and understand related changes. On the other hand, it's a very complicated UX problem, and would likely balloon the surface area of the cli. Also part of me feels like if the changes are so significant that grouping them makes them significantly easier to understand, then it's probably a good indication that forking the library is the way to go. So feature is very low on my priority list. I don't think I'll ever work on in myself or approve a pull request for it unless someone designs a UX that feels really good for generating and managing the stacked patch files. |
if I understood the other comments correctly, the main thing we want here is to be able to group changes into small independent chunks, so we can have more control on which patches we need to apply over the original package. lets say one of the changes we patched is later fixed by the maintainer of the package, but the other are not - we can just delete this specific patch file. the part that is bothering you is the interactive UI for choosing the parts of the changes that should be grouped together.
(it;s clear that the first scenario is actually a private case of the second one.. but it's clearer to understand in that way) I hope I didn't miss the point completely.. |
Yeah that would work for creating patch files! But what if you want to go back and make changes to a previous patch file? |
you just delete this specific patch file, and run 'patch package' again after you make your desired changes. |
That assumes the patch files don't modify contiguous or overlapping areas of code. Otherwise the patch-application process would break. |
Alright. And if you know you have a patch that is independent of other patches, you are free to just delete as I said before. Its actually resemble the .Net EF migration system. |
Thanks for all your input! 👍
Then you might end up with related changes being in separate files, while this feature is supposed to promote related changes being grouped together. Maybe it seems like I'm nitpicking. I feel that the simplicity of patch-package's UX is one of its biggest strengths and that this feature would compromise that. Also I have no need for it myself, so the thought of implementing it and/or maintaining it is something I'm going to push back against naturally. Maybe a good alternative to having multiple patch files is to add comments explaining the changes? |
Thank you again for all of this work, and for your detailed answers. 👍 |
I think for several (including me) the issue is also several small changes/fixes to a certain monolith-like package where each fix might get fixed over time. A secondary issue the pragmatic approach explained in #43 (comment) would also fix is conflict-handing: right now when there's a conflict in a patch, all you know is which file it happened in. |
My use cases mirrors jlsjonas’; I apply a number of small changes to react-native and after any given RN update some of those changes may no longer be necessary. It would be nice to just yank the individual patches that I don’t need |
Being able to generate patches on a per file basis might be a nice compromise? |
Normally these are bundled in one patch file. Why not append them if wanted and skip those which can not be applied (x chunks / y chunks). Or use |
I haven't looked into this, I just stumbled about this issue and wanted to add some further information that might be relevant: So, if anyone wants to work on this issue, quilt might provide some ideas for workflows. |
I would love to have this and some naming convetion for identify what exactly patch doing. This can be done by using some kind of config in package.json - I think that loading files by file system is not a good way at all. Check this out working solution in PHP world, Drupal: https://groups.drupal.org/node/518975. This is really nice solution with documentation of all patches in project on the first view. |
I was looking for some feature similar to this, would love to see it implemented. |
Any updates to this? |
This would be amazing, but it doesn't really seem feasible, or at least, not without a tremendous amount of work. I'd love for someone to prove me wrong though. |
Perhaps just the naming convention isn't too much work?
Text after the second
|
Amy update on this one?) would be really cool feature |
Any updates? |
This feature is going ahead. Expensify is kindly funding the effort. I'm working on it in #474 and expect it to be ready to use in a few weeks. |
This is finished and was released in v8.0.0 |
I've been manually patching React Native for quite some time and I love the idea of this tool. It makes extracting a patch so much easier than the manual process I'm used to using.
The one thing that stands in the way of my complete adoption of
patch-package
is its lack of support for multiple patches upon the same package. I like to separate my patches by concern, and it'd be nice ifpatch-package
allowed a third segment in the patch name that can be customized by the user.For example, it'd be great if I could split my one mega-patch into the following three patch files:
patch-package
could apply the patches in lexically-sorted order. If the order of patch application matters, the user could include a sorting ordinal in the custom third segment, like such:The trickiest part of this will be excluding existing patches at the time that a new patch is extracted from a package. I'm not entirely sure how to handle that, but I'm also unconvinced that support for multiple patches needs to hinge on first-class support for extracting and isolating multiple patches. For now, if you want to use this power-user feature, you would just need to ensure that each patch is authored on a clean base package.
The text was updated successfully, but these errors were encountered: