status of SVN to Mercurial conversion tools

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Aug 30 06:00:26 CDT 2007


On 2007-08-28 15:17, Manlio Perillo <manlio_perillo at libero.it> wrote:
>Giorgos Keramidas ha scritto:
>> Try the builtin "hg convert" support of recent "crew" builds, and let
>> us know how it worked then :-)
>
> Sorry, I have another question :).
>
> Subversion copy command supports the -r option, used to copy a file
> from a specific revision.

In its simplest form, where you "svn copy -r REV" an entire directory,
this is called "branching off a specific revision".

This is easy to do in Mercurial, because *every* *single* commit, is a
potential branch-point.  This way, you can create a revision history
graph like the following:

    [0]----[1]----[2]
            \
             `----------[3]

Where [3] is a "branch" created on top of the revision [1] sources.

This is how "hg convert" handles branches spinned off a particular
Subversion revision with "svn copy -r REV" too.  It creates a branch
whose "parent" changeset is not the "tip" of the workspace, but the
correct "older" changeset.

If you "merge" only a single file from "trunk" to a Subversion branch,
then this is recorded as a plain commit to the file you merged.  For
example, here's how the "graphlog" extension displays an Hg workspace
which contains a converted Subversion repository which was created
with:

  * An import of mercurial/crew sources on 'trunk"

  * A branch created from "trunk"

  * A couple of commits to "trunk", affecting trunk/README

  * A merge (with subversion) of -r 2:5 from trunk to the branch.

The "hg glog" command shows both the branch (created with Hg changeset
3:202cb73dbefb below), and the "merge" from trunk to the branch.  A
catch which you should watch out for is that a plain Subversion
repository has no merge-tracking information so this merge is not
visible as a Mercurial-style merge in the converted tree.

  o  changeset:   5:99d62933b20b
  |  tag:         tip
  |  user:        keramida
  |  date:        Thu Aug 30 10:52:03 2007 +0000
  |  summary:     Add extended help command information.
  |
  o  changeset:   4:407587d3e520
  |  parent:      1:282ac9fa9345
  |  user:        keramida
  |  date:        Thu Aug 30 10:52:00 2007 +0000
  |  summary:     Add a second help viewer command.
  |
  | o  changeset:   3:202cb73dbefb
  | |  branch:      crew
  | |  user:        keramida
  | |  date:        Thu Aug 30 10:54:05 2007 +0000
  | |  summary:     Merge -r 2:5 from the trunk.
  | |
  | o  changeset:   2:c16a0b3641f0
  |/   branch:      crew
  |    user:        keramida
  |    date:        Thu Aug 30 10:51:03 2007 +0000
  |    summary:     Create a "crew" branch off the "trunk".
  |
  o  changeset:   1:282ac9fa9345
  |  user:        keramida
  |  date:        Thu Aug 30 10:51:00 2007 +0000
  |  summary:     Import a snapshot of the Mercurial "crew" source tree.
  |
  o  changeset:   0:fca4834da3d8
     user:        keramida
     date:        Thu Aug 30 10:50:00 2007 +0000
     summary:     Standard subversion repo structure.

I hope this helps,

- Giorgos



More information about the Mercurial mailing list