##// 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 # make sure tests are repeatable
785 # make sure tests are repeatable
786 random.seed(int(opts['seed']))
786 random.seed(int(opts['seed']))
787
787
788 def doit(pushedrevs, remoteheads, remote=remote):
788
789 if opts.get('old'):
789
790 if opts.get('old'):
791 def doit(pushedrevs, remoteheads, remote=remote):
790 if not util.safehasattr(remote, 'branches'):
792 if not util.safehasattr(remote, 'branches'):
791 # enable in-client legacy support
793 # enable in-client legacy support
792 remote = localrepo.locallegacypeer(remote.local())
794 remote = localrepo.locallegacypeer(remote.local())
@@ -800,26 +802,30 b' def debugdiscovery(ui, repo, remoteurl="'
800 clnode = repo.changelog.node
802 clnode = repo.changelog.node
801 common = repo.revs('heads(::%ln)', common)
803 common = repo.revs('heads(::%ln)', common)
802 common = {clnode(r) for r in common}
804 common = {clnode(r) for r in common}
803 else:
805 return common, hds
806 else:
807 def doit(pushedrevs, remoteheads, remote=remote):
804 nodes = None
808 nodes = None
805 if pushedrevs:
809 if pushedrevs:
806 revs = scmutil.revrange(repo, pushedrevs)
810 revs = scmutil.revrange(repo, pushedrevs)
807 nodes = [repo[r].node() for r in revs]
811 nodes = [repo[r].node() for r in revs]
808 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
812 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
809 ancestorsof=nodes)
813 ancestorsof=nodes)
810 common = set(common)
814 return common, hds
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"))
819
815
820 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
816 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
821 localrevs = opts['rev']
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 _chunksize = 4 << 10
830 _chunksize = 4 << 10
825
831
General Comments 0
You need to be logged in to leave comments. Login now