SVN 文件夹到新存储库根目录
我有一个现有的 SVN 存储库,其中包含一个保存我的项目的文件夹。 我想知道是否有一种方法可以创建一个新的存储库,并将我的项目文件夹设置为其根目录,并保留所有颠覆历史记录(日志)。 请注意,我不介意丢失原始存储库修订号。
谢谢。
I have an existing SVN repository which contains a folder that holds my project.
I wish to know if there's a way of creating a new repository with my project's folder set as its root and preserve all subversion history (log) along with it. Notice that I do not mind loosing the original repository revision numbers.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以手动复制存储库,或使用 svnadmin。
然后,您可以将项目的子目录移动到根目录下,并删除其他所有内容,从而保留您想要的目录结构。 每个文件的历史记录都会被保留,但它会记住这些文件曾经有不同的路径(这可能是一件好事)。
You can copy the repository manually, or using svnadmin.
You can then move the sub-directories of your project to be under the root, and delete everything else, and thus remain with the directory structure you want. The history will be preserved, per-file, but it will remember that the files used to have a different path (which is probably a good thing).
Avi 的解决方案可能是最简单的,但有一个缺点,即新存储库将包含该项目之外的所有内容的完整历史记录。 在下面的示例中,我假设您位于 *NIX 计算机的命令行,并且位于包含现有存储库的目录中。
如果您运行的是 Subversion 1.6.x,svnsync 提供了更好的选择。 在 1.6.x 之前,svnsync 只能用于复制整个存储库。 在 1.6.x 中,它获得了仅复制存储库的给定子树的能力。
Avi's solution is probably easiest, but has the downside that the new repository will contain the full history of all the stuff outside of this one project. In the example below, I'm assuming that you are at the command line of a *NIX machine and that you are in a directory containing your existing repository.
If you are running subversion 1.6.x, svnsync provides a better option. Prior to 1.6.x, svnsync could only be used to copy whole repositories. With 1.6.x it has gained the ability to copy only a given subtree of the repository.
仅供参考: svnsync 选项对我来说适用于 subversion 1.5.3。
另外,这是一个执行相同操作的 Windows 批处理脚本:
注意:在同步完成之前,您将无法浏览新存储库。
FYI: The svnsync option worked for me with subversion 1.5.3.
Also, here is a Windows batch script doing the same thing:
Note: You will not be able to browse the new repository until the sync is finished.