7

I currently have my ASP.NET and C# source code versioned using a local Debian Linux machine on my network using Subversion. My local path to the repo is: http://carbon.local/svn/main/WebSites/MooDB

I want to move my source code to Mercurial and have it hosted on bitbucket.org. I've set up an account on bitbucket and want to convert my local SVN to Hg and then upload the repo complete with history to bitbucket. The bitbucket repo is here:

https://bitbucket.org/keymoo/moodb

I've done some googling and tried this in a temp working directory (running this on Windows 7 and have installed TortoiseHg):

hg convert http://carbon.local/svn/main/WebSites/MooDB

This creates a .hg folder where I ran the command but my source code has not been copied. I'm also unsure how to get the repo and history into bitbucket. Please help, I just want to get up and running with my repo+history on bitbucket ASAP.

Mark Allison
  • 6,838
  • 33
  • 102
  • 151

2 Answers2

7

That's easy.

  1. Install hgsubversion.
  2. Create a folder for Hg version of your repository:
    mkdir MooDB_hg
    cd MooDB_hg
  3. Clone your SVN repository to the local folder:
    hg clone svn+http://carbon.local/svn/main/WebSites/MooDB
  4. Push it to bitbucket:
    hg push https://bitbucket.org/keymoo/moodb
yurymik
  • 2,194
  • 20
  • 14
6

Your repository and source code have certainly been copied. You can think of the .hg directory as being the repository, like your Subversion server, except it's local. Mercurial keeps a copy of the whole repository locally. The reason you can't see any files is because you haven't checked out a specific revision yet, which you can do by entering the directory where your converted repository is and typing hg update.

If you want to upload your repository to Bitbucket, you will have to configure the Bitbucket repository within your repository's .hg/hgrc file according to the Bitbucket documentation. You can then push the repository to Bitbucket using hg push.

More specifically, you need to tell your repository where it can find your remote repository. Here's an example with a test repository I created at Bitbucket:

[paths]
default = https://csstaub@bitbucket.org/csstaub/test

That tells Mercurial "there is a remote repository with the name default and it is located at the following address". You have to take the address of your repository as shown on it's Bitbucket page. Then you can do an hg push in order to push the repository to Bitbucket.

Here are some links to the Bitbucket documentation to get you started:

Cedric
  • 720
  • 5
  • 11
  • Thanks `hg update` did the trick to get my files into the directory. What should I configure in the .hg/hgrc file? On Windows 7 that would be `C:\Users\MY_NAME\mercurial.ini` right? I've looked through the bitbucket docs and can't find anything on how to configure it. I have an empty repo at Bitbucket, how do I get my files and history into it? – Mark Allison Feb 10 '11 at 16:30
  • 1
    The mercurial.ini file is the user-specific configuration, but what you want is the repository-specific configuration, and that file should be in `.hg/hgrc` as far as I know. – Cedric Feb 10 '11 at 16:33