将 SVN 设置为 ignore 是否安全?在应该受版本控制的目录中? [英] Is it safe to set SVN to ignore . in a directory that should be version controlled?

查看:48
本文介绍了将 SVN 设置为 ignore 是否安全?在应该受版本控制的目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我问了一个问题,为什么目录会在 Subclipse 中显示为包含未提交的更改,而实际上它们不包含未提交的更改.答案是在伪目录 . 上设置 svn:ignore 状态算作修改,但 Subclipse 没有显示任何内容,因为它不处理 ..

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 ..

知道原因很好,但问题还没有完全解决.将忽略状态的添加提交到 . 伪目录是否安全?我希望SVN忽略实际目录;我只想让未提交的更改装饰器消失.(不,我还没有尝试过这样做.如果结果有问题,我不知道如何干净地还原更改.)

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.)


正如蒂姆的回答中指出的那样,指责 . 的修改是一种误导.. 仅被标记为已修改,因为其中一个子目录被设置为 svn:ignore;这才是真正的变化和根本原因.


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.

推荐答案

基于 您收到的 svn diff 的输出,您实际上是在为 svn:ignore 设置资源 target.此属性信息保存在父版本化资源(在本例中为项目根目录 .)中,以便它可以独立于本地忽略设置提交到存储库.

Based on the output of svn diff that you received, you were actually setting svn:ignore for the resource target. 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.

鉴于此,提交属性更改是否安全?这取决于你想产生什么样的影响.文档svn:ignore 属性:

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:

svn:ignore 属性是告诉 Subversion 忽略可能存在于该目录的每个用户的工作副本中的文件的好方法,例如编译器输出...

The svn:ignore property is a good way to tell Subversion to ignore files that are likely to be present in every user's working copy of that directory, such as compiler output...

因此,通过提交此更改,您将有效地忽略从存储库中提取项目的任何人的 target 资源(前提是它当前未版本化).不过,这可能不是您工作场所的政策,因此您可能希望避免这种情况.要移除该属性,您可以执行以下操作之一:

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 .
  • 在 Eclipse(带有 Subclipse)中,右键单击项目文件夹,转到 Team -> Show Properties,选择 svn:ignore 属性条目,右键单击,然后单击 Delete Property
  • Run svn propdel svn:ignore . from the command line
  • In Eclipse (with Subclipse), right-click the project folder, go to Team -> Show Properties, select the svn:ignore property entry, right-click, and click Delete Property

这样应该可以去掉根目录上的修改通知.关于您之前的问题,如果不是 属性更改在同步视图中显示为正常的传出更改.如果您要打开 Commit 对话框,您实际上应该看到独特的 Property Change 装饰器.

This 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.

不幸的是,这会让您忽略 target 资源.要在 Eclipse 中修复此问题,您可以将 target 添加到忽略资源列表中.要获得此选项,请转到窗口 -> 首选项 -> 团队 -> 忽略的资源.然后,您可以将目标"添加到忽略模式列表中.如果您希望在全局范围内将忽略模式应用于 Subversion,您可以修改 Subversion 配置文件.

Unfortunately, this leaves you with the target resource unignored. To fix this in Eclipse, you can add target 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 the global-ignores setting of your Subversion configuration file.

这种方法的问题在于它忽略了 Eclipse 工作区中所有项目的 target 资源,或整个系统中的所有 Subversion 操作(取决于您选择的忽略方法).目前,我想不出一种方法来逐案扭转这种情况.

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.

这篇关于将 SVN 设置为 ignore 是否安全?在应该受版本控制的目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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