Modify

Opened 8 years ago

Last modified 5 years ago

#808 assigned enhancement

Add Changesets to TracXmlRpc plugin

Reported by: iXce Owned by: olemis
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Here is a patch adding changeset interface into Trac XmlRpc API. It's not perfect but it works really well.

Attachments (1)

trac-xmlrpc-changeset.patch (1.7 KB) - added by iXce 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by iXce

comment:1 Changed 8 years ago by athomas

Good idea to add repository inspection, but I think a more general versioncontrol module might be better, mirroring the trac.versioncontrol API.

comment:2 follow-up: Changed 5 years ago by olemis

  • Trac Release changed from 0.10 to 0.11

TracGViz plugin includes some XML-RPC handlers. VersionControlRPC class's been included since version 1.3.3 (can't provide a link to browse the source code due to the fact that my SVN client is failing and I can't (commit | check) out anything ... sorry :( ).

Please see below a code snippet illustrating public methods :

class VersionControlRPC(Component):
    r""" An interface to Trac's Repository and RepositoryManager.
    """
    implements(IXMLRPCHandler)

    # IXMLRPCHandler methods
    def xmlrpc_namespace(self):
        return 'source'
   
    def xmlrpc_methods(self):
        yield ('BROWSER_VIEW',
                ((list, list, str, str, bool, int),
                 (list, list, str, str, bool),
                 (list, list, str, str),
                 (list, list, str),
                 (list, list),),
                 self.ls)
        yield ('BROWSER_VIEW',
                ((list, list, str),
                 (list, list),),
                 self.getFileAttributes)
        opt_types = [str, xmlrpclib.DateTime]
        yield ('CHANGESET_VIEW',
                tuple(rpc_opt_sigs(list, None, opt_types, \
                                    opt_types, [bool])
                  ),
                 self.getRevisions)
        yield ('CHANGESET_VIEW',
                ((list, str, str, xmlrpclib.DateTime),
                 (list, str, str, str),
                 (list, str, str),
                 (list, str),),
                 self.getFileHistory)
        yield ('CHANGESET_VIEW',
                ((list, str),
                 (list, ),),
                 self.enumChanges)
        yield ('CHANGESET_VIEW',
                ((list, str),
                 (list, ),),
                 self.normalize_rev)

It relies upon Trac Version Control API and has been tested using both wiki:TracMercurial connector and the default Subversion connector, and it should work with other (VCS | SCM). Besides it supports many features such as UNIX filename patterns, multiple specs (i.e. revision IDs + datetime values) for time intervals, and more.

There may be still a few open issues and further methods may be needed (e.g. file downloads). It is possible to move it onto XmlRpcPlugin. Feel free to do it !

PS: I tested it using 0.11, that's why I changed Trac Release field . Hope you don't mind.

comment:3 in reply to: ↑ 2 Changed 5 years ago by anonymous

Replying to olemis:

TracGViz plugin includes some XML-RPC handlers. VersionControlRPC class's been included since version 1.3.3 (can't provide a link to browse the source code due to the fact that my SVN client is failing and I can't (commit | check) out anything ... sorry :( ).

BTW newer versions may include further features and bug fixes, so it's better to download the latest version. In fact in this case I've found a critical issue while using TracMercurial. So, please, take a look at the latest version instead.

comment:4 Changed 5 years ago by olemis

  • Owner changed from athomas to olemis
  • Status changed from new to assigned

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.