D3639: remotenames: add paths argument to remotenames revset

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu May 24 09:13:24 EDT 2018


yuja added a comment.


  > +def _parsepaths(x):
  >  +    """parses the argument passed in revsets as paths and return
  >  +    them as a set or returns None if no path is specified"""
  >  +
  >  +    if not x:
  >  +        return None
  >  +
  >  +    paths = set()
  >  +    if x[0] in ('symbol', 'string'):
  >  +        paths.add(x[1])
  >  +    elif x[0] == 'list':
  >  +        for t, p in x[1:]:
  >  +            paths.add(p)
  >  +    return paths
  
  Use `revsetlang.getlist()` and apply `.getstring()` to each element, which
  is more robust.
  
  That said, the common idiom is to accept a literal/re pattern. See
  `revset.bookmark()` for example.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list