yuja added a comment.
In https://phab.mercurial-scm.org/D1678#28686, @pulkit wrote: > @yuja am I headed in the right direction? (I am not sure about whether the API's I changed are used by extensions or not) Sort of, but I was thinking of a simpler one. Just parse specs twice, which isn't costly operation. def unhidehashlikerevs(repo, specs, allowhidden|warnhidden): if not repo.filtername: return repo syms = set() for spec in specs: try: tree = revsetlang.parse(spec) except ParseError: continue # will be reported later by scmutil.revrange() syms.update(revsetlang.hashlikesymbols(tree)) if not syms: return repo pinned = perhaps_need_to_convert_to_nodes_or_revs?(syms) # filtered repo with the given extra pinned revisions; no idea if this is an ideal API return repo.filtered(repo.filtername, pinned) This allows us to get rid of an intermediate state where a repo is flagged as "visible-<x>", but "<x>" isn't added yet. We can apply this function at dispatch: def _dispatch(req): ... if repo: ui = repo.ui if options['hidden']: repo = repo.unfiltered() else: # perhaps we'll need a registrar flag to get arguments taking revspecs repo = scmutil.unhidehashlikerevs(repo, cmdoptions.get('rev', [])) or simply at each command: def diff(...): ... repo = scmutil.unhidehashlikerevs(repo, changesets, 'allowhidden') revs = scmutil.revrange(repo, changesets) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1678 To: pulkit, #hg-reviewers Cc: yuja, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel