This is an archive of the discontinued Mercurial Phabricator instance.

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

Authored by pulkit on Oct 11 2017, 3:10 PM.

Details

Reviewers
dlax
Group Reviewers
hg-reviewers
Summary

This patch adds two new filternames 'visible-hidden' and 'visible-warnhidden'
which will be used to access hidden commits.
'visible-hidden' will allow access of hidden commits without any warning. This will
be for read only commands.
'visible-warnhidden' will allow access of hidden commits but will warn for that.
This will be for recoverable write commands.
For unrecoverable write commands, we don't need to have anything new as that's
the current behaviour.

We are using the same computehidden() function as we will be adding the hidden
revisions to pinnedrevs.

The idea to add new filternames is taken from directaccess extension from
fb-hgext.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Oct 11 2017, 3:10 PM
dlax edited the summary of this revision. (Show Details)Oct 12 2017, 3:11 AM
dlax requested changes to this revision.Oct 12 2017, 3:16 AM
dlax added a subscriber: dlax.

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.)

This revision now requires changes to proceed.Oct 12 2017, 3:16 AM
dlax added a comment.Oct 12 2017, 3:19 AM
In D1012#17020, @dlax wrote:

(Also having an actual use of the new behavior in the patch series would help understanding the intent.)

Hm, I now see it's used in some other differentials but they do not appear in this stack :(

In D1012#17023, @dlax wrote:
In D1012#17020, @dlax wrote:

(Also having an actual use of the new behavior in the patch series would help understanding the intent.)

Hm, I now see it's used in some other differentials but they do not appear in this stack :(

Yeah I am also sad about that. I will resend them as a new stack fixing some minor comments from others.

pulkit abandoned this revision.Oct 17 2017, 8:23 AM

Resend the series as D1140 - D1144.