1

I'm looking for any suggestions or tools that can be used to migrate a Mercurial(hg) repository on a Windows 7 system to a TFS repository on Visualstudio.com. I currently use TortoiseHg to interface with the Mercuial repository. I had found a post that says i can be done with SVNBridge but no details and it didn't makes sense to me since SVN is different than Mercurial.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
dblwizard
  • 595
  • 7
  • 26

1 Answers1

2

If you are using Git version control for your VSTS repository, you can use Hg-Git mercurial plugin to convert a hg repository to Git repository.

A link for your reference: Easy Migration from Mercurial to Git

If you are using Team Foundation Version Control (TFVC) for your VSTS repository, there isn't any tool to migration it directly as I know. But you can convert the Mercurial repository to Git repository first and then use git-tfs to convert the Git repository to TFVC repository.

Update: You can following the steps below to do this:

  1. Create a new folder.

  2. Navigate to the created folder and run "git-tfs clone https://xxxx.visualstudio.com/DefaultCollection/ $/Project" command. This will create a local git repo in the folder.

  3. Open the git repo folder and run "git remote add origin " command.

  4. Run "git pull origin yourbranch" command.

  5. Run “git-tfs checkin" command.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • Eddie, I'm working through this and am curious if I'm missing something or if the instructions are just a bit off. On the get-tfs site (http://git-tfs.com/ the instructions say "get tfs ..." instead of "get-tfs ..." is that just typo's or did I not get something installed properly? – dblwizard Apr 18 '16 at 23:39
  • Eddie, I put Gitblit on a second temporary workstation(gitblit server) and imported the mercurial repositories into the git repository and can view it via a browser. But now I want to configure my dev box to point to both the git repository and the TFVC but I'm not seeing how to configure the git and git-tfs version on my dev box or exactly what the next step is. Do I have to Clone the TFVC repository? Where do I configure git to point to the gitblit server? Any help would be appreciated. – dblwizard Apr 19 '16 at 15:02
  • Eddie, when I run the clone command I get "Given tfs name is not correct URI and not found as a registered TFS instance". I've got through each of the visual studio installations and made sure the visualstudio.com instance is registered as a server. – dblwizard Apr 29 '16 at 00:47
  • Eddie, don't know how many times I looked at it but the "\" between the url and "DefaultCollection" was wrong ... fixed that ...moving on to next step. Will keep you posted. – dblwizard Apr 29 '16 at 20:17
  • Eddie, here's my confusion, how do I "open the git repo folder" when its on a second machine using gitblt? Do I have "clone" that repo locally on my dev box? – dblwizard Apr 29 '16 at 21:00
  • @dblwizard No,not the git folder on gitblt, it is the follder that created by git-tfs command on your local machine. It usually locates in the new folder that created at step 1 and named as your project name. – Eddie Chen - MSFT Apr 29 '16 at 21:49
  • Eddie, when I type the "git remote add origin" I get the following:C:\Development\TFSTemp\ProjectName>git remote add origin usage: git remote add [] -f, --fetch fetch the remote branches --tags import all tags and associated objects when fetching or do not fetch any tag at all (--no-tags) -t, --track branch(es) to track -m, --master master branch --mirror[=] set up remote as a mirror to push to or fetch from – dblwizard May 02 '16 at 20:36
  • Is "origin" where I put the http:// link to the temporary GIT repository that I'm trying to import? – dblwizard May 02 '16 at 20:38
  • @dblwizard You need to add your remote repo url after git remote add origin command – Eddie Chen - MSFT May 03 '16 at 00:48
  • Eddie, I've downloaded the latest version of GIT but I still get the usage message mentioned above when I enter "git remote add origin". Am I missing something here? – dblwizard May 04 '16 at 16:37
  • @dblwizard Did you enter the command like this: git remote add origin http://? – Eddie Chen - MSFT May 05 '16 at 04:16
  • Eddie, No. I didn't get that from your previous instructions. So is it just the url to the server without any of the projects in the path? Also is there a way to control where in the VSTS Repository it gets added? – dblwizard May 10 '16 at 21:21
  • @dblwizard Sorry for didn't mention it in the answer. It is the entire path of your remote Git repository. – Eddie Chen - MSFT May 11 '16 at 02:59
  • I ran all this through a trial run and then deleted the Project, which was my only project on TFVC, and then created a new one. The problem is it looks like TFVC is doing something with the "DefaultCollection" becuase now it looks like its gone away ... sort of. It now created a Collection based on the new Project Name. Now when I enter "git-tfs clone https://xxxxx.visualstudio.com/ProjectName/ $/ProjectName". I get "The system cannot find the file specified" – dblwizard May 20 '16 at 21:57
  • @dblwizard This is a change in VSTS recently. Just remove the projectname from the URL like this: "git-tfs clone xxxxx.visualstudio.com/ $/ProjectName". – Eddie Chen - MSFT May 23 '16 at 06:48
  • that doesn't seem to work. I'm entering:"git-tfs clone https://xxxxxx.visualstudio.com/ $/ProjectName" and I get: "The system cannot find the file specified" – dblwizard May 23 '16 at 15:42
  • After almost a year and having gotten pulled 14 different directions I'm now trying to do this again. I'm now to the of running the "git pull origin yourbranch" command and using "master" and get "fatal: Couldn't find remote ref master" I've tried "master", "default", "head" all with the same result. Any chance you can point me in the right direction? – dblwizard Mar 15 '17 at 17:59