##// END OF EJS Templates
test-glog: pretty print revset expressions
Patrick Mezard -
r16315:f89284d7 default
parent child Browse files
Show More
@@ -92,7 +92,7 b' o (0) root'
92 92 > if opts.get('print_revset'):
93 93 > expr = graphlog.revset(repo, pats, opts)[0]
94 94 > tree = revset.parse(expr)[0]
95 > ui.write(tree, "\n")
95 > ui.write(revset.prettyformat(tree), "\n")
96 96 > return 0
97 97 > return orig(ui, repo, *pats, **opts)
98 98 > entry = extensions.wrapcommand(commands.table, 'log', printrevset)
@@ -1430,7 +1430,19 b' Test log -G options'
1430 1430 glog always reorders nodes which explains the difference with log
1431 1431
1432 1432 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1433 ('group', ('group', ('or', ('or', ('or', ('or', ('or', ('symbol', '27'), ('symbol', '25')), ('symbol', '21')), ('symbol', '34')), ('symbol', '32')), ('symbol', '31'))))
1433 (group
1434 (group
1435 (or
1436 (or
1437 (or
1438 (or
1439 (or
1440 ('symbol', '27')
1441 ('symbol', '25'))
1442 ('symbol', '21'))
1443 ('symbol', '34'))
1444 ('symbol', '32'))
1445 ('symbol', '31'))))
1434 1446 --- log.nodes * (glob)
1435 1447 +++ glog.nodes * (glob)
1436 1448 @@ -1,6 +1,6 @@
@@ -1445,26 +1457,84 b' glog always reorders nodes which explain'
1445 1457 +nodetag 21
1446 1458 [1]
1447 1459 $ testlog -u test -u not-a-user
1448 ('group', ('group', ('or', ('func', ('symbol', 'user'), ('string', 'test')), ('func', ('symbol', 'user'), ('string', 'not-a-user')))))
1460 (group
1461 (group
1462 (or
1463 (func
1464 ('symbol', 'user')
1465 ('string', 'test'))
1466 (func
1467 ('symbol', 'user')
1468 ('string', 'not-a-user')))))
1449 1469 $ testlog -b not-a-branch
1450 ('group', ('group', ('func', ('symbol', 'branch'), ('string', 'not-a-branch'))))
1470 (group
1471 (group
1472 (func
1473 ('symbol', 'branch')
1474 ('string', 'not-a-branch'))))
1451 1475 abort: unknown revision 'not-a-branch'!
1452 1476 abort: unknown revision 'not-a-branch'!
1453 1477 $ testlog -b default -b branch --only-branch branch
1454 ('group', ('group', ('or', ('or', ('func', ('symbol', 'branch'), ('string', 'default')), ('func', ('symbol', 'branch'), ('string', 'branch'))), ('func', ('symbol', 'branch'), ('string', 'branch')))))
1478 (group
1479 (group
1480 (or
1481 (or
1482 (func
1483 ('symbol', 'branch')
1484 ('string', 'default'))
1485 (func
1486 ('symbol', 'branch')
1487 ('string', 'branch')))
1488 (func
1489 ('symbol', 'branch')
1490 ('string', 'branch')))))
1455 1491 $ testlog -k expand -k merge
1456 ('group', ('group', ('or', ('func', ('symbol', 'keyword'), ('string', 'expand')), ('func', ('symbol', 'keyword'), ('string', 'merge')))))
1492 (group
1493 (group
1494 (or
1495 (func
1496 ('symbol', 'keyword')
1497 ('string', 'expand'))
1498 (func
1499 ('symbol', 'keyword')
1500 ('string', 'merge')))))
1457 1501 $ testlog --only-merges
1458 ('group', ('func', ('symbol', 'merge'), None))
1502 (group
1503 (func
1504 ('symbol', 'merge')
1505 None))
1459 1506 $ testlog --no-merges
1460 ('group', ('not', ('func', ('symbol', 'merge'), None)))
1507 (group
1508 (not
1509 (func
1510 ('symbol', 'merge')
1511 None)))
1461 1512 $ testlog --date '2 0 to 4 0'
1462 ('group', ('func', ('symbol', 'date'), ('string', '2 0 to 4 0')))
1513 (group
1514 (func
1515 ('symbol', 'date')
1516 ('string', '2 0 to 4 0')))
1463 1517 $ hg log -G -d 'brace ) in a date'
1464 1518 abort: invalid date: 'brace ) in a date'
1465 1519 [255]
1466 1520 $ testlog --prune 31 --prune 32
1467 ('group', ('group', ('and', ('not', ('group', ('or', ('string', '31'), ('func', ('symbol', 'ancestors'), ('string', '31'))))), ('not', ('group', ('or', ('string', '32'), ('func', ('symbol', 'ancestors'), ('string', '32'))))))))
1521 (group
1522 (group
1523 (and
1524 (not
1525 (group
1526 (or
1527 ('string', '31')
1528 (func
1529 ('symbol', 'ancestors')
1530 ('string', '31')))))
1531 (not
1532 (group
1533 (or
1534 ('string', '32')
1535 (func
1536 ('symbol', 'ancestors')
1537 ('string', '32'))))))))
1468 1538
1469 1539 Dedicated repo for --follow and paths filtering. The g is crafted to
1470 1540 have 2 filelog topological heads in a linear changeset graph.
@@ -1507,19 +1577,55 b' have 2 filelog topological heads in a li'
1507 1577
1508 1578
1509 1579 $ testlog a
1510 ('group', ('group', ('func', ('symbol', 'filelog'), ('string', 'a'))))
1580 (group
1581 (group
1582 (func
1583 ('symbol', 'filelog')
1584 ('string', 'a'))))
1511 1585 $ testlog a b
1512 ('group', ('group', ('or', ('func', ('symbol', 'filelog'), ('string', 'a')), ('func', ('symbol', 'filelog'), ('string', 'b')))))
1586 (group
1587 (group
1588 (or
1589 (func
1590 ('symbol', 'filelog')
1591 ('string', 'a'))
1592 (func
1593 ('symbol', 'filelog')
1594 ('string', 'b')))))
1513 1595
1514 1596 Test falling back to slow path for non-existing files
1515 1597
1516 1598 $ testlog a c
1517 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('list', ('string', 'r:'), ('string', 'p:a')), ('string', 'p:c')))))
1599 (group
1600 (group
1601 (func
1602 ('symbol', '_matchfiles')
1603 (list
1604 (list
1605 ('string', 'r:')
1606 ('string', 'p:a'))
1607 ('string', 'p:c')))))
1518 1608
1519 1609 Test multiple --include/--exclude/paths
1520 1610
1521 1611 $ testlog --include a --include e --exclude b --exclude e a e
1522 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('list', ('list', ('list', ('list', ('list', ('string', 'r:'), ('string', 'p:a')), ('string', 'p:e')), ('string', 'i:a')), ('string', 'i:e')), ('string', 'x:b')), ('string', 'x:e')))))
1612 (group
1613 (group
1614 (func
1615 ('symbol', '_matchfiles')
1616 (list
1617 (list
1618 (list
1619 (list
1620 (list
1621 (list
1622 ('string', 'r:')
1623 ('string', 'p:a'))
1624 ('string', 'p:e'))
1625 ('string', 'i:a'))
1626 ('string', 'i:e'))
1627 ('string', 'x:b'))
1628 ('string', 'x:e')))))
1523 1629
1524 1630 Test glob expansion of pats
1525 1631
@@ -1530,7 +1636,11 b' Test glob expansion of pats'
1530 1636 > else
1531 1637 > testlog a*;
1532 1638 > fi;
1533 ('group', ('group', ('func', ('symbol', 'filelog'), ('string', 'aa'))))
1639 (group
1640 (group
1641 (func
1642 ('symbol', 'filelog')
1643 ('string', 'aa'))))
1534 1644
1535 1645 Test --follow on a directory
1536 1646
@@ -1557,26 +1667,42 b' Test --follow on a single rename'
1557 1667
1558 1668 $ hg up -q 2
1559 1669 $ testlog -f a
1560 ('group', ('group', ('func', ('symbol', 'follow'), ('string', 'a'))))
1670 (group
1671 (group
1672 (func
1673 ('symbol', 'follow')
1674 ('string', 'a'))))
1561 1675
1562 1676 Test --follow and multiple renames
1563 1677
1564 1678 $ hg up -q tip
1565 1679 $ testlog -f e
1566 ('group', ('group', ('func', ('symbol', 'follow'), ('string', 'e'))))
1680 (group
1681 (group
1682 (func
1683 ('symbol', 'follow')
1684 ('string', 'e'))))
1567 1685
1568 1686 Test --follow and multiple filelog heads
1569 1687
1570 1688 $ hg up -q 2
1571 1689 $ testlog -f g
1572 ('group', ('group', ('func', ('symbol', 'follow'), ('string', 'g'))))
1690 (group
1691 (group
1692 (func
1693 ('symbol', 'follow')
1694 ('string', 'g'))))
1573 1695 $ cat log.nodes
1574 1696 nodetag 2
1575 1697 nodetag 1
1576 1698 nodetag 0
1577 1699 $ hg up -q tip
1578 1700 $ testlog -f g
1579 ('group', ('group', ('func', ('symbol', 'follow'), ('string', 'g'))))
1701 (group
1702 (group
1703 (func
1704 ('symbol', 'follow')
1705 ('string', 'g'))))
1580 1706 $ cat log.nodes
1581 1707 nodetag 3
1582 1708 nodetag 2
@@ -1585,7 +1711,15 b' Test --follow and multiple filelog heads'
1585 1711 Test --follow and multiple files
1586 1712
1587 1713 $ testlog -f g e
1588 ('group', ('group', ('or', ('func', ('symbol', 'follow'), ('string', 'g')), ('func', ('symbol', 'follow'), ('string', 'e')))))
1714 (group
1715 (group
1716 (or
1717 (func
1718 ('symbol', 'follow')
1719 ('string', 'g'))
1720 (func
1721 ('symbol', 'follow')
1722 ('string', 'e')))))
1589 1723 $ cat log.nodes
1590 1724 nodetag 4
1591 1725 nodetag 3
@@ -1605,12 +1739,19 b' Test --follow-first'
1605 1739 $ echo merge > e
1606 1740 $ hg ci -m "merge 5 and 4"
1607 1741 $ testlog --follow-first
1608 ('group', ('func', ('symbol', '_followfirst'), None))
1742 (group
1743 (func
1744 ('symbol', '_followfirst')
1745 None))
1609 1746
1610 1747 Cannot compare with log --follow-first FILE as it never worked
1611 1748
1612 1749 $ hg log -G --print-revset --follow-first e
1613 ('group', ('group', ('func', ('symbol', '_followfirst'), ('string', 'e'))))
1750 (group
1751 (group
1752 (func
1753 ('symbol', '_followfirst')
1754 ('string', 'e'))))
1614 1755 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1615 1756 @ 6 merge 5 and 4
1616 1757 |\
@@ -1639,18 +1780,47 b' Test "set:..." and parent revision'
1639 1780
1640 1781 $ hg up -q 4
1641 1782 $ testlog "set:copied()"
1642 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'r:'), ('string', 'p:set:copied()')))))
1783 (group
1784 (group
1785 (func
1786 ('symbol', '_matchfiles')
1787 (list
1788 ('string', 'r:')
1789 ('string', 'p:set:copied()')))))
1643 1790 $ testlog --include "set:copied()"
1644 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'r:'), ('string', 'i:set:copied()')))))
1791 (group
1792 (group
1793 (func
1794 ('symbol', '_matchfiles')
1795 (list
1796 ('string', 'r:')
1797 ('string', 'i:set:copied()')))))
1645 1798 $ testlog -r "sort(file('set:copied()'), -rev)"
1646 ('group', ('group', ('func', ('symbol', 'sort'), ('list', ('func', ('symbol', 'file'), ('string', 'set:copied()')), ('negate', ('symbol', 'rev'))))))
1799 (group
1800 (group
1801 (func
1802 ('symbol', 'sort')
1803 (list
1804 (func
1805 ('symbol', 'file')
1806 ('string', 'set:copied()'))
1807 (negate
1808 ('symbol', 'rev'))))))
1647 1809
1648 1810 Test --removed
1649 1811
1650 1812 $ testlog --removed
1651 ('func', ('symbol', 'all'), None)
1813 (func
1814 ('symbol', 'all')
1815 None)
1652 1816 $ testlog --removed a
1653 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'r:'), ('string', 'p:a')))))
1817 (group
1818 (group
1819 (func
1820 ('symbol', '_matchfiles')
1821 (list
1822 ('string', 'r:')
1823 ('string', 'p:a')))))
1654 1824 $ testlog --removed --follow a
1655 1825 abort: can only follow copies/renames for explicit filenames
1656 1826 abort: can only follow copies/renames for explicit filenames
General Comments 0
You need to be logged in to leave comments. Login now