svncvscvs2svn

Solving svnadmin error E160020 on trunk


The context

I'm migrating old CVS repositories into SVN. We have a repository for our enterprise components and another for all company projects. For the company projects, for which the migration is scheduled to be manual for each project, we chose to use the multi-solution layout

-solution1
    -branches
        -
        -
        -
    -tags
        -
        -
        -
    -trunk
        -component1
        -component2

Instead, for the core components, we chose a single-solution-multi-project layout

-branches
    -
    -
    -
    -
-tags
    -
    -
    -
-trunk
    -compv1
    -compv2
    -compv3
    -tools
    -utils
    -etc

(Different major version are treated as separate projects and maintaned)

The tool

Now, since the migration of core components is expected to be a one-shot event, I prepared a script to migrate everything to the dedicated SVN repository. Based on what I did on the other projects, I created a script to be launched with project-name argument

#!/bin/bash
PROJECT_NAME=$1
TARGET_REPO=$2
PROJECT_ROOT=/tmp/cvs_copy

sudo -u apache cvs2svn --dumpfile=/tmp/$PROJECT_NAME.dump --trunk=trunk/$PROJECT_NAME --branches=branches --tags=tags --tmpdir=/tmp/cvs2svn --encoding=windows-1252 --dry-run $PROJECT_ROOT/$PROJECT_NAME/

sudo -u apache cvs2svn --dumpfile=/tmp/$PROJECT_NAME.dump --trunk=trunk/$PROJECT_NAME --branches=branches --tags=tags --tmpdir=/tmp/cvs2svn --encoding=windows-1252 $PROJECT_ROOT/$PROJECT_NAME/

sudo -u apache svnadmin load /srv/svn/repos/phoenix/ < /tmp/$PROJECT_NAME.dump

The problem

I can successfully migrate the first project, but when it comes the time for the second, I obviously get the following error

svnadmin: E160020: File already exists: filesystem '70ce675a-1390-4203-9115-015d7d1d3a47', transaction '155-4b', path '/trunk'

Obviously because, thinking about it, the dump contains a transaction to create the root trunk directory, which conflicts with the current repository layout: on T-0, it's empty; on T-1, after importing project 1, it contains trunk, and it cannot evolve to T-2 because trunk already exists.

The question

I would like to tell svnadmin load that it can gracefully skip the creation of the trunk directory when it exists. I'm no master of parent-dir flag but I assume that it creates everything under parent-dir, which is what I want in the first layout shown you above.

Can you provide advice on performing this migration?


Solution

  • svnadmin load always re-create the whole tree, stored in dump, in repository. --parent-dir just allow to change "mount point" of root for this tree on load. F.e - dumped /trunk/, loaded with --parent-dir somedir, will produce /somedir/trunk/... in new repository

    In your case you have at least two ways: