Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 32932:577759ef2ed2
revset: add support of keyword arguments to ancestors() and descendants()
Prepares for adding depth parameter.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Jun 2017 12:06:22 +0900 |
parents | 2851b24eecc4 |
children | 272a44cac57e |
line wrap: on
line diff
--- a/mercurial/revset.py Sun Jun 18 11:57:28 2017 +0900 +++ b/mercurial/revset.py Sun Jun 18 12:06:22 2017 +0900 @@ -250,7 +250,11 @@ """Changesets that are ancestors of changesets in set, including the given changesets themselves. """ - return _ancestors(repo, subset, x) + args = getargsdict(x, 'ancestors', 'set') + if 'set' not in args: + # i18n: "ancestors" is a keyword + raise error.ParseError(_('ancestors takes at least 1 argument')) + return _ancestors(repo, subset, args['set']) @predicate('_firstancestors', safe=True) def _firstancestors(repo, subset, x): @@ -596,7 +600,11 @@ """Changesets which are descendants of changesets in set, including the given changesets themselves. """ - return _descendants(repo, subset, x) + args = getargsdict(x, 'descendants', 'set') + if 'set' not in args: + # i18n: "descendants" is a keyword + raise error.ParseError(_('descendants takes at least 1 argument')) + return _descendants(repo, subset, args['set']) @predicate('_firstdescendants', safe=True) def _firstdescendants(repo, subset, x):