Merging local repositories
Benoît Allard
benoit at aeteurope.nl
Wed Jul 23 09:03:56 CDT 2008
Nikolaus Demmel wrote:
> I use mercurial for local version-control. I have created 3
> repositories. One in /a/b/, one in /a/c/ and one in /a/ itsself
> (which includes /a/d/). How can I now merge the repositories in /a/b/
> and /a/c/ to the one in /a/, so that i'm left with only one
> repository and can commit all changes by calling $hg ci in /a/?
>
You will need to use the convert extension in its Hg -> Hg flavour.
first, you will create a copy of the b and c repositories that include
their name as prefix (respectively b and c)
To do that, you will create a filemap file that ask to rename everything
with the new prefix that is:
,--[filemap-b]
|rename . b
`------
for the first one and
,--[filemap-c]
|rename . c
`------
for the second one.
then simply run the convert process:
$ hg convert --filemap filemap-b /a/b /b-renamed
$ hg convert --filemap filemap-c /a/c /c-renamed
At that point, you have copies (not clones, the revision id will be
different, because the filepaths are differents) of the two
sub-repositories. You can delete the original ones (or move them for
precaution).
The last step is to combine them together, you will be using push with
its -f parameter to force the push between unrelated repositories. This
will create new branchs in the main one. Finally, you want to merge the
heads, this shouldn't be a problem as the file shouldn't conflict. As
mercurial commands that give:
$ mv /a/b /b-backup
$ mv /a/c /c-backup
$ hg -R /b-renamed push -f /a
$ hg -R /a merge
$ hg -R /a ci -m"merged with b"
$ hg -R /c-renamed push -f /a
$ hg -R /a merge
$ hg -R /a ci -m"merged with c"
And you've got it ...
Benoit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4197 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial/attachments/20080723/a4a741db/attachment.bin
More information about the Mercurial
mailing list