Create a p4 change list in php

1.8k Views Asked by At

Im having one hell of a time trying to create a change list that returns the actual change list id thats avail from p4.

I have tried

$out = $p4->run('change','-o'); $out = $p4->run('change','i');

print_r($out);

any thoughts on this? seem like im missing the ability to pass a description value

Here is the updated piece of code im using and the returned data

$change = $p4->run('change', '-o');
$change[0]["Description"] = "Some description";
d($change);
$out = $p4->run_submit('-i',$change);
d($out);

Here is the returned data

Array
(
[0] => Array
    (
        [Change] => new
        [Client] => steve-contentdev
        [User] => stevet
        [Status] => new
        [Description] => Some description
    )

)
[P4.run()] Errors during command execution( "p4 submit -i" ) [Error]: Error in change       specification. Missing required field 'Change'. Error: Error in change specification. Missing required field 'Change'.

the d function is just a print_r with around it to make it look nice.

2

There are 2 best solutions below

0
On

After a bit of fiddling I ran into the input command which input values into a form, and from the p4 change it requires some stuff to be added.. here is the final code for php that will auto create a change list for you

$change = $p4->fetch_change();
$change[ 'Description' ] = "Autosubmitted changelist" ; 
$p4->input = $change;
$out = $p4->run('change','-i');
print_r($out);
1
On

I'm not sure what you're trying to do? 'p4 change -o' will dump the changelist form to stdout, while 'p4 change -i' will try to submit it. So your $out will contain very different data after those two calls.

If you want to pass in a changelist description you can try 'p4 submit -d'. Otherwise you need to edit the form after you grab it using 'p4 change -o'.