Patchwork D8913: scmutil: introduce filterrequirements() to split reqs into wc and store ones

login
register
mail settings
Submitter phabricator
Date Aug. 7, 2020, 12:45 p.m.
Message ID <differential-rev-PHID-DREV-cnqrrvx6xixgnjw4torf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47011/
State Superseded
Headers show

Comments

phabricator - Aug. 7, 2020, 12:45 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In upcoming patches where we try to implement requirements in store, we will
  need a mechanism to split all requirements on some basis and decide which one
  goes to `.hg/requires` and which one goes to `.hg/store/requires`.
  
  This patch introduce a separate function for that. It does not do anything for
  now but will be doing something soon.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8913

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1470,11 +1470,26 @@ 
     repo._quick_access_changeid_invalidate()
 
 
+def filterrequirements(requirements):
+    """ filters the requirements into two sets:
+
+    wcreq: requirements which should be written in .hg/requires
+    storereq: which should be written in .hg/store/requires
+
+    Returns (wcreq, storereq)
+    """
+    return requirements, None
+
+
 def writereporequirements(repo, requirements=None):
     """ writes requirements for the repo to .hg/requires """
     if requirements:
         repo.requirements = requirements
-    writerequires(repo.vfs, repo.requirements)
+    wcreq, storereq = filterrequirements(repo.requirements)
+    if wcreq:
+        writerequires(repo.vfs, wcreq)
+    if storereq:
+        writerequires(repo.svfs, storereq)
 
 
 def writerequires(opener, requirements):