/******************************************************************************* Copyright (c) 1997-2004, Perforce Software, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #define P4RUBY_VERSION "1.6028"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#70 | 6028 | Tony Smith | Improve p4conf.rb to support AIX 5.3 - thanks to Robert Cowham | ||
#69 | 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. |
||
#68 | 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. |
||
#67 | 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. |
||
#66 | 5897 | Tony Smith |
Remove ugly Darwin hack from P4Ruby distribution - no longer needed now that it works properly on OS X 10.4. |
||
#65 | 5806 | Tony Smith |
FreeBSD 6 porting changes. No functional change |
||
#64 | 5800 | Tony Smith |
Bug fix: P4Ruby commands could segfault on garbage collection due to uninitialized values. This change initializes them. |
||
#63 | 5795 | Tony Smith | Fix a typo in the previous change (it's just not my day) | ||
#62 | 5794 | Tony Smith | Update P4Ruby's build to 1.5794 - to include change 5793 | ||
#61 | 5792 | Tony Smith | Update P4Ruby to support 2006.2 beta API. | ||
#60 | 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. |
||
#59 | 5768 | Tony Smith |
Build system tweaks: sort the quoting out for Windows builds. No functional change |
||
#58 | 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 |
||
#57 | 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. |
||
#56 | 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. |
||
#55 | 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 |
||
#54 | 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) |
||
#53 | 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. |
||
#52 | 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. |
||
#51 | 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 |
||
#50 | 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!). |
||
#49 | 5112 | Tony Smith | Port previous change to NT (and hopefully others). | ||
#48 | 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. |
||
#47 | 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). |
||
#46 | 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. |
||
#45 | 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. |
||
#44 | 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. |
||
#43 | 4841 | Tony Smith |
Bug fix. Fix stupid uninitialized integer problem with MaxScanRows and MaxResults. |
||
#42 | 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. |
||
#41 | 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. |
||
#40 | 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. |
||
#39 | 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. |
||
#38 | 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. |
||
#37 | 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. |
||
#36 | 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. |
||
#35 | 4593 | Tony Smith |
Add support for 'p4 login' to P4Ruby per request from Robert Cowham. New installer to follow. |
||
#34 | 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=. |
||
#33 | 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. |
||
#32 | 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 ) |
||
#31 | 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= |
||
#30 | 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. |
||
#29 | 4157 | Tony Smith |
Copyright notice update. No functional change |
||
#28 | 4136 | Tony Smith |
Porting change. Solaris 2.7 and above require an additional pre-processor definition to compile correctly |
||
#27 | 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. |
||
#26 | 3578 | Tony Smith | Port P4Ruby to Ruby 1.8.0. | ||
#25 | 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. |
||
#24 | 2924 | Tony Smith |
Porting changes. P4Ruby now builds with gcc 3.2 |
||
#23 | 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. |
||
#22 | 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. |
||
#21 | 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. |
||
#20 | 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. |
||
#19 | 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. |
||
#18 | 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. |
||
#17 | 2086 | Tony Smith |
Add support for capturing the output of "p4 diff" to the Ruby API interface. |
||
#16 | 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. |
||
#15 | 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 |
||
#14 | 1750 | Tony Smith | Build environment tweaks. | ||
#13 | 1725 | Tony Smith | Update P4/Ruby with support for 2002.1 API | ||
#12 | 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. |
||
#11 | 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. |
||
#10 | 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. |
||
#9 | 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. |
||
#8 | 1327 | Tony Smith | Update version number as I call this a development release. | ||
#7 | 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. |
||
#6 | 1170 | Tony Smith | Update version number (oops) | ||
#5 | 1168 | Tony Smith |
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. |
||
#4 | 1166 | Tony Smith |
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. |
||
#3 | 1165 | Tony Smith |
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 |
||
#2 | 1164 | Tony Smith |
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! |
||
#1 | 1083 | Tony Smith |
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. |
||
//guest/tony_smith/perforce/API/Ruby/main/version.h | |||||
#1 | 1081 | Tony Smith |
Debugging and identification support. Adds two new methods: P4#identify() P4#debug( int ) |