简体   繁体   English

SVN外部文件未提交是否正常?

[英]Is it normal that SVN external files are not committed?

I'm fairly new to Subversion and recently learned how to automatically import files which belong to other repositories using svn:externals . 我是Subversion的新手,最近学会了如何使用svn:externals自动导入属于其他存储库的文件。 And now when I commit the trunk folder and create a tag to take a snapshot of the project, the files/folders defined as externals won't be added to the tag folder. 现在,当我提交trunk文件夹并创建标记以拍摄项目的快照时,定义为外部的文件/文件夹将不会添加到标记文件夹中。

For example, I have this folder structure 例如,我有这个文件夹结构

Z:\\repos\\repoA Z:\\回购\\ repoA

Z:\\repos\\repoB Z:\\回购\\ repoB

Z:\\Projects\\workB Z:\\项目\\ workB

I have set svn:externals on Z:\\Projects\\workB to file:///Z:/repos/repoA/trunk/lib trunk/lib so that repoA 's lib folder is automatically added to the current working directory, Z:\\Projects\\workB\\trunk . 我在Z:\\Projects\\workB svn:externals设置为file:///Z:/repos/repoA/trunk/lib trunk/lib以便repoA的lib文件夹自动添加到当前工作目录中, Z:\\Projects\\workB\\trunk And actually when I perform SVN Update , the lib folder is created under the trunk folder. 实际上,当我执行SVN Update ,会在trunk文件夹下创建lib文件夹。

After editing some files and performing SVN Commit... on Z:\\Projects\\workB\\trunk , I selected TortoiseSVN -> Branch/Tag from the context menu. Z:\\Projects\\workB\\trunk上编辑了一些文件并执行SVN Commit... ,我从上下文菜单中选择了TortoiseSVN -> Branch/Tag In the To Path field, typed tags/1.0.1 and pressed OK. To Path字段中,键入tags/1.0.1并按下OK。 The 1.0.1 tag was successfully created. 1.0.1标记已成功创建。

After I performed SVN Update on Z:\\Projects\\workB\\tags , a folder named 1.0.1 appeared but without external files. Z:\\Projects\\workB\\tags上执行SVN Update后,出现了一个名为1.0.1的文件夹,但没有外部文件。

Is this normal? 这是正常的吗? I expected the imported files also would be there since they are in the trunk folder of the working directory. 我预计导入的文件也会存在,因为它们位于工作目录的trunk文件夹中。


I created two public repositories at Assembla for anyone to test this out. 我在Assembla创建了两个公共存储库,供任何人测试。

The second repository has the externals definition which pulls down the lib folder from the first repository. 第二个存储库具有外部定义,该定义从第一个存储库中下拉lib文件夹。 When I create a tag of the current trunk files from the second repository, it does not add the external files to the tag folder. 当我从第二个存储库创建当前主干文件的标记时,它不会将外部文件添加到标记文件夹。 Also when I check out the tag folder, it won't add the external files to the local working copy. 另外,当我签出标签文件夹时,它不会将外部文件添加到本地工作副本。

When you set the externals property it does not copy the files from the external repository to your working repository. 设置externals属性时,它不会将文件从外部存储库复制到工作存储库。 Rather it just creates a "note" on where to fetch those files from in future. 相反,它只是创建一个“注释”,指出将来从哪里获取这些文件。

Thus, when you create your tag svn doesn't bother to copy the actual files that are externally linked. 因此,当您创建标记时,svn无需复制外部链接的实际文件。 Instead it just copies the "note". 相反,它只是复制“注释”。 Were you to perform a checkout of your tags/1.0.1 directory (or an update if it is already locally checked out) then you would notice that it would correctly pull down the relevant externals even thought these files do not exist in the working repository. 如果您执行了您的tags/1.0.1目录的签出(或者如果已经在本地签出了更新),那么您会注意到它会正确地拉下相关的外部,即使这些文件在工作存储库中不存在。

edit: 编辑:

Ah, I've finally seen the problem. 啊,我终于看到了这个问题。 You set your external in the root directory rather than in the trunk directory. 您可以在根目录中而不是在trunk目录中设置外部。

The best way to view svn is that it is just a filesystem, the whole idea of trunk, tags and branches are just conceptual ideas and each directory is no different to the next. 查看svn的最好方法是它只是一个文件系统,trunk,tags和branches的整个想法只是概念性的想法,每个目录与下一个目录没有什么不同。

Thus, when you copy trunk over to the tags directory the external properties do not get transferred as they are not part of the trunk directory (they only says to put external items in trunk). 因此,当您将trunk复制到tags目录时,外部属性不会被传输,因为它们不是trunk目录的一部分(它们只表示将外部项目放在trunk中)。 To solve you should remove the external properties from the root directory and add them to trunk. 要解决此问题,应从根目录中删除外部属性并将其添加到trunk。 Next time you create a tag the external properties should be transferred. 下次创建标记时,应传输外部属性。

The following command: 以下命令:

svn propget svn:externals file:///Z:/Projects/workB/trunk

should output: 应该输出:

file:///Z:/repos/repoA/trunk/lib lib 

You expectation is correct. 你的期望是正确的。 svn copy must create 100% copy of source object, ie - external definition (and content) must appear in tag svn copy必须创建源对象的100%副本,即 - 外部定义(和内容)必须出现在标记中

  1. Check svn ls -v -R file:///Z:/repos/repoB/tags/1.0.1 检查svn ls -v -R file:///Z:/repos/repoB/tags/1.0.1
  2. In order to easier check and troubleshot I'll suggest move to publicly available repo-set - for testing you can, fe, create on Assembla free space with two or more SVN-repos 为了更容易检查和麻烦我建议转移到公开的repo-set - 用于测试你可以,fe,在Assembla免费空间创建两个或更多SVN-repos

Unrelated to problem note: tag, by convention, used as code-freeze point (later from any point you can get exactly the same code), but it means, what you must also have locked all externals to the state of creating tag. 与问题说明无关:按照惯例,标记用作代码冻结点 (稍后可以从任何一点获得完全相同的代码),但这意味着,您还必须将所有外部锁定到创建标记的状态。 repos/repoA/trunk/lib is HEAD revision, which changed over time and corresponding revision (link tag rev - lib rev)for tag 1.0.1 will be lost. repos / repoA / trunk / lib是HEAD修订版,随着时间的推移发生变化,标记1.0.1的相应修订版(链接标记rev-lib rev)将丢失。 Read about PEG-revisions 阅读PEG修订版

Edit 编辑

Tested Assembla repo with extension in trunk. 经测试的Assembla repo扩展在trunk中。 Test failed: 测试失败:

>svn co https://subversion.assembla.com/svn/subversion-troubleshoot-b/trunk .
A    core_mod.txt
Checked out revision 4

only, there I had to checkout also /lib folder 只有,我还要检查/ lib文件夹

Edit2 EDIT2

For subversion-troubleshoot-b repo: fixes applied to definition, created correctly-written tag ( 1.0.1 ) with external binded to PEG-revision 对于subversion-troubleshoot-b repo:修复应用于定义,创建正确编写的标记( 1.0.1 ),外部绑定到PEG修订

See differences between trunk and tag checkout 查看主干和标签结帐之间的差异

z:\>svn co https://subversion.assembla.com/svn/subversion-troubleshoot-b/
...

Fetching external item into 'subversion-troubleshoot-b\trunk\lib':
A    subversion-troubleshoot-b\trunk\lib\lib01.txt
Checked out external at revision 4.

Fetching external item into 'subversion-troubleshoot-b\tags\1.0.1\lib':
A    subversion-troubleshoot-b\tags\1.0.1\lib\lib01.txt
Checked out external at revision 2.

Checked out revision 7.

if you'll change lib in linked repo later - trunk will get latest content of folder, 1.0.1 - will be always with revision 2 of lib in subversion-troubleshoot 如果您稍后将更改链接仓库中的lib - trunk将获取文件夹的最新内容,1.0.1 - 将始终与subversion中的lib的修订版本2进行故障排除

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM