[Updated] D8911: repository: introduce constant for sparse repo requirement and use it
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Aug 8 17:30:23 UTC 2020
Closed by commit rHGa1f51c7dce0f: repository: introduce constant for sparse repo requirement and use it (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D8911?vs=22325&id=22354#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8911?vs=22325&id=22354
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8911/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8911
AFFECTED FILES
mercurial/interfaces/repository.py
mercurial/localrepo.py
mercurial/sparse.py
CHANGE DETAILS
diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -24,8 +24,10 @@
scmutil,
util,
)
+from .interfaces import repository
from .utils import hashutil
+
# Whether sparse features are enabled. This variable is intended to be
# temporary to facilitate porting sparse to core. It should eventually be
# a per-repo option, possibly a repo requirement.
@@ -606,11 +608,11 @@
# updated. But this requires massive rework to matcher() and its
# consumers.
- if b'exp-sparse' in oldrequires and removing:
- repo.requirements.discard(b'exp-sparse')
+ if repository.SPARSE_REQUIREMENT in oldrequires and removing:
+ repo.requirements.discard(repository.SPARSE_REQUIREMENT)
scmutil.writereporequirements(repo)
- elif b'exp-sparse' not in oldrequires:
- repo.requirements.add(b'exp-sparse')
+ elif repository.SPARSE_REQUIREMENT not in oldrequires:
+ repo.requirements.add(repository.SPARSE_REQUIREMENT)
scmutil.writereporequirements(repo)
try:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -816,7 +816,7 @@
``error.RepoError`` should be raised on failure.
"""
- if b'exp-sparse' in requirements and not sparse.enabled:
+ if repository.SPARSE_REQUIREMENT in requirements and not sparse.enabled:
raise error.RepoError(
_(
b'repository is using sparse feature but '
@@ -1067,7 +1067,7 @@
b'shared',
b'relshared',
b'dotencode',
- b'exp-sparse',
+ repository.SPARSE_REQUIREMENT,
b'internal-phase',
}
diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -15,6 +15,9 @@
# we should move this to just "narrow" or similar.
NARROW_REQUIREMENT = b'narrowhg-experimental'
+# Enables sparse working directory usage
+SPARSE_REQUIREMENT = b'exp-sparse'
+
# Local repository feature string.
# Revlogs are being used for file storage.
To: pulkit, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200808/b30ec4e6/attachment-0002.html>
More information about the Mercurial-patches
mailing list