comparison tests/test-walk.t @ 32465:a83a7d27911e

match: handle excludes using new differencematcher As I've said on earlier patches, I'm hoping to use more composition of simpler matchers instead of the single complex matcher we currently have. This extracts a first new matcher that composes two other matchers. It matches if the first matcher matches but the second does not. As such, we can use it for excludes, which this patch also does. We'll remove the now-unncessary code for excludes in the next patch.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 16 May 2017 16:36:48 -0700
parents 2def402bd16d
children 12e241b2713c
comparison
equal deleted inserted replaced
32464:2e80a691e575 32465:a83a7d27911e
74 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle 74 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
75 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi 75 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
76 f mammals/Procyonidae/raccoon Procyonidae/raccoon 76 f mammals/Procyonidae/raccoon Procyonidae/raccoon
77 f mammals/skunk skunk 77 f mammals/skunk skunk
78 $ hg debugwalk -X ../beans 78 $ hg debugwalk -X ../beans
79 matcher: <matcher files=[], patterns=None, includes=None, excludes='(?:beans(?:/|$))'> 79 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans(?:/|$))', excludes=None>>
80 f fennel ../fennel 80 f fennel ../fennel
81 f fenugreek ../fenugreek 81 f fenugreek ../fenugreek
82 f fiddlehead ../fiddlehead 82 f fiddlehead ../fiddlehead
83 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle 83 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
84 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi 84 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
144 matcher: <matcher files=[], patterns=None, includes='(?:^[^/]+$)', excludes=None> 144 matcher: <matcher files=[], patterns=None, includes='(?:^[^/]+$)', excludes=None>
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: <matcher files=[], patterns=None, includes=None, excludes='(?:^[^/]+$)'> 149 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:^[^/]+$)', excludes=None>>
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
192 f mammals/skunk skunk 192 f mammals/skunk skunk
193 $ hg debugwalk -I 'rootfilesin:mammals/' 193 $ hg debugwalk -I 'rootfilesin:mammals/'
194 matcher: <matcher files=[], patterns=None, includes='(?:^mammals/[^/]+$)', excludes=None> 194 matcher: <matcher files=[], patterns=None, includes='(?:^mammals/[^/]+$)', excludes=None>
195 f mammals/skunk skunk 195 f mammals/skunk skunk
196 $ hg debugwalk -X 'rootfilesin:mammals' 196 $ hg debugwalk -X 'rootfilesin:mammals'
197 matcher: <matcher files=[], patterns=None, includes=None, excludes='(?:^mammals/[^/]+$)'> 197 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:^mammals/[^/]+$)', excludes=None>>
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
287 f beans/black beans/black exact 287 f beans/black beans/black exact
288 $ hg debugwalk -Ibeans/black beans 288 $ hg debugwalk -Ibeans/black beans
289 matcher: <matcher files=['beans'], patterns='(?:beans(?:/|$))', includes='(?:beans\\/black(?:/|$))', excludes=None> 289 matcher: <matcher files=['beans'], patterns='(?:beans(?:/|$))', includes='(?:beans\\/black(?:/|$))', excludes=None>
290 f beans/black beans/black 290 f beans/black beans/black
291 $ hg debugwalk -Xbeans/black beans 291 $ hg debugwalk -Xbeans/black beans
292 matcher: <matcher files=['beans'], patterns='(?:beans(?:/|$))', includes=None, excludes='(?:beans\\/black(?:/|$))'> 292 matcher: <differencematcher m1=<matcher files=['beans'], patterns='(?:beans(?:/|$))', includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>>
293 f beans/borlotti beans/borlotti 293 f beans/borlotti beans/borlotti
294 f beans/kidney beans/kidney 294 f beans/kidney beans/kidney
295 f beans/navy beans/navy 295 f beans/navy beans/navy
296 f beans/pinto beans/pinto 296 f beans/pinto beans/pinto
297 f beans/turtle beans/turtle 297 f beans/turtle beans/turtle
298 $ hg debugwalk -Xbeans/black -Ibeans 298 $ hg debugwalk -Xbeans/black -Ibeans
299 matcher: <matcher files=[], patterns=None, includes='(?:beans(?:/|$))', excludes='(?:beans\\/black(?:/|$))'> 299 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes='(?:beans(?:/|$))', excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>>
300 f beans/borlotti beans/borlotti 300 f beans/borlotti beans/borlotti
301 f beans/kidney beans/kidney 301 f beans/kidney beans/kidney
302 f beans/navy beans/navy 302 f beans/navy beans/navy
303 f beans/pinto beans/pinto 303 f beans/pinto beans/pinto
304 f beans/turtle beans/turtle 304 f beans/turtle beans/turtle
305 $ hg debugwalk -Xbeans/black beans/black 305 $ hg debugwalk -Xbeans/black beans/black
306 matcher: <matcher files=['beans/black'], patterns='(?:beans\\/black(?:/|$))', includes=None, excludes='(?:beans\\/black(?:/|$))'> 306 matcher: <differencematcher m1=<matcher files=['beans/black'], patterns='(?:beans\\/black(?:/|$))', includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>>
307 f beans/black beans/black exact 307 f beans/black beans/black exact
308 $ hg debugwalk -Xbeans/black -Ibeans/black 308 $ hg debugwalk -Xbeans/black -Ibeans/black
309 matcher: <matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes='(?:beans\\/black(?:/|$))'> 309 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>>
310 $ hg debugwalk -Xbeans beans/black 310 $ hg debugwalk -Xbeans beans/black
311 matcher: <matcher files=['beans/black'], patterns='(?:beans\\/black(?:/|$))', includes=None, excludes='(?:beans(?:/|$))'> 311 matcher: <differencematcher m1=<matcher files=['beans/black'], patterns='(?:beans\\/black(?:/|$))', includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans(?:/|$))', excludes=None>>
312 f beans/black beans/black exact 312 f beans/black beans/black exact
313 $ hg debugwalk -Xbeans -Ibeans/black 313 $ hg debugwalk -Xbeans -Ibeans/black
314 matcher: <matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes='(?:beans(?:/|$))'> 314 matcher: <differencematcher m1=<matcher files=[], patterns=None, includes='(?:beans\\/black(?:/|$))', excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:beans(?:/|$))', excludes=None>>
315 $ hg debugwalk 'glob:mammals/../beans/b*' 315 $ hg debugwalk 'glob:mammals/../beans/b*'
316 matcher: <matcher files=['beans'], patterns='(?:beans\\/b[^/]*$)', includes=None, excludes=None> 316 matcher: <matcher files=['beans'], patterns='(?:beans\\/b[^/]*$)', includes=None, excludes=None>
317 f beans/black beans/black 317 f beans/black beans/black
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: <matcher files=['mammals'], patterns='(?:mammals(?:/|$))', includes=None, excludes='(?:[^/]*\\/Procyonidae(?:/|$))'> 320 matcher: <differencematcher m1=<matcher files=['mammals'], patterns='(?:mammals(?:/|$))', includes=None, excludes=None>, m2=<matcher files=[], patterns=None, includes='(?:[^/]*\\/Procyonidae(?:/|$))', excludes=None>>
321 f mammals/skunk mammals/skunk 321 f mammals/skunk mammals/skunk
322 $ hg debugwalk path:mammals 322 $ hg debugwalk path:mammals
323 matcher: <matcher files=['mammals'], patterns='(?:^mammals(?:/|$))', includes=None, excludes=None> 323 matcher: <matcher files=['mammals'], patterns='(?:^mammals(?:/|$))', includes=None, excludes=None>
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