Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 50580:833a4e881a7a
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:28:15 +0100 |
parents | e6948aafda6f |
children | b2ec43d552d4 |
comparison
equal
deleted
inserted
replaced
50579:b23b3ef38ba1 | 50580:833a4e881a7a |
---|---|
413 This function handles the repo locking itself.""" | 413 This function handles the repo locking itself.""" |
414 try: | 414 try: |
415 try: | 415 try: |
416 bundle = exchange.readbundle(self.ui, bundle, None) | 416 bundle = exchange.readbundle(self.ui, bundle, None) |
417 ret = exchange.unbundle(self._repo, bundle, heads, b'push', url) | 417 ret = exchange.unbundle(self._repo, bundle, heads, b'push', url) |
418 if util.safehasattr(ret, b'getchunks'): | 418 if util.safehasattr(ret, 'getchunks'): |
419 # This is a bundle20 object, turn it into an unbundler. | 419 # This is a bundle20 object, turn it into an unbundler. |
420 # This little dance should be dropped eventually when the | 420 # This little dance should be dropped eventually when the |
421 # API is finally improved. | 421 # API is finally improved. |
422 stream = util.chunkbuffer(ret.getchunks()) | 422 stream = util.chunkbuffer(ret.getchunks()) |
423 ret = bundle2.getunbundler(self.ui, stream) | 423 ret = bundle2.getunbundler(self.ui, stream) |