我第一次使用 p4python,遇到了一个问题,我无法将我的更改提交到 perforce 服务器。我能够连接到服务器并打开文件进行编辑。
change_spec = p4.fetch_change()
change_spec["Files"] = []
change_spec["Description"] = "change by "+p4.user+" of adding dns for network:"+network
ret = p4.save_change(change_spec)
change_number = ret[0].split( )[1]
editServerfiles = ["db/zone-master","db/zone-slave","db/zone-site","db/zones","db/zone-hidden_slave"]
p4.run_edit("-c",change_number,editServerfiles)
<<making subprocess calls to edit the opened files>>
change_spec = p4.fetch_change(change_number)
changedfiles = ["//ssg/dns_generate/main/db/zone-master","//ssg/dns_generate/main/db/zone-slave","//ssg/dns_generate/main/db/zone-site","//ssg/dns_generate/main/db/zones"] #depot files
change_spec["Files"] = changedfiles
change_spec["Description"] = "change by "+p4.user+" of adding dns for network: "+network
print change_spec
p4.run_submit(change_spec)
执行 p4_run_submit(change_spec) 之前的 change_spec 对象(见下文)看起来不错,但它仍然抱怨没有要提交的文件。任何指针???
{'Status': 'pending', 'Files': ['//ssg/dns_generate/main/db/zone-master',
'//ssg/dns_generate/main/db/zone-slave', '//ssg/dns_generate/main/db/zone-site', '//ssg/dns_generate/main/db/zones'], 'Description': 'change by skameswa of adding dns for network: 172.30.116.0\n', 'Client': 'skameswa.p4dns', 'User': 'skameswa', 'Date': '2017/08/30 14:21:49', 'Type': 'public', 'Change': '2810898'}
Traceback (most recent call last):
File "dnsaddperforce.py", line 91, in <module>
p4.run_submit(change_spec)
File "/usr/local/pythonbrew/pythons/Python-2.7.9/lib/python2.7/site-
packages/P4.py", line 631, in run_submit
return self.run("submit", *nargs, **kargs)
File "/usr/local/pythonbrew/pythons/Python-2.7.9/lib/python2.7/site-
packages/P4.py", line 609, in run raise e
P4.P4Exception: [P4#run] Errors during command execution( "p4 submit -i" )
[Error]: "No files to submit.\nSubmit failed -- fix problems above then use 'p4 submit -c 2810898'."