提交之前使用Perforce触发器更新文件 [英] Updating files with a Perforce trigger before submit

查看:84
本文介绍了提交之前使用Perforce触发器更新文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,这个问题从本质上已经已被问到,但该问题没有明确的答案,因此请耐心等待.

I understand that this question has, in essence, already been asked, but that question did not have an unequivocal answer, so please bear with me.

背景:在我的公司中,我们使用Perforce提交编号作为版本控制的一部分.不管这是否是正确的方法,事情都是这样.当前,许多开发人员会分别提交代码和文档:首先是代码,然后是文档,以使用新的版本号更新面向客户的文档.我想简化此过程.

Background: In my company, we use Perforce submission numbers as part of our versioning. Regardless of whether this is a correct method or not, that is how things are. Currently, many developers do separate submissions for code and documentation: first the code and then the documentation to update the client-facing docs with what the new version numbers should be. I would like to streamline this process.

我的想法如下:创建一个Perforce触发器(在服务器端运行),该触发器扫描提交的文档文件(例如 .txt )中的唯一术语(例如#### PERFORCE ## CHANGELIST ## NUMBER ### ROFL ### LOL ### WHATEVER ##### ),然后将其替换为提交时更改列表的值.我已经知道如何确定该值.我不知道要如何更新文件或在何处更新文件.

My thoughts are as follows: create a Perforce trigger (which runs on the server side) which scans the submitted documentation files (such as .txt) for a unique term (such as #####PERFORCE##CHANGELIST##NUMBER###ROFL###LOL###WHATEVER#####) and then replaces it with the value of what the change list would be when submitted. I already know how to determine this value. What I cannot figure out, is how or where to update the files.

我已经确定使用 change-content 触发器(无论是否可行)

I have already determined that using the change-content trigger (whether possible or not), which

在创建更改列表和文件传输之后但在将提交提交到数据库之前触发",
"fire[s] after changelist creation and file transfer, but prior to committing the submit to the database",

是必经之路.此时,文件需要在服务器上的某处存在.我如何从一个Python脚本中确定这些文件的(临时位置),以便我可以更新或 将占位符值替换为预期值?到目前为止,我发现的有关Perforce的在线文档还没有明确说明这一点是否可行,或者在此阶段提交工作的机制如何工作.

is the way to go. At this point the files need to exist somewhere on the server. How do I determine the (temporary?) location of these files from within, say, a Python script so that I can update or sed to replace the placeholder value with the intended value? The online documentation for Perforce which I have found so far have not been very explicit on whether this is possible or how the mechanics of a submission at this stage would work.

基本上,我要寻找的是类似RCS的功能,但是没有伴随它的难看的特殊字符序列.经过进一步的挖掘,我要问的是与这个问题.但是我相信这是有可能的,因为触发器在服务器端上运行,并且文件已被传输到服务器.因此,它们必须可以通过脚本访问.

Basically what I am looking for is RCS-like functionality, but without the unsightly special character sequences which accompany it. After more digging, what I am asking is the same as this question. However I believe that this must be possible, because the trigger is running on the server side and the files had already been transferred to the server. They must therefore be accessible by the script.

请考虑发行说明文档中的以下代码段:

Consider the following snippet from a release notes document:

[#####PERFORCE##CHANGELIST##NUMBER###ROFL###LOL###WHATEVER#####] Added a cool new feature.  Early retirement is in sight.
[52702] Fixed a really annoying bug.  Many lives saved.
[52686] Fixed an annoying bug.

这是用户提交的.然后,我希望触发器在提交过程中拦截该文件(如前所述,在 change-content 阶段)并对其进行更改,以使最终存储在Perforce中的内容如下所示:

This is what the user submits. I then want the trigger to intercept this file during the submission process (as mentioned, at the change-content stage) and alter it so that what is eventually stored within Perforce looks like this:

[52738] Added a cool new feature.  Early retirement is in sight.
[52702] Fixed a really annoying bug.  Many lives saved.
[52686] Fixed an annoying bug.

其中 52738 是用户提交的最终更改列表号.(如前所述,我已经可以确定这个数字了,所以请对此进行详细说明.)即用户在Perforce客户端控制台上看到的是

Where 52738 is the final change list number of what the user submitted. (As mentioned, I can already determine this number, so please do dwell on this point.) I.e., what the user sees on the Perforce client console is.

Changelist 52733 renamed 52738.
Submitted change 52738.

推荐答案

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