Ticket #327: ChangeLog-11.patch

File ChangeLog-11.patch, 3.1 kB (added by DiGi, 1 year ago)

patch for 0.11 and torev

  • setup.py

    old new  
    11from setuptools import setup 
    22 
    33PACKAGE = 'tracchangelog' 
    4 VERSION = '0.1
     4VERSION = '0.11
    55 
    6 setup(name=PACKAGE, version=VERSION, packages=['tracchangelog']) 
     6setup( 
     7    name=PACKAGE, 
     8    version=VERSION, 
     9    packages=['tracchangelog'], 
     10    author = 'Alec Thomas', 
     11    author_email = 'alec@swapoff.org', 
     12    url = 'http://trac-hacks.org/wiki/ChangeLogPlugin', 
     13    description = 'ChangeLog Macro for Trac', 
     14    license = 'BSD', 
     15    zip_safe=True, 
     16    install_requires = [ 
     17        #'trac>=0.11', 
     18    ], 
     19    entry_points = { 
     20        'trac.plugins': [ 
     21            'tracchangelog = tracchangelog.tracchangelog', 
     22        ] 
     23    }, 
     24
  • tracchangelog.egg-info/trac_plugin.txt

    old new  
  • tracchangelog/__init__.py

    old new  
    1 # tracchangelog module 
    2 from tracchangelog import * 
  • tracchangelog/tracchangelog.py

    old new  
    1212class TracChangeLogPlugin(Component): 
    1313    """ Provides the macro 
    1414    {{{ 
    15        [[ChangeLog(path[,limit[,rev]])]] 
     15       [[ChangeLog(path[,limit[,rev[,torev]]])]] 
    1616    }}} 
    1717    which dumps the change log for path of revision rev, back 
    18     limit revisions. "rev" can be 0 for the latest revision. 
     18    limit revisions. "rev" can be 0 for the latest revision. torev is used for from revision to revision. limit must  
    1919    """ 
    2020 
    2121    implements(IWikiMacroProvider) 
     
    2727        return pydoc.getdoc(self) 
    2828 
    2929    def render_macro(self, req, name, content): 
    30         path, limit, rev = ([x.strip() for x in (content or '').split(',')] + [None, None])[0:3
     30        path, limit, rev, torev = ([x.strip() for x in (content or '').split(',')] + [None, None, None])[0:4
    3131 
    3232        if not hasattr(req, 'authname'): 
    3333            return Markup('<i>Changelog not available</i>') 
     
    4444            limit = 5 
    4545        else: 
    4646            limit = int(limit) 
    47          
     47        if torev is None: 
     48            torev = 0 
     49        else: 
     50            torev = int(torev) 
     51 
    4852        node = repo.get_node(path, rev) 
    4953        out = StringIO() 
    5054        for npath, nrev, nlog in node.get_history(limit): 
    5155            change = repo.get_changeset(nrev) 
     56            if nrev < torev: 
     57                break 
    5258            out.write(wiki_to_html("'''[%i] by %s on %s'''\n\n%s" % (nrev, change.author, format_datetime(change.date), change.message), self.env, req)); 
     59            if nrev == torev: 
     60                break 
    5361        return out.getvalue()