Reputation: 1888
I want to split up one of my Mercurial repositories into two separate repositories. In particular, I want to take a directory sitting at the root level of the repository and convert that into it's own repository.
My initial thought on how to do this is to tell the existing repository to forget about that particular directory, add the directory to .hgignore, and then convert the directory into it's own repository. However, I'd like to preserve the history of the directory in the new repository.
How can I achieve this?
Upvotes: 1
Views: 241
Reputation: 97260
Convert extension with --filemap option will do it. See Converting from Mercurial part
It's also useful to filter Mercurial repositories to get subsets of an existing one. For example to transform a subdirectory subfoo of a repository foo into a repository with its own life (while keeping its full history), do the following:
$ echo include subfoo > /tmp/myfilemap
$ echo rename subfoo . >> /tmp/myfilemap
$ hg convert --filemap /tmp/myfilemap /path/to/repo/foo /tmp/mysubfoo-repo
Upvotes: 3