# HG changeset patch # User Jason R. Coombs # Date 1662577005 14400 # Node ID 4367c46a89eeaa7000a08cf595d0b6bc3a06e712 # Parent c6a1beba27e9fd5590f128e1abca4ee22cb60142 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. diff -r c6a1beba27e9 -r 4367c46a89ee mercurial/localrepo.py --- 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):