Mercurial > hg
changeset 27071:dfb31eebd949
localrepo: improve docstring for revset methods
revs() doesn't return a list. Also document what its arguments do.
Also clarify that set() is just a convenience wrapper around revs().
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 21 Nov 2015 11:07:30 -0800 |
parents | 7860366b46c9 |
children | e18a9ceade3b |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Nov 22 16:23:20 2015 -0800 +++ b/mercurial/localrepo.py Sat Nov 21 11:07:30 2015 -0800 @@ -517,15 +517,23 @@ return iter(self.changelog) def revs(self, expr, *args): - '''Return a list of revisions matching the given revset''' + '''Find revisions matching a revset. + + The revset is specified as a string ``expr`` that may contain + %-formatting to escape certain types. See ``revset.formatspec``. + + Return a revset.abstractsmartset, which is a list-like interface + that contains integer revisions. + ''' expr = revset.formatspec(expr, *args) m = revset.match(None, expr) return m(self) def set(self, expr, *args): - ''' - Yield a context for each matching revision, after doing arg - replacement via revset.formatspec + '''Find revisions matching a revset and emit changectx instances. + + This is a convenience wrapper around ``revs()`` that iterates the + result and is a generator of changectx instances. ''' for r in self.revs(expr, *args): yield self[r]