自定义 Perforce RCS 关键字扩展的输出 [英] Customizing the output of Perforce RCS keyword expansion

查看:71
本文介绍了自定义 Perforce RCS 关键字扩展的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 RCS 关键字扩展过滤文件,以便将 $Change$ 的实例转换为 1745 而不是 $Change 的默认行为: 1745 $.我意识到这会阻止未来的扩展,但出于目的,这是可以接受的.

I'd like to filter files using RCS keyword expansion so that instances of $Change$ are translated to 1745 rather than the default behaviour of $Change: 1745 $. I realize that this would prevent future expansions, but that's acceptable for the purposes.

也欢迎其他将更改列表编号插入文件的方法.这是我在 Perforce 中看到的唯一一种在提交期间有效的方法——只是我想清理它,以便它可以干净地插入到版本号中.这也可以通过触发器来实现吗?

Other methods of inserting the changelist number into a file are also welcome. This is the only method I've seen with Perforce that works during submission -- it's just that I'd like to clean it up so that it can be cleanly inserted into version numbers. Could this also be accomplished with triggers?

推荐答案

触发器无法完成您的要求.提交期间唯一处于活动状态的触发器change-submitchange-contentchange-commit.您只能检索后两者的文件内容,但是使用 change-content 触发器,更改列表编号尚未修复,并且使用 change-commit 触发器,文件内容已提交且无法更改.但更糟糕的是,您无法从触发器内将更改的文件内容提交回服务器.

What you are asking for cannot be done with triggers. The only triggers that are active during submit are change-submit, change-content and change-commit. You can only retrieve the file-content for the latter two, but with the change-content trigger, the changelist number is not yet fix, and with the change-commit trigger, the file-content is already committed and can't be changed. What's worse, though, is that you wouldn't have a way to submit a changed file-content back to the server from within your trigger.

RCS 关键字扩展之所以有效,是因为它是由服务器本身完成的,并且因为 Perforce 会在提交后刷新,即客户端刷新 Perforce 服务器提交的更改的所有文件,从而获得具有扩展 RCS 关键字的内容.

The RCS keyword expansion works because it is done by the server itself and because Perforce does a refresh-after-submit, i.e. the client refreshes all files of a submitted change from the Perforce server, thereby getting the content with expanded RCS keywords.

这篇关于自定义 Perforce RCS 关键字扩展的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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