# HG changeset patch # User Pierre-Yves David # Date 1449101535 28800 # Node ID b64b6fdc5c9b30137aed46c3011177dc497d3a27 # Parent 95a54824ab002bc5f9c83714ed897953ab7b0154 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. diff -r 95a54824ab00 -r b64b6fdc5c9b mercurial/localrepo.py --- a/mercurial/localrepo.py Wed Dec 09 14:22:57 2015 -0800 +++ b/mercurial/localrepo.py Wed Dec 02 16:12:15 2015 -0800 @@ -808,12 +808,13 @@ return repo[key].branch() def known(self, nodes): - nm = self.changelog.nodemap - pc = self._phasecache + cl = self.changelog + nm = cl.nodemap + filtered = cl.filteredrevs result = [] for n in nodes: r = nm.get(n) - resp = not (r is None or pc.phase(self, r) >= phases.secret) + resp = not (r is None or r in filtered) result.append(resp) return result diff -r 95a54824ab00 -r b64b6fdc5c9b tests/test-obsolete-changeset-exchange.t --- a/tests/test-obsolete-changeset-exchange.t Wed Dec 09 14:22:57 2015 -0800 +++ b/tests/test-obsolete-changeset-exchange.t Wed Dec 02 16:12:15 2015 -0800 @@ -118,19 +118,17 @@ $ cd .. client only pulls down 1 changeset -("all local heads known remotely" may change if the wire protocol discovery -commands ever stop saying they have hidden changesets) $ cd pull-hidden-common-client $ hg pull --debug pulling from $TESTTMP/pull-hidden-common (glob) query 1; heads searching for changes - all local heads known remotely - 3 changesets found + taking quick initial sample + query 2; still undecided: 2, sample size is: 2 + 2 total queries + 1 changesets found list of changesets: - 96ee1d7354c4ad7372047672c36a1f561e3a6a4c - a33779fdfc23063680fc31e9ff637dff6876d3d2 bec0734cd68e84477ba7fc1d13e6cff53ab70129 listing keys for "phase" listing keys for "bookmarks" @@ -141,14 +139,12 @@ bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported adding changesets - add changeset 96ee1d7354c4 - add changeset a33779fdfc23 add changeset bec0734cd68e adding manifests adding file changes adding foo revisions added 1 changesets with 1 changes to 1 files (+1 heads) - bundle2-input-part: total payload size 1378 + bundle2-input-part: total payload size 474 bundle2-input-part: "listkeys" (params: 1 mandatory) supported bundle2-input-part: "listkeys" (params: 1 mandatory) supported bundle2-input-bundle: 2 parts total diff -r 95a54824ab00 -r b64b6fdc5c9b tests/test-obsolete.t --- a/tests/test-obsolete.t Wed Dec 09 14:22:57 2015 -0800 +++ b/tests/test-obsolete.t Wed Dec 02 16:12:15 2015 -0800 @@ -745,8 +745,7 @@ $ hg outgoing comparing with $TESTTMP/tmpe/repo-issue3805 (glob) searching for changes - no changes found - [1] + 1:29f0c6921ddd (draft) [tip ] A #if serve @@ -760,8 +759,7 @@ $ hg outgoing http://localhost:$HGPORT comparing with http://localhost:$HGPORT/ searching for changes - no changes found - [1] + 1:29f0c6921ddd (draft) [tip ] A $ killdaemons.py