comparison hgext/keyword.py @ 6072:e521ec1ad985

keyword: no expansion in web diffs Expansion in hgweb view of changesets and diffs is not needed and only distracting. Expansion stays enable in file and archive requests where it makes sense.
author Christian Ebert <blacktrash@gmx.net>
date Sun, 10 Feb 2008 04:24:59 +0100
parents 127c973e4499
children beb775df5630
comparison
equal deleted inserted replaced
6071:127c973e4499 6072:e521ec1ad985
78 "Log = {desc}" expands to the first line of the changeset description. 78 "Log = {desc}" expands to the first line of the changeset description.
79 ''' 79 '''
80 80
81 from mercurial import commands, cmdutil, context, dispatch, filelog, revlog 81 from mercurial import commands, cmdutil, context, dispatch, filelog, revlog
82 from mercurial import patch, localrepo, templater, templatefilters, util 82 from mercurial import patch, localrepo, templater, templatefilters, util
83 from mercurial.hgweb import webcommands
83 from mercurial.node import * 84 from mercurial.node import *
84 from mercurial.i18n import _ 85 from mercurial.i18n import _
85 import re, shutil, tempfile, time 86 import re, shutil, tempfile, time
86 87
87 commands.optionalrepo += ' kwdemo' 88 commands.optionalrepo += ' kwdemo'
119 current command and command options (global _cmd, _cmdoptions).''' 120 current command and command options (global _cmd, _cmdoptions).'''
120 global _cmd, _cmdoptions 121 global _cmd, _cmdoptions
121 _cmd, func, args, options, _cmdoptions = _dispatch_parse(ui, args) 122 _cmd, func, args, options, _cmdoptions = _dispatch_parse(ui, args)
122 return _cmd, func, args, options, _cmdoptions 123 return _cmd, func, args, options, _cmdoptions
123 124
125 def kwweb_changeset(web, req, tmpl):
126 try:
127 _kwtemplater.matcher = util.never
128 except AttributeError:
129 pass
130 return web.changeset(tmpl, web.changectx(req))
131
132 def kwweb_filediff(web, req, tmpl):
133 try:
134 _kwtemplater.matcher = util.never
135 except AttributeError:
136 pass
137 return web.filediff(tmpl, web.filectx(req))
138
124 dispatch._parse = _kwdispatch_parse 139 dispatch._parse = _kwdispatch_parse
140 webcommands.changeset = webcommands.rev = kwweb_changeset
141 webcommands.filediff = webcommands.diff = kwweb_filediff
125 142
126 143
127 class kwtemplater(object): 144 class kwtemplater(object):
128 ''' 145 '''
129 Sets up keyword templates, corresponding keyword regex, and 146 Sets up keyword templates, corresponding keyword regex, and