How to combine a number of small repositories into one?

Becker, Mischa J mischa.becker at kroger.com
Fri Dec 11 18:42:05 UTC 2020


Depends on what you are wanting the end resulting repo history to look like.

I don't recommend it but, if you want to keep all of your existing revision changeset #s, it's possible to pull everything into one repo without using hg convert.  You will end up with a many tailed history that merges down into 1 main branch.  You do this by force pulling the commits from the separate repos into one combined repo and then going to the head of each branch and hg move that branch's files down into their proper plugins or tpl folder. Once you've committed all the moves so all the branch heads have everything in the proper place relative to each other you can do consecutive merges to get down to only 1 branch.

I personally find the above type of history extra confusing and instead use hg convert to redo history to match how the repo will work going forward.

I highly recommend reading hg help convert. Focus on the mercurial to mercurial conversion with a filemap.

Regardless of which direction you go, don't make any of these changes directly in dokuwiki.  Instead pull everything into a new folder like /home/chris/dev/dokuwiki-new/.  Once you are happy with how your new repo looks you can swap it for your old one.

Mischa Becker

> -----Original Message-----
> From: Mercurial <mercurial-bounces at mercurial-scm.org> On Behalf Of Chris
> Green
> Sent: Friday, December 11, 2020 9:38 AM
> To: mercurial at mercurial-scm.org
> Subject: Re: How to combine a number of small repositories into one?
>
> ** [EXTERNAL EMAIL]: Do not click links or open attachments unless you
> recognize the sender and know the content is safe. **
>
> On Fri, Dec 11, 2020 at 10:21:48AM -0700, Tom Hindle wrote:
> > >    On Fri, Dec 11, 2020 at 10:17 AM Chris Green <[2]cl at isbd.net> wrote:
> > >
> > >      I have a number of very small mercurial repositories living in
> > >      various
> > >      subdirectories of a single parent directory (most are two levels
> > >      down).
> > >      How can I merge all of them into a single mercurial repository while
> > >      keeping all the history etc.?
> > >      The repositories to be merged are:-
> > >          /home/chris/dev/dokuwiki/plugins/textalign/.hg
> > >          /home/chris/dev/dokuwiki/plugins/xv/.hg
> > >          /home/chris/dev/dokuwiki/plugins/blog/.hg
> > >          /home/chris/dev/dokuwiki/plugins/dbrd/.hg
> > >          /home/chris/dev/dokuwiki/plugins/rst/.hg
> > >          /home/chris/dev/dokuwiki/plugins/showmail/.hg
> > >          /home/chris/dev/dokuwiki/plugins/db2.wkg/.hg
> > >          /home/chris/dev/dokuwiki/plugins/servlog/.hg
> > >          /home/chris/dev/dokuwiki/plugins/tagentry/.hg
> > >          /home/chris/dev/dokuwiki/plugins/indexmenu/.hg
> > >          /home/chris/dev/dokuwiki/plugins/trip/.hg
> > >          /home/chris/dev/dokuwiki/plugins/include/.hg
> > >          /home/chris/dev/dokuwiki/plugins/database2/.hg
> > >          /home/chris/dev/dokuwiki/plugins/rsthdr/.hg
> > >          /home/chris/dev/dokuwiki/tpl/roundbox/.hg
> > >      I want them to be combined in one repository at
> > >      /home/chris/dev/dokuwiki.
> > >      These are all local files, nothing remote, I'm running mercurial
> > >      version 5.3.1 on xubuntu.
> >
> [1] https://stackoverflow.com/a/10450591/361714
> >
> Ah, maybe I wasn't quite clear, I want to retain the directory hierarchy but
> have only one repository.  I.e. all the files stay in exactly the same place but
> instead of all those separate .hg directories there will be a single one:-
>
>     /home/chris/dev/dokuwiki/.hg
>
> --
> Chris Green
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww
> .mercurial-
> scm.org%2Fmailman%2Flistinfo%2Fmercurial&data=04%7C01%7Cmisch
> a.becker%40kroger.com%7C327752706dd44a07405d08d89dfb7f0b%7C8331e
> 14a91344288bf5a5e2c8412f074%7C0%7C1%7C637433050775457330%7CUnk
> nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> 1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=YNfqdQJpyd7DOP5q3SkZl2B
> C0WzHuB6pS1GSwYgHYEk%3D&reserved=0

________________________________

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.


More information about the Mercurial mailing list