Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 48549: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 |
comparison
equal
deleted
inserted
replaced
48548:88a45330b290 | 48549:28f0092ec89f |
---|---|
519 step(pushop) | 519 step(pushop) |
520 | 520 |
521 | 521 |
522 def _checksubrepostate(pushop): | 522 def _checksubrepostate(pushop): |
523 """Ensure all outgoing referenced subrepo revisions are present locally""" | 523 """Ensure all outgoing referenced subrepo revisions are present locally""" |
524 | |
525 repo = pushop.repo | |
526 | |
527 # If the repository does not use subrepos, skip the expensive | |
528 # manifest checks. | |
529 if not len(repo.file(b'.hgsub')) or not len(repo.file(b'.hgsubstate')): | |
530 return | |
531 | |
524 for n in pushop.outgoing.missing: | 532 for n in pushop.outgoing.missing: |
525 ctx = pushop.repo[n] | 533 ctx = repo[n] |
526 | 534 |
527 if b'.hgsub' in ctx.manifest() and b'.hgsubstate' in ctx.files(): | 535 if b'.hgsub' in ctx.manifest() and b'.hgsubstate' in ctx.files(): |
528 for subpath in sorted(ctx.substate): | 536 for subpath in sorted(ctx.substate): |
529 sub = ctx.sub(subpath) | 537 sub = ctx.sub(subpath) |
530 sub.verify(onpush=True) | 538 sub.verify(onpush=True) |