Mercurial convert with filemap to separate subfolders creates empty repository

3k views Asked by At

I have a large Hg repository (2+GB) that was converted from an svn repository. It has a number of websites in it, and we want to separate those out into separate Hg repos. The repositories are on a Windows 2008 Server and we're using the hg that comes with TortoiseHg.

We've been trying to use the convert method with a filemap to create a new repo from the converted repository.

The problem is that the command runs through all the changesets in the source repo, but the newly created repo is empty.

This is what the command line looks like:

hg convert -s hg --filemap "hgsplitstaticsites-site1.txt" staticsites-hg "C:\projects\marcelsprojects\hgversions\site1-hg"

The filemap looks like this:

include staticsites-hg/site1
rename staticsites-hg/site1 .

Any help would be greatly appreciated.

we've also tried running hg convert on the subfolder in the svn repository, but that actually throws an exception and exits.


We gave up on this one, and just separated the sub folders into separate Hg repos, and lost all of the version history.

6

There are 6 answers

1
Andy Edinborough On BEST ANSWER

I wrote a batch script to help with running the hg convert command. Can I clone part of a Mercurial repository?

0
Isopod On

I also just had the problem with the empty repository. The problem in my case was that I used Windows-style path names (with backslash instead of a normal slash) in my filemap like this:

include src\file1.pas
include src\file2.pas
...

But it had to be in the POSIX format:

include src/file1.pas
include src/file2.pas
...

Apparently you also may not prepend ./ to the path as it produced an empty repository as well.

Your filemap looks okay, so this could not have been the cause in your case, but maybe this will help others who are having this problem and find this page through Google.

1
cezio On

What is the output of hg convert? What do you mean by empty repository? If you do hg log in target repository, do you have any entries?

0
Zoltán On

This answer was spot on: you don't actually create an empty directory, but a directory with a hidden .hg directory. If you run

hg update

in your target directory, you will have your target directory with all its contents as expected.

1
Ruu On

My problem with empty repository was due to pathnames in the filemap were of the wrong case.

1
Ako On

I had the same issue, it's caused by your include line. You need to specify relative path, not the repository one..

E.g

svnrepo > branches |
        | tags     |
        | trunk    > Project1
                   | Project2

Your filemap should look like this

include Project1