[PATCH 4 of 6] checkheads: don't warns about unsynched changes that we are going to obsolete

Adrian Buehlmann adrian at cadifra.com
Fri Aug 24 10:31:39 CDT 2012


On 2012-08-24 17:14, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1343842300 -7200
> # Node ID 79d63ffb7f1ff5daca6fcea74848b7ac729ee357
> # Parent  595b866243542dd2e27268d8b9d6b4a00a27f66d
> checkheads: don't warns about unsynched changes that we are going to obsolete.
                    warn        unsynced                                       (no point at end)
> 
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -269,23 +269,23 @@ def checkheads(repo, remote, outgoing, r
>      for branch, heads in headssum.iteritems():
>          if heads[0] is None:
>              # Maybe we should abort if we push more that one head
>              # for new branches ?
>              continue
> -        if heads[2]:
> -            unsynced = True
> -        oldhs = set(heads[0])
>          candidate_newhs = set(heads[1])
>          # add unsynced data
> +        oldhs = set(heads[0])
>          oldhs.update(heads[2])
>          candidate_newhs.update(heads[2])
>          dhs = None
> +        discardedheads = set()
>          if repo.obsstore:
>              # remove future heads which are actually obsolete by another
>              # pushed element:
>              #
> -            # XXX There is several case this case does not handle properly
> +            # XXX as above, There is several case this case does not handle
                               there are        cases

> +            #               properly

                 ????????????  (why this indent?)

>              #
>              # (1) if <nh> is public, it won't be affected by obsolete marker
>              #     and a new is created
>              #
>              # (2) if the new heads have ancestors which are not obsolete and
> @@ -298,15 +298,18 @@ def checkheads(repo, remote, outgoing, r
>                  if nh in repo and repo[nh].phase() <= phases.public:
>                      newhs.add(nh)
>                  else:
>                      for suc in obsolete.anysuccessors(repo.obsstore, nh):
>                          if suc != nh and suc in allfuturecommon:
> +                            discardedheads.add(nh)
>                              break
>                      else:
>                          newhs.add(nh)
>          else:
>              newhs = candidate_newhs
> +        if [h for h in heads[2] if h not in discardedheads]:
> +            unsynced = True
>          if len(newhs) > len(oldhs):
>              # strip updates to existing remote heads from the new heads list
>              dhs = list(newhs - bookmarkedheads - oldhs)
>          if dhs:
>              if error is None:
> diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
> --- a/tests/test-obsolete-checkheads.t
> +++ b/tests/test-obsolete-checkheads.t
> @@ -265,10 +265,9 @@ It should not complains about "unsynced 
>  handled yet.
>  
>    $ hg push --traceback
>    pushing to $TESTTMP/remote
>    searching for changes
> -  note: unsynced remote changes!
>    adding changesets
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files (+1 heads)


More information about the Mercurial-devel mailing list