Reputation: 2583
I have two different Mercurial repositories, each with its own history. Is there a way to merge the two into one repository that would also have complete history of both?
Upvotes: 2
Views: 418
Reputation: 6262
You can pull one into the other with the -f
flag:
> cd path\to\repo1
> hg pull -f path\to\repo2
> hg merge
.... deal with merge conflicts ....
> hg commit -m "Merge with repo2"
Upvotes: 3
Reputation: 328556
Maybe. Try this approach:
hg export
from repo #2hg import
This will fail when the two repos have common files. The solution here will be to apply the failing patches using hg patch
.
Background: Mercurial creates a checksum for each changeset. This strong cryptographic checksum contains the modification date, the user name, checksums of the parent changeset(s) and the patch.
This means if you try to copy a changeset from one repo to another, this will fail simply because the parent changeset(s) can't be found. It's not easy to add the parent changeset because of the checksums.
Upvotes: 1