开发者

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 开发者_如何学Gosimply 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?


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!


The problem is that hgsubversion can't push merges from Mercurial to Subversion. As long as you don't create any merge changesets, everything should work fine. (FWIW Subversion merges work fine, as hgsubversion simply disregards the merge info and creates regular, single-parent changesets.) The problem you are describing is one of the known limitations of hgsubversion; others are listed in hg help subversion.

In order to work around this, you might want to consider using the rebase extension to ensure that the history to push is perfectly linear.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜