comparison tests/test-fix.t @ 43226:5272bd7e7517

tests: add test showing that fixer patterns are currently relative to $PWD Differential Revision: https://phab.mercurial-scm.org/D7100
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 12 Oct 2019 11:30:20 -0700
parents d3d1a3afe7aa
children f02d3c0eed18
comparison
equal deleted inserted replaced
43225:8343070ed758 43226:5272bd7e7517
1296 $ cd subprocesscwd 1296 $ cd subprocesscwd
1297 1297
1298 $ cat >> .hg/hgrc <<EOF 1298 $ cat >> .hg/hgrc <<EOF
1299 > [fix] 1299 > [fix]
1300 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())" 1300 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())"
1301 > printcwd:pattern = path:foo/bar 1301 > printcwd:pattern = relpath:foo/bar
1302 > EOF 1302 > EOF
1303 1303
1304 $ mkdir foo 1304 $ mkdir foo
1305 $ printf "bar\n" > foo/bar 1305 $ printf "bar\n" > foo/bar
1306 $ hg commit -Aqm blah 1306 $ hg commit -Aqm blah
1316 $ hg fix -w -r . bar 1316 $ hg fix -w -r . bar
1317 $ hg cat -r tip bar 1317 $ hg cat -r tip bar
1318 $TESTTMP/subprocesscwd 1318 $TESTTMP/subprocesscwd
1319 $ cat bar 1319 $ cat bar
1320 $TESTTMP/subprocesscwd 1320 $TESTTMP/subprocesscwd
1321 $ echo modified > bar
1322 $ hg fix -w bar
1323 $ cat bar
1324 modified
1321 1325
1322 $ cd ../.. 1326 $ cd ../..
1323 1327
1324 Tools configured without a pattern are ignored. It would be too dangerous to 1328 Tools configured without a pattern are ignored. It would be too dangerous to
1325 run them on all files, because this might happen while testing a configuration 1329 run them on all files, because this might happen while testing a configuration
1371 $ printf "baz" > baz_file 1375 $ printf "baz" > baz_file
1372 $ hg add -q 1376 $ hg add -q
1373 1377
1374 $ cd bar 1378 $ cd bar
1375 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \ 1379 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \
1376 > --config "fix.cooltool:pattern=rootglob:**" 1380 > --config "fix.cooltool:pattern=glob:**"
1377 $ cd .. 1381 $ cd ..
1378 1382
1379 $ cat foo/file 1383 $ cat foo/file
1380 fixed 1384 fixed
1381 $ cat bar/file 1385 $ cat bar/file
1407 > EOF 1411 > EOF
1408 1412
1409 $ hg fix --working-dir foo bar baz \ 1413 $ hg fix --working-dir foo bar baz \
1410 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \ 1414 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \
1411 > --config 'fix.changedlines:linerange="{first} through {last}"' \ 1415 > --config 'fix.changedlines:linerange="{first} through {last}"' \
1412 > --config 'fix.changedlines:pattern=rootglob:**' \ 1416 > --config 'fix.changedlines:pattern=glob:**' \
1413 > --config 'fix.changedlines:skipclean=false' 1417 > --config 'fix.changedlines:skipclean=false'
1414 1418
1415 $ cat foo 1419 $ cat foo
1416 Line ranges: 1420 Line ranges:
1417 $ cat bar 1421 $ cat bar