1.4251 Fri Apr 02 2004
Add delete_* methods for easy deletion of specs. i.e. you can now
use:
p4.delete_client( "clientname" )
instead of:
p4.run_client( "-d", "clientname" )
Just shorthand, but convenient shorthand.
Also change setup script to support --apilibdir= and --apiincludedir=
parameters as well as apidir= to cope better with the case where people
put the header files in /usr/include/p4/ and the libraries in
/usr/lib/p4/.
1.4190 Tue Feb 10 2004
Port P4Ruby to MacOSX. This is a "sausages" build - you might like
the results but you won't like the way it's done.
In this case, it's so ugly that I'm ashamed to submit this change. It
works, but MacOSX will remain an unsupported platform for P4Ruby as
long as this hack is necessary.
The basic problem is that the Signaler class in the Perforce API calls
signal() on initialisation to install itself as the default handler for
SIGINT signals. In a standalone executable that's fine on OSX, but ruby
uses Apple's dyld interface to load the module into the process address
space dynamically. When signal() is called at module load time, Apple's
dyld implementation goes into an infaloop.
This horrible piece of code provides a replacement (broken)
implementation of the Signaler class that does not initialise itself
in this way thereby avoiding the problem. The fact that this is broken
should not cause any problems for P4Ruby users, but would not be
advisable to use it elsewhere.
I refuse to integrate this into the build process for P4Ruby, so people
who want this port will have to follow the instructions in README.DARWIN
and do it themselves.
I have made a few minor porting changes to help with compiler selection
on DARWIN though.
1.4159 Thu Jan 29 2004
Bug fix. P4#save_* methods previously only accepted one argument,
now, you can pass extras. This allows you to run commands like:
p4.save_client( spec, "-f" ) # i.e. "p4 client -i -f"
Note that you must still pass the spec as the first argument, and
the flags must follow.
1.4136 Thu Jan 22 2004
Porting change. Support for Solaris 2.7 and above - required an
extra preprocessor definition.
1.3888 Mon Nov 10 2003
Bug fix. An access/segmentation violation could result when no
arguments were passed to P4#run().
1.3578 Fri Aug 15 2003
Porting change: Now compiles with Ruby 1.8.0
1.3541 Tue Aug 05 2003
Porting change: Now compiles under Cygwin with 2002.2 Perforce API
and gcc-2 package. You can't use gcc3 to compile P4Ruby until the
Perforce API built with gcc3 is available so in the meantime, Cygwin
users should add --gccver=2 to their p4conf.rb command line.
1.2924 Fri Mar 14 2003
Porting change: P4Ruby now compiles with gcc 3.x series which requires
C++ programs to be linked with g++ and not gcc. Ruby's mkmf doesn't
handle this so we have to do it for ourselves. No functional change
1.2593 Tue Jan 14 2003
Bug fix. Form parsing failed when attempting to parse forms containing
invalid select field values. Specifically a jobspec that initialised
select fields to invalid values meant that you could not create a
new job easily using P4Ruby. This fix ensures that the client makes
no attempt to validate the form data sent by the server. It's the
server's job to do the validation.
1.2409 Wed Nov 27 2002
Port bug fix from P4Perl into P4Ruby. Form fields whose names
contained embedded numbers ( e.g. P4DTI-* fields in jobs) were
not being properly handled by the tagged mode code.
1.2408 Wed Nov 27 2002
Build process tweak. Rename config.h (created by p4conf.rb) to
extconf.h so that "make distclean" will remove it.
1.2407 Wed Nov 27 2002
Bug fix (kind of). The reuse of the variable names otherLock and
otherOpen in the output of "p4 fstat" was causing P4Ruby to trash
the first value of the variable in favour of the second. So for
otherOpen you'd get the number of other people who have the file
open, but not their names or clients. This change introduces a
slightly unpleasant fix which renames the second, unindexed
occurrence of the variable (i.e. otherOpen not otherOpen1) by
simply appending an "s". So otherOpen becomes otherOpens and
otherLock becomes otherLocks.
In the case of otherOpen(s) this makes sense because the hash
member otherOpen points to an array of user/client combo's for
people who have the file open whilst otherOpens is the number of
other people who have the file open (i.e h[ "otherOpen" ].length ).
In the case of otherLock it makes slightly less sense since
otherLock is normally a flag but now it's a (one-element)
array containing the name & client of the locking user. otherLocks
is now the flag and contains only an empty string as its value.
In future it may make more sense to simply drop otherLocks and
otherOpens as the array elements give you all the info you need.
1.2388 Mon Nov 25 2002
Rework p4conf.rb script to improve the build process. There are now
two mandatory parms and if you omit them you will be prompted for
their values.
--apidir
- Path to the Perforce API
--apiver - API version string (e.g. 2002.2)
I've also renamed the .so file from "P4api.so" to just P4.so
and I've improved the self identification code to include the
build flags and the API version to help with diagnosis.
1.2210 Fri Oct 04 2002
- Bug fix. Fix fault introduced in 1.2085 that broke form parsing.
1.2086 Mon Sep 09 2002
- Add support for capturing the output of "p4 diff".
1.2085 Fri Sep 06 2002
- Get rid of specdef from parsed form hashes. No need to store it
as it's available from the RPC buffer when we need it. The fewer
turds there are in the hashes the better.
1.1934 Mon Jul 08 2002
- Change arguments to rb_define_method calls to use the
RUBY_METHOD_FUNC(func) macro to make sure that the cast is always
correct. Helps compilation on Linux distro's that ship with gcc 2.96
series.
1.1869 Thu May 30 2002
- Add a workaround to an obscure protocol bug in 2000.[12] in which a
"p4 client -o" in tagged mode caused all subsequent commands to
fail badly. Now the client interface will be automatically restarted
after a "p4 client -o" in tagged mode against a 2000.1 or 2000.2
server. For all other servers there's no change.
1.1750 Thu May 2 2002
- Build environment tweaks. Renaming all the .cc files to .cpp helps
Ruby's mkmf do the right thing. Also correct definition of OS specific
macro for Perforce header files. Was getting -DOS_MSWIN when it should
be -DOS_NT.
0.1725 Mon Apr 29
- Add support for 2002.1 API.
1464 Fri Feb 15
- Add support for binary output - mainly for "p4 print binary_file".
Binary output is returned in a Ruby string. Note that due to
the fragmentation of large messages by the Perforce server,
P4#run( "print", "-q", "binfile" ) can return an array of more than
one element - each element comprising a chunk of the same file.
If you're only printing one file, then you can simply use:
p4.run_print( "-q", binfile ).join( "" )
If you're printing more than one file, you'll have to iterate
over the result array to find the file markers ( using "-q" is
a bad plan in this case ). Each file marker will be in a separate
element of the array though.
1426 Thu Feb 07
- Cleaned up the debug output a little. Introduced some debug levels
so you can decide (roughly) what output you want to see. Level 1
shows command execution, connect and disconnect. Level 2 includes
Level 1 and also shows the RPC callbacks as they happen. Level 3
includes 1 and 2 and also shows when Ruby garbage collection takes
place.
- Converted all the simple methods of the form P4#meth( arg ) to
aliases for P4#meth=. Added P4#debug= to complete the scheme. The
P4#meth( arg ) forms are now deprecated. i.e. you should use:
p4.user = "tony"
and not:
p4.user( "tony" )
It's just more Ruby-like.
1423 Thu Feb 07
- Refine the argument handling in P4#run. Now takes its args as a
Ruby array, not a C array and calles Array#flatten to resolve any
embedded arrays before all the args are converted to C strings and
passed to Perforce. No functional change, just tidying up.
1412 Wed Feb 6 2002
- Add manifest file, and publish the first tarball distribution
1411 Wed Feb 6 2002
- Document API version requirements
1393 - Thu Jan 31 2002
Bug fix. Running a "p4 filelog" on a file without any integration
history would cause a NameError exception to be raised due to the
non-existence of the "how" tag. Now fixed
1391 - Wed Jan 30 2002
Bug fix. GC could cause a crash if it ran between the destruction
of one object and the instantiation of its replacement.
1327 - Tue Jan 15 2002
Added client=, port=, host=, cwd=, passwd= and user= methods as
alternatives to their functional equivalents.
Added exception_level= instance method as an alternative to
exception_level() in the same vein as the above. Also added a new
exception_level? so you can test the current exception level if you
need to.
Added P4DepotFile, P4Revision and P4Integration classes to
provide an easy to use way of examining responses from the server.
Currently used only by P4#run_filelog (see below).
Added P4#run_filelog definition. Previously handled by method
missing, now when used in tagged mode, the complex filelog
response is returned as an array of P4DepotFile objects. Each
P4DepotFile object has an array of P4Revision objects and each
revision has an array of P4Integration objects. This structure
makes it much easier to analyse the filelog data in a script.
Fixed bug in P4#input which was returning true even if parse
errors had been encountered whilst parsing a form. This only
happened in exception level 0 as in all other levels, an exception
was raised.
Huge doc rework. The docs now look similar to the docs in
Programming Ruby, so if you've read that you're on home ground.
Added interface specifications to the docs to clear up a few
loose ends. Docs also go in a separate subdirectory now, 'coz
it's more than just one file.
1173 - Mon Dec 17 2001
Bug fix. Arguments to P4#fetch_* methods were not being passed
to P4#run. This change builds on change 1168 and ensures that
all args are always passed to the run method.
1168 - Tue Dec 11 13:43:16 2001
Bug fix. P4#run was not handling arrays passed as arguments -
which is what P4#method_missing does. It was just calling to_s
on all its args, and Array#to_s joins all the elements of the
array so if you passed more than one argument to a run_xxx method,
it was joining them together.
This change involves flattening an array of Ruby objects (some of
which could be arrays themselves) into a single C++ array before
executing the command.
1167 - Tue Dec 11 11:43:28 2001
First go at cleaning up the NT build for P4/Ruby. Now generates a
makefile that works with nmake.
1166 - Tue Dec 11 10:51:01 2001
Followup to previous change.
Simplify the interface to getting results/errors and warnings.
No need for the P4Result class anymore so that's gone (though
it's still there as a C++ class because it's useful) and so
is P4#result. Now you get your errors/warnings and results using
P4#errors, P4#warnings and P4#output all of which return arrays.
1165 - Tue Dec 11 10:01:35 2001
Minor reshuffle. Added the ability to disable exceptions
completely if you don't like them or to have them raised only
for errors (and not for warnings). Removed P4#warnings
interface and replaced it with P4#exception_level.
Some minor doc tweaks to go with the above change
1164 - Mon Dec 10 18:04:54 2001
Reworked exception handling (hopefully for the last time) in
P4/Ruby. Now exceptions are raised on completion of Perforce
commands if any errors or warnings were received as part of
executing the command.
This change also adds documentation, and indexes the Ruby
interface off my main page. Bad form to combine so many changes
in one changelist, but it's getting late and I want to get
them submitted!
1083 - Thu Nov 15 17:21:56 2001
Sweeping change to exception handling and garbage collection.
Exceptions are no longer raised for errors encoutered during
execution of Perforce commands as that was causing processing
to abort at the first error when several success messages may
have been close behind.
Now exceptions are raised for events which are fatal to the
execution of commands - such as failure to connect to the
Perforce server for example. For other errors, the user must
call "p4.errors? " to determine whether or not errors occured
and "p4.errors" to get an array of error messages. You can
of course then raise exceptions yourself if you want to:
begin
client = p4.fetch_client
if p4.errors?
raise P4Exception, "p4 client -o failed"
end
rescue P4Exception => m
puts( m )
p4.errors.each { |e| puts( e ) }
end
version.h got renamed because it conflicts with ruby's own
version.h file. We may need to look in there at some point
for ruby's version so I'm getting it out of the way now.
Added gc_hack.h to make sure that GC works properly on all
platforms now so Ruby shouldn't nuke any objects we're holding now.
1081 - Thu Nov 15 11:54:18 2001
Debugging and identification support. Adds two new methods:
P4#identify()
P4#debug( int )
1052 - Wed Nov 7 13:29:07 2001
Add P4#submit_spec method to allow easy submitting. Just supply
the changespec as either a String or as an edited hash returned
by a previous call to P4#run( "change", "-o" )
The Ruby API now has functional parity with the Perl API.
1051 - Wed Nov 7 13:20:08 2001
Port nested data handling code from Perl API to Ruby API.
1030 - Mon Nov 5 16:10:47 2001
P4.rb moved down one level to "lib" subdirectory. Clunky but it
makes mkmf do the right thing on "make install".
1029 - Mon Nov 5 14:52:36 2001
Fix. Was crashing if you attempted to run a command before
connecting. Now correctly raises an exception.
1028 - Mon Nov 5 13:23:09 2001
Earlier garbage collection fix doesn't work on NT. Reverting it for
now until I figure out how to do it properly.
1027 - Mon Nov 5 12:22:06 2001
Rework structure slightly. What was P4.so is now called
P4api.so and a new P4.rb module is added. P4api.so
contains the raw bridge to the Perforce API whilst P4.rb
contains extensions to it written purely in Ruby. Both
define and extend the P4 class and P4.rb requires P4api.so
so user code is unaffected.
The intent is to give me a place to write Ruby code rather
than having to work solely in C++.
The first method added using this new structure is
P4#method_missing, so now Perforce commands all appear as
methods on the P4 object (prefixed by "run_" ). e.g
p4 = P4.new
p4.run_info()
p4.run_users()
p4.run_protect( "-o" )
This change also adds support for shortcut methods for
form editing. fetch* and save* methods have been added as
shortcuts for "p4 -o" and "p4 -i" respectively.
For example:
p4 = P4.new
p4.parse_forms()
client_spec = p4.fetch_client()
client_spec[ "Owner" ] = tony
p4.save_client( client_spec )
Note that unlike the run* methods, these accessor methods
do not return an array, but return a single result - a string
normally, or a hash in parse_forms mode.
Ruby's arcane build/install system means that you have to
install the P4.rb file yourself. "make install" doesn't
take care of it.
1026 - Mon Nov 5 12:12:02 2001
Garbage collection update. Removed stale debug statement and
added what I think is correct support for garbage collection. Now
any Ruby vars supplied as input to a "p4 xxx -i" command will not
be swept while we're using them.
gc_mark() - Ruby's API function for the mark and sweep garbage
collector has a duff prototype in Ruby 1.6.4 and 1.6.5 so I've
had to add that here to keep GCC statisfied. Hopefully it can
be removed later on.
1025 - Mon Nov 5 12:08:04 2001
Licence file for Ruby/Perforce API
1019 - Fri Nov 2 12:40:56 2001
Some porting work to get it to compile on NT. mkmf stuff is still
rubbish on NT (as I told ruby-talk it would be) and
the generated makefile doesn't work at all. Had to figure it out
and build by hand - yuk.
1015 - Thu Nov 1 17:22:16 2001
First cut of Perforce bindings for the Ruby scripting language.
Similar functionality to the Perl API stuff, but "rubyfied".
Supports error reporting via exceptions, and presents tagged
output and parsed forms as hash structures, with nested arrays
where required.
Still early days so the docs are thin on the ground. See the
example.pl for a brief guide.
Built with Ruby 1.6.4 on Linux. May still be some memory
management issues as the Ruby Garbage Collection API has
changed a little since the docs I've got and I've just
dodged garbage collection for now.
Not indexing this just yet.