D5166: localrepo: support marking repos as having shallow file storage
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Oct 22 11:49:39 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7e3b6c4f01a2: localrepo: support marking repos as having shallow file storage (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5166?vs=12272&id=12302
REVISION DETAIL
https://phab.mercurial-scm.org/D5166
AFFECTED FILES
hgext/sqlitestore.py
mercurial/hg.py
mercurial/localrepo.py
mercurial/repository.py
CHANGE DETAILS
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -29,6 +29,8 @@
REPO_FEATURE_LFS = b'lfs'
# Repository supports being stream cloned.
REPO_FEATURE_STREAM_CLONE = b'streamclone'
+# Files storage may lack data for all ancestors.
+REPO_FEATURE_SHALLOW_FILE_STORAGE = b'shallowfilestorage'
REVISION_FLAG_CENSORED = 1 << 15
REVISION_FLAG_ELLIPSIS = 1 << 14
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2922,6 +2922,7 @@
'sharedrepo',
'sharedrelative',
'shareditems',
+ 'shallowfilestore',
}
return {k: v for k, v in createopts.items() if k not in known}
@@ -2949,6 +2950,9 @@
is stored as an absolute path.
shareditems
Set of items to share to the new repository (in addition to storage).
+ shallowfilestore
+ Indicates that storage for files should be shallow (not all ancestor
+ revisions are known).
"""
createopts = defaultcreateopts(ui, createopts=createopts)
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -578,6 +578,9 @@
createopts['narrowfiles'] = True
+ if depth:
+ createopts['shallowfilestore'] = True
+
if srcpeer.capable(b'lfs-serve'):
# Repository creation honors the config if it disabled the extension, so
# we can't just announce that lfs will be enabled. This check avoids
diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py
--- a/hgext/sqlitestore.py
+++ b/hgext/sqlitestore.py
@@ -101,6 +101,7 @@
REQUIREMENT_ZSTD = b'exp-sqlite-comp-001=zstd'
REQUIREMENT_ZLIB = b'exp-sqlite-comp-001=zlib'
REQUIREMENT_NONE = b'exp-sqlite-comp-001=none'
+REQUIREMENT_SHALLOW_FILES = b'exp-sqlite-shallow-files'
CURRENT_SCHEMA_VERSION = 1
@@ -1014,6 +1015,8 @@
supported.add(REQUIREMENT_ZLIB)
supported.add(REQUIREMENT_NONE)
+ supported.add(REQUIREMENT_SHALLOW_FILES)
+ supported.add(repository.NARROW_REQUIREMENT)
def newreporequirements(orig, ui, createopts):
if createopts['backend'] != 'sqlite':
@@ -1030,6 +1033,7 @@
known = {
'narrowfiles',
'backend',
+ 'shallowfilestore',
}
unsupported = set(createopts) - known
@@ -1061,6 +1065,9 @@
raise error.Abort(_('unknown compression engine defined in '
'storage.sqlite.compression: %s') % compression)
+ if createopts.get('shallowfilestore'):
+ requirements.add(REQUIREMENT_SHALLOW_FILES)
+
return requirements
@interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
@@ -1082,12 +1089,15 @@
return sqlitefilestore(self._dbconn, path, compression)
-def makefilestorage(orig, requirements, **kwargs):
+def makefilestorage(orig, requirements, features, **kwargs):
"""Produce a type conforming to ``ilocalrepositoryfilestorage``."""
if REQUIREMENT in requirements:
+ if REQUIREMENT_SHALLOW_FILES in requirements:
+ features.add(repository.REPO_FEATURE_SHALLOW_FILE_STORAGE)
+
return sqlitefilestorage
else:
- return orig(requirements=requirements, **kwargs)
+ return orig(requirements=requirements, features=features, **kwargs)
def makemain(orig, ui, requirements, **kwargs):
if REQUIREMENT in requirements:
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list