##// END OF EJS Templates
exchange: improve computation of relevant markers for large repos...
Joerg Sonnenberger -
r52537:f28c52a9 default
parent child Browse files
Show More
@@ -1788,7 +1788,7 b' def _addpartsfromopts(ui, repo, bundler,'
1788 addpartrevbranchcache(repo, bundler, outgoing)
1788 addpartrevbranchcache(repo, bundler, outgoing)
1789
1789
1790 if opts.get(b'obsolescence', False):
1790 if opts.get(b'obsolescence', False):
1791 obsmarkers = repo.obsstore.relevantmarkers(outgoing.missing)
1791 obsmarkers = repo.obsstore.relevantmarkers(nodes=outgoing.missing)
1792 buildobsmarkerspart(
1792 buildobsmarkerspart(
1793 bundler,
1793 bundler,
1794 obsmarkers,
1794 obsmarkers,
@@ -703,8 +703,8 b' def _pushdiscoveryobsmarkers(pushop):'
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')
@@ -2605,8 +2605,8 b' def _getbundleobsmarkerpart('
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
@@ -771,10 +771,11 b' class obsstore:'
771 _addchildren(self.children, markers)
771 _addchildren(self.children, markers)
772 _checkinvalidmarkers(self.repo, markers)
772 _checkinvalidmarkers(self.repo, markers)
773
773
774 def relevantmarkers(self, nodes):
774 def relevantmarkers(self, nodes=None, revs=None):
775 """return a set of all obsolescence markers relevant to a set of nodes.
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 - marker that use this changeset as successor
780 - marker that use this changeset as successor
780 - prune marker of direct children on this changeset
781 - prune marker of direct children on this changeset
@@ -782,10 +783,24 b' class obsstore:'
782 markers
783 markers
783
784
784 It is a set so you cannot rely on order."""
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)
791 get_rev = self.repo.unfiltered().changelog.index.get_rev
792 pendingnodes = set()
793 for marker in self._all:
794 for node in (marker[0],) + marker[1] + (marker[5] or ()):
795 if node in nodes:
796 pendingnodes.add(node)
797 elif revs:
798 rev = get_rev(node)
799 if rev is not None and rev in revs:
800 pendingnodes.add(node)
787 seenmarkers = set()
801 seenmarkers = set()
788 seennodes = set(pendingnodes)
802 seenmarkers = set()
803 seennodes = set()
789 precursorsmarkers = self.predecessors
804 precursorsmarkers = self.predecessors
790 succsmarkers = self.successors
805 succsmarkers = self.successors
791 children = self.children
806 children = self.children
@@ -108,7 +108,7 b' def getmarkers(repo, nodes=None, exclusi'
108 elif exclusive:
108 elif exclusive:
109 rawmarkers = exclusivemarkers(repo, nodes)
109 rawmarkers = exclusivemarkers(repo, nodes)
110 else:
110 else:
111 rawmarkers = repo.obsstore.relevantmarkers(nodes)
111 rawmarkers = repo.obsstore.relevantmarkers(nodes=nodes)
112
112
113 for markerdata in rawmarkers:
113 for markerdata in rawmarkers:
114 yield marker(repo, markerdata)
114 yield marker(repo, markerdata)
General Comments 0
You need to be logged in to leave comments. Login now