# HG changeset patch # User Christian Ebert # Date 2008-06-12 09:01:36 # Node ID 01e95d4bc66cac6e7bd34452c040a3eebae1e470 # Parent 53465a7464e255d78614de5987f45a26bfa9fd93 keyword: disable expansion for annotate Keyword expansion should not be annotated. Annotate revision when unexpanded keyword was inserted. Add test. diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -88,7 +88,7 @@ import re, shutil, tempfile, time 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') @@ -513,6 +513,11 @@ def reposetup(ui, repo): kwt.restrict = True patch_diff(repo, node1, node2, match, fp, changes, opts) + 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 @@ -527,11 +532,13 @@ def reposetup(ui, repo): patchfile_init = patch.patchfile.__init__ patch_diff = patch.diff + webcommands_annotate = webcommands.annotate webcommands_changeset = webcommands.changeset webcommands_filediff = webcommands.filediff patch.patchfile.__init__ = kwpatchfile_init patch.diff = kw_diff + webcommands.annotate = kwweb_annotate webcommands.changeset = webcommands.rev = kwweb_changeset webcommands.filediff = webcommands.diff = kwweb_filediff diff --git a/tests/test-keyword b/tests/test-keyword --- a/tests/test-keyword +++ b/tests/test-keyword @@ -214,6 +214,8 @@ cat a b echo % hg cat hg cat sym a b echo +echo % annotate +hg annotate a echo % remove hg debugrebuildstate diff --git a/tests/test-keyword.out b/tests/test-keyword.out --- a/tests/test-keyword.out +++ b/tests/test-keyword.out @@ -294,6 +294,11 @@ xxx $ $Xinfo: User Name : firstline $ ignore $Id$ a +% annotate +1: expand $Id$ +1: do not process $Id: +1: xxx $ +2: $Xinfo$ % remove % status % rollback