[p4] p4ruby create new changelist

Peter Stephenson pws at csr.com
Fri Mar 6 09:33:37 PST 2009


Peter Buckley wrote:
> I'm having trouble entering a change description from the command line
> that I don't have issues with from the p4win gui. Perforce seems to be
> interpolating the lines that I've put in the description. How can I
> appropriately comment or pass this to perforce on the command line and
> still maintain my formatting for the description?
> 
> Thanks,
> Peter
> 
> Here's the relevant code snippet from my class:
> 
>     @changeDescription = File.open(changeDescriptionFile,'rb').readlines
>     p4.input = "Change: new\nDescription: #{@changeDescription}"

The problem's here: your description spans multiple lines, so the form
will look like:

Change: new
Description: stuff...
more stuff...

whereas Perforce wants (note leading tabs):

Change: new
Description:
	stuff...
	more stuff

Try something like (remembering the newlines are already there):

p4.input = "Change: new\nDescription:\n\t" + @changeDescription.join("\t")

I haven't verified this works (but did check the Ruby syntax).

-- 
Peter Stephenson <pws at csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



More information about the perforce-user mailing list