如何在不替换本地文件的情况下将现有目录转换为SVN工作副本(WC)? [英] How do I convert an existing directory to an SVN working copy (WC) without replacing local files?

查看:287
本文介绍了如何在不替换本地文件的情况下将现有目录转换为SVN工作副本(WC)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型的Subversion存储库,其中有将近15 GB的数据分布在约500,000个文件中.现在,我需要将此存储库签到远程主机,这需要几天的时间才能完成.

I have a large Subversion repository with nearly 15 GB of data spread across ~500,000 files. Now I need to check out this repository to a remote host which would take days to complete.

我要检出的主机已经在存储库中具有数据的完整副本.但是,由于没有直接从存储库中检出文件,因此它们不构成工作副本(没有".svn"文件夹).

The host I'm checking out to already has a complete copy of the data in the repository. But seeing as the files weren't checked out directly from the repository, they do not constitute a working copy (no ".svn" folders).

我想避免在网络上复制所有这些数据,尤其是当目标主机上已经存在这些数据时.我可以使用一种技巧来将现有目录转换为工作副本,而不必用存储库中的相同副本替换本地文件吗?

I'd like to avoid copying all this data across the network, especially when it already exists on the target host. Is there a trick I can use that will turn a preexisting directory into a working copy without replacing the local files with identical copies from the repository?

推荐答案

从SVN 1.7开始(但不包括以前的版本),您可以使用以下方法轻松实现此目的:

As of SVN 1.7 (but not before) you can do this easily with:

svn co --force http://path/to/repo

这会将本地副本视为现有副本,并且您将在输出中的每个文件名之前看到存在的"E": E some/existing/file

This will respect the local copy as existing, and you'll see the "E" for existing before each file name in the output: E some/existing/file

如果文件与存储库不同(新文件或已修改文件),它也会根据

If the file is different (new or modified) from the repository it will handle that gracefully too according to the book:

在1.7版之前,如果您尝试检出包含检出本身将创建的文件或子目录的现有目录之上的目录,则默认情况下,Subversion会抱怨. Subversion 1.7处理这种情况的方式有所不同,允许检出继续进行,但将任何障碍物标记为树冲突.使用--force选项可以覆盖此防护措施.当您使用--force选项签出时,签出目标树中通常会阻碍签出的所有未版本化文件仍将被版本化,但是Subversion将按原样保留其内容.如果这些内容与该路径中的存储库文件不同(该文件是作为检出的一部分下载的),则该文件似乎具有本地修改-将检出的版本化文件转换为检查前所拥有的未版本化文件所需的更改退出-结帐完成时.

Prior to version 1.7, Subversion would complain by default if you try to check out a directory atop an existing directory which contains files or subdirectories that the checkout itself would have created. Subversion 1.7 handles this situation differently, allowing the checkout to proceed but marking any obstructing objects as tree conflicts. Use the --force option to override this safeguard. When you check out with the --force option, any unversioned file in the checkout target tree which ordinarily would obstruct the checkout will still become versioned, but Subversion will preserve its contents as-is. If those contents differ from the repository file at that path (which was downloaded as part of the checkout), the file will appear to have local modifications—the changes required to transform the versioned file you checked out into the unversioned file you had before checking out—when the checkout completes.

还请注意,SVN 1.7可能导致这种情况更为普遍(可能是解决方案的起因).将 sub 目录移动到磁盘上的新位置时,我遇到了此问题.在1.7之前的版本中,可以使用它移动.svn目录,并且可以单独使用.在1.7版中,该目录实际上已取消版本控制.但是svn co --force保存了这一天.

Also note that SVN 1.7 can lead to situations where this a more common problem (perhaps motivating the solution). I hit this problem when moving a sub directory to a new location on disk. In pre-1.7 that would have moved the .svn directory with it and it would have stood alone just fine. In 1.7 the directory became effectively unversioned. But svn co --force saved the day.

这篇关于如何在不替换本地文件的情况下将现有目录转换为SVN工作副本(WC)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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