Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 48578:28f0092ec89f
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
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Mon, 03 Jan 2022 01:09:56 +0100 |
parents | 04688c51f81f |
children | 6000f5b25c9b |
line wrap: on
line diff
--- 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):