maskedmenace
maskedmenace

Reputation: 11

P4Python create label without tmp file from getting opened

I have a requirement to create multiple perforce labels from my test script. Following snippet creates a perforce label. But it happens to open a .tmp file for me to edit the description and the process waits until I close the .tmp file. Is there a way I can prevent the .tmp file from getting opened?

import P4
p4 = P4()
p4.connect()
p4.run('label', ['label_name'])
p4.disconnect()

P.S: I am aware of the solution to use p4 label -o -t label_template new_label | p4 label -i. Is there a way I can do this from P4Python?

Upvotes: 1

Views: 101

Answers (1)

neuroc
neuroc

Reputation: 1

You have to utilize the 'input' property of your P4 connection object

output = p4.run_label('-o', label)[0]
p4.input = output
p4.run_label('-i')

https://www.perforce.com/manuals/p4python/Content/P4Python/python.p4.html#Class_Methods_..38

p4.input -> string | dict | list Contains input for the next command.

Upvotes: 0

Related Questions