# HG changeset patch # User FUJIWARA Katsunori # Date 2017-06-25 18:40:12 # Node ID 0afdc1a4f9252b85b8828bd7a278e62e8d9d19a8 # Parent 9062458febcab017e03c95b79c69d229e6ee29e8 keyword: make comparison webcommand suppress keyword expansion Before this patch, diff in "comparison" webcommand doesn't suppress keyword expansion as same as diff output of other webcommands. diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -121,6 +121,9 @@ testedwith = 'ships-with-hg-core' nokwcommands = ('add addremove annotate bundle export grep incoming init log' ' outgoing push tip verify convert email glog') +# webcommands that do not act on keywords +nokwwebcommands = ('annotate changeset rev filediff diff comparison') + # hg commands that trigger expansion only when writing to working dir, # not when reading filelog, and unexpand when reading from working dir restricted = ('merge kwexpand kwshrink record qrecord resolve transplant' @@ -763,6 +766,6 @@ def reposetup(ui, repo): extensions.wrapfunction(cmdutil, 'amend', kw_amend) extensions.wrapfunction(cmdutil, 'copy', kw_copy) extensions.wrapfunction(cmdutil, 'dorecord', kw_dorecord) - for c in 'annotate changeset rev filediff diff'.split(): + for c in nokwwebcommands.split(): extensions.wrapfunction(webcommands, c, kwweb_skip) repo.__class__ = kwrepo diff --git a/tests/test-keyword.t b/tests/test-keyword.t --- a/tests/test-keyword.t +++ b/tests/test-keyword.t @@ -1018,7 +1018,7 @@ kwexpand nonexistent #if serve hg serve - expand with hgweb file - - no expansion with hgweb annotate/changeset/filediff + - no expansion with hgweb annotate/changeset/filediff/comparison - expand with hgweb file, again - check errors @@ -1079,6 +1079,12 @@ hg serve + $ get-with-headers.py localhost:$HGPORT 'comparison/bb948857c743/a' | grep '\$[a-zA-Z]' + 1 expand $Id$ + 1 expand $Id$ + 2 do not process $Id: + 2 do not process $Id: + 4 $Xinfo$ (check "kwweb_skip"-ed webcommand doesn't suppress expanding keywords at subsequent webcommands)