有没有一种快速的方法来锁定我的 SVN 存储库的主干? [英] Is there a fast way to lock my SVN repository's trunk?

查看:39
本文介绍了有没有一种快速的方法来锁定我的 SVN 存储库的主干?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我需要确保没有人提交到特定分支或我的主干.发布版本和重新集成合并就是一个例子.

There are moments when I need to be sure that no one is committing to either a specific branch or to my trunk. Release builds and reintegration merges are an example.

SVN锁定"所有文件是不现实的(因为项目很大很长时间).我也不相信锁定会阻止某人提交新文件.

SVN "locking" all the files is not realistic (very long since project is huge). I also don't believe that locking prevents someone from committing new files.

确保在我完成我正在做的事情之前没有人向文件夹提交任何内容的快速方法是什么?

What would be a quick way to make sure no one commits anything to the folder until I'm done what I'm doing?

谢谢

推荐答案

我们在为发布版本编译项目时遇到了这个问题,其中生成服务器属性(CruiseControl.NET 项目标签)用作程序集和安装程序的一部分版本.

We faced this problem when compiling our projects for release builds, where a build server property (CruiseControl.NET project label) is used as part of the assembly and installer version.

在您分支(或标记)工作副本的地方,解决方案很简单,例如用于发布版本.

The solution is easy where you are branching (or tagging) the working copy, e.g. for release builds.

工作流程:

  1. 检查主干(或分支)的新工作副本.
  2. 构建您的版本,这会更新文件,使您的工作副本处于修改状态.
  3. 如果您的构建成功,svn 将工作副本复制到您的新分支或标签中.
  1. Checkout fresh working copy of trunk (or branch).
  2. Build your release, this updates files leaving your working copy in a modified state.
  3. If your build succeeds, svn copy the working copy into your new branch or tag.

如果你想在没有分支的情况下提交你的工作副本,那么正如你所说,如果有人修改了存储库的路径,这将失败(或者至少是不可靠的).

If you want to commit your working copy without branching, then as you say this will fail (or at the least be unreliable) if someone has modified that path of the repository.

解决这个问题的方法是使用 svn 授权控制,将构建服务器用户添加到 svn 并为存储库提供不同的 authz 文件.

A way to solve this would be to use svn authorization control, adding a build server user to svn and have different authz files for the repository.

工作流程:

  1. authz 替换为授予构建服务器用户写入权限和所有其他用户读取权限的文件.
  2. 照常执行您的构建.
  3. authz 替换为授予所有用户正常访问权限的文件.
  1. Replace authz with file granting write access for build server user and read access for all other users.
  2. Perform your build as per normal.
  3. Replace authz with file granting normal access for all users.

请注意,svn 授权允许基于路径的控制,因此您可以将其限制为中继(或其他任何地方)以减少对用户的影响.

Note that svn authorization allows path-based control, so you could restrict this just to trunk (or wherever) to reduce impact on users.

使用类似方法(相同工作流程)的另一种方法是替换 预提交钩子并检查用户;如果不是您的构建服务器用户执行提交,则拒绝提交(带有适当的错误消息).同样,如果需要,这可以是基于路径的(需要一些额外的正则表达式工作).

Another way using a similar approach (same workflow) would be replacing pre-commit hook and checking the user; rejecting the commit (with appropriate error message) if it wasn't your build server user performing the commit. Again, this could be path based (with a little extra regex work) if needed.

这篇关于有没有一种快速的方法来锁定我的 SVN 存储库的主干?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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