强制锁定分支?

发布于 2024-07-15 03:42:32 字数 243 浏览 8 评论 0原文

目前,在我创建发布分支之后,但是当我们在发布之前有一段时间时,我有时会打开整个分支进行编辑,然后锁定所有文件,以防止任何人在发布分支的“代码冻结”期间修改任何内容。

有没有更好的办法? 我当前的方式似乎可能是对锁定功能的错误使用,是否有更好的方法来阻止某人在不使用分支的情况下签入代码。 我虽然有 P4 保护,但我不是这个 perforce 实例的管理员,而且处理可能有 100 行的保护文件也会变得很麻烦。

有任何想法吗?

Currently after I create a release branch, but when we have some time before we release, I sometimes open the entire branch for edit and then lock all files in order to prevent anybody from modifying anything during "code-freeze" period in the release branch.

Is there a better way? Doing it my current way seems possibly like an incorrect use of the lock feature, is there a better way to keep somebody from checking in code without using branches. I though of P4 protect but I am not the admin on this perforce instance, and also dealing with the protect file at potentially 100s of lines would get cumbersome as well.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

寒冷纷飞旳雪 2024-07-22 03:42:32

作为一名建筑工程师,我一直在这样做。 我使用“p4保护”将每个人对树的访问限制为只读:

super group everyone * -//depot/project/branch/...
read group everyone * //depot/project/branch/...
super user me * //depot/project/branch/...

第一行关闭所有用户对分支的所有权限(假设正确定义了“每个人”组。)

第二行重新建立读取每个人的权限。

最后一行重新建立了只有我的所有权限。

I'm doing this all the time as a builds engineer. I use 'p4 protect' to restrict everyone's access to the trees to read-only:

super group everyone * -//depot/project/branch/...
read group everyone * //depot/project/branch/...
super user me * //depot/project/branch/...

The first line closes all permissions for all users to the branch (assuming that the group 'everyone' is defined properly.)

The second line re-establishes read permissions for everyone.

The last line re-establishes all permissions to just me.

ま柒月 2024-07-22 03:42:32

在现代 Perforce 中做到这一点的方法是使用流——命名分支在本地系统上更新,并且可以应用权限来鼓励您在流之间合并和复制时做正确的事情。

您可以选择限制流,以便只有流所有者可以签入(并且您可以锁定流,以便除所有者之外的任何人都可以编辑其属性)。 请参阅 http://www.perforce。 com/perforce/doc.current/manuals/p4guide/chapter.codelines.html#codelines.streams

The way to do this in modern Perforce is to use streams -- named branches that update in place on your local system, and can have permissions applied to encourage you to do the right thing when merging and copying between streams.

You can optionally restrict a stream so only the stream owner can check in (and you can lock the stream so no one but the owner can edit its properties). See http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.codelines.html#codelines.streams

烟沫凡尘 2024-07-22 03:42:32

p4 保护绝对是更好的选择 - 这就是它的用途。 我强烈建议您将所有用户放入组中,并且仅在保护表中使用组 - 更易于管理。

您可以按照您喜欢的任何粒度级别进行保护,因此并不笨重。 另请注意,2008.1 服务器版本具有新的保护功能,允许您以稍微不同的方式指定可以执行的操作。 更改说明:

#152278 **
    'p4 protect' now allows specification of permission 'rights'.
    Previously, 'p4 protect' only allowed using permission levels 
    which include the specified access (ie 'read') and also all
    of its lesser permissions (ie 'read' = 'read' + 'list').
    Permission rights make it possible to deny individual rights
    without having to re-grant lesser rights.  The new 
    permission rights are '=read', '=branch', '=open',
    and '=write'. This functionality was previously undocumented,
    and is now fully supported for 2008.1

如果您确实对必须成为管理员才能锁定和安装有疑问,请参阅以下内容: 解锁了这个,那么你应该看看2007.3引入的“群组所有者”功能。 这将使非超级用户能够添加& 从群组中删除人员。 因此,请将其与保护表结合起来。 即让站点管理员设置保护表,并将权限限制到名为“Rel 1.0 Authorized”的组,并使您成为组所有者。 然后,您可以在该组中添加和删除用户(或子组)以控制访问。

触发器选项是可能的,但您仍然需要成为管理员才能首先设置触发器。 您还可能会影响所有提交的性能,这一点需要注意。 但触发器的主要问题是您将使用它们来模拟为此目的而设计的内置功能 - 即保护表。 而且,如果您想要安全,您仍然需要找到某种方法来防止其他人修改参考文件。 模拟现有功能似乎需要做很多工作。

p4 protect is definitely the better way to go - it's what it is there for. I would strongly recommend you put all your users into groups, and only ever use groups in your protections table - much easier to manage.

You can protect at any level of granularity you like, so is not unwieldy. Note also that the 2008.1 server release has a new protect feature that allows you to specify what you can do in a slightly different way. Change note:

#152278 **
    'p4 protect' now allows specification of permission 'rights'.
    Previously, 'p4 protect' only allowed using permission levels 
    which include the specified access (ie 'read') and also all
    of its lesser permissions (ie 'read' = 'read' + 'list').
    Permission rights make it possible to deny individual rights
    without having to re-grant lesser rights.  The new 
    permission rights are '=read', '=branch', '=open',
    and '=write'. This functionality was previously undocumented,
    and is now fully supported for 2008.1

If you really have an issue with having to be an admin to lock & unlock this, then you should take a look at the "group owner" feature introduced in 2007.3. This will let a non-super user to be able to add & remove people from a group. So combine that with the protections table. I.e. get site admin to set up the protections table, and restrict rights to a group named "Rel 1.0 Authorised", and make you the group owner. You can then add and remove users (or subgroups) from that group to control access.

The trigger option is a possibility, but you still need to be an admin to set up the trigger in the first place. You could also affect performance of all submissions, which is something to look out for. But the main issue with triggers is that you would be using them to emulate a built in feature designed for that purpose - i.e. protections table. And, if you wanted to be safe, you would still need to find some way of preventing anyone else modifying the reference file. It just seems like a lot of work to emulate an existing feature.

甜是你 2024-07-22 03:42:32

作为对其他答案之一的轻微补充。 首先建立一个组“everyone”,其中包含所有用户。 然后将其添加到 p4 protected

write group everyone * -//depot/project/1.0/...
read group everyone * //depot/project/1.0/...
write group 1.0 * //depot/project/1.0/...

这将允许您创建一个组“1.0”,您可以在其中添加任何被允许写入访问的用户。

如果您使用的是服务器 2008.1,则可以执行此操作。

=write group everyone * -//depot/project/1.0/...
write group 1.0 * //depot/project/1.0/...

第一行仅从组 every 中删除写访问权(不删除读和列表)。

As a slight addition to one of the other answers. First set up a group "everyone" which has all users in it. Then add this to p4 protect

write group everyone * -//depot/project/1.0/...
read group everyone * //depot/project/1.0/...
write group 1.0 * //depot/project/1.0/...

This will allow you to create a group "1.0" into which you can add any users who are allowed write access.

If you are using server 2008.1 you can do this.

=write group everyone * -//depot/project/1.0/...
write group 1.0 * //depot/project/1.0/...

The first line removes only the write access ( not read and list ) from the group everyone.

天气好吗我好吗 2024-07-22 03:42:32

正如其他答案中所解释的,P4 保护可能是大多数人的正确答案。

但是,在我的组织中,我不能成为管理员,因此执行此操作的方法是强制使用触发脚本来读取非管理员具有写入权限的文本文件,并检查分支是否出现在列表中。
这样就不需要像 p4 Protect 这样的管理员访问权限了。

P4 protect is probably the right answer for most people as explained in other answers.

However in my organization I can't be the admin so way of doing this is to have a trigger script in perforce that reads a text file that non-admins have write access to and check whether branch appears on the list.
This way admin access like p4 protect would need is not needed.

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