将具有历史记录的SVN存储库数据作为子文件夹移动到另一个存储库中 [英] 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?
推荐答案
有两种方法可以完成任务.根据Subversion服务器的分布和任务的复杂性,您可能会发现其中一个比另一个更容易或更方便.
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.
该解决方案非常棘手,因为Subversion存储库历史记录过滤基于您指定要包含在回购转储输出中的路径来进行.简而言之,您应该执行以下操作:
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:
- 使用
svnadmin dump
转储您当前的存储库, - 使用
svndumpfilter
过滤掉转储中仅需要的存储库路径, - 使用
svnadmin load
将已过滤的转储加载到另一个存储库.
- Dump your current repositories with
svnadmin dump
, - Filter out only needed repository path in the dumps with
svndumpfilter
, - Load the filtered dumps to another repository with
svnadmin load
.
您还可以使用 svnrdump
工具(存在于SVN中1.7及更高版本)以远程执行转储和加载过程.请参见 svnrdump dump
和
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
.
我强烈建议您阅读SVNBook中与该过程有关的以下文章:
I strongly advise you to read the following articles from the SVNBook related to the process:
- Filtering Repository History
svnadmin dump
svnadmin load
svnrdump dump
svnrdump load
svndumpfilter
假设您在此存储库中有存储库 C:\ Repositories \ REPO 和文件夹/trunk/abc .请参阅将文件夹/trunk/abc 移至另一个存储库 C:\ Repositories \ REPO2 的示例步骤.
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.
-
确保影响/trunk/abc 路径及其后代的所有提交均不影响任何其他路径.例如,没有提交可将文件同时添加到/trunk/abc 和/another_folder 或将文件从/another_folder 复制到/trunk/abc 等.
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.
创建REPO存储库的转储:
Create dump of the REPO repository:
svnadmin dump C:\Repositories\REPO > REPO.dump
从REPO.dump文件中过滤掉不必要的路径:
Filter out unnecessary paths from the REPO.dump file:
svndumpfilter include /trunk/ABC < REPO.dump > filtered.dump
在 C:\ Repositories \ REPO2 存储库中创建一个空的/loaded 文件夹.
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
就是这样!
该解决方案也很棘手,但是与上述方法相比,使用复杂的存储库过滤可能更方便.
The solution is also tricky however a complex repository filtration may be a bit more convenient with it than the approach described above.
方法是在配置后,用svnsync
复制存储库基于路径的授权规则,拒绝对需要从存储库历史记录中过滤掉的任何路径进行读取访问.
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.
与svndumpfilter
不同,svnsync
会将具有不可读源路径的复制操作自动转换为普通添加,这在需要过滤涉及复制操作的历史记录时非常有用.
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.
这篇关于将具有历史记录的SVN存储库数据作为子文件夹移动到另一个存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!