我第一次使用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'."