##// END OF EJS Templates
cleanup: use __builtins__.any instead of util.any...
Augie Fackler -
r25149:3f0744ee default
parent child Browse files
Show More
@@ -332,7 +332,7 b' class filemap_source(converter_source):'
332 mp1 = self.parentmap[p1]
332 mp1 = self.parentmap[p1]
333 if mp1 == SKIPREV or mp1 in knownparents:
333 if mp1 == SKIPREV or mp1 in knownparents:
334 continue
334 continue
335 isancestor = util.any(p2 for p2 in parents
335 isancestor = any(p2 for p2 in parents
336 if p1 != p2 and mp1 != self.parentmap[p2]
336 if p1 != p2 and mp1 != self.parentmap[p2]
337 and mp1 in self.wantedancestors[p2])
337 and mp1 in self.wantedancestors[p2])
338 if not isancestor and not hasbranchparent and len(parents) > 1:
338 if not isancestor and not hasbranchparent and len(parents) > 1:
@@ -255,7 +255,7 b' def sign(ui, repo, *revs, **opts):'
255
255
256 if not opts["force"]:
256 if not opts["force"]:
257 msigs = match.exact(repo.root, '', ['.hgsigs'])
257 msigs = match.exact(repo.root, '', ['.hgsigs'])
258 if util.any(repo.status(match=msigs, unknown=True, ignored=True)):
258 if any(repo.status(match=msigs, unknown=True, ignored=True)):
259 raise util.Abort(_("working copy of .hgsigs is changed "),
259 raise util.Abort(_("working copy of .hgsigs is changed "),
260 hint=_("please commit .hgsigs manually"))
260 hint=_("please commit .hgsigs manually"))
261
261
@@ -707,15 +707,15 b' def _histedit(ui, repo, state, *freeargs'
707 if force and not outg:
707 if force and not outg:
708 raise util.Abort(_('--force only allowed with --outgoing'))
708 raise util.Abort(_('--force only allowed with --outgoing'))
709 if cont:
709 if cont:
710 if util.any((outg, abort, revs, freeargs, rules, editplan)):
710 if any((outg, abort, revs, freeargs, rules, editplan)):
711 raise util.Abort(_('no arguments allowed with --continue'))
711 raise util.Abort(_('no arguments allowed with --continue'))
712 goal = 'continue'
712 goal = 'continue'
713 elif abort:
713 elif abort:
714 if util.any((outg, revs, freeargs, rules, editplan)):
714 if any((outg, revs, freeargs, rules, editplan)):
715 raise util.Abort(_('no arguments allowed with --abort'))
715 raise util.Abort(_('no arguments allowed with --abort'))
716 goal = 'abort'
716 goal = 'abort'
717 elif editplan:
717 elif editplan:
718 if util.any((outg, revs, freeargs)):
718 if any((outg, revs, freeargs)):
719 raise util.Abort(_('only --commands argument allowed with '
719 raise util.Abort(_('only --commands argument allowed with '
720 '--edit-plan'))
720 '--edit-plan'))
721 goal = 'edit-plan'
721 goal = 'edit-plan'
@@ -364,10 +364,10 b' def unixpath(path):'
364
364
365 def islfilesrepo(repo):
365 def islfilesrepo(repo):
366 if ('largefiles' in repo.requirements and
366 if ('largefiles' in repo.requirements and
367 util.any(shortnameslash in f[0] for f in repo.store.datafiles())):
367 any(shortnameslash in f[0] for f in repo.store.datafiles())):
368 return True
368 return True
369
369
370 return util.any(openlfdirstate(repo.ui, repo, False))
370 return any(openlfdirstate(repo.ui, repo, False))
371
371
372 class storeprotonotcapable(Exception):
372 class storeprotonotcapable(Exception):
373 def __init__(self, storetypes):
373 def __init__(self, storetypes):
@@ -365,7 +365,7 b' def reposetup(ui, repo):'
365 repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook)
365 repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook)
366
366
367 def checkrequireslfiles(ui, repo, **kwargs):
367 def checkrequireslfiles(ui, repo, **kwargs):
368 if 'largefiles' not in repo.requirements and util.any(
368 if 'largefiles' not in repo.requirements and any(
369 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
369 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
370 repo.requirements.add('largefiles')
370 repo.requirements.add('largefiles')
371 repo._writerequirements()
371 repo._writerequirements()
@@ -298,7 +298,7 b' class patchheader(object):'
298 self.haspatch = diffstart > 1
298 self.haspatch = diffstart > 1
299 self.plainmode = (plainmode or
299 self.plainmode = (plainmode or
300 '# HG changeset patch' not in self.comments and
300 '# HG changeset patch' not in self.comments and
301 util.any(c.startswith('Date: ') or
301 any(c.startswith('Date: ') or
302 c.startswith('From: ')
302 c.startswith('From: ')
303 for c in self.comments))
303 for c in self.comments))
304
304
@@ -54,7 +54,7 b' exts = {'
54
54
55 def guesskind(dest):
55 def guesskind(dest):
56 for kind, extensions in exts.iteritems():
56 for kind, extensions in exts.iteritems():
57 if util.any(dest.endswith(ext) for ext in extensions):
57 if any(dest.endswith(ext) for ext in extensions):
58 return kind
58 return kind
59 return None
59 return None
60
60
@@ -4047,8 +4047,8 b' def identify(ui, repo, source=None, rev='
4047 parents = ctx.parents()
4047 parents = ctx.parents()
4048 changed = ""
4048 changed = ""
4049 if default or id or num:
4049 if default or id or num:
4050 if (util.any(repo.status())
4050 if (any(repo.status())
4051 or util.any(ctx.sub(s).dirty() for s in ctx.substate)):
4051 or any(ctx.sub(s).dirty() for s in ctx.substate)):
4052 changed = '+'
4052 changed = '+'
4053 if default or id:
4053 if default or id:
4054 output = ["%s%s" %
4054 output = ["%s%s" %
@@ -5522,7 +5522,7 b' def revert(ui, repo, *pats, **opts):'
5522 hint = _("uncommitted merge, use --all to discard all changes,"
5522 hint = _("uncommitted merge, use --all to discard all changes,"
5523 " or 'hg update -C .' to abort the merge")
5523 " or 'hg update -C .' to abort the merge")
5524 raise util.Abort(msg, hint=hint)
5524 raise util.Abort(msg, hint=hint)
5525 dirty = util.any(repo.status())
5525 dirty = any(repo.status())
5526 node = ctx.node()
5526 node = ctx.node()
5527 if node != parent:
5527 if node != parent:
5528 if dirty:
5528 if dirty:
@@ -1181,7 +1181,7 b' def getbundle(repo, source, heads=None, '
1181 # bundle10 case
1181 # bundle10 case
1182 usebundle2 = False
1182 usebundle2 = False
1183 if bundlecaps is not None:
1183 if bundlecaps is not None:
1184 usebundle2 = util.any((cap.startswith('HG2') for cap in bundlecaps))
1184 usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps))
1185 if not usebundle2:
1185 if not usebundle2:
1186 if bundlecaps and not kwargs.get('cg', True):
1186 if bundlecaps and not kwargs.get('cg', True):
1187 raise ValueError(_('request for bundle10 must include changegroup'))
1187 raise ValueError(_('request for bundle10 must include changegroup'))
@@ -232,7 +232,7 b' def _search(web, req, tmpl):'
232 # no revset syntax used
232 # no revset syntax used
233 return MODE_KEYWORD, query
233 return MODE_KEYWORD, query
234
234
235 if util.any((token, (value or '')[:3]) == ('string', 're:')
235 if any((token, (value or '')[:3]) == ('string', 're:')
236 for token, value, pos in revset.tokenize(revdef)):
236 for token, value, pos in revset.tokenize(revdef)):
237 return MODE_KEYWORD, query
237 return MODE_KEYWORD, query
238
238
@@ -627,7 +627,7 b' class localrepository(object):'
627
627
628 if not local:
628 if not local:
629 m = matchmod.exact(self.root, '', ['.hgtags'])
629 m = matchmod.exact(self.root, '', ['.hgtags'])
630 if util.any(self.status(match=m, unknown=True, ignored=True)):
630 if any(self.status(match=m, unknown=True, ignored=True)):
631 raise util.Abort(_('working copy of .hgtags is changed'),
631 raise util.Abort(_('working copy of .hgtags is changed'),
632 hint=_('please commit .hgtags manually'))
632 hint=_('please commit .hgtags manually'))
633
633
@@ -1117,7 +1117,7 b' def _computeunstableset(repo):'
1117 for rev, ctx in revs:
1117 for rev, ctx in revs:
1118 # A rev is unstable if one of its parent is obsolete or unstable
1118 # A rev is unstable if one of its parent is obsolete or unstable
1119 # this works since we traverse following growing rev order
1119 # this works since we traverse following growing rev order
1120 if util.any((x.obsolete() or (x.rev() in unstable))
1120 if any((x.obsolete() or (x.rev() in unstable))
1121 for x in ctx.parents()):
1121 for x in ctx.parents()):
1122 unstable.add(rev)
1122 unstable.add(rev)
1123 return unstable
1123 return unstable
@@ -830,7 +830,7 b' class header(object):'
830 self.hunks = []
830 self.hunks = []
831
831
832 def binary(self):
832 def binary(self):
833 return util.any(h.startswith('index ') for h in self.header)
833 return any(h.startswith('index ') for h in self.header)
834
834
835 def pretty(self, fp):
835 def pretty(self, fp):
836 for h in self.header:
836 for h in self.header:
@@ -853,7 +853,7 b' class header(object):'
853 fp.write(''.join(self.header))
853 fp.write(''.join(self.header))
854
854
855 def allhunks(self):
855 def allhunks(self):
856 return util.any(self.allhunks_re.match(h) for h in self.header)
856 return any(self.allhunks_re.match(h) for h in self.header)
857
857
858 def files(self):
858 def files(self):
859 match = self.diffgit_re.match(self.header[0])
859 match = self.diffgit_re.match(self.header[0])
@@ -872,7 +872,7 b' class header(object):'
872 return '<header %s>' % (' '.join(map(repr, self.files())))
872 return '<header %s>' % (' '.join(map(repr, self.files())))
873
873
874 def isnewfile(self):
874 def isnewfile(self):
875 return util.any(self.newfile_re.match(h) for h in self.header)
875 return any(self.newfile_re.match(h) for h in self.header)
876
876
877 def special(self):
877 def special(self):
878 # Special files are shown only at the header level and not at the hunk
878 # Special files are shown only at the header level and not at the hunk
@@ -885,7 +885,7 b' class header(object):'
885 nocontent = len(self.header) == 2
885 nocontent = len(self.header) == 2
886 emptynewfile = self.isnewfile() and nocontent
886 emptynewfile = self.isnewfile() and nocontent
887 return emptynewfile or \
887 return emptynewfile or \
888 util.any(self.special_re.match(h) for h in self.header)
888 any(self.special_re.match(h) for h in self.header)
889
889
890 class recordhunk(object):
890 class recordhunk(object):
891 """patch hunk
891 """patch hunk
@@ -196,7 +196,7 b' def computemutable(repo):'
196 Secret and hidden changeset should not pretend to be here."""
196 Secret and hidden changeset should not pretend to be here."""
197 assert not repo.changelog.filteredrevs
197 assert not repo.changelog.filteredrevs
198 # fast check to avoid revset call on huge repo
198 # fast check to avoid revset call on huge repo
199 if util.any(repo._phasecache.phaseroots[1:]):
199 if any(repo._phasecache.phaseroots[1:]):
200 getphase = repo._phasecache.phase
200 getphase = repo._phasecache.phase
201 maymutable = filterrevs(repo, 'base')
201 maymutable = filterrevs(repo, 'base')
202 return frozenset(r for r in maymutable if getphase(repo, r))
202 return frozenset(r for r in maymutable if getphase(repo, r))
@@ -1121,7 +1121,7 b' def keyword(repo, subset, x):'
1121
1121
1122 def matches(r):
1122 def matches(r):
1123 c = repo[r]
1123 c = repo[r]
1124 return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(),
1124 return any(kw in encoding.lower(t) for t in c.files() + [c.user(),
1125 c.description()])
1125 c.description()])
1126
1126
1127 return subset.filter(matches)
1127 return subset.filter(matches)
@@ -1779,7 +1779,7 b' def subrepo(repo, subset, x):'
1779 return s.added or s.modified or s.removed
1779 return s.added or s.modified or s.removed
1780
1780
1781 if s.added:
1781 if s.added:
1782 return util.any(submatches(c.substate.keys()))
1782 return any(submatches(c.substate.keys()))
1783
1783
1784 if s.modified:
1784 if s.modified:
1785 subs = set(c.p1().substate.keys())
1785 subs = set(c.p1().substate.keys())
@@ -1790,7 +1790,7 b' def subrepo(repo, subset, x):'
1790 return True
1790 return True
1791
1791
1792 if s.removed:
1792 if s.removed:
1793 return util.any(submatches(c.p1().substate.keys()))
1793 return any(submatches(c.p1().substate.keys()))
1794
1794
1795 return False
1795 return False
1796
1796
@@ -842,7 +842,7 b' class ui(object):'
842 output will be redirected if fout is not stdout.
842 output will be redirected if fout is not stdout.
843 '''
843 '''
844 out = self.fout
844 out = self.fout
845 if util.any(s[1] for s in self._bufferstates):
845 if any(s[1] for s in self._bufferstates):
846 out = self
846 out = self
847 return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
847 return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
848 errprefix=errprefix, out=out)
848 errprefix=errprefix, out=out)
@@ -367,7 +367,7 b' class wirepeer(peer.peerrepository):'
367 % keytype)
367 % keytype)
368 opts[key] = value
368 opts[key] = value
369 f = self._callcompressable("getbundle", **opts)
369 f = self._callcompressable("getbundle", **opts)
370 if util.any((cap.startswith('HG2') for cap in bundlecaps)):
370 if any((cap.startswith('HG2') for cap in bundlecaps)):
371 return bundle2.getunbundler(self.ui, f)
371 return bundle2.getunbundler(self.ui, f)
372 else:
372 else:
373 return changegroupmod.cg1unpacker(f, 'UN')
373 return changegroupmod.cg1unpacker(f, 'UN')
General Comments 0
You need to be logged in to leave comments. Login now