[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Python 2.2 compatibility for svn_export_empty_files.py

From: Blair Zajac <blair_at_orcaware.com>
Date: 2005-08-18 07:35:03 CEST

David James wrote:
> I'd like to be sure that svn_export_empty_files.py is compatible with
> Python 2.2 before merging it to 1.2.x. So I've posted a patch.

Hi David,

Thank you. Committed in r15796.

> [[[
> Python 2.2 Compatibility for svn_export_empty_files.py.
>
> * contrib/client-side/svn_export_empty_files.py:
> (__main__): Use getopt instead of gnu_getopt for compatibility with
> versions of
> Python older than 2.4. Explicitly declare '--delete' as tuple for
> compatibility
> with Python 2.2.

I don't have Python 2.2 around, so is there something Python does special in 2.3
and greater to see that the tuple for '--delete' is really a tuple?

> By the way, the svn_export_empty_files.py script is really nice --
> it's the first script I've seen that properly uses the svn.client and
> svn.ra layers to access remote respositories using the Python
> bindings. Has anyone seen similar scripts?

Thanks! That script took a while to put together just because I couldn't find
any scripts that put everything together in one place. Lot's of Googling there
:) Now we have a script we can point people to on how to use the client bindings.

BTW, the check_url_for_export() in this script is the one that needs
svn.client.svn_client_info() that I previously mentioned. Because the script
syncs a directory, it needs to check if the given URL is a directory or a file.
  However, there's no guaranteed way to tell what the URL refers to without
checking it out, which the script doesn't want to do.

You can't use svn.client.svn_client_ls(), because if it's a file, you get the
info on the file, but if it's a directory, then you get the info on the
contents. If the number of entries you get back is != 1, then it's a directory,
but you could have a case of a directory containing a single file and that
single file has the same name as the directory, so the URL is a directory, but
you think it's a file. So the script does an ls() on the parent path and checks
the info in the directory listing, but if you're at the root of the repository,
then you can't ls() the parent, in which case the script assumes the URL is a
directory.

Anyway, that's a hint that having svn.client.svn_client_info() would be nice :)

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<blair@orcaware.com>
Subversion and Orca training and consulting
http://www.orcaware.com/svn/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 18 07:35:52 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.