~ubuntu-branches/debian/sid/trac-bzr/sid

« back to all changes in this revision

Viewing changes to tracbzr/backend.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-11-06 22:15:24 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101106221524-5qcw36mf53wlxayg
Tags: 0.4.2-1
* Run test suite during package build.
* Change section to vcs.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
    def get_repository(self, repos_type, repos_dir, authname_or_params):
113
113
        """Return a `BzrRepository`"""
114
114
        assert repos_type == 'bzr'
 
115
        if trac_version < (0,12):
 
116
            # Trac 0.11 and earlier expects an auth object or None
 
117
            authname_or_params = None
115
118
        return BzrRepository(repos_dir, authname_or_params, self)
116
119
 
117
120
class BzrWikiMacros(core.Component):
137
140
                date = format_datetime(timestamp)
138
141
                age = pretty_timedelta(timestamp)
139
142
                return html.SPAN(age, title=date)
140
 
        repo = self.env.get_repository(req.authname)
 
143
        if trac_version >= (0,12):
 
144
            from trac.wiki.api import parse_args
 
145
            from trac.versioncontrol.api import RepositoryManager
 
146
            args, kwargs = parse_args(content)
 
147
            reponame = kwargs.get('repo', '')
 
148
            rm = RepositoryManager(self.env)
 
149
            repo = rm.get_repository(reponame)
 
150
            if repo is None:
 
151
                raise core.TracError('No repository named %r' % (reponame,))
 
152
        else:
 
153
            repo = self.env.get_repository(req.authname)
141
154
        if not isinstance(repo, BzrRepository):
142
 
            raise core.TracError('Configured repository is not a bzr repository')
 
155
            raise core.TracError('Configured repository is not a bzr repository but a %s instead' % (repo.__class__.__name__,))
143
156
        try:
144
157
            branches = repo.get_branches()
145
158
            rows = []
276
289
 
277
290
        Defaults to True.""")
278
291
 
279
 
    def __init__(self, location, authname_or_params, component):
280
 
        versioncontrol.Repository.__init__(self, location, authname_or_params,
 
292
    def __init__(self, location, auth_or_params, component):
 
293
        versioncontrol.Repository.__init__(self, location, auth_or_params,
281
294
                                           component.log)
282
295
        self.component = component
283
296
        self.config = component.config