0

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*.

Prakash
  • 601
  • 2
  • 9
  • 24
  • 1
    possible duplicate of [Moving SVN repositories data with history as subfolders into another repository](http://stackoverflow.com/questions/11563031/moving-svn-repositories-data-with-history-as-subfolders-into-another-repository) – bahrep Jan 21 '14 at 14:05
  • Thanks for pointing me to that answer. But when I try to import the filtered dump it's failing. Let me try with `svnadmin import` with `--parent-dir` and update – Prakash Jan 21 '14 at 14:37
  • there is no `svnadmin import` command. What errors do you get when importing the filtered dump? – bahrep Jan 21 '14 at 14:40
  • As mentioned in you answer in the other thread I created dump and filtered using svndumpfilter. Then I created a new repo using `cd /data/repo svnadmin created newrepo`. Now when I load the data from the dump file `svnadmin load --parent-dir /trunk /data/repo/newrepo` and do `svn list file:///data/repo/newrepo` nothing is getting displayed... – Prakash Jan 21 '14 at 16:29
  • @bahrep I performed the steps that you suggested but it's adding the original repository path to the new repository too. I have edited the question to be more clear. – Prakash Jan 22 '14 at 15:57

1 Answers1

1

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.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • Thanks. With the combination `svnadmin dump`, `svndumpfilter`, `svn load` and `svn mv` I was able to successfully create the required structure. – Prakash Jan 23 '14 at 14:02