/******************************************************************************* Copyright (c) 1997-2006, 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. *******************************************************************************/ class ClientApi; class PerlClientUser; class PerlClientApi { public: static SV * Identify(); PerlClientApi(); ~PerlClientApi(); SV * Connect(); SV * Disconnect(); SV * Dropped(); SV * Run( const char *cmd, int argc, char * const *argv ); void SetApiLevel( int level ); SV * SetCharset( const char *c ); void SetClient( const char *c ) { client->SetClient( c ); } void SetCwd( const char *c ) { client->SetCwd( c ); } void SetHost( const char *c ) { client->SetHost( c ); } void SetLanguage( const char *c ) { client->SetLanguage( c ); } void SetPassword( const char *c ) { client->SetPassword( c ); } void SetMaxResults( int v ) { maxResults = v; } void SetMaxScanRows( int v ) { maxScanRows = v; } void SetPort( const char *c ) { client->SetPort( c ); } void SetUser( const char *c ) { client->SetUser( c ); } void SetProg( const char *c ) { prog.Set( c ); } void SetInput( SV *i ); SV * GetCharset(); SV * GetClient(); SV * GetCwd(); SV * GetHost(); SV * GetLanguage(); SV * GetPassword(); SV * GetPort(); SV * GetServerLevel(); SV * GetUser(); // Base protocol ops void SetProtocol( const char *p, const char *v ); StrPtr * GetProtocol( const char *v ); // High-level protocol ops void Tagged(); void ParseForms(); int IsTagged(); int IsParseForms(); // // Handling command output // SV * MergeErrors( int merge = -1 ); SV * GetFirstOutput(); AV * GetOutput(); AV * GetWarnings(); AV * GetErrors(); I32 GetOutputCount(); I32 GetWarningCount(); I32 GetErrorCount(); // Spec parsing SV * ParseSpec( const char *type, const char *form ); SV * FormatSpec( const char *type, HV *hash ); // Debugging support void SetDebugLevel( int l ); int GetDebugLevel() { return debug; } int IsConnected() { return initCount; } // private: // Compatibility flags // enum { CPT_MERGED = 0x0001 }; // // Client mode settings // enum { PROTO_TAG = 0x01, PROTO_SPECSTRING = 0x02, MODE_PARSEFORMS = 0x03, PROTO_MASK = 0x0f }; StrPtr * FetchSpecDef( const char *type ); void RunCmd( const char *cmd, ClientUser *ui, int argc, char * const *argv ); private: ClientApi * client; PerlClientUser * ui; StrBufDict specDict; StrBuf prog; int server2; int mode; int initCount; int debug; int compatFlags; int maxResults; int maxScanRows; };
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 5708 | Tony Smith |
Add static P4::Identify() method to report the version of P4Perl, and the API used to build it. |
||
#10 | 5692 | Tony Smith |
Add support for $p4->ServerLevel() which returns the server's 'server2' protocol level. This is not the same as, but is closely aligned to, the server version and can be used to test for feature availability. If you need explicit Perforce version strings, run 'p4 info' in tagged mode and parse the 'serverVersion' string. New feature requested by Robert Cowham. |
||
#9 | 5313 | Tony Smith |
Add new SetApiLevel() 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->SetApiLevel( 57 ); |
||
#8 | 5035 | Tony Smith |
Bug fix: call ClientApi::SetProg() before every command instead of just once as this value is not retained by the Perforce API. |
||
#7 | 4864 | Tony Smith |
Bug fix: Introduce workaround for obscure 2000.1/2000.2 protocol bug that I really thought we'd seen the last of. Along the way, a total revamp of the debugging output - required to diagnose the problem. |
||
#6 | 4804 | Tony Smith |
Add support for P4::SetMaxResults() and P4::SetMaxScanRows() which specify the desired limits for an instance of the P4 class. Note that the limits remain in force until disabled by setting them to zero. |
||
#5 | 4676 | Tony Smith |
Enable P4Perl to work against a server in unicode mode. This change adds two new methods to the P4 class: SetCharset() and GetCharset() which have the expected behaviour. Thanks to Raymond Danks <raymond.danks@amd.com>. Also cleaned up the test harness a little. |
||
#4 | 4666 | Tony Smith |
New ParseSpec() and FormatSpec() methods allow you to convert specs between hash and string representations easily. Shortcut methods Parse* and Format* are also defined. (i.e. FormatClient() and ParseLabel() etc.) New methods IsTagged() and IsParseForms() tell you if your client is in tagged/form parsing mode respectively. If you care. P4::Tag() is deprecated in favour of P4::Tagged(). P4::Tag() exists for backwards compatibility |
||
#3 | 4608 | Tony Smith |
Bug fix: The SetInput() method was omitted in the big rewrite so quite a lot was broken in builds 3.4579 and later. This change fixes that omission, and adds support for 'p4 login' too (that was how I discovered that SetInput() was missing). |
||
#2 | 4585 | Tony Smith |
Make the new P4Perl work with older versions of the Perforce API (i.e those without ClientApi::SetProg() defined ). This also introduces automatic determination of the API version being used so we can selectively exclude functionality that isn't available. No functional change. |
||
#1 | 4579 | Tony Smith |
Rewrite P4Perl to be more like P4Ruby. This change does away with the old P4/P4::Client split and pulls all the functionality of P4::Client into P4. Hence P4::Client is now deprecated. There are a few gotcha's - see the Changes file, and documentation for the details, but in general it's backwards compatible. As part of this change, I'm also releasing the previous current versions of P4 and P4::Client as released versions - for posterity. P4 now gets a v3.x version number so the old versions will stand out clearly. Hopefully it's all working - works fine for me - but people should consider this a beta build, for now at least. |