1

I managed to create an empty changelist in my perforce client workspace following the steps below :

>>> from P4 import P4,P4Exception
>>> p4 = P4()
>>> p4.connect()
P4 [ciastro@ciastromac perforce:1666] connected
>>> change = p4.fetch_change()
>>> change
{'Status': 'new', 'Client': 'ciastromac', 'User': 'ciastro', 'Change': 'new', 'Description': '<enter description here>\n'}
>>> change[ "Description" ] = "Autosubmitted 3rd changelist"
>>> p4.input = change
>>> p4.run_submit( "-i" )

this does add a changelist but I do not get the changelist number to add files to the changelist. I need the changelist number to submit to depot as well.

Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197

2 Answers2

1

You don't need to define a new changelist spec at all in order to submit the default changelist. Just do:

p4.run_submit("-d", "Autosubmitted 3rd changelist")

If you don't provide a changelist number, p4 submit will automatically take the files from the default changelist, put them into a new numbered changelist, and submit it. (If you supply the -d flag with a description, it will use the description instead of prompting you to edit the changelist spec.) The output of p4 submit will tell you what number the changelist ended up with.

Samwise
  • 68,105
  • 3
  • 30
  • 44
0

We can get the change but you need to use system command

change = subprocess.check_output('p4 change -o | p4 change -i', shell=True).decode('utf-8').split(' ')[1]

print(change) then you can use p4.fetch_change() with change number