开发者

Workflow when using HG Subversion to push to SVN

This question is very similar to the one posed in this question, but I'm having some issues following the workaround.

The Problem:

Basically I have a subversion server and a mercurial local client. The extension hg-subversion allows mercurial to act as a subversion client. This is ideal for me because I can make unlimited feature branches off my subversion development branch and merge them in as I choose fit.

Due to a limitation of subversion, I cannot commit a branch merge to a subversion repository. In fact, I don't need to commit every branch merge, I just want the "default" branch head to be committed to SVN.

The Proposed Solution:

A workaround user Harvey recommended was to modify my workflow to include an hg-only clone of a hgsubversion clone for development.

To quote Harvey:

The trick is to learn the modified hg<->hgsubversion<->svn workflow. Once you "get" how it works, you won't have any trouble. You'll just type a few more commands. I've actually started writing scripts to make the process (which is repetitive) easier. Typical flow: [in "hg" repo] commit a bunch of changes; push them to "hgsubversion"; [switch to "hgsubversion"] hg update (hgsubversion needs this); hg push to "svn" (which automatically re-pulls after you push and removes your changesets locally); [switch back to "hg"] hg pull from "hgsubversion"; hg strip the older duplicates b/c "hg" isn't an hgsubversion clone and doesn't know to automatically strip the old changesets.

The Issue I'm Running Into:

I'm ge开发者_Python百科tting stuck at the point where I run hg push from hgsubversion to the svn repository. I'm still getting the error message, "abort: Sorry, can't find svn parent of a merge revision."

Admittedly I'm not 100% on how hgsubversion pushes revisions to svn. Honestly I'd like to see the state my local copy is in pushed to the svn server.

Halp?


I have decided to answer my own question for archival purposes (and for those having the same issue).

I found another similar question where the answer was simply stated, you can't do it. Please refer to the above link and up-vote Eric-Karl's answer if this was helpful to you. He does offer a work-around to recover.


Using HgSubversion knowledge

If I understand the question correctly, hgsubversion will only push to your current revision.

e.g. if you've done 10,11,12,and then merged a 13 from a dev branch. You can

hg up 12
hg push

Due to the way it'll do the rebases etc, you'll end up pushing to 12 and then being updated to 13, but it works for me.

New hg functionality

Use the mercurial phases and mark the revisions you don't want to push as secret. Of course this will prevent you from pushing to other repositories as well.

Use corporate policy

The other nice situation at our work is that all code commits must have a reviewer and issue. If something is not intended for svn (but is in our team/spike repository), then I don't put that information in and any accidents are stopped by a pre-commit hook failure.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜