On Fri, 2014-01-17 at 01:01 +0300, anatoly techtonik wrote: > Sorry for a long delay. I finally lost my job, so now I can have some continuous > time piece to concentrate on python-patch. Oops, sorry to hear that. You make it sound almost positive though. > > We assume that all patches need one level stripped, but if a patch is a > > git patch (as indicated by having the "diff" and/or (?) "index" lines), > > then the patch library will already strip a level. That basically > > assumes that users use "-p0" on 'plain' patches, which isn't the case, > > we always use -p1. > > > > IOW, this will break dropping git patches (e.g. git > > diff/show/format-patch) into the patches directory. > > patch.py is smart enough to strip only a/ and b/ prefixes, and do this > automatically when it is needed. Well, yes, but it doesn't auto-detect other prefixes. So if I diff something manually, then the prefixes aren't removed. As a result, I must generate the patch using git if I want it to work right, or must go against the -p1 convention when generating it manually. Both of those are cumbersome and hard to remember. IOW, you're assuming that a 'real patch' has no prefix, and a 'git patch' has useless a/ and b/ prefixes. But that relies on a certain convention about a 'real patch' which isn't true in the Linux community. > How do you use patch.py? We use it to apply patches within the backport project, those patches are stored in the project and applied against upstream Linux code. > Why do you have to use -p1? See above. > > Anatoly, would you be interested in maybe having an option to disable > > this stripping? If yes, I can do that, otherwise I'm just going to edit > > it out of our copy of your library again :-) > > Thanks to Google Code editor with no HG or GIT watermark I now also > implemented a/ and b/ stripping logic in apply function - see here: > http://code.google.com/p/python-patch/source/browse/trunk/patch.py?spec=svn229&r=229#746 > It will be in first 1.14.x release. Again, you're assuming that the 'canonical patch' should have no prefixes. This is simply a matter of convention (whether -p0 or -p1 is preferred by the project when applying a patch), and that convention happens to be -p1 for many projects. You're assuming -p0. Anyway, since the current version of patch.py does what we need, there's little incentive for us to update/change things. If you consider a 'canonical patch' to be -p0, we'll just keep our changed copy :) johannes -- To unsubscribe from this list: send the line "unsubscribe backports" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html