Make a root-level directory in an SVN repository a subdirectory in a different repository

StackOverflow https://stackoverflow.com/questions/22314851

  •  12-06-2023
  •  | 
  •  

Question

I have two SVN repositories, structured as follows:

-Repo1
--mydir
----...\\subdirectories and files.

-Repo2
--mydir
----mydir
------mydirgrandchild
--------...\\subdirectories and files.

The similarity in the names "mydir" is not incidental; all directories named here "mydir" are actually named the same.

My task is to take mydir from under Repo1, and place it as is (while maintaining history, revision numbers etc.) as a child of mydirgrandchild in Repo2. Note that once copied it will have (grand and great grand) parents named the same.

I don't know how to approach this. All the solutions I could find online talk about creating a dump of Repo1 and loading it as is into Repo2, but this is not what I need. In my case the root-level folder in Repo1 will simply become one of the subfolders in Repo2.

Help will be very much appreciated.

Was it helpful?

Solution

svnadmin dump and svnadmin load are the right tools. If the paths in repo1/ (full history) are disjoint from the paths in repo1/.../mydirgrandchild/ (head revision), then the following steps should do the job:

svnadmin dump /path/to/repo1 > /tmp/repo1.dump
svnadmin load --parent-dir mydir/mydir/mydirgrandchild /path/to/repo2 < /tmp/repo1.dump

It the paths are not disjoint, then you should change the paths in the dump before loading it into repo2. See the following links for more information:

To minimize the risk of data corruption, you should test the second step before running it on your real SVN repository. That means you should first create an exact copy of repo2. You can use file system tools for this task (e.g. cp -a). Don't forget to check if there are absolute paths hardcoded in the hook scripts.

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