6

I am using Mercurial to develop a client project. After I've been working on this for 2 weeks, the client has now requested that I keep all code in their SVN repo.

I want to continue to use Mercurial for development, but to keep the client happy, export all commits (w/ messages) into SVN as well.

Is this possible?

Jon L.
  • 2,292
  • 2
  • 19
  • 31

1 Answers1

3

You can use Mercurial as client to their subversion repository.

Have you checked out hgsubversion yet? This allows you to have complete history in Mercurial.

See the details at : https://www.mercurial-scm.org/wiki/WorkingWithSubversion

It provides three ways of working with Subversion. Make sure that you use one and do not mix them.

  1. With hgsubversion
  2. With MQ
  3. Convert extension

[Personal Experience]

I have found hgsubversion better how ever it may have issues while converting the suversion repo to a Mercurial repo.

# This usually fails for a svn repo with 
# large history or large files in revchanges

hg clone svn+http://.../svn local-hg

# If the above has any issues and dies before converting the repo, use hg pull
hg pull

Issue: You have an existing repo already.

  1. I guess the best way would be to create another Mercurial repo from the subversion repo using one of the methods above.
  2. Pull your change sets into this new repo from the older one to get all the changes and history from the previous one
  3. Now you are ready to submit the changes to svn repository
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
pyfunc
  • 65,343
  • 15
  • 148
  • 136
  • So would this solution allow me to keep using my *exist* hg repo, to sync the changes into their SVN repo? Even better would be the ability to pull new changes from SVN (in case there is anyone making changes on their side as well). Would this be doable? – Jon L. Nov 29 '10 at 18:04
  • @Jon L.: Yes you will need to clone the svn repo using one of the three methods. This will allow you to use Mercurial as a client to subversion. Then you will need to sync this new repo with your changes from older repo via hg pull. Then use the new repo to push the changes to svn repo. – pyfunc Nov 29 '10 at 18:10
  • Well... clone an empty repo from the svn server, then hg pull your changes from your current hg repo. – jkerian Nov 29 '10 at 18:11
  • One issue I encountered is that pulling first from SVN using hgsubversion and then pulling from your existing hg repo means you have to force the pull because the repositories are unrelated. This also means that the pull will bring in the _whole_ repo from hg since mercurial cannot determine that hg rev 101 from your old repository should have rev 100 as parent. I have not yet found a way to overcome this problem. – Masterfu Aug 02 '11 at 09:36