Skip to content
Snippets Groups Projects
Commit f95ab2c5 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

outgoing: fix common-heads computation from `missingroots` argument

When initializing a `outgoing` object, the `common set` can be defined explicitly (with the `commonheads` argument`) or implicitly (with the missingroots arguments).

It turns out the logic to compute `commonheads` from `missingroots` is buggy, as it does not consider the parents of enough changesets. Previously, it only considered parents of "missingroots` items, while it need to consider all parents of missing. Here is an example:

  F
  |\
  C E
  | |
  B D
  |/
  A

If we use [E] as missing-roots, the missing set is [E, F], and the common-heads
are [C, D]. However you cannot only consider the parent of [E] to find them, as
[C] is not a parent of [E].

This already fix the bundle generated in one test, and it would prevent many
other to misbehave with future change from this series.
parent 385a4f80
No related branches found
No related tags found
3 merge requests!618Draft: 6.5rc0,!541Draft: sslutil: set context security level for legacy tls testing (issue6760),!496fixes around bundle phases and discovery
......@@ -104,11 +104,8 @@
if ancestorsof is None:
ancestorsof = cl.heads()
if missingroots:
discbases = []
for n in missingroots:
discbases.extend([p for p in cl.parents(n) if p != repo.nullid])
# TODO remove call to nodesbetween.
# TODO populate attributes on outgoing instance instead of setting
# discbases.
csets, roots, heads = cl.nodesbetween(missingroots, ancestorsof)
included = set(csets)
......@@ -110,8 +107,11 @@
# TODO remove call to nodesbetween.
# TODO populate attributes on outgoing instance instead of setting
# discbases.
csets, roots, heads = cl.nodesbetween(missingroots, ancestorsof)
included = set(csets)
discbases = []
for n in csets:
discbases.extend([p for p in cl.parents(n) if p != repo.nullid])
ancestorsof = heads
commonheads = [n for n in discbases if n not in included]
elif not commonheads:
......
......@@ -296,5 +296,5 @@
bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
bundle2-output-part: "phase-heads" 24 bytes payload
saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
3 changesets found
2 changesets found
list of changesets:
......@@ -300,5 +300,4 @@
list of changesets:
4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
19c888675e133ab5dff84516926a65672eaf04d9
c1ffa3b5274e92a9388fe782854e295d2e8d0443
bundle2-output-bundle: "HG20", 3 parts total
......@@ -309,9 +308,8 @@
bundle2-input-bundle: with-transaction
bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
adding changesets
add changeset 4c9fbe56a16f
add changeset 19c888675e13
add changeset c1ffa3b5274e
adding manifests
adding file changes
adding f1.txt revisions
......@@ -313,7 +311,7 @@
add changeset 19c888675e13
add changeset c1ffa3b5274e
adding manifests
adding file changes
adding f1.txt revisions
bundle2-input-part: total payload size 1761
bundle2-input-part: total payload size 1255
bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
......@@ -319,5 +317,5 @@
bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
bundle2-input-part: total payload size 74
bundle2-input-part: total payload size 54
bundle2-input-part: "phase-heads" supported
bundle2-input-part: total payload size 24
bundle2-input-bundle: 3 parts total
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment