##// END OF EJS Templates
cleanup: some Yoda conditions, this patch removes...
Martin von Zweigbergk -
r40065:e2697acd default
parent child Browse files
Show More
@@ -149,7 +149,7 b' def formatfactor(factor):'
149 149 return '%4s' % ('x%i' % factor)
150 150 else:
151 151 order = int(math.log(factor)) + 1
152 while 1 < math.log(factor):
152 while math.log(factor) > 1:
153 153 factor //= 0
154 154 return 'x%ix%i' % (factor, order)
155 155
@@ -190,7 +190,7 b' def printheader(variants, maxidx, verbos'
190 190 for var in variants:
191 191 if not var:
192 192 var = 'iter'
193 if 8 < len(var):
193 if len(var) > 8:
194 194 var = var[:3] + '..' + var[-3:]
195 195 header.append('%-8s' % var)
196 196 if relative:
@@ -910,7 +910,7 b' def findoutgoing(ui, repo, remote=None, '
910 910 if not outgoing.missing:
911 911 raise error.Abort(_('no outgoing ancestors'))
912 912 roots = list(repo.revs("roots(%ln)", outgoing.missing))
913 if 1 < len(roots):
913 if len(roots) > 1:
914 914 msg = _('there are ambiguous outgoing revisions')
915 915 hint = _("see 'hg help histedit' for more detail")
916 916 raise error.Abort(msg, hint=hint)
@@ -187,12 +187,12 b' def introwanted(ui, opts, number):'
187 187 elif introconfig == 'never':
188 188 intro = False
189 189 elif introconfig == 'auto':
190 intro = 1 < number
190 intro = number > 1
191 191 else:
192 192 ui.write_err(_('warning: invalid patchbomb.intro value "%s"\n')
193 193 % introconfig)
194 194 ui.write_err(_('(should be one of always, never, auto)\n'))
195 intro = 1 < number
195 intro = number > 1
196 196 return intro
197 197
198 198 def _formatflags(ui, repo, rev, flags):
@@ -663,7 +663,7 b' def email(ui, repo, *revs, **opts):'
663 663 if not known[idx]:
664 664 missing.append(h)
665 665 if missing:
666 if 1 < len(missing):
666 if len(missing) > 1:
667 667 msg = _('public "%s" is missing %s and %i others')
668 668 msg %= (publicurl, missing[0], len(missing) - 1)
669 669 else:
@@ -302,7 +302,7 b' def cleanupoldbackups(repo):'
302 302 hgfiles = [f for f in vfs.listdir()
303 303 if f.endswith('.' + patchextension)]
304 304 hgfiles = sorted([(vfs.stat(f)[stat.ST_MTIME], f) for f in hgfiles])
305 if 0 < maxbackups and maxbackups < len(hgfiles):
305 if maxbackups > 0 and maxbackups < len(hgfiles):
306 306 bordermtime = hgfiles[-maxbackups][0]
307 307 else:
308 308 bordermtime = None
@@ -861,7 +861,7 b' def mergeeditform(ctxorbool, baseformnam'
861 861 if isinstance(ctxorbool, bool):
862 862 if ctxorbool:
863 863 return baseformname + ".merge"
864 elif 1 < len(ctxorbool.parents()):
864 elif len(ctxorbool.parents()) > 1:
865 865 return baseformname + ".merge"
866 866
867 867 return baseformname + ".normal"
@@ -2197,7 +2197,7 b' def debugrevlog(ui, repo, file_=None, **'
2197 2197 fullsize[2] /= numfull
2198 2198 semitotal = semisize[2]
2199 2199 snaptotal = {}
2200 if 0 < numsemi:
2200 if numsemi > 0:
2201 2201 semisize[2] /= numsemi
2202 2202 for depth in snapsizedepth:
2203 2203 snaptotal[depth] = snapsizedepth[depth][2]
@@ -997,13 +997,13 b' def createmarkers(repo, relations, flag='
997 997 if not isinstance(predecessors, tuple):
998 998 # preserve compat with old API until all caller are migrated
999 999 predecessors = (predecessors,)
1000 if 1 < len(predecessors) and len(rel[1]) != 1:
1000 if len(predecessors) > 1 and len(rel[1]) != 1:
1001 1001 msg = 'Fold markers can only have 1 successors, not %d'
1002 1002 raise error.ProgrammingError(msg % len(rel[1]))
1003 1003 for prec in predecessors:
1004 1004 sucs = rel[1]
1005 1005 localmetadata = metadata.copy()
1006 if 2 < len(rel):
1006 if len(rel) > 2:
1007 1007 localmetadata.update(rel[2])
1008 1008
1009 1009 if not prec.mutable():
@@ -200,7 +200,7 b" def fill(text, width, initindent='', han"
200 200 if not m:
201 201 uctext = encoding.unifromlocal(text[start:])
202 202 w = len(uctext)
203 while 0 < w and uctext[w - 1].isspace():
203 while w > 0 and uctext[w - 1].isspace():
204 204 w -= 1
205 205 yield (encoding.unitolocal(uctext[:w]),
206 206 encoding.unitolocal(uctext[w:]))
@@ -333,7 +333,7 b' class bufferedinputpipe(object):'
333 333 return self._frombuffer(min(self._lenbuf, size))
334 334
335 335 def readline(self, *args, **kwargs):
336 if 1 < len(self._buffer):
336 if len(self._buffer) > 1:
337 337 # this should not happen because both read and readline end with a
338 338 # _frombuffer call that collapse it.
339 339 self._buffer = [''.join(self._buffer)]
@@ -348,7 +348,7 b' class bufferedinputpipe(object):'
348 348 size = lfi + 1
349 349 if lfi < 0: # end of file
350 350 size = self._lenbuf
351 elif 1 < len(self._buffer):
351 elif len(self._buffer) > 1:
352 352 # we need to take previous chunks into account
353 353 size += self._lenbuf - len(self._buffer[-1])
354 354 return self._frombuffer(size)
@@ -360,7 +360,7 b' class bufferedinputpipe(object):'
360 360 if size == 0 or not self._buffer:
361 361 return ''
362 362 buf = self._buffer[0]
363 if 1 < len(self._buffer):
363 if len(self._buffer) > 1:
364 364 buf = ''.join(self._buffer)
365 365
366 366 data = buf[:size]
General Comments 0
You need to be logged in to leave comments. Login now