将 SVN 设置为忽略是否安全?在应该进行版本控制的目录中?

发布于 2024-10-19 01:55:14 字数 496 浏览 2 评论 0原文

昨天,我问了一个问题,为什么目录在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红衣飘飘貌似仙 2024-10-26 01:55:14

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

鉴于此,进行财产变更是否安全?这取决于您想要产生什么影响。 文档对此进行了注释svn:ignore 属性:

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

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

  • 从命令行运行 svn propdel svn:ignore .
  • 在 Eclipse(使用 Subclipse)中,右键单击项目文件夹,转到 Team - >显示属性,选择 svn:ignore 属性条目,单击鼠标右键,然后单击“删除属性”。

这应该会删除根目录上的修改通知。关于您之前的问题,如果不是 属性更改在同步视图中显示为正常的传出更改。如果您要打开“提交”对话框,您实际上应该看到不同的“属性更改”装饰器。

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

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

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.

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:

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

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:

  • 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

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.

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文