Mercurial > hg
diff mercurial/localrepo.py @ 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 | 4414d500604f |
children | 70884715725e |
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]