Mercurial > hg
comparison mercurial/localrepo.py @ 15403:e27561eb4a76
localrepo: add revs helper method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 02 Nov 2011 13:37:34 -0500 |
parents | c519cd8f0169 |
children | cf729af26963 |
comparison
equal
deleted
inserted
replaced
15402:f437967f9f80 | 15403:e27561eb4a76 |
---|---|
218 | 218 |
219 def __iter__(self): | 219 def __iter__(self): |
220 for i in xrange(len(self)): | 220 for i in xrange(len(self)): |
221 yield i | 221 yield i |
222 | 222 |
223 def revs(self, expr, *args): | |
224 '''Return a list of revisions matching the given revset''' | |
225 expr = revset.formatspec(expr, *args) | |
226 m = revset.match(None, expr) | |
227 return [r for r in m(self, range(len(self)))] | |
228 | |
223 def set(self, expr, *args): | 229 def set(self, expr, *args): |
224 ''' | 230 ''' |
225 Yield a context for each matching revision, after doing arg | 231 Yield a context for each matching revision, after doing arg |
226 replacement via revset.formatspec | 232 replacement via revset.formatspec |
227 ''' | 233 ''' |
228 | 234 for r in self.revs(expr, *args): |
229 expr = revset.formatspec(expr, *args) | |
230 m = revset.match(None, expr) | |
231 for r in m(self, range(len(self))): | |
232 yield self[r] | 235 yield self[r] |
233 | 236 |
234 def url(self): | 237 def url(self): |
235 return 'file:' + self.root | 238 return 'file:' + self.root |
236 | 239 |