Perforce:预填充更改列表描述 [英] Perforce : Prefill changelist description

查看:113
本文介绍了Perforce:预填充更改列表描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的公司设置一个perforce服务器,想实现更改列表"预填描述(类似于GIT中的提交模板),但网上参考说我需要通过帮助来做同样的事情的触发器.我发现我需要实现更改内容和更改提交类型或触发器.但是我在互联网上找到的所有文档都只是以非常原始的形式告诉我,而不是以详尽的方式告诉我的.互联网上甚至没有视频参考.

I am setting up a perforce server in my company, and wanted to implement the "change list" pre-filled description(similar to commit template in GIT), but online reference says that I need to do the same by the help of triggers. I figured out that I need to implement change-content and change-submit type or triggers. But all the documentation I found on the internet tells me only in a very raw form but not in an elaborate way. Even no video reference was present on the internet.

如果有人能帮助我创建相同的触发器,我将不胜感激.(这是我第一次使用 Perforce Management.)

I would appreciate a lot, if someone can help me on how to create a trigger for the same.(This is my first time in Perforce Management.)

作为参考,模板将包含以下文本:-

[BUG_ID]
[标题]
[解决方案]
[开发商]
[团队]

For reference the template would contain the following text:-

[BUG_ID]
[TITLE]
[SOLUTION]
[DEVELOPER]
[TEAM]

提前致谢.

杰伊什

编辑(2014 年 7 月 30 日)---------------
在拜兰的回答之后,我尝试了以下内容.触发p4触发器"后,我在文本文件中添加了以下行

EDIT (30 JUL 2014)-----------------------
After Byran's answer, I tried the following stuff. I added the following line in text file after firing 'p4 triggers'


template_setter 格式更改c:/test/p4_template.ps1 %changelist%"

并将以下代码放入ps1文件中

and put the following code in the ps1 file

(Get-Content $args[0]) | 
Foreach-Object {$_ -replace "/<enter description here>", " Issue:
'nComment: "} | 
Set-Content $args[0]


但是当我尝试保存触发器文件时,它显示语法错误".我完全被困在这一点上.就像在互联网上一样,我发现几乎每个例子都说我必须这样做.但这种方式行不通.


But when I try to save the trigger file, it says "syntax error". And I am totally stuck at this point. as on internet I found almost every example saying I have to do this way. But this way is not working.

EDIT2(2014 年 7 月 30 日)-----------------------
我发现我在触发器文件中的触发器名称之前省略了 4 个空格.之后它接受了触发器.但现在问题是里面的代码(如上所述)不起作用.P4V 提示我上述文件不是有效的 WIN32 应用程序.

EDIT2 (30 JUL 2014)-----------------------
I figured out that I left out the 4 blank spaces before the trigger name in trigger file. After which it accepted the trigger. But now the problem is the code inside(as mentioned above) is not working. P4V gives me an error that the above file is not an valid WIN32 application.

EDIT3(2014 年 7 月 30 日)-----------------------
我通过在触发器文件中的触发器文件路径之前添加 powershell 来解决 EDIT2 问题.现在我的触发器是执行与否我不确定.其次,我不确定它是否正确执行.

EDIT3 (30 JUL 2014)-----------------------
I have fixed the EDIT2 problem by adding powershell before the trigger file path in trigger file. Now my trigger is execution or not I am not sure. Secondly, I am not sure if it is executing correctly.

请帮忙.谢谢

推荐答案

终于搞清楚了整个流程.
如下(基于Windows PowerShell的解决方案):-

第 1 步:创建一个 PowerShell 脚本文件(例如 test.ps1)并将此代码放入其中
(Get-Content $args[0]) |Foreach-Object {$_ -replace "<在此处输入描述>", "模板文本"} |设置内容 $args[0]

第 2 步:将此文件保存到物理服务器(尽量不要有带空格的路径)(例如,在我的情况下,文件位于物理服务器上的 c:\triggers\p4_template.ps1)

第 3 步:在命令提示符下运行此命令并具有对 P4 的 super 访问权限
p4 触发器

第 4 步:将此文本放入刚刚作为第 3 步结果打开的文本文件中
<代码><模板名称>表单更改powershell c:/test/p4_template.ps1 %formfile%"
(不要忘记在 <template_name> 之前放置 4 个空格)
(您可以使用连字符和/或下划线输入不带空格的任何模板名称)

第 4 步:在物理服务器上以admin 权限在命令提示符下运行此命令
set-executionpolicy remotesigned

第 5 步:从 Services.msc 重新启动 Perforce 服务或重新启动整个服务器一次.

第 6 步:检查 P4V 客户端应用程序的实现.

Finally, I have figured out the whole process.
It goes as follows(Windows PowerShell based solution):-

Step 1 : Create a PowerShell script file(eg test.ps1) and put this code in it
(Get-Content $args[0]) | Foreach-Object {$_ -replace "<enter description here>", "template text"} | Set-Content $args[0]

Step 2 : Save this file to the physical server(try not to have a path with spaces) (eg. in my case file was located at c:\triggers\p4_template.ps1 on the physical server)

Step 3 : run this command on command prompt with super access to P4
p4 triggers

Step 4 : put this text in the text file just opened as a result of Step 3
<template_name> form-out change "powershell c:/test/p4_template.ps1 %formfile%"
(DO NOT FORGET TO PUT 4 WHITE SPACES before the <template_name>)
(you can put any template name with out spaces using hyphen and/or underscore)

Step 4 : run this command on command prompt with admin rights to command prompt on physical server
set-executionpolicy remotesigned

Step 5 : restart the Perforce service from Services.msc or restart the entire server once.

Step 6 : check the implementation from P4V client application.

此实现 100% 正确.希望这对您也有帮助.

This implementation worked 100% correctly. Hope this helps you as well.

特别感谢 Bryan Pendleton,他让我开始了我的工作.

Special thanks to Bryan Pendleton, who gave me the kick start in my work.

(请注意,如果您在我给出的代码段中发现任何多余的空格,请忽略直到并且除非我明确提及.)如果您觉得这对您有帮助,请投票.

(please note that if you find any extra blank spaces in the code segments I have given then please ignore until and unless I have explicitly mentioned it.) Please vote if you find this helpful.

这篇关于Perforce:预填充更改列表描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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