P4 Triggers-在客户端提交后编辑变更者描述

发布于 2025-02-04 08:49:58 字数 665 浏览 3 评论 0 原文

如果我在P4V中提交更改者,我想通过P4触发器更改更改者的描述。

像这样,

“在此处输入图像描述”


用更改扣(或变更命令)触发执行的命令,但描述没有更改。

p4 --field Description=DESCRIPTIONS... change -o CHANGELISTNUM | p4 change -i -u

我已经尝试了P4更改选项-i -u和-i -f,All Option不适用于触发命令。(脚本)

(在触发器工作的环境中,由于超级用户帐户已登录,因此可以使用-f选项。)

是否有人通过触发器更改了描述?

谢谢

If I submit the changelist in P4V, I'd like to change the description of the changelist through the P4 trigger.

like this,

enter image description here

https://www.perforce.com/manuals/p4sag/Content/P4SAG/scripting.triggers.push.html
Command executed with change-submit(or change-commit) trigger but Description did not change.

p4 --field Description=DESCRIPTIONS... change -o CHANGELISTNUM | p4 change -i -u

I've tried p4 change options -i -u and -i -f, all option not working on trigger command.(script)
(In the environment where the trigger works, the -f option is possible because the superuser account is logged in.)

Has anyone changed the description through the trigger?

Thanks ????

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

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

发布评论

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

评论(1

污味仙女 2025-02-11 08:49:58

是的;如果您使用 -f ,它应该有效。 -U 除非触发器作为拥有变更者的用户(即执行提交的用户)运行,否则 -f 只要有效扳机作为管理员运行。如果不起作用,请仔细检查您的权限。

简单示例:

C:\Perforce\test>p4 triggers -o
(...snip...)
Triggers:
        update-desc change-commit //... "cmd /c p4 --field Description+=DESCRIPTIONS... change -o %change% | p4 change -if"

C:\Perforce\test>p4 submit -d "test description"
Submitting change 301.
Locking 1 files ...
edit //stream/main/foo#6
Change 301 submitted.
Change 301 updated.

C:\Perforce\test>p4 change -o 301
(...snip...)
Description:
        test description
        DESCRIPTIONS...

触发器不在命令外壳中执行,因此,如果要使用 | 重定向之类的shell功能,则可能需要明确使用命令壳来处理命令行(在我的情况下 CMD /C < /code>执行该作业)。

请注意提交输出中的Extra 更改301更新;这就是触发器的 p4更改-i 回声回到客户端的输出。如果您的触发器不起作用,请仔细查看您从 p4提交的输出,因为它可能包含一条错误消息,该消息使您有一个线索,触发器失败。如果您看到整个更改规格都回到了您身上,那就是重定向不起作用的线索。 (如果您找不到P4V中的任何触发器输出,请从CLI进行测试提交;如果您仍然找不到任何触发器,请仔细检查触发器的触发器条目,并记录服务器日志。)

请注意,请注意< Code> Change-Submit 是A pre-Submit 触发器,而 Chage> Change-Commit 是A subsubmit 触发器。如果您希望扳机成功提交后发射,则需要 Change-Commit

Yes; it should work if you use -f. -u won't work unless the trigger is running as the user who owns the changelist (i.e. the user who's doing the submit), but -f will work as long as the trigger is running as an admin. If it's not working, double check your permissions.

Simple example:

C:\Perforce\test>p4 triggers -o
(...snip...)
Triggers:
        update-desc change-commit //... "cmd /c p4 --field Description+=DESCRIPTIONS... change -o %change% | p4 change -if"

C:\Perforce\test>p4 submit -d "test description"
Submitting change 301.
Locking 1 files ...
edit //stream/main/foo#6
Change 301 submitted.
Change 301 updated.

C:\Perforce\test>p4 change -o 301
(...snip...)
Description:
        test description
        DESCRIPTIONS...

Triggers don't execute in a command shell, so if you want to use shell features like | redirection, you may need to explicitly use a command shell to process the command line (in my case cmd /c does that job).

Note the extra Change 301 updated in the submit output; that's the output of the trigger's p4 change -i being echoed back to the client. If your trigger isn't working, look carefully at the output that you're getting from the p4 submit, since it will probably contain an error message that gives you a clue where the trigger is failing. If you see the entire change spec being echoed back to you, that's a clue that the redirection isn't working. (If you can't find any trigger output in P4V, go do a test submit from the CLI; if you still can't find any, double check the triggers entry for typos, and the server log for errors.)

Note that change-submit is a pre-submit trigger, whereas change-commit is a post-submit trigger. If you want the trigger to fire after a successful submit, you want change-commit.

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