[PATCH 2 of 2] localrepo: comment that revs() is internal only

Gregory Szorc gregory.szorc at gmail.com
Sun Dec 20 12:32:35 CST 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1450636340 28800
#      Sun Dec 20 10:32:20 2015 -0800
# Node ID 85666a6ed6c8403a50f1c851701aa2d2a3c79c6f
# Parent  fd6eb3903a016edc748053a5aa42c74cefa6a7fb
localrepo: comment that revs() is internal only

I didn't realize repo.revs() was only appropriate for internal use.
Add a comment to help prevent others from falling into this pit.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -521,16 +521,21 @@ class localrepository(object):
     def revs(self, expr, *args):
         '''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.
+
+        Note: this should only be used on internal-facing revsets. If
+        operating on revsets provided by users, use ``revset.match()``
+        directly to avoid revset expression formatting and so revset
+        aliases work.
         '''
         expr = revset.formatspec(expr, *args)
         m = revset.match(None, expr)
         return m(self)
 
     def set(self, expr, *args):
         '''Find revisions matching a revset and emit changectx instances.
 


More information about the Mercurial-devel mailing list