[p4ruby] p4 changelist

Andy Koch andy.koch at pc-doctor.com
Fri Apr 18 15:58:20 PDT 2008

I did eventually realize (via irb session) that one can capture the 
output in a variable, which seems more natural.

I also found a few other methods had changed, here is the resulting code 
for contrast...

change = p4.run_change( "-o" ).shift

p4.input = change
output = p4.run_change( "-i" ).shift

params['changelist_num'] = output.to_s.split(/\s+/)[1]

note - "input=" instead of "input()"
and the format_changelist was dropped completely.


Tony Smith wrote:
> Hi Andy,
>> to elaborate, my code does this...
>> **********************
>>  # create a new changelist and retrieve changelist number
>>     change = p4.run_change( "-o" ).shift
>>     p4.input( p4.format_changelist(change) )
>>    p4.run_change( "-i" )
>>     changelist_num = p4.output.to_s.split(/\s+/)[1]
>> **********************
>> the changelist_num is then used for processing to add files to the
>> specific changelist, reverting empty changelists and submitting changelists
>> but I've still not worked out a way to accomplish this with the new P4
>> library
> The output method was deleted because it was redundant really. You can get the 
> output just by saving the result of the p4.run_change command. Something like 
> this:
>      p4.input( p4.format_changelist(change) )
>      changelist_num = p4.run_change( "-i" ).to_s.split(/\s+/)[1]
> Tony

Andy Koch, Web Applications Developer
PC-Doctor, Inc.
9805 Double R Boulevard Suite 301
Reno, NV 89521
andy.koch at pc-doctor.com

The information contained in this message is confidential. It is 
intended to be read only by the individual or entity to whom it is 
addressed or by an authorized designee. If the reader of this 
message is not the intended recipient, be aware that distribution 
of this message in any form is strictly prohibited. If you have 
received this message in error, please immediately notify the sender 
and destroy any copy of this message.

More information about the p4ruby mailing list