Show More
@@ -95,6 +95,24 def _kindpatsalwaysmatch(kindpats): | |||
|
95 | 95 | return False |
|
96 | 96 | return True |
|
97 | 97 | |
|
98 | def _buildkindpatsmatcher(matchercls, root, cwd, kindpats, ctx=None, | |
|
99 | listsubrepos=False, badfn=None): | |
|
100 | fset, kindpats = _expandsets(kindpats, ctx, listsubrepos) | |
|
101 | matchers = [] | |
|
102 | if kindpats: | |
|
103 | m = matchercls(root, cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, | |
|
104 | badfn=badfn) | |
|
105 | matchers.append(m) | |
|
106 | if fset: | |
|
107 | m = predicatematcher(root, cwd, fset.__contains__, | |
|
108 | predrepr='fileset', badfn=badfn) | |
|
109 | matchers.append(m) | |
|
110 | if not matchers: | |
|
111 | return nevermatcher(root, cwd, badfn=badfn) | |
|
112 | if len(matchers) == 1: | |
|
113 | return matchers[0] | |
|
114 | return unionmatcher(matchers) | |
|
115 | ||
|
98 | 116 | def match(root, cwd, patterns=None, include=None, exclude=None, default='glob', |
|
99 | 117 | exact=False, auditor=None, ctx=None, listsubrepos=False, warn=None, |
|
100 | 118 | badfn=None, icasefs=False): |
@@ -159,8 +177,9 def match(root, cwd, patterns=None, incl | |||
|
159 | 177 | if _kindpatsalwaysmatch(kindpats): |
|
160 | 178 | m = alwaysmatcher(root, cwd, badfn, relativeuipath=True) |
|
161 | 179 | else: |
|
162 |
m = patternmatcher |
|
|
163 |
listsubrepos=listsubrepos, |
|
|
180 | m = _buildkindpatsmatcher(patternmatcher, root, cwd, kindpats, | |
|
181 | ctx=ctx, listsubrepos=listsubrepos, | |
|
182 | badfn=badfn) | |
|
164 | 183 | else: |
|
165 | 184 | # It's a little strange that no patterns means to match everything. |
|
166 | 185 | # Consider changing this to match nothing (probably using nevermatcher). |
@@ -168,13 +187,13 def match(root, cwd, patterns=None, incl | |||
|
168 | 187 | |
|
169 | 188 | if include: |
|
170 | 189 | kindpats = normalize(include, 'glob', root, cwd, auditor, warn) |
|
171 |
im = includematcher |
|
|
172 | listsubrepos=listsubrepos, badfn=None) | |
|
190 | im = _buildkindpatsmatcher(includematcher, root, cwd, kindpats, ctx=ctx, | |
|
191 | listsubrepos=listsubrepos, badfn=None) | |
|
173 | 192 | m = intersectmatchers(m, im) |
|
174 | 193 | if exclude: |
|
175 | 194 | kindpats = normalize(exclude, 'glob', root, cwd, auditor, warn) |
|
176 |
em = includematcher |
|
|
177 | listsubrepos=listsubrepos, badfn=None) | |
|
195 | em = _buildkindpatsmatcher(includematcher, root, cwd, kindpats, ctx=ctx, | |
|
196 | listsubrepos=listsubrepos, badfn=None) | |
|
178 | 197 | m = differencematcher(m, em) |
|
179 | 198 | return m |
|
180 | 199 | |
@@ -828,10 +847,6 def _buildmatch(ctx, kindpats, globsuffi | |||
|
828 | 847 | globsuffix is appended to the regexp of globs.''' |
|
829 | 848 | matchfuncs = [] |
|
830 | 849 | |
|
831 | fset, kindpats = _expandsets(kindpats, ctx, listsubrepos) | |
|
832 | if fset: | |
|
833 | matchfuncs.append(fset.__contains__) | |
|
834 | ||
|
835 | 850 | subincludes, kindpats = _expandsubinclude(kindpats, root) |
|
836 | 851 | if subincludes: |
|
837 | 852 | submatchers = {} |
@@ -2023,25 +2023,14 Test "set:..." and parent revision | |||
|
2023 | 2023 | $ testlog "set:copied()" |
|
2024 | 2024 | [] |
|
2025 | 2025 | (func |
|
2026 |
(symbol ' |
|
|
2027 | (list | |
|
2028 | (string 'r:') | |
|
2029 | (string 'd:relpath') | |
|
2030 | (string 'p:set:copied()'))) | |
|
2026 | (symbol 'filelog') | |
|
2027 | (string 'set:copied()')) | |
|
2031 | 2028 | <filteredset |
|
2032 | <spanset- 0:7>, | |
|
2033 | <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=2147483647>> | |
|
2029 | <spanset- 0:7>, set([])> | |
|
2034 | 2030 | $ testlog --include "set:copied()" |
|
2035 | 2031 | [] |
|
2036 | (func | |
|
2037 | (symbol '_matchfiles') | |
|
2038 | (list | |
|
2039 | (string 'r:') | |
|
2040 | (string 'd:relpath') | |
|
2041 | (string 'i:set:copied()'))) | |
|
2042 | <filteredset | |
|
2043 | <spanset- 0:7>, | |
|
2044 | <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=2147483647>> | |
|
2032 | [] | |
|
2033 | <spanset- 0:7> | |
|
2045 | 2034 | $ testlog -r "sort(file('set:copied()'), -rev)" |
|
2046 | 2035 | ["sort(file('set:copied()'), -rev)"] |
|
2047 | 2036 | [] |
@@ -1870,25 +1870,14 Test "set:..." and parent revision | |||
|
1870 | 1870 | $ testlog "set:copied()" |
|
1871 | 1871 | [] |
|
1872 | 1872 | (func |
|
1873 |
(symbol ' |
|
|
1874 | (list | |
|
1875 | (string 'r:') | |
|
1876 | (string 'd:relpath') | |
|
1877 | (string 'p:set:copied()'))) | |
|
1873 | (symbol 'filelog') | |
|
1874 | (string 'set:copied()')) | |
|
1878 | 1875 | <filteredset |
|
1879 | <spanset- 0:7>, | |
|
1880 | <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=2147483647>> | |
|
1876 | <spanset- 0:7>, set([])> | |
|
1881 | 1877 | $ testlog --include "set:copied()" |
|
1882 | 1878 | [] |
|
1883 | (func | |
|
1884 | (symbol '_matchfiles') | |
|
1885 | (list | |
|
1886 | (string 'r:') | |
|
1887 | (string 'd:relpath') | |
|
1888 | (string 'i:set:copied()'))) | |
|
1889 | <filteredset | |
|
1890 | <spanset- 0:7>, | |
|
1891 | <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=2147483647>> | |
|
1879 | [] | |
|
1880 | <spanset- 0:7> | |
|
1892 | 1881 | $ testlog -r "sort(file('set:copied()'), -rev)" |
|
1893 | 1882 | ["sort(file('set:copied()'), -rev)"] |
|
1894 | 1883 | [] |
General Comments 0
You need to be logged in to leave comments.
Login now