# HG changeset patch # User Joerg Sonnenberger # Date 1641168596 -3600 # Node ID 28f0092ec89f53ccf6d7b2b92dcaf8e1b02e8c13 # Parent 88a45330b290c71fe6026bfcd43575cdcf21fc9f exchange: add fast path for subrepo check on push Try to check if .hgsub and .hgsubstate exist at all before looking for them in every changeset to be pushed. The latter can be quite expensive for large repositories and the existance check is almost free. Differential Revision: https://phab.mercurial-scm.org/D11956 diff -r 88a45330b290 -r 28f0092ec89f hgext/remotefilelog/README.md --- a/hgext/remotefilelog/README.md Wed Jan 05 11:34:54 2022 -0800 +++ b/hgext/remotefilelog/README.md Mon Jan 03 01:09:56 2022 +0100 @@ -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 ` will be much slower since it has to walk the entire commit history instead of just the filelog. Use `hg log -f ` 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 ` will be much slower since it has to walk the entire commit history instead of just the filelog. Use `hg log -f ` instead, which remains very fast. Contributing ============ diff -r 88a45330b290 -r 28f0092ec89f hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py Wed Jan 05 11:34:54 2022 -0800 +++ b/hgext/remotefilelog/remotefilelog.py Mon Jan 03 01:09:56 2022 +0100 @@ -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 -r 88a45330b290 -r 28f0092ec89f mercurial/exchange.py --- a/mercurial/exchange.py Wed Jan 05 11:34:54 2022 -0800 +++ b/mercurial/exchange.py Mon Jan 03 01:09:56 2022 +0100 @@ -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 -r 88a45330b290 -r 28f0092ec89f relnotes/next --- a/relnotes/next Wed Jan 05 11:34:54 2022 -0800 +++ b/relnotes/next Mon Jan 03 01:09:56 2022 +0100 @@ -15,6 +15,8 @@ == Backwards Compatibility Changes == +The remotefilelog extension now requires an appropiate excludepattern +for subrepositories. == Internal API Changes ==