D1012: repoview: add two new filternames to be used for accessing hidden commits

dlax (Denis Laxalde) phabricator at mercurial-scm.org
Thu Oct 12 03:16:16 EDT 2017


dlax requested changes to this revision.
dlax added a comment.
This revision now requires changes to proceed.


  The idea of using different names to control the behavior of the filter function sounds strange to me.
  Maybe `repoview.filterrevs()` could accept `**kwargs` that would be passed to the function in `repoview.filtertable`?
  
    diff --git a/mercurial/repoview.py b/mercurial/repoview.py
    --- a/mercurial/repoview.py
    +++ b/mercurial/repoview.py
    @@ -146,11 +146,11 @@ filtertable = {'visible': computehidden,
                    'immutable':  computemutable,
                    'base':  computeimpactable}
     
    -def filterrevs(repo, filtername):
    +def filterrevs(repo, filtername, **kwargs):
         """returns set of filtered revision for this filter name"""
         if filtername not in repo.filteredrevcache:
             func = filtertable[filtername]
    -        repo.filteredrevcache[filtername] = func(repo.unfiltered())
    +        repo.filteredrevcache[filtername] = func(repo.unfiltered(), **kwargs)
         return repo.filteredrevcache[filtername]
     
     class repoview(object):
  
  Then you'd call `repoview.filterrevs(repo, 'visible', warn=True)` assuming `computehidden` accepts a `warn` keyword argument.
  
  (Also having an actual use of the new behavior in the patch series would help understanding the intent.)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1012

To: pulkit, #hg-reviewers, dlax
Cc: dlax, mercurial-devel


More information about the Mercurial-devel mailing list