diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py +++ b/contrib/revsetbenchmarks.py @@ -149,7 +149,7 @@ return '%4s' % ('x%i' % factor) else: order = int(math.log(factor)) + 1 - while 1 < math.log(factor): + while math.log(factor) > 1: factor //= 0 return 'x%ix%i' % (factor, order) @@ -190,7 +190,7 @@ for var in variants: if not var: var = 'iter' - if 8 < len(var): + if len(var) > 8: var = var[:3] + '..' + var[-3:] header.append('%-8s' % var) if relative: diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -910,7 +910,7 @@ if not outgoing.missing: raise error.Abort(_('no outgoing ancestors')) roots = list(repo.revs("roots(%ln)", outgoing.missing)) - if 1 < len(roots): + if len(roots) > 1: msg = _('there are ambiguous outgoing revisions') hint = _("see 'hg help histedit' for more detail") raise error.Abort(msg, hint=hint) diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -187,12 +187,12 @@ elif introconfig == 'never': intro = False elif introconfig == 'auto': - intro = 1 < number + intro = number > 1 else: ui.write_err(_('warning: invalid patchbomb.intro value "%s"\n') % introconfig) ui.write_err(_('(should be one of always, never, auto)\n')) - intro = 1 < number + intro = number > 1 return intro def _formatflags(ui, repo, rev, flags): @@ -663,7 +663,7 @@ if not known[idx]: missing.append(h) if missing: - if 1 < len(missing): + if len(missing) > 1: msg = _('public "%s" is missing %s and %i others') msg %= (publicurl, missing[0], len(missing) - 1) else: diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -302,7 +302,7 @@ hgfiles = [f for f in vfs.listdir() if f.endswith('.' + patchextension)] hgfiles = sorted([(vfs.stat(f)[stat.ST_MTIME], f) for f in hgfiles]) - if 0 < maxbackups and maxbackups < len(hgfiles): + if maxbackups > 0 and maxbackups < len(hgfiles): bordermtime = hgfiles[-maxbackups][0] else: bordermtime = None diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -861,7 +861,7 @@ if isinstance(ctxorbool, bool): if ctxorbool: return baseformname + ".merge" - elif 1 < len(ctxorbool.parents()): + elif len(ctxorbool.parents()) > 1: return baseformname + ".merge" return baseformname + ".normal" diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2197,7 +2197,7 @@ fullsize[2] /= numfull semitotal = semisize[2] snaptotal = {} - if 0 < numsemi: + if numsemi > 0: semisize[2] /= numsemi for depth in snapsizedepth: snaptotal[depth] = snapsizedepth[depth][2] diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -997,13 +997,13 @@ if not isinstance(predecessors, tuple): # preserve compat with old API until all caller are migrated predecessors = (predecessors,) - if 1 < len(predecessors) and len(rel[1]) != 1: + if len(predecessors) > 1 and len(rel[1]) != 1: msg = 'Fold markers can only have 1 successors, not %d' raise error.ProgrammingError(msg % len(rel[1])) for prec in predecessors: sucs = rel[1] localmetadata = metadata.copy() - if 2 < len(rel): + if len(rel) > 2: localmetadata.update(rel[2]) if not prec.mutable(): diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -200,7 +200,7 @@ if not m: uctext = encoding.unifromlocal(text[start:]) w = len(uctext) - while 0 < w and uctext[w - 1].isspace(): + while w > 0 and uctext[w - 1].isspace(): w -= 1 yield (encoding.unitolocal(uctext[:w]), encoding.unitolocal(uctext[w:])) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -333,7 +333,7 @@ return self._frombuffer(min(self._lenbuf, size)) def readline(self, *args, **kwargs): - if 1 < len(self._buffer): + if len(self._buffer) > 1: # this should not happen because both read and readline end with a # _frombuffer call that collapse it. self._buffer = [''.join(self._buffer)] @@ -348,7 +348,7 @@ size = lfi + 1 if lfi < 0: # end of file size = self._lenbuf - elif 1 < len(self._buffer): + elif len(self._buffer) > 1: # we need to take previous chunks into account size += self._lenbuf - len(self._buffer[-1]) return self._frombuffer(size) @@ -360,7 +360,7 @@ if size == 0 or not self._buffer: return '' buf = self._buffer[0] - if 1 < len(self._buffer): + if len(self._buffer) > 1: buf = ''.join(self._buffer) data = buf[:size]