comparison tests/test-manifest.py @ 31255:959ebff3505a

manifest: add match argument to diff and filesnotin As part of removing manifest.matches (since it is O(manifest)), let's start by adding match arguments to diff and filesnotin. As we'll see in later patches, these are the only flows that actually use matchers, so by moving the matching into the actual functions, other manifest implementations can make more efficient algorithsm. For instance, this will allow treemanifest diff's to only iterate over the files that are different AND meet the match criteria. No consumers are changed in this patches, but the code is fairly easy to verify visually. Future patches will convert consumers to use it. One test was affected because it did not use the kwargs version of the clean parameter.
author Durham Goode <durham@fb.com>
date Tue, 07 Mar 2017 09:56:11 -0800
parents b9ed5a88710c
children 94c1d3c1aea2
comparison
equal deleted inserted replaced
31254:2140e12d3258 31255:959ebff3505a
318 self.assertEqual(want, pruned.diff(short)) 318 self.assertEqual(want, pruned.diff(short))
319 want = { 319 want = {
320 'bar/baz/qux.py': None, 320 'bar/baz/qux.py': None,
321 'foo': (MISSING, (BIN_HASH_1, '')), 321 'foo': (MISSING, (BIN_HASH_1, '')),
322 } 322 }
323 self.assertEqual(want, pruned.diff(short, True)) 323 self.assertEqual(want, pruned.diff(short, clean=True))
324 324
325 def testReversedLines(self): 325 def testReversedLines(self):
326 backwards = ''.join( 326 backwards = ''.join(
327 l + '\n' for l in reversed(A_SHORT_MANIFEST.split('\n')) if l) 327 l + '\n' for l in reversed(A_SHORT_MANIFEST.split('\n')) if l)
328 try: 328 try: