tests/test-glog.t
changeset 34073 7bbc4e113e5f
parent 33957 04518bd58e8a
child 34661 eb586ed5d8ce
equal deleted inserted replaced
34072:30535fe47e78 34073:7bbc4e113e5f
  1461   (group
  1461   (group
  1462     (group
  1462     (group
  1463       (or
  1463       (or
  1464         (list
  1464         (list
  1465           (func
  1465           (func
  1466             ('symbol', 'user')
  1466             (symbol 'user')
  1467             ('string', 'test'))
  1467             (string 'test'))
  1468           (func
  1468           (func
  1469             ('symbol', 'user')
  1469             (symbol 'user')
  1470             ('string', 'not-a-user'))))))
  1470             (string 'not-a-user'))))))
  1471   $ testlog -b not-a-branch
  1471   $ testlog -b not-a-branch
  1472   abort: unknown revision 'not-a-branch'!
  1472   abort: unknown revision 'not-a-branch'!
  1473   abort: unknown revision 'not-a-branch'!
  1473   abort: unknown revision 'not-a-branch'!
  1474   abort: unknown revision 'not-a-branch'!
  1474   abort: unknown revision 'not-a-branch'!
  1475   $ testlog -b 35 -b 36 --only-branch branch
  1475   $ testlog -b 35 -b 36 --only-branch branch
  1477   (group
  1477   (group
  1478     (group
  1478     (group
  1479       (or
  1479       (or
  1480         (list
  1480         (list
  1481           (func
  1481           (func
  1482             ('symbol', 'branch')
  1482             (symbol 'branch')
  1483             ('string', 'default'))
  1483             (string 'default'))
  1484           (func
  1484           (func
  1485             ('symbol', 'branch')
  1485             (symbol 'branch')
  1486             ('string', 'branch'))
  1486             (string 'branch'))
  1487           (func
  1487           (func
  1488             ('symbol', 'branch')
  1488             (symbol 'branch')
  1489             ('string', 'branch'))))))
  1489             (string 'branch'))))))
  1490   $ testlog -k expand -k merge
  1490   $ testlog -k expand -k merge
  1491   []
  1491   []
  1492   (group
  1492   (group
  1493     (group
  1493     (group
  1494       (or
  1494       (or
  1495         (list
  1495         (list
  1496           (func
  1496           (func
  1497             ('symbol', 'keyword')
  1497             (symbol 'keyword')
  1498             ('string', 'expand'))
  1498             (string 'expand'))
  1499           (func
  1499           (func
  1500             ('symbol', 'keyword')
  1500             (symbol 'keyword')
  1501             ('string', 'merge'))))))
  1501             (string 'merge'))))))
  1502   $ testlog --only-merges
  1502   $ testlog --only-merges
  1503   []
  1503   []
  1504   (group
  1504   (group
  1505     (func
  1505     (func
  1506       ('symbol', 'merge')
  1506       (symbol 'merge')
  1507       None))
  1507       None))
  1508   $ testlog --no-merges
  1508   $ testlog --no-merges
  1509   []
  1509   []
  1510   (group
  1510   (group
  1511     (not
  1511     (not
  1512       (func
  1512       (func
  1513         ('symbol', 'merge')
  1513         (symbol 'merge')
  1514         None)))
  1514         None)))
  1515   $ testlog --date '2 0 to 4 0'
  1515   $ testlog --date '2 0 to 4 0'
  1516   []
  1516   []
  1517   (group
  1517   (group
  1518     (func
  1518     (func
  1519       ('symbol', 'date')
  1519       (symbol 'date')
  1520       ('string', '2 0 to 4 0')))
  1520       (string '2 0 to 4 0')))
  1521   $ hg log -G -d 'brace ) in a date'
  1521   $ hg log -G -d 'brace ) in a date'
  1522   hg: parse error: invalid date: 'brace ) in a date'
  1522   hg: parse error: invalid date: 'brace ) in a date'
  1523   [255]
  1523   [255]
  1524   $ testlog --prune 31 --prune 32
  1524   $ testlog --prune 31 --prune 32
  1525   []
  1525   []
  1528       (and
  1528       (and
  1529         (not
  1529         (not
  1530           (group
  1530           (group
  1531             (or
  1531             (or
  1532               (list
  1532               (list
  1533                 ('string', '31')
  1533                 (string '31')
  1534                 (func
  1534                 (func
  1535                   ('symbol', 'ancestors')
  1535                   (symbol 'ancestors')
  1536                   ('string', '31'))))))
  1536                   (string '31'))))))
  1537         (not
  1537         (not
  1538           (group
  1538           (group
  1539             (or
  1539             (or
  1540               (list
  1540               (list
  1541                 ('string', '32')
  1541                 (string '32')
  1542                 (func
  1542                 (func
  1543                   ('symbol', 'ancestors')
  1543                   (symbol 'ancestors')
  1544                   ('string', '32')))))))))
  1544                   (string '32')))))))))
  1545 
  1545 
  1546 Dedicated repo for --follow and paths filtering. The g is crafted to
  1546 Dedicated repo for --follow and paths filtering. The g is crafted to
  1547 have 2 filelog topological heads in a linear changeset graph.
  1547 have 2 filelog topological heads in a linear changeset graph.
  1548 
  1548 
  1549   $ cd ..
  1549   $ cd ..
  1589   $ testlog a
  1589   $ testlog a
  1590   []
  1590   []
  1591   (group
  1591   (group
  1592     (group
  1592     (group
  1593       (func
  1593       (func
  1594         ('symbol', 'filelog')
  1594         (symbol 'filelog')
  1595         ('string', 'a'))))
  1595         (string 'a'))))
  1596   $ testlog a b
  1596   $ testlog a b
  1597   []
  1597   []
  1598   (group
  1598   (group
  1599     (group
  1599     (group
  1600       (or
  1600       (or
  1601         (list
  1601         (list
  1602           (func
  1602           (func
  1603             ('symbol', 'filelog')
  1603             (symbol 'filelog')
  1604             ('string', 'a'))
  1604             (string 'a'))
  1605           (func
  1605           (func
  1606             ('symbol', 'filelog')
  1606             (symbol 'filelog')
  1607             ('string', 'b'))))))
  1607             (string 'b'))))))
  1608 
  1608 
  1609 Test falling back to slow path for non-existing files
  1609 Test falling back to slow path for non-existing files
  1610 
  1610 
  1611   $ testlog a c
  1611   $ testlog a c
  1612   []
  1612   []
  1613   (group
  1613   (group
  1614     (func
  1614     (func
  1615       ('symbol', '_matchfiles')
  1615       (symbol '_matchfiles')
  1616       (list
  1616       (list
  1617         ('string', 'r:')
  1617         (string 'r:')
  1618         ('string', 'd:relpath')
  1618         (string 'd:relpath')
  1619         ('string', 'p:a')
  1619         (string 'p:a')
  1620         ('string', 'p:c'))))
  1620         (string 'p:c'))))
  1621 
  1621 
  1622 Test multiple --include/--exclude/paths
  1622 Test multiple --include/--exclude/paths
  1623 
  1623 
  1624   $ testlog --include a --include e --exclude b --exclude e a e
  1624   $ testlog --include a --include e --exclude b --exclude e a e
  1625   []
  1625   []
  1626   (group
  1626   (group
  1627     (func
  1627     (func
  1628       ('symbol', '_matchfiles')
  1628       (symbol '_matchfiles')
  1629       (list
  1629       (list
  1630         ('string', 'r:')
  1630         (string 'r:')
  1631         ('string', 'd:relpath')
  1631         (string 'd:relpath')
  1632         ('string', 'p:a')
  1632         (string 'p:a')
  1633         ('string', 'p:e')
  1633         (string 'p:e')
  1634         ('string', 'i:a')
  1634         (string 'i:a')
  1635         ('string', 'i:e')
  1635         (string 'i:e')
  1636         ('string', 'x:b')
  1636         (string 'x:b')
  1637         ('string', 'x:e'))))
  1637         (string 'x:e'))))
  1638 
  1638 
  1639 Test glob expansion of pats
  1639 Test glob expansion of pats
  1640 
  1640 
  1641   $ expandglobs=`$PYTHON -c "import mercurial.util; \
  1641   $ expandglobs=`$PYTHON -c "import mercurial.util; \
  1642   >   print(mercurial.util.expandglobs and 'true' or 'false')"`
  1642   >   print(mercurial.util.expandglobs and 'true' or 'false')"`
  1647   > fi;
  1647   > fi;
  1648   []
  1648   []
  1649   (group
  1649   (group
  1650     (group
  1650     (group
  1651       (func
  1651       (func
  1652         ('symbol', 'filelog')
  1652         (symbol 'filelog')
  1653         ('string', 'aa'))))
  1653         (string 'aa'))))
  1654 
  1654 
  1655 Test --follow on a non-existent directory
  1655 Test --follow on a non-existent directory
  1656 
  1656 
  1657   $ testlog -f dir
  1657   $ testlog -f dir
  1658   abort: cannot follow file not in parent revision: "dir"
  1658   abort: cannot follow file not in parent revision: "dir"
  1665   $ testlog -f dir
  1665   $ testlog -f dir
  1666   []
  1666   []
  1667   (group
  1667   (group
  1668     (and
  1668     (and
  1669       (func
  1669       (func
  1670         ('symbol', 'ancestors')
  1670         (symbol 'ancestors')
  1671         ('symbol', '.'))
  1671         (symbol '.'))
  1672       (func
  1672       (func
  1673         ('symbol', '_matchfiles')
  1673         (symbol '_matchfiles')
  1674         (list
  1674         (list
  1675           ('string', 'r:')
  1675           (string 'r:')
  1676           ('string', 'd:relpath')
  1676           (string 'd:relpath')
  1677           ('string', 'p:dir')))))
  1677           (string 'p:dir')))))
  1678   $ hg up -q tip
  1678   $ hg up -q tip
  1679 
  1679 
  1680 Test --follow on file not in parent revision
  1680 Test --follow on file not in parent revision
  1681 
  1681 
  1682   $ testlog -f a
  1682   $ testlog -f a
  1689   $ testlog -f 'glob:*'
  1689   $ testlog -f 'glob:*'
  1690   []
  1690   []
  1691   (group
  1691   (group
  1692     (and
  1692     (and
  1693       (func
  1693       (func
  1694         ('symbol', 'ancestors')
  1694         (symbol 'ancestors')
  1695         ('symbol', '.'))
  1695         (symbol '.'))
  1696       (func
  1696       (func
  1697         ('symbol', '_matchfiles')
  1697         (symbol '_matchfiles')
  1698         (list
  1698         (list
  1699           ('string', 'r:')
  1699           (string 'r:')
  1700           ('string', 'd:relpath')
  1700           (string 'd:relpath')
  1701           ('string', 'p:glob:*')))))
  1701           (string 'p:glob:*')))))
  1702 
  1702 
  1703 Test --follow on a single rename
  1703 Test --follow on a single rename
  1704 
  1704 
  1705   $ hg up -q 2
  1705   $ hg up -q 2
  1706   $ testlog -f a
  1706   $ testlog -f a
  1707   []
  1707   []
  1708   (group
  1708   (group
  1709     (group
  1709     (group
  1710       (func
  1710       (func
  1711         ('symbol', 'follow')
  1711         (symbol 'follow')
  1712         ('string', 'a'))))
  1712         (string 'a'))))
  1713 
  1713 
  1714 Test --follow and multiple renames
  1714 Test --follow and multiple renames
  1715 
  1715 
  1716   $ hg up -q tip
  1716   $ hg up -q tip
  1717   $ testlog -f e
  1717   $ testlog -f e
  1718   []
  1718   []
  1719   (group
  1719   (group
  1720     (group
  1720     (group
  1721       (func
  1721       (func
  1722         ('symbol', 'follow')
  1722         (symbol 'follow')
  1723         ('string', 'e'))))
  1723         (string 'e'))))
  1724 
  1724 
  1725 Test --follow and multiple filelog heads
  1725 Test --follow and multiple filelog heads
  1726 
  1726 
  1727   $ hg up -q 2
  1727   $ hg up -q 2
  1728   $ testlog -f g
  1728   $ testlog -f g
  1729   []
  1729   []
  1730   (group
  1730   (group
  1731     (group
  1731     (group
  1732       (func
  1732       (func
  1733         ('symbol', 'follow')
  1733         (symbol 'follow')
  1734         ('string', 'g'))))
  1734         (string 'g'))))
  1735   $ cat log.nodes
  1735   $ cat log.nodes
  1736   nodetag 2
  1736   nodetag 2
  1737   nodetag 1
  1737   nodetag 1
  1738   nodetag 0
  1738   nodetag 0
  1739   $ hg up -q tip
  1739   $ hg up -q tip
  1740   $ testlog -f g
  1740   $ testlog -f g
  1741   []
  1741   []
  1742   (group
  1742   (group
  1743     (group
  1743     (group
  1744       (func
  1744       (func
  1745         ('symbol', 'follow')
  1745         (symbol 'follow')
  1746         ('string', 'g'))))
  1746         (string 'g'))))
  1747   $ cat log.nodes
  1747   $ cat log.nodes
  1748   nodetag 3
  1748   nodetag 3
  1749   nodetag 2
  1749   nodetag 2
  1750   nodetag 0
  1750   nodetag 0
  1751 
  1751 
  1756   (group
  1756   (group
  1757     (group
  1757     (group
  1758       (or
  1758       (or
  1759         (list
  1759         (list
  1760           (func
  1760           (func
  1761             ('symbol', 'follow')
  1761             (symbol 'follow')
  1762             ('string', 'g'))
  1762             (string 'g'))
  1763           (func
  1763           (func
  1764             ('symbol', 'follow')
  1764             (symbol 'follow')
  1765             ('string', 'e'))))))
  1765             (string 'e'))))))
  1766   $ cat log.nodes
  1766   $ cat log.nodes
  1767   nodetag 4
  1767   nodetag 4
  1768   nodetag 3
  1768   nodetag 3
  1769   nodetag 2
  1769   nodetag 2
  1770   nodetag 1
  1770   nodetag 1
  1790   $ hg ci -m "merge 5 and 4"
  1790   $ hg ci -m "merge 5 and 4"
  1791   $ testlog --follow-first
  1791   $ testlog --follow-first
  1792   []
  1792   []
  1793   (group
  1793   (group
  1794     (func
  1794     (func
  1795       ('symbol', '_firstancestors')
  1795       (symbol '_firstancestors')
  1796       (func
  1796       (func
  1797         ('symbol', 'rev')
  1797         (symbol 'rev')
  1798         ('symbol', '6'))))
  1798         (symbol '6'))))
  1799 
  1799 
  1800 Cannot compare with log --follow-first FILE as it never worked
  1800 Cannot compare with log --follow-first FILE as it never worked
  1801 
  1801 
  1802   $ hg log -G --print-revset --follow-first e
  1802   $ hg log -G --print-revset --follow-first e
  1803   []
  1803   []
  1804   (group
  1804   (group
  1805     (group
  1805     (group
  1806       (func
  1806       (func
  1807         ('symbol', '_followfirst')
  1807         (symbol '_followfirst')
  1808         ('string', 'e'))))
  1808         (string 'e'))))
  1809   $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
  1809   $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
  1810   @    6 merge 5 and 4
  1810   @    6 merge 5 and 4
  1811   |\
  1811   |\
  1812   | ~
  1812   | ~
  1813   o  5 add another e
  1813   o  5 add another e
  1837   $ hg up -q 4
  1837   $ hg up -q 4
  1838   $ testlog "set:copied()"
  1838   $ testlog "set:copied()"
  1839   []
  1839   []
  1840   (group
  1840   (group
  1841     (func
  1841     (func
  1842       ('symbol', '_matchfiles')
  1842       (symbol '_matchfiles')
  1843       (list
  1843       (list
  1844         ('string', 'r:')
  1844         (string 'r:')
  1845         ('string', 'd:relpath')
  1845         (string 'd:relpath')
  1846         ('string', 'p:set:copied()'))))
  1846         (string 'p:set:copied()'))))
  1847   $ testlog --include "set:copied()"
  1847   $ testlog --include "set:copied()"
  1848   []
  1848   []
  1849   (group
  1849   (group
  1850     (func
  1850     (func
  1851       ('symbol', '_matchfiles')
  1851       (symbol '_matchfiles')
  1852       (list
  1852       (list
  1853         ('string', 'r:')
  1853         (string 'r:')
  1854         ('string', 'd:relpath')
  1854         (string 'd:relpath')
  1855         ('string', 'i:set:copied()'))))
  1855         (string 'i:set:copied()'))))
  1856   $ testlog -r "sort(file('set:copied()'), -rev)"
  1856   $ testlog -r "sort(file('set:copied()'), -rev)"
  1857   ["sort(file('set:copied()'), -rev)"]
  1857   ["sort(file('set:copied()'), -rev)"]
  1858   []
  1858   []
  1859 
  1859 
  1860 Test --removed
  1860 Test --removed
  1864   []
  1864   []
  1865   $ testlog --removed a
  1865   $ testlog --removed a
  1866   []
  1866   []
  1867   (group
  1867   (group
  1868     (func
  1868     (func
  1869       ('symbol', '_matchfiles')
  1869       (symbol '_matchfiles')
  1870       (list
  1870       (list
  1871         ('string', 'r:')
  1871         (string 'r:')
  1872         ('string', 'd:relpath')
  1872         (string 'd:relpath')
  1873         ('string', 'p:a'))))
  1873         (string 'p:a'))))
  1874   $ testlog --removed --follow a
  1874   $ testlog --removed --follow a
  1875   []
  1875   []
  1876   (group
  1876   (group
  1877     (and
  1877     (and
  1878       (func
  1878       (func
  1879         ('symbol', 'ancestors')
  1879         (symbol 'ancestors')
  1880         ('symbol', '.'))
  1880         (symbol '.'))
  1881       (func
  1881       (func
  1882         ('symbol', '_matchfiles')
  1882         (symbol '_matchfiles')
  1883         (list
  1883         (list
  1884           ('string', 'r:')
  1884           (string 'r:')
  1885           ('string', 'd:relpath')
  1885           (string 'd:relpath')
  1886           ('string', 'p:a')))))
  1886           (string 'p:a')))))
  1887 
  1887 
  1888 Test --patch and --stat with --follow and --follow-first
  1888 Test --patch and --stat with --follow and --follow-first
  1889 
  1889 
  1890   $ hg up -q 3
  1890   $ hg up -q 3
  1891   $ hg log -G --git --patch b
  1891   $ hg log -G --git --patch b
  2207   +g
  2207   +g
  2208   $ testlog --follow -r6 -r8 -r5 -r7 -r4
  2208   $ testlog --follow -r6 -r8 -r5 -r7 -r4
  2209   ['6', '8', '5', '7', '4']
  2209   ['6', '8', '5', '7', '4']
  2210   (group
  2210   (group
  2211     (func
  2211     (func
  2212       ('symbol', 'descendants')
  2212       (symbol 'descendants')
  2213       (func
  2213       (func
  2214         ('symbol', 'rev')
  2214         (symbol 'rev')
  2215         ('symbol', '6'))))
  2215         (symbol '6'))))
  2216 
  2216 
  2217 Test --follow-first and forward --rev
  2217 Test --follow-first and forward --rev
  2218 
  2218 
  2219   $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
  2219   $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
  2220   ['6', '8', '5', '7', '4']
  2220   ['6', '8', '5', '7', '4']
  2221   (group
  2221   (group
  2222     (func
  2222     (func
  2223       ('symbol', '_firstdescendants')
  2223       (symbol '_firstdescendants')
  2224       (func
  2224       (func
  2225         ('symbol', 'rev')
  2225         (symbol 'rev')
  2226         ('symbol', '6'))))
  2226         (symbol '6'))))
  2227   --- log.nodes	* (glob)
  2227   --- log.nodes	* (glob)
  2228   +++ glog.nodes	* (glob)
  2228   +++ glog.nodes	* (glob)
  2229   @@ -1,3 +1,3 @@
  2229   @@ -1,3 +1,3 @@
  2230   -nodetag 6
  2230   -nodetag 6
  2231    nodetag 8
  2231    nodetag 8
  2236 
  2236 
  2237   $ testlog --follow -r6 -r5 -r7 -r8 -r4
  2237   $ testlog --follow -r6 -r5 -r7 -r8 -r4
  2238   ['6', '5', '7', '8', '4']
  2238   ['6', '5', '7', '8', '4']
  2239   (group
  2239   (group
  2240     (func
  2240     (func
  2241       ('symbol', 'ancestors')
  2241       (symbol 'ancestors')
  2242       (func
  2242       (func
  2243         ('symbol', 'rev')
  2243         (symbol 'rev')
  2244         ('symbol', '6'))))
  2244         (symbol '6'))))
  2245 
  2245 
  2246 Test --follow-first and backward --rev
  2246 Test --follow-first and backward --rev
  2247 
  2247 
  2248   $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
  2248   $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
  2249   ['6', '5', '7', '8', '4']
  2249   ['6', '5', '7', '8', '4']
  2250   (group
  2250   (group
  2251     (func
  2251     (func
  2252       ('symbol', '_firstancestors')
  2252       (symbol '_firstancestors')
  2253       (func
  2253       (func
  2254         ('symbol', 'rev')
  2254         (symbol 'rev')
  2255         ('symbol', '6'))))
  2255         (symbol '6'))))
  2256 
  2256 
  2257 Test --follow with --rev of graphlog extension
  2257 Test --follow with --rev of graphlog extension
  2258 
  2258 
  2259   $ hg --config extensions.graphlog= glog -qfr1
  2259   $ hg --config extensions.graphlog= glog -qfr1
  2260   o  1:216d4c92cf98
  2260   o  1:216d4c92cf98
  2268   $ cd dir
  2268   $ cd dir
  2269   $ testlog .
  2269   $ testlog .
  2270   []
  2270   []
  2271   (group
  2271   (group
  2272     (func
  2272     (func
  2273       ('symbol', '_matchfiles')
  2273       (symbol '_matchfiles')
  2274       (list
  2274       (list
  2275         ('string', 'r:')
  2275         (string 'r:')
  2276         ('string', 'd:relpath')
  2276         (string 'd:relpath')
  2277         ('string', 'p:.'))))
  2277         (string 'p:.'))))
  2278   $ testlog ../b
  2278   $ testlog ../b
  2279   []
  2279   []
  2280   (group
  2280   (group
  2281     (group
  2281     (group
  2282       (func
  2282       (func
  2283         ('symbol', 'filelog')
  2283         (symbol 'filelog')
  2284         ('string', '../b'))))
  2284         (string '../b'))))
  2285   $ testlog -f ../b
  2285   $ testlog -f ../b
  2286   []
  2286   []
  2287   (group
  2287   (group
  2288     (group
  2288     (group
  2289       (func
  2289       (func
  2290         ('symbol', 'follow')
  2290         (symbol 'follow')
  2291         ('string', 'b'))))
  2291         (string 'b'))))
  2292   $ cd ..
  2292   $ cd ..
  2293 
  2293 
  2294 Test --hidden
  2294 Test --hidden
  2295  (enable obsolete)
  2295  (enable obsolete)
  2296 
  2296