Commit 93ca7480 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.7.1

parent 4dd7ff2f
......@@ -25,6 +25,7 @@ if "%PY_MAJ%.%PY_MIN%" == "2.4" set COMPILER=msvc71
if "%PY_MAJ%.%PY_MIN%" == "2.5" set COMPILER=msvc71
if "%PY_MAJ%.%PY_MIN%" == "2.6" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "3.0" set COMPILER=msvc90
if "%PY_MAJ%.%PY_MIN%" == "3.1" set COMPILER=msvc90
if exist ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions-%SVN_VER_MAJ_MIN%.cmd (
pushd ..\..\ReleaseEngineering\win32-%COMPILER%
......
......@@ -5,7 +5,7 @@ if [ ! -z "$1" ]
then
PREF_VER=$1.$2
else
PREF_VER=
PREF_VER=2.7
fi
for PY_VER in ${PREF_VER} 2.7 2.6 2.5 2.4 2.3 2.2
......@@ -24,5 +24,5 @@ then
# prove the python version selected is as expected
${PYTHON} -c "import sys;print( 'Info: Python Version %r' % sys.version )"
else
echo "Error: Cannot find python${PY_MAJ}.${PY_MIN} on the PATH"
echo "Error: Cannot find python${PREF_VER} on the PATH"
fi
MAJOR=1
MINOR=7
PATCH=0
PATCH=1
BUILD=0
......@@ -59,10 +59,11 @@ install-1.6:
test: test-$(SVN_VER_MAJ_MIN)
test-1.4:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.5:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.6:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
......@@ -62,10 +62,10 @@ install-1.6:
test: test-$(SVN_VER_MAJ_MIN)
test-1.4:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.5:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.6:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
......@@ -177,6 +177,9 @@ the value 'client in use on another thread'.
<p><a href="#pysvn_client_exception_style">exception_style</a> allows you to control the style of exception raised by pysvn.
</p>
<p><a href="#pysvn_client_commit_info_style">commit_info_style</a> allows you to control the style of commit_info returned by pysvn.
</p>
<h4><a name="pysvn_client_exception_style"><a href="#pysvn_module">pysvn</a>.<a href="#pysvn_client">Client</a>.exception_style</a></h4>
<p>exception_style is used to control how pysvn raises <a href="#pysvn_clienterror">ClientError</a>
exceptions.
......@@ -189,6 +192,16 @@ for details of effect of the style on the exception raised.
</p>
<h4><a name="pysvn_client_commit_info_style"><a href="#pysvn_module">pysvn</a>.<a href="#pysvn_client">Client</a>.commit_info_style</a></h4>
<p>commit_info_style is used to control how pysvn return commit information.
</p>
<p>commit_info_style can be set to 0 or 1.
The default value, 0, makes pysvn return only the commit revision.
</p>
<p>When set to 1 pysvn returns a dictionary of commit information including date, author, revision and post_commit_err.
</p>
<h3><a name="pysvn_client_callbacks">Client callbacks</a></h3>
<p>pysvn uses callback functions to allow for realtime feedback
......@@ -1981,6 +1994,8 @@ revision. Set recurse to True to recursively update a directory's
children. <span class="svn_1002000">Set ignore_externals to True to ignore externals definitions.</span>
</p>
<div class="svn_1005000">
<p>path can be a single path string or a list of path strings.
</p>
<p>The depth can be used in place of recurse. depth is one of the pysvn.depth enums.
Use pysvn.depth.unknown to update all files and folders in the working copy honoring the current depths.
Use pysvn.depth.infinity to upadate all files and folders adding any that are missing ignoring the current depths.
......
......@@ -161,6 +161,7 @@ class SvnCommand:
def initClient( self, config_dir ):
self.client = pysvn.Client( config_dir )
self.client.exception_style = 1
self.client.commit_info_style = 1
self.client.callback_get_login = self.callback_getLogin
self.client.callback_get_log_message = self.callback_getLogMessage
self.client.callback_notify = self.callback_notify
......@@ -367,9 +368,13 @@ class SvnCommand:
if msg == '':
msg = self.getLogMessage()
rev = self.client.checkin( positional_args, msg, recurse=recurse )
commit_info = self.client.checkin( positional_args, msg, recurse=recurse )
rev = commit_info["revision"]
self.printNotifyMessages()
if commit_info['post_commit_err'] is not None:
print( commit_info['post_commit_err'] )
if rev is None:
print( 'Nothing to commit' )
elif rev.number > 0:
......@@ -377,6 +382,7 @@ class SvnCommand:
else:
print( 'Commit failed' )
cmd_commit = cmd_checkin
cmd_ci = cmd_checkin
......
......@@ -63,7 +63,8 @@ and <a href="http://www.jrsoftware.org/">INNO</a> 4.0.10 to create the installat
<h3>Building on unix and Mac OS X systems.</h3>
<ol>
<li>Install subversion</li>
<li>Install subversion.
<br />When installing from packages you will need to install the <i>devel</i> packages as well. For example on Fedora/Redhat subversion-devel, apr-devel, apr-util-devel and their dependancies.</li>
<li>Get the pysvn source code</li>
<li>For Python 2 builds: <code>tar xzf pycxx-5.5.0.tar.gz</code> into <em>extdir</em>/Import if not using a source kit</li>
<li>For Python 3 builds: <code>tar xzf pycxx-6.0.0.tar.gz</code> into <em>extdir</em>/Import if not using a source kit</li>
......
//-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// 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 THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS 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.
//
//-----------------------------------------------------------------------------
#ifndef __CXX_Extensions__h
#define __CXX_Extensions__h
#ifdef _MSC_VER
// disable warning C4786: symbol greater than 255 character,
// okay to ignore
#pragma warning(disable: 4786)
#endif
#include "CXX/WrapPython.h"
#include "CXX/Version.hxx"
#include "CXX/Config.hxx"
#include "CXX/Objects.hxx"
extern "C"
{
extern PyObject py_object_initializer;
}
#include <vector>
// std::map / hash_map selection and declarations ----------------------------
#if !defined( PYCXX_USING_HASH_MAP )
#include <map>
#else
#if defined( __GNUC__) && !defined( _STLPORT_VERSION )
#include <ext/hash_map>
#else
#include <hash_map>
#endif
#if defined( _STLPORT_VERSION )
#define __PYCXX_HASHMAP_NAMESPACE std
using namespace std;
#elif defined ( _MSC_VER ) && !defined( __INTEL_COMPILER ) && !defined( __ICC ) && !defined( __ICL ) && !defined( __ECC )
#define __PYCXX_HASHMAP_NAMESPACE stdext
using namespace stdext;
#elif defined( __INTEL_COMPILER ) || defined( __ICC ) || defined( __ICL ) || defined( __ECC )
#define __PYCXX_HASHMAP_NAMESPACE stdext
using namespace stdext;
#elif defined( __GNUC__ )
#define __PYCXX_HASHMAP_NAMESPACE __gnu_cxx
using namespace __gnu_cxx;
#else
#define __PYCXX_HASHMAP_NAMESPACE std
using namespace std;
#endif
class __pycxx_str_hash_func
{
public:
enum
{
// parameters for hash table
bucket_size = 4, // 0 < bucket_size
min_buckets = 8 // min_buckets = 2 ^^ N, 0 < N
};
// http://www.azillionmonkeys.com/qed/hash.html
size_t operator()( const std::string &str ) const
{
const unsigned char * data = reinterpret_cast<const unsigned char *>( str.c_str() );
int len = (int)str.length();
unsigned int hash = len;
unsigned int tmp;
int rem;
if (len <= 0 || data == NULL)
return 0;
rem = len & 3;
len >>= 2;
/* Main loop */
for (;len > 0; len--)
{
hash += (data[1] << 8) | data[0];
tmp = (((data[3] << 8) | data[2]) << 11) ^ hash;
hash = (hash << 16) ^ tmp;
data += 2*sizeof (unsigned short);
hash += hash >> 11;
}
/* Handle end cases */
switch (rem)
{
case 3: hash += (data[1] << 8) | data[0];
hash ^= hash << 16;
hash ^= data[sizeof (unsigned short)] << 18;
hash += hash >> 11;
break;
case 2: hash += (data[1] << 8) | data[0];
hash ^= hash << 11;
hash += hash >> 17;
break;
case 1: hash += *data;
hash ^= hash << 10;
hash += hash >> 1;
}
/* Force "avalanching" of final 127 bits */
hash ^= hash << 3;
hash += hash >> 5;
hash ^= hash << 4;
hash += hash >> 17;
hash ^= hash << 25;
hash += hash >> 6;
return hash;
}
bool operator()(const std::string &str_1, const std::string &str_2) const
{
// test if str_1 ordered before str_2
return str_1 < str_2;
}
};
#endif // PYCXX_USING_HASH_MAP
// ----------------------------------------------------------------------
namespace Py
{
class ExtensionModuleBase;
// Make an Exception Type for use in raising custom exceptions
class ExtensionExceptionType : public Object
{
public:
ExtensionExceptionType();
virtual ~ExtensionExceptionType();
// call init to create the type
void init( ExtensionModuleBase &module, const std::string& name, ExtensionExceptionType &parent );
void init( ExtensionModuleBase &module, const std::string& name );
};
class MethodTable
{
public:
MethodTable();
virtual ~MethodTable();
void add(const char* method_name, PyCFunction f, const char* doc="", int flag=1);
PyMethodDef* table();
protected:
std::vector<PyMethodDef> t; // accumulator of PyMethodDef's
PyMethodDef *mt; // Actual method table produced when full
static PyMethodDef method (const char* method_name, PyCFunction f, int flags = 1, const char* doc="");
private:
//
// prevent the compiler generating these unwanted functions
//
MethodTable(const MethodTable& m); //unimplemented
void operator=(const MethodTable& m); //unimplemented
}; // end class MethodTable
extern "C"
{
typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args );
typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict );
};
template<class T>
class MethodDefExt : public PyMethodDef
{
public:
typedef Object (T::*method_varargs_function_t)( const Tuple &args );
typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
MethodDefExt
(
const char *_name,
method_varargs_function_t _function,
method_varargs_call_handler_t _handler,
const char *_doc
)
{
ext_meth_def.ml_name = const_cast<char *>(_name);
ext_meth_def.ml_meth = _handler;
ext_meth_def.ml_flags = METH_VARARGS;
ext_meth_def.ml_doc = const_cast<char *>(_doc);
ext_varargs_function = _function;
ext_keyword_function = NULL;
}
MethodDefExt
(
const char *_name,
method_keyword_function_t _function,
method_keyword_call_handler_t _handler,
const char *_doc
)
{
ext_meth_def.ml_name = const_cast<char *>(_name);
ext_meth_def.ml_meth = method_varargs_call_handler_t( _handler );
ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS;
ext_meth_def.ml_doc = const_cast<char *>(_doc);
ext_varargs_function = NULL;
ext_keyword_function = _function;
}
~MethodDefExt()
{}
PyMethodDef ext_meth_def;
method_varargs_function_t ext_varargs_function;
method_keyword_function_t ext_keyword_function;
};
class ExtensionModuleBase
{
public:
ExtensionModuleBase( const char *name );
virtual ~ExtensionModuleBase();
Module module(void) const; // only valid after initialize() has been called
Dict moduleDictionary(void) const; // only valid after initialize() has been called
virtual Object invoke_method_keyword( const std::string &_name, const Tuple &_args, const Dict &_keywords ) = 0;
virtual Object invoke_method_varargs( const std::string &_name, const Tuple &_args ) = 0;
const std::string &name() const;
const std::string &fullName() const;
protected:
// Initialize the module
void initialize( const char *module_doc );
const std::string module_name;
const std::string full_module_name;
MethodTable method_table;
private:
//
// prevent the compiler generating these unwanted functions
//
ExtensionModuleBase( const ExtensionModuleBase & ); //unimplemented
void operator=( const ExtensionModuleBase & ); //unimplemented
};
extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" void do_not_dealloc( void * );
template<TEMPLATE_TYPENAME T>
class ExtensionModule : public ExtensionModuleBase
{
public:
ExtensionModule( const char *name )
: ExtensionModuleBase( name )
{}
virtual ~ExtensionModule()
{}
protected:
typedef Object (T::*method_varargs_function_t)( const Tuple &args );
typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws );
#if defined( PYCXX_USING_HASH_MAP )
typedef __PYCXX_HASHMAP_NAMESPACE::hash_map<std::string, MethodDefExt<T> *, __pycxx_str_hash_func> method_map_t;
#else
typedef std::map<std::string, MethodDefExt<T> *> method_map_t;
#endif
static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" )
{
method_map_t &mm = methods();
MethodDefExt<T> *method_definition = new MethodDefExt<T>
(
name,
function,
method_varargs_call_handler,
doc
);
mm[std::string( name )] = method_definition;
}
static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" )
{
method_map_t &mm = methods();
MethodDefExt<T> *method_definition = new MethodDefExt<T>
(
name,
function,
method_keyword_call_handler,
doc
);
mm[std::string( name )] = method_definition;
}
void initialize( const char *module_doc="" )
{
ExtensionModuleBase::initialize( module_doc );
Dict dict( moduleDictionary() );
//
// put each of the methods into the modules dictionary
// so that we get called back at the function in T.
//
method_map_t &mm = methods();
EXPLICIT_TYPENAME method_map_t::const_iterator i;
for( i=mm.begin(); i != mm.end(); ++i )
{
MethodDefExt<T> *method_definition = (*i).second;
static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc );
Tuple args( 2 );
args[0] = Object( self );
args[1] = String( (*i).first );
PyObject *func = PyCFunction_New
(
&method_definition->ext_meth_def,
new_reference_to( args )
);
dict[ (*i).first ] = Object( func );
}
}
protected: // Tom Malcolmson reports that derived classes need access to these
static method_map_t &methods(void)
{
static method_map_t *map_of_methods = NULL;
if( map_of_methods == NULL )
map_of_methods = new method_map_t;
return *map_of_methods;
}
// this invoke function must be called from within a try catch block
virtual Object invoke_method_keyword( const std::string &name, const Tuple &args, const Dict &keywords )
{
method_map_t &mm = methods();
MethodDefExt<T> *meth_def = mm[ name ];
if( meth_def == NULL )
{
std::string error_msg( "CXX - cannot invoke keyword method named " );
error_msg += name;
throw RuntimeError( error_msg );
}
// cast up to the derived class
T *self = static_cast<T *>(this);
return (self->*meth_def->ext_keyword_function)( args, keywords );
}
// this invoke function must be called from within a try catch block
virtual Object invoke_method_varargs( const std::string &name, const Tuple &args )
{
method_map_t &mm = methods();
MethodDefExt<T> *meth_def = mm[ name ];
if( meth_def == NULL )
{
std::string error_msg( "CXX - cannot invoke varargs method named " );
error_msg += name;
throw RuntimeError( error_msg );
}
// cast up to the derived class
T *self = static_cast<T *>(this);
return (self->*meth_def->ext_varargs_function)( args );
}
private:
//
// prevent the compiler generating these unwanted functions
//
ExtensionModule( const ExtensionModule<T> & ); //unimplemented
void operator=( const ExtensionModule<T> & ); //unimplemented
};
class PythonType
{
public:
// if you define one sequence method you must define
// all of them except the assigns
PythonType (size_t base_size, int itemsize, const char *default_name );
virtual ~PythonType ();
const char *getName () const;
const char *getDoc () const;
PyTypeObject* type_object () const;
PythonType & name (const char* nam);
PythonType & doc (const char* d);
PythonType & dealloc(void (*f)(PyObject*));
PythonType & supportPrint(void);
PythonType & supportGetattr(void);
PythonType & supportSetattr(void);
PythonType & supportGetattro(void);
PythonType & supportSetattro(void);
PythonType & supportCompare(void);
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 1)
PythonType & supportRichCompare(void);
#endif
PythonType & supportRepr(void);
PythonType & supportStr(void);
PythonType & supportHash(void);
PythonType & supportCall(void);
PythonType & supportIter(void);
PythonType & supportSequenceType(void);
PythonType & supportMappingType(void);
PythonType & supportNumberType(void);
PythonType & supportBufferType(void);
protected:
PyTypeObject *table;
PySequenceMethods *sequence_table;
PyMappingMethods *mapping_table;
PyNumberMethods *number_table;
PyBufferProcs *buffer_table;
void init_sequence();
void init_mapping();