views:

1072

answers:

6

A similar question has been asked recently, but is not the same.

The Mercurial website has a detailed page listing comparisons for 4 different options for getting Mercurial and Subversion to interoperate.

I am wondering if anyone out there has tried one or more of these, and could relate any really good or really bad experiences. The note on the hgsubversion download says

hgsubversion is an extension for Mercurial that allows using Mercurial as a Subversion client. Right now it is not ready for production use. You should only be using this if you're ready to hack on it, and go diving into the internals of Mercurial and/or Subversion.

which is about as inviting to me signs that say "Abandon hope, all ye who enter here" or "Trespassers will be arrested". So I'm just wondering if this or any of the other alternatives are worth trying for someone who doesn't have a lot of extra time to hack around.

+1  A: 

I've been using Subversion for several years, but I'm interested in trying out this distributed VCS idea. (I would like to use git, but it isn't so good on Windows which rules it out for use at my work. So I next would like to try Mercurial.)

I initially would like to push and pull with a Subversion server. So I tried option 1, hgsubversion. I'm on Ubuntu 9.04 (Jaunty) with hg 1.1.2. I followed the directions given on that web page. It all seemed to install fine. But when I tried the hg svnclone command, I got an "unknown command" error. Further digging showed that now you just do hg clone with the SVN URL prefixed by svn+. e.g.:

hg clone svn+https://server/svn/repo/

But then, I got an error message:

abort: could not import module encoding!

That seems to be a known bug, but after some fiddling around, I couldn't figure out what I'm meant to do to fix it.

Summary: option 1 currently not functional for me. The other options don't fit my desired work-flow.

Update: I tried it again with Mercurial 1.2.1, and got the same result. Someone told me that the in-development mercurial-crew branch should work.

Craig McQueen
you need the latest versions of mercurial and hgsubversion. However - be careful with hgsubversion at the moment. It looks like there is a lot of refactoring going on
Nick R
Thanks. I added an update re 1.2.1 and mercurial-crew.
Craig McQueen
Yeah, you need Mercurial 1.3 -- the encoding module was added after 1.2.1 was released.
Martin Geisler
+2  A: 

I think hgsubversions author is being a bit paranoid. If you follow the README - meaning use suitably recent versions of mercurial and subversion - not whatever happens to be installed on or by your distro - then it actually works fairly well. Likewise, the documentation included is up to date; whereas what you find on the web may not be. I've been using it for a couple of weeks with reasonable - but not perfect - results.

It's when you get into the corners of the two systems that you have problems: hgsubversion and other extensions (I have problems with hgtasks) don't seem to like each other; it's not clear how properties are handled, etc.

+2  A: 

Yeah, you must use a recent "crew version" of Mercurial, see the CrewRepository page on the Mercurial wiki.

When Mercurial 1.3 is released on July 1st, hgsubversion should begin maintaining a stable branch. At least that's the word on IRC (#hgsubversion on irc.freenode.net).

Martin Geisler
ooh ahh. I look fwd to Jul 1 then.
Jason S
dohhwww, it looks like this is not true for hgsubversion; the "convert" extension is the thing that apparently got added/released
Jason S
The convert extension is the one that is shipped with Mercurial (and has been shipped for a long time). I'm sorry that hgsubversion has not yet released a stable version, apparently they got into a bigger rewrite than they thought at the time I answered this question.
Martin Geisler
+3  A: 

I've just started working with option 4, hgsvn. Despite what the Mercurial page says, hgsvn 0.1.7 does support pushing back to the svn repo.

My use case is very simple: I really only want the ability to have local branches (at this stage). The workflow listed on the hgsvn page is exactly what I've used and so far it hasn't broken anything.

Matt F
+3  A: 

I'd like to second option hgsvn, it's rather slow if you want to mirror a big repository, but you can start at revision close to the tip (which is usually what you want anyway).

I found it very robust, mirrored repositories with over 5000 revisions. You can push changesets back if that's what you want.

wires
Let me add a tip: I currently use mercurial + hgsvn + http://arrenbrecht.ch/mercurial/pbranch/ to contribute to (open source) projects. Just pull the svn repo into mercurial manage your patches using pbranch. You then communicate your patches via email to the project maintainers.
wires
A: 

I have been using hgsubversion for several months. You might be missing some features but it is ready for production use.

OGRE and many others have decided to use hgsubversion because it is fast.

afriza