There are two ways to accomplish the task and depending on Subversion server distribution and task complexity you may find one of them easier or more convenient than the other.
Filtering repository history with svndumpfilter
tool
The solution is quite tricky because Subversion repository history filtering works based on paths you specify to include or exclude in a repo dump output. In short you should do the following:
- Dump your current repositories with
svnadmin dump
, - Filter out only needed repository path in the dumps with
svndumpfilter
, - Load the filtered dumps to other repository with
svnadmin load
.
You can also use
svnrdump
tool (exists in SVN 1.7 and later) to perform the dump and load process remotely. See svnrdump dump
and svnrdump load
.
I strongly advise you to read the following articles from the SVNBook related to the process:
Suppose you have repository C:\Repositories\REPO and folder /trunk/abc in this repository. See the sample steps to move folder /trunk/abc to another repository C:\Repositories\REPO2.
- Ensure that all commits affecting /trunk/abc path and its descendants do NOT affect any other path. For example, there is no commit which adds files to /trunk/abc and */another_folder* at the same time or copy files from */another_folder* to /trunk/abc etc.
- Create dump of the REPO repository:
svnadmin dump C:\Repositories\REPO > REPO.dump
- Filter out unnecessary paths from the REPO.dump file:
svndumpfilter include /trunk/ABC < REPO.dump > filtered.dump
- Create empty /loaded folder in the C:\Repositories\REPO2 repository.
- Load dump to that folder:
svnadmin load --parent-dir /loaded C:\Repositories\REPO2 < filtered.dump
That's it!
Repository replication with svnsync
tool
The solution is also tricky however a complex repository filtration may be a bit more convenient with it than the approach describe above.
The approach is to replicate the repository with
svnsync
after configuring path-based authorizationrules that deny read access to any paths that need to be filtered out from repository history.
Unlike
svndumpfilter
, svnsync
will automatically translate copy operations with an unreadable source path into normal additions, which is useful if history involving copy operations needs to be filtered.
No comments:
Post a Comment