Patchwork [3,of,3] obsolete: avoid using revset to compute the obsolete set

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 2:34 p.m.
Message ID <a4a844d706453079ea69.1486737259@localhost.localdomain>
Download mbox | patch
Permalink /patch/18393/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - Feb. 10, 2017, 2:34 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1486737071 28800
#      Fri Feb 10 06:31:11 2017 -0800
# Node ID a4a844d706453079ea69de94f5e1c6fec64710e9
# Parent  44f2c707475a79758ecbc4b4117b9cda9d7a4380
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r a4a844d70645
obsolete: avoid using revset to compute the obsolete set

This is part of a refactoring that moves some phase query optimization from
revset.py to phases.py. See previous patches for motivation.

Now we have APIs to get the non-public set efficiently, replace revset with
it.
via Mercurial-devel - Feb. 15, 2017, 1:38 a.m.
On Fri, Feb 10, 2017 at 6:34 AM, Jun Wu <quark@fb.com> wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1486737071 28800
> #      Fri Feb 10 06:31:11 2017 -0800
> # Node ID a4a844d706453079ea69de94f5e1c6fec64710e9
> # Parent  44f2c707475a79758ecbc4b4117b9cda9d7a4380
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r a4a844d70645
> obsolete: avoid using revset to compute the obsolete set
>
> This is part of a refactoring that moves some phase query optimization from
> revset.py to phases.py. See previous patches for motivation.
>
> Now we have APIs to get the non-public set efficiently, replace revset with
> it.
>
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -1121,5 +1121,5 @@ def _computeobsoleteset(repo):
>      obs = set()
>      getnode = repo.changelog.node
> -    notpublic = repo.revs("not public()")
> +    notpublic = repo._phasecache.getrevs(repo, phases.allphases[1:])

nit: phases.allphases[1:] is also called phases.trackedphases, if you like

>      for r in notpublic:
>          if getnode(r) in repo.obsstore.successors:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1121,5 +1121,5 @@  def _computeobsoleteset(repo):
     obs = set()
     getnode = repo.changelog.node
-    notpublic = repo.revs("not public()")
+    notpublic = repo._phasecache.getrevs(repo, phases.allphases[1:])
     for r in notpublic:
         if getnode(r) in repo.obsstore.successors: