changeset 39551:261f1e8dc300

localrepo: add requirement when narrow files creation option present The previous commit taught hg.clone() to define a creation option when file include or exclude patterns are passed. This commit teaches the new repo creation code to convert that creation option into a repository requirement. While not yet used by the narrow extension, the eventual side-effect of this change is that newly-created repositories will have the narrow requirement from their creation onset. Currently, the requirement is added to the repo at exchange.pull() time via a wrapped function in the narrow extension. Differential Revision: https://phab.mercurial-scm.org/D4537
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 11 Sep 2018 14:16:05 -0700
parents 65b5900f30be
children 4c807ec07888
files mercurial/localrepo.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Sep 11 17:15:35 2018 -0700
+++ b/mercurial/localrepo.py	Tue Sep 11 14:16:05 2018 -0700
@@ -2440,6 +2440,9 @@
     if ui.configbool('format', 'internal-phase'):
         requirements.add('internal-phase')
 
+    if createopts.get('narrowfiles'):
+        requirements.add(repository.NARROW_REQUIREMENT)
+
     return requirements
 
 def filterknowncreateopts(ui, createopts):
@@ -2456,7 +2459,9 @@
     Extensions can wrap this function to filter out creation options
     they know how to handle.
     """
-    return dict(createopts)
+    known = {'narrowfiles'}
+
+    return {k: v for k, v in createopts.items() if k not in known}
 
 def createrepository(ui, wdirvfs, createopts=None):
     """Create a new repository in a vfs.