将 SVN 设置为忽略是否安全?在应该进行版本控制的目录中?
昨天,我问了一个问题,为什么目录在 Subclipse 中看起来包含未提交的更改,而实际上并不包含。答案是,在伪目录 .
上设置 svn:ignore
状态算作修改,但 Subclipse 没有显示任何内容,因为它不处理 .
。
知道原因固然很好,但问题还没有完全解决。将忽略状态添加到 .
伪目录是否安全?我不希望 SVN 忽略实际目录;我只想让未提交的变更装饰器消失。 (不,我还没有尝试这样做。如果结果有问题,我不知道如何干净地恢复更改。)
编辑:
正如蒂姆的回答所指出的,指责 .
的修改是误导性的。 .
仅被标记为已修改,因为其中一个子目录被设置为 svn:ignore
;这才是真正的变化和根本原因。
Yesterday, I asked a question about why directories can appear to Subclipse to contain uncommitted changes when they actually don't. The answer was that setting svn:ignore
status on the pseudo-directory .
counted as a modification, but Subclipse didn't show anything because it doesn't deal with .
.
Knowing the cause is nice, but the issue isn't fully resolved. Is it safe to commit the addition of ignore status to the .
pseudo-directory? I do not want the actual directory to be ignored by SVN; I only want to make the uncommitted change decorator go away. (No, I haven't tried just doing it. I wouldn't know how to cleanly revert the change if it turned out to be problematic.)
EDIT:
As pointed out in Tim's answer, blaming the modification of .
is misleading. .
was only marked modified because one of the subdirectories was set to svn:ignore
; that's the real change and root cause.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于 输出您收到的
svn diff
中,您实际上是为资源target
设置了svn:ignore
。此属性信息保存在父版本化资源(在本例中为项目根.
)上,以便可以将其提交到存储库,而与本地忽略设置无关。鉴于此,进行财产变更是否安全?这取决于您想要产生什么影响。 文档对此进行了注释
svn:ignore
属性:因此,通过提交此更改,您可以有效地忽略为从存储库中提取项目的任何人提供的
target
资源(前提是该项目当前未版本化)。不过,这可能不是您工作场所的政策,因此您可能希望避免这种情况。要删除该属性,您可以执行以下操作之一:svn:ignore
属性条目,单击鼠标右键,然后单击“删除属性”。这应该会删除根目录上的修改通知。关于您之前的问题,如果不是 属性更改在同步视图中显示为正常的传出更改。如果您要打开“提交”对话框,您实际上应该看到不同的“属性更改”装饰器。
不幸的是,这会让您的目标资源未被忽略。要在 Eclipse 中修复此问题,您可以将
target
添加到忽略资源列表中。要访问此选项,请转到“窗口”->“首选项->团队->被忽略的资源。然后,您可以将“目标”添加到忽略模式列表中。如果您希望全局应用忽略模式到 Subversion,您可以修改 Subversion 配置文件。这种方法的问题在于,它忽略了 Eclipse 工作区中所有项目的
target
资源,或整个系统中的所有 Subversion 操作(取决于您选择的忽略方法)。目前,我无法根据具体情况想出一种方法来扭转这种情况。Based on the output of
svn diff
that you received, you were actually settingsvn:ignore
for the resourcetarget
. This property information is saved on the parent versioned resource (in this case the project root.
) so that it can be committed to the repository independent of your local ignore settings.Given this, is it safe to commit the property change? It depends on what impact you want to make. The documentation makes this note about the
svn:ignore
property:So, by committing this change, you'd effective ignore the
target
resource for anyone who pulled the project from the repository (provided it's currently unversioned). It's possible that this may not be the policy at your workplace though, so you may want to avoid this. To remove the property, you can take one of the following actions:svn propdel svn:ignore .
from the command linesvn:ignore
property entry, right-click, and click Delete PropertyThis should get rid of the modification notice on the root directory. With respect to your previous question, the problem would have been more apparent had it not been for the fact that property changes show as normal outgoing changes in the Synchronization view. If you were to bring up the Commit dialog, you should actually see the distinct Property Change decorator.
Unfortunately, this leaves you with the
target
resource unignored. To fix this in Eclipse, you can addtarget
to the list of ignored resources. To get to this option, go to Window -> Preferences -> Team -> Ignored Resources. You can then add "target" to the list of ignore patterns. If you wish to apply the ignore pattern to Subversion globally, you can modify theglobal-ignores
setting of your Subversion configuration file.The problem with this approach is that it ignores the
target
resource for all projects in the Eclipse workspace, or all Subversion actions across the system (depending on your ignore method of choice). At the moment, I can't think of a way to reverse this on a case-by-case basis.