Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 51581:5b99b64328f2
phases: use revision number in `_pushdiscoveryphase`
We now reach our target checkpoint in terms of rev-num conversion. The
`_pushdiscoveryphase` function is now performing graph computation based on
revision number only. Avoiding repeated conversion from node-id to rev-num.
See previous changeset updated `new_heads` for rationnal.
Again, time saved in the 100 milliseconds order of magnitude for the mozilla-try
benchmark I have been using.
However, wow that the logic is done using revision number, we can look into having
better logic in the next changesets, which will provide a much bigger speedup.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 05 Apr 2024 14:13:47 +0200 |
parents | 22cc679a7312 |
children | 1cef1412af3e |
comparison
equal
deleted
inserted
replaced
51580:22cc679a7312 | 51581:5b99b64328f2 |
---|---|
643 pushop.outdatedphases = [] | 643 pushop.outdatedphases = [] |
644 pushop.fallbackoutdatedphases = [] | 644 pushop.fallbackoutdatedphases = [] |
645 return | 645 return |
646 | 646 |
647 fallbackheads_rev = [to_rev(n) for n in pushop.fallbackheads] | 647 fallbackheads_rev = [to_rev(n) for n in pushop.fallbackheads] |
648 futureheads_rev = [to_rev(n) for n in pushop.futureheads] | |
648 | 649 |
649 pushop.remotephases = phases.RemotePhasesSummary( | 650 pushop.remotephases = phases.RemotePhasesSummary( |
650 pushop.repo, | 651 pushop.repo, |
651 fallbackheads_rev, | 652 fallbackheads_rev, |
652 remotephases, | 653 remotephases, |
654 droots = pushop.remotephases.draft_roots | 655 droots = pushop.remotephases.draft_roots |
655 | 656 |
656 extracond = b'' | 657 extracond = b'' |
657 if not pushop.remotephases.publishing: | 658 if not pushop.remotephases.publishing: |
658 extracond = b' and public()' | 659 extracond = b' and public()' |
659 revset = b'heads((%%ld::%%ln) %s)' % extracond | 660 revset = b'heads((%%ld::%%ld) %s)' % extracond |
660 # Get the list of all revs draft on remote by public here. | 661 # Get the list of all revs draft on remote by public here. |
661 # XXX Beware that revset break if droots is not strictly | 662 # XXX Beware that revset break if droots is not strictly |
662 # XXX root we may want to ensure it is but it is costly | 663 # XXX root we may want to ensure it is but it is costly |
663 fallback = list(unfi.set(revset, droots, pushop.fallbackheads)) | 664 fallback = list(unfi.set(revset, droots, fallbackheads_rev)) |
664 if not pushop.remotephases.publishing and pushop.publish: | 665 if not pushop.remotephases.publishing and pushop.publish: |
665 future = list( | 666 future = list( |
666 unfi.set( | 667 unfi.set( |
667 b'%ln and (not public() or %ld::)', pushop.futureheads, droots | 668 b'%ld and (not public() or %ld::)', futureheads_rev, droots |
668 ) | 669 ) |
669 ) | 670 ) |
670 elif not outgoing.missing: | 671 elif not outgoing.missing: |
671 future = fallback | 672 future = fallback |
672 else: | 673 else: |
673 # adds changeset we are going to push as draft | 674 # adds changeset we are going to push as draft |
674 # | 675 # |
675 # should not be necessary for publishing server, but because of an | 676 # should not be necessary for publishing server, but because of an |
676 # issue fixed in xxxxx we have to do it anyway. | 677 # issue fixed in xxxxx we have to do it anyway. |
677 fdroots = list( | 678 missing_rev = [to_rev(n) for n in outgoing.missing] |
678 unfi.set(b'roots(%ln + %ld::)', outgoing.missing, droots) | 679 fdroots = list(unfi.set(b'roots(%ld + %ld::)', missing_rev, droots)) |
679 ) | |
680 fdroots = [f.rev() for f in fdroots] | 680 fdroots = [f.rev() for f in fdroots] |
681 future = list(unfi.set(revset, fdroots, pushop.futureheads)) | 681 future = list(unfi.set(revset, fdroots, futureheads_rev)) |
682 pushop.outdatedphases = future | 682 pushop.outdatedphases = future |
683 pushop.fallbackoutdatedphases = fallback | 683 pushop.fallbackoutdatedphases = fallback |
684 | 684 |
685 | 685 |
686 @pushdiscovery(b'obsmarker') | 686 @pushdiscovery(b'obsmarker') |