Skip to main content
 首页 » 编程设计

python之p4python 修改变更列表说明

2024年10月25日19powertoolsteam

此 p4python 代码片段获取 perforce 描述并删除了描述中提到的方括号。我计划在更改提交触发器期间调用此脚本,以在提交更改之前替换 CL 描述。不知道出了什么问题,但是触发器没有接受我的新更改描述。有没有人尝试使用 p4python 来做这个?非常感谢任何提示

describe = p4.run('describe', changeList) 
print describe 
 
description = describe[0].get('desc') 
print description 
 
description = description.replace('[', '') 
description = description.replace(']', '') 
print description 

先描述打印

[{'status': 'pending', 'changeType': 'public', 'rev': ['21'], 'client': 'workspace1', 'user': 'username', 'time': '1432010818', 'action': ['edit'], 'type': ['text'], 'depotFile': ['//depot/repo/Vagrantfile'], 'change': '12345', 'desc': '[ABC-789] testfile commit'}] 

第一个描述打印

[ABC-789] testfile commit 

第二个描述去掉了方括号

ABC-789 testfile commit 

请您参考如下方法:

“更改提交触发器”是拼写错误吗?更改提交触发器在更改完全提交后被调用,并且不能对其进行任何修改。

如果您想在提交过程中更改更改列表,您需要使用更改提交或更改内容触发器。