comparison mercurial/filelog.py @ 52643:5cc8deb96b48

pyupgrade: modernize calls to superclass methods This is the `legacy` fixer in `pyupgrade`, with the loop yielding the offset of `yield` statements commented out.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 05 Jan 2025 22:23:31 -0500
parents ba8f03ad8906
children
comparison
equal deleted inserted replaced
52642:73ab542565e0 52643:5cc8deb96b48
272 272
273 class narrowfilelog(filelog): 273 class narrowfilelog(filelog):
274 """Filelog variation to be used with narrow stores.""" 274 """Filelog variation to be used with narrow stores."""
275 275
276 def __init__(self, opener, path, narrowmatch, try_split=False): 276 def __init__(self, opener, path, narrowmatch, try_split=False):
277 super(narrowfilelog, self).__init__(opener, path, try_split=try_split) 277 super().__init__(opener, path, try_split=try_split)
278 self._narrowmatch = narrowmatch 278 self._narrowmatch = narrowmatch
279 279
280 def renamed(self, node): 280 def renamed(self, node):
281 res = super(narrowfilelog, self).renamed(node) 281 res = super().renamed(node)
282 282
283 # Renames that come from outside the narrowspec are problematic 283 # Renames that come from outside the narrowspec are problematic
284 # because we may lack the base text for the rename. This can result 284 # because we may lack the base text for the rename. This can result
285 # in code attempting to walk the ancestry or compute a diff 285 # in code attempting to walk the ancestry or compute a diff
286 # encountering a missing revision. We address this by silently 286 # encountering a missing revision. We address this by silently
301 301
302 def size(self, rev): 302 def size(self, rev):
303 # Because we have a custom renamed() that may lie, we need to call 303 # Because we have a custom renamed() that may lie, we need to call
304 # the base renamed() to report accurate results. 304 # the base renamed() to report accurate results.
305 node = self.node(rev) 305 node = self.node(rev)
306 if super(narrowfilelog, self).renamed(node): 306 if super().renamed(node):
307 return len(self.read(node)) 307 return len(self.read(node))
308 else: 308 else:
309 return super(narrowfilelog, self).size(rev) 309 return super().size(rev)
310 310
311 def cmp(self, node, text): 311 def cmp(self, node, text):
312 # We don't call `super` because narrow parents can be buggy in case of a 312 # We don't call `super` because narrow parents can be buggy in case of a
313 # ambiguous dirstate. Always take the slow path until there is a better 313 # ambiguous dirstate. Always take the slow path until there is a better
314 # fix, see issue6150. 314 # fix, see issue6150.