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