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

Rép. : Re: How to get proplist for a file in a python script

From: Yves Bergeron <yves.bergeron_at_shq.gouv.qc.ca>
Date: 2005-10-11 15:52:59 CEST

Salut Stéphane,

Where does pysvn come from ?

>>> Stephane Bortzmeyer <bortzmeyer@nic.fr> 10/07/05 5:10 am >>>
On Thu, Oct 06, 2005 at 02:29:53PM -0400,
 Yves Bergeron <yves.bergeron@shq.gouv.qc.ca> wrote
 a message of 19 lines which said:

> Hi,

> I know there is a perl script doing this thing
> (contrib/hook-scripts/check-mime-type.pl) but I prefer python since
> I already done a lot of job in that language.

Here is how I do it:


import pysvn
import getopt
import sys
import string
import time

# Options by default
path = "." # Current directory
recurse = False
MAX = 60

    optlist, args = getopt.getopt (sys.argv[1:], "p:r",
                                   ["path=", "recurse!"])
    for option, value in optlist:
        if option == "--path" or option == "-p":
            path = value
        elif option == "--recurse" or option == "-r":
            recurse = True
            raise Exception ("Unknown option " + str(option))
except getopt.error, reason:
    raise Exception ("Usage: " + sys.argv[0] + ": " + str(reason))
if len(args) > 0:
    raise Exception ("Usage: " + sys.argv[0] + ": no arguments expected")
client = pysvn.Client()
files = client.ls(path, recurse=recurse)
for file in files:
    property = client.propget("svn:eol-style", "%s" % file['name'])
    if len(property) > 0:
        print file['name']

« Le présent courriel peut contenir des renseignements confidentiels et ne s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce courriel vous est parvenu par mégarde, veuillez le supprimer et nous en aviser aussitôt. Merci. »
Received on Tue Oct 11 15:55:35 2005

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

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