Patchwork repoview: extract hideable revision computation in a dedicated function

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 10, 2013, 9:44 a.m.
Message ID <034c5b46762bee1b902c.1357811094@crater1.logilab.fr>
Download mbox | patch
Permalink /patch/517/
State Accepted
Commit 1f35d6737ed8376715e8332bd580ba95ebf6a531
Headers show

Comments

Pierre-Yves David - Jan. 10, 2013, 9:44 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1357809902 -3600
# Node ID 034c5b46762bee1b902c4173152bf7bf1a42dbaf
# Parent  0d5a22f73a1f8d7b871c51bc8426264e8c629ce4
repoview: extract hideable revision computation in a dedicated function

This will help extensions to plug into the hidden mechanism.
Augie Fackler - Jan. 10, 2013, 2:12 p.m.
queued, thanks


On Thu, Jan 10, 2013 at 4:44 AM, <pierre-yves.david@logilab.fr> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@logilab.fr>
> # Date 1357809902 -3600
> # Node ID 034c5b46762bee1b902c4173152bf7bf1a42dbaf
> # Parent  0d5a22f73a1f8d7b871c51bc8426264e8c629ce4
> repoview: extract hideable revision computation in a dedicated function
>
> This will help extensions to plug into the hidden mechanism.
>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -10,16 +10,22 @@ import copy
>  import phases
>  import util
>  import obsolete, bookmarks, revset
>
>
> +def hideablerevs(repo):
> +    """Revisions candidates to be hidden
> +
> +    This is a standalone function to help extensions to wrap it."""
> +    return obsolete.getrevs(repo, 'obsolete')
> +
>  def computehidden(repo):
>      """compute the set of hidden revision to filter
>
>      During most operation hidden should be filtered."""
>      assert not repo.changelog.filteredrevs
> -    hideable = obsolete.getrevs(repo, 'obsolete')
> +    hideable = hideablerevs(repo)
>      if hideable:
>          cl = repo.changelog
>          firsthideable = min(hideable)
>          revs = cl.revs(start=firsthideable)
>          blockers = [r for r in revset._children(repo, revs, hideable)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -10,16 +10,22 @@  import copy
 import phases
 import util
 import obsolete, bookmarks, revset
 
 
+def hideablerevs(repo):
+    """Revisions candidates to be hidden
+
+    This is a standalone function to help extensions to wrap it."""
+    return obsolete.getrevs(repo, 'obsolete')
+
 def computehidden(repo):
     """compute the set of hidden revision to filter
 
     During most operation hidden should be filtered."""
     assert not repo.changelog.filteredrevs
-    hideable = obsolete.getrevs(repo, 'obsolete')
+    hideable = hideablerevs(repo)
     if hideable:
         cl = repo.changelog
         firsthideable = min(hideable)
         revs = cl.revs(start=firsthideable)
         blockers = [r for r in revset._children(repo, revs, hideable)