如何将代码库从一个 svn 存储库迁移到另一个保留历史记录的存储库?
我在一个结构不良的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想这可能类似于@ZacThompson(和@Pekka)的意思:我认为 svndumpfilter 是你的朋友。
从你的问题来看,我认为你知道它的意思是什么,但在到处复制/移动分支时遇到困难?可以在前面提到的 SVN文档,我相信:
含义:使 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:
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 orsvndumpfilter2
).您将需要使用以下组合:
如果您想要执行整个分支,您甚至可能不需要 svndumpfilter。但如果你这样做:
http ://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.filtering
You will want to use some combination of:
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
还有另一种解决方案非常简单,可以解决“保留移动”问题。请参阅 Apache Subversion 常见问题解答条目的最后一段 “如何从存储库中完全删除文件历史?”。该解决方案不依赖于
svndumpfilter
。您可以执行以下步骤:
配置基于路径授权规则,用于拒绝USERNAME帐户对要从存储库中删除的文件或文件夹的PATHS的读取访问权限历史。
请注意复数名词路径。您想要删除的文件或文件夹可能具有不同的名称,或者可能位于存储库历史记录中的不同位置。设置拒绝规则时请考虑这一点。
创建一个空存储库,
使用 < 复制源存储库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:
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.
Create an empty repository,
Replicate the source repository with
svnsync
tool to the target repository under account USERNAME. For details on repository synchronization withsvnsync
please refer to SVNBook chapter "Repository Replication".Unlike
svndumpfilter
,svnsync
automatically translatessvn copy
operations with an unreadable source path into normal additions, which is useful if history involves copy operations and still needs to be filtered. :)您需要使用 HotCopy 来备份存储库目录。那么它应该是简单地恢复存储库的问题。
You need to use HotCopy to backup the repository directory. Then it should be a matter of simply restoring the repository.