comparison mercurial/hgweb/webutil.py @ 31434:d4645ae6ba15

hgweb: explicitly tests for None in webutil Changeset d2878bec55bd removed the mutable default value, but did not explicitly tested for None. Such implicit testing can introduce semantic and performance issue. We move to an explicit testing for None as recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#programming-recommendations
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 15 Mar 2017 15:10:09 -0700
parents d2878bec55bd
children 413b44003462
comparison
equal deleted inserted replaced
31433:7aac35ada1cb 31434:d4645ae6ba15
141 def hex(self, rev): 141 def hex(self, rev):
142 return hex(self._changelog.node(self._revlog.linkrev(rev))) 142 return hex(self._changelog.node(self._revlog.linkrev(rev)))
143 143
144 class _siblings(object): 144 class _siblings(object):
145 def __init__(self, siblings=None, hiderev=None): 145 def __init__(self, siblings=None, hiderev=None):
146 self.siblings = [s for s in siblings or [] if s.node() != nullid] 146 if siblings is None:
147 siblings = []
148 self.siblings = [s for s in siblings if s.node() != nullid]
147 if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev: 149 if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev:
148 self.siblings = [] 150 self.siblings = []
149 151
150 def __iter__(self): 152 def __iter__(self):
151 for s in self.siblings: 153 for s in self.siblings: