此p4python代码的片段获取perforce描述并删除说明中提及的方括号。我打算在更改提交触发器期间调用此脚本以在提交更改之前替换CL描述。不知道什么是错的,但触发器不采取我的新变化描述..有没有人尝试使用p4python这样做?任何提示的高度赞赏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
感谢修正布莱恩..你SRE的权利..我的意思更改内容 – thunderbird
你应该能够改变更改提交触发器期间的更改列表描述。但仅仅在Python程序中改变'description'变量是不够的,而且它不足以将更新后的描述打印到stdout。您需要运行“更改-i”命令,并将修改规范修改为包含修订后的更改列表描述(但更改列表规范的其余部分未更改)。 –