largfiles: replace filter() with listcomp when result needs to be a list
authorAugie Fackler <augie@google.com>
Sun, 18 Feb 2018 14:28:31 -0500
changeset 36344 b9da10f310f4
parent 36343 ea62c2df882d
child 36345 3ac8b5c1c36c
largfiles: replace filter() with listcomp when result needs to be a list filter() is a generator on Python 3, but these cases are used as lists. Differential Revision: https://phab.mercurial-scm.org/D2339
hgext/largefiles/lfcommands.py
hgext/largefiles/overrides.py
--- a/hgext/largefiles/lfcommands.py	Sun Feb 18 14:25:03 2018 -0500
+++ b/hgext/largefiles/lfcommands.py	Sun Feb 18 14:28:31 2018 -0500
@@ -365,7 +365,7 @@
     at = 0
     ui.debug("sending statlfile command for %d largefiles\n" % len(files))
     retval = store.exists(files)
-    files = filter(lambda h: not retval[h], files)
+    files = [h for h in files if not retval[h]]
     ui.debug("%d largefiles need to be uploaded\n" % len(files))
 
     for hash in files:
--- a/hgext/largefiles/overrides.py	Sun Feb 18 14:25:03 2018 -0500
+++ b/hgext/largefiles/overrides.py	Sun Feb 18 14:28:31 2018 -0500
@@ -42,7 +42,7 @@
     matcher'''
     m = copy.copy(match)
     lfile = lambda f: lfutil.standin(f) in manifest
-    m._files = filter(lfile, m._files)
+    m._files = [lf for lf in m._files if lfile(lf)]
     m._fileset = set(m._files)
     m.always = lambda: False
     origmatchfn = m.matchfn
@@ -57,7 +57,7 @@
     m = copy.copy(match)
     notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
             manifest or f in excluded)
-    m._files = filter(notlfile, m._files)
+    m._files = [lf for lf in m._files if notlfile(lf)]
     m._fileset = set(m._files)
     m.always = lambda: False
     origmatchfn = m.matchfn