Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
582 views
in Technique[技术] by (71.8m points)

version control - Moving SVN repositories data with history as subfolders into another repository

I have some repositories, and I need to transform the content of each one in subfolders of another repository preserving their history log... How can I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are two ways to accomplish the task. 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:

  1. Dump your current repositories with svnadmin dump,
  2. Filter out only needed repository path in the dumps with svndumpfilter,
  3. Load the filtered dumps to another 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:

  1. Filtering Repository History
  2. svnadmin dump
  3. svnadmin load
  4. svnrdump dump
  5. svnrdump load
  6. svndumpfilter

Suppose you have repository C:RepositoriesREPO and folder /trunk/abc in this repository. See the sample steps to move folder /trunk/abc to another repository C:RepositoriesREPO2.

  1. Ensure that all commits that affect /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.

  2. Create dump of the REPO repository:

    svnadmin dump C:RepositoriesREPO > REPO.dump

  3. Filter out unnecessary paths from the REPO.dump file:

    svndumpfilter include /trunk/ABC < REPO.dump > filtered.dump

  4. Create empty /loaded folder in the C:RepositoriesREPO2 repository.

  5. Load dump to that folder:

    svnadmin load --parent-dir /loaded C:RepositoriesREPO2 < 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 described above.

The approach is to replicate the repository with svnsync after configuring path-based authorization rules 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...