sapling/hgext/fastmanifest
Martijn Pieters 0aa55642b8 hg: make sure len(manifest) always raises TypeError
Summary:
`len()` on a hybrid manifest wrapping a treemanifest would raise an attribute error. But if there is no treemanifest or there is *only* a treemanifest, then a TypeError is raised. Using `len()` on an object that doesn't support length should always raise `TypeError`, consistently.

Instead of looking up the `__len__` attribute, use the built-in `len()` function, which will raise `TypeError` if the wrapped manifest in a hybrid doesn't have a `__len__` method. This ensures that we get a consistent exception.

Reviewed By: farnz

Differential Revision: D7485510

fbshipit-source-id: 4132d6b383171cde8dd99dd60098716d4aedc527
2018-04-13 21:51:45 -07:00
..
__init__.py codemod: use single blank line 2018-04-13 21:51:08 -07:00
cachemanager.py hg: don't use statvfs when it's not available 2018-04-13 21:51:45 -07:00
concurrency.py fastmanifest: fix import paths 2018-01-09 15:23:52 -08:00
constants.py fastmanifest: fix import paths 2018-01-09 15:23:52 -08:00
debug.py fastmanifest: fix import paths 2018-01-09 15:23:52 -08:00
implementation.py hg: make sure len(manifest) always raises TypeError 2018-04-13 21:51:45 -07:00
metrics.py fastmanifest: fix import paths 2018-01-09 15:23:52 -08:00