comparison mercurial/exchange.py @ 51641: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
comparison
equal deleted inserted replaced
51639:69c5f8d6c710 51641:f28c52a9f7b4
701 return 701 return
702 702
703 repo = pushop.repo 703 repo = pushop.repo
704 # very naive computation, that can be quite expensive on big repo. 704 # very naive computation, that can be quite expensive on big repo.
705 # However: evolution is currently slow on them anyway. 705 # However: evolution is currently slow on them anyway.
706 nodes = (c.node() for c in repo.set(b'::%ln', pushop.futureheads)) 706 revs = repo.revs(b'::%ln', pushop.futureheads)
707 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes) 707 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(revs=revs)
708 708
709 709
710 @pushdiscovery(b'bookmarks') 710 @pushdiscovery(b'bookmarks')
711 def _pushdiscoverybookmarks(pushop): 711 def _pushdiscoverybookmarks(pushop):
712 ui = pushop.ui 712 ui = pushop.ui
2603 ): 2603 ):
2604 """add an obsolescence markers part to the requested bundle""" 2604 """add an obsolescence markers part to the requested bundle"""
2605 if kwargs.get('obsmarkers', False): 2605 if kwargs.get('obsmarkers', False):
2606 if heads is None: 2606 if heads is None:
2607 heads = repo.heads() 2607 heads = repo.heads()
2608 subset = [c.node() for c in repo.set(b'::%ln', heads)] 2608 revs = repo.revs(b'::%ln', heads)
2609 markers = repo.obsstore.relevantmarkers(subset) 2609 markers = repo.obsstore.relevantmarkers(revs=revs)
2610 markers = obsutil.sortedmarkers(markers) 2610 markers = obsutil.sortedmarkers(markers)
2611 bundle2.buildobsmarkerspart(bundler, markers) 2611 bundle2.buildobsmarkerspart(bundler, markers)
2612 2612
2613 2613
2614 @getbundle2partsgenerator(b'phases') 2614 @getbundle2partsgenerator(b'phases')