[PATCH] hgweb: do not display hidden changesets

Matt Mackall mpm at selenic.com
Tue Sep 27 14:13:35 CDT 2011


On Mon, 2011-09-26 at 17:49 +0200, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1317052038 -7200
> # Node ID b2a0477d788718f65b5dfec03d51f07b31d595cf
> # Parent  91dc8878f88857f01b86a99ad047400704b5fd7e
> hgweb: do not display hidden changesets
> 
> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -737,11 +737,10 @@ def static(web, req, tmpl):
>              tp = [tp]
>          static = [os.path.join(p, 'static') for p in tp]
>      return [staticfile(static, fname, req)]
>  
>  def graph(web, req, tmpl):
> -

Unrelated change.

>      rev = webutil.changectx(web.repo, req).rev()
>      bg_height = 39
>      revcount = web.maxshortchanges
>      if 'revcount' in req.form:
>          revcount = int(req.form.get('revcount', [revcount])[0])
> @@ -764,11 +763,19 @@ def graph(web, req, tmpl):
>      startrev = rev
>      # if starting revision is less than 60 set it to uprev
>      if rev < web.maxshortchanges:
>          startrev = uprev
>  
> -    dag = graphmod.dagwalker(web.repo, range(startrev, downrev - 1, -1))
> +    # do not include hidden changesets
> +    revs = []
> +    rev = startrev
> +    while rev >=0 and len(revs) < revcount:
> +        if rev not in web.repo.changelog.hiddenrevs:
> +            revs.append(rev)
> +        rev -= 1
> +
> +    dag = graphmod.dagwalker(web.repo, revs)

This looks like it's in the graph page code?

We should probably have a generic infrastructure for this so that we're
not reproducing this loop all over the place. Now that we've got the
repo.set() predicate, we can do:

 for x in repo.set('%s:%s and not hidden()', startrev, downrev - 1):

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list