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

Manuel Jacob me at manueljacob.de
Tue Apr 28 16:46:17 UTC 2020


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.
* Pull from each small repository. After having done this for all small 
repositories, all branches from all repositories will coexist in the new 
repository.
* 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>".
* Merge the branches that you want to develop together in the future.

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



More information about the Mercurial mailing list