comparison 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
comparison
equal deleted inserted replaced
27070:7860366b46c9 27071:dfb31eebd949
515 515
516 def __iter__(self): 516 def __iter__(self):
517 return iter(self.changelog) 517 return iter(self.changelog)
518 518
519 def revs(self, expr, *args): 519 def revs(self, expr, *args):
520 '''Return a list of revisions matching the given revset''' 520 '''Find revisions matching a revset.
521
522 The revset is specified as a string ``expr`` that may contain
523 %-formatting to escape certain types. See ``revset.formatspec``.
524
525 Return a revset.abstractsmartset, which is a list-like interface
526 that contains integer revisions.
527 '''
521 expr = revset.formatspec(expr, *args) 528 expr = revset.formatspec(expr, *args)
522 m = revset.match(None, expr) 529 m = revset.match(None, expr)
523 return m(self) 530 return m(self)
524 531
525 def set(self, expr, *args): 532 def set(self, expr, *args):
526 ''' 533 '''Find revisions matching a revset and emit changectx instances.
527 Yield a context for each matching revision, after doing arg 534
528 replacement via revset.formatspec 535 This is a convenience wrapper around ``revs()`` that iterates the
536 result and is a generator of changectx instances.
529 ''' 537 '''
530 for r in self.revs(expr, *args): 538 for r in self.revs(expr, *args):
531 yield self[r] 539 yield self[r]
532 540
533 def url(self): 541 def url(self):