Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mirror a Mercurial repository into Subversion?

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?

like image 739
Jon L. Avatar asked Nov 29 '10 17:11

Jon L.


People also ask

What is mercurial SVN?

Mercurial is a distributed revision control tool for software developers. It is supported on Microsoft Windows and Unix-like systems, such as FreeBSD, macOS, and Linux.

What is SVN mirror?

svnsync is the Subversion remote repository mirroring tool. Put simply, it allows you to replay the revisions of one repository into another one. In any mirroring scenario, there are two repositories: the source repository, and the mirror (or “sink”) repository.

Does SVN store diffs?

It doesn't make complete copies of nodes; instead, it stores the latest revision as a full text, and previous revisions as a succession of reverse diffs (the word "diff" is used loosely here – for files, it means vdeltas, for directories, it means a format that expresses changes to directories).

How do I create a full mirror of a subvrsion repository?

Here are three ways to create a full mirror of a Subvrsion repository: File Copy: treat the repository like any other filesystem and recursively copy it to the mirror location. Dump/Load: Use svnadmin dump and svnadmin load. Hotcopy: Use svnadmin hotcopy. All these ways have their own advantage and disadvantage.

How do I copy a Subversion repository?

The command line of copy a subversion repository is Svnadmin dump is designed to create a portable repository dump. The resulting dumpfile can be loaded into a new Subversion repository – even if the new repository is using a different database backend, or even a different revision of Subverson.

How do I synchronise a mirror with the source repository?

Once the destination repository has been initialised as a mirror, it can be brought into synchronisation with the source repository at any time by means of the svnsync sync command: It is a good idea to issue the first synchronisation command manually in order to check that the mirror has been configured correctly.

How does svnsync work with subversion?

svnsync cannot lose connectivity to the destination repository, therefore there is less chance of the repository being left in a locked state. Create an empty Subversion repository in the normal manner. svnsync makes the assumption that it has exclusive control of the destination repository.


1 Answers

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
like image 81
pyfunc Avatar answered Oct 15 '22 11:10

pyfunc