comparison mercurial/cmdutil.py @ 36346:f62369667a7c

py3: use list comprehensions instead of filter where we need to eagerly filter These two uses of filter() are then checked for truthiness, but on Python 3: >>> bool(filter(None, [])) True So we need to stop depending on that. Fortunately it's easy to replace the filter with an equivalent list comprehension. Differential Revision: https://phab.mercurial-scm.org/D2364
author Augie Fackler <augie@google.com>
date Wed, 21 Feb 2018 10:10:02 -0500
parents 428de1a59f2d
children ef6ae3f64c23
comparison
equal deleted inserted replaced
36345:f85e32a5e5c8 36346:f62369667a7c
1829 elif not value in self.revs: 1829 elif not value in self.revs:
1830 return False 1830 return False
1831 else: 1831 else:
1832 self.revs.discard(value) 1832 self.revs.discard(value)
1833 ctx = change(value) 1833 ctx = change(value)
1834 matches = filter(match, ctx.files()) 1834 matches = [f for f in ctx.files() if match(f)]
1835 if matches: 1835 if matches:
1836 fncache[value] = matches 1836 fncache[value] = matches
1837 self.set.add(value) 1837 self.set.add(value)
1838 return True 1838 return True
1839 return False 1839 return False