Let's make sure we fully understand our goal here:
We want to keep all the files from all three projects. If the same file name appears in multiple repositories, we want to do what?
- Keep the version from A (or B, or C): We can perform the merge using
--tool internal:local
or internal:other
as appropriate. Local keeps the version we currently have, other keeps the version we're merging in.
- Merge them together using Mercurial's standard three-way merging logic (which won't work very well since we don't have common ancestry):
--tool internal:merge
or just don't specify the option at all. This will likely produce ugly merge conflicts which we will have to resolve.
- This can't (shouldn't) happen in the first place:
--tool internal:fail
will throw an error in this case and won't try to merge the files.
So, here's the modified procedure:
$ hg init combined
$ cd combined
$ hg pull ../A
$ hg update
$ hg pull ../B --force
$ hg merge --tool something # see above
$ # Manually fix up any files that throw merge conflicts
$ hg resolve --all -m # Mark all files as resolved, only if there were conflicts
$ hg commit -m "Merge A and B"
$ hg pull ../C --force
$ hg merge --tool something # see above
$ # Fix conflicts
$ hg resolve --all -m # Only if there were conflicts
$ hg commit -m "Merge A+B and C"