I have two Mercurial repositories. Both repos have their own unrelated history. Let's call them:
- "Main" (contains the project itself)
- "Lab" (contains some related content)
I would now like to "import" the Lab repo into the Main repo with the following constraints:
- Both repos shall keep their history.
Labshall be stored as a subfolder inMain.- The changes from
Labshall be be located in a branch which gets merged intoMain.
Following https://www.mercurial-scm.org/wiki/MergingUnrelatedRepositories basically works but doesn't create a branch.
Given a repository
MainandLab, you can merge theLabrepository into the Main repository and rename its default branch to some other name by doing the following with theconvertextension:default Lab. Using this branchmap, the Lab changesets in the "default" branch will be named "Lab". If you have other branches in your Lab repository, you may want additional entries.hg convert Lab Main --branchmap branchmap.txt. This assumes the Lab and Main repository directories, and the branchmap.txt file, are in the current directory. Adjust paths accordingly. The Lab changesets will be added to the Main repository.a.
hg update Labb.
mkdir Labc.
hg move * Labd.hg ci -m "Moved Lab files to Lab subdirectory"e.
hg update defaultf.
hg merge Labg.
hg ci -m MergeNow you can continue to modify the Lab branch in the future and merge to default as needed.