How to combine a number of small repositories into one?

Dr Rainer Woitok rainer.woitok at gmail.com
Fri Dec 11 17:55:04 UTC 2020


Chris,
On Friday, 2020-12-11 17:37:43 +0000, you wrote:

> 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

$ cd /home/chris/dev/
$ hg init newwiki
$ cd newwiki
$ mkdir plugins tpl
$ cd plugins
$ for r in ../../dokuwiki/plugins/* do ; hg pull -f $r ${r##*/} ; done
$ cd ../tpl
$ hg pull -f ../../dokuwiki/tpl/roundbox roundbox
$ cd ../..
$ mv dokuwiki dokuwiki.orig # Just to still have it around
$ mv newwiki dokuwiki

Sincerely,
  Rainer



More information about the Mercurial mailing list