Reputation: 2566
The diff command, even using git option, includes path prefixes commonly used on DCS:
--- a/file.ext
+++ b/file.ext
So applying such patches you should need to using -p1 instead of -p0.
Is there any way to generate clean patched from Mercurial?
Upvotes: 0
Views: 142
Reputation: 26597
You could adapt the see script given in this answer : transforming patch strip level to remove the first directory instead of adding it.
Something like this should work (untested) :
sed \
-e 's!^--- a/!--- !' \
-e 's!^+++ b/!+++ !' \
< p1.patch \
> p0.patch
Assuming your "p1 patch" is in a file named p1.patch, the output will be in p0.patch
Upvotes: 0
Reputation: 78330
Mercurial won't emit -p0 patches. As @Ringdig points out, they're very seldom what you want.
Upvotes: 1