hg import to apply patch to a subdirectory
Martin Geisler
mg at aragost.com
Fri May 4 05:21:23 CDT 2012
Sean Farley <sean.michael.farley at gmail.com> writes:
>> I can see how this would be useful, though it's not something I've
>> needed before -- when I apply patches coming from 'hg export', then
>> they're already rooted correctly at the repository root.
>>
>> Where do you get your patches from if they only apply on a
>> subdirectory?
>
> These patches usually come from subdirectories that /should/ be
> subrepositories but for reasons out of my control are not. Using
> transplant has been extremely nice for the 'strip' direction (I was
> able to patch transplant to pass --strip down to patch.patch) but the
> other direction would be more code intrusion than just a patch for
> transplant.py; hence this email asking about potential ideas.
Okay, so you have two unrelated repositories main and sub. You
transplant changes from sub into main, applying them onto a subdirectory
of main that "happens" to look just like sub. Hmm... :)
It doesn't sound like a very common workflow. I was going to suggest
using the --filter flag for transplant, but I see now that filterdiff
will remove the Mercurial patch header. So it's not just a matter of
running
hg transplant \
--filter "filterdiff --strip 2 --addoldprefix a/ --addnewprefix b/"
when stripping out the top-level directory.
Since it's more complicated than that, maybe we should include an option
for this? I'm not really sure...
--
Martin Geisler
aragost Trifork
Commercial Mercurial support
http://aragost.com/mercurial/
More information about the Mercurial-devel
mailing list