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