comparison mercurial/subrepoutil.py @ 50601:b539c60a79ac

safehasattr: pass attribute name as string instead of bytes This is a step toward replacing `util.safehasattr` usage with plain `hasattr`. The builtin function behave poorly in Python2 but this was fixed in Python3. These change are done one by one as they tend to have a small odd to trigger puzzling breackage.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Feb 2023 17:36:32 +0100
parents 2e726c934fcd
children 98b805d40c41
comparison
equal deleted inserted replaced
50600:d1502345f89c 50601:b539c60a79ac
382 """return the source of this repo 382 """return the source of this repo
383 383
384 Either absolute or relative the outermost repo""" 384 Either absolute or relative the outermost repo"""
385 parent = repo 385 parent = repo
386 chunks = [] 386 chunks = []
387 while util.safehasattr(parent, b'_subparent'): 387 while util.safehasattr(parent, '_subparent'):
388 source = urlutil.url(parent._subsource) 388 source = urlutil.url(parent._subsource)
389 chunks.append(bytes(source)) 389 chunks.append(bytes(source))
390 if source.isabs(): 390 if source.isabs():
391 break 391 break
392 parent = parent._subparent 392 parent = parent._subparent