I assume that you had something like this structure:
main.c
lib1.c
lib2.c
You renamed the files and got something like this:
main.c
lib/lib1.c
lib/lib2.c
You now want something like this as you lib
repository:
lib1.c
lib2.c
I assume this last part because, when you include it as a sub-repository, it will look like the your original repository did after the rename.
I would do this in a few stages.
The first stage would be to do as you probably already did. Convert the repository with the command line hg convert --filemap LibTempMap.txt Main LibTemp
and the following contents of LibTempMap.txt
:
exclude *
include lib
rename lib .
This gives you a repository with the history after the rename.
The second stage would be to convert the repository before the rename with the command line hg convert --rev X --filemap LibMap.txt Main Lib
(where X is the revision before the rename) and the following contents of LibMap.txt
:
exclude *
include lib1.c
include lib2.c
This gives you a repository with the history from before the rename.
I would then transplant the later changes from LibTemp
to Lib
using hg transplant -s ..\LibTemp Y:tip
from within the Lib
folder (where Y
is the revision after the rename in the LibTemp
repository). This should transplant cleanly as you made sure that the file structures were the same in the temporary repository by doing the rename during the convert.
You're then left with the Lib
repository containing the history and files that you want and can delete the LibTemp
repository.