List Info

Thread: changelist # retrieval




changelist # retrieval
country flaguser name
United States
2007-02-06 13:08:23
Greetings p4ruby list,

I'm new to using p4ruby but my project is substantial so I'm
excited to 
have this tool available.

Currently working on getting a basic understanding of how to
work with 
p4ruby, so my examples are contrived.  My code is also
purposely verbose 
as I hack about testing different things.

I'm trying to work out adding, editing, etc. files.  I've
gleaned some 
information from the documentation but I can't seem get how
one 
retrieves the number of a new changelist.  Here is my
code...

require 'P4'
p4 = P4.new
p4.debug=3
p4.tagged
p4.parse_forms

p4.connect
p4.run_login

change = p4.run_change( "-o" ).shift
change[ "Description" ] = "adding new
files"

p4.run_add('C:ruby_chipstest.rb')
change.each {|k,v| printf "%-14s = %-40.50sn", k,
v}

p4.input( change )
p4.run_submit( "-i" )

p4.disconnect


This results in creating an empty changelist while the file
I'm trying 
to add ends up in the default changelist. 

I'm guessing that I want to change...

p4.run_add('C:ruby_chipstest.rb')

into...

p4.run_add('C:ruby_chipstest.rb -c <changelist #>')

but where/how to get the changelist #?

Regards,

-- 
Andy Koch
_______________________________________________
p4ruby mailing list
p4rubyperforce.com

http://maillist.perforce.com/mailman/listinfo/p4ruby

Re: changelist # retrieval
user name
2007-02-06 15:54:41
I think you have a horse/cart problem in front of you.

Suggestion #1:
     do the "run_add" and then, *afterwards*, the
"change -o / input /
submit -i".
     (This assumes that nothing else is opened for anything,
that
you're in a controlled environment, etc.)

Suggestion #2:
     Do the "change -o" and combine with a
"change -i", which will return a
     change number in the output. Now, do the add operations
for that change
     number and submit -c <thatchange>. (No need to
set the input for the
     submit, in that case - but you wanna set it before
calling change -i.)

Followup thought: it's an outstanding tool. Document the
heck out of your
work so that your colleagues are helping craft the scripts.

   -Jeff Bowles

On 2/6/07, Andy Koch <andy.kochpc-doctor.com> wrote:
> Greetings p4ruby list,
>
> I'm new to using p4ruby but my project is substantial
so I'm excited to
> have this tool available.
>
> Currently working on getting a basic understanding of
how to work with
> p4ruby, so my examples are contrived.  My code is also
purposely verbose
> as I hack about testing different things.
>
> I'm trying to work out adding, editing, etc. files. 
I've gleaned some
> information from the documentation but I can't seem get
how one
> retrieves the number of a new changelist.  Here is my
code...
>
> require 'P4'
> p4 = P4.new
> p4.debug=3
> p4.tagged
> p4.parse_forms
>
> p4.connect
> p4.run_login
>
> change = p4.run_change( "-o" ).shift
> change[ "Description" ] = "adding new
files"
>
> p4.run_add('C:ruby_chipstest.rb')
> change.each {|k,v| printf "%-14s =
%-40.50sn", k, v}
>
> p4.input( change )
> p4.run_submit( "-i" )
>
> p4.disconnect
>
>
> This results in creating an empty changelist while the
file I'm trying
> to add ends up in the default changelist.
>
> I'm guessing that I want to change...
>
> p4.run_add('C:ruby_chipstest.rb')
>
> into...
>
> p4.run_add('C:ruby_chipstest.rb -c <changelist
#>')
>
> but where/how to get the changelist #?
>
> Regards,
>
> --
> Andy Koch
> _______________________________________________
> p4ruby mailing list
> p4rubyperforce.com
> 
http://maillist.perforce.com/mailman/listinfo/p4ruby
>


-- 
---
Jeff Bowles - jabpiccoloeng.com
_______________________________________________
p4ruby mailing list
p4rubyperforce.com

http://maillist.perforce.com/mailman/listinfo/p4ruby

Re: changelist # retrieval
user name
2007-02-07 12:15:59
You must first create the changelist.  As a note the 2006.2
version of
the server now supports a submit option that allows a one
liner.  Very
cool.

-----Original Message-----
From: p4ruby-bouncesperforce.com [mailto:p4ruby-bouncesperforce.com]
On Behalf Of Andy Koch
Sent: Tuesday, February 06, 2007 12:08 PM
To: p4rubyperforce.com
Subject: [p4ruby] changelist # retrieval

Greetings p4ruby list,

I'm new to using p4ruby but my project is substantial so I'm
excited to 
have this tool available.

Currently working on getting a basic understanding of how to
work with 
p4ruby, so my examples are contrived.  My code is also
purposely verbose

as I hack about testing different things.

I'm trying to work out adding, editing, etc. files.  I've
gleaned some 
information from the documentation but I can't seem get how
one 
retrieves the number of a new changelist.  Here is my
code...

require 'P4'
p4 = P4.new
p4.debug=3
p4.tagged
p4.parse_forms

p4.connect
p4.run_login

change = p4.run_change( "-o" ).shift
change[ "Description" ] = "adding new
files"

p4.run_add('C:ruby_chipstest.rb')
change.each {|k,v| printf "%-14s = %-40.50sn", k,
v}

p4.input( change )
p4.run_submit( "-i" )

p4.disconnect


This results in creating an empty changelist while the file
I'm trying 
to add ends up in the default changelist. 

I'm guessing that I want to change...

p4.run_add('C:ruby_chipstest.rb')

into...

p4.run_add('C:ruby_chipstest.rb -c <changelist #>')

but where/how to get the changelist #?

Regards,

-- 
Andy Koch
_______________________________________________
p4ruby mailing list
p4rubyperforce.com

http://maillist.perforce.com/mailman/listinfo/p4ruby

_______________________________________________
p4ruby mailing list
p4rubyperforce.com

http://maillist.perforce.com/mailman/listinfo/p4ruby

Re: changelist # retrieval
country flaguser name
United States
2007-02-07 12:17:31
Thanks Jeff,

That helped a great deal.  Now I'm having what I consider a
spooky problem.

My code is now...

###############################################
require 'P4'
p4 = P4.new

begin
  p4.debug=3
  p4.parse_forms
  p4.connect
  p4.run_login

  change = p4.run_change( "-o" ).shift
  change[ "Description" ] = "Andy Testing :
p4ruby"

  p4.input( p4.format_changelist(change) )
  p4.run_change( "-i" )

  changelist_num = p4.output.to_s.split(/s+/)[1]

  p4.run_add("-c # change.txt")
  p4.run_edit("-c # stuff.txt")

  # No Submit yet
  #p4.input( change )
  #p4.run_submit( "-i" )
rescue P4Exception => ex
  puts "Exception Caught: nn #"
ensure
  p4.disconnect
end
############################################

But I keep getting an error related to the p4 add
command...

_________________________________________
Exception Caught:

 [P4#run] Errors during command execution( "p4 add -c
87651 change.txt" )

    [Error]: Usage: add/edit/delete [-c changelist#] [ -f ]
[-t type] 
files...
Missing/wrong number of arguments.
_________________________________________

Which is very strange because if I copy that command
"p4 add -c 87651 
change.txt" and run from cmd line it works.

Am I missing something?

Regards,

/ak

Jeff A. Bowles schrieb:
> I think you have a horse/cart problem in front of you.
>
> Suggestion #1:
>     do the "run_add" and then, *afterwards*,
the "change -o / input /
> submit -i".
>     (This assumes that nothing else is opened for
anything, that
> you're in a controlled environment, etc.)
>
> Suggestion #2:
>     Do the "change -o" and combine with a
"change -i", which will 
> return a
>     change number in the output. Now, do the add
operations for that 
> change
>     number and submit -c <thatchange>. (No need
to set the input for the
>     submit, in that case - but you wanna set it before
calling change 
> -i.)
>
> Followup thought: it's an outstanding tool. Document
the heck out of your
> work so that your colleagues are helping craft the
scripts.
>
>   -Jeff Bowles
>
> On 2/6/07, Andy Koch <andy.kochpc-doctor.com> wrote:
>>
>>
>
>


-- 
Andy Koch
_______________________________________________
p4ruby mailing list
p4rubyperforce.com

http://maillist.perforce.com/mailman/listinfo/p4ruby

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )