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 ` 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 --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py +++ b/hgext/remotefilelog/remotefilelog.py @@ -245,11 +245,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/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -522,8 +522,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/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 ==