Mercurial > hg > mercurial-source
changeset 33848:0afdc1a4f925
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.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 26 Jun 2017 03:40:12 +0900 |
parents | 9062458febca |
children | cf0da12afe8a |
files | hgext/keyword.py tests/test-keyword.t |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -121,6 +121,9 @@ 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 @@ 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
--- a/tests/test-keyword.t +++ b/tests/test-keyword.t @@ -1018,7 +1018,7 @@ #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 @@ + $ get-with-headers.py localhost:$HGPORT 'comparison/bb948857c743/a' | grep '\$[a-zA-Z]' + <td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td> + <td class="source equal"><a href="#l1r1"> 1</a> expand $Id$</td> + <td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td> + <td class="source equal"><a href="#l2r2"> 2</a> do not process $Id:</td> + <td class="source insert"><a href="#r4"> 4</a> $Xinfo$</td> (check "kwweb_skip"-ed webcommand doesn't suppress expanding keywords at subsequent webcommands)