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

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 1:46 a.m.
Message ID <d93bba366d42f9537a55.1486691180@localhost.localdomain>
Download mbox | patch
Permalink /patch/18380/
State Deferred
Headers show

Comments

Jun Wu - Feb. 10, 2017, 1:46 a.m.
# HG changeset patch
# User Jun Wu <quark@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.

Patch

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: