p4python修改更改列表说明

时间:2015-05-19 05:53:19

标签: python perforce p4python

此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

2 个答案:

答案 0 :(得分:1)

'change-commit trigger'是一个错字吗?更改提交触发器在完全提交后称为,并且无法对其进行任何修改。

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

答案 1 :(得分:1)

由于您的意思是在更改提交/内容触发期间,这就是我的工作:

details = p4.fetch_change(changelistNumber)
description = details['Description']

# Make changes to description

details[descriptionKey] = description
p4.save_change(details)