How to combine several small repositories into separate subdirectories of a single repository?

Chris Green cl at isbd.net
Tue Apr 28 19:25:30 UTC 2020


On Tue, Apr 28, 2020 at 06:46:17PM +0200, Manuel Jacob wrote:
> On 2020-04-28 17:38, Chris Green wrote:
> > I have a number of separate small projects maintained using mercurial,
> > since they all relate to Dokuwiki and could probably, in the long
> > term, share some code it would see sensible to combine them into a
> > single repository.
> > 
> > So, given a set of separate projects each with its own .hg as follows:-
> > 
> >     ./dokuwiki/plugins/servlog/.hg
> >     ./dokuwiki/plugins/tagentry/.hg
> >     ./dokuwiki/plugins/trip/.hg
> >     ./dokuwiki/plugins/showmail/.hg
> >     ./dokuwiki/tpl/roundbox/.hg
> >     ./dokuwiki/tpl/dokucms/.hg
> > 
> > How do I combine them into a single mercurial repository with its data
> > stored in ./dokuwiki/.hg ?
> 
> One possibility would be:
> 
> * Create a new repository.

OK


> * Pull from each small repository. After having done this for all small
> repositories, all branches from all repositories will coexist in the new
> repository.

But there are lots of files with the same name in the separate
projects, for example nearly all of them will have one or both of
action.php and/or syntax.php.


> * Rename the files in each of the branches such that they will be at the
> right place in the end. E.g. for each file in ./dokuwiki/plugins/servlog/,
> run "hg mv <filename> ./dokuwiki/plugins/servlog/<filename>".

I guess I need to automate this with bash and wildcards as otherwise
it will take a *long* time.  There's around 1000 files involved.


> * Merge the branches that you want to develop together in the future.
> 
No branches at the moment.


> If you want all the history to be interleaved instead of just merged
> together at one place, a more sophisticated solution is needed.

I'm not sure I'm clever enough to even understand what this means! :-)

Thanks everone anyway.

-- 
Chris Green



More information about the Mercurial mailing list