[PATCH 9 of 9 v2] hidden: remove unnecessary guard condition

Augie Fackler raf at durin42.com
Wed May 31 14:31:38 EDT 2017


On Tue, May 30, 2017 at 01:29:36PM -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1496175392 25200
> #      Tue May 30 13:16:32 2017 -0700
> # Node ID 67bf929e29e4c8cf7e824cc49d6bd271e1d78a86
> # Parent  b3db386713b83543ad3b966a59caae359f0b67b4
> hidden: remove unnecessary guard condition

Very nice cleanup, queued the lot. Thanks!

(I did add one (API) flag on patch 2, since it seemed like it should
get some extra visibility to potential clients.)

>
> The "if visible" guard is now pretty pointless, because the function
> call it guards will do almost no work anyway when there are no visible
> revisions.
>
> We can also stop wrapping "visible" in a set since it just needs to be
> an iterable now.
>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -76,9 +76,8 @@
>          mutablephases = (phases.draft, phases.secret)
>          mutable = repo._phasecache.getrevset(repo, mutablephases)
>
> -        visible = set(mutable - hidden)
> -        if visible:
> -            _revealancestors(pfunc, hidden, visible)
> +        visible = mutable - hidden
> +        _revealancestors(pfunc, hidden, visible)
>      return frozenset(hidden)
>
>  def computeunserved(repo):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list