1.6028 Tue Sep 18 2007 Improve p4conf.rb to support AIX 5.3 - thanks to Robert Cowham 1.6012 Thu Aug 30 2007 Help P4Ruby build more cleanly on Windows with more recent Ruby's than my own. The host_os value on Windows can include the compiler version now i.e. mswin32_71 or mswin32_80, and that was causing p4conf.rb to get the -DOS_NT macro wrong (OS_NT_71), which caused builds to fail. No functional change. Thanks to Patrick Bennett. 1.5953 Mon Jun 18 2007 Bug fix: P4Ruby could crash attempting to parse a form when tagged mode is enabled, but form parsing was not. This only occurred when used against a 2005.2 or later server. 1.5944 Fri May 18 2007 Changes for building P4Ruby with 2007.2 API. This change also makes p4conf.rb check that the user is using an API version we can digest. In addition, I've widened some of the gcc/g++ pattern matches to catch some build problems recently observed on some Red Hat platforms. 1.5897 Tue Apr 24 2007 Remove ugly Darwin hack from P4Ruby distribution - no longer needed now that it works properly on OS X 10.4. 1.5896 Tue Apr 24 2007 Porting to OSX 10.4. Nothing we can do to fix 10.3, it was broken, but 10.4 has the fix P4Ruby needed, so this change makes it build cleanly on OSX 10.4. 1.5806 Wed Jan 03 2007 FreeBSD 6 porting changes. No functional change 1.5800 Tue Dec 19 2006 Bug fix: P4Ruby commands could segfault on garbage collection due to uninitialized values. This change initializes them. 1.5795 Fri Dec 08 2006 Back-ported change 1.5791 to Ruby 1.6. The prototype of rb_protect changed between 1.6 and 1.8 so it needs special handling. 1.5792 Fri Dec 08 2006 Update P4Ruby to support 2006.2 beta API. 1.5791 Fri Dec 08 2006 Add experimental support for passing a block to P4#run_resolve. The block is passed a P4::MergeData object encapsulating the context of each merge performed. The block should evaluate to a string indicating the desired result of the merge: 'ay', 'at', 'am', 's', etc. The P4::MergeData object contains information about the files involved in the merge and can invoke an external merge tool. This is still experimental at this stage so the interface may change as it evolves. 1.5768 Mon Nov 13 2006 Build system tweaks: sort the quoting out for Windows builds. No functional change 1.5339 Mon Feb 27 2006 Bug fix: A typo in change 5335 introduced a bug. This just corrects the typo. Thanks to Dean Wampler <dean@aspectprogramming.com> for spotting it. 1.5335 Thu Feb 23 2006 Bug fix: P4::Spec#[]= method didn't work properly when constructed without a fieldmap. In that case, the user might see this error: P4.rb:292:in `[]=': undefined method `[]' for nil:NilClass (NoMethodError) This change corrects the logic and the method now works properly. 1.5311 Tue Feb 07 2006 Add new P4#api= method to allow users to lock scripts to a particular API level. This helps when upgrading to new servers that extend support for tagged output to hitherto unsupported commands (2005.2 did a lot of that). See the C/C++ API Release Notes for the full details, but by way of example, to lock scripts to the 2005.1 interface use: p4.api = 57 1.5279 Thu Jan 19 2006 Bug fix: Change 5258 (changes for 2005.2 API), broke the creation of P4::Spec objects for parsed forms. This change reworks the logic for form parsing in a way that should be compatible with all server versions (from about 2000.1 onwards) 1.5258 Thu Jan 12 2006 Adapt P4Ruby for 2005.2 API changes. The 2005.2 API supplies forms ready-parsed in tagged mode and in general P4Ruby worked with it. The only issue was that P4Ruby wasn't caching the specdefs properly so conversions in the reverse direction were broken. This change ensures that we cache the specdef if we have it regardless of the API level. Squelched on a compiler warning too while I was there. 1.5222 Wed Nov 30 2005 Improve debug output in P4Ruby: p4.debug = 1 * Show commands being executed p4.debug = 2 * Show function calls p4.debug = 3 * Show data p4.debug = 4 * Show ruby garbage collection calls. Debug levels are cumulative as you'd expect. 1.5115 Wed Sep 14 2005 Yet another change to the build system. My guesswork on how it would work on AMD64 was wrong, and since I now have access to an Opteron box with Ruby on it, I've ported and tested it directly. Architecture detection works nicely now, and the const_char macro is correctly defined. Porting change only - no functional change 1.5114 Wed Sep 14 2005 Minor update to previous two changes. I originally opted to use CONFIG[ 'target_os' ] as it contained just what I was looking for, but it's not there in Ruby 1.6 so that was out. What is there in both 1.6 and 1.8 is 'host_os', but on Linux (and possibly others) it can contain a tuple value ('linux-gnu' instead of just 'linux'). This change splits the host_os field and takes only the first part so p4conf.rb should guess correctly in more cases (I think!). 1.5112 Tue Sep 13 2005 Port previous change to NT (and hopefully others). 1.5111 Tue Sep 13 2005 Make P4Ruby's build script support the const_char macro definition on those platforms that need it (Solaris >= 2.7 and Linux on AMD64 primarily). If we ever port P4Ruby to LinuxIA64 we'll need to add support for that too. With this change p4conf.rb tries harder to determine the O/S name and version, but it's unlikely to get it right all the time. So there's also a new '--apibuild' flag to p4conf.rb that allows the user to override the detected platform with an explicit configuration. Most people won't have to use it, but it'll be there for those that need it. I've also updated the README with the new build procedure, and added a FAQ document for the most common questions. 1.5105 Fri Sep 09 2005 Make P4Ruby include the text of any errors or warnings in exception messages. Previously the user had to call P4#errors() and/or P4#warnings() to display this information and if you didn't handle P4Exception specifically the message could look somewhat cryptic. This change hopefully makes it easier - particularly for newbies. Note that the text of warnings is not shown unless you're using exception level 2 (P4::RAISE_ALL). 1.4942 Thu May 05 2005 Add support for Unicode servers to P4Ruby. This change adds two new interfaces, P4#charset= and P4#charset? to set and get the charset respectively. 1.4940 Wed May 04 2005 Add (undoc'd) support for enabling/disabling tagged mode on a per-command basis. Also fixed a minor typo which was rendering an error message less useful than intended. 1.4870 Tue Mar 29 2005 Call ClientApi::SetProg() every time a command is run rather than only once. This makes the log entries correctly record the script name against every command that the script runs. 1.4841 Mon Mar 07 2005 Bug fix. Fix stupid uninitialized integer problem with MaxScanRows and MaxResults. 1.4840 Mon Mar 07 2005 Bug fix to P4Ruby's build script. On some Linux platforms, P4Ruby would still be linked with gcc rather than g++ causing problems for those using gcc 3.x. This change forces mkmf to generate a makefile where CC=g++ which does no harm to old environments but makes the link work on new environments. 1.4830 Wed Feb 09 2005 Add named constants for P4Ruby's exception levels. The valid levels are: P4::RAISE_NONE -- No exceptions P4::RAISE_ERRORS -- Exceptions on errors only P4::RAISE_ALL -- Exceptions on errors and warnings Also added P4#at_exception_level( level ) { ... } method to allow you to run a block of code at a different exception level and revert to the previous level when the block completes. Thanks to Johan Nilsson. Some doc tidying along with the docs for the features above. 1.4809 Fri Jan 21 2005 Add P4#maxresults= and P4#maxscanrows= methods to allow you to place explicit limits on the execution of individual commands. These limits remain in force for all subsequent commands until they are removed by setting them to zero. Port of new functionality from P4Perl. 1.4753 Tue Jan 11 2005 Add support for executing commands which prompt the user for input more than once during their execution. A perfect example is 'p4 password' which prompts the user three times. This works by allowing P4#input() to take an array argument. Each time Perforce prompts the user (by calling ClientUserRuby::Prompt()), the array is shifted by one and the first value in the array is passed to Perforce. Thus, to change your password a three-element array is needed comprising of your old password, and the new password twice. To make this a little easier on the eye, this change also includes a thin wrapper called P4#run_password() which takes simply the old password and the new password and constructs a suitable input array. This change also includes docs for the above, and docs for P4#run_filelog() which were found to be missing. 1.4680 Fri Dec 10 2004 Make P4Ruby return new P4::Spec objects instead of plain old hashes when parse_forms mode is in use. A P4::Spec object is derived from Hash so should be backwards compatible with previous code. P4::Spec provides limited fieldname validation on forms and accessor methods for quick and easy access to the fields in the form. The accessor methods are all prefixed with '_' to avoid colliding with methods from the Hash parent class. This is a little ugly, but deriving from hash is a big win, so it's worth it. This change also fixes a minor bug found along the way. Spec parsing and formatting wouldn't work with labels, branches, depots and groups unless you'd previously run a P4::fetch_label( <label> ), P4::fetch_branch( <branch> ) etc. etc. This is because the spec parsing code internally runs one of these commands in order to grab the specdef from the server but it wasn't providing a spec name. i.e. it was using 'p4 client -o' and assuming that this would work for other types of spec too. It does, but not for all spec types. So, now the spec parsing code will use a bogus name for the spec types that require it. 1.4651 Fri Nov 19 2004 Add format_spec() method and format_* shortcuts to make it easy to convert a spec in a hash back to its string form without sending it to the server. 1.4636 Tue Nov 09 2004 Bug fix: P4Ruby was segfaulting on 'p4 diff2' due to the use of 'depotFile' and 'depotFile2' variable names. Normally a variable suffixed by a number occurs when there are multiple results for a command. i.e. 'p4 -Ztag filelog' on a file with multiple revisions and/or integrations. In these cases you'll see: rev0, rev1, rev2, rev3,... action0, action1, ... and in these cases P4Ruby puts all the 'rev*' elements into an array. But in the case of diff2, there's no 'depotFile0' so P4Ruby was trying to insert depotFile2 into an array that wasn't an array. With this change, if P4Ruby finds that a name has already been defined, and the value it holds is not an array then it will simply use the name it's been given - including the numerical suffix. 1.4593 Thu Oct 21 2004 Add support for 'p4 login' to P4Ruby per request from Robert Cowham. 1.4589 Wed Oct 20 2004 Update P4Ruby to support the new SetProg() method in the 2004.2 API. Whilst the new 'P4#prog=' method is always available, it's only functional if P4Ruby is built with a 2004.2 or later API. The build system got a bit of tidying up to support this change and the API version is now detected automatically if possible. I've also removed the --apilibdir and --apiincludedir flags as they complicate matters and I never use them and I don't believe anyone else does either. There are also some minor doc formatting tweaks to go along with the added documentation for prog=. 1.4587 Wed Oct 20 2004 Support for multi-threaded use of P4Ruby. Previously, whilst you could create a multithreaded application and use P4 objects in different threads, all P4#run() method calls were serialised so there was no gain. This was because Ruby's threading model is co-operative and P4Ruby wasn't co-operating. With this change, we now call rb_thread_schedule() so multithreading works as expected. There may still be some problems with termination if an exception is raised in another thread at an inopportune moment but so far it's handled all the tests I've thrown at it. 1.4261 Thu Apr 08 2004 Add support for parsing arbitrary specs from strings in Ruby space. Useful with spec depots. You might obtain the spec by running a "p4 print -q" against a file in a spec depot, but want to parse it into a Ruby hash. i.e. p4 = P4.new p4.parse_forms # Required! p4.connect buf = p4.run_print( "-q", "//specs/client/myclient" ) spec = p4.parse_client( buf ) # Or equivalently spec = p4.parse_spec( "client", buf ) 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 <dir> - Path to the Perforce API --apiver <string> - 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 <cmd> -o" and "p4 <cmd> -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 (<smug>as I told ruby-talk it would be</smug>) 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.
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#69 | 6028 | Tony Smith | Improve p4conf.rb to support AIX 5.3 - thanks to Robert Cowham | ||
#68 | 6012 | Tony Smith |
Help P4Ruby build more cleanly on Windows with more recent Ruby's than my own. The host_os value on Windows can include the compiler version now i.e. mswin32_71 or mswin32_80, and that was causing p4conf.rb to get the -DOS_NT macro wrong (OS_NT_71), which caused builds to fail. No functional change. Thanks to Patrick Bennett. |
||
#67 | 5953 | Tony Smith |
Bug fix: P4Ruby could crash attempting to parse a form when tagged mode is enabled, but form parsing was not. This only occurred when used against a 2005.2 or later server. |
||
#66 | 5944 | Tony Smith |
Changes for building P4Ruby with 2007.2 API. This change also makes p4conf.rb check that the user is using an API version we can digest. In addition, I've widened some of the gcc/g++ pattern matches to catch some build problems recently observed on some Red Hat platforms. |
||
#65 | 5897 | Tony Smith |
Remove ugly Darwin hack from P4Ruby distribution - no longer needed now that it works properly on OS X 10.4. |
||
#64 | 5896 | Tony Smith |
Porting to OSX 10.4. Nothing we can do to fix 10.3, it was broken, but 10.4 has the fix P4Ruby needed, so this change makes it build cleanly on OSX 10.4. |
||
#63 | 5806 | Tony Smith |
FreeBSD 6 porting changes. No functional change |
||
#62 | 5800 | Tony Smith |
Bug fix: P4Ruby commands could segfault on garbage collection due to uninitialized values. This change initializes them. |
||
#61 | 5795 | Tony Smith | Fix a typo in the previous change (it's just not my day) | ||
#60 | 5794 | Tony Smith | Update P4Ruby's build to 1.5794 - to include change 5793 | ||
#59 | 5792 | Tony Smith | Update P4Ruby to support 2006.2 beta API. | ||
#58 | 5791 | Tony Smith |
Add experimental support for passing a block to P4#run_resolve. The block is passed a P4::MergeData object encapsulating the context of each merge performed. The block should evaluate to a string indicating the desired result of the merge: 'ay', 'at', 'am', 's', etc. The P4::MergeData object contains information about the files involved in the merge and can invoke an external merge tool. This is still experimental at this stage so the interface may change as it evolves. |
||
#57 | 5768 | Tony Smith |
Build system tweaks: sort the quoting out for Windows builds. No functional change |
||
#56 | 5693 | Tony Smith |
Update p4conf.rb to define const_char on all platforms if building against a 2006.1 or later API. Also squelched some compiler noise. No functional change |
||
#55 | 5339 | Tony Smith |
Bug fix: A typo in change 5335 introduced a bug. This just corrects the typo. Thanks to Dean Wampler <dean@aspectprogramming.com> for spotting it. |
||
#54 | 5335 | Tony Smith |
Bug fix: P4::Spec#[]= method didn't work properly when constructed without a fieldmap. In that case, the user might see this error: P4.rb:292:in `[]=': undefined method `[]' for nil:NilClass (NoMethodError) This change corrects the logic and the method now works properly. |
||
#53 | 5311 | Tony Smith |
Add new P4#api= method to allow users to lock scripts to a particular API level. This helps when upgrading to new servers that extend support for tagged output to hitherto unsupported commands (2005.2 did a lot of that). See the C/C++ API Release Notes for the full details, but by way of example, to lock scripts to the 2005.1 interface use: p4.api = 57 |
||
#52 | 5279 | Tony Smith |
Bug fix: Change 5258 (changes for 2005.2 API), broke the creation of P4::Spec objects for parsed forms. This change reworks the logic for form parsing in a way that should be compatible with all server versions (from about 2000.1 onwards) |
||
#51 | 5258 | Tony Smith |
Adapt P4Ruby for 2005.2 API changes. The 2005.2 API supplies forms ready-parsed in tagged mode and in general P4Ruby worked with it. The only issue was that P4Ruby wasn't caching the specdefs properly so conversions in the reverse direction were broken. This change ensures that we cache the specdef if we have it regardless of the API level. Squelched on a compiler warning too while I was there. |
||
#50 | 5222 | Tony Smith |
Improve debug output in P4Ruby: p4.debug = 1 * Show commands being executed p4.debug = 2 * Show function calls p4.debug = 3 * Show data p4.debug = 4 * Show ruby garbage collection calls. Debug levels are cumulative as you'd expect. |
||
#49 | 5115 | Tony Smith |
Yet another change to the build system. My guesswork on how it would work on AMD64 was wrong, and since I now have access to an Opteron box with Ruby on it, I've ported and tested it directly. Architecture detection works nicely now, and the const_char macro is correctly defined. Porting change only - no functional change |
||
#48 | 5114 | Tony Smith |
Minor update to previous two changes. I originally opted to use CONFIG[ 'target_os' ] as it contained just what I was looking for, but it's not there in Ruby 1.6 so that was out. What is there in both 1.6 and 1.8 is 'host_os', but on Linux (and possibly others) it can contain a tuple value ('linux-gnu' instead of just 'linux'). This change splits the host_os field and takes only the first part so p4conf.rb should guess correctly in more cases (I think!). |
||
#47 | 5112 | Tony Smith | Port previous change to NT (and hopefully others). | ||
#46 | 5111 | Tony Smith |
Make P4Ruby's build script support the const_char macro definition on those platforms that need it (Solaris >= 2.7 and Linux on AMD64 primarily). If we ever port P4Ruby to LinuxIA64 we'll need to add support for that too. With this change p4conf.rb tries harder to determine the O/S name and version, but it's unlikely to get it right all the time. So there's also a new '--apibuild' flag to p4conf.rb that allows the user to override the detected platform with an explicit configuration. Most people won't have to use it, but it'll be there for those that need it. I've also updated the README with the new build procedure, and added a FAQ document for the most common questions. |
||
#45 | 5105 | Tony Smith |
Make P4Ruby include the text of any errors or warnings in exception messages. Previously the user had to call P4#errors() and/or P4#warnings() to display this information and if you didn't handle P4Exception specifically the message could look somewhat cryptic. This change hopefully makes it easier - particularly for newbies. Note that the text of warnings is not shown unless you're using exception level 2 (P4::RAISE_ALL). |
||
#44 | 4942 | Tony Smith |
Add support for Unicode servers to P4Ruby. This change adds two new interfaces, P4#charset= and P4#charset? to set and get the charset respectively. |
||
#43 | 4940 | Tony Smith |
Add (undoc'd) support for enabling/disabling tagged mode on a per-command basis. Also fixed a minor typo which was rendering an error message less useful than intended. |
||
#42 | 4870 | Tony Smith |
Call ClientApi::SetProg() every time a command is run rather than only once. This makes the log entries correctly record the script name against every command that the script runs. |
||
#41 | 4841 | Tony Smith |
Bug fix. Fix stupid uninitialized integer problem with MaxScanRows and MaxResults. |
||
#40 | 4840 | Tony Smith |
Bug fix to P4Ruby's build script. On some Linux platforms, P4Ruby would still be linked with gcc rather than g++ causing problems for those using gcc 3.x. This change forces mkmf to generate a makefile where CC=g++ which does no harm to old environments but makes the link work on new environments. |
||
#39 | 4830 | Tony Smith |
Add named constants for P4Ruby's exception levels. The valid levels are: P4::RAISE_NONE -- No exceptions P4::RAISE_ERRORS -- Exceptions on errors only P4::RAISE_ALL -- Exceptions on errors and warnings Also added P4#at_exception_level( level ) { ... } method to allow you to run a block of code at a different exception level and revert to the previous level when the block completes. Thanks to Johan Nilsson. Some doc tidying along with the docs for the features above. |
||
#38 | 4809 | Tony Smith |
Add P4#maxresults= and P4#maxscanrows= methods to allow you to place explicit limits on the execution of individual commands. These limits remain in force for all subsequent commands until they are removed by setting them to zero. Port of new functionality from P4Perl. |
||
#37 | 4753 | Tony Smith |
Add support for executing commands which prompt the user for input more than once during their execution. A perfect example is 'p4 password' which prompts the user three times. This works by allowing P4#input() to take an array argument. Each time Perforce prompts the user (by calling ClientUserRuby::Prompt()), the array is shifted by one and the first value in the array is passed to Perforce. Thus, to change your password a three-element array is needed comprising of your old password, and the new password twice. To make this a little easier on the eye, this change also includes a thin wrapper called P4#run_password() which takes simply the old password and the new password and constructs a suitable input array. This change also includes docs for the above, and docs for P4#run_filelog() which were found to be missing. |
||
#36 | 4680 | Tony Smith |
Make P4Ruby return new P4::Spec objects instead of plain old hashes when parse_forms mode is in use. A P4::Spec object is derived from Hash so should be backwards compatible with previous code. P4::Spec provides limited fieldname validation on forms and accessor methods for quick and easy access to the fields in the form. The accessor methods are all prefixed with '_' to avoid colliding with methods from the Hash parent class. This is a little ugly, but deriving from hash is a big win, so it's worth it. This change also fixes a minor bug found along the way. Spec parsing and formatting wouldn't work with labels, branches, depots and groups unless you'd previously run a P4::fetch_label( <label> ), P4::fetch_branch( <branch> ) etc. etc. This is because the spec parsing code internally runs one of these commands in order to grab the specdef from the server but it wasn't providing a spec name. i.e. it was using 'p4 client -o' and assuming that this would work for other types of spec too. It does, but not for all spec types. So, now the spec parsing code will use a bogus name for the spec types that require it. |
||
#35 | 4651 | Tony Smith |
Add format_spec() method and format_* shortcuts to make it easy to convert a spec in a hash back to its string form without sending it to the server. |
||
#34 | 4636 | Tony Smith |
Bug fix: P4Ruby was segfaulting on 'p4 diff2' due to the use of 'depotFile' and 'depotFile2' variable names. Normally a variable suffixed by a number occurs when there are multiple results for a command. i.e. 'p4 -Ztag filelog' on a file with multiple revisions and/or integrations. In these cases you'll see: rev0, rev1, rev2, rev3,... action0, action1, ... and in these cases P4Ruby puts all the 'rev*' elements into an array. But in the case of diff2, there's no 'depotFile0' so P4Ruby was trying to insert depotFile2 into an array that wasn't an array. With this change, if P4Ruby finds that a name has already been defined, and the value it holds is not an array then it will simply use the name it's been given - including the numerical suffix. |
||
#33 | 4593 | Tony Smith |
Add support for 'p4 login' to P4Ruby per request from Robert Cowham. New installer to follow. |
||
#32 | 4589 | Tony Smith |
Update P4Ruby to support the new SetProg() method in the 2004.2 API. Whilst the new 'P4#prog=' method is always available, it's only functional if P4Ruby is built with a 2004.2 or later API. The build system got a bit of tidying up to support this change and the API version is now detected automatically if possible. I've also removed the --apilibdir and --apiincludedir flags as they complicate matters and I never use them and I don't believe anyone else does either. There are also some minor doc formatting tweaks to go along with the added documentation for prog=. |
||
#31 | 4587 | Tony Smith |
Support for multi-threaded use of P4Ruby. Previously, whilst you could create a multithreaded application and use P4 objects in different threads, all P4#run() method calls were serialised so there was no gain. This was because Ruby's threading model is co-operative and P4Ruby wasn't co-operating. With this change, we now call rb_thread_schedule() so multithreading works as expected. There may still be some problems with termination if an exception is raised in another thread at an inopportune moment but so far it's handled all the tests I've thrown at it. |
||
#30 | 4261 | Tony Smith |
Add support for parsing arbitrary specs from strings in Ruby space. Useful with spec depots. You might obtain the spec by running a "p4 print -q" against a file in a spec depot, but want to parse it into a Ruby hash. i.e. p4 = P4.new p4.parse_forms # Required! p4.connect buf = p4.run_print( "-q", "//specs/client/myclient" ) spec = p4.parse_client( buf ) # Or equivalently spec = p4.parse_spec( "client", buf ) |
||
#29 | 4253 | Tony Smith |
Fix bad changelist number in Changes file and update tarball. No functional change |
||
#28 | 4251 | Tony Smith |
Add support for delete_* methods to P4Ruby so you can now say: p4.delete_client( "clientname" ) instead of the old: p4.run_client( "-d", "clientname" ) Just some shorthand. Also some small changes to the setup script to allow for people who install the Perforce API in a system-wide location such as /usr/include/p4/ /usr/lib/p4/ Now the installer takes --apilibdir= and --apiincludedir= params as well as the old --apidir= |
||
#27 | 4190 | Tony Smith |
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. |
||
#26 | 4159 | Tony Smith |
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. |
||
#25 | 4136 | Tony Smith |
Porting change. Solaris 2.7 and above require an additional pre-processor definition to compile correctly |
||
#24 | 3888 | Tony Smith |
Bug fix. Off-by-one error in memory allocation. Where there were no arguments passed to P4#run(), an access violation could result. Thanks to Jeff Bowles for pointing this one out. |
||
#23 | 3578 | Tony Smith | Port P4Ruby to Ruby 1.8.0. | ||
#22 | 3541 | Tony Smith |
Porting change. Now builds under Cygwin with only a few filthy hacks. New undoc'd --gccver=2 flag allows Cygwin users to build P4Ruby using the gcc-2 package rather than the default compiler which is currently gcc 3.2.3. They have to do this because the Perforce API is not yet available in a gcc-3 version for Cygwin. |
||
#21 | 2924 | Tony Smith |
Porting changes. P4Ruby now builds with gcc 3.2 |
||
#20 | 2593 | Tony Smith |
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. |
||
#19 | 2409 | Tony Smith |
Port bug fix from P4Perl to P4Ruby. This fixes the problems with tagged mode parsing of fields whose names contain embedded numbers like P4DTI-* fields in jobs. |
||
#18 | 2408 | Tony Smith |
Build process tweak. Rename config.h to extconf.h so that it will be removed by "make distclean" as that's what mkmf expects it to be called. |
||
#17 | 2407 | Tony Smith |
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. |
||
#16 | 2388 | Tony Smith |
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 <dir> - Path to the Perforce API --apiver <string> - 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. |
||
#15 | 2210 | Tony Smith |
Bug fix to change 2085 which broke form parsing as the specdef variable is only available within the context of the command being executed and the SetInput() method was trying to use it outside of any command context. That and having a bad condition in the test for its existence was causing a segvio. |
||
#14 | 2086 | Tony Smith |
Add support for capturing the output of "p4 diff" to the Ruby API interface. |
||
#13 | 2085 | Tony Smith |
Get rid of specdef hack in the Ruby API. No need to store it in the hash, just grab it from the RPC buffer when needed. |
||
#12 | 1934 | Tony Smith |
Bug fix. On some lame Linux distro's which ship with beta gcc's p4.cpp would fail to compile because of a prototype mismatch in the arguments to the rb_define_method() function (and others). This change makes use of Ruby's handy RUBY_METHOD_FUNC(func) macro to make sure the cast is always correct |
||
#11 | 1869 | Tony Smith |
Build in workaround for 2000.[12] protocol bug with "p4 client -o" in tagged mode so script writers don't have to think about it |
||
#10 | 1750 | Tony Smith | Build environment tweaks. | ||
#9 | 1725 | Tony Smith | Update P4/Ruby with support for 2002.1 API | ||
#8 | 1464 | Tony Smith |
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. |
||
#7 | 1426 | Tony Smith |
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. |
||
#6 | 1393 | Tony Smith |
Bug fix: Filelogs for files without any integration records were raising a NameError exception as the "how" tag was not defined. This change just looks before it leaps. |
||
#5 | 1391 | Tony Smith |
Bug fix. Garbage collection can apparently run at any time (i.e. when you're in C space and not just when you're in Ruby space) and it was occasionally running in between adjacent "delete" and "new" statements when the result set was being reset. This change removes this race condition by making the result member of ClientUserRuby a permanently instantiated variable and extending the P4Result class so that it can reset itself in a way that GC respects. Now the only dynamically allocated C++ object is the top level P4ClientApi object. No functional change. |
||
#4 | 1327 | Tony Smith | Update version number as I call this a development release. | ||
#3 | 1325 | Tony Smith | P4/Ruby: Update Changes file with recent history. | ||
#2 | 1173 | Tony Smith |
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. |
||
#1 | 1169 | Tony Smith |
Add a Changes file containing the history of the extension. All extracted from the depot using a small Ruby script of course! |