Patchwork [1,of,6,frozen-repos] localrepo: improve docstring for revset methods

mail settings
Submitter Gregory Szorc
Date Nov. 22, 2015, 1:13 a.m.
Message ID <e6778f6f5ada8a50bfd7.1448154838@ubuntu-main>
Download mbox | patch
Permalink /patch/11565/
State Accepted
Delegated to: Pierre-Yves David
Headers show


Gregory Szorc - Nov. 22, 2015, 1:13 a.m.
# HG changeset patch
# User Gregory Szorc <>
# Date 1448132850 28800
#      Sat Nov 21 11:07:30 2015 -0800
# Node ID e6778f6f5ada8a50bfd7e154334692c404383315
# Parent  df9b73d2d444ae82fe8d3fe6cf682a93b2c4a7ef
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().


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -512,25 +512,33 @@  class localrepository(object):
     def __len__(self):
         return len(self.changelog)
     def __iter__(self):
         return iter(self.changelog)
     def revs(self, expr, *args):
-        '''Return a list of revisions matching the given revset'''
+        '''Find revisions matching a revset.
+        The revset is specified as a string ``expr`` that may contain
+        %-formatting to escape certain types. See ``revset.formatspec``.
+        Return a revset.abstractsmartset, which is a list-like interface
+        that contains integer revisions.
+        '''
         expr = revset.formatspec(expr, *args)
         m = revset.match(None, expr)
         return m(self)
     def set(self, expr, *args):
-        '''
-        Yield a context for each matching revision, after doing arg
-        replacement via revset.formatspec
+        '''Find revisions matching a revset and emit changectx instances.
+        This is a convenience wrapper around ``revs()`` that iterates the
+        result and is a generator of changectx instances.
         for r in self.revs(expr, *args):
             yield self[r]
     def url(self):
         return 'file:' + self.root
     def hook(self, name, throw=False, **args):