Mercurial > hg-stable
changeset 15403:e27561eb4a76
localrepo: add revs helper method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 02 Nov 2011 13:37:34 -0500 |
parents | f437967f9f80 |
children | c1eb8398fe82 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Nov 01 16:49:30 2011 -0500 +++ b/mercurial/localrepo.py Wed Nov 02 13:37:34 2011 -0500 @@ -220,15 +220,18 @@ for i in xrange(len(self)): yield i + def revs(self, expr, *args): + '''Return a list of revisions matching the given revset''' + expr = revset.formatspec(expr, *args) + m = revset.match(None, expr) + return [r for r in m(self, range(len(self)))] + def set(self, expr, *args): ''' Yield a context for each matching revision, after doing arg replacement via revset.formatspec ''' - - expr = revset.formatspec(expr, *args) - m = revset.match(None, expr) - for r in m(self, range(len(self))): + for r in self.revs(expr, *args): yield self[r] def url(self):