D3639: remotenames: add paths argument to remotenames revset

Yuya Nishihara yuya at tcha.org
Thu May 24 09:13:16 EDT 2018


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


More information about the Mercurial-devel mailing list