From patchwork Sun Sep 3 14:36:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [8, of, 8] parser: stabilize output of prettyformat() by using byte-safe repr() From: Yuya Nishihara X-Patchwork-Id: 23652 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 03 Sep 2017 23:36:26 +0900 # HG changeset patch # User Yuya Nishihara # Date 1504441045 -32400 # Sun Sep 03 21:17:25 2017 +0900 # Node ID a9b5bfc65a2fd68c66a5bc8fec651320ce2d7d3c # Parent 2f19734c56c0227e004a849e8037378f9d930e7d parser: stabilize output of prettyformat() by using byte-safe repr() The format of leaf nodes is slightly changed so they look more similar to internal nodes. diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -20,6 +20,7 @@ from __future__ import absolute_import from .i18n import _ from . import ( + encoding, error, util, ) @@ -193,9 +194,17 @@ def unescapestr(s): # mangle Python's exception into our format raise error.ParseError(str(e).lower()) +def _brepr(obj): + if isinstance(obj, bytes): + return b"'%s'" % util.escapestr(obj) + return encoding.strtolocal(repr(obj)) + def _prettyformat(tree, leafnodes, level, lines): - if not isinstance(tree, tuple) or tree[0] in leafnodes: - lines.append((level, str(tree))) + if not isinstance(tree, tuple): + lines.append((level, _brepr(tree))) + elif tree[0] in leafnodes: + rs = map(_brepr, tree[1:]) + lines.append((level, '(%s %s)' % (tree[0], ' '.join(rs)))) else: lines.append((level, '(%s' % tree[0])) for s in tree[1:]: @@ -219,9 +228,9 @@ def simplifyinfixops(tree, targetnodes): ... ('symbol', '2')), ... ('symbol', '3'))) (or - ('symbol', '1') - ('symbol', '2') - ('symbol', '3')) + (symbol '1') + (symbol '2') + (symbol '3')) >>> f(('func', ... ('symbol', 'p1'), ... ('or', @@ -246,25 +255,25 @@ def simplifyinfixops(tree, targetnodes): ... ('symbol', '7'))))), ... ('symbol', '8')))) (func - ('symbol', 'p1') + (symbol 'p1') (or (func - ('symbol', 'sort') + (symbol 'sort') (list (or - ('symbol', '1') - ('symbol', '2') - ('symbol', '3')) + (symbol '1') + (symbol '2') + (symbol '3')) (negate - ('symbol', 'rev')))) + (symbol 'rev')))) (and - ('symbol', '4') + (symbol '4') (group (or - ('symbol', '5') - ('symbol', '6') - ('symbol', '7')))) - ('symbol', '8'))) + (symbol '5') + (symbol '6') + (symbol '7')))) + (symbol '8'))) """ if not isinstance(tree, tuple): return tree @@ -561,8 +570,8 @@ class basealiasrules(object): >>> args = ['$1', '$2', 'foo'] >>> pprint(builddefn('$1 or foo', args)) (or - ('_aliasarg', '$1') - ('_aliasarg', 'foo')) + (_aliasarg '$1') + (_aliasarg 'foo')) >>> try: ... builddefn('$1 or $bar', args) ... except error.ParseError as inst: @@ -571,12 +580,12 @@ class basealiasrules(object): >>> args = ['$1', '$10', 'foo'] >>> pprint(builddefn('$10 or baz', args)) (or - ('_aliasarg', '$10') - ('symbol', 'baz')) + (_aliasarg '$10') + (symbol 'baz')) >>> pprint(builddefn('"$1" or "foo"', args)) (or - ('string', '$1') - ('string', 'foo')) + (string '$1') + (string 'foo')) """ tree = cls._parse(defn) if args: diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -194,18 +194,18 @@ def _unnesttemplatelist(tree): >>> def f(tree): ... print prettyformat(_unnesttemplatelist(tree)) >>> f(('template', [])) - ('string', '') + (string '') >>> f(('template', [('string', 'foo')])) - ('string', 'foo') + (string 'foo') >>> f(('template', [('string', 'foo'), ('symbol', 'rev')])) (template - ('string', 'foo') - ('symbol', 'rev')) + (string 'foo') + (symbol 'rev')) >>> f(('template', [('symbol', 'rev')])) # template(rev) -> str (template - ('symbol', 'rev')) + (symbol 'rev')) >>> f(('template', [('template', [('string', 'foo')])])) - ('string', 'foo') + (string 'foo') """ if not isinstance(tree, tuple): return tree diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -41,62 +41,62 @@ Test division: $ hg debugtemplate -r0 -v '{5 / 2} {mod(5, 2)}\n' (template (/ - ('integer', '5') - ('integer', '2')) - ('string', ' ') + (integer '5') + (integer '2')) + (string ' ') (func - ('symbol', 'mod') + (symbol 'mod') (list - ('integer', '5') - ('integer', '2'))) - ('string', '\n')) + (integer '5') + (integer '2'))) + (string '\n')) 2 1 $ hg debugtemplate -r0 -v '{5 / -2} {mod(5, -2)}\n' (template (/ - ('integer', '5') + (integer '5') (negate - ('integer', '2'))) - ('string', ' ') + (integer '2'))) + (string ' ') (func - ('symbol', 'mod') + (symbol 'mod') (list - ('integer', '5') + (integer '5') (negate - ('integer', '2')))) - ('string', '\n')) + (integer '2')))) + (string '\n')) -3 -1 $ hg debugtemplate -r0 -v '{-5 / 2} {mod(-5, 2)}\n' (template (/ (negate - ('integer', '5')) - ('integer', '2')) - ('string', ' ') + (integer '5')) + (integer '2')) + (string ' ') (func - ('symbol', 'mod') + (symbol 'mod') (list (negate - ('integer', '5')) - ('integer', '2'))) - ('string', '\n')) + (integer '5')) + (integer '2'))) + (string '\n')) -3 1 $ hg debugtemplate -r0 -v '{-5 / -2} {mod(-5, -2)}\n' (template (/ (negate - ('integer', '5')) + (integer '5')) (negate - ('integer', '2'))) - ('string', ' ') + (integer '2'))) + (string ' ') (func - ('symbol', 'mod') + (symbol 'mod') (list (negate - ('integer', '5')) + (integer '5')) (negate - ('integer', '2')))) - ('string', '\n')) + (integer '2')))) + (string '\n')) 2 -1 Filters bind closer than arithmetic: @@ -106,11 +106,11 @@ Filters bind closer than arithmetic: (- (| (func - ('symbol', 'revset') - ('string', '.')) - ('symbol', 'count')) - ('integer', '1')) - ('string', '\n')) + (symbol 'revset') + (string '.')) + (symbol 'count')) + (integer '1')) + (string '\n')) 0 But negate binds closer still: @@ -118,20 +118,20 @@ But negate binds closer still: $ hg debugtemplate -r0 -v '{1-3|stringify}\n' (template (- - ('integer', '1') + (integer '1') (| - ('integer', '3') - ('symbol', 'stringify'))) - ('string', '\n')) + (integer '3') + (symbol 'stringify'))) + (string '\n')) hg: parse error: arithmetic only defined on integers [255] $ hg debugtemplate -r0 -v '{-3|stringify}\n' (template (| (negate - ('integer', '3')) - ('symbol', 'stringify')) - ('string', '\n')) + (integer '3')) + (symbol 'stringify')) + (string '\n')) -3 Keyword arguments: @@ -139,10 +139,10 @@ Keyword arguments: $ hg debugtemplate -r0 -v '{foo=bar|baz}' (template (keyvalue - ('symbol', 'foo') + (symbol 'foo') (| - ('symbol', 'bar') - ('symbol', 'baz')))) + (symbol 'bar') + (symbol 'baz')))) hg: parse error: can't use a key-value pair in this context [255] @@ -3174,21 +3174,21 @@ Test integer literal: $ hg debugtemplate -v '{(0)}\n' (template (group - ('integer', '0')) - ('string', '\n')) + (integer '0')) + (string '\n')) 0 $ hg debugtemplate -v '{(123)}\n' (template (group - ('integer', '123')) - ('string', '\n')) + (integer '123')) + (string '\n')) 123 $ hg debugtemplate -v '{(-4)}\n' (template (group (negate - ('integer', '4'))) - ('string', '\n')) + (integer '4'))) + (string '\n')) -4 $ hg debugtemplate '{(-)}\n' hg: parse error at 3: not a prefix: ) @@ -3201,25 +3201,25 @@ top-level integer literal is interpreted $ hg debugtemplate -D 1=one -v '{1}\n' (template - ('integer', '1') - ('string', '\n')) + (integer '1') + (string '\n')) one $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n' (template (func - ('symbol', 'if') + (symbol 'if') (list - ('string', 't') + (string 't') (template - ('integer', '1')))) - ('string', '\n')) + (integer '1')))) + (string '\n')) one $ hg debugtemplate -D 1=one -v '{1|stringify}\n' (template (| - ('integer', '1') - ('symbol', 'stringify')) - ('string', '\n')) + (integer '1') + (symbol 'stringify')) + (string '\n')) one unless explicit symbol is expected: @@ -3235,27 +3235,27 @@ Test string literal: $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n' (template - ('string', 'string with no template fragment') - ('string', '\n')) + (string 'string with no template fragment') + (string '\n')) string with no template fragment $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n' (template (template - ('string', 'template: ') - ('symbol', 'rev')) - ('string', '\n')) + (string 'template: ') + (symbol 'rev')) + (string '\n')) template: 0 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n' (template - ('string', 'rawstring: {rev}') - ('string', '\n')) + (string 'rawstring: {rev}') + (string '\n')) rawstring: {rev} $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n' (template (% - ('symbol', 'files') - ('string', 'rawstring: {file}')) - ('string', '\n')) + (symbol 'files') + (string 'rawstring: {file}')) + (string '\n')) rawstring: {file} Test string escaping: @@ -4242,49 +4242,49 @@ Templater supports aliases of symbol and $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n' (template - ('symbol', 'rn') - ('string', ' ') + (symbol 'rn') + (string ' ') (| (func - ('symbol', 'utcdate') - ('symbol', 'date')) - ('symbol', 'isodate')) - ('string', '\n')) + (symbol 'utcdate') + (symbol 'date')) + (symbol 'isodate')) + (string '\n')) * expanded: (template (template - ('symbol', 'rev') - ('string', ':') + (symbol 'rev') + (string ':') (| - ('symbol', 'node') - ('symbol', 'short'))) - ('string', ' ') + (symbol 'node') + (symbol 'short'))) + (string ' ') (| (func - ('symbol', 'localdate') + (symbol 'localdate') (list - ('symbol', 'date') - ('string', 'UTC'))) - ('symbol', 'isodate')) - ('string', '\n')) + (symbol 'date') + (string 'UTC'))) + (symbol 'isodate')) + (string '\n')) 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 $ hg debugtemplate -vr0 '{status("A", file_adds)}' (template (func - ('symbol', 'status') + (symbol 'status') (list - ('string', 'A') - ('symbol', 'file_adds')))) + (string 'A') + (symbol 'file_adds')))) * expanded: (template (% - ('symbol', 'file_adds') + (symbol 'file_adds') (template - ('string', 'A') - ('string', ' ') - ('symbol', 'file') - ('string', '\n')))) + (string 'A') + (string ' ') + (symbol 'file') + (string '\n')))) A a A unary function alias can be called as a filter: @@ -4293,20 +4293,20 @@ A unary function alias can be called as (template (| (| - ('symbol', 'date') - ('symbol', 'utcdate')) - ('symbol', 'isodate')) - ('string', '\n')) + (symbol 'date') + (symbol 'utcdate')) + (symbol 'isodate')) + (string '\n')) * expanded: (template (| (func - ('symbol', 'localdate') + (symbol 'localdate') (list - ('symbol', 'date') - ('string', 'UTC'))) - ('symbol', 'isodate')) - ('string', '\n')) + (symbol 'date') + (string 'UTC'))) + (symbol 'isodate')) + (string '\n')) 1970-01-12 13:46 +0000 Aliases should be applied only to command arguments and templates in hgrc. @@ -4341,7 +4341,7 @@ Unparsable alias: $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}' (template - ('symbol', 'bad')) + (symbol 'bad')) abort: bad definition of template alias "bad": at 2: not a prefix: end [255] $ hg log --config templatealias.bad='x(' -T '{bad}' diff --git a/tests/test-fileset.t b/tests/test-fileset.t --- a/tests/test-fileset.t +++ b/tests/test-fileset.t @@ -17,20 +17,20 @@ Test operators and basic patterns $ fileset -v a1 - ('symbol', 'a1') + (symbol 'a1') a1 $ fileset -v 'a*' - ('symbol', 'a*') + (symbol 'a*') a1 a2 $ fileset -v '"re:a\d"' - ('string', 're:a\\d') + (string 're:a\\d') a1 a2 $ fileset -v 'a1 or a2' (or - ('symbol', 'a1') - ('symbol', 'a2')) + (symbol 'a1') + (symbol 'a2')) a1 a2 $ fileset 'a1 | a2' diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -1463,11 +1463,11 @@ glog always reorders nodes which explain (or (list (func - ('symbol', 'user') - ('string', 'test')) + (symbol 'user') + (string 'test')) (func - ('symbol', 'user') - ('string', 'not-a-user')))))) + (symbol 'user') + (string 'not-a-user')))))) $ testlog -b not-a-branch abort: unknown revision 'not-a-branch'! abort: unknown revision 'not-a-branch'! @@ -1479,14 +1479,14 @@ glog always reorders nodes which explain (or (list (func - ('symbol', 'branch') - ('string', 'default')) + (symbol 'branch') + (string 'default')) (func - ('symbol', 'branch') - ('string', 'branch')) + (symbol 'branch') + (string 'branch')) (func - ('symbol', 'branch') - ('string', 'branch')))))) + (symbol 'branch') + (string 'branch')))))) $ testlog -k expand -k merge [] (group @@ -1494,30 +1494,30 @@ glog always reorders nodes which explain (or (list (func - ('symbol', 'keyword') - ('string', 'expand')) + (symbol 'keyword') + (string 'expand')) (func - ('symbol', 'keyword') - ('string', 'merge')))))) + (symbol 'keyword') + (string 'merge')))))) $ testlog --only-merges [] (group (func - ('symbol', 'merge') + (symbol 'merge') None)) $ testlog --no-merges [] (group (not (func - ('symbol', 'merge') + (symbol 'merge') None))) $ testlog --date '2 0 to 4 0' [] (group (func - ('symbol', 'date') - ('string', '2 0 to 4 0'))) + (symbol 'date') + (string '2 0 to 4 0'))) $ hg log -G -d 'brace ) in a date' hg: parse error: invalid date: 'brace ) in a date' [255] @@ -1530,18 +1530,18 @@ glog always reorders nodes which explain (group (or (list - ('string', '31') + (string '31') (func - ('symbol', 'ancestors') - ('string', '31')))))) + (symbol 'ancestors') + (string '31')))))) (not (group (or (list - ('string', '32') + (string '32') (func - ('symbol', 'ancestors') - ('string', '32'))))))))) + (symbol 'ancestors') + (string '32'))))))))) Dedicated repo for --follow and paths filtering. The g is crafted to have 2 filelog topological heads in a linear changeset graph. @@ -1591,8 +1591,8 @@ have 2 filelog topological heads in a li (group (group (func - ('symbol', 'filelog') - ('string', 'a')))) + (symbol 'filelog') + (string 'a')))) $ testlog a b [] (group @@ -1600,11 +1600,11 @@ have 2 filelog topological heads in a li (or (list (func - ('symbol', 'filelog') - ('string', 'a')) + (symbol 'filelog') + (string 'a')) (func - ('symbol', 'filelog') - ('string', 'b')))))) + (symbol 'filelog') + (string 'b')))))) Test falling back to slow path for non-existing files @@ -1612,12 +1612,12 @@ Test falling back to slow path for non-e [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:a') - ('string', 'p:c')))) + (string 'r:') + (string 'd:relpath') + (string 'p:a') + (string 'p:c')))) Test multiple --include/--exclude/paths @@ -1625,16 +1625,16 @@ Test multiple --include/--exclude/paths [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:a') - ('string', 'p:e') - ('string', 'i:a') - ('string', 'i:e') - ('string', 'x:b') - ('string', 'x:e')))) + (string 'r:') + (string 'd:relpath') + (string 'p:a') + (string 'p:e') + (string 'i:a') + (string 'i:e') + (string 'x:b') + (string 'x:e')))) Test glob expansion of pats @@ -1649,8 +1649,8 @@ Test glob expansion of pats (group (group (func - ('symbol', 'filelog') - ('string', 'aa')))) + (symbol 'filelog') + (string 'aa')))) Test --follow on a non-existent directory @@ -1667,14 +1667,14 @@ Test --follow on a directory (group (and (func - ('symbol', 'ancestors') - ('symbol', '.')) + (symbol 'ancestors') + (symbol '.')) (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:dir'))))) + (string 'r:') + (string 'd:relpath') + (string 'p:dir'))))) $ hg up -q tip Test --follow on file not in parent revision @@ -1691,14 +1691,14 @@ Test --follow and patterns (group (and (func - ('symbol', 'ancestors') - ('symbol', '.')) + (symbol 'ancestors') + (symbol '.')) (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:glob:*'))))) + (string 'r:') + (string 'd:relpath') + (string 'p:glob:*'))))) Test --follow on a single rename @@ -1708,8 +1708,8 @@ Test --follow on a single rename (group (group (func - ('symbol', 'follow') - ('string', 'a')))) + (symbol 'follow') + (string 'a')))) Test --follow and multiple renames @@ -1719,8 +1719,8 @@ Test --follow and multiple renames (group (group (func - ('symbol', 'follow') - ('string', 'e')))) + (symbol 'follow') + (string 'e')))) Test --follow and multiple filelog heads @@ -1730,8 +1730,8 @@ Test --follow and multiple filelog heads (group (group (func - ('symbol', 'follow') - ('string', 'g')))) + (symbol 'follow') + (string 'g')))) $ cat log.nodes nodetag 2 nodetag 1 @@ -1742,8 +1742,8 @@ Test --follow and multiple filelog heads (group (group (func - ('symbol', 'follow') - ('string', 'g')))) + (symbol 'follow') + (string 'g')))) $ cat log.nodes nodetag 3 nodetag 2 @@ -1758,11 +1758,11 @@ Test --follow and multiple files (or (list (func - ('symbol', 'follow') - ('string', 'g')) + (symbol 'follow') + (string 'g')) (func - ('symbol', 'follow') - ('string', 'e')))))) + (symbol 'follow') + (string 'e')))))) $ cat log.nodes nodetag 4 nodetag 3 @@ -1792,10 +1792,10 @@ Test --follow-first [] (group (func - ('symbol', '_firstancestors') + (symbol '_firstancestors') (func - ('symbol', 'rev') - ('symbol', '6')))) + (symbol 'rev') + (symbol '6')))) Cannot compare with log --follow-first FILE as it never worked @@ -1804,8 +1804,8 @@ Cannot compare with log --follow-first F (group (group (func - ('symbol', '_followfirst') - ('string', 'e')))) + (symbol '_followfirst') + (string 'e')))) $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n' @ 6 merge 5 and 4 |\ @@ -1839,20 +1839,20 @@ Test "set:..." and parent revision [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:set:copied()')))) + (string 'r:') + (string 'd:relpath') + (string 'p:set:copied()')))) $ testlog --include "set:copied()" [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'i:set:copied()')))) + (string 'r:') + (string 'd:relpath') + (string 'i:set:copied()')))) $ testlog -r "sort(file('set:copied()'), -rev)" ["sort(file('set:copied()'), -rev)"] [] @@ -1866,24 +1866,24 @@ Test --removed [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:a')))) + (string 'r:') + (string 'd:relpath') + (string 'p:a')))) $ testlog --removed --follow a [] (group (and (func - ('symbol', 'ancestors') - ('symbol', '.')) + (symbol 'ancestors') + (symbol '.')) (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:a'))))) + (string 'r:') + (string 'd:relpath') + (string 'p:a'))))) Test --patch and --stat with --follow and --follow-first @@ -2209,10 +2209,10 @@ changessincelatesttag with no prior tag ['6', '8', '5', '7', '4'] (group (func - ('symbol', 'descendants') + (symbol 'descendants') (func - ('symbol', 'rev') - ('symbol', '6')))) + (symbol 'rev') + (symbol '6')))) Test --follow-first and forward --rev @@ -2220,10 +2220,10 @@ Test --follow-first and forward --rev ['6', '8', '5', '7', '4'] (group (func - ('symbol', '_firstdescendants') + (symbol '_firstdescendants') (func - ('symbol', 'rev') - ('symbol', '6')))) + (symbol 'rev') + (symbol '6')))) --- log.nodes * (glob) +++ glog.nodes * (glob) @@ -1,3 +1,3 @@ @@ -2238,10 +2238,10 @@ Test --follow and backward --rev ['6', '5', '7', '8', '4'] (group (func - ('symbol', 'ancestors') + (symbol 'ancestors') (func - ('symbol', 'rev') - ('symbol', '6')))) + (symbol 'rev') + (symbol '6')))) Test --follow-first and backward --rev @@ -2249,10 +2249,10 @@ Test --follow-first and backward --rev ['6', '5', '7', '8', '4'] (group (func - ('symbol', '_firstancestors') + (symbol '_firstancestors') (func - ('symbol', 'rev') - ('symbol', '6')))) + (symbol 'rev') + (symbol '6')))) Test --follow with --rev of graphlog extension @@ -2270,25 +2270,25 @@ Test subdir [] (group (func - ('symbol', '_matchfiles') + (symbol '_matchfiles') (list - ('string', 'r:') - ('string', 'd:relpath') - ('string', 'p:.')))) + (string 'r:') + (string 'd:relpath') + (string 'p:.')))) $ testlog ../b [] (group (group (func - ('symbol', 'filelog') - ('string', '../b')))) + (symbol 'filelog') + (string '../b')))) $ testlog -f ../b [] (group (group (func - ('symbol', 'follow') - ('string', 'b')))) + (symbol 'follow') + (string 'b')))) $ cd .. Test --hidden diff --git a/tests/test-revset-dirstate-parents.t b/tests/test-revset-dirstate-parents.t --- a/tests/test-revset-dirstate-parents.t +++ b/tests/test-revset-dirstate-parents.t @@ -14,19 +14,19 @@ $ try 'p1()' (func - ('symbol', 'p1') + (symbol 'p1') None) * set: $ try 'p2()' (func - ('symbol', 'p2') + (symbol 'p2') None) * set: $ try 'parents()' (func - ('symbol', 'parents') + (symbol 'parents') None) * set: diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -155,8 +155,8 @@ trivial $ try 0:1 (range - ('symbol', '0') - ('symbol', '1')) + (symbol '0') + (symbol '1')) * set: 0 @@ -181,8 +181,8 @@ trivial 9 $ try 3::6 (dagrange - ('symbol', '3') - ('symbol', '6')) + (symbol '3') + (symbol '6')) * set: 3 @@ -191,9 +191,9 @@ trivial $ try '0|1|2' (or (list - ('symbol', '0') - ('symbol', '1') - ('symbol', '2'))) + (symbol '0') + (symbol '1') + (symbol '2'))) * set: 0 @@ -203,14 +203,14 @@ trivial names that should work without quoting $ try a - ('symbol', 'a') + (symbol 'a') * set: 0 $ try b-a (minus - ('symbol', 'b') - ('symbol', 'a')) + (symbol 'b') + (symbol 'a')) * set: , @@ -218,14 +218,14 @@ names that should work without quoting >> 1 $ try _a_b_c_ - ('symbol', '_a_b_c_') + (symbol '_a_b_c_') * set: 6 $ try _a_b_c_-a (minus - ('symbol', '_a_b_c_') - ('symbol', 'a')) + (symbol '_a_b_c_') + (symbol 'a')) * set: , @@ -233,14 +233,14 @@ names that should work without quoting >> 6 $ try .a.b.c. - ('symbol', '.a.b.c.') + (symbol '.a.b.c.') * set: 7 $ try .a.b.c.-a (minus - ('symbol', '.a.b.c.') - ('symbol', 'a')) + (symbol '.a.b.c.') + (symbol 'a')) * set: , @@ -251,20 +251,20 @@ names that should work without quoting names that should be caught by fallback mechanism $ try -- '-a-b-c-' - ('symbol', '-a-b-c-') + (symbol '-a-b-c-') * set: 4 $ log -a-b-c- 4 $ try '+a+b+c+' - ('symbol', '+a+b+c+') + (symbol '+a+b+c+') * set: 3 $ try '+a+b+c+:' (rangepost - ('symbol', '+a+b+c+')) + (symbol '+a+b+c+')) * set: 3 @@ -276,7 +276,7 @@ names that should be caught by fallback 9 $ try ':+a+b+c+' (rangepre - ('symbol', '+a+b+c+')) + (symbol '+a+b+c+')) * set: 0 @@ -285,8 +285,8 @@ names that should be caught by fallback 3 $ try -- '-a-b-c-:+a+b+c+' (range - ('symbol', '-a-b-c-') - ('symbol', '+a+b+c+')) + (symbol '-a-b-c-') + (symbol '+a+b+c+')) * set: 4 @@ -300,15 +300,15 @@ names that should be caught by fallback (minus (minus (negate - ('symbol', 'a')) - ('symbol', 'b')) - ('symbol', 'c')) + (symbol 'a')) + (symbol 'b')) + (symbol 'c')) (negate - ('symbol', 'a'))) + (symbol 'a'))) abort: unknown revision '-a'! [255] $ try é - ('symbol', '\xc3\xa9') + (symbol '\xc3\xa9') * set: 9 @@ -324,8 +324,8 @@ quoting needed $ try '"-a-b-c-"-a' (minus - ('string', '-a-b-c-') - ('symbol', 'a')) + (string '-a-b-c-') + (symbol 'a')) * set: , @@ -345,9 +345,9 @@ quoting needed (or (list (and - ('symbol', '1') - ('symbol', '2')) - ('symbol', '3'))) + (symbol '1') + (symbol '2')) + (symbol '3'))) * set: , @@ -356,10 +356,10 @@ quoting needed $ try '1|2&3' (or (list - ('symbol', '1') + (symbol '1') (and - ('symbol', '2') - ('symbol', '3')))) + (symbol '2') + (symbol '3')))) * set: , @@ -368,20 +368,20 @@ quoting needed $ try '1&2&3' # associativity (and (and - ('symbol', '1') - ('symbol', '2')) - ('symbol', '3')) + (symbol '1') + (symbol '2')) + (symbol '3')) * set: $ try '1|(2|3)' (or (list - ('symbol', '1') + (symbol '1') (group (or (list - ('symbol', '2') - ('symbol', '3')))))) + (symbol '2') + (symbol '3')))))) * set: , @@ -471,11 +471,11 @@ keyword arguments $ try 'foo=bar|baz' (keyvalue - ('symbol', 'foo') + (symbol 'foo') (or (list - ('symbol', 'bar') - ('symbol', 'baz')))) + (symbol 'bar') + (symbol 'baz')))) hg: parse error: can't use a key-value pair in this context [255] @@ -483,17 +483,17 @@ keyword arguments $ try --optimize 'foo=(not public())' (keyvalue - ('symbol', 'foo') + (symbol 'foo') (group (not (func - ('symbol', 'public') + (symbol 'public') None)))) * optimized: (keyvalue - ('symbol', 'foo') + (symbol 'foo') (func - ('symbol', '_notpublic') + (symbol '_notpublic') None)) hg: parse error: can't use a key-value pair in this context [255] @@ -503,13 +503,13 @@ relation-subscript operator has the high $ hg debugrevspec -p parsed 'tip:tip^#generations[-1]' * parsed: (range - ('symbol', 'tip') + (symbol 'tip') (relsubscript (parentpost - ('symbol', 'tip')) - ('symbol', 'generations') + (symbol 'tip')) + (symbol 'generations') (negate - ('symbol', '1')))) + (symbol '1')))) 9 8 7 @@ -522,10 +522,10 @@ relation-subscript operator has the high (not (relsubscript (func - ('symbol', 'public') + (symbol 'public') None) - ('symbol', 'generations') - ('symbol', '0'))) + (symbol 'generations') + (symbol '0'))) left-hand side of relation-subscript operator should be optimized recursively: @@ -535,34 +535,34 @@ left-hand side of relation-subscript ope (relsubscript (not (func - ('symbol', 'public') + (symbol 'public') None)) - ('symbol', 'generations') - ('symbol', '0')) + (symbol 'generations') + (symbol '0')) * optimized: (relsubscript (func - ('symbol', '_notpublic') + (symbol '_notpublic') None) - ('symbol', 'generations') - ('symbol', '0')) + (symbol 'generations') + (symbol '0')) resolution of subscript and relation-subscript ternary operators: $ hg debugrevspec -p analyzed 'tip[0]' * analyzed: (subscript - ('symbol', 'tip') - ('symbol', '0')) + (symbol 'tip') + (symbol '0')) hg: parse error: can't use a subscript in this context [255] $ hg debugrevspec -p analyzed 'tip#rel[0]' * analyzed: (relsubscript - ('symbol', 'tip') - ('symbol', 'rel') - ('symbol', '0')) + (symbol 'tip') + (symbol 'rel') + (symbol '0')) hg: parse error: unknown identifier: rel [255] @@ -570,9 +570,9 @@ resolution of subscript and relation-sub * analyzed: (subscript (relation - ('symbol', 'tip') - ('symbol', 'rel')) - ('symbol', '0')) + (symbol 'tip') + (symbol 'rel')) + (symbol '0')) hg: parse error: can't use a subscript in this context [255] @@ -580,10 +580,10 @@ resolution of subscript and relation-sub * analyzed: (subscript (relsubscript - ('symbol', 'tip') - ('symbol', 'rel') - ('symbol', '0')) - ('symbol', '1')) + (symbol 'tip') + (symbol 'rel') + (symbol '0')) + (symbol '1')) hg: parse error: can't use a subscript in this context [255] @@ -591,10 +591,10 @@ resolution of subscript and relation-sub * analyzed: (relsubscript (relation - ('symbol', 'tip') - ('symbol', 'rel0')) - ('symbol', 'rel1') - ('symbol', '1')) + (symbol 'tip') + (symbol 'rel0')) + (symbol 'rel1') + (symbol '1')) hg: parse error: unknown identifier: rel1 [255] @@ -602,11 +602,11 @@ resolution of subscript and relation-sub * analyzed: (relsubscript (relsubscript - ('symbol', 'tip') - ('symbol', 'rel0') - ('symbol', '0')) - ('symbol', 'rel1') - ('symbol', '1')) + (symbol 'tip') + (symbol 'rel0') + (symbol '0')) + (symbol 'rel1') + (symbol '1')) hg: parse error: unknown identifier: rel1 [255] @@ -675,23 +675,23 @@ parsed tree at stages: (group (or (list - ('symbol', '0') - ('symbol', '1')))) - ('symbol', '1')) + (symbol '0') + (symbol '1')))) + (symbol '1')) * analyzed: (and (or (list - ('symbol', '0') - ('symbol', '1'))) + (symbol '0') + (symbol '1'))) (not - ('symbol', '1'))) + (symbol '1'))) * optimized: (difference (func - ('symbol', '_list') - ('string', '0\x001')) - ('symbol', '1')) + (symbol '_list') + (string '0\x001')) + (symbol '1')) 0 $ hg debugrevspec -p unknown '0' @@ -710,15 +710,15 @@ verify optimized tree: * analyzed: (and (func - ('symbol', 'r3232') + (symbol 'r3232') None) - ('symbol', '2')) + (symbol '2')) * optimized: (andsmally (func - ('symbol', 'r3232') + (symbol 'r3232') None) - ('symbol', '2')) + (symbol '2')) * analyzed set: * optimized set: @@ -766,7 +766,7 @@ may be hidden (issue5385) $ try -p analyzed ':1' * analyzed: (rangepre - ('symbol', '1')) + (symbol '1')) * set: 0 @@ -776,8 +776,8 @@ may be hidden (issue5385) (rangepre (or (list - ('symbol', '1') - ('symbol', '2')))) + (symbol '1') + (symbol '2')))) * set: 0 @@ -787,8 +787,8 @@ may be hidden (issue5385) * analyzed: (rangepre (and - ('symbol', '1') - ('symbol', '2'))) + (symbol '1') + (symbol '2'))) * set: @@ -799,8 +799,8 @@ infix/suffix resolution of ^ operator (i $ try '1^:2' (range (parentpost - ('symbol', '1')) - ('symbol', '2')) + (symbol '1')) + (symbol '2')) * set: 0 @@ -810,8 +810,8 @@ infix/suffix resolution of ^ operator (i $ try '1^::2' (dagrange (parentpost - ('symbol', '1')) - ('symbol', '2')) + (symbol '1')) + (symbol '2')) * set: 0 @@ -821,7 +821,7 @@ infix/suffix resolution of ^ operator (i $ try '9^:' (rangepost (parentpost - ('symbol', '9'))) + (symbol '9'))) * set: 8 @@ -831,10 +831,10 @@ infix/suffix resolution of ^ operator (i $ try '1^(:2)' (parent - ('symbol', '1') + (symbol '1') (group (rangepre - ('symbol', '2')))) + (symbol '2')))) hg: parse error: ^ expects a number 0, 1, or 2 [255] @@ -842,11 +842,11 @@ infix/suffix resolution of ^ operator (i $ try 'sort(1^:2)' (func - ('symbol', 'sort') + (symbol 'sort') (range (parentpost - ('symbol', '1')) - ('symbol', '2'))) + (symbol '1')) + (symbol '2'))) * set: 0 @@ -859,9 +859,9 @@ infix/suffix resolution of ^ operator (i (group (range (parentpost - ('symbol', '3')) - ('symbol', '4')))) - ('symbol', '2')) + (symbol '3')) + (symbol '4')))) + (symbol '2')) * set: 0 @@ -874,9 +874,9 @@ infix/suffix resolution of ^ operator (i (group (dagrange (parentpost - ('symbol', '3')) - ('symbol', '4')))) - ('symbol', '2')) + (symbol '3')) + (symbol '4')))) + (symbol '2')) * set: 0 @@ -889,7 +889,7 @@ infix/suffix resolution of ^ operator (i (group (rangepost (parentpost - ('symbol', '9')))))) + (symbol '9')))))) * set: 4 @@ -902,12 +902,12 @@ infix/suffix resolution of ^ operator (i x^ in alias should also be resolved $ try 'A' --config 'revsetalias.A=1^:2' - ('symbol', 'A') + (symbol 'A') * expanded: (range (parentpost - ('symbol', '1')) - ('symbol', '2')) + (symbol '1')) + (symbol '2')) * set: 0 @@ -916,13 +916,13 @@ infix/suffix resolution of ^ operator (i $ try 'A:2' --config 'revsetalias.A=1^' (range - ('symbol', 'A') - ('symbol', '2')) + (symbol 'A') + (symbol '2')) * expanded: (range (parentpost - ('symbol', '1')) - ('symbol', '2')) + (symbol '1')) + (symbol '2')) * set: 0 @@ -934,13 +934,13 @@ infix/suffix resolution of ^ operator (i $ try '1^A' --config 'revsetalias.A=:2' (parent - ('symbol', '1') - ('symbol', 'A')) + (symbol '1') + (symbol 'A')) * expanded: (parent - ('symbol', '1') + (symbol '1') (rangepre - ('symbol', '2'))) + (symbol '2'))) hg: parse error: ^ expects a number 0, 1, or 2 [255] @@ -1168,11 +1168,11 @@ test ancestors/descendants relation subs * parsed: (relsubscript (func - ('symbol', 'roots') + (symbol 'roots') (rangeall None)) - ('symbol', 'g') - ('symbol', '2')) + (symbol 'g') + (symbol '2')) 2 3 @@ -1270,22 +1270,22 @@ test author 6 $ try 'grep("(")' # invalid regular expression (func - ('symbol', 'grep') - ('string', '(')) + (symbol 'grep') + (string '(')) hg: parse error: invalid match pattern: unbalanced parenthesis [255] $ try 'grep("\bissue\d+")' (func - ('symbol', 'grep') - ('string', '\x08issue\\d+')) + (symbol 'grep') + (string '\x08issue\\d+')) * set: , > $ try 'grep(r"\bissue\d+")' (func - ('symbol', 'grep') - ('string', '\\bissue\\d+')) + (symbol 'grep') + (string '\\bissue\\d+')) * set: , @@ -1602,17 +1602,17 @@ Test operand of '%' is optimized recursi (onlypost (minus (range - ('symbol', '8') - ('symbol', '9')) - ('symbol', '8'))) + (symbol '8') + (symbol '9')) + (symbol '8'))) * optimized: (func - ('symbol', 'only') + (symbol 'only') (difference (range - ('symbol', '8') - ('symbol', '9')) - ('symbol', '8'))) + (symbol '8') + (symbol '9')) + (symbol '8'))) * set: 8 @@ -1620,15 +1620,15 @@ Test operand of '%' is optimized recursi $ try --optimize '(9)%(5)' (only (group - ('symbol', '9')) + (symbol '9')) (group - ('symbol', '5'))) + (symbol '5'))) * optimized: (func - ('symbol', 'only') + (symbol 'only') (list - ('symbol', '9') - ('symbol', '5'))) + (symbol '9') + (symbol '5'))) * set: 2 @@ -1962,14 +1962,14 @@ ordering defined by it. (difference (and (range - ('symbol', '3') - ('symbol', '0')) + (symbol '3') + (symbol '0')) (range - ('symbol', '0') - ('symbol', '3'))) + (symbol '0') + (symbol '3'))) (range - ('symbol', '2') - ('symbol', '1'))) + (symbol '2') + (symbol '1'))) * set: , @@ -2015,26 +2015,26 @@ ordering defined by it. $ try --optimize '2:0 & (0:1 + 2)' (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (group (or (list (range - ('symbol', '0') - ('symbol', '1')) - ('symbol', '2'))))) + (symbol '0') + (symbol '1')) + (symbol '2'))))) * optimized: (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (or (list (range - ('symbol', '0') - ('symbol', '1')) - ('symbol', '2')))) + (symbol '0') + (symbol '1')) + (symbol '2')))) * set: , @@ -2050,19 +2050,19 @@ ordering defined by it. $ trylist --optimize '2:0 & %ld' 0 1 2 (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', '_intlist') - ('string', '0\x001\x002'))) + (symbol '_intlist') + (string '0\x001\x002'))) * optimized: (andsmally (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', '_intlist') - ('string', '0\x001\x002'))) + (symbol '_intlist') + (string '0\x001\x002'))) * set: , @@ -2074,19 +2074,19 @@ ordering defined by it. $ trylist --optimize '%ld & 2:0' 0 2 1 (and (func - ('symbol', '_intlist') - ('string', '0\x002\x001')) + (symbol '_intlist') + (string '0\x002\x001')) (range - ('symbol', '2') - ('symbol', '0'))) + (symbol '2') + (symbol '0'))) * optimized: (and (func - ('symbol', '_intlist') - ('string', '0\x002\x001')) + (symbol '_intlist') + (string '0\x002\x001')) (range - ('symbol', '2') - ('symbol', '0'))) + (symbol '2') + (symbol '0'))) * set: , @@ -2100,19 +2100,19 @@ ordering defined by it. $ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2` (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', '_hexlist') - ('string', '*'))) (glob) + (symbol '_hexlist') + (string '*'))) (glob) * optimized: (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', '_hexlist') - ('string', '*'))) (glob) + (symbol '_hexlist') + (string '*'))) (glob) * set: , @@ -2124,19 +2124,19 @@ ordering defined by it. $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1` (and (func - ('symbol', '_hexlist') - ('string', '*')) (glob) + (symbol '_hexlist') + (string '*')) (glob) (range - ('symbol', '2') - ('symbol', '0'))) + (symbol '2') + (symbol '0'))) * optimized: (andsmally (func - ('symbol', '_hexlist') - ('string', '*')) (glob) + (symbol '_hexlist') + (string '*')) (glob) (range - ('symbol', '2') - ('symbol', '0'))) + (symbol '2') + (symbol '0'))) * set: 0 @@ -2150,11 +2150,11 @@ ordering defined by it. * optimized: (difference (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', '_list') - ('string', '0\x001'))) + (symbol '_list') + (string '0\x001'))) * set: , @@ -2166,15 +2166,15 @@ ordering defined by it. * optimized: (difference (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (and (range - ('symbol', '0') - ('symbol', '2')) + (symbol '0') + (symbol '2')) (func - ('symbol', '_list') - ('string', '0\x001')))) + (symbol '_list') + (string '0\x001')))) * set: , @@ -2188,10 +2188,10 @@ ordering defined by it. $ try -p optimized 'present(2 + 0 + 1)' * optimized: (func - ('symbol', 'present') + (symbol 'present') (func - ('symbol', '_list') - ('string', '2\x000\x001'))) + (symbol '_list') + (string '2\x000\x001'))) * set: 2 @@ -2201,25 +2201,25 @@ ordering defined by it. $ try --optimize '2:0 & present(0 + 1 + 2)' (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', 'present') + (symbol 'present') (or (list - ('symbol', '0') - ('symbol', '1') - ('symbol', '2'))))) + (symbol '0') + (symbol '1') + (symbol '2'))))) * optimized: (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', 'present') + (symbol 'present') (func - ('symbol', '_list') - ('string', '0\x001\x002')))) + (symbol '_list') + (string '0\x001\x002')))) * set: , @@ -2233,22 +2233,22 @@ ordering defined by it. $ try --optimize '0:2 & reverse(all())' (and (range - ('symbol', '0') - ('symbol', '2')) + (symbol '0') + (symbol '2')) (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'all') + (symbol 'all') None))) * optimized: (and (range - ('symbol', '0') - ('symbol', '2')) + (symbol '0') + (symbol '2')) (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'all') + (symbol 'all') None))) * set: , @@ -2307,25 +2307,25 @@ ordering defined by it. $ try --optimize '2:0 & first(1 + 0 + 2)' (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', 'first') + (symbol 'first') (or (list - ('symbol', '1') - ('symbol', '0') - ('symbol', '2'))))) + (symbol '1') + (symbol '0') + (symbol '2'))))) * optimized: (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', 'first') + (symbol 'first') (func - ('symbol', '_list') - ('string', '1\x000\x002')))) + (symbol '_list') + (string '1\x000\x002')))) * set: , @@ -2335,26 +2335,26 @@ ordering defined by it. $ try --optimize '2:0 & not last(0 + 2 + 1)' (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (not (func - ('symbol', 'last') + (symbol 'last') (or (list - ('symbol', '0') - ('symbol', '2') - ('symbol', '1')))))) + (symbol '0') + (symbol '2') + (symbol '1')))))) * optimized: (difference (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (func - ('symbol', 'last') + (symbol 'last') (func - ('symbol', '_list') - ('string', '0\x002\x001')))) + (symbol '_list') + (string '0\x002\x001')))) * set: , @@ -2368,33 +2368,33 @@ ordering defined by it. $ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)' (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (range (group (or (list - ('symbol', '1') - ('symbol', '0') - ('symbol', '2')))) + (symbol '1') + (symbol '0') + (symbol '2')))) (group (or (list - ('symbol', '0') - ('symbol', '2') - ('symbol', '1')))))) + (symbol '0') + (symbol '2') + (symbol '1')))))) * optimized: (and (range - ('symbol', '2') - ('symbol', '0')) + (symbol '2') + (symbol '0')) (range (func - ('symbol', '_list') - ('string', '1\x000\x002')) + (symbol '_list') + (string '1\x000\x002')) (func - ('symbol', '_list') - ('string', '0\x002\x001')))) + (symbol '_list') + (string '0\x002\x001')))) * set: , @@ -2406,22 +2406,22 @@ ordering defined by it. $ try --optimize 'contains("glob:*") & (2 + 0 + 1)' (and (func - ('symbol', 'contains') - ('string', 'glob:*')) + (symbol 'contains') + (string 'glob:*')) (group (or (list - ('symbol', '2') - ('symbol', '0') - ('symbol', '1'))))) + (symbol '2') + (symbol '0') + (symbol '1'))))) * optimized: (andsmally (func - ('symbol', 'contains') - ('string', 'glob:*')) + (symbol 'contains') + (string 'glob:*')) (func - ('symbol', '_list') - ('string', '2\x000\x001'))) + (symbol '_list') + (string '2\x000\x001'))) * set: , @@ -2436,26 +2436,26 @@ ordering defined by it. $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)' (and (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'contains') - ('string', 'glob:*'))) + (symbol 'contains') + (string 'glob:*'))) (group (or (list - ('symbol', '0') - ('symbol', '2') - ('symbol', '1'))))) + (symbol '0') + (symbol '2') + (symbol '1'))))) * optimized: (andsmally (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'contains') - ('string', 'glob:*'))) + (symbol 'contains') + (string 'glob:*'))) (func - ('symbol', '_list') - ('string', '0\x002\x001'))) + (symbol '_list') + (string '0\x002\x001'))) * set: , @@ -2791,13 +2791,13 @@ test that `or` operation skips duplicate (or (list (func - ('symbol', 'reverse') + (symbol 'reverse') (dagrange - ('symbol', '1') - ('symbol', '5'))) + (symbol '1') + (symbol '5'))) (func - ('symbol', 'ancestors') - ('symbol', '4')))) + (symbol 'ancestors') + (symbol '4')))) * set: , @@ -2810,17 +2810,17 @@ test that `or` operation skips duplicate 4 $ try 'sort(ancestors(4) or reverse(1::5))' (func - ('symbol', 'sort') + (symbol 'sort') (or (list (func - ('symbol', 'ancestors') - ('symbol', '4')) + (symbol 'ancestors') + (symbol '4')) (func - ('symbol', 'reverse') + (symbol 'reverse') (dagrange - ('symbol', '1') - ('symbol', '5')))))) + (symbol '1') + (symbol '5')))))) * set: , @@ -2837,18 +2837,18 @@ test optimization of trivial `or` operat $ try --optimize '0|(1)|"2"|-2|tip|null' (or (list - ('symbol', '0') + (symbol '0') (group - ('symbol', '1')) - ('string', '2') + (symbol '1')) + (string '2') (negate - ('symbol', '2')) - ('symbol', 'tip') - ('symbol', 'null'))) + (symbol '2')) + (symbol 'tip') + (symbol 'null'))) * optimized: (func - ('symbol', '_list') - ('string', '0\x001\x002\x00-2\x00tip\x00null')) + (symbol '_list') + (string '0\x001\x002\x00-2\x00tip\x00null')) * set: 0 @@ -2861,20 +2861,20 @@ test optimization of trivial `or` operat $ try --optimize '0|1|2:3' (or (list - ('symbol', '0') - ('symbol', '1') + (symbol '0') + (symbol '1') (range - ('symbol', '2') - ('symbol', '3')))) + (symbol '2') + (symbol '3')))) * optimized: (or (list (func - ('symbol', '_list') - ('string', '0\x001')) + (symbol '_list') + (string '0\x001')) (range - ('symbol', '2') - ('symbol', '3')))) + (symbol '2') + (symbol '3')))) * set: , @@ -2888,27 +2888,27 @@ test optimization of trivial `or` operat (or (list (range - ('symbol', '0') - ('symbol', '1')) - ('symbol', '2') + (symbol '0') + (symbol '1')) + (symbol '2') (range - ('symbol', '3') - ('symbol', '4')) - ('symbol', '5') - ('symbol', '6'))) + (symbol '3') + (symbol '4')) + (symbol '5') + (symbol '6'))) * optimized: (or (list (range - ('symbol', '0') - ('symbol', '1')) - ('symbol', '2') + (symbol '0') + (symbol '1')) + (symbol '2') (range - ('symbol', '3') - ('symbol', '4')) + (symbol '3') + (symbol '4')) (func - ('symbol', '_list') - ('string', '5\x006')))) + (symbol '_list') + (string '5\x006')))) * set: 3 $ try --optimize 'ancestors(1) - ancestors(3)' (minus (func - ('symbol', 'ancestors') - ('symbol', '1')) + (symbol 'ancestors') + (symbol '1')) (func - ('symbol', 'ancestors') - ('symbol', '3'))) + (symbol 'ancestors') + (symbol '3'))) * optimized: (func - ('symbol', 'only') + (symbol 'only') (list - ('symbol', '1') - ('symbol', '3'))) + (symbol '1') + (symbol '3'))) * set: $ try --optimize 'not ::2 and ::6' (and (not (dagrangepre - ('symbol', '2'))) + (symbol '2'))) (dagrangepre - ('symbol', '6'))) + (symbol '6'))) * optimized: (func - ('symbol', 'only') + (symbol 'only') (list - ('symbol', '6') - ('symbol', '2'))) + (symbol '6') + (symbol '2'))) * set: 3 @@ -3127,18 +3127,18 @@ check that conversion to only works $ try --optimize 'ancestors(6) and not ancestors(4)' (and (func - ('symbol', 'ancestors') - ('symbol', '6')) + (symbol 'ancestors') + (symbol '6')) (not (func - ('symbol', 'ancestors') - ('symbol', '4')))) + (symbol 'ancestors') + (symbol '4')))) * optimized: (func - ('symbol', 'only') + (symbol 'only') (list - ('symbol', '6') - ('symbol', '4'))) + (symbol '6') + (symbol '4'))) * set: 3 @@ -3150,14 +3150,14 @@ no crash by empty group "()" while optim $ try --optimize '::1 and ()' (and (dagrangepre - ('symbol', '1')) + (symbol '1')) (group None)) * optimized: (andsmally (func - ('symbol', 'ancestors') - ('symbol', '1')) + (symbol 'ancestors') + (symbol '1')) None) hg: parse error: missing argument [255] @@ -3168,13 +3168,13 @@ optimization to only() works only if anc * optimized: (difference (func - ('symbol', 'ancestors') - ('symbol', '6')) + (symbol 'ancestors') + (symbol '6')) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (list - ('symbol', '4') - ('symbol', '1')))) + (symbol '4') + (symbol '1')))) 0 1 3 @@ -3184,13 +3184,13 @@ optimization to only() works only if anc * optimized: (difference (func - ('symbol', 'ancestors') + (symbol 'ancestors') (list - ('symbol', '6') - ('symbol', '1'))) + (symbol '6') + (symbol '1'))) (func - ('symbol', 'ancestors') - ('symbol', '4'))) + (symbol 'ancestors') + (symbol '4'))) 5 6 @@ -3201,15 +3201,15 @@ to support it) * optimized: (difference (func - ('symbol', 'ancestors') + (symbol 'ancestors') (keyvalue - ('symbol', 'set') - ('symbol', '6'))) + (symbol 'set') + (symbol '6'))) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (keyvalue - ('symbol', 'set') - ('symbol', '4')))) + (symbol 'set') + (symbol '4')))) 3 5 6 @@ -3492,10 +3492,10 @@ aliases: $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc $ try m - ('symbol', 'm') + (symbol 'm') * expanded: (func - ('symbol', 'merge') + (symbol 'merge') None) * set: 8 @@ -3543,8 +3543,8 @@ aliases: $ export HGPLAIN $ try 'p2(.)' (func - ('symbol', 'p2') - ('symbol', '.')) + (symbol 'p2') + (symbol '.')) * set: @@ -3552,12 +3552,12 @@ aliases: $ export HGPLAINEXCEPT $ try 'p2(.)' (func - ('symbol', 'p2') - ('symbol', '.')) + (symbol 'p2') + (symbol '.')) * expanded: (func - ('symbol', 'p1') - ('symbol', '.')) + (symbol 'p1') + (symbol '.')) * set: 8 @@ -3568,12 +3568,12 @@ aliases: test alias recursion $ try sincem - ('symbol', 'sincem') + (symbol 'sincem') * expanded: (func - ('symbol', 'descendants') + (symbol 'descendants') (func - ('symbol', 'merge') + (symbol 'merge') None)) * set: @@ -3585,7 +3585,7 @@ test infinite recursion $ echo 'recurse1 = recurse2' >> .hg/hgrc $ echo 'recurse2 = recurse1' >> .hg/hgrc $ try recurse1 - ('symbol', 'recurse1') + (symbol 'recurse1') hg: parse error: infinite expansion of revset alias "recurse1" detected [255] @@ -3593,22 +3593,22 @@ test infinite recursion $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc $ try "level2(level1(1, 2), 3)" (func - ('symbol', 'level2') + (symbol 'level2') (list (func - ('symbol', 'level1') + (symbol 'level1') (list - ('symbol', '1') - ('symbol', '2'))) - ('symbol', '3'))) + (symbol '1') + (symbol '2'))) + (symbol '3'))) * expanded: (or (list - ('symbol', '3') + (symbol '3') (or (list - ('symbol', '1') - ('symbol', '2'))))) + (symbol '1') + (symbol '2'))))) * set: , @@ -3624,16 +3624,16 @@ test nesting and variable passing $ echo 'nested3($1) = max($1)' >> .hg/hgrc $ try 'nested(2:5)' (func - ('symbol', 'nested') + (symbol 'nested') (range - ('symbol', '2') - ('symbol', '5'))) + (symbol '2') + (symbol '5'))) * expanded: (func - ('symbol', 'max') + (symbol 'max') (range - ('symbol', '2') - ('symbol', '5'))) + (symbol '2') + (symbol '5'))) * set: > .hg/hgrc $ try 'chainedorops(0:1, 1:2, 2:3)' (func - ('symbol', 'chainedorops') + (symbol 'chainedorops') (list (range - ('symbol', '0') - ('symbol', '1')) + (symbol '0') + (symbol '1')) (range - ('symbol', '1') - ('symbol', '2')) + (symbol '1') + (symbol '2')) (range - ('symbol', '2') - ('symbol', '3')))) + (symbol '2') + (symbol '3')))) * expanded: (or (list (range - ('symbol', '0') - ('symbol', '1')) + (symbol '0') + (symbol '1')) (range - ('symbol', '1') - ('symbol', '2')) + (symbol '1') + (symbol '2')) (range - ('symbol', '2') - ('symbol', '3')))) + (symbol '2') + (symbol '3')))) * set: , @@ -3688,16 +3688,16 @@ far away. $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc $ try 'callinjection(2:5)' (func - ('symbol', 'callinjection') + (symbol 'callinjection') (range - ('symbol', '2') - ('symbol', '5'))) + (symbol '2') + (symbol '5'))) * expanded: (func - ('symbol', 'descendants') + (symbol 'descendants') (func - ('symbol', 'max') - ('string', '$1'))) + (symbol 'max') + (string '$1'))) abort: unknown revision '$1'! [255] @@ -3708,13 +3708,13 @@ but 'all()' should never be substituted $ echo 'shadowall(all) = all and universe' >> .hg/hgrc $ try 'shadowall(0)' (func - ('symbol', 'shadowall') - ('symbol', '0')) + (symbol 'shadowall') + (symbol '0')) * expanded: (and - ('symbol', '0') + (symbol '0') (func - ('symbol', 'all') + (symbol 'all') None)) * set: 9 $ try 'tip' - ('symbol', 'tip') + (symbol 'tip') * set: 9 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" - ('symbol', 'tip') + (symbol 'tip') warning: bad declaration of revset alias "bad name": at 4: invalid token * set: @@ -3753,17 +3753,17 @@ test unknown reference: $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc $ try 'strictreplacing("foo", tip)' (func - ('symbol', 'strictreplacing') + (symbol 'strictreplacing') (list - ('string', 'foo') - ('symbol', 'tip'))) + (string 'foo') + (symbol 'tip'))) * expanded: (or (list - ('symbol', 'tip') + (symbol 'tip') (func - ('symbol', 'desc') - ('string', '$1')))) + (symbol 'desc') + (string '$1')))) * set: , @@ -3774,20 +3774,20 @@ test unknown reference: $ try 'd(2:5)' (func - ('symbol', 'd') + (symbol 'd') (range - ('symbol', '2') - ('symbol', '5'))) + (symbol '2') + (symbol '5'))) * expanded: (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'sort') + (symbol 'sort') (list (range - ('symbol', '2') - ('symbol', '5')) - ('symbol', 'date')))) + (symbol '2') + (symbol '5')) + (symbol 'date')))) * set: 4 @@ -3796,71 +3796,71 @@ test unknown reference: 2 $ try 'rs(2 or 3, date)' (func - ('symbol', 'rs') + (symbol 'rs') (list (or (list - ('symbol', '2') - ('symbol', '3'))) - ('symbol', 'date'))) + (symbol '2') + (symbol '3'))) + (symbol 'date'))) * expanded: (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'sort') + (symbol 'sort') (list (or (list - ('symbol', '2') - ('symbol', '3'))) - ('symbol', 'date')))) + (symbol '2') + (symbol '3'))) + (symbol 'date')))) * set: 3 2 $ try 'rs()' (func - ('symbol', 'rs') + (symbol 'rs') None) hg: parse error: invalid number of arguments: 0 [255] $ try 'rs(2)' (func - ('symbol', 'rs') - ('symbol', '2')) + (symbol 'rs') + (symbol '2')) hg: parse error: invalid number of arguments: 1 [255] $ try 'rs(2, data, 7)' (func - ('symbol', 'rs') + (symbol 'rs') (list - ('symbol', '2') - ('symbol', 'data') - ('symbol', '7'))) + (symbol '2') + (symbol 'data') + (symbol '7'))) hg: parse error: invalid number of arguments: 3 [255] $ try 'rs4(2 or 3, x, x, date)' (func - ('symbol', 'rs4') + (symbol 'rs4') (list (or (list - ('symbol', '2') - ('symbol', '3'))) - ('symbol', 'x') - ('symbol', 'x') - ('symbol', 'date'))) + (symbol '2') + (symbol '3'))) + (symbol 'x') + (symbol 'x') + (symbol 'date'))) * expanded: (func - ('symbol', 'reverse') + (symbol 'reverse') (func - ('symbol', 'sort') + (symbol 'sort') (list (or (list - ('symbol', '2') - ('symbol', '3'))) - ('symbol', 'date')))) + (symbol '2') + (symbol '3'))) + (symbol 'date')))) * set: 3 @@ -3927,16 +3927,16 @@ issue2549 - correct optimizations $ try 'limit(1 or 2 or 3, 2) and not 2' (and (func - ('symbol', 'limit') + (symbol 'limit') (list (or (list - ('symbol', '1') - ('symbol', '2') - ('symbol', '3'))) - ('symbol', '2'))) + (symbol '1') + (symbol '2') + (symbol '3'))) + (symbol '2'))) (not - ('symbol', '2'))) + (symbol '2'))) * set: , @@ -3946,13 +3946,13 @@ issue2549 - correct optimizations $ try 'max(1 or 2) and not 2' (and (func - ('symbol', 'max') + (symbol 'max') (or (list - ('symbol', '1') - ('symbol', '2')))) + (symbol '1') + (symbol '2')))) (not - ('symbol', '2'))) + (symbol '2'))) * set: , @@ -4065,12 +4065,12 @@ tests for concatenation of strings/symbo (_concat (_concat (_concat - ('symbol', '278') - ('string', '5f5')) - ('symbol', '1ee')) - ('string', 'ce5')) + (symbol '278') + (string '5f5')) + (symbol '1ee')) + (string 'ce5')) * concatenated: - ('string', '2785f51eece5') + (string '2785f51eece5') * set: 0 @@ -4078,22 +4078,22 @@ tests for concatenation of strings/symbo $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc $ try "cat4(278, '5f5', 1ee, 'ce5')" (func - ('symbol', 'cat4') + (symbol 'cat4') (list - ('symbol', '278') - ('string', '5f5') - ('symbol', '1ee') - ('string', 'ce5'))) + (symbol '278') + (string '5f5') + (symbol '1ee') + (string 'ce5'))) * expanded: (_concat (_concat (_concat - ('symbol', '278') - ('string', '5f5')) - ('symbol', '1ee')) - ('string', 'ce5')) + (symbol '278') + (string '5f5')) + (symbol '1ee')) + (string 'ce5')) * concatenated: - ('string', '2785f51eece5') + (string '2785f51eece5') * set: 0 @@ -4370,98 +4370,98 @@ Test `draft() & ::x` optimization * analyzed: (and (func - ('symbol', 'draft') + (symbol 'draft') None) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (or (list (and (or (list - ('symbol', 'S1') - ('symbol', 'D1') - ('symbol', 'P5'))) + (symbol 'S1') + (symbol 'D1') + (symbol 'P5'))) (not - ('symbol', 'D3'))) - ('symbol', 'S2'))))) + (symbol 'D3'))) + (symbol 'S2'))))) * optimized: (func - ('symbol', '_phaseandancestors') + (symbol '_phaseandancestors') (list - ('symbol', 'draft') + (symbol 'draft') (or (list (difference (func - ('symbol', '_list') - ('string', 'S1\x00D1\x00P5')) - ('symbol', 'D3')) - ('symbol', 'S2'))))) + (symbol '_list') + (string 'S1\x00D1\x00P5')) + (symbol 'D3')) + (symbol 'S2'))))) $ hg debugrevspec --verify -p analyzed -p optimized 'secret() & ::9' * analyzed: (and (func - ('symbol', 'secret') + (symbol 'secret') None) (func - ('symbol', 'ancestors') - ('symbol', '9'))) + (symbol 'ancestors') + (symbol '9'))) * optimized: (func - ('symbol', '_phaseandancestors') + (symbol '_phaseandancestors') (list - ('symbol', 'secret') - ('symbol', '9'))) + (symbol 'secret') + (symbol '9'))) $ hg debugrevspec --verify -p analyzed -p optimized '7 & ( (not public()) & ::(tag()) )' * analyzed: (and - ('symbol', '7') + (symbol '7') (and (not (func - ('symbol', 'public') + (symbol 'public') None)) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (func - ('symbol', 'tag') + (symbol 'tag') None)))) * optimized: (and - ('symbol', '7') + (symbol '7') (func - ('symbol', '_phaseandancestors') + (symbol '_phaseandancestors') (list - ('symbol', '_notpublic') + (symbol '_notpublic') (func - ('symbol', 'tag') + (symbol 'tag') None)))) $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, 1)' * optimized: (and (func - ('symbol', '_notpublic') + (symbol '_notpublic') None) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (list (func - ('symbol', '_list') - ('string', 'S1\x00D2\x00P5')) - ('symbol', '1')))) + (symbol '_list') + (string 'S1\x00D2\x00P5')) + (symbol '1')))) $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, depth=1)' * optimized: (and (func - ('symbol', '_notpublic') + (symbol '_notpublic') None) (func - ('symbol', 'ancestors') + (symbol 'ancestors') (list (func - ('symbol', '_list') - ('string', 'S1\x00D2\x00P5')) + (symbol '_list') + (string 'S1\x00D2\x00P5')) (keyvalue - ('symbol', 'depth') - ('symbol', '1'))))) + (symbol 'depth') + (symbol '1')))))