Show More
@@ -340,7 +340,7 b' def _makelogrevset(repo, pats, opts, rev' | |||
|
340 | 340 | # "a" and "b" while "file(a) and not file(b)" does |
|
341 | 341 | # not. Besides, filesets are evaluated against the working |
|
342 | 342 | # directory. |
|
343 | matchargs = ['r:'] | |
|
343 | matchargs = ['r:', 'd:relpath'] | |
|
344 | 344 | for p in pats: |
|
345 | 345 | matchargs.append('p:' + p) |
|
346 | 346 | for p in opts.get('include', []): |
@@ -559,13 +559,14 b' def _matchfiles(repo, subset, x):' | |||
|
559 | 559 | # patterns and 'x:' for exclude patterns. Use 'r:' prefix to pass |
|
560 | 560 | # a revision identifier, or the empty string to reference the |
|
561 | 561 | # working directory, from which the match object is |
|
562 | # initialized. At most one 'r:' argument can be passed. | |
|
562 | # initialized. Use 'd:' to set the default matching mode, default | |
|
563 | # to 'glob'. At most one 'r:' and 'd:' argument can be passed. | |
|
563 | 564 | |
|
564 | 565 | # i18n: "_matchfiles" is a keyword |
|
565 | 566 | l = getargs(x, 1, -1, _("_matchfiles requires at least one argument")) |
|
566 | 567 | pats, inc, exc = [], [], [] |
|
567 | 568 | hasset = False |
|
568 | rev = None | |
|
569 | rev, default = None, None | |
|
569 | 570 | for arg in l: |
|
570 | 571 | s = getstring(arg, _("_matchfiles requires string arguments")) |
|
571 | 572 | prefix, value = s[:2], s[2:] |
@@ -580,10 +581,17 b' def _matchfiles(repo, subset, x):' | |||
|
580 | 581 | raise error.ParseError(_('_matchfiles expected at most one ' |
|
581 | 582 | 'revision')) |
|
582 | 583 | rev = value |
|
584 | elif prefix == 'd:': | |
|
585 | if default is not None: | |
|
586 | raise error.ParseError(_('_matchfiles expected at most one ' | |
|
587 | 'default mode')) | |
|
588 | default = value | |
|
583 | 589 | else: |
|
584 | 590 | raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) |
|
585 | 591 | if not hasset and matchmod.patkind(value) == 'set': |
|
586 | 592 | hasset = True |
|
593 | if not default: | |
|
594 | default = 'glob' | |
|
587 | 595 | m = None |
|
588 | 596 | s = [] |
|
589 | 597 | for r in subset: |
@@ -593,7 +601,7 b' def _matchfiles(repo, subset, x):' | |||
|
593 | 601 | if rev is not None: |
|
594 | 602 | ctx = repo[rev or None] |
|
595 | 603 | m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, |
|
596 | exclude=exc, ctx=ctx) | |
|
604 | exclude=exc, ctx=ctx, default=default) | |
|
597 | 605 | for f in c.files(): |
|
598 | 606 | if m(f): |
|
599 | 607 | s.append(r) |
@@ -1600,7 +1600,9 b' Test falling back to slow path for non-e' | |||
|
1600 | 1600 | ('symbol', '_matchfiles') |
|
1601 | 1601 | (list |
|
1602 | 1602 | (list |
|
1603 | (list | |
|
1603 | 1604 | ('string', 'r:') |
|
1605 | ('string', 'd:relpath')) | |
|
1604 | 1606 | ('string', 'p:a')) |
|
1605 | 1607 | ('string', 'p:c')))) |
|
1606 | 1608 | |
@@ -1617,7 +1619,9 b' Test multiple --include/--exclude/paths' | |||
|
1617 | 1619 | (list |
|
1618 | 1620 | (list |
|
1619 | 1621 | (list |
|
1622 | (list | |
|
1620 | 1623 | ('string', 'r:') |
|
1624 | ('string', 'd:relpath')) | |
|
1621 | 1625 | ('string', 'p:a')) |
|
1622 | 1626 | ('string', 'p:e')) |
|
1623 | 1627 | ('string', 'i:a')) |
@@ -1791,7 +1795,9 b' Test "set:..." and parent revision' | |||
|
1791 | 1795 | (func |
|
1792 | 1796 | ('symbol', '_matchfiles') |
|
1793 | 1797 | (list |
|
1798 | (list | |
|
1794 | 1799 | ('string', 'r:') |
|
1800 | ('string', 'd:relpath')) | |
|
1795 | 1801 | ('string', 'p:set:copied()')))) |
|
1796 | 1802 | $ testlog --include "set:copied()" |
|
1797 | 1803 | [] |
@@ -1799,7 +1805,9 b' Test "set:..." and parent revision' | |||
|
1799 | 1805 | (func |
|
1800 | 1806 | ('symbol', '_matchfiles') |
|
1801 | 1807 | (list |
|
1808 | (list | |
|
1802 | 1809 | ('string', 'r:') |
|
1810 | ('string', 'd:relpath')) | |
|
1803 | 1811 | ('string', 'i:set:copied()')))) |
|
1804 | 1812 | $ testlog -r "sort(file('set:copied()'), -rev)" |
|
1805 | 1813 | ["sort(file('set:copied()'), -rev)"] |
@@ -1816,7 +1824,9 b' Test --removed' | |||
|
1816 | 1824 | (func |
|
1817 | 1825 | ('symbol', '_matchfiles') |
|
1818 | 1826 | (list |
|
1827 | (list | |
|
1819 | 1828 | ('string', 'r:') |
|
1829 | ('string', 'd:relpath')) | |
|
1820 | 1830 | ('string', 'p:a')))) |
|
1821 | 1831 | $ testlog --removed --follow a |
|
1822 | 1832 | abort: can only follow copies/renames for explicit filenames |
@@ -2001,3 +2011,18 b' Test --follow-first and backward --rev' | |||
|
2001 | 2011 | (func |
|
2002 | 2012 | ('symbol', '_firstancestors') |
|
2003 | 2013 | ('symbol', '6'))) |
|
2014 | ||
|
2015 | Test subdir | |
|
2016 | ||
|
2017 | $ hg up -q 3 | |
|
2018 | $ cd dir | |
|
2019 | $ testlog . | |
|
2020 | [] | |
|
2021 | (group | |
|
2022 | (func | |
|
2023 | ('symbol', '_matchfiles') | |
|
2024 | (list | |
|
2025 | (list | |
|
2026 | ('string', 'r:') | |
|
2027 | ('string', 'd:relpath')) | |
|
2028 | ('string', 'p:.')))) |
General Comments 0
You need to be logged in to leave comments.
Login now