mercurial/localrepo.py
changeset 49493 4367c46a89ee
parent 49472 f59e49f6bee4
child 49540 bc2ecf08ae04
child 49571 8fa3f7c3a9ad
--- 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):