comparison mercurial/discovery.py @ 44667:b561f3a68e41 stable

discovery: avoid wrongly saying there are nothing to pull We can get in a situation where a revision passed through `hg pull --rev REV` are available on the server, but not a descendant of the advertised server heads. For example the server could lying be during heads advertisement, to hide some pull request. Or obsolete/hidden content could be explicitly pulled. So in this case the lookup associated to `REV` returned successfully, but the normal discovery will find all advertised heads already known locally. This flip a special boolean `anyinc` that will prevent any fetch attempt, preventing `REV` to be pulled over. We add three line of code to detect this case and make sure a pull actually happens. My main target is to make some third party extensions happy (I expect the associated test to move upstream with the extension). However this fix already make some of the `infinitepush` test happier.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Apr 2020 00:24:57 +0200
parents 7d5455b988ec
children 26ce8e751503
comparison
equal deleted inserted replaced
44650:3f29c5edac8e 44667:b561f3a68e41
65 remote, 65 remote,
66 abortwhenunrelated=not force, 66 abortwhenunrelated=not force,
67 ancestorsof=ancestorsof, 67 ancestorsof=ancestorsof,
68 ) 68 )
69 common, anyinc, srvheads = res 69 common, anyinc, srvheads = res
70 if heads and not anyinc:
71 # server could be lying on the advertised heads
72 has_node = repo.changelog.hasnode
73 anyinc = any(not has_node(n) for n in heads)
70 return (list(common), anyinc, heads or list(srvheads)) 74 return (list(common), anyinc, heads or list(srvheads))
71 75
72 76
73 class outgoing(object): 77 class outgoing(object):
74 '''Represents the set of nodes present in a local repo but not in a 78 '''Represents the set of nodes present in a local repo but not in a