You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan Heniser <ry...@moving-picture.com> on 2009/09/16 15:45:38 UTC

svn_python SWIG bindings & dump file format

Hello all,

I am unable to use the svn SWIG python bindings when using python 2.5.1 
and svn 1.6.5.

=============================================

[Wed 16-09-09 4:28:48pm] ryan-he@georgia:/jobs/rnd_dev > svn --version
svn, version 1.6.5 (r38866)
    compiled Sep 15 2009, 13:29:23

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet 
(http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using 
Neon.
   - handles 'http' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
   - with Cyrus SASL authentication
   - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
   - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using 
serf.
   - handles 'http' scheme
   - handles 'https' scheme

[Wed 16-09-09 4:29:02pm] ryan-he@georgia:/jobs/rnd_dev > python
Python 2.5.1 (r251, Sep  4 2007, 19:03:53)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from svn import fs, repos, core
 >>> assert (core.SVN_VER_MAJOR, core.SVN_VER_MINOR) >= (1, 6), 
"Subversion 1.6 or later required"
 >>> repository = repos.open('/mpc/devel/ryan-he/dev/svn/.svn')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File 
"/software/subversion/1.6.5/linux.centos4.x86_64/lib/svn-python/libsvn/repos.py", 
line 55, in svn_repos_open
     return apply(_repos.svn_repos_open, args)
svn.core.SubversionException: ("Expected repository format '3' or '5'; 
found format '9'", 165005)
 >>> print repos.__file__
/software/python/2.5.1/linux.centos4.x86_64/lib/python2.5/site-packages/svn/repos.pyc
 >>> print repos.DUMPFILE_FORMAT_VERSION
3
 >>> print _repos.__file__
/software/python/2.5.1/linux.centos4.x86_64/lib/python2.5/site-packages/libsvn/_repos.so
 >>> print _repos.SVN_REPOS_DUMPFILE_FORMAT_VERSION
3

=============================================


I took a look at 
http://svn.collab.net/repos/svn/trunk/subversion/include/svn_repos.h

There is a hard coded variable SVN_REPOS_DUMPFILE_FORMAT_VERSION at line 
2048 that is set to 3. But, I'm not about to kludge it by setting this 
to 9 without asking here first. I've blow several hours tracking this 
down. Would greatly appreciate some timely help here. Thanks in advance!

Ryan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395616

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: svn_python SWIG bindings & dump file format

Posted by Ryan Heniser <ry...@moving-picture.com>.
Stefan,

Thanks so much for the direction. I think that site just confused me. I was under the impression that the svn module would work with a network filesystem as well as the local filesystem. So, the svn module is to be used by server side or local scripts to query or modify the local filesystem.

What I want is the pysvn module to interface with the Subversion version control system. This API allows the client to programmatically interface with the repository for managing a working copy, querying a repository, and synchronizing the two. Wish I would have come across this distinction in the docs. 

Thanks,
Ryan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395887

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Re: svn_python SWIG bindings & dump file format

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Sep 16, 2009 at 02:44:14PM -0700, Ryan Heniser wrote:
> Stefan,
> 
> I am aware of the distinction. But, when I gave it the address as I would have expected the error message suggests otherwise.
> 
> >>> repository = repos.open('http://svn.mpc.local/repos/rnd/framework/muggins/trunk/muggins')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/software/subversion/1.6.5/linux.centos4.x86_64/lib/svn-python/libsvn/repos.py", line 55, in svn_repos_open
>     return apply(_repos.svn_repos_open, args)
> svn.core.SubversionException: ("Can't open file 'http://svn.mpc.local/repos/rnd/framework/muggins/trunk/muggins/format': No such file or directory", 2)

That's wrong as well. The "repos" API is all about accessing
a repository which is on a local filesystem.

Try this sequence of commands:

cd /tmp
mkdir dir
echo a > dir/a
svnadmin create repository
svn import -m import dir file:///tmp/repository
python
repository = repos.open('/tmp/repository')

> The only 'format' file I've come across in my limited svn experience has lived in the .svn folder. What am I doing wrong? I'm just trying to follow http://jtauber.com/python_subversion_binding/

That tutorial isn't very detailed, and assumes prior knowledge,
and you seem to be confusing even very basic Subversion terminology
(e.g. "working copy" vs. "repository"). I suggest that you read the
first two chapters of the svn book if you haven't read them yet:
http://svnbook.red-bean.com/nightly/en/

There is indeed a file called 'format' in the repository.
If you create an empty repository with "svnadmin create" you can
see it:

 $ svnadmin create repos                                
 $ ls repos
 README.txt   conf/        db/          format       hooks/       locks/
 $ 

> Thanks so much for the help! The docs on this stuff is sparse.

Yes, that is a problem.
You could try the C API docs, too, since the SWIG bindings pretty
much map to them: http://svn.collab.net/svn-doxygen/

I've never worked with the bindings myself though so I am not
entirely sure how useful the C API docs are for this purpose.

You can also find some useful information on how to get started
with understanding the Subversion APIs at
http://subversion.tigris.org/hacking.html#code-to-read

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395758

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: Re: svn_python SWIG bindings & dump file format

Posted by Ryan Heniser <ry...@moving-picture.com>.
Stefan,

I am aware of the distinction. But, when I gave it the address as I would have expected the error message suggests otherwise.

>>> repository = repos.open('http://svn.mpc.local/repos/rnd/framework/muggins/trunk/muggins')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/software/subversion/1.6.5/linux.centos4.x86_64/lib/svn-python/libsvn/repos.py", line 55, in svn_repos_open
    return apply(_repos.svn_repos_open, args)
svn.core.SubversionException: ("Can't open file 'http://svn.mpc.local/repos/rnd/framework/muggins/trunk/muggins/format': No such file or directory", 2)

The only 'format' file I've come across in my limited svn experience has lived in the .svn folder. What am I doing wrong? I'm just trying to follow http://jtauber.com/python_subversion_binding/

Thanks so much for the help! The docs on this stuff is sparse. But the bindings are so much appreciated :-)

Ryan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395747

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: svn_python SWIG bindings & dump file format

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Wed, 16 Sep 2009 at 16:58 +0100:
> On Wed, Sep 16, 2009 at 04:45:38PM +0100, Ryan Heniser wrote:
> > There is a hard coded variable SVN_REPOS_DUMPFILE_FORMAT_VERSION 

That constant is irrelevant since you are not working with dumpfiles.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395716

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: svn_python SWIG bindings & dump file format

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Sep 16, 2009 at 04:45:38PM +0100, Ryan Heniser wrote:
> Hello all,
> 
> I am unable to use the svn SWIG python bindings when using python 2.5.1 
> and svn 1.6.5.
> 

> [Wed 16-09-09 4:29:02pm] ryan-he@georgia:/jobs/rnd_dev > python
> Python 2.5.1 (r251, Sep  4 2007, 19:03:53)
> [GCC 4.1.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from svn import fs, repos, core
>  >>> assert (core.SVN_VER_MAJOR, core.SVN_VER_MINOR) >= (1, 6), 
> "Subversion 1.6 or later required"
>  >>> repository = repos.open('/mpc/devel/ryan-he/dev/svn/.svn')

This does not look right. You are trying to open a repository.
But you are passing a path to a working copy meta data directory.
Not quite the same thing.

Stefan

> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File 
> "/software/subversion/1.6.5/linux.centos4.x86_64/lib/svn-python/libsvn/repos.py", 
> line 55, in svn_repos_open
>      return apply(_repos.svn_repos_open, args)
> svn.core.SubversionException: ("Expected repository format '3' or '5'; 
> found format '9'", 165005)
>  >>> print repos.__file__
> /software/python/2.5.1/linux.centos4.x86_64/lib/python2.5/site-packages/svn/repos.pyc
>  >>> print repos.DUMPFILE_FORMAT_VERSION
> 3
>  >>> print _repos.__file__
> /software/python/2.5.1/linux.centos4.x86_64/lib/python2.5/site-packages/libsvn/_repos.so
>  >>> print _repos.SVN_REPOS_DUMPFILE_FORMAT_VERSION
> 3
> 
> =============================================
> 
> 
> I took a look at 
> http://svn.collab.net/repos/svn/trunk/subversion/include/svn_repos.h
> 
> There is a hard coded variable SVN_REPOS_DUMPFILE_FORMAT_VERSION at line 
> 2048 that is set to 3. But, I'm not about to kludge it by setting this 
> to 9 without asking here first. I've blow several hours tracking this 
> down. Would greatly appreciate some timely help here. Thanks in advance!
> 
> Ryan
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395616
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2395625

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].