# HG changeset patch # User Martijn Pieters # Date 1464037790 25200 # Node ID e150c1d5f2624feae60465ec5afea016040d6a50 # Parent ee935a6e1ea2894c16e866bca25591aa93fb566d revset: use getargsdict for sort() This makes it possible to use keyword arguments to specify per-sort options. For example, a hypothetical 'first' option for the user sort could sort certain users first with: sort(all(), user, user.first=mpm@selenic.com) diff -r ee935a6e1ea2 -r e150c1d5f262 mercurial/revset.py --- a/mercurial/revset.py Wed May 25 15:32:35 2016 -0500 +++ b/mercurial/revset.py Mon May 23 14:09:50 2016 -0700 @@ -1847,14 +1847,16 @@ - ``user`` for user name (``author`` can be used as an alias), - ``date`` for the commit date """ - # i18n: "sort" is a keyword - l = getargs(x, 1, 2, _("sort requires one or two arguments")) + args = getargsdict(x, 'sort', 'set keys') + if 'set' not in args: + # i18n: "sort" is a keyword + raise error.ParseError(_('sort requires one or two arguments')) keys = "rev" - if len(l) == 2: + if 'keys' in args: # i18n: "sort" is a keyword - keys = getstring(l[1], _("sort spec must be a string")) - - s = l[0] + keys = getstring(args['keys'], _("sort spec must be a string")) + + s = args['set'] keys = keys.split() revs = getset(repo, subset, s) if keys == ["rev"]: