| 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 | |
|---|
| 17 | from trac.core import Component, implements |
|---|
| 18 | from trac.versioncontrol import IRepositoryConnector |
|---|
| 19 | from repos import DarcsRepository, DarcsCachedRepository |
|---|
| 20 | |
|---|
| 21 | class 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) |
|---|