##// END OF EJS Templates
debugdiscovery: small internal refactoring...
marmoute -
r42198:d31d8c52 default
parent child Browse files
Show More
@@ -785,8 +785,10 b' def debugdiscovery(ui, repo, remoteurl="'
785 785 # make sure tests are repeatable
786 786 random.seed(int(opts['seed']))
787 787
788 def doit(pushedrevs, remoteheads, remote=remote):
789 if opts.get('old'):
788
789
790 if opts.get('old'):
791 def doit(pushedrevs, remoteheads, remote=remote):
790 792 if not util.safehasattr(remote, 'branches'):
791 793 # enable in-client legacy support
792 794 remote = localrepo.locallegacypeer(remote.local())
@@ -800,26 +802,30 b' def debugdiscovery(ui, repo, remoteurl="'
800 802 clnode = repo.changelog.node
801 803 common = repo.revs('heads(::%ln)', common)
802 804 common = {clnode(r) for r in common}
803 else:
805 return common, hds
806 else:
807 def doit(pushedrevs, remoteheads, remote=remote):
804 808 nodes = None
805 809 if pushedrevs:
806 810 revs = scmutil.revrange(repo, pushedrevs)
807 811 nodes = [repo[r].node() for r in revs]
808 812 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
809 813 ancestorsof=nodes)
810 common = set(common)
811 rheads = set(hds)
812 lheads = set(repo.heads())
813 ui.write(("common heads: %s\n") %
814 " ".join(sorted(short(n) for n in common)))
815 if lheads <= common:
816 ui.write(("local is subset\n"))
817 elif rheads <= common:
818 ui.write(("remote is subset\n"))
814 return common, hds
819 815
820 816 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
821 817 localrevs = opts['rev']
822 doit(localrevs, remoterevs)
818 common, hds = doit(localrevs, remoterevs)
819
820 common = set(common)
821 rheads = set(hds)
822 lheads = set(repo.heads())
823 ui.write(("common heads: %s\n") %
824 " ".join(sorted(short(n) for n in common)))
825 if lheads <= common:
826 ui.write(("local is subset\n"))
827 elif rheads <= common:
828 ui.write(("remote is subset\n"))
823 829
824 830 _chunksize = 4 << 10
825 831
General Comments 0
You need to be logged in to leave comments. Login now