Patchwork [01,of,14,"] repoview: fix conditional around unserved changesets

login
register
mail settings
Submitter Pierre-Yves David
Date April 13, 2019, 11:40 p.m.
Message ID <5ce5915a48297de3f746.1555198831@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39595/
State Accepted
Headers show

Comments

Pierre-Yves David - April 13, 2019, 11:40 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1555181870 -7200
#      Sat Apr 13 20:57:50 2019 +0200
# Node ID 5ce5915a48297de3f7464e8f149629799da5ca6f
# Parent  2a3c0106ded9584938116ec2b1cbc7e21f13e1e1
# EXP-Topic hgweb-obsolete
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5ce5915a4829
repoview: fix conditional around unserved changesets

The conditional could lead to wrong computation since we have more unserved
changesets than just the "secret" phase.

In addition, now that we have efficient caching of phased changesets, we don't
need the conditional anymore.
Gregory Szorc - April 16, 2019, 10:43 a.m.
On Sat, Apr 13, 2019 at 5:49 PM Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1555181870 -7200
> #      Sat Apr 13 20:57:50 2019 +0200
> # Node ID 5ce5915a48297de3f7464e8f149629799da5ca6f
> # Parent  2a3c0106ded9584938116ec2b1cbc7e21f13e1e1
> # EXP-Topic hgweb-obsolete
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 5ce5915a4829
> repoview: fix conditional around unserved changesets
>

Queued parts 1-3. I dropped the internal-phase requirement from part 2.


>
> The conditional could lead to wrong computation since we have more unserved
> changesets than just the "secret" phase.
>
> In addition, now that we have efficient caching of phased changesets, we
> don't
> need the conditional anymore.
>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -93,8 +93,8 @@ def computeunserved(repo, visibilityexce
>      assert not repo.changelog.filteredrevs
>      # fast path in simple case to avoid impact of non optimised code
>      hiddens = filterrevs(repo, 'visible')
> -    if phases.hassecret(repo):
> -        secrets = repo._phasecache.getrevset(repo,
> phases.remotehiddenphases)
> +    secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
> +    if secrets:
>          return frozenset(hiddens | frozenset(secrets))
>      else:
>          return hiddens
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -93,8 +93,8 @@  def computeunserved(repo, visibilityexce
     assert not repo.changelog.filteredrevs
     # fast path in simple case to avoid impact of non optimised code
     hiddens = filterrevs(repo, 'visible')
-    if phases.hassecret(repo):
-        secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
+    secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
+    if secrets:
         return frozenset(hiddens | frozenset(secrets))
     else:
         return hiddens