diff --git a/mercurial/registrar.py b/mercurial/registrar.py --- a/mercurial/registrar.py +++ b/mercurial/registrar.py @@ -166,7 +166,8 @@ DoS attack (False by default). Optional argument 'takeorder' indicates whether a predicate function - takes ordering policy as the last argument. + takes ordering policy as the last argument. By default, takeorder is None + and will be inferrepo from function signature. Optional argument 'takesubset' indicates whether a predicate function takes subset as its second argument. By default, takesubset is None and @@ -188,8 +189,12 @@ _getname = _funcregistrarbase._parsefuncdecl _docformat = "``%s``\n %s" - def _extrasetup(self, name, func, safe=False, takeorder=False, + def _extrasetup(self, name, func, safe=False, takeorder=None, takesubset=None): + args = inspect.getargspec(func).args + if takeorder is None: + takeorder = (len(args) >= 4) + if takeorder: if takesubset is False: raise error.ProgrammingError( @@ -198,7 +203,6 @@ if takesubset is None: # detect from signature - args = inspect.getargspec(func).args takesubset = (len(args) >= 3) func._safe = safe diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -65,7 +65,7 @@ A typical use of this function is:: - @revsetpredicate('myrevset', takeorder=True) + @revsetpredicate('myrevset') def myrevset(repo, subset, x, order): newset = ... # a smartset that implements "myrevset" return revset.intersect(subset, newset, order)