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