将带有历史记录的 SVN 存储库数据作为子文件夹移动到另一个存储库中 [英] Moving SVN repositories data with history as subfolders into another repository

查看:23
本文介绍了将带有历史记录的 SVN 存储库数据作为子文件夹移动到另一个存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些存储库,我需要在另一个存储库的子文件夹中转换每个存储库的内容保留他们的历史日志...我该怎么做?

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:

  1. 使用 svnadmin dump 转储您当前的存储库,
  2. 使用 svndumpfilter 过滤掉转储中仅需要的存储库路径,
  3. 使用 svnadmin load 将过滤后的转储加载到另一个存储库.
  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.

您也可以使用 svnrdump工具(存在于 SVN 1.7 及更高版本中)以远程执行转储和加载过程.请参阅 svnrdump dumpsvnrdump 加载.

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:

  1. 过滤存储库历史
  2. svnadmin 转储
  3. svnadmin 加载
  4. svnrdump 转储
  5. svnrdump 加载
  6. svndumpfilter

假设您在此存储库中有存储库 C:RepositoriesREPO 和文件夹 /trunk/abc.请参阅将文件夹 /trunk/abc 移动到另一个存储库 C:RepositoriesREPO2 的示例步骤.

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. 确保所有影响 /trunk/abc 路径及其后代的提交不会影响任何其他路径.例如,没有提交将文件同时添加到 /trunk/abc/another_folder 或将文件从 /another_folder 复制到/trunk/abc

  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.

创建 REPO 存储库的转储:

Create dump of the REPO repository:

svnadmin dump C:RepositoriesREPO >REPO.dump

从 REPO.dump 文件中过滤掉不必要的路径:

Filter out unnecessary paths from the REPO.dump file:

svndumpfilter 包含/trunk/ABC <REPO.dump >过滤后的转储

C:RepositoriesREPO2 存储库中创建空的 /loaded 文件夹.

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

加载转储到该文件夹​​:

Load dump to that folder:

svnadmin load --parent-dir/loaded C:RepositoriesREPO2 <过滤后的转储

就是这样!

该解决方案也很棘手,但是使用它进行复杂的存储库过滤可能比上述方法更方便一些.

The solution is also tricky however a complex repository filtration may be a bit more convenient with it than the approach described above.

方法是在配置 svnsync 复制存储库nofollow noreferrer">基于路径的授权 规则拒绝对需要从存储库历史中过滤掉的任何路径的读取访问.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆