Modify

Opened 11 years ago

Last modified 7 years ago

#808 assigned enhancement

Add Changesets to TracXmlRpc plugin

Reported by: iXce Owned by: Olemis Lang
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 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by iXce

Attachment: trac-xmlrpc-changeset.patch added

comment:1 Changed 10 years ago by Alec Thomas

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

comment:2 Changed 8 years ago by Olemis Lang

Trac Release: 0.100.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 8 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 7 years ago by Olemis Lang

Owner: changed from Alec Thomas to Olemis Lang
Status: newassigned

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Olemis Lang.

Add Comment


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

 
Note: See TracTickets for help on using tickets.