[PATCH] keyword: no expansion in web diffs

Christian Ebert blacktrash at gmx.net
Sat Feb 9 21:07:24 CST 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202612835 -3600
# Node ID a334fb9241e3b612c56b2b7abff3893c1489bebe
# Parent  513c1fc917af44086f487864deccb4fdd2ffa055
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.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -80,6 +80,7 @@
 
 from mercurial import commands, cmdutil, context, dispatch, filelog, revlog
 from mercurial import patch, localrepo, templater, templatefilters, util
+from mercurial.hgweb import webcommands
 from mercurial.node import *
 from mercurial.i18n import _
 import re, shutil, tempfile, time
@@ -121,7 +122,17 @@
     _cmd, func, args, options, _cmdoptions = _dispatch_parse(ui, args)
     return _cmd, func, args, options, _cmdoptions
 
+def kwweb_changeset(web, req, tmpl):
+    _kwtemplater.matcher = util.never
+    return web.changeset(tmpl, web.changectx(req))
+
+def kwweb_filediff(web, req, tmpl):
+    _kwtemplater.matcher = util.never
+    return web.filediff(tmpl, web.filectx(req))
+
 dispatch._parse = _kwdispatch_parse
+webcommands.changeset = webcommands.rev = kwweb_changeset
+webcommands.filediff = webcommands.diff = kwweb_filediff
 
 
 class kwtemplater(object):


More information about the Mercurial-devel mailing list