##// END OF EJS Templates
scmutil: improve documentation of revset APIs...
Gregory Szorc -
r29417:526b027b default
parent child Browse files
Show More
@@ -554,7 +554,10 b' class localrepository(object):'
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)
@@ -566,6 +569,9 b' class localrepository(object):'
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]
@@ -808,10 +808,29 b' def revpair(repo, revs):'
808
808
809 return repo.lookup(first), repo.lookup(second)
809 return repo.lookup(first), repo.lookup(second)
810
810
811 def revrange(repo, revs):
811 def revrange(repo, specs):
812 """Yield revision as strings from a list of revision specifications."""
812 """Execute 1 to many revsets and return the union.
813
814 This is the preferred mechanism for executing revsets using user-specified
815 config options, such as revset aliases.
816
817 The revsets specified by ``specs`` will be executed via a chained ``OR``
818 expression. If ``specs`` is empty, an empty result is returned.
819
820 ``specs`` can contain integers, in which case they are assumed to be
821 revision numbers.
822
823 It is assumed the revsets are already formatted. If you have arguments
824 that need to be expanded in the revset, call ``revset.formatspec()``
825 and pass the result as an element of ``specs``.
826
827 Specifying a single revset is allowed.
828
829 Returns a ``revset.abstractsmartset`` which is a list-like interface over
830 integer revisions.
831 """
813 allspecs = []
832 allspecs = []
814 for spec in revs:
833 for spec in specs:
815 if isinstance(spec, int):
834 if isinstance(spec, int):
816 spec = revset.formatspec('rev(%d)', spec)
835 spec = revset.formatspec('rev(%d)', spec)
817 allspecs.append(spec)
836 allspecs.append(spec)
General Comments 0
You need to be logged in to leave comments. Login now