comparison mercurial/exchange.py @ 43545:9c1f4e2f1fc4

index: use `index.has_node` in `exchange._pulldiscoverychangegroup` Differential Revision: https://phab.mercurial-scm.org/D7346
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 08 Nov 2019 16:00:47 +0100
parents 9f70512ae2cf
children a49b2e253035
comparison
equal deleted inserted replaced
43544:886ec3962c66 43545:9c1f4e2f1fc4
1853 at some point.""" 1853 at some point."""
1854 tmp = discovery.findcommonincoming( 1854 tmp = discovery.findcommonincoming(
1855 pullop.repo, pullop.remote, heads=pullop.heads, force=pullop.force 1855 pullop.repo, pullop.remote, heads=pullop.heads, force=pullop.force
1856 ) 1856 )
1857 common, fetch, rheads = tmp 1857 common, fetch, rheads = tmp
1858 nm = pullop.repo.unfiltered().changelog.nodemap 1858 has_node = pullop.repo.unfiltered().changelog.index.has_node
1859 if fetch and rheads: 1859 if fetch and rheads:
1860 # If a remote heads is filtered locally, put in back in common. 1860 # If a remote heads is filtered locally, put in back in common.
1861 # 1861 #
1862 # This is a hackish solution to catch most of "common but locally 1862 # This is a hackish solution to catch most of "common but locally
1863 # hidden situation". We do not performs discovery on unfiltered 1863 # hidden situation". We do not performs discovery on unfiltered
1866 # 1866 #
1867 # If a set of such "common but filtered" changeset exist on the server 1867 # If a set of such "common but filtered" changeset exist on the server
1868 # but are not including a remote heads, we'll not be able to detect it, 1868 # but are not including a remote heads, we'll not be able to detect it,
1869 scommon = set(common) 1869 scommon = set(common)
1870 for n in rheads: 1870 for n in rheads:
1871 if n in nm: 1871 if has_node(n):
1872 if n not in scommon: 1872 if n not in scommon:
1873 common.append(n) 1873 common.append(n)
1874 if set(rheads).issubset(set(common)): 1874 if set(rheads).issubset(set(common)):
1875 fetch = [] 1875 fetch = []
1876 pullop.common = common 1876 pullop.common = common