Search code examples
mercurialmercurial-queue

Is it possible to (easily?) re-write the paths within a Mercurial Queue patch?


I've got some MQ patches with work implemented in file path project/feature_a, but I need to move these changes to project/feature_b. Is there an easy way to do this?


Solution

  • The only way is to modify the patch files directly with a tool or an editor.

    You must (of course) do this while the patches are unapplied, so begin with

    $ hg qpop -a
    

    Then edit the patches in .hg/patches using either an editor of your choice or perhaps by using filterdiff from patchutils. Running

    $ filterdiff --strip 3 \
                 --addoldprefix a/project/feature_b/ \
                 --addnewprefix b/project/feature_b/ your-patch
    

    might do the trick by stripping off the old a/project/feature_b prefixes before adding new ones.