[PATCH 06 of 10] scmutil: allow reading repo requires without checking

Jun Wu quark at fb.com
Thu Feb 9 20:46:20 EST 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1486687506 28800
#      Thu Feb 09 16:45:06 2017 -0800
# Node ID d93bba366d42f9537a5556d7ff948848b608d02c
# Parent  76448b71f139b1fa06f2dbce04ac3f91ffd93f9d
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r d93bba366d42
scmutil: allow reading repo requires without checking

This allows the side-effect-free baselocalrepository to load repo
requirements without checking them.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1204,8 +1204,10 @@ def dirstatecopy(ui, repo, wctx, src, ds
             wctx.copy(origsrc, dst)
 
-def readrequires(opener, supported):
+def readrequires(opener, supported, checkmissing=True):
     '''Reads and parses .hg/requires and checks if all entries found
     are in the list of supported features.'''
     requirements = set(opener.read("requires").splitlines())
+    if not checkmissing:
+        return requirements
     missings = []
     for r in requirements:


More information about the Mercurial-devel mailing list