[p4ruby] Auto Submitting changes does not work for me

Russ Lavoy ussray_00 at yahoo.com
Fri Jan 8 09:23:08 PST 2010


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_ruby.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?


      



More information about the p4ruby mailing list