diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -57,7 +57,7 @@ if all(knownnode(h) for h in heads): return (heads, False, heads) - res = setdiscovery.findcommonheads(repo.ui, repo, remote, heads, + res = setdiscovery.findcommonheads(repo.ui, repo, remote, abortwhenunrelated=not force, ancestorsof=ancestorsof) common, anyinc, srvheads = res diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -130,7 +130,7 @@ sample = set(random.sample(sample, desiredlen)) return sample -def findcommonheads(ui, local, remote, heads=None, +def findcommonheads(ui, local, remote, initialsamplesize=100, fullsamplesize=200, abortwhenunrelated=True, @@ -155,15 +155,11 @@ sample = _limitsample(ownheads, initialsamplesize) # indices between sample and externalized version must match sample = list(sample) - if heads: - srvheadhashes = heads - yesno = remote.known(dag.externalizeall(sample)) - else: - batch = remote.iterbatch() - batch.heads() - batch.known(dag.externalizeall(sample)) - batch.submit() - srvheadhashes, yesno = batch.results() + batch = remote.iterbatch() + batch.heads() + batch.known(dag.externalizeall(sample)) + batch.submit() + srvheadhashes, yesno = batch.results() if cl.tip() == nullid: if srvheadhashes != [nullid]: