“不可能只签出一个文件。你能做的最好的签出级别是在目录级别。”
在使用Subversion时,我如何解决这个问题?
我们在Subversion中有这个文件夹,用来保存所有的图像。我只是想从其中找出一个文件(图像)。这个文件夹真的很大,里面有很多我现在不需要的东西。
“不可能只签出一个文件。你能做的最好的签出级别是在目录级别。”
在使用Subversion时,我如何解决这个问题?
我们在Subversion中有这个文件夹,用来保存所有的图像。我只是想从其中找出一个文件(图像)。这个文件夹真的很大,里面有很多我现在不需要的东西。
当前回答
If you want to view readme.txt in your repository without checking it out: $ svn cat http://svn.red-bean.com/repos/test/readme.txt This is a README file. You should read this. Tip: If your working copy is out of date (or you have local modifications) and you want to see the HEAD revision of a file in your working copy, svn cat will automatically fetch the HEAD revision when you give it a path: $ cat foo.c This file is in my local working copy and has changes that I've made. $ svn cat foo.c Latest revision fresh from the repository!
源
其他回答
cd C:\path\dir
svn checkout https://server/path/to/trunk/dir/dir/parent_dir--depth empty
cd C:\path\dir\parent_dir
svn update filename.log
(编辑filename.log)
svn commit -m "this is a comment."
我想将单个文件签出到一个目录,而该目录不是工作副本的一部分。
让我们通过以下URL获取该文件:http://subversion.repository.server/repository/module/directory/myfile
svn co http://subversion.repository.server/repository/module/directory/myfile /**directoryb**
因此,我签出了包含目标文件的给定目录,我想要获得一个虚拟目录,(以/etc结尾的URL为etcb)。
然后,我从目标目录中我不需要的所有文件中清空文件.svn/entries,只留下我想要的文件。在这个.svn/entries文件中,每个文件都有一个带有其属性的记录,因此只保留关于您想要获取和保存的文件的记录。
现在你只需要复制。”到目录,这将是一个新的“工作副本”。然后你只需要:
cp .svn /directory
cd /directory
svn update myfile
现在目录目录处于版本控制之下。不要忘记删除目录directoryb,它只是一个“临时工作副本”。
我只需要浏览并导出单个文件。如果您有HTTP访问权限,只需使用web浏览器找到文件并获取它。
如果你在编辑后需要把它放回去,这可能会有点乏味,但我相信可能会有一个svn import函数……
If you want to view readme.txt in your repository without checking it out: $ svn cat http://svn.red-bean.com/repos/test/readme.txt This is a README file. You should read this. Tip: If your working copy is out of date (or you have local modifications) and you want to see the HEAD revision of a file in your working copy, svn cat will automatically fetch the HEAD revision when you give it a path: $ cat foo.c This file is in my local working copy and has changes that I've made. $ svn cat foo.c Latest revision fresh from the repository!
源
以下是已接受答案的TortoiseSVN等效解决方案(我在公司的内部文档中写了这个,因为我们新采用了SVN)。我觉得在这里分享也会有帮助:
签出一个文件: Subversion不支持检出单个文件,它只支持检出目录结构。(参考:http://subversion.tigris.org/faq.html single-file-checkout)。这是因为对于作为工作副本签出的每个目录,有关修改/文件修订的元数据存储为内部隐藏文件夹(.svn/_svn)。对于单个文件,目前(v1.6)不支持这一点。
Alternate recommended strategy: You will have to do the checkout directory part only once, following that you can directly go and checkout your single files. Do a sparse checkout of the parent folder and directory structure. A sparse checkout is basically checking out only the folder structure without populating the content files. So you checkout only the directory structures and need not checkout ALL the files as was the concern. Reference: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html
步骤1:继续到存储库浏览器
步骤2:右键单击存储库中的父文件夹,其中包含您希望处理的所有文件,并选择Checkout。
步骤3:在新的弹出窗口中,确保签出目录指向本地PC上的正确位置。也会有一个下拉菜单标记为“结帐深度”。根据需要选择“仅此项目”或“直接子项,包括文件夹”。第二个选项是推荐的,如果你想要处理嵌套文件夹,你可以直接进行下一次,否则你将不得不对嵌套文件夹再次遵循整个过程。
步骤4:父文件夹现在应该在您本地选择的文件夹中可用,并且现在由SVN监视(一个隐藏文件夹”)。现在应该出现“Svn”或“_svn”)。现在,在存储库中,右键单击您希望单独签出的单个文件,并选择“Update Item to revision”选项。现在可以处理单个文件并将其签回存储库。
我希望这能有所帮助。