Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Hg locally and pushing to an SVN repo when other team members are just working on SVN -- is this possible?

I've found what appear to be very similar questions here on SO, with what appear to be good answers; but for some reason, I still can't seem to figure out how to get this to work. My concern is that it may simply not be possible.

Here's the situation: I am working on a small team that uses a central SVN repository as our version control system. My pair programmer and I got frustrated not having the option of local commits (and didn't want to have to go through the hassle of using SVN branches), so we looked into using either Git or Mercurial as an SVN client and found that hgsubversion seems capable of doing what we want: to work locally on an Hg repository, commit locally, and only push to SVN when we're ready.

When the time came to push, we received this error message from Hg:

Sorry, can't find svn parent of a merge revision.

I'm wondering if the problem is that we had to pull changes from SVN to get our teammates' updates, then merge with our local changes, and now Hg can't figure out how to make SVN happy? This seems to be the message I'm getting from the other SO questions & answers I've looked at; however, the advice that was dispensed in those cases (doing hg rebase --svn) seems not to work for us either; that same "can't find svn parent" message is given.

Is this even possible? Or is it more trouble than it's worth when other developers on the team are making changes directly to SVN?

like image 270
Dan Tao Avatar asked Mar 24 '11 20:03

Dan Tao


People also ask

What does Git SVN fetch do?

This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches :) You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.

Can I use Git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.


1 Answers

I've been doing this for over a year now and it works great. I get sweet, sweet DVCS love and the rest of the folks, uh... don't. I use hgsubversion as my bridge. I had quite a bit of trouble with hg-svn. YMMV.

I used this to get setup and have been loving it ever since!

The caveat is, you can't use Mercurial to merge changes between branches. You can still work on the branch (use hg up [some-branch]), but when it comes time to merge it into trunk, you'll need to commit, push to some-branch, then use subversion to merge some-branch into trunk.

I've prepared a blog post that describes this procedure in detail. You can see it here: http://xinmyname.tumblr.com/post/11305033055/subversion-mercurial-branches-oh-my

Good luck!

like image 106
Andy S Avatar answered Sep 20 '22 13:09

Andy S