使用乌龟 svn 防止提交和忽略本地更改

Prevent Commit and ignore local changes with tortoise svn

Tortoise SVN 中有没有办法将文件添加到 svn 并冻结它的版本并忽略对该文件的本地更改。

  1. 我有一个每个开发人员都使用的小单元测试项目。他们必须对 ini.file 稍做调整才能在他们的 PC 上进行测试 运行。但是不允许将这些更改提交给 svn。我怎样才能阻止这个文件的提交。

  2. 如果 unittest 项目作为外部 svn 添加到另一个存储库中。 Windows 将显示,如果开发人员根据需要调整 ini 文件,则存在本地修改。我可以以某种方式忽略 ini 文件以检查本地修改吗?我只知道忽略功能,但这需要从存储库中完全删除 ini 文件,我不想那样做。

I have a little unittest-project every developer uses. They have to make little adjustments to an ini.file in order to get the tests run on their PC. But those changes aren't allowed to be comitted to the svn. How can I prevent the commit of this file.

在服务器端配置对这些文件的只读权限。参见 SVNBook | Path-based authorization, and - if you use VisualSVN Server - KB33: Understanding VisualSVN Server Authorization

您可以使用 ignore-on-commit 更改列表:

然而,此功能仅用于防止意外 提交。要真正执行它,您需要一个 server-side 解决方案,例如创建一个存储库挂钩来拒绝包含该文件的提交。

最好的解决方案是一开始就不要在存储库中包含该文件。相反,您提交一个 模板 (您已经拥有的文件具有不同的名称,例如 settings.ini-templatesettings.ini-production...),然后添加实际的名称该工具用于 svn:ignore 属性 的文件,在 TortoiseSVN 中可以使用 Unversion 完成并添加到忽略列表 菜单项。