mercurialmercurial-queue

MQ patches on renamed files


I have some MQ patches and someone else has renamed the files that I am working on in the repository. Now I don't know how to merge my patches for renamed files (after pulling changes). Do I have to manually fix my patches for all renamed files?


Solution

  • Your best option is to let hg handle the merge over the rename:

    1. Update to a changeset before the files were renamed
    2. Apply and finish your patches. (If there are conflicts here, update to an earlier patch?)
    3. Merge them with the tip that has the name changes.

    hg knows that the files were renamed (assuming, of course, that the other person correctly recorded the renames as a file rename and not as a delete with a separate add file), therefore it can figure out how to put the files together.

    If you goal is to keep the patches as patches, you can manually go through and update the file names in the patches and have them apply to the new file names. Personally, I'd turn the patch folder into a repo and track your patches' changes in case something doesn't work (with hg init --mq, etc.)