# HG changeset patch # User Augie Fackler # Date 2015-05-16 18:30:07 # Node ID 3f0744eeaeafa8fff29d21cf8cd0daedabd94bf2 # Parent 3b5cd6f13dccf771078e632fb2e3fb9e215faaf1 cleanup: use __builtins__.any instead of util.any any() is available in all Python versions we support now. diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -332,7 +332,7 @@ class filemap_source(converter_source): mp1 = self.parentmap[p1] if mp1 == SKIPREV or mp1 in knownparents: continue - isancestor = util.any(p2 for p2 in parents + isancestor = any(p2 for p2 in parents if p1 != p2 and mp1 != self.parentmap[p2] and mp1 in self.wantedancestors[p2]) if not isancestor and not hasbranchparent and len(parents) > 1: diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -255,7 +255,7 @@ def sign(ui, repo, *revs, **opts): if not opts["force"]: msigs = match.exact(repo.root, '', ['.hgsigs']) - if util.any(repo.status(match=msigs, unknown=True, ignored=True)): + if any(repo.status(match=msigs, unknown=True, ignored=True)): raise util.Abort(_("working copy of .hgsigs is changed "), hint=_("please commit .hgsigs manually")) diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -707,15 +707,15 @@ def _histedit(ui, repo, state, *freeargs if force and not outg: raise util.Abort(_('--force only allowed with --outgoing')) if cont: - if util.any((outg, abort, revs, freeargs, rules, editplan)): + if any((outg, abort, revs, freeargs, rules, editplan)): raise util.Abort(_('no arguments allowed with --continue')) goal = 'continue' elif abort: - if util.any((outg, revs, freeargs, rules, editplan)): + if any((outg, revs, freeargs, rules, editplan)): raise util.Abort(_('no arguments allowed with --abort')) goal = 'abort' elif editplan: - if util.any((outg, revs, freeargs)): + if any((outg, revs, freeargs)): raise util.Abort(_('only --commands argument allowed with ' '--edit-plan')) goal = 'edit-plan' diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -364,10 +364,10 @@ def unixpath(path): def islfilesrepo(repo): if ('largefiles' in repo.requirements and - util.any(shortnameslash in f[0] for f in repo.store.datafiles())): + any(shortnameslash in f[0] for f in repo.store.datafiles())): return True - return util.any(openlfdirstate(repo.ui, repo, False)) + return any(openlfdirstate(repo.ui, repo, False)) class storeprotonotcapable(Exception): 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 @@ -365,7 +365,7 @@ def reposetup(ui, repo): repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook) def checkrequireslfiles(ui, repo, **kwargs): - if 'largefiles' not in repo.requirements and util.any( + if 'largefiles' not in repo.requirements and any( lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()): repo.requirements.add('largefiles') repo._writerequirements() diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -298,7 +298,7 @@ class patchheader(object): self.haspatch = diffstart > 1 self.plainmode = (plainmode or '# HG changeset patch' not in self.comments and - util.any(c.startswith('Date: ') or + any(c.startswith('Date: ') or c.startswith('From: ') for c in self.comments)) diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -54,7 +54,7 @@ exts = { def guesskind(dest): for kind, extensions in exts.iteritems(): - if util.any(dest.endswith(ext) for ext in extensions): + if any(dest.endswith(ext) for ext in extensions): return kind return None diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4047,8 +4047,8 @@ def identify(ui, repo, source=None, rev= parents = ctx.parents() changed = "" if default or id or num: - if (util.any(repo.status()) - or util.any(ctx.sub(s).dirty() for s in ctx.substate)): + if (any(repo.status()) + or any(ctx.sub(s).dirty() for s in ctx.substate)): changed = '+' if default or id: output = ["%s%s" % @@ -5522,7 +5522,7 @@ def revert(ui, repo, *pats, **opts): hint = _("uncommitted merge, use --all to discard all changes," " or 'hg update -C .' to abort the merge") raise util.Abort(msg, hint=hint) - dirty = util.any(repo.status()) + dirty = any(repo.status()) node = ctx.node() if node != parent: if dirty: diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1181,7 +1181,7 @@ def getbundle(repo, source, heads=None, # bundle10 case usebundle2 = False if bundlecaps is not None: - usebundle2 = util.any((cap.startswith('HG2') for cap in bundlecaps)) + usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps)) if not usebundle2: if bundlecaps and not kwargs.get('cg', True): raise ValueError(_('request for bundle10 must include changegroup')) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -232,7 +232,7 @@ def _search(web, req, tmpl): # no revset syntax used return MODE_KEYWORD, query - if util.any((token, (value or '')[:3]) == ('string', 're:') + if any((token, (value or '')[:3]) == ('string', 're:') for token, value, pos in revset.tokenize(revdef)): return MODE_KEYWORD, query diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -627,7 +627,7 @@ class localrepository(object): if not local: m = matchmod.exact(self.root, '', ['.hgtags']) - if util.any(self.status(match=m, unknown=True, ignored=True)): + if any(self.status(match=m, unknown=True, ignored=True)): raise util.Abort(_('working copy of .hgtags is changed'), hint=_('please commit .hgtags manually')) diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1117,7 +1117,7 @@ def _computeunstableset(repo): for rev, ctx in revs: # A rev is unstable if one of its parent is obsolete or unstable # this works since we traverse following growing rev order - if util.any((x.obsolete() or (x.rev() in unstable)) + if any((x.obsolete() or (x.rev() in unstable)) for x in ctx.parents()): unstable.add(rev) return unstable diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -830,7 +830,7 @@ class header(object): self.hunks = [] def binary(self): - return util.any(h.startswith('index ') for h in self.header) + return any(h.startswith('index ') for h in self.header) def pretty(self, fp): for h in self.header: @@ -853,7 +853,7 @@ class header(object): fp.write(''.join(self.header)) def allhunks(self): - return util.any(self.allhunks_re.match(h) for h in self.header) + return any(self.allhunks_re.match(h) for h in self.header) def files(self): match = self.diffgit_re.match(self.header[0]) @@ -872,7 +872,7 @@ class header(object): return '
' % (' '.join(map(repr, self.files()))) def isnewfile(self): - return util.any(self.newfile_re.match(h) for h in self.header) + return any(self.newfile_re.match(h) for h in self.header) def special(self): # Special files are shown only at the header level and not at the hunk @@ -885,7 +885,7 @@ class header(object): nocontent = len(self.header) == 2 emptynewfile = self.isnewfile() and nocontent return emptynewfile or \ - util.any(self.special_re.match(h) for h in self.header) + any(self.special_re.match(h) for h in self.header) class recordhunk(object): """patch hunk diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -196,7 +196,7 @@ def computemutable(repo): Secret and hidden changeset should not pretend to be here.""" assert not repo.changelog.filteredrevs # fast check to avoid revset call on huge repo - if util.any(repo._phasecache.phaseroots[1:]): + if any(repo._phasecache.phaseroots[1:]): getphase = repo._phasecache.phase maymutable = filterrevs(repo, 'base') return frozenset(r for r in maymutable if getphase(repo, r)) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1121,7 +1121,7 @@ def keyword(repo, subset, x): def matches(r): c = repo[r] - return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(), + return any(kw in encoding.lower(t) for t in c.files() + [c.user(), c.description()]) return subset.filter(matches) @@ -1779,7 +1779,7 @@ def subrepo(repo, subset, x): return s.added or s.modified or s.removed if s.added: - return util.any(submatches(c.substate.keys())) + return any(submatches(c.substate.keys())) if s.modified: subs = set(c.p1().substate.keys()) @@ -1790,7 +1790,7 @@ def subrepo(repo, subset, x): return True if s.removed: - return util.any(submatches(c.p1().substate.keys())) + return any(submatches(c.p1().substate.keys())) return False diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -842,7 +842,7 @@ class ui(object): output will be redirected if fout is not stdout. ''' out = self.fout - if util.any(s[1] for s in self._bufferstates): + if any(s[1] for s in self._bufferstates): out = self return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr, errprefix=errprefix, out=out) diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -367,7 +367,7 @@ class wirepeer(peer.peerrepository): % keytype) opts[key] = value f = self._callcompressable("getbundle", **opts) - if util.any((cap.startswith('HG2') for cap in bundlecaps)): + if any((cap.startswith('HG2') for cap in bundlecaps)): return bundle2.getunbundler(self.ui, f) else: return changegroupmod.cg1unpacker(f, 'UN')