Mercurial > hg
changeset 49493:4367c46a89ee
requires: re-use vfs.tryread for simplicity
Avoids calling `set` twice or having to re-raise an exception and implements the routine with a single return expression.
author | Jason R. Coombs <jaraco@jaraco.com> |
---|---|
date | Wed, 07 Sep 2022 14:56:45 -0400 |
parents | c6a1beba27e9 |
children | c96ed4029fda |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Aug 30 15:29:55 2022 -0400 +++ b/mercurial/localrepo.py Wed Sep 07 14:56:45 2022 -0400 @@ -522,12 +522,8 @@ # the repository. This file was introduced in Mercurial 0.9.2, # which means very old repositories may not have one. We assume # a missing file translates to no requirements. - try: - return set(vfs.read(b'requires').splitlines()) - except FileNotFoundError: - if not allowmissing: - raise - return set() + read = vfs.tryread if allowmissing else vfs.read + return set(read(b'requires').splitlines()) def makelocalrepository(baseui, path, intents=None):