Edgewall Software

Changes between Version 3 and Version 4 of TracDev/VersionControlApi


Ignore:
Timestamp:
Sep 15, 2010, 12:20:28 AM (14 years ago)
Author:
alex@…
Comment:

Mention RepositoryManager interface introduced in Trac 0.12

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/VersionControlApi

    v3 v4  
    1818}}}
    1919
     20From Trac 0.12 {{{env.get_repository()}}} is deprecated, replaced by the {{{RepositoryManager}}} interface. The above code becomes:
     21{{{
     22#!python
     23from trac.env import Environment
     24from trac.versioncontrol import RepositoryManager
     25
     26env = Environment('/path/to/projenv')
     27repos = RepositoryManager(env).get_repository(None)
     28try:
     29    # Do whatever you like with the repository object here
     30finally:
     31    repos.close()
     32}}}
     33
     34To access a repository other than the default pass a {{{reponame}}} in place of {{{None}}}. In class that inherits from {{{Component}}} it is more convenient to use {{{self.env}}} than instantiate {{{Environment}}} manually.
    2035----
    2136See also: TracDev