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

Re: Commercial Users of Subversion: LET ME KNOW

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2004-07-25 04:25:10 CEST

Ron Bieber <ron@bieberlabs.com> writes:

> > Ah, I think I must have missed this suggestion in the past. I can
> > certainly see the utility of such a feature. Do you envision this
> > being something more than you can already do with shell tools? Want
> > me to write you a Python-bindings-using script to do this for you?
> > :-)
> >
> This would be really helpful, if nothing else to give me an idea as to
> how to do these kinds of things myself. I'd love to be able to
> contribute tools we write around Subversion at some point that prove
> useful to us managing our build, but I'm not an SVN API god yet ... ;>)

Ask and ye shall receive... you have *GOT* to love Python language
bindings, man. Net coding an smoke-testing time was about 15

This little script will search your working copy for a given property.
Searching revisions for revision props is almost as trivial -- you
just use client.svn_client_revprop_list(), and cycle through the range
of revisions you want to search (at a cost of some network turnarounds
per revision, of course).


import sys
import string
import os.path
from svn import core, client

def find_props(pool, prop_name, wc_path):
    revision = core.svn_opt_revision_t()
    revision.kind = core.svn_opt_revision_working

    ctx = client.svn_client_ctx_t()
    providers = []
    ctx.auth_baton = core.svn_auth_open(providers, pool)
    ctx.config = core.svn_config_get_config(None, pool)
    props = client.svn_client_proplist(wc_path, revision, 1, ctx, pool)
    for prop in props:
        if prop[1].has_key(prop_name):
            print prop[0]

if __name__ == "__main__":
    argc = len(sys.argv)
    if argc < 2 or argc > 3:
        print "Usage: %s PROPNAME [WC-PATH]" % (sys.argv[0])
        print "List the set of paths in working copy WC-PATH ('.' by default)"
        print "which contain the property name PROPNAME."
    prop_name = sys.argv[1]
    wc_path = ''
    if argc == 3:
        wc_path = sys.argv[2]
        if wc_path[-1] == '/' or wc_path[-1] == '\\':
            wc_path = wc_path[:-1]
    core.run_app(find_props, prop_name, wc_path)

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Jul 25 04:26:42 2004

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.