Question

We have multiple SVN repositories in a particular physical location /mnt/data1/repos

And the repos are in structure as below

repos
     |
     App1
         |
         trunk
              |
              module1
              |
              module2
         |
         branches
     |
     App2
         |
         trunk
              |
              module1
              |
              module2
         |
         branches
     |
     App3
         |
         trunk
              |
              module1
              |
              module2
         |
         branches

We are trying to consolidate multiple repos to single repo as below at a different path /mnt/data2/repo

     repo
     |
     trunk
         |
         App1
            |
            module1
            |
            module2
         |
         App2
            |
            module1
            |
            module2
         |
         App3
            |
            module1
            |
            module2

I created a repo using svnadmin at /mnt/data2/repo

Created directories /mnt/data2/repo/trunk/App1, /mnt/data2/repo/trunk/App2 & /mnt/data2/repo/trunk/App3using svn mkdir.

Then I tried to do svn dump of app1 /mnt/data1/repos/App1/, filter it using svndumpfilter with include trunk and did svn import to /mnt/data2/repo/trunk/App1. It failed since /mnt/data2/repo/trunk/App1 is not the root of the repo.

Please let me know the best suitable way to perform this consolidation. Important point is that we should preserve the revision history from all the repos.

Edit:

I performed the following steps.

svnadmin dump --quiet /mnt/data1/repos/App1 > App1.dmp
svndumpfilter include --targets /tmp/list.txt < App1.dmp > App1Trunk.dmp
svnadmin create /mnt/data2/repo/
svn mkdir --parents svn://<IP>:<PORT>/trunk/App1 -m "Creating MC directory"
svnadmin load  --quiet --parent-dir trunk/App1 /mnt/data2/repo < App1Trunk.dmp

When I tried to load the dump I found that it's still creating trunk/App1/trunk/module1, trunk/App1/trunk/module2, etc. Help me in loading data into trunk/App1/moudle*.

Was it helpful?

Solution

The easiest way is to use svn mv to move things around:

$ svn mv --parents $URL/repos/App1/trunk/module1 $URL/repos/trunk/App1/module1

This will move your repositories to a new structure, and you will still have your history. When moving entire projects around, you'll have to coordinate with the users of the repository. Make sure the users know what's going on. In fact, the coordination is usually the biggest issue with these moves.

The problem with svnadmin dump and svnadmin load is that it what you can move around is limited. The directory structure of the old projects are preserved even if you move them to a new node. Since a Subversion repository is one big giant project, and you can officially commit a change that touches multiple branches, trunk, and projects at the same time, Subversion insists on keeping it's structure. You maybe able to move something to a new root node, but you can't really edit the structure beyond that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top