Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 51642:f28c52a9f7b4
exchange: improve computation of relevant markers for large repos
Find the candidates for nodes with relevant markers by going over
all markers instead of iterating over all nodes. Most nodes will
not have markers anyway.
Further optimize the code by allowing revsets as well, which reduces the
materialization cost.
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 11 Jun 2024 18:47:50 +0200 |
parents | 69c5f8d6c710 |
children | a0f1378b932e |
line wrap: on
line diff
--- a/mercurial/exchange.py Wed Jun 12 11:29:11 2024 +0200 +++ b/mercurial/exchange.py Tue Jun 11 18:47:50 2024 +0200 @@ -703,8 +703,8 @@ repo = pushop.repo # very naive computation, that can be quite expensive on big repo. # However: evolution is currently slow on them anyway. - nodes = (c.node() for c in repo.set(b'::%ln', pushop.futureheads)) - pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes) + revs = repo.revs(b'::%ln', pushop.futureheads) + pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(revs=revs) @pushdiscovery(b'bookmarks') @@ -2605,8 +2605,8 @@ if kwargs.get('obsmarkers', False): if heads is None: heads = repo.heads() - subset = [c.node() for c in repo.set(b'::%ln', heads)] - markers = repo.obsstore.relevantmarkers(subset) + revs = repo.revs(b'::%ln', heads) + markers = repo.obsstore.relevantmarkers(revs=revs) markers = obsutil.sortedmarkers(markers) bundle2.buildobsmarkerspart(bundler, markers)