【发布时间】:2020-02-18 16:28:27
【问题描述】:
我有以下代码。我正在尝试从 Perforce 中检查两个文件并将它们放入更改列表中。但是run_add 不会检出文件。我在 Perforce 中看到的唯一内容是一个空的更改列表,其中没有文件。
""" Checks out files from workspace using P4"""
files = ['analyse-location.cfg', 'CMakeLists.txt']
p4 = P4()
# Connect and disconnect
if (p4.connected()):
p4.disconnect()
p4.port = portp4
p4.user = usernameP4
p4.password = passwordP4
p4.client = clientP4
try:
p4.connect()
if p4.connected():
change = p4.fetch_change()
change['Description'] = "Auto"
change['Files'] = []
changeList = p4.save_change(change)[0].split()[1]
for items in files:
abs_path = script_dir + "\\" + items
p4.run_add("-c", changeList, items)
print("Adding file "+ abs_path + " to "+ changeList)
# Done! Disconnect!
p4.disconnect()
except P4Exception:
print("Something went wrong in P4 connection. The errors are: ")
for e in p4.errors:
print(e)
p4.disconnect()
但是,当我改为使用p4.run("edit", items) 时,它会将文件放在默认更改列表中。它真的让我很紧张。我不知道我这样做是错误的。还创建了更改列表。我在 Windows 上使用 python 3.7 32 位
【问题讨论】:
标签: python-3.7 perforce p4python