0
try: # Catch exceptions with try/except
    p4.connect() # Connect to the Perforce Server
    p4.run_login()

    client = p4.fetch_client()
    client['View'] = ['//TestPublic/Extern/firanl/... //mitica/TestPublic/Extern/firanl/...']  # workspace mapping
    p4.save_client(client)
#    p4.run_sync()   # this command stops the execution of other commands after this

    result = p4.run("fstat", perforce_path)[0]
    file1 = result['clientFile']

    change = p4.fetch_change()
    change._files = [file1]     #associate file to changelist
    change._description = 'aaaaaa'
    p4.run_submit(change)



    p4.disconnect() # Disconnect from the Server
except P4Exception:
    for e in p4.errors: # Display errors
        print e
#

当我运行代码时,会给我这个错误:“更改规范错误。不能包含尚未打开的文件。使用 p4 添加、p4 编辑等打开新文件。”

我试图用 p4.run("edit", file1) 打开文件,但是程序什么也不做,并且在此之后不运行下一个命令。如何打开文件以及 p4 add 和 p4 edit 的 python 工作命令是什么?

4

1 回答 1

1

专注于你的run_sync命令。我的猜测是它没有使用您刚刚设置的客户端。

要验证正在使用的内容,请运行run_set并打印其结果。

为确保您正在使用您的客户端,请先为其命名(使用client['Name'] = 'MyClient'),然后再保存它,然后告诉您的 P4Python 使用它(p4.client = 'MyClient')。

然后运行同步。

于 2016-11-15T08:45:31.677 回答