Commit 9e0809a2 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.4.1

parent ede2b884
@echo off
rem figure out where we are
for %%I in ( %0\..\.. ) do set WORKDIR=%%~fI
set PY_MAJ=2
if not "%1" == "" set PY_MAJ=%1
set PY_MIN=3
set PY_MIN=4
if not "%2" == "" set PY_MIN=%2
set BUILD_TYPE=Release
if not "%3" == "" set BUILD_TYPE=%3
......@@ -16,7 +17,7 @@ rem otherwise the builder will have run it already
set COMPILER=msvc60
if "%PY_MIN%" == "4" set COMPILER=msvc71
if exist ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions.cmd call ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions.cmd
if exist ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions.cmd call ..\..\ReleaseEngineering\win32-%COMPILER%\software-versions.cmd off
set PYCXX=%WORKDIR%\Import\pycxx_%PYCXX_VER%
set OPENSSL=%TARGET%\openssl-%OPENSSL_VER%
......
......@@ -3,34 +3,27 @@
# TARGET is set by the ReleaseEngineering scripts
if [ -z "$TARGET" ]
then
# set the ReleaseEngineering symbols in development mode
case $(uname -s) in
Darwin)
. ../../ReleaseEngineering/MacOSX/software-version.inc
;;
*)
. ../../ReleaseEngineering/unix/software-version.inc\
;;
esac
# set the ReleaseEngineering symbols in development mode
case $(uname -s) in
Darwin)
. ../../ReleaseEngineering/MacOSX/software-version.inc
;;
*)
. ../../ReleaseEngineering/unix/software-version.inc\
;;
esac
fi
export WORKDIR=$(cd ..;pwd)
# default to 2.3 if no value in $1 and $2
export PY_MAJ=${1:-2}
export PY_MIN=${2:-3}
export PYCXX=${WORKDIR}/Import/pycxx_${PYCXXVER}
case $(uname -s) in
Darwin)
export PYTHON=/usr/bin/python${PY_MAJ}.${PY_MIN}
;;
FreeBSD)
export PYTHON=/usr/local/bin/python${PY_MAJ}.${PY_MIN}
;;
*)
export PYTHON=/usr/bin/python${PY_MAJ}.${PY_MIN}
;;
esac
# prove the python version selected is as expected
${PYTHON} -c "import sys;print 'Info: Python Version %r' % sys.version"
export PYTHON=$( which python${PY_MAJ}.${PY_MIN} )
if [ -e "${PYTHON}" ]
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"
fi
MAJOR=1
MINOR=3
MINOR=4
PATCH=1
BUILD=0
......@@ -7,6 +7,7 @@ all:
clean:
cd ..\Source && msdev /useenv pysvn.dsw /make "pysvn - Win32 $(BUILD_TYPE)" /clean
cd ..\Source && del sept
cd ..\Tests && $(MAKE) -f win32.mak clean
cd ..\kit\Win32 && $(MAKE) clean
......
......@@ -7,6 +7,7 @@ all:
clean:
cd ..\Source && devenv pysvn.sln /useenv /clean "$(BUILD_TYPE)" /project "pysvn"
cd ..\Source && del sept
cd ..\Tests && $(MAKE) -f win32.mak clean
cd ..\kit\Win32 && $(MAKE) clean
......
#!/usr/bin/python
import sys
import os
import xml.dom.minidom
def main( argv ):
svn_include = argv[1]
html_doc = argv[2]
cpp_header_filename = argv[3]
cpp_module_filename = argv[4]
print 'svn_include',svn_include
print 'html_doc',html_doc
print 'cpp_header_filename',cpp_header_filename
print 'cpp_module_filename',cpp_module_filename
debug.enable( '--debug' in argv )
try:
parser = XhtmlParser( file( html_doc ).read() )
except ParseException, e:
print repr(e)
print str(e)
return 1
parser.setSvnVersion( svn_include )
parser.htmlToCpp()
cpp_header = file( cpp_header_filename, 'w' )
cpp_module = file( cpp_module_filename, 'w' )
cpp_header.write( '// Created by %s\n\n' % argv[0] )
cpp_module.write( '// Created by %s\n' % argv[0] )
cpp_module.write( '#include "pysvn_docs.hpp"\n' )
parser.writeCppDocs( cpp_header, cpp_module )
cpp_header.close()
cpp_module.close()
return 0
class DebugTrace:
def __init__( self, enable=False ):
self._enable = enable
def __call__( self, *args ):
if self.isEnabled():
for s in args:
print s,
print
def enable( self, enable ):
self._enable = enable
def isEnabled( self ):
return self._enable
debug = DebugTrace()
class ParseException(Exception):
def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
def __repr__( self ):
return '<ParseException: %s>' % self.msg
def __str__( self ):
return self.msg
class XhtmlParser:
def __init__( self, definition_text ):
self.dom = None
self.all_docs = {}
self.svn_version = None
try:
self.dom = xml.dom.minidom.parseString( definition_text )
except xml.parsers.expat.ExpatError, details:
raise ParseException( 'Ln:%d Col:%d %s' % (details.lineno, details.offset, details.args[0]) )
def htmlToCpp( self ):
all_anchors = self.dom.getElementsByTagName("a")
all_named_nodes = [(node.parentNode, node.getAttribute( 'name' ))
for node in all_anchors
if node.hasAttribute( 'name' )]
for node, name in all_named_nodes:
self.docsFromNode( node, name )
copyright = ''' Copyright (c) 2003-2006 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
=============================================================
This product includes software developed by
CollabNet (http://www.Collab.Net/).
'''
docs = Documentation( 'copyright' )
docs.addText( copyright )
self.all_docs[ docs.getName() ] = docs
def writeCppDocs( self, cpp_header, cpp_module ):
all_names = self.all_docs.keys()
all_names.sort()
for name in all_names:
docs = self.all_docs[ name ]
cpp_header.write( 'extern const char %s_doc[];\n' % name )
cpp_module.write( '\nconst char %s_doc[] =\n' % name )
for line in docs.getBody().split('\n' ):
cpp_module.write( ' "%s\\n"\n' % line )
cpp_module.write( ';\n' )
def docsFromNode( self, node, name ):
docs = Documentation( name )
while True:
node = node.nextSibling
if node is None:
break
if node.nodeName in ['h1','h2','h3','h4']:
break
self.__extractText( None, docs, node )
self.all_docs[ name ] = docs
def __extractText( self, parent, docs, node ):
debug( '__extractText( node=',repr(node), ')' )
if node.nodeName == 'p':
docs.addText( '\n' )
if node.nodeName == 'li':
docs.addText( '* ' )
for child in node.childNodes:
debug('__extractText child nodeName=%s' % child.nodeName)
if child.nodeType == xml.dom.minidom.Node.TEXT_NODE:
debug( '__extractText TEXT_NODE: %r %r' % (node, child.data) )
if node.nodeName in ['p','li','span']:
docs.addText( child.data.strip() )
elif node.nodeName in ['a']:
docs.addText( '%s ' % child.data.strip() )
elif node.nodeName in ['pre']:
docs.addText( child.data )
elif child.nodeType == xml.dom.minidom.Node.DOCUMENT_TYPE_NODE:
#debug( '__extractText DOCUMENT_TYPE_NODE' )
pass
elif child.nodeType == xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE:
#debug( '__extractText PROCESSING_INSTRUCTION_NODE' )
pass
elif child.nodeType == xml.dom.minidom.Node.COMMENT_NODE:
#debug( '__extractText COMMENT_NODE' )
pass
elif child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE:
debug( '__extractText ELEMENT_NODE %r' % child.nodeName )
include_children = True
# check for conditional span and div sections
if child.nodeName in ['span','div']:
version_class = child.getAttribute( 'class' )
if version_class.startswith( 'svn_' ):
encoded_version = int( version_class[len('svn_'):] )
if debug.isEnabled():
docs.addText( '[if %d]' % encoded_version )
if encoded_version > self.svn_version:
debug( 'Skipping %r > %r' % (encoded_version, self.svn_version) )
include_children = False
else:
debug( 'Including %r <= %r' % (encoded_version, self.svn_version) )
if include_children:
self.__extractText( node, docs, child )
if node.nodeName == 'p':
docs.addText( '\n' )
if node.nodeName == 'li':
docs.addText( '\n' )
debug('__extractText done')
return
def setSvnVersion( self, svn_include ):
all_svn_version_lines = file( os.path.join( svn_include, 'svn_version.h' ) ).readlines()
major = None
minor = None
patch = None
for line in all_svn_version_lines:
words = line.strip().split()
if len(words) > 2 and words[0] == '#define':
if words[1] == 'SVN_VER_MAJOR':
major = int(words[2])
elif words[1] == 'SVN_VER_MINOR':
minor = int(words[2])
elif words[1] == 'SVN_VER_PATCH':
patch = int(words[2])
self.svn_version = ((major * 1000) + minor) * 1000 + patch
# force to the version to test with
#self.svn_version = 1001000
print 'Info: Building against SVN %d.%d.%d code %d' % (major, minor, patch, self.svn_version)
class Documentation:
def __init__( self, name ):
self.name = name
self.body = []
def addText( self, text ):
self.body.append( text )
def getName( self ):
return self.name
def getBody( self ):
body = ''.join( self.body ).strip()
body = body.replace( '\\', '\\\\' )
body = body.replace( '"', '\\"' )
return body
if __name__ == "__main__":
sys.exit( main( sys.argv ) )
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>pysvn - Python interface to Subversion</title>
<link rev="made" href="mailto:barry@barrys-emacs.org">
<link rev="made" href="mailto:barry@barrys-emacs.org" />
<style>
H1, H2, H3, H4 {color: #000099; background-color: lightskyblue}
h1, h2, h3, h4 {color: #000099; background-color: lightskyblue}
pre {color: #0000cc; background-color: #eeeeee; position: relative; left: 40px; margin-right: 80px;
border-style: solid; border-color: black; border-width: thin}
</style>
......@@ -16,23 +17,27 @@ pre {color: #0000cc; background-color: #eeeeee; position: relative; left: 40px;
<h2>Documentation</h2>
<p>The <a href="pysvn_prog_guide.html">pysvn Programmer's Guide</a> is the best place to start learning about pysvn.
It covers the use of pysvn in a tutorial style with lots of examples.</p>
It covers the use of pysvn in a tutorial style with lots of examples.
</p>
<p>Use the <a href="pysvn_prog_ref.html">pysvn Programmer's Reference</a> to look up the detailed descriptions
of all the classes, functions and variables of pysvn.</p>
of all the classes, functions and variables of pysvn.
</p>
<p>The <i>python-library</i>/site-packages/pysvn/Examples/Client/svn_cmd.py program is a complete replacement
for the svn command line written using pysvn. It is a good place to look for working examples of use of all
the pysvn module.</p>
the pysvn module.
</p>
<h2>pysvn Support</h2>
<p>Please use the mailing lists and the issues database on
<a href="http://pysvn.tigris.org">http://pysvn.tigris.org</a>
to report problems, suggest improvements or contribute changes.</p>
to report problems, suggest improvements or contribute changes.
</p>
<h2>pysvn License</h2>
<pre>
=================================================================
Copyright (C) 2003-2005 Barry A. Scott. All rights reserved.
Copyright (C) 2003-2006 Barry A. Scott. All rights reserved.
=================================================================
The Apache Software License, Version 1.1
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; utf-8">
<meta http-equiv="Content-Type" content="text/html; utf-8" />
<title>pysvn Programmer's Guide</title>
<link rev="made" href="mailto:barry@barrys-emacs.org">
<link rev="made" href="mailto:barry@barrys-emacs.org" />
<style>
H1, H2, H3, H4 {color: #000099; background-color: lightskyblue}
h1, h2, h3, h4 {color: #000099; background-color: lightskyblue}
pre {color: #0000cc; background-color: #eeeeee; position: relative; left: 40px; margin-right: 80px;
border-style: solid; border-color: black; border-width: thin}
code {color: #0000cc; background-color: #eeeeee;}
......@@ -13,43 +14,51 @@ code {color: #0000cc; background-color: #eeeeee;}
</head>
<body>
<h1>pysvn Programmer's Guide</h1>
<p>This guide gives an tutorial introduction to the pysvn module.</p>
<p>This guide gives an tutorial introduction to the pysvn module.
</p>
<p>Complete and detailed infomation on the pysvn API is documented in
<a href="pysvn_prog_ref.html">pysvn Programmer's Reference</a>.</p>
<a href="pysvn_prog_ref.html">pysvn Programmer's Reference</a>.
</p>
<p>The pysvn module is a python interface
to the Subversion version control system. This API exposes client
interfaces for managing a working copy, querying a repository, and
synchronizing the two.</p>
synchronizing the two.
</p>
<p>This API cannot create new
repositories; it can only interact with existing repositories. If
you need to create a repository, use the svnadmin command from
Subversion.</p>
Subversion.
</p>
<p>Using the API, you can check out a
working copy, add, edit, and remove working files, and check in,
compare, or discard your changes. Repository properties such as
keyword expansion, end of line characters, and ignore lists can also
be examined and manipulated.</p>
be examined and manipulated.
</p>
<h2>Subversion model</h2>
<p>Subversion operates on an
update-edit-commit model. A local, working copy is created. Changes
are made in the working copy, then committed to the central
repository (which may be local or remote).</p>
repository (which may be local or remote).
</p>
<p>This model allows and in fact expects
that multiple people will occasionally edit the same file at the same
time. In most cases, Subversion merges these differences without
intervention. In the rare case where the differences are ambiguous,
one of the commits fails, and the user or application will need to
examine and resolve the differences before attempting to commit
again.</p>
again.
</p>
<h2>Common Tasks</h2>
<p>This section gives examples of common
tasks using the pysvn interface. Operations applied to directories
are processed recursively. Add the argument <code>recurse=False</code>
to prevent this behavior; for example, you may want to add a
directory without adding its contents.</p>
directory without adding its contents.
</p>
<h3>Check out a working copy</h3>
<pre>import pysvn
......@@ -64,7 +73,8 @@ client.checkout('http://localhost/example/trunk',
</pre><p>
This example creates a working copy of the example project in the
directory examples/pysvn. This project is used in the remaining
examples.</p>
examples.
</p>
<h3>Add a file or directory to the repository</h3>
<pre>import pysvn
......@@ -82,7 +92,8 @@ client.checkin(['./examples/pysvn/foo.txt'], 'Adding a sample file')</pre>
in the working copy, then adds it to the repository. Note that the
<code>Client.import_()</code> command does the addition
and commit in a single step. Most applications, however, queue up
multiple changes and commit them together at a later time.</p>
multiple changes and commit them together at a later time.
</p>
<h3>Update the working copy</h3>
<pre>import pysvn
......@@ -91,7 +102,8 @@ client.update('./examples/pysvn')</pre>
<p>Updating gets any changes other users
have committed to the repository and applies them to your working
copy. Most applications do this on a regular basis to prevent
conflicts.</p>
conflicts.
</p>
<h3>Commit changes to the repository</h3>
<pre>import pysvn
......@@ -106,7 +118,8 @@ client.checkin(['./examples/pysvn'], 'Corrected spelling of python in foo.txt')<
Either all scheduled changes are successfully committed, or none are.
Most applications either commit all changes in the working copy, as
shown in this example, or pass a list of individual files and
directories that need to be committed as a unit.</p>
directories that need to be committed as a unit.
</p>
<h3>Discard changes in the working copy</h3>
<pre>import pysvn
......@@ -119,10 +132,12 @@ client = pysvn.Client()
client.revert('./examples/pysvn/foo.txt')</pre>
<p>This discards any uncommitted changes
in the working copy and restores a file or directory to its unedited
state.</p>
state.
</p>
<p>Files that are scheduled for addition
or removal remain unversioned or are restored to the working copy,
respectively.</p>
respectively.
</p>
<h3>Rename or move a file</h3>
<pre>import pysvn
......@@ -135,13 +150,16 @@ client.checkin(['./examples/pysvn/foo.txt', './examples/pysvn/foo2.txt'], 'Foo h
<p>
Moving or renaming a file removes the file under the old path or name
and adds it in the new location while preserving information about
previous versions.</p>
previous versions.
</p>
<p>In this example, we passed both
filenames to <code>Client.checkin()</code>. Passing the parent
directory would also have been effective.</p>
directory would also have been effective.
</p>
<p>The move and checkin can be done in a
single step on the server side; see the example in the Respository
Tasks section.</p>
Tasks section.
</p>
<h3>Remove a file or directory from the repository</h3>
<pre>import pysvn
......@@ -154,10 +172,12 @@ client.checkin(['./examples/pysvn/foo2.txt'], 'Removing sample file')</pre>
<p>Some people confuse removing a file or
directory from the repository with purging it completely. The file
still exists in previous versions and can be retrieved by checking
out or otherwise examining the contents of a previous revision.</p>
out or otherwise examining the contents of a previous revision.
</p>
<p>Files are typically removed from the
working copy immediately, while directories usually remain in the
working copy until the removal is committed.</p>
working copy until the removal is committed.
</p>
<h3>Determine pending changes</h3>
<pre>import pysvn
......@@ -192,7 +212,8 @@ print 'Url:',info.url
<p>This section shows examples of tasks
that manipulate or examine the repository. While the common tasks
schedule changes through a local working copy, these tasks affect the
repository directly.</p>
repository directly.
</p>
<h2>List the contents of a repository directory</h2>
<pre>import pysvn
......@@ -249,7 +270,8 @@ client.unlock( 'file.txt', force=True )
<h2>Test for a locked file</h2>
<p>Method 1:</p>
<p>Method 1:
</p>
<pre>all_entries = self.client.info2( path, recurse=False )
for path, info in all_entries:
if info['lock']:
......@@ -257,7 +279,8 @@ for path, info in all_entries:
print '%s is locked' % path
print info['lock']['comment']
</pre>
<p>Method 2:</p>
<p>Method 2:
</p>
<pre>all_status = self.client.status( path, recurse=False, update=True )
for status in all_status:
if status.entry is not None:
......@@ -265,5 +288,6 @@ for status in all_status:
print '%s is locked' % status.path
</pre>
<p>Copyright &copy; 2004-2006 Barry A. Scott. All rigths reserved.</p>
</body>
</html>
This diff is collapsed.
//
// ====================================================================
// Copyright (c) 2006 Barry A Scott. All rights reserved.
//
// This software is licensed as described in the file LICENSE.txt,
// which you should have received as part of this distribution.
//
// ====================================================================
//
all_versions = new Array( 1001000, 1002000, 1003000 )
current_version = 1003000;
change_style = "hilite";
function changeDisplay( version )
{
current_version = version;
style_string = ""
if( change_style == "hilite" )
{
span_style = "";
div_style = "";
}
else
{
span_style = "display: inline";
div_style = "display: block";
}
excluded_features = false;
for( var i=0; i<all_versions.length; i++)
{
if( version < all_versions[i] )
{
if( change_style == "hilite" )
{
span_style = "background-color: #ffc0c0;";
div_style = "background-color: #ffc0c0;";
}
else
{
span_style = "display: none";
div_style = "display: none";
}
}
style_string += "span.svn_" + all_versions[i].toString() + " { " + span_style + ";}\n";
style_string += "div.svn_" + all_versions[i].toString() + " { " + div_style + ";}\n";
}
document.getElementById("show_style").innerHTML = style_string;
major = Math.floor( version / 1000000 );
minor = Math.floor( version / 1000 ) % 1000;
patch = version % 1000;
version_shown = "" + major + "." + minor + "." + patch;
document.getElementById("version_shown").innerHTML = version_shown;
}
function changeVisual( type )
{
change_style = type;
if( change_style == "hilite" )
{
span_style = "background-color: #ffc0c0;";
}
else
{
span_style = "display: none";
}
document.getElementById("example_show_style").innerHTML = "span.svn_example { " + span_style + ";}\n";;
changeDisplay( current_version );
}
'''
====================================================================
Copyright (c) 2003 Barry A Scott. All rights reserved.
Copyright (c) 2003-2006 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
......
'''
====================================================================
Copyright (c) 2003-2005 Barry A Scott. All rights reserved.
Copyright (c) 2003-2006 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
......@@ -13,6 +13,7 @@ import sys
import os
import parse_datetime
import glob
import locale
class CommandError( Exception ):
def __init__( self, reason ):
......@@ -31,14 +32,40 @@ def main( args ):
if args[1:2] == ['--pause']:
del args[1]
pause = True
# if the locale is not setup SVN can report errors handling non ascii file names
initLocale()
svn_cmd = SvnCommand( progname )
rc = svn_cmd.dispatch( args[1:] )
if pause:
sys.stdin.readline()
return rc
def initLocale():
# init the locale
if sys.platform == 'win32':
locale.setlocale( locale.LC_ALL, '' )
else:
language_code, encoding = locale.getdefaultlocale()
if language_code is None:
language_code = 'en_GB'
if encoding is None:
encoding = 'UTF-8'
if encoding.lower() == 'utf':
encoding = 'UTF-8'
try:
# setlocale fails when params it does not understand are passed
locale.setlocale( locale.LC_ALL, '%s.%s' % (language_code, encoding) )
except locale.Error:
# force a locale that will work
locale.setlocale( locale.LC_ALL, 'en_GB.UTF-8' )
def fmtDateTime( t ):
return time.strftime( '%d-%b-%Y %X', time.localtime( t ) )