如何将代码库从一个 svn 存储库迁移到另一个保留历史记录的存储库?

发布于 2024-08-27 12:11:17 字数 358 浏览 14 评论 0原文

我在一个结构不良的 svn 存储库中有一个分支,需要将其删除并移动到另一个 svn 存储库。 (我正在尝试清理它)。

如果我执行 svn log 而不是停止复制/重命名,我可以看到我关心的所有 3427 次提交。除了编写一些主要脚本之外,是否有某种方法可以转储修订版本?

我会遵循 中的建议这个问题但是这个分支已经被移动到各处,我也想保留这些移动。

I have a branch in a badly structured svn repo that needs to be stripped out and moved to another svn repository. (I'm trying to clean it up some).

If I do an svn log and not stop on copy/rename I can see all 3427 commits that I care about. Is there some way to dump the revisions out, short of writing some major scripts?

I would follow the advice in this question but this branch has been moved all over the place and I would like to preserve the moves as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉城 2024-09-03 12:11:17

我想这可能类似于@ZacThompson(和@Pekka)的意思:我认为 svndumpfilter 是你的朋友。

从你的问题来看,我认为你知道它的意思是什么,但在到处复制/移动分支时遇到困难?可以在前面提到的 SVN文档,我相信:

另外,复制的路径可以给你一些
麻烦。 Subversion 支持复制
存储库中的操作,其中
通过复制一些内容来创建新路径
已经存在的路径。有可能
在生命的某个时刻
您的存储库,您可能已经复制
来自某个位置的文件或目录
svndumpfilter 排除的是
它所包含的位置。使
转储数据自给自足,
svndumpfilter 仍然需要显示
添加新路径 - 包括
由创建的任何文件的内容
复制——并且不代表该添加
作为来自不会的来源的副本
存在于您过滤的转储数据中
溪流。但因为颠覆
存储库转储格式仅显示内容
在每次修订中都发生了变化,
复制源的内容可能不
随时可用。如果您怀疑
您有此类副本
在你的存储库中,你可能想要
重新考虑您的包含/排除集合
路径,也许包括路径
作为你的来源
复制操作也很麻烦。

含义:使 svndumpfilter 包含分支曾经存在的所有路径。或者我错过了什么?

另一种可能性可能是 @compie 在您链接的线程中提到的 svndumpfilter2 ,尽管我认为它甚至没有必要(而且我不知道 @compie 或 svndumpfilter2 ) )。

I guess this might be similar to what @ZacThompson (and @Pekka) mean: I think svndumpfilter is your friend.

From your question I think you have the idea what it is meant to do but struggle with the copying/moving of the branch all over the place? An answer to that can be found in the before mentioned SVN Documentation, I believe:

Also, copied paths can give you some
trouble. Subversion supports copy
operations in the repository, where a
new path is created by copying some
already existing path. It is possible
that at some point in the lifetime of
your repository, you might have copied
a file or directory from some location
that svndumpfilter is excluding, to a
location that it is including. To make
the dump data self-sufficient,
svndumpfilter needs to still show the
addition of the new path—including the
contents of any files created by the
copy—and not represent that addition
as a copy from a source that won't
exist in your filtered dump data
stream. But because the Subversion
repository dump format shows only what
was changed in each revision, the
contents of the copy source might not
be readily available. If you suspect
that you have any copies of this sort
in your repository, you might want to
rethink your set of included/excluded
paths, perhaps including the paths
that served as sources of your
troublesome copy operations, too.

Meaning: make svndumpfilter include all paths the branch ever lived at. Or am I missing something?

Another possibility might be the svndumpfilter2 mentioned by @compie in the thread you linked although I believe it is not even necessary (and I don't know either of @compie or svndumpfilter2).

野生奥特曼 2024-09-03 12:11:17

您将需要使用以下组合:

  1. svnadmin dump
  2. svndumpfilter
  3. svnadmin load

如果您想要执行整个分支,您甚至可能不需要 svndumpfilter。但如果你这样做:

http ://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.filtering

You will want to use some combination of:

  1. svnadmin dump
  2. svndumpfilter
  3. svnadmin load

If you want to do the whole branch, you may not even need svndumpfilter. But if you do:

http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.filtering

南风几经秋 2024-09-03 12:11:17

还有另一种解决方案非常简单,可以解决“保留移动”问题。请参阅 Apache Subversion 常见问题解答条目的最后一段 “如何从存储库中完全删除文件历史?”。该解决方案不依赖于svndumpfilter

您可以执行以下步骤:

  1. 配置基于路径授权规则,用于拒绝USERNAME帐户对要从存储库中删除的文件或文件夹的PATHS的读取访问权限历史。

    请注意复数名词路径。您想要删除的文件或文件夹可能具有不同的名称,或者可能位于存储库历史记录中的不同位置。设置拒绝规则时请考虑这一点。

  2. 创建一个空存储库,

  3. 使用 < 复制源存储库code>svnsync 工具到帐户 USERNAME 下的目标存储库。有关使用 svnsync 进行存储库同步的详细信息,请参阅 SVNBook 章节 "存储库复制"

svndumpfilter不同,svnsync自动将源路径不可读的svn copy操作转换为正常的添加,如果历史涉及复制操作并且仍然需要,这很有用进行过滤。 :)

There is another solution that is pretty simple and solves the "preserve the moves" issue. Please see the last paragraph of the Apache Subversion FAQ entry "How do I completely remove a file from the repository's history?". The solution does not rely on the svndumpfilter.

You can perform the following steps:

  1. Configure path-based authorization rules to deny read access for a USERNAME account to the PATHS of the file or a folder you want to remove from repository history.

    Please note the plural noun paths. The file or folder you want to get rid of could have different names or can be located in different places across a repository history. Please consider this when setting up deny rules.

  2. Create an empty repository,

  3. Replicate the source repository with svnsync tool to the target repository under account USERNAME. For details on repository synchronization with svnsync please refer to SVNBook chapter "Repository Replication".

Unlike svndumpfilter, svnsync automatically translates svn copy operations with an unreadable source path into normal additions, which is useful if history involves copy operations and still needs to be filtered. :)

音盲 2024-09-03 12:11:17

您需要使用 HotCopy 来备份存储库目录。那么它应该是简单地恢复存储库的问题。

You need to use HotCopy to backup the repository directory. Then it should be a matter of simply restoring the repository.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文