hgkw/keyword.py
branch0.9.2compat
changeset 399 5e1faca15e81
parent 397 db7cc16560d4
child 400 4a28faccdb18
equal deleted inserted replaced
397:db7cc16560d4 399:5e1faca15e81
   154             # shrink keywords read from working dir
   154             # shrink keywords read from working dir
   155             kwshrunk = _kwtemplater.shrink(''.join(self.lines))
   155             kwshrunk = _kwtemplater.shrink(''.join(self.lines))
   156             self.lines = kwshrunk.splitlines(True)
   156             self.lines = kwshrunk.splitlines(True)
   157 except ImportError:
   157 except ImportError:
   158     pass
   158     pass
       
   159 
       
   160 try:
       
   161     from mercurial.hgweb import webcommands
       
   162 
       
   163     def _kwweb_changeset(web, req, tmpl):
       
   164         '''Wraps webcommands.changeset turning off keyword expansion.'''
       
   165         try:
       
   166             _kwtemplater.matcher = util.never
       
   167         except AttributeError:
       
   168             pass
       
   169         return web.changeset(tmpl, web.changectx(req))
       
   170 
       
   171     def _kwweb_filediff(web, req, tmpl):
       
   172         '''Wraps webcommands.filediff turning off keyword expansion.'''
       
   173         try:
       
   174             _kwtemplater.matcher = util.never
       
   175         except AttributeError:
       
   176             pass
       
   177         return web.filediff(tmpl, web.filectx(req))
       
   178 
       
   179     webcommands.changeset = webcommands.rev = _kwweb_changeset
       
   180     webcommands.filediff = webcommands.diff = _kwweb_filediff
       
   181 
       
   182 except ImportError:
       
   183     from mercurial.hgweb.hgweb_mod import hgweb
       
   184 
       
   185     def _kwweb_changeset(self, req):
       
   186         try:
       
   187             _kwtemplater.matcher = util.never
       
   188         except AttributeError:
       
   189             pass
       
   190         req.write(self.changeset(self.changectx(req)))
       
   191 
       
   192     def _kwweb_filediff(self, req):
       
   193         try:
       
   194             _kwtemplater.matcher = util.never
       
   195         except AttributeError:
       
   196             pass
       
   197         req.write(self.filediff(self.filectx(req)))
       
   198 
       
   199     hgweb.do_changeset = hgweb.do_rev = _kwweb_changeset
       
   200     hgweb.do_filediff = hgweb.do_diff = _kwweb_filediff
   159 
   201 
   160 try:
   202 try:
   161     # templatefilters module introduced in 9f1e6ab76069
   203     # templatefilters module introduced in 9f1e6ab76069
   162     from mercurial import templatefilters
   204     from mercurial import templatefilters
   163     template_filters = templatefilters.filters
   205     template_filters = templatefilters.filters