[p4ruby] Auto Submitting changes does not work for me

Robert Cowham robert at vizim.com
Fri Jan 8 09:41:33 PST 2010


Please ignore anything in the Tony Smith area of the public depot - now out
of date and replaced by fully supported option.

Parse_forms is not valid with official perforce version.

Run_edit takes an array.

You can use shortcuts fetch_XXX/save_XXX

See below:

irb(main):007:0> p4.password = "brunopass"
=> "brunopass"
irb(main):008:0> p4.run_login
=> ["User bruno logged in."]
irb(main):009:0> c = p4.fetch_change
=> {"Status"=>"new", "User"=>"bruno", "Client"=>"bruno_ws", "Change"=>"new",
"Description"=>"<enter description here>\n"
}
irb(main):010:0> c["Description"] = "New desc"
=> "New desc"
irb(main):011:0> result = p4.save_change(c)
=> ["Change 849 created."]
irb(main):012:0> cnum = result[0].split(" ")[1]
=> "849"
irb(main):013:0> p4.run_edit("-c", cnum, "//depot/jam/main/src/hash.c")
=> [{"type"=>"text", "action"=>"edit", "workRev"=>"8",
"clientFile"=>"c:\\bruno_ws\\Jam\\MAIN\\src\\hash.c", "depotFile"
=>"//depot/Jam/MAIN/src/hash.c"}]
irb(main):014:0> P4.identify
=> "Perforce - The Fast Software Configuration Management System.\nCopyright
1995-2008 Perforce Software.  All rights re
served.\nRev. P4Ruby/NTX86/2008.1/160893 (2008.1 API) (2008/08/04).\n"
irb(main):015:0>


HTH
Robert


> -----Original Message-----
> From: p4ruby-bounces at perforce.com 
> [mailto:p4ruby-bounces at perforce.com] On Behalf Of Russ Lavoy
> Sent: 08 January 2010 17:23
> To: p4ruby at perforce.com
> Subject: [p4ruby] Auto Submitting changes does not work for me
> 
> I am new to ruby and perforce and am having an issue here.  I 
> have tried all variations of sample code and I just can't 
> seem to get it to work.  I looked at the following links for 
> help.  The server requires user name and password to login.
> 
> http://www.perforce.com/perforce/doc.091/manuals/p4script/01_r
uby.html#1053103
> 
> http://public.perforce.com/guest/tony_smith/perforce/API/Ruby/
> main/doc/P4.html#input
> 
> I just can't seem to get it to work.  Here is the code:
> 
> <snip>
> 
> require "P4"
> p4 = P4.new
> p4.port = "1.2.3.4:1666"
> p4.user = "puser"
> p4.client = "srv"
> p4.password = "passwd"
> 
> 
>   p4.debug=3
>   p4.connect
>   p4.run_login
>   p4.parse_forms
> 
>   change = p4.run_change( "-o" ).shift
>   change[ "Description" ] = "Testing"
> 
>   p4.input( p4.format_changelist(change) )
>   p4.run_change( "-i" )
> 
>   changelist_num = p4.output.to_s.split(/\s+/)[1]
> 
>   p4.run_edit("-c #{changelist_num} stuff.txt")
> 
> </snip>
> 
> When I run it I get the following error.
> 
> <snip>
> 
> [root at srv ~]# ruby test.rb
> [P4] Connecting to Perforce
> [P4] Received input for next command
> [P4] SetInput()
> [P4] Executing "p4 login"
> [P4] Prompt(): Enter password:
> [P4] InputData(). Using supplied input
> [P4] OutputInfo()
> ... User puser logged in.
> [P4] Cleaning up saved input
> test.rb:14: undefined method 'P4#parse_forms' (NoMethodError)
> 
> </snip>
> 
> If I remove the parse_forms I get something back...  But dies 
> on another step.
> 
> <snip>
> 
> [P4] Connecting to Perforce
> [P4] Received input for next command
> [P4] SetInput()
> [P4] Executing "p4 login"
> [P4] Prompt(): Enter password:
> [P4] InputData(). Using supplied input
> [P4] OutputInfo()
> ... User puser logged in.
> [P4] Cleaning up saved input
> [P4] Executing "p4 change -o"
> [P4] OutputStat() - Converting to P4::Spec object ... Change 
> -> new ... Client -> srv ... User -> puser ... Status -> new 
> ... Description -> <enter description here>
> 
> ... Files -> [0] = //depot/somefile
> /usr/lib/ruby/site_ruby/1.8/P4.rb:102:in `format_spec': 
> [P4#format_spec] No spec definition for changelist objects. 
> (P4Exception)
>         from /usr/lib/ruby/site_ruby/1.8/P4.rb:102:in `method_missing'
>         from test.rb:19
> 
> </snip>
> 
> Can I get some help with this?
> 
> 
>       
> _______________________________________________
> p4ruby mailing list
> p4ruby at perforce.com
> http://maillist.perforce.com/mailman/listinfo/p4ruby



More information about the p4ruby mailing list