svnmercurialdvcshgsubversion

Submitting Hg changes back to SVN


I've began work in an SVN repository. I've cloned a subfolder of it into a local Hg repo with hg clone.

Afterwards, I wanted to share this with a colleague who does not have access to the SVN repository. I've created a private BitBucket repository, and we occasionally pushed the changes, and hence I had to pull them.

hgsubversion does some nasty things to changesets, such as changing their committer (and I believe even the hash). When I tried pushing and pulling to the BitBucket repo, I had to do a merge.

Now I am unable to push changes back into the Subversion repository due to our beloved friend, abort: Sorry, can't find svn parent of a merge revision..

How would one pull the BitBucket-targetting Mercurial repository with the svn-targetting Mercurial repository, while staying compatible with hgsubversion (that is, without importing the merge revisions)?

Some automated way to do this would be appreciated, of course, but if there is no such thing/easy way to do this, I'd be grateful for any solution.

I use hgsubversion, not hgsvn; that is, the extension in which one does hg clone svn://repo/url. I am open to switching, though, if necessary.


Solution

  • When you use Mercurial on a subversion repository, you have to still think like SVN does, so a lot of features part of the basic mercurial workflow just won't work. Merging the way mercurial does it is impossible on a svn depot. If you have merged your work with the pulled svn branch, you'll get the infamous about message you're getting now :(

    I suggest you read durin42's answer to this question.

    EDIT : To get out of your current mess, I suggest you create a patch (or a series of patches) from the point you checkout from the SVN repo. Get a new fresh copy from the subversion repository and apply the patch(es). I am not sure you'll be able to do it from your current repo. You could explore the hg diff command.

    hg diff -g -r tip -r XXX > patch
    

    with XXX being your original SVN checkout (I haven't tested it yet.)