diff mercurial/registrar.py @ 29937:91a95ad985d8

revset: add 'takeorder' attribute to mark functions that need ordering flag Since most functions shouldn't need 'order' flag, it is passed only when explicitly required. This avoids large API breakage.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 07 Aug 2016 17:58:50 +0900
parents cc103bd0dbf9
children 6ffb7e0249f4
line wrap: on
line diff
--- a/mercurial/registrar.py	Sun Aug 07 17:46:12 2016 +0900
+++ b/mercurial/registrar.py	Sun Aug 07 17:58:50 2016 +0900
@@ -108,6 +108,9 @@
     Optional argument 'safe' indicates whether a predicate is safe for
     DoS attack (False by default).
 
+    Optional argument 'takeorder' indicates whether a predicate function
+    takes ordering policy as the last argument.
+
     'revsetpredicate' instance in example above can be used to
     decorate multiple functions.
 
@@ -120,8 +123,9 @@
     _getname = _funcregistrarbase._parsefuncdecl
     _docformat = "``%s``\n    %s"
 
-    def _extrasetup(self, name, func, safe=False):
+    def _extrasetup(self, name, func, safe=False, takeorder=False):
         func._safe = safe
+        func._takeorder = takeorder
 
 class filesetpredicate(_funcregistrarbase):
     """Decorator to register fileset predicate