Mercurial > hg
comparison tests/test-keyword.t @ 33063:7f569ce30216
keyword: restore kwtemplater.restrict at the end of wrapped patch.diff
Before this patch, kwdiff doesn't restore kwtemplater.restrict after
invocation of wrapped patch.diff(). This suppresses keyword expansion
at subsequent filelog.read().
Typical usecase of this issue is "hg cat" after "hg diff" with command
server. In this case, kwtemplater.restrict=True is kept in command
server process even after "hg diff".
To ensure kwtemplater.restrict=True while original patch.diff()
running, this patch makes kwdiff() yield values returned by it,
because it returns generator object.
Strictly speaking, if filelog.read() is invoked before completely
evaluating the result of previous patch.diff(), keyword expansion is
still suppressed, because kwtemplater.restrict isn't restored yet.
But this fixing should be reasonable enough, because patch.diff() is
consumed immediately, AFAIK.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 26 Jun 2017 03:38:12 +0900 |
parents | c2380b448265 |
children | 9062458febca |
comparison
equal
deleted
inserted
replaced
33062:e21b750c9b9e | 33063:7f569ce30216 |
---|---|
1376 do not process $Id: | 1376 do not process $Id: |
1377 xxx $ | 1377 xxx $ |
1378 $Xinfo$ | 1378 $Xinfo$ |
1379 +xxxx | 1379 +xxxx |
1380 | 1380 |
1381 Test that patch.diff(), which is implied by "hg diff" or so, doesn't | |
1382 suppress expanding keywords at subsequent commands | |
1383 | |
1384 #if windows | |
1385 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH" | |
1386 #else | |
1387 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH" | |
1388 #endif | |
1389 $ export PYTHONPATH | |
1390 | |
1391 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new | |
1392 $ mv $HGRCPATH.new $HGRCPATH | |
1393 | |
1394 >>> from __future__ import print_function | |
1395 >>> from hgclient import readchannel, runcommand, check | |
1396 >>> @check | |
1397 ... def check(server): | |
1398 ... # hello block | |
1399 ... readchannel(server) | |
1400 ... | |
1401 ... runcommand(server, ['cat', 'm']) | |
1402 ... runcommand(server, ['diff', '-c', '.', 'm']) | |
1403 ... runcommand(server, ['cat', 'm']) | |
1404 *** runcommand cat m | |
1405 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $ | |
1406 bar | |
1407 *** runcommand diff -c . m | |
1408 *** runcommand cat m | |
1409 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $ | |
1410 bar | |
1411 | |
1381 $ cd .. | 1412 $ cd .. |