[PATCH] keyword: no expansion in web diffs (2. corrected version)

Christian Ebert blacktrash at gmx.net
Sat Feb 9 21:27:52 CST 2008


Hi,

Overlooked catching an Error, so here's the right version.

c



# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202613899 -3600
# Node ID 67e867eb8c4e80120cd005c374fff179b142f30d
# Parent  5629677197b5db3acfa762dccf7d5efbd2acd2a4
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,23 @@
     _cmd, func, args, options, _cmdoptions = _dispatch_parse(ui, args)
     return _cmd, func, args, options, _cmdoptions
 
+def kwweb_changeset(web, req, tmpl):
+    try:
+        _kwtemplater.matcher = util.never
+    except AttributeError:
+        pass
+    return web.changeset(tmpl, web.changectx(req))
+
+def kwweb_filediff(web, req, tmpl):
+    try:
+        _kwtemplater.matcher = util.never
+    except AttributeError:
+        pass
+    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