Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
32931:3292c0df64f7 | 32932:577759ef2ed2 |
---|---|
248 @predicate('ancestors(set)', safe=True) | 248 @predicate('ancestors(set)', safe=True) |
249 def ancestors(repo, subset, x): | 249 def ancestors(repo, subset, x): |
250 """Changesets that are ancestors of changesets in set, including the | 250 """Changesets that are ancestors of changesets in set, including the |
251 given changesets themselves. | 251 given changesets themselves. |
252 """ | 252 """ |
253 return _ancestors(repo, subset, x) | 253 args = getargsdict(x, 'ancestors', 'set') |
254 if 'set' not in args: | |
255 # i18n: "ancestors" is a keyword | |
256 raise error.ParseError(_('ancestors takes at least 1 argument')) | |
257 return _ancestors(repo, subset, args['set']) | |
254 | 258 |
255 @predicate('_firstancestors', safe=True) | 259 @predicate('_firstancestors', safe=True) |
256 def _firstancestors(repo, subset, x): | 260 def _firstancestors(repo, subset, x): |
257 # ``_firstancestors(set)`` | 261 # ``_firstancestors(set)`` |
258 # Like ``ancestors(set)`` but follows only the first parents. | 262 # Like ``ancestors(set)`` but follows only the first parents. |
594 @predicate('descendants(set)', safe=True) | 598 @predicate('descendants(set)', safe=True) |
595 def descendants(repo, subset, x): | 599 def descendants(repo, subset, x): |
596 """Changesets which are descendants of changesets in set, including the | 600 """Changesets which are descendants of changesets in set, including the |
597 given changesets themselves. | 601 given changesets themselves. |
598 """ | 602 """ |
599 return _descendants(repo, subset, x) | 603 args = getargsdict(x, 'descendants', 'set') |
604 if 'set' not in args: | |
605 # i18n: "descendants" is a keyword | |
606 raise error.ParseError(_('descendants takes at least 1 argument')) | |
607 return _descendants(repo, subset, args['set']) | |
600 | 608 |
601 @predicate('_firstdescendants', safe=True) | 609 @predicate('_firstdescendants', safe=True) |
602 def _firstdescendants(repo, subset, x): | 610 def _firstdescendants(repo, subset, x): |
603 # ``_firstdescendants(set)`` | 611 # ``_firstdescendants(set)`` |
604 # Like ``descendants(set)`` but follows only the first parents. | 612 # Like ``descendants(set)`` but follows only the first parents. |