[p4python] Change list numbers do not match up after p4 submit
wrivera at nikondev.com
Mon Jul 14 12:37:47 PDT 2008
Thank you for the link it explains a lot .
I am rethinking how to better handle this situation since the final
submitted change list number is important to the end result of my script.
Once again thank you
All the best,
Robert Cowham wrote:
> Hi Wilken
> This is by design - it is how Perforce works.
> On the command line you would see something like:
> Change 123 renamed 129 and submitted.
> See this discussion:
>> -----Original Message-----
>> From: p4python-bounces at perforce.com
>> [mailto:p4python-bounces at perforce.com] On Behalf Of WilkenRivera
>> Sent: 14 July 2008 19:13
>> To: p4python at perforce.com
>> Subject: [p4python] Change list numbers do not match up after
>> p4 submit
>> Hello Everyone,
>> I have recently come across a strange issue when calling the
>> p4.run method to execute a submit for a pending change list.
>> I have a set of scripts that executes a number of p4 commands
>> for opening and submitting files. In order to keep all file
>> changes under one changelist I create a pending changelist by
>> using the fetch_change and save_change method to obtain a new
>> change list and set the change list status to pending.
>> When I submit the pending change list I get a new change list
>> number for the existing change list. I am not sure how
>> exactly this is happening but I do know that it does not
>> occur all of the time. I have included snippets of code to
>> show exactly how I am obtaining a change list and how I am
>> submitting the change list.
>> The issue is as follows:
>> I begin the process of fetching a changelist once the change
>> has been fetch I update the description and status (set to
>> pending) and execute a p4.save_change. Once the changelist
>> has been saved I use regex to extract the actual changelist
>> number created on Perforce.
>> if UserLogin(p4c):
>> print "Establishing New Changelist"
>> p4c.new_change = p4c.fetch_change()
>> p4c.new_change['Description'] = in_description
>> change_no_result = p4c.save_change(p4c.new_change)
>> rx = re.compile("[^\d]+");
>> changelist_no = rx.sub("",change_no_result)
>> print "Changelist Number %s" % changelist_no;
>> p4c.new_change["Change"] = changelist_no
>> p4c.new_change["Status"] = "pending"
>> except p4.P4Error:
>> return changelist_no
>> The code above successfully creates a new changelist and
>> marks it as pending. The changlist_no at this point matches
>> the actual changelist number in Perforce.
>> Once the new_change attribute has been updated with the
>> corresponding change list information the script proceeds to
>> checkout files for edit
>> print "Opening %s for edit" % str(filepath)
>> p4c.run_edit ( "-c", p4c.new_change["Change"], str(filepath) )
>> The files at this point are marked for edit within the
>> pending change list.
>> Finally, when I submit the pending change list the change
>> list number on the Perforce server is different from the
>> actual change list number that I obtained when I originally
>> created the change.
>> cmd = ["submit"]
>> cmd.append ("-c")
>> cmd.append (p4c.new_change["Change"])
>> Any help on or explanation on why I am getting a new change
>> list number would be greatly appreciated.
Software Infrastructure Administrator, Nikon Inc.
1300 Walt Whitman Road, Melville, NY 11747-3064
Phone: +631-547-8615, Cell: +917-208-9046
Email: wrivera at nikondev.com
More information about the p4python