##// END OF EJS Templates
exchange: improve computation of relevant markers for large repos...
Joerg Sonnenberger -
r52560:b8647465 default
parent child Browse files
Show More
@@ -1788,7 +1788,7 b' def _addpartsfromopts(ui, repo, bundler,'
1788 1788 addpartrevbranchcache(repo, bundler, outgoing)
1789 1789
1790 1790 if opts.get(b'obsolescence', False):
1791 obsmarkers = repo.obsstore.relevantmarkers(outgoing.missing)
1791 obsmarkers = repo.obsstore.relevantmarkers(nodes=outgoing.missing)
1792 1792 buildobsmarkerspart(
1793 1793 bundler,
1794 1794 obsmarkers,
@@ -703,8 +703,8 b' def _pushdiscoveryobsmarkers(pushop):'
703 703 repo = pushop.repo
704 704 # very naive computation, that can be quite expensive on big repo.
705 705 # However: evolution is currently slow on them anyway.
706 nodes = (c.node() for c in repo.set(b'::%ln', pushop.futureheads))
707 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
706 repo.revs(b'::%ln', pushop.futureheads)
707 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(revs=revs)
708 708
709 709
710 710 @pushdiscovery(b'bookmarks')
@@ -2603,10 +2603,15 b' def _getbundleobsmarkerpart('
2603 2603 ):
2604 2604 """add an obsolescence markers part to the requested bundle"""
2605 2605 if kwargs.get('obsmarkers', False):
2606 unfi_cl = repo.unfiltered().changelog
2606 2607 if heads is None:
2607 heads = repo.heads()
2608 subset = [c.node() for c in repo.set(b'::%ln', heads)]
2609 markers = repo.obsstore.relevantmarkers(subset)
2608 headrevs = repo.changelog.headrevs()
2609 else:
2610 get_rev = unfi_cl.index.get_rev
2611 headrevs = [get_rev(node) for node in heads]
2612 headrevs = [rev for rev in headrevs if rev is not None]
2613 revs = unfi_cl.ancestors(headrevs, inclusive=True)
2614 markers = repo.obsstore.relevantmarkers(revs=revs)
2610 2615 markers = obsutil.sortedmarkers(markers)
2611 2616 bundle2.buildobsmarkerspart(bundler, markers)
2612 2617
@@ -771,10 +771,11 b' class obsstore:'
771 771 _addchildren(self.children, markers)
772 772 _checkinvalidmarkers(self.repo, markers)
773 773
774 def relevantmarkers(self, nodes):
775 """return a set of all obsolescence markers relevant to a set of nodes.
774 def relevantmarkers(self, nodes=None, revs=None):
775 """return a set of all obsolescence markers relevant to a set of
776 nodes or revisions.
776 777
777 "relevant" to a set of nodes mean:
778 "relevant" to a set of nodes or revisions mean:
778 779
779 780 - marker that use this changeset as successor
780 781 - prune marker of direct children on this changeset
@@ -782,13 +783,33 b' class obsstore:'
782 783 markers
783 784
784 785 It is a set so you cannot rely on order."""
786 if nodes is None:
787 nodes = set()
788 if revs is None:
789 revs = set()
785 790
786 pendingnodes = set(nodes)
787 seenmarkers = set()
788 seennodes = set(pendingnodes)
791 tonode = self.repo.unfiltered().changelog.node
792 pendingnodes = set()
789 793 precursorsmarkers = self.predecessors
790 794 succsmarkers = self.successors
791 795 children = self.children
796 for node in nodes:
797 if (
798 node in precursorsmarkers
799 or node in succsmarkers
800 or node in children
801 ):
802 pendingnodes.add(node)
803 for rev in revs:
804 node = tonode(rev)
805 if (
806 node in precursorsmarkers
807 or node in succsmarkers
808 or node in children
809 ):
810 pendingnodes.add(node)
811 seenmarkers = set()
812 seennodes = pendingnodes.copy()
792 813 while pendingnodes:
793 814 direct = set()
794 815 for current in pendingnodes:
@@ -108,7 +108,7 b' def getmarkers(repo, nodes=None, exclusi'
108 108 elif exclusive:
109 109 rawmarkers = exclusivemarkers(repo, nodes)
110 110 else:
111 rawmarkers = repo.obsstore.relevantmarkers(nodes)
111 rawmarkers = repo.obsstore.relevantmarkers(nodes=nodes)
112 112
113 113 for markerdata in rawmarkers:
114 114 yield marker(repo, markerdata)
General Comments 0
You need to be logged in to leave comments. Login now