##// END OF EJS Templates
match: sort patterns before compiling them into a regex...
marmoute -
r51285:47686726 stable
parent child Browse files
Show More
@@ -197,7 +197,7 b' def match('
197
197
198 Usually a patternmatcher is returned:
198 Usually a patternmatcher is returned:
199 >>> _match(b'/foo', b'.', [br're:.*\.c$', b'path:foo/a', b'*.py'])
199 >>> _match(b'/foo', b'.', [br're:.*\.c$', b'path:foo/a', b'*.py'])
200 <patternmatcher patterns='.*\\.c$|foo/a(?:/|$)|[^/]*\\.py$'>
200 <patternmatcher patterns='[^/]*\\.py$|foo/a(?:/|$)|.*\\.c$'>
201
201
202 Combining 'patterns' with 'include' (resp. 'exclude') gives an
202 Combining 'patterns' with 'include' (resp. 'exclude') gives an
203 intersectionmatcher (resp. a differencematcher):
203 intersectionmatcher (resp. a differencematcher):
@@ -614,7 +614,7 b' class patternmatcher(basematcher):'
614 True
614 True
615
615
616 >>> m.files()
616 >>> m.files()
617 ['', 'foo/a', 'b', '']
617 [b'', b'foo/a', b'', b'b']
618 >>> m.exact(b'foo/a')
618 >>> m.exact(b'foo/a')
619 True
619 True
620 >>> m.exact(b'b')
620 >>> m.exact(b'b')
@@ -625,6 +625,7 b' class patternmatcher(basematcher):'
625
625
626 def __init__(self, root, kindpats, badfn=None):
626 def __init__(self, root, kindpats, badfn=None):
627 super(patternmatcher, self).__init__(badfn)
627 super(patternmatcher, self).__init__(badfn)
628 kindpats.sort()
628
629
629 self._files = _explicitfiles(kindpats)
630 self._files = _explicitfiles(kindpats)
630 self._prefix = _prefix(kindpats)
631 self._prefix = _prefix(kindpats)
@@ -53,7 +53,7 b' Test operators and basic patterns'
53 (symbol 'glob')
53 (symbol 'glob')
54 (symbol 'b?')))
54 (symbol 'b?')))
55 * matcher:
55 * matcher:
56 <patternmatcher patterns='a1(?:/|$)|b.$'>
56 <patternmatcher patterns='b.$|a1(?:/|$)'>
57 a1
57 a1
58 b1
58 b1
59 b2
59 b2
@@ -536,7 +536,7 b' Test patterns:'
536 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
536 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
537 $ hg debugwalk -v beans 'glob:beans/*'
537 $ hg debugwalk -v beans 'glob:beans/*'
538 * matcher:
538 * matcher:
539 <patternmatcher patterns='beans(?:/|$)|beans/[^/]*$'>
539 <patternmatcher patterns='beans/[^/]*$|beans(?:/|$)'>
540 f beans/black beans/black
540 f beans/black beans/black
541 f beans/borlotti beans/borlotti
541 f beans/borlotti beans/borlotti
542 f beans/kidney beans/kidney
542 f beans/kidney beans/kidney
General Comments 0
You need to be logged in to leave comments. Login now