hgkw/keyword.py
branch0.9.2compat
changeset 433 d830cdde0ddb
parent 432 140fe33eacf3
child 435 7bc92583f344
equal deleted inserted replaced
432:140fe33eacf3 433:d830cdde0ddb
   165     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
   165     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
   166                 fp=fp, changes=changes, opts=opts)
   166                 fp=fp, changes=changes, opts=opts)
   167 
   167 
   168 try:
   168 try:
   169     from mercurial.hgweb import webcommands
   169     from mercurial.hgweb import webcommands
       
   170     _webcommands_changeset = webcommands.changeset
       
   171     _webcommands_filediff = webcommands.filediff
   170 
   172 
   171     def _kwweb_changeset(web, req, tmpl):
   173     def _kwweb_changeset(web, req, tmpl):
   172         '''Wraps webcommands.changeset turning off keyword expansion.'''
   174         '''Wraps webcommands.changeset turning off keyword expansion.'''
   173         kwtools['templater'].matcher = util.never
   175         kwtools['templater'].matcher = util.never
   174         return web.changeset(tmpl, web.changectx(req))
   176         try:
       
   177             return _webcommands_changeset(web, req, tmpl)
       
   178         except TypeError:
       
   179             return _webcommands_changeset(tmpl, web.changectx(req))
   175 
   180 
   176     def _kwweb_filediff(web, req, tmpl):
   181     def _kwweb_filediff(web, req, tmpl):
   177         '''Wraps webcommands.filediff turning off keyword expansion.'''
   182         '''Wraps webcommands.filediff turning off keyword expansion.'''
   178         kwtools['templater'].matcher = util.never
   183         kwtools['templater'].matcher = util.never
   179         return web.filediff(tmpl, web.filectx(req))
   184         try:
       
   185             return _webcommands_filediff(web, req, tmpl)
       
   186         except TypeError:
       
   187             return _webcommands_filediff(tmpl, web.filectx(req))
   180 
   188 
   181     webcommands.changeset = webcommands.rev = _kwweb_changeset
   189     webcommands.changeset = webcommands.rev = _kwweb_changeset
   182     webcommands.filediff = webcommands.diff = _kwweb_filediff
   190     webcommands.filediff = webcommands.diff = _kwweb_filediff
   183 
   191 
   184 except ImportError:
   192 except ImportError: