How to create a numbered list of changes using P4Python?

P4.fetch_change () creates a change specification with a change equal to "new". I need to create a change specification with the actual number (which will not interfere with other changes). IOW, I need to be able to reserve a change list number.

How can this be done with P4Python?

Context: My script accepts an existing list of changes. I need to check that the script is working correctly.

+3
source share
3 answers

P4.save_change () creates a change list number, i.e. Creates a numbered, pending list. Try something like:

changespec = P4.fetch_change()
changespec[ "Description" ] = "placeholder"
P4.save_change( changespec )
+6
source

, p4.fetch_change() !

, ! , dict "Change": "new" "Description".

save_change . , :

from P4 import P4

def create_empty_changelist(desc='some description'):
    p4 = P4()
    p4.connect()
    result = p4.save_change({'Change': 'new', 'Description': desc})[0]
    return int(result.split()[1])
+1

Perforce does not allow you to reserve change list numbers. If you want to send an existing (pending) list of changes using P4Python, follow these steps: p4.run_submit("-c", changelist)

0
source

All Articles