Combining two repositories

Paul Nathan paul at nathan.house
Tue Jul 11 22:45:15 UTC 2023


oh!  something i can answer!


last time I welded two unrelated repositories together, many years ago:

hg clone -> r1
hg clone -> r2

cd r2
hg push -f ../r1
cd ../r1
hg up old-tip-of-r1
hg merge old-tip-of-r2

now you have a final tip commit to keep running on.

this gives a proper history. two initial roots, but its a "true" history.


Regards,
Paul


On Tue, Jul 11, 2023 at 2:45 PM John W <jwdevel at gmail.com> wrote:

> > Is there something like an append option I can't find?
>
> There's some good info on this SO post:
>
> https://urldefense.com/v3/__https://stackoverflow.com/questions/10448788/merging-two-different-repositories__;!!JYXjzlvb!mKB9Spu2VuYsposmNiJEYSm4wj4Bc_22ZHQ_X2YzwxFrcc922sAGaZYD1knBUo16LOl5W8DPXP2MO_OBFFU6Iw$
>
> Regardless, the first step is likely to combine the repos with 'hg
> pull --force'. Then, you can fix up history from there.
>
> Some options:
>
> * Use the 'splicemap' approach described in the above post, to leave
> you with linear history.
> * Use 'hg rebase' to accomplish something similar.
> * Use MQ to turn one of the repos' history into patches, then apply
> those patches on top of the other repo (basically the same as
> 'rebase', but more manual).
> * Leave it alone, and just merge the two heads. You'll have a slightly
> strange "two roots" repo.
>
> Regardless, you will likely want to do the hg->hg convert step you
> initially described, using a filemap, to make sure everything is in
> the right place before you do the final combine+fixup. This helps
> reduce conflicts (eg: same-named files — details will depend on your
> specific case).
>
> -John
>
> On 7/11/23, Ernie Rael <errael at raelity.com> wrote:
> > Greetings,
> >
> > I started something with two repositories, thinking I might combine them
> > later using "hg convert". I can't get that to work. If I do
> >
> >     hg convert repo1 target-repo
> >     hg convert repo2 target-repo
> >
> > then repo1 is not in target-repo. There's a simple filemap involved with
> > each, but I get the same problem without them.
> >
> > Is there something like an append option I can't find? Some other way to
> > do what I'm looking for?
> >
> >     $ hg version -v
> >     Mercurial Distributed SCM (version 6.4.3)
> >
> >     Enabled extensions:
> >
> >        convert     internal
> >        evolve      external  11.0.1
> >        ...
> >
> > -ernie
> >
> _______________________________________________
> Mercurial mailing list
> Mercurial at lists.mercurial-scm.org
>
> https://urldefense.com/v3/__https://lists.mercurial-scm.org/mailman/listinfo/mercurial__;!!JYXjzlvb!mKB9Spu2VuYsposmNiJEYSm4wj4Bc_22ZHQ_X2YzwxFrcc922sAGaZYD1knBUo16LOl5W8DPXP2MO_Py-0rp5w$
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20230711/4f6f25f8/attachment.html>


More information about the Mercurial mailing list