[PATCH] largefiles: remove redundant any_ function

Benjamin Pollack benjamin at bitquabit.com
Wed Oct 19 19:48:48 CDT 2011


# HG changeset patch
# User Benjamin Pollack <benjamin at bitquabit.com>
# Date 1319071255 14400
# Branch stable
# Node ID a4a6d5fc4b48261f73f91148c0465ffc9033f238
# Parent  3eb1a90ea40941ad7a920daad665e27ffdb6f291
largefiles: remove redundant any_ function

diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -121,7 +121,7 @@
             cctx = self.repo[rev]
             cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
 
-            failed = lfutil.any_(self._verifyfile(
+            failed = util.any(self._verifyfile(
                 cctx, cset, contents, standin, verified) for standin in cctx)
 
         num_revs = len(verified)
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -435,13 +435,7 @@
 
 def islfilesrepo(repo):
     return ('largefiles' in repo.requirements and
-            any_(shortname + '/' in f[0] for f in repo.store.datafiles()))
-
-def any_(gen):
-    for x in gen:
-        if x:
-            return True
-    return False
+            util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
 
 class storeprotonotcapable(BaseException):
     def __init__(self, storetypes):
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -346,7 +346,7 @@
                         fstandin += os.sep
 
                     # prevalidate matching standin directories
-                    if lfutil.any_(st for st in match._files
+                    if util.any(st for st in match._files
                                    if st.startswith(fstandin)):
                         continue
                     actualfiles.append(f)
@@ -400,7 +400,7 @@
     repo.__class__ = lfiles_repo
 
     def checkrequireslfiles(ui, repo, **kwargs):
-        if 'largefiles' not in repo.requirements and lfutil.any_(
+        if 'largefiles' not in repo.requirements and util.any(
                 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
             repo.requirements.add('largefiles')
             repo._writerequirements()


More information about the Mercurial-devel mailing list