comparison tests/test-walk.t @ 33357:a21819f439fe

match: remove unnecessary '^' from regexes The regexes are passed to re.match(), which matches against the beginning of the input, so the '^' doesn't do anything. Note that unrooted patterns, such as globs and regexes from .hgignore are instead achieved by adding '.*' to the expression given by the user. (That's unless the user's expression started with '^', in which case the '.*' is not added, perhaps to keep the regex cleaner?)
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 09 Jul 2017 22:53:02 -0700
parents 20c9f3ecc192
children feecfefeba25
comparison
equal deleted inserted replaced
33356:ccb3e5399921 33357:a21819f439fe
107 matcher: <includematcher includes='(?:.*.*k$)'> 107 matcher: <includematcher includes='(?:.*.*k$)'>
108 f beans/black ../beans/black 108 f beans/black ../beans/black
109 f fenugreek ../fenugreek 109 f fenugreek ../fenugreek
110 f mammals/skunk skunk 110 f mammals/skunk skunk
111 $ hg debugwalk -I 'path:beans' 111 $ hg debugwalk -I 'path:beans'
112 matcher: <includematcher includes='(?:^beans(?:/|$))'> 112 matcher: <includematcher includes='(?:beans(?:/|$))'>
113 f beans/black ../beans/black 113 f beans/black ../beans/black
114 f beans/borlotti ../beans/borlotti 114 f beans/borlotti ../beans/borlotti
115 f beans/kidney ../beans/kidney 115 f beans/kidney ../beans/kidney
116 f beans/navy ../beans/navy 116 f beans/navy ../beans/navy
117 f beans/pinto ../beans/pinto 117 f beans/pinto ../beans/pinto
124 f beans/navy ../beans/navy 124 f beans/navy ../beans/navy
125 f beans/pinto ../beans/pinto 125 f beans/pinto ../beans/pinto
126 f beans/turtle ../beans/turtle 126 f beans/turtle ../beans/turtle
127 127
128 $ hg debugwalk 'rootfilesin:' 128 $ hg debugwalk 'rootfilesin:'
129 matcher: <patternmatcher patterns='(?:^[^/]+$)'> 129 matcher: <patternmatcher patterns='(?:[^/]+$)'>
130 f fennel ../fennel 130 f fennel ../fennel
131 f fenugreek ../fenugreek 131 f fenugreek ../fenugreek
132 f fiddlehead ../fiddlehead 132 f fiddlehead ../fiddlehead
133 $ hg debugwalk -I 'rootfilesin:' 133 $ hg debugwalk -I 'rootfilesin:'
134 matcher: <includematcher includes='(?:^[^/]+$)'> 134 matcher: <includematcher includes='(?:[^/]+$)'>
135 f fennel ../fennel 135 f fennel ../fennel
136 f fenugreek ../fenugreek 136 f fenugreek ../fenugreek
137 f fiddlehead ../fiddlehead 137 f fiddlehead ../fiddlehead
138 $ hg debugwalk 'rootfilesin:.' 138 $ hg debugwalk 'rootfilesin:.'
139 matcher: <patternmatcher patterns='(?:^[^/]+$)'> 139 matcher: <patternmatcher patterns='(?:[^/]+$)'>
140 f fennel ../fennel 140 f fennel ../fennel
141 f fenugreek ../fenugreek 141 f fenugreek ../fenugreek
142 f fiddlehead ../fiddlehead 142 f fiddlehead ../fiddlehead
143 $ hg debugwalk -I 'rootfilesin:.' 143 $ hg debugwalk -I 'rootfilesin:.'
144 matcher: <includematcher includes='(?:^[^/]+$)'> 144 matcher: <includematcher includes='(?:[^/]+$)'>
145 f fennel ../fennel 145 f fennel ../fennel
146 f fenugreek ../fenugreek 146 f fenugreek ../fenugreek
147 f fiddlehead ../fiddlehead 147 f fiddlehead ../fiddlehead
148 $ hg debugwalk -X 'rootfilesin:' 148 $ hg debugwalk -X 'rootfilesin:'
149 matcher: <differencematcher m1=<alwaysmatcher>, m2=<includematcher includes='(?:^[^/]+$)'>> 149 matcher: <differencematcher m1=<alwaysmatcher>, m2=<includematcher includes='(?:[^/]+$)'>>
150 f beans/black ../beans/black 150 f beans/black ../beans/black
151 f beans/borlotti ../beans/borlotti 151 f beans/borlotti ../beans/borlotti
152 f beans/kidney ../beans/kidney 152 f beans/kidney ../beans/kidney
153 f beans/navy ../beans/navy 153 f beans/navy ../beans/navy
154 f beans/pinto ../beans/pinto 154 f beans/pinto ../beans/pinto
156 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle 156 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
157 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi 157 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
158 f mammals/Procyonidae/raccoon Procyonidae/raccoon 158 f mammals/Procyonidae/raccoon Procyonidae/raccoon
159 f mammals/skunk skunk 159 f mammals/skunk skunk
160 $ hg debugwalk 'rootfilesin:fennel' 160 $ hg debugwalk 'rootfilesin:fennel'
161 matcher: <patternmatcher patterns='(?:^fennel/[^/]+$)'> 161 matcher: <patternmatcher patterns='(?:fennel/[^/]+$)'>
162 $ hg debugwalk -I 'rootfilesin:fennel' 162 $ hg debugwalk -I 'rootfilesin:fennel'
163 matcher: <includematcher includes='(?:^fennel/[^/]+$)'> 163 matcher: <includematcher includes='(?:fennel/[^/]+$)'>
164 $ hg debugwalk 'rootfilesin:skunk' 164 $ hg debugwalk 'rootfilesin:skunk'
165 matcher: <patternmatcher patterns='(?:^skunk/[^/]+$)'> 165 matcher: <patternmatcher patterns='(?:skunk/[^/]+$)'>
166 $ hg debugwalk -I 'rootfilesin:skunk' 166 $ hg debugwalk -I 'rootfilesin:skunk'
167 matcher: <includematcher includes='(?:^skunk/[^/]+$)'> 167 matcher: <includematcher includes='(?:skunk/[^/]+$)'>
168 $ hg debugwalk 'rootfilesin:beans' 168 $ hg debugwalk 'rootfilesin:beans'
169 matcher: <patternmatcher patterns='(?:^beans/[^/]+$)'> 169 matcher: <patternmatcher patterns='(?:beans/[^/]+$)'>
170 f beans/black ../beans/black 170 f beans/black ../beans/black
171 f beans/borlotti ../beans/borlotti 171 f beans/borlotti ../beans/borlotti
172 f beans/kidney ../beans/kidney 172 f beans/kidney ../beans/kidney
173 f beans/navy ../beans/navy 173 f beans/navy ../beans/navy
174 f beans/pinto ../beans/pinto 174 f beans/pinto ../beans/pinto
175 f beans/turtle ../beans/turtle 175 f beans/turtle ../beans/turtle
176 $ hg debugwalk -I 'rootfilesin:beans' 176 $ hg debugwalk -I 'rootfilesin:beans'
177 matcher: <includematcher includes='(?:^beans/[^/]+$)'> 177 matcher: <includematcher includes='(?:beans/[^/]+$)'>
178 f beans/black ../beans/black 178 f beans/black ../beans/black
179 f beans/borlotti ../beans/borlotti 179 f beans/borlotti ../beans/borlotti
180 f beans/kidney ../beans/kidney 180 f beans/kidney ../beans/kidney
181 f beans/navy ../beans/navy 181 f beans/navy ../beans/navy
182 f beans/pinto ../beans/pinto 182 f beans/pinto ../beans/pinto
183 f beans/turtle ../beans/turtle 183 f beans/turtle ../beans/turtle
184 $ hg debugwalk 'rootfilesin:mammals' 184 $ hg debugwalk 'rootfilesin:mammals'
185 matcher: <patternmatcher patterns='(?:^mammals/[^/]+$)'> 185 matcher: <patternmatcher patterns='(?:mammals/[^/]+$)'>
186 f mammals/skunk skunk 186 f mammals/skunk skunk
187 $ hg debugwalk -I 'rootfilesin:mammals' 187 $ hg debugwalk -I 'rootfilesin:mammals'
188 matcher: <includematcher includes='(?:^mammals/[^/]+$)'> 188 matcher: <includematcher includes='(?:mammals/[^/]+$)'>
189 f mammals/skunk skunk 189 f mammals/skunk skunk
190 $ hg debugwalk 'rootfilesin:mammals/' 190 $ hg debugwalk 'rootfilesin:mammals/'
191 matcher: <patternmatcher patterns='(?:^mammals/[^/]+$)'> 191 matcher: <patternmatcher patterns='(?:mammals/[^/]+$)'>
192 f mammals/skunk skunk 192 f mammals/skunk skunk
193 $ hg debugwalk -I 'rootfilesin:mammals/' 193 $ hg debugwalk -I 'rootfilesin:mammals/'
194 matcher: <includematcher includes='(?:^mammals/[^/]+$)'> 194 matcher: <includematcher includes='(?:mammals/[^/]+$)'>
195 f mammals/skunk skunk 195 f mammals/skunk skunk
196 $ hg debugwalk -X 'rootfilesin:mammals' 196 $ hg debugwalk -X 'rootfilesin:mammals'
197 matcher: <differencematcher m1=<alwaysmatcher>, m2=<includematcher includes='(?:^mammals/[^/]+$)'>> 197 matcher: <differencematcher m1=<alwaysmatcher>, m2=<includematcher includes='(?:mammals/[^/]+$)'>>
198 f beans/black ../beans/black 198 f beans/black ../beans/black
199 f beans/borlotti ../beans/borlotti 199 f beans/borlotti ../beans/borlotti
200 f beans/kidney ../beans/kidney 200 f beans/kidney ../beans/kidney
201 f beans/navy ../beans/navy 201 f beans/navy ../beans/navy
202 f beans/pinto ../beans/pinto 202 f beans/pinto ../beans/pinto
318 f beans/borlotti beans/borlotti 318 f beans/borlotti beans/borlotti
319 $ hg debugwalk '-X*/Procyonidae' mammals 319 $ hg debugwalk '-X*/Procyonidae' mammals
320 matcher: <differencematcher m1=<patternmatcher patterns='(?:mammals(?:/|$))'>, m2=<includematcher includes='(?:[^/]*\\/Procyonidae(?:/|$))'>> 320 matcher: <differencematcher m1=<patternmatcher patterns='(?:mammals(?:/|$))'>, m2=<includematcher includes='(?:[^/]*\\/Procyonidae(?:/|$))'>>
321 f mammals/skunk mammals/skunk 321 f mammals/skunk mammals/skunk
322 $ hg debugwalk path:mammals 322 $ hg debugwalk path:mammals
323 matcher: <patternmatcher patterns='(?:^mammals(?:/|$))'> 323 matcher: <patternmatcher patterns='(?:mammals(?:/|$))'>
324 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle 324 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
325 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi 325 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
326 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon 326 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
327 f mammals/skunk mammals/skunk 327 f mammals/skunk mammals/skunk
328 $ hg debugwalk .. 328 $ hg debugwalk ..
381 glob: No such file or directory 381 glob: No such file or directory
382 $ hg debugwalk glob:glob:glob 382 $ hg debugwalk glob:glob:glob
383 matcher: <patternmatcher patterns='(?:glob\\:glob$)'> 383 matcher: <patternmatcher patterns='(?:glob\\:glob$)'>
384 f glob:glob glob:glob exact 384 f glob:glob glob:glob exact
385 $ hg debugwalk path:glob:glob 385 $ hg debugwalk path:glob:glob
386 matcher: <patternmatcher patterns='(?:^glob\\:glob(?:/|$))'> 386 matcher: <patternmatcher patterns='(?:glob\\:glob(?:/|$))'>
387 f glob:glob glob:glob exact 387 f glob:glob glob:glob exact
388 $ rm glob:glob 388 $ rm glob:glob
389 $ hg addremove 389 $ hg addremove
390 removing glob:glob 390 removing glob:glob
391 #endif 391 #endif
400 f beans/black beans/black 400 f beans/black beans/black
401 f fenugreek fenugreek 401 f fenugreek fenugreek
402 f mammals/skunk mammals/skunk 402 f mammals/skunk mammals/skunk
403 403
404 $ hg debugwalk path:beans/black 404 $ hg debugwalk path:beans/black
405 matcher: <patternmatcher patterns='(?:^beans\\/black(?:/|$))'> 405 matcher: <patternmatcher patterns='(?:beans\\/black(?:/|$))'>
406 f beans/black beans/black exact 406 f beans/black beans/black exact
407 $ hg debugwalk path:beans//black 407 $ hg debugwalk path:beans//black
408 matcher: <patternmatcher patterns='(?:^beans\\/black(?:/|$))'> 408 matcher: <patternmatcher patterns='(?:beans\\/black(?:/|$))'>
409 f beans/black beans/black exact 409 f beans/black beans/black exact
410 410
411 $ hg debugwalk relglob:Procyonidae 411 $ hg debugwalk relglob:Procyonidae
412 matcher: <patternmatcher patterns='(?:(?:|.*/)Procyonidae$)'> 412 matcher: <patternmatcher patterns='(?:(?:|.*/)Procyonidae$)'>
413 $ hg debugwalk 'relglob:Procyonidae/**' 413 $ hg debugwalk 'relglob:Procyonidae/**'