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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 28 18:10:23 UTC 2020


You have to main options:

A) Keeping each history intact so that the node-id (sha1 hashes) valid 
for the old repositories are still valid in the new repos, at the 
expense of being able to checkout all older content at the same time. 
(so each history is independent). To do this you just have to pull all 
the various repositories in the same repo, and merge the various heads 
together (after renaming into the appropriate directory).

B) Building a consistent view of all the source together at various 
point of time. At the expense of presenting the node-id of the previous 
history. In this case you need to "convert" you repository to change the 
path recorded in each commit (altering commit content and therefor 
nodeid). And then use some custom script to recreate a merged history.

If you can go for the "just pull everything in one repo" option, it will 
be much simpler.

Regards,


On 4/28/20 5:38 PM, 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 ?
> 

-- 
Pierre-Yves David



More information about the Mercurial mailing list