discovery: weaken claim about returned common heads if ancestorsof are given
authorManuel Jacob <me@manueljacob.de>
Wed, 15 Jul 2020 09:51:11 +0200
changeset 45142 75f6491b66a7
parent 45141 9719e118e4af
child 45143 5631b0116374
discovery: weaken claim about returned common heads if ancestorsof are given As the test case shows, the claim is not true in general.
mercurial/discovery.py
tests/test-setdiscovery.t
--- a/mercurial/discovery.py	Thu Jul 16 19:48:49 2020 +0200
+++ b/mercurial/discovery.py	Wed Jul 15 09:51:11 2020 +0200
@@ -41,8 +41,8 @@
       any longer.
     "heads" is either the supplied heads, or else the remote's heads.
     "ancestorsof" if not None, restrict the discovery to a subset defined by
-      these nodes. Changeset outside of this set won't be considered (and
-      won't appears in "common")
+      these nodes. Changeset outside of this set won't be considered (but may
+      still appear in "common").
 
     If you pass heads and they are all known locally, the response lists just
     these heads in "common" and in "heads".
--- a/tests/test-setdiscovery.t	Thu Jul 16 19:48:49 2020 +0200
+++ b/tests/test-setdiscovery.t	Wed Jul 15 09:51:11 2020 +0200
@@ -1112,3 +1112,40 @@
   * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> found 101 common and 1 unknown server heads, 1 roundtrips in *.????s (glob)
   * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing r2 *-T{rev} * --config *extensions.blackbox=* exited 0 after *.?? seconds (glob)
   $ cd ..
+
+Even if the set of revs to discover is restricted, unrelated revs may be
+returned as common heads.
+
+  $ mkdir ancestorsof
+  $ cd ancestorsof
+  $ hg init a
+  $ hg clone a b -q
+  $ cd b
+  $ hg debugbuilddag '.:root *root *root'
+  $ hg log -G -T '{node|short}'
+  o  fa942426a6fd
+  |
+  | o  66f7d451a68b
+  |/
+  o  1ea73414a91b
+  
+  $ hg push -r 66f7d451a68b -q
+  $ hg debugdiscovery --verbose --rev fa942426a6fd
+  comparing with $TESTTMP/ancestorsof/a
+  searching for changes
+  elapsed time:  * seconds (glob)
+  heads summary:
+    total common heads:          1
+      also local heads:          1
+      also remote heads:         1
+      both:                      1
+    local heads:                 2
+      common:                    1
+      missing:                   1
+    remote heads:                1
+      common:                    1
+      unknown:                   0
+  local changesets:              3
+    common:                      2
+    missing:                     1
+  common heads: 66f7d451a68b