comparison mercurial/localrepo.py @ 27319:b64b6fdc5c9b

discovery: properly filter changeset in 'peer.known' (issue4982) The 'peer.known' call (handled at the repository level) was applying its own manual filtering (looking at phases) instead of relying on the repoview mechanism. This led to the discovery finding more "common" node that 'getbundle' was willing to recognised. From there, bad things happen, issue4982 is a symptom of it. While situations like described in issue4982 can still happen because of race conditions, fixing 'peer.known' is important for consistency in all cases. We update the code to use 'repoview' filtering. This lead to small changes in the tests for exchanging obsolescence marker because the discovery yields different results. The test affected in 'test-obsolete-changeset-exchange.t' is a test for issue4982 getting back to its expected state.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 02 Dec 2015 16:12:15 -0800
parents a18328aad48c
children 798535853345
comparison
equal deleted inserted replaced
27318:95a54824ab00 27319:b64b6fdc5c9b
806 806
807 repo = (remote and remote.local()) and remote or self 807 repo = (remote and remote.local()) and remote or self
808 return repo[key].branch() 808 return repo[key].branch()
809 809
810 def known(self, nodes): 810 def known(self, nodes):
811 nm = self.changelog.nodemap 811 cl = self.changelog
812 pc = self._phasecache 812 nm = cl.nodemap
813 filtered = cl.filteredrevs
813 result = [] 814 result = []
814 for n in nodes: 815 for n in nodes:
815 r = nm.get(n) 816 r = nm.get(n)
816 resp = not (r is None or pc.phase(self, r) >= phases.secret) 817 resp = not (r is None or r in filtered)
817 result.append(resp) 818 result.append(resp)
818 return result 819 return result
819 820
820 def local(self): 821 def local(self):
821 return self 822 return self