Patchwork [2,of,2] discovery: reference relevant bug in the faulty code

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 9, 2015, 10:59 p.m.
Message ID <bda683d8299902137ec5.1444431583@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10939/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 9, 2015, 10:59 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1444430640 25200
#      Fri Oct 09 15:44:00 2015 -0700
# Node ID bda683d8299902137ec5710c0558c127f2b7aae5
# Parent  bfde4c287d34ea09716861af2fd63e38f27439fb
# EXP-Topic disc.cleanup
discovery: reference relevant bug in the faulty code

We extend the comment about this code flaw with more code flaw.
Augie Fackler - Oct. 12, 2015, 2:25 p.m.
On Fri, Oct 09, 2015 at 03:59:43PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1444430640 25200
> #      Fri Oct 09 15:44:00 2015 -0700
> # Node ID bda683d8299902137ec5710c0558c127f2b7aae5
> # Parent  bfde4c287d34ea09716861af2fd63e38f27439fb
> # EXP-Topic disc.cleanup
> discovery: reference relevant bug in the faulty code

queued, thanks

>
> We extend the comment about this code flaw with more code flaw.
>
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -317,10 +317,13 @@ def checkheads(repo, remote, outgoing, r
>              # (2) if the new heads have ancestors which are not obsolete and
>              #     not ancestors of any other heads we will have a new head too.
>              #
>              # These two cases will be easy to handle for known changeset but
>              # much more tricky for unsynced changes.
> +            #
> +            # In addition, this code is confused by prune as it only look for
> +            # successors of the heads (none if pruned) leading to issue4354
>              newhs = set()
>              for nh in candidate_newhs:
>                  if nh in repo and repo[nh].phase() <= phases.public:
>                      newhs.add(nh)
>                  else:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -317,10 +317,13 @@  def checkheads(repo, remote, outgoing, r
             # (2) if the new heads have ancestors which are not obsolete and
             #     not ancestors of any other heads we will have a new head too.
             #
             # These two cases will be easy to handle for known changeset but
             # much more tricky for unsynced changes.
+            #
+            # In addition, this code is confused by prune as it only look for
+            # successors of the heads (none if pruned) leading to issue4354
             newhs = set()
             for nh in candidate_newhs:
                 if nh in repo and repo[nh].phase() <= phases.public:
                     newhs.add(nh)
                 else: