As part of a little bit of re-organisation work I undertook today I needed to move a project out of one Visual Studio Solution into it’s own solution. As part of that move I needed to move the code from it’s original Mercurial repository into a new one.
The first job is to create a new Visual Studio solution in which to put the existing project.
- Create new empty Visual Studio Solution
- Create a Mercurial repository in the root folder of the solution
- Copy my standard .hgignore file and nuget-update.bat files in there
- Commit all files to the new repository
- Clone the repository to a temporary “work” one, just in case I screwed something up!
- Load up a powershell console
- cd <cloned repo folder>
- notepad filemap.txt
- add “include <path of project relative to root repo path of source solution>” – in my case include “ReadThroughProviders”, this is a folder within the solution folder I’m taking the project from
- make a backup of the filemap.txt file just in case I need to start again (copy filemap.txt ..)
hg convert --filemap filemap.txt C:\Dev\SourceSolutionFolder C:\Dev\TargetSolutionFolder.Clone
- hg merge
- hg commit
- hg update
- Add project to the new blank solution in Visual Studio
- run nuget-update.bat to make sure all my dependencies are okay
- build the solution to make sure all is well
- hg commit
- hg push (I also created a new repository on our Kiln server)
… and relax!