Christian Boos wrote:
> ...
> For Subversion, it looks a lot more complex to get it done right, as 
> we'd need to use the svnclient API and I'm not sure if all the bits and 
> pieces needed are available to the bindings.
>   

Just a quick update: I got curious and wanted to check the above.
It seems that the needed API is actually usable... that's great news, so 
let's do it ;)

This seems to work for file: and svn: URLs only, at least for me with 
Subversion 1.4.0 on windows, as I got crashes in _client.dll when trying 
out http: URLs...

-- Christian


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Trac Development" group.
To post to this group, send email to trac-dev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
#
# Test for client.blame Subversion API
#
# Author: Christian Boos <[EMAIL PROTECTED]>


# FIXME:
#
# use blame3, and for that, find a way to get a svn_diff_file_options_t
# instance
#

from svn import core, client

def rev(num):
    value = core.svn_opt_revision_value_t()
    value.number = num
    revision = core.svn_opt_revision_t()
    revision.kind = core.svn_opt_revision_number
    revision.value = value
    return revision

def head():
    revision = core.svn_opt_revision_t()
    revision.kind = core.svn_opt_revision_head
    return revision

def blame_receiver(line_no, revision, author, date, line, pool):
    print '%05d' % line_no, revision, line


def main():
    from optparse import OptionParser, OptionValueError
    parser = OptionParser(usage='usage: %prog [options] [REPOS_URL]')

    parser.add_option('-a', '--start', action='store', type='int',
                      dest='start', default=0,
                      help='the revision from where to start to blame')
    parser.add_option('-b', '--stop', action='store', type='int',
                      dest='stop',
                      help='the revision at which the blame should stop')

    options, args = parser.parse_args()

    if not args:
        parser.error('the REPOS_URL must be specified')

    repos_url = args[0]
    peg_rev = head()
    if '@' in repos_url:
        repos_url, peg_rev = args[0].split('@', 1)
        peg_rev = rev(int(peg_rev))

    start = rev(options.start)
    stop = options.stop and rev(options.stop) or peg_rev

    client_ctx = client.create_context()
    client.blame2(repos_url, peg_rev, start, stop, blame_receiver, client_ctx)

    
if __name__ == '__main__':
    main()

Reply via email to