Mercurial > hg
comparison tests/test-fix.t @ 44129:84a0102c05c7 stable 5.3rc0
merge to stable for 5.3 release freeze
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 21 Jan 2020 13:14:51 -0500 |
parents | 61881b170140 e685fac56693 |
children | 5205b46bd887 |
comparison
equal
deleted
inserted
replaced
44048:61881b170140 | 44129:84a0102c05c7 |
---|---|
262 | 262 |
263 $ printf "hello\n" > hello.whole | 263 $ printf "hello\n" > hello.whole |
264 $ hg commit -Aqm "hello" | 264 $ hg commit -Aqm "hello" |
265 $ hg phase -r 0 --public | 265 $ hg phase -r 0 --public |
266 $ hg fix -r 0 | 266 $ hg fix -r 0 |
267 abort: can't fix immutable changeset 0:6470986d2e7b | 267 abort: cannot fix public changesets |
268 (see 'hg help phases' for details) | |
268 [255] | 269 [255] |
269 $ hg fix -r 0 --working-dir | 270 $ hg fix -r 0 --working-dir |
270 abort: can't fix immutable changeset 0:6470986d2e7b | 271 abort: cannot fix public changesets |
272 (see 'hg help phases' for details) | |
271 [255] | 273 [255] |
272 $ hg cat -r tip hello.whole | 274 $ hg cat -r tip hello.whole |
273 hello | 275 hello |
274 $ cat hello.whole | 276 $ cat hello.whole |
275 hello | 277 hello |
1169 $ printf "one\n" > foo.whole | 1171 $ printf "one\n" > foo.whole |
1170 $ hg commit -Aqm "first" | 1172 $ hg commit -Aqm "first" |
1171 $ printf "two\n" > foo.whole | 1173 $ printf "two\n" > foo.whole |
1172 $ hg commit -m "second" | 1174 $ hg commit -m "second" |
1173 $ hg --config experimental.evolution.allowunstable=False fix -r '.^' | 1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^' |
1174 abort: can only fix a changeset together with all its descendants | 1176 abort: cannot fix changeset with children |
1175 [255] | 1177 [255] |
1176 $ hg fix -r '.^' | 1178 $ hg fix -r '.^' |
1177 1 new orphan changesets | 1179 1 new orphan changesets |
1178 $ hg cat -r 2 foo.whole | 1180 $ hg cat -r 2 foo.whole |
1179 ONE | 1181 ONE |
1299 | 1301 |
1300 $ cat >> .hg/hgrc <<EOF | 1302 $ cat >> .hg/hgrc <<EOF |
1301 > [fix] | 1303 > [fix] |
1302 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())" | 1304 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())" |
1303 > printcwd:pattern = relpath:foo/bar | 1305 > printcwd:pattern = relpath:foo/bar |
1306 > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())" | |
1307 > filesetpwd:pattern = set:**quux | |
1304 > EOF | 1308 > EOF |
1305 | 1309 |
1306 $ mkdir foo | 1310 $ mkdir foo |
1307 $ printf "bar\n" > foo/bar | 1311 $ printf "bar\n" > foo/bar |
1312 $ printf "quux\n" > quux | |
1308 $ hg commit -Aqm blah | 1313 $ hg commit -Aqm blah |
1309 | 1314 |
1310 $ hg fix -w -r . foo/bar | 1315 $ hg fix -w -r . foo/bar |
1311 $ hg cat -r tip foo/bar | 1316 $ hg cat -r tip foo/bar |
1312 $TESTTMP/subprocesscwd | 1317 $TESTTMP/subprocesscwd |
1314 $TESTTMP/subprocesscwd | 1319 $TESTTMP/subprocesscwd |
1315 | 1320 |
1316 $ cd foo | 1321 $ cd foo |
1317 | 1322 |
1318 $ hg fix -w -r . bar | 1323 $ hg fix -w -r . bar |
1319 $ hg cat -r tip bar | 1324 $ hg cat -r tip bar ../quux |
1320 $TESTTMP/subprocesscwd | 1325 $TESTTMP/subprocesscwd |
1321 $ cat bar | 1326 quux |
1327 $ cat bar ../quux | |
1322 $TESTTMP/subprocesscwd | 1328 $TESTTMP/subprocesscwd |
1329 quux | |
1323 $ echo modified > bar | 1330 $ echo modified > bar |
1324 $ hg fix -w bar | 1331 $ hg fix -w bar |
1325 $ cat bar | 1332 $ cat bar |
1326 $TESTTMP/subprocesscwd | 1333 $TESTTMP/subprocesscwd |
1334 | |
1335 Apparently fixing p1() and its descendants doesn't include wdir() unless | |
1336 explicitly stated. | |
1337 | |
1338 $ hg fix -r '.::' | |
1339 $ hg cat -r . ../quux | |
1340 quux | |
1341 $ hg cat -r tip ../quux | |
1342 fs: $TESTTMP/subprocesscwd | |
1343 $ cat ../quux | |
1344 quux | |
1345 | |
1346 Clean files are not fixed unless explicitly named | |
1347 $ echo 'dirty' > ../quux | |
1348 | |
1349 $ hg fix --working-dir | |
1350 $ cat ../quux | |
1351 fs: $TESTTMP/subprocesscwd | |
1327 | 1352 |
1328 $ cd ../.. | 1353 $ cd ../.. |
1329 | 1354 |
1330 Tools configured without a pattern are ignored. It would be too dangerous to | 1355 Tools configured without a pattern are ignored. It would be too dangerous to |
1331 run them on all files, because this might happen while testing a configuration | 1356 run them on all files, because this might happen while testing a configuration |
1425 $ cat baz | 1450 $ cat baz |
1426 Line ranges: | 1451 Line ranges: |
1427 2 through 2 | 1452 2 through 2 |
1428 | 1453 |
1429 $ cd .. | 1454 $ cd .. |
1455 | |
1456 Test various cases around merges. We were previously dropping files if they were | |
1457 created on only the p2 side of the merge, so let's test permutations of: | |
1458 * added, was fixed | |
1459 * added, considered for fixing but was already good | |
1460 * added, not considered for fixing | |
1461 * modified, was fixed | |
1462 * modified, considered for fixing but was already good | |
1463 * modified, not considered for fixing | |
1464 | |
1465 Before the bug was fixed where we would drop files, this test demonstrated the | |
1466 following issues: | |
1467 * new_in_r1.ignored, new_in_r1_already_good.changed, and | |
1468 > mod_in_r1_already_good.changed were NOT in the manifest for the merge commit | |
1469 * mod_in_r1.ignored had its contents from r0, NOT r1. | |
1470 | |
1471 We're also setting a named branch for every commit to demonstrate that the | |
1472 branch is kept intact and there aren't issues updating to another branch in the | |
1473 middle of fix. | |
1474 | |
1475 $ hg init merge_keeps_files | |
1476 $ cd merge_keeps_files | |
1477 $ for f in r0 mod_in_r1 mod_in_r2 mod_in_merge mod_in_child; do | |
1478 > for c in changed whole ignored; do | |
1479 > printf "hello\n" > $f.$c | |
1480 > done | |
1481 > printf "HELLO\n" > "mod_in_${f}_already_good.changed" | |
1482 > done | |
1483 $ hg branch -q r0 | |
1484 $ hg ci -Aqm 'r0' | |
1485 $ hg phase -p | |
1486 $ make_test_files() { | |
1487 > printf "world\n" >> "mod_in_$1.changed" | |
1488 > printf "world\n" >> "mod_in_$1.whole" | |
1489 > printf "world\n" >> "mod_in_$1.ignored" | |
1490 > printf "WORLD\n" >> "mod_in_$1_already_good.changed" | |
1491 > printf "new in $1\n" > "new_in_$1.changed" | |
1492 > printf "new in $1\n" > "new_in_$1.whole" | |
1493 > printf "new in $1\n" > "new_in_$1.ignored" | |
1494 > printf "ALREADY GOOD, NEW IN THIS REV\n" > "new_in_$1_already_good.changed" | |
1495 > } | |
1496 $ make_test_commit() { | |
1497 > make_test_files "$1" | |
1498 > hg branch -q "$1" | |
1499 > hg ci -Aqm "$2" | |
1500 > } | |
1501 $ make_test_commit r1 "merge me, pt1" | |
1502 $ hg co -q ".^" | |
1503 $ make_test_commit r2 "merge me, pt2" | |
1504 $ hg merge -qr 1 | |
1505 $ make_test_commit merge "evil merge" | |
1506 $ make_test_commit child "child of merge" | |
1507 $ make_test_files wdir | |
1508 $ hg fix -r 'not public()' -w | |
1509 $ hg log -G -T'{rev}:{shortest(node,8)}: branch:{branch} desc:{desc}' | |
1510 @ 8:c22ce900: branch:child desc:child of merge | |
1511 | | |
1512 o 7:5a30615a: branch:merge desc:evil merge | |
1513 |\ | |
1514 | o 6:4e5acdc4: branch:r2 desc:merge me, pt2 | |
1515 | | | |
1516 o | 5:eea01878: branch:r1 desc:merge me, pt1 | |
1517 |/ | |
1518 o 0:0c548d87: branch:r0 desc:r0 | |
1519 | |
1520 $ hg files -r tip | |
1521 mod_in_child.changed | |
1522 mod_in_child.ignored | |
1523 mod_in_child.whole | |
1524 mod_in_child_already_good.changed | |
1525 mod_in_merge.changed | |
1526 mod_in_merge.ignored | |
1527 mod_in_merge.whole | |
1528 mod_in_merge_already_good.changed | |
1529 mod_in_mod_in_child_already_good.changed | |
1530 mod_in_mod_in_merge_already_good.changed | |
1531 mod_in_mod_in_r1_already_good.changed | |
1532 mod_in_mod_in_r2_already_good.changed | |
1533 mod_in_r0_already_good.changed | |
1534 mod_in_r1.changed | |
1535 mod_in_r1.ignored | |
1536 mod_in_r1.whole | |
1537 mod_in_r1_already_good.changed | |
1538 mod_in_r2.changed | |
1539 mod_in_r2.ignored | |
1540 mod_in_r2.whole | |
1541 mod_in_r2_already_good.changed | |
1542 new_in_child.changed | |
1543 new_in_child.ignored | |
1544 new_in_child.whole | |
1545 new_in_child_already_good.changed | |
1546 new_in_merge.changed | |
1547 new_in_merge.ignored | |
1548 new_in_merge.whole | |
1549 new_in_merge_already_good.changed | |
1550 new_in_r1.changed | |
1551 new_in_r1.ignored | |
1552 new_in_r1.whole | |
1553 new_in_r1_already_good.changed | |
1554 new_in_r2.changed | |
1555 new_in_r2.ignored | |
1556 new_in_r2.whole | |
1557 new_in_r2_already_good.changed | |
1558 r0.changed | |
1559 r0.ignored | |
1560 r0.whole | |
1561 $ for f in "$(hg files -r tip)"; do hg cat -r tip $f -T'{path}:\n{data}\n'; done | |
1562 mod_in_child.changed: | |
1563 hello | |
1564 WORLD | |
1565 | |
1566 mod_in_child.ignored: | |
1567 hello | |
1568 world | |
1569 | |
1570 mod_in_child.whole: | |
1571 HELLO | |
1572 WORLD | |
1573 | |
1574 mod_in_child_already_good.changed: | |
1575 WORLD | |
1576 | |
1577 mod_in_merge.changed: | |
1578 hello | |
1579 WORLD | |
1580 | |
1581 mod_in_merge.ignored: | |
1582 hello | |
1583 world | |
1584 | |
1585 mod_in_merge.whole: | |
1586 HELLO | |
1587 WORLD | |
1588 | |
1589 mod_in_merge_already_good.changed: | |
1590 WORLD | |
1591 | |
1592 mod_in_mod_in_child_already_good.changed: | |
1593 HELLO | |
1594 | |
1595 mod_in_mod_in_merge_already_good.changed: | |
1596 HELLO | |
1597 | |
1598 mod_in_mod_in_r1_already_good.changed: | |
1599 HELLO | |
1600 | |
1601 mod_in_mod_in_r2_already_good.changed: | |
1602 HELLO | |
1603 | |
1604 mod_in_r0_already_good.changed: | |
1605 HELLO | |
1606 | |
1607 mod_in_r1.changed: | |
1608 hello | |
1609 WORLD | |
1610 | |
1611 mod_in_r1.ignored: | |
1612 hello | |
1613 world | |
1614 | |
1615 mod_in_r1.whole: | |
1616 HELLO | |
1617 WORLD | |
1618 | |
1619 mod_in_r1_already_good.changed: | |
1620 WORLD | |
1621 | |
1622 mod_in_r2.changed: | |
1623 hello | |
1624 WORLD | |
1625 | |
1626 mod_in_r2.ignored: | |
1627 hello | |
1628 world | |
1629 | |
1630 mod_in_r2.whole: | |
1631 HELLO | |
1632 WORLD | |
1633 | |
1634 mod_in_r2_already_good.changed: | |
1635 WORLD | |
1636 | |
1637 new_in_child.changed: | |
1638 NEW IN CHILD | |
1639 | |
1640 new_in_child.ignored: | |
1641 new in child | |
1642 | |
1643 new_in_child.whole: | |
1644 NEW IN CHILD | |
1645 | |
1646 new_in_child_already_good.changed: | |
1647 ALREADY GOOD, NEW IN THIS REV | |
1648 | |
1649 new_in_merge.changed: | |
1650 NEW IN MERGE | |
1651 | |
1652 new_in_merge.ignored: | |
1653 new in merge | |
1654 | |
1655 new_in_merge.whole: | |
1656 NEW IN MERGE | |
1657 | |
1658 new_in_merge_already_good.changed: | |
1659 ALREADY GOOD, NEW IN THIS REV | |
1660 | |
1661 new_in_r1.changed: | |
1662 NEW IN R1 | |
1663 | |
1664 new_in_r1.ignored: | |
1665 new in r1 | |
1666 | |
1667 new_in_r1.whole: | |
1668 NEW IN R1 | |
1669 | |
1670 new_in_r1_already_good.changed: | |
1671 ALREADY GOOD, NEW IN THIS REV | |
1672 | |
1673 new_in_r2.changed: | |
1674 NEW IN R2 | |
1675 | |
1676 new_in_r2.ignored: | |
1677 new in r2 | |
1678 | |
1679 new_in_r2.whole: | |
1680 NEW IN R2 | |
1681 | |
1682 new_in_r2_already_good.changed: | |
1683 ALREADY GOOD, NEW IN THIS REV | |
1684 | |
1685 r0.changed: | |
1686 hello | |
1687 | |
1688 r0.ignored: | |
1689 hello | |
1690 | |
1691 r0.whole: | |
1692 hello | |
1693 |