Transplanting mercurial changeset onto hgsubversion converted repository

217 views Asked by At

I have been migrating from subversion to mercurial piecemeal and this has created a bit of a tangle. I had an old SVN server (pre 1.4) to start with so here is what happened.

  1. HgSubversion did not want to pull in the full history from trunk, so I did a shallow convert.
  2. My colleagues did their last commits to SVN and I pulled those into Hg.
  3. We moved over to Hg and started pushing to it
  4. Just to be safe one of my colleagues made some more commits to SVN.
  5. I managed upgrade the SVN server and get the full repo to the new SVN.
  6. HgSubversion pulled in the full history successfully - including the few extra/duplicate commits.

Now I would like to "transplant" the commits in the shallow mercurial repository into the full history, the repositories are related in content but unrelated in mercurial hashes.Short of just copy pasting content what would be the best way to migrate the changes ? Eventually everybody should be able:

  1. To switch the Hg repo with full history and keep working
  2. Have automated push from the Hg repos of suitable squashed/rebased changesets to SVN as a service user.

I would like a concrete example with the following scenario.

  • Last mercurial hash at step 2 - A
  • Current mercurial hash after pushes step 3 - B
  • Hash of last commit after pull from upgraded SVN - C
  • Hash of step 2 commit after full SVN history pull - D

I am not very good at ASCII art, feel free to add one for bonus points.

1

There are 1 answers

2
krtek On BEST ANSWER

We did a CVS -> Mercurial migration last week at work. Like in your case, some people continued to use the CVS for a time.

In order to sync the the two repositories when the CVS server was finally shutdown, I did the following :

  1. Convert the CVS to mercurial via cvs2hg
  2. Export each new revision with hg export
  3. Import the patch files with hg patch

There was only a dozen revisions, so this was no big deal... If you have many more revisions, you could maybe take a look at the transplant extension.

Hope this helps.