source: tracdarcs/__init__.py @ 3

Revision 3, 1.2 KB checked in by lele@…, 7 years ago (diff)

Reworked the trac+darcs backend into a TracPlugin?

Line 
1# -*- coding: iso-8859-1 -*-
2#
3# Copyright (C) 2005 Edgewall Software
4# Copyright (C) 2005,2006 Lele Gaifax <lele@metapensiero.it>
5#
6# This software is licensed as described in the file COPYING, which
7# you should have received as part of this distribution. The terms
8# are also available at http://trac.edgewall.com/license.html.
9#
10# This software consists of voluntary contributions made by many
11# individuals. For the exact contribution history, see the revision
12# history and logs, available at http://projects.edgewall.com/trac/.
13#
14# Author: Lele Gaifax <lele@metapensiero.it>
15
16
17from trac.core import Component, implements
18from trac.versioncontrol import IRepositoryConnector
19from repos import DarcsRepository, DarcsCachedRepository
20
21class DarcsConnector(Component):
22
23    implements(IRepositoryConnector)
24
25    # IRepositoryConnector methods
26
27    def get_supported_types(self):
28        """Support the `darcs:` scheme"""
29        yield ("darcs", 8)
30
31    def get_repository(self, type, dir, authname):
32        """Return a `DarcsRepository`, wrapped by a `DarcsCachedRepository`"""
33        db = self.env.get_db_cnx()
34        repos = DarcsRepository(db, dir, self.env.log, self.env.config)
35        return DarcsCachedRepository(db, repos, None, self.log)
Note: See TracBrowser for help on using the repository browser.