comparison mercurial/localrepo.py @ 29417:526b027b0130

scmutil: improve documentation of revset APIs I can never remember the differences between the various revset APIs. I can never remember that scmutil.revrange() is the one I want to use from user-facing commands. Add some documentation to clarify this. While we're here, the argument name for revrange() is changed to "specs" because that's what it actually is.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 25 Jun 2016 19:12:20 -0700
parents 36fbd72c2f39
children 41689e293994
comparison
equal deleted inserted replaced
29416:30789efb1e5e 29417:526b027b0130
552 '''Find revisions matching a revset. 552 '''Find revisions matching a revset.
553 553
554 The revset is specified as a string ``expr`` that may contain 554 The revset is specified as a string ``expr`` that may contain
555 %-formatting to escape certain types. See ``revset.formatspec``. 555 %-formatting to escape certain types. See ``revset.formatspec``.
556 556
557 Return a revset.abstractsmartset, which is a list-like interface 557 Revset aliases from the configuration are not expanded. To expand
558 user aliases, consider calling ``scmutil.revrange()``.
559
560 Returns a revset.abstractsmartset, which is a list-like interface
558 that contains integer revisions. 561 that contains integer revisions.
559 ''' 562 '''
560 expr = revset.formatspec(expr, *args) 563 expr = revset.formatspec(expr, *args)
561 m = revset.match(None, expr) 564 m = revset.match(None, expr)
562 return m(self) 565 return m(self)
564 def set(self, expr, *args): 567 def set(self, expr, *args):
565 '''Find revisions matching a revset and emit changectx instances. 568 '''Find revisions matching a revset and emit changectx instances.
566 569
567 This is a convenience wrapper around ``revs()`` that iterates the 570 This is a convenience wrapper around ``revs()`` that iterates the
568 result and is a generator of changectx instances. 571 result and is a generator of changectx instances.
572
573 Revset aliases from the configuration are not expanded. To expand
574 user aliases, consider calling ``scmutil.revrange()``.
569 ''' 575 '''
570 for r in self.revs(expr, *args): 576 for r in self.revs(expr, *args):
571 yield self[r] 577 yield self[r]
572 578
573 def url(self): 579 def url(self):