【发布时间】:2015-05-05 12:05:14
【问题描述】:
我有一个 perforce 客户端工作区和一个远程仓库。我正在尝试编写一个 Python 脚本,每当在该仓库中添加或更改新文件时,该脚本会定期将远程仓库同步到我的客户端工作区。我在这里查看了 P4P APIs 和一个非常有用的answer,并且对如何实现这一点有了一个模糊的想法:-
from P4 import P4, P4Exception
p4 = P4()
p4.port = "1"
p4.user = "User"
p4.client = "Client"
try:
p4.connect()
changelist = p4.run_filelog('//server/folder/...@yyyy/mm/dd,@now')
for r in changelist:
print r.depotFile #does this print the contents of the changed file??
print r.revisions[0].time #does this print the change time?
except P4Exception:
for e in p4.errors:
print e
finally:
p4.disconnect()
如果 r.depotfile 返回文件及其内容(相当于 p4 print),我可以使用该文件进行进一步处理。有没有办法在仓库发生变化时定期执行此操作?请指出正确的方向。提前致谢。
【问题讨论】: