[Updated] D11956: exchange: add fast path for subrepo check on push
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Mon Jan 17 10:54:36 UTC 2022
Closed by commit rHG28f0092ec89f: exchange: add fast path for subrepo check on push (authored by joerg.sonnenberger).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11956?vs=31624&id=31659
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11956/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11956
AFFECTED FILES
hgext/remotefilelog/README.md
hgext/remotefilelog/remotefilelog.py
mercurial/exchange.py
relnotes/next
CHANGE DETAILS
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -15,6 +15,8 @@
== Backwards Compatibility Changes ==
+The remotefilelog extension now requires an appropiate excludepattern
+for subrepositories.
== Internal API Changes ==
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -521,8 +521,16 @@
def _checksubrepostate(pushop):
"""Ensure all outgoing referenced subrepo revisions are present locally"""
+
+ repo = pushop.repo
+
+ # If the repository does not use subrepos, skip the expensive
+ # manifest checks.
+ if not len(repo.file(b'.hgsub')) or not len(repo.file(b'.hgsubstate')):
+ return
+
for n in pushop.outgoing.missing:
- ctx = pushop.repo[n]
+ ctx = repo[n]
if b'.hgsub' in ctx.manifest() and b'.hgsubstate' in ctx.files():
for subpath in sorted(ctx.substate):
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -244,11 +244,11 @@
__bool__ = __nonzero__
def __len__(self):
- if self.filename == b'.hgtags':
- # The length of .hgtags is used to fast path tag checking.
- # remotefilelog doesn't support .hgtags since the entire .hgtags
- # history is needed. Use the excludepattern setting to make
- # .hgtags a normal filelog.
+ if self.filename in (b'.hgtags', b'.hgsub', b'.hgsubstate'):
+ # Global tag and subrepository support require access to the
+ # file history for various performance sensitive operations.
+ # excludepattern should be used for repositories depending on
+ # those features to fallback to regular filelog.
return 0
raise RuntimeError(b"len not supported")
diff --git a/hgext/remotefilelog/README.md b/hgext/remotefilelog/README.md
--- a/hgext/remotefilelog/README.md
+++ b/hgext/remotefilelog/README.md
@@ -88,7 +88,9 @@
4. Tags are not supported in completely shallow repos. If you use tags in your repo you will have to specify `excludepattern=.hgtags` in your client configuration to ensure that file is downloaded. The include/excludepattern settings are experimental at the moment and have yet to be deployed in a production environment.
-5. A few commands will be slower. `hg log <filename>` will be much slower since it has to walk the entire commit history instead of just the filelog. Use `hg log -f <filename>` instead, which remains very fast.
+5. Similarly, subrepositories should not be used with completely shallow repos. Use `excludepattern=.hgsub*` in your client configuration to ensure that the files are downloaded.
+
+6. A few commands will be slower. `hg log <filename>` will be much slower since it has to walk the entire commit history instead of just the filelog. Use `hg log -f <filename>` instead, which remains very fast.
Contributing
============
To: joerg.sonnenberger, #hg-reviewers, Alphare
Cc: mharbison72, Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220117/5a439f27/attachment-0002.html>
More information about the Mercurial-patches
mailing list