--- a/hgkw/keyword.py Fri Jun 06 17:21:00 2008 +0200
+++ b/hgkw/keyword.py Thu Jun 12 16:32:16 2008 +0200
@@ -94,7 +94,7 @@
commands.optionalrepo += ' kwdemo'
# hg commands that do not act on keywords
-nokwcommands = ('add addremove bundle copy export grep incoming init'
+nokwcommands = ('add addremove annotate bundle copy export grep incoming init'
' log outgoing push rename rollback tip'
' convert email glog')
@@ -703,6 +703,11 @@
try:
from mercurial.hgweb import webcommands
+ def kwweb_annotate(web, req, tmpl):
+ '''Wraps webcommands.annotate turning off keyword expansion.'''
+ kwt.matcher = util.never
+ return webcommands_annotate(web, req, tmpl)
+
def kwweb_changeset(web, req, tmpl):
'''Wraps webcommands.changeset turning off keyword expansion.'''
kwt.matcher = util.never
@@ -713,13 +718,20 @@
kwt.matcher = util.never
return webcommands_filediff(web, req, tmpl)
+ webcommands_annotate = webcommands.annotate
webcommands_changeset = webcommands.changeset
webcommands_filediff = webcommands.filediff
+
+ webcommands.annotate = kwweb_annotate
webcommands.changeset = webcommands.rev = kwweb_changeset
webcommands.filediff = webcommands.diff = kwweb_filediff
except ImportError:
from mercurial.hgweb.hgweb_mod import hgweb
+ def kwweb_do_annotate(self, req):
+ kwt.matcher = util.never
+ hgweb_do_annotate(self, req)
+
def kwweb_do_changeset(self, req):
kwt.matcher = util.never
hgweb_do_changeset(self, req)
@@ -728,8 +740,11 @@
kwt.matcher = util.never
hgweb_do_filediff(self, req)
+ hgweb_do_annotate = hgweb.do_annotate
hgweb_do_changeset = hgweb.do_changeset
hgweb_do_filediff = hgweb.do_filediff
+
+ hgweb.do_annotate = kwweb_do_annotate
hgweb.do_changeset = hgweb.do_rev = kwweb_do_changeset
hgweb.do_filediff = hgweb.do_diff = kwweb_do_filediff
--- a/tests/test-keyword Fri Jun 06 17:21:00 2008 +0200
+++ b/tests/test-keyword Thu Jun 12 16:32:16 2008 +0200
@@ -196,7 +196,10 @@
echo % cat
cat a b
echo % hg cat
-hg cat a b
+hg cat sym a b
+echo
+echo % annotate
+hg annotate a
echo % remove
hg debugrebuildstate
--- a/tests/test-keyword.out Fri Jun 06 17:21:00 2008 +0200
+++ b/tests/test-keyword.out Thu Jun 12 16:32:16 2008 +0200
@@ -238,6 +238,12 @@
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
+a
+% annotate
+1: expand $Id$
+1: do not process $Id:
+1: xxx $
+2: $Xinfo$
% remove
% status
% rollback