Changes between Version 8 and Version 9 of HgTimelinePlugin


Ignore:
Timestamp:
Mar 6, 2013 2:58:00 PM (19 months ago)
Author:
djc
Comment:

Update, deprecation notice.

Legend:

Unmodified
Added
Removed
Modified
  • HgTimelinePlugin

    v8 v9  
    11= Interface Trac to multiple Hg repositores = 
     2 
     3== Deprecated == 
     4 
     5Now that [http://trac.edgewall.org/wiki/TracMercurial TracMercurial] supports multiple repositories, I consider this plugin to be obsolete. We currently use the following plugin to preserve HgTimelinePlugin-style wiki links: 
     6 
     7{{{ 
     8!#python 
     9from genshi.builder import tag 
     10 
     11from trac.core import * 
     12from trac.util.datefmt import utc 
     13from trac.util.text import to_unicode, shorten_line 
     14from trac.wiki import format_to_html 
     15from trac.wiki.api import IWikiSyntaxProvider 
     16from trac.versioncontrol.api import RepositoryManager, NoSuchChangeset 
     17 
     18# The component 
     19 
     20class MultiRepoWikiFormatting(Component): 
     21 
     22    implements(IWikiSyntaxProvider) 
     23 
     24    def __init__(self): 
     25        self.rm = RepositoryManager(self.env) 
     26        self.repos = self.rm.get_all_repositories().keys() 
     27 
     28    # IWikiSyntaxProvider methods 
     29 
     30    def get_wiki_syntax(self): 
     31        return [] 
     32 
     33    def get_link_resolvers(self): 
     34        for repo in self.repos: 
     35            self.log.debug('Link resolver for %s added' % repo) 
     36            yield repo, self._format_link 
     37 
     38    def _format_link(self, formatter, repo, rev, label): 
     39        repo = self.rm.get_repository(repo) 
     40        href = '/changeset/%s/%s' % (rev, repo.reponame) 
     41        try: 
     42            cset = repo.get_changeset(rev) 
     43            text = shorten_line(cset.message) 
     44            return tag.a(label, class_='changeset', href=href, title=text) 
     45        except NoSuchChangeset as e: 
     46            text = to_unicode('No such changeset: %s' % rev) 
     47            return tag.a(label, class_='missing changeset', rel='nofollow', 
     48                         href=href, title=text) 
     49}}} 
     50 
     51If you still use this plugin, I'm happy to field pull requests on [https://bitbucket.org/kentyde/hgtimelineplugin Bitbucket] (including the above plugin, which I've added to the repository). 
    252 
    353== Description == 
     
    1969== Download and Source == 
    2070 
    21 Download the [http://hg.xavamedia.nl/hgtl/archive/tip.tar.gz zipped source], check out [http://hg.xavamedia.nl/hgtl/ using Mercurial], or [http://hg.xavamedia.nl/hgtl/ browse the source] online. 
    22  
    23 Requires Trac 0.11. 
    24  
     71This plugin now lives on [https://bitbucket.org/kentyde/hgtimelineplugin Bitbucket]. It requires Trac 0.11 (and probably some older version of Mercurial). 
    2572 
    2673== Example ==