2

I would like to import the source code from a Subversion repository to Mercurial. Using Hg Subversion I imported it. The problem is, the layout of the SVN repo is the default one - with trunk directory, branches at the branches directory etc. - today, but it was not so before. Some time ago, all directories of the project were a the root repository, so Hg Subversion could not convert the branches directory to Mercurial branches and the new Mercurial repository just contains the directories branches and trunk.

I converted the branches directories into Mercurial branches the "hard way":

  • for each branch b
  • hg mv branches/$b .
  • hg rm branches trunk
  • hg branch $b
  • hg commint -m "Creating branch $b"

However, I wonder: is there a better way to do it? How would you solve this problem?

brandizzi
  • 26,083
  • 8
  • 103
  • 158

3 Answers3

0

hgsubversion should have auto-detected the presence of the trunk/tags/branches directories and done the intelligent thing. Did you force hgsubversion into a non-automatic mode to get it to not do that?

durin42
  • 1,447
  • 8
  • 10
0

The answer is no, there was no better method. This situation was very specific, and there was an workaround, so I assume a "fix" wouldn't probably be worth it. I solved following the steps in the question, and would recommend it for most people in this situation.

brandizzi
  • 26,083
  • 8
  • 103
  • 158
-1
$ hg help convert

The filemap is a file that allows filtering and remapping of files and
directories. Each line can contain one of the following directives:

  include path/to/file-or-dir

  exclude path/to/file-or-dir

  rename path/to/source path/to/destination  <== YOUR CASE

--filemap FILE     remap file names using contents of file
gavenkoa
  • 45,285
  • 19
  • 251
  • 303