Sunday, 24 January 2016

Migrating from Mercurial Kiln to Visual Studio Online (Git)

So we migrated all of our Mercury repositories, hosted in Kiln, to Visual Studio Online last week and this is the procedure we followed.

We only had 3 separate repositories and they are relatively small, so we deemed it unnecessary to try a more scalable approach. 

All the command line commands are run from a Developer Command Prompt for VS 2015.

1. Clone Mercury Repository to be migrated to a new directory.
hg clone <repo url>
2. Create new Harmony Repository
a. Navigate to https://<yourcompany>.kilnhg.com/Code/Repositories
b. Click on New Repository

It's very important that you select a Harmony Repository, otherwise this process will not work. Forking or Branching a Mercury only repository will not work either, as it simple creates a new Mercury repository.
3. Push to new Harmony Repository
 a. Edit  the .hg/hgrc file and change the path the new repository url
[paths]
default = https://<>.kilnhg.com/Code/Repositories/Group/Test_Migration
b. hg push  
Once this is has finished the Test_Migration repository is a Git & Mercury repository of the initial Mercury only repo, so it's relatively simple from this point onward.
4. Clone Harmony Repository as a Git Repository
git clone <https://<>.kilnhg.com/Code/Repositories/Group/Test_Migration.git>
5. Create new Repository in VSO
a. Navigate to Project
b. Click on Code
Once created you can click on Explorer which will take you to this page

6. Push to VSO
git remote remove origin
git remote add origin https://<yourcompany>.visualstudio.com/DefaultCollection/<project>/_git/<repo>
git push -u origin --all

2 comments:

  1. Hello, Thanks for post. Did you also migrate your Fogbugz cases to VSO work items? If so, how did you manage the migration and keeping the link between Fogbugz case references, in the changeset comment, to match the new VSO work item #?

    ReplyDelete
    Replies
    1. Just the code I'm afraid. The cases in Fogbugz were such a complete mess that we decided to start from fresh.

      Delete