2010-08-30 08:23:32 +04:00
|
|
|
$ HGENCODING=utf-8
|
|
|
|
$ export HGENCODING
|
2014-03-27 02:55:50 +04:00
|
|
|
$ cat > testrevset.py << EOF
|
|
|
|
> import mercurial.revset
|
|
|
|
>
|
|
|
|
> baseset = mercurial.revset.baseset
|
|
|
|
>
|
|
|
|
> def r3232(repo, subset, x):
|
|
|
|
> """"simple revset that return [3,2,3,2]
|
|
|
|
>
|
|
|
|
> revisions duplicated on purpose.
|
|
|
|
> """
|
|
|
|
> if 3 not in subset:
|
|
|
|
> if 2 in subset:
|
|
|
|
> return baseset([2,2])
|
|
|
|
> return baseset()
|
|
|
|
> return baseset([3,3,2,2])
|
|
|
|
>
|
|
|
|
> mercurial.revset.symbols['r3232'] = r3232
|
|
|
|
> EOF
|
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [extensions]
|
|
|
|
> testrevset=$TESTTMP/testrevset.py
|
|
|
|
> EOF
|
2010-08-30 08:23:32 +04:00
|
|
|
|
|
|
|
$ try() {
|
2011-04-30 20:30:14 +04:00
|
|
|
> hg debugrevspec --debug "$@"
|
2010-08-30 08:23:32 +04:00
|
|
|
> }
|
|
|
|
|
|
|
|
$ log() {
|
|
|
|
> hg log --template '{rev}\n' -r "$1"
|
|
|
|
> }
|
|
|
|
|
2016-06-22 16:02:25 +03:00
|
|
|
extension to build '_intlist()' and '_hexlist()', which is necessary because
|
|
|
|
these predicates use '\0' as a separator:
|
|
|
|
|
|
|
|
$ cat <<EOF > debugrevlistspec.py
|
|
|
|
> from __future__ import absolute_import
|
|
|
|
> from mercurial import (
|
|
|
|
> node as nodemod,
|
2016-01-09 17:07:20 +03:00
|
|
|
> registrar,
|
2016-06-22 16:02:25 +03:00
|
|
|
> revset,
|
2017-02-19 12:19:33 +03:00
|
|
|
> revsetlang,
|
2016-10-16 11:28:51 +03:00
|
|
|
> smartset,
|
2016-06-22 16:02:25 +03:00
|
|
|
> )
|
|
|
|
> cmdtable = {}
|
2016-01-09 17:07:20 +03:00
|
|
|
> command = registrar.command(cmdtable)
|
2017-06-25 05:50:05 +03:00
|
|
|
> @command(b'debugrevlistspec',
|
2016-06-22 16:02:25 +03:00
|
|
|
> [('', 'optimize', None, 'print parsed tree after optimizing'),
|
|
|
|
> ('', 'bin', None, 'unhexlify arguments')])
|
|
|
|
> def debugrevlistspec(ui, repo, fmt, *args, **opts):
|
|
|
|
> if opts['bin']:
|
|
|
|
> args = map(nodemod.bin, args)
|
2017-02-19 12:19:33 +03:00
|
|
|
> expr = revsetlang.formatspec(fmt, list(args))
|
2016-06-22 16:02:25 +03:00
|
|
|
> if ui.verbose:
|
2017-02-19 12:19:33 +03:00
|
|
|
> tree = revsetlang.parse(expr, lookup=repo.__contains__)
|
|
|
|
> ui.note(revsetlang.prettyformat(tree), "\n")
|
2016-06-22 16:02:25 +03:00
|
|
|
> if opts["optimize"]:
|
2017-02-19 12:19:33 +03:00
|
|
|
> opttree = revsetlang.optimize(revsetlang.analyze(tree))
|
|
|
|
> ui.note("* optimized:\n", revsetlang.prettyformat(opttree),
|
|
|
|
> "\n")
|
2016-06-22 16:02:25 +03:00
|
|
|
> func = revset.match(ui, expr, repo)
|
|
|
|
> revs = func(repo)
|
|
|
|
> if ui.verbose:
|
2016-10-16 11:28:51 +03:00
|
|
|
> ui.note("* set:\n", smartset.prettyformat(revs), "\n")
|
2016-06-22 16:02:25 +03:00
|
|
|
> for c in revs:
|
|
|
|
> ui.write("%s\n" % c)
|
|
|
|
> EOF
|
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
|
|
> [extensions]
|
|
|
|
> debugrevlistspec = $TESTTMP/debugrevlistspec.py
|
|
|
|
> EOF
|
|
|
|
$ trylist() {
|
|
|
|
> hg debugrevlistspec --debug "$@"
|
|
|
|
> }
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ hg init repo
|
|
|
|
$ cd repo
|
|
|
|
|
|
|
|
$ echo a > a
|
|
|
|
$ hg branch a
|
|
|
|
marked working directory as branch a
|
2011-12-09 00:32:44 +04:00
|
|
|
(branches are permanent and global, did you want a bookmark?)
|
2010-08-30 08:23:32 +04:00
|
|
|
$ hg ci -Aqm0
|
|
|
|
|
|
|
|
$ echo b > b
|
|
|
|
$ hg branch b
|
|
|
|
marked working directory as branch b
|
|
|
|
$ hg ci -Aqm1
|
|
|
|
|
|
|
|
$ rm a
|
|
|
|
$ hg branch a-b-c-
|
|
|
|
marked working directory as branch a-b-c-
|
|
|
|
$ hg ci -Aqm2 -u Bob
|
|
|
|
|
2012-05-12 12:20:57 +04:00
|
|
|
$ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
|
|
|
|
2
|
|
|
|
$ hg log -r "extra('branch')" --template '{rev}\n'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
2012-05-31 02:14:04 +04:00
|
|
|
$ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
|
|
|
|
0 a
|
|
|
|
2 a-b-c-
|
2012-05-12 12:20:57 +04:00
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ hg co 1
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg branch +a+b+c+
|
|
|
|
marked working directory as branch +a+b+c+
|
|
|
|
$ hg ci -Aqm3
|
|
|
|
|
|
|
|
$ hg co 2 # interleave
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ echo bb > b
|
|
|
|
$ hg branch -- -a-b-c-
|
|
|
|
marked working directory as branch -a-b-c-
|
|
|
|
$ hg ci -Aqm4 -d "May 12 2005"
|
|
|
|
|
|
|
|
$ hg co 3
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
test-revset: enable for Windows
In MSYS, the test fails like this if the hghave exit at the beginning is
removed:
--- C:\Users\adi\hgrepos\hg-main\tests\test-revset.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-revset.t.err
@@ -58,7 +58,7 @@
$ hg co 3
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch /a/b/c/
- marked working directory as branch /a/b/c/
+ marked working directory as branch a:/b/c/
(branches are permanent and global, did you want a bookmark?)
$ hg ci -Aqm"5 bug"
@@ -252,7 +252,7 @@
2 a-b-c-
3 +a+b+c+
4 -a-b-c-
- 5 /a/b/c/
+ 5 a:/b/c/
6 _a_b_c_
7 .a.b.c.
$ log 'children(ancestor(4,5))'
due to the posix path conversion done by MSYS globally, as explained here
http://www.mingw.org/wiki/Posix_path_conversion
The solution is a bit lame, but it is simple and works: don't use strings that
look like '/a/b', in order not to trigger the path magic done by MSYS.
So, if we can agree not to insist on testing branch names starting with '/',
then this relatively simple patch makes the test pass both on Windows with MSYS
and Linux.
2012-06-03 11:06:15 +04:00
|
|
|
$ hg branch !a/b/c/
|
|
|
|
marked working directory as branch !a/b/c/
|
2010-08-30 08:23:32 +04:00
|
|
|
$ hg ci -Aqm"5 bug"
|
|
|
|
|
|
|
|
$ hg merge 4
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg branch _a_b_c_
|
|
|
|
marked working directory as branch _a_b_c_
|
|
|
|
$ hg ci -Aqm"6 issue619"
|
|
|
|
|
|
|
|
$ hg branch .a.b.c.
|
|
|
|
marked working directory as branch .a.b.c.
|
|
|
|
$ hg ci -Aqm7
|
|
|
|
|
|
|
|
$ hg branch all
|
|
|
|
marked working directory as branch all
|
|
|
|
|
|
|
|
$ hg co 4
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg branch é
|
2010-11-08 03:41:41 +03:00
|
|
|
marked working directory as branch \xc3\xa9 (esc)
|
2010-08-30 08:23:32 +04:00
|
|
|
$ hg ci -Aqm9
|
|
|
|
|
|
|
|
$ hg tag -r6 1.0
|
2015-04-20 10:52:20 +03:00
|
|
|
$ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
2010-08-30 08:23:32 +04:00
|
|
|
|
|
|
|
$ hg clone --quiet -U -r 7 . ../remote1
|
|
|
|
$ hg clone --quiet -U -r 8 . ../remote2
|
|
|
|
$ echo "[paths]" >> .hg/hgrc
|
|
|
|
$ echo "default = ../remote1" >> .hg/hgrc
|
|
|
|
|
2015-03-16 12:36:53 +03:00
|
|
|
trivial
|
|
|
|
|
|
|
|
$ try 0:1
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>
|
2015-03-16 12:36:53 +03:00
|
|
|
0
|
|
|
|
1
|
2015-07-05 06:15:54 +03:00
|
|
|
$ try --optimize :
|
|
|
|
(rangeall
|
|
|
|
None)
|
|
|
|
* optimized:
|
2017-01-09 10:55:56 +03:00
|
|
|
(rangeall
|
|
|
|
None
|
2016-08-07 11:46:12 +03:00
|
|
|
define)
|
2015-07-05 06:15:54 +03:00
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:10>
|
2015-07-05 06:15:54 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
2015-03-16 12:36:53 +03:00
|
|
|
$ try 3::6
|
|
|
|
(dagrange
|
|
|
|
('symbol', '3')
|
|
|
|
('symbol', '6'))
|
|
|
|
* set:
|
2015-08-21 03:23:21 +03:00
|
|
|
<baseset+ [3, 5, 6]>
|
2015-03-16 12:36:53 +03:00
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ try '0|1|2'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
2015-05-17 09:11:38 +03:00
|
|
|
<baseset [0, 1, 2]>
|
2015-03-16 12:36:53 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
names that should work without quoting
|
|
|
|
|
|
|
|
$ try a
|
|
|
|
('symbol', 'a')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [0]>
|
2010-08-30 08:23:32 +04:00
|
|
|
0
|
|
|
|
$ try b-a
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(minus
|
|
|
|
('symbol', 'b')
|
|
|
|
('symbol', 'a'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-02-13 13:25:11 +03:00
|
|
|
<baseset [1]>,
|
|
|
|
<not
|
|
|
|
<baseset [0]>>>
|
2010-08-30 08:23:32 +04:00
|
|
|
1
|
|
|
|
$ try _a_b_c_
|
|
|
|
('symbol', '_a_b_c_')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [6]>
|
2010-08-30 08:23:32 +04:00
|
|
|
6
|
|
|
|
$ try _a_b_c_-a
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(minus
|
|
|
|
('symbol', '_a_b_c_')
|
|
|
|
('symbol', 'a'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-02-13 13:25:11 +03:00
|
|
|
<baseset [6]>,
|
|
|
|
<not
|
|
|
|
<baseset [0]>>>
|
2010-08-30 08:23:32 +04:00
|
|
|
6
|
|
|
|
$ try .a.b.c.
|
|
|
|
('symbol', '.a.b.c.')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [7]>
|
2010-08-30 08:23:32 +04:00
|
|
|
7
|
|
|
|
$ try .a.b.c.-a
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(minus
|
|
|
|
('symbol', '.a.b.c.')
|
|
|
|
('symbol', 'a'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-02-13 13:25:11 +03:00
|
|
|
<baseset [7]>,
|
|
|
|
<not
|
|
|
|
<baseset [0]>>>
|
2010-08-30 08:23:32 +04:00
|
|
|
7
|
2015-07-18 17:02:18 +03:00
|
|
|
|
|
|
|
names that should be caught by fallback mechanism
|
|
|
|
|
|
|
|
$ try -- '-a-b-c-'
|
2015-07-18 17:30:17 +03:00
|
|
|
('symbol', '-a-b-c-')
|
2015-07-18 17:02:18 +03:00
|
|
|
* set:
|
|
|
|
<baseset [4]>
|
|
|
|
4
|
|
|
|
$ log -a-b-c-
|
2010-08-30 08:23:32 +04:00
|
|
|
4
|
2015-07-18 17:30:17 +03:00
|
|
|
$ try '+a+b+c+'
|
|
|
|
('symbol', '+a+b+c+')
|
|
|
|
* set:
|
|
|
|
<baseset [3]>
|
|
|
|
3
|
|
|
|
$ try '+a+b+c+:'
|
|
|
|
(rangepost
|
|
|
|
('symbol', '+a+b+c+'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 3:10>
|
2015-07-18 17:30:17 +03:00
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ try ':+a+b+c+'
|
|
|
|
(rangepre
|
|
|
|
('symbol', '+a+b+c+'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:4>
|
2015-07-18 17:30:17 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
$ try -- '-a-b-c-:+a+b+c+'
|
|
|
|
(range
|
|
|
|
('symbol', '-a-b-c-')
|
|
|
|
('symbol', '+a+b+c+'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 3:5>
|
2015-07-18 17:30:17 +03:00
|
|
|
4
|
|
|
|
3
|
|
|
|
$ log '-a-b-c-:+a+b+c+'
|
|
|
|
4
|
|
|
|
3
|
2014-03-19 02:56:27 +04:00
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ try -- -a-b-c--a # complains
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(minus
|
|
|
|
(minus
|
|
|
|
(minus
|
|
|
|
(negate
|
|
|
|
('symbol', 'a'))
|
|
|
|
('symbol', 'b'))
|
|
|
|
('symbol', 'c'))
|
|
|
|
(negate
|
|
|
|
('symbol', 'a')))
|
2010-08-30 08:23:32 +04:00
|
|
|
abort: unknown revision '-a'!
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ try é
|
|
|
|
('symbol', '\xc3\xa9')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [9]>
|
2010-08-30 08:23:32 +04:00
|
|
|
9
|
|
|
|
|
2014-03-19 02:56:27 +04:00
|
|
|
no quoting needed
|
|
|
|
|
|
|
|
$ log ::a-b-c-
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
quoting needed
|
|
|
|
|
|
|
|
$ try '"-a-b-c-"-a'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(minus
|
|
|
|
('string', '-a-b-c-')
|
|
|
|
('symbol', 'a'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-02-13 13:25:11 +03:00
|
|
|
<baseset [4]>,
|
|
|
|
<not
|
|
|
|
<baseset [0]>>>
|
2010-08-30 08:23:32 +04:00
|
|
|
4
|
|
|
|
|
|
|
|
$ log '1 or 2'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
$ log '1|2'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
$ log '1 and 2'
|
|
|
|
$ log '1&2'
|
|
|
|
$ try '1&2|3' # precedence - and is higher
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(and
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
('symbol', '3')))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset []>,
|
|
|
|
<baseset [3]>>
|
2010-08-30 08:23:32 +04:00
|
|
|
3
|
|
|
|
$ try '1|2&3'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
(and
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset [1]>,
|
|
|
|
<baseset []>>
|
2010-08-30 08:23:32 +04:00
|
|
|
1
|
|
|
|
$ try '1&2&3' # associativity
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(and
|
|
|
|
(and
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
('symbol', '3'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset []>
|
2010-08-30 08:23:32 +04:00
|
|
|
$ try '1|(2|3)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
(group
|
|
|
|
(or
|
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset [1]>,
|
2015-05-17 09:11:38 +03:00
|
|
|
<baseset [2, 3]>>
|
2010-08-30 08:23:32 +04:00
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
$ log '1.0' # tag
|
|
|
|
6
|
|
|
|
$ log 'a' # branch
|
|
|
|
0
|
|
|
|
$ log '2785f51ee'
|
|
|
|
0
|
|
|
|
$ log 'date(2005)'
|
|
|
|
4
|
|
|
|
$ log 'date(this is a test)'
|
|
|
|
hg: parse error at 10: unexpected token: symbol
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date()'
|
2010-10-16 20:50:53 +04:00
|
|
|
hg: parse error: date requires a string
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date'
|
2015-05-03 19:28:15 +03:00
|
|
|
abort: unknown revision 'date'!
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date('
|
|
|
|
hg: parse error at 5: not a prefix: end
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2015-09-10 17:29:55 +03:00
|
|
|
$ log 'date("\xy")'
|
|
|
|
hg: parse error: invalid \x escape
|
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date(tip)'
|
2017-05-24 18:50:17 +03:00
|
|
|
hg: parse error: invalid date: 'tip'
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2015-05-03 19:28:15 +03:00
|
|
|
$ log '0:date'
|
|
|
|
abort: unknown revision 'date'!
|
|
|
|
[255]
|
|
|
|
$ log '::"date"'
|
2010-08-30 08:23:32 +04:00
|
|
|
abort: unknown revision 'date'!
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2015-05-03 19:28:15 +03:00
|
|
|
$ hg book date -r 4
|
|
|
|
$ log '0:date'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
$ log '::date'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
4
|
|
|
|
$ log '::"date"'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
4
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date(2005) and 1::'
|
|
|
|
4
|
2015-05-03 19:28:15 +03:00
|
|
|
$ hg book -d date
|
|
|
|
|
2016-06-27 14:44:14 +03:00
|
|
|
function name should be a symbol
|
|
|
|
|
|
|
|
$ log '"date"(2005)'
|
|
|
|
hg: parse error: not a symbol
|
|
|
|
[255]
|
|
|
|
|
2015-06-27 11:05:28 +03:00
|
|
|
keyword arguments
|
|
|
|
|
2015-06-28 16:57:33 +03:00
|
|
|
$ log 'extra(branch, value=a)'
|
|
|
|
0
|
|
|
|
|
|
|
|
$ log 'extra(branch, a, b)'
|
2017-04-08 14:07:37 +03:00
|
|
|
hg: parse error: extra takes at most 2 positional arguments
|
2015-06-28 16:57:33 +03:00
|
|
|
[255]
|
|
|
|
$ log 'extra(a, label=b)'
|
|
|
|
hg: parse error: extra got multiple values for keyword argument 'label'
|
|
|
|
[255]
|
|
|
|
$ log 'extra(label=branch, default)'
|
|
|
|
hg: parse error: extra got an invalid argument
|
|
|
|
[255]
|
|
|
|
$ log 'extra(branch, foo+bar=baz)'
|
|
|
|
hg: parse error: extra got an invalid argument
|
|
|
|
[255]
|
|
|
|
$ log 'extra(unknown=branch)'
|
|
|
|
hg: parse error: extra got an unexpected keyword argument 'unknown'
|
|
|
|
[255]
|
|
|
|
|
2015-06-27 11:05:28 +03:00
|
|
|
$ try 'foo=bar|baz'
|
|
|
|
(keyvalue
|
|
|
|
('symbol', 'foo')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', 'bar')
|
|
|
|
('symbol', 'baz'))))
|
2015-06-27 11:05:28 +03:00
|
|
|
hg: parse error: can't use a key-value pair in this context
|
|
|
|
[255]
|
|
|
|
|
2016-08-07 08:58:49 +03:00
|
|
|
right-hand side should be optimized recursively
|
|
|
|
|
|
|
|
$ try --optimize 'foo=(not public())'
|
|
|
|
(keyvalue
|
|
|
|
('symbol', 'foo')
|
|
|
|
(group
|
|
|
|
(not
|
|
|
|
(func
|
|
|
|
('symbol', 'public')
|
|
|
|
None))))
|
|
|
|
* optimized:
|
|
|
|
(keyvalue
|
|
|
|
('symbol', 'foo')
|
|
|
|
(func
|
|
|
|
('symbol', '_notpublic')
|
2016-08-07 11:46:12 +03:00
|
|
|
None
|
|
|
|
any))
|
2016-08-07 08:58:49 +03:00
|
|
|
hg: parse error: can't use a key-value pair in this context
|
|
|
|
[255]
|
|
|
|
|
2016-08-21 06:33:57 +03:00
|
|
|
parsed tree at stages:
|
|
|
|
|
|
|
|
$ hg debugrevspec -p all '()'
|
|
|
|
* parsed:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* expanded:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* concatenated:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* analyzed:
|
|
|
|
None
|
|
|
|
* optimized:
|
|
|
|
None
|
|
|
|
hg: parse error: missing argument
|
|
|
|
[255]
|
|
|
|
|
2016-08-21 06:40:02 +03:00
|
|
|
$ hg debugrevspec --no-optimized -p all '()'
|
|
|
|
* parsed:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* expanded:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* concatenated:
|
|
|
|
(group
|
|
|
|
None)
|
|
|
|
* analyzed:
|
|
|
|
None
|
|
|
|
hg: parse error: missing argument
|
|
|
|
[255]
|
|
|
|
|
2016-08-21 06:33:57 +03:00
|
|
|
$ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1'
|
|
|
|
* parsed:
|
|
|
|
(minus
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))))
|
2016-08-21 06:33:57 +03:00
|
|
|
('symbol', '1'))
|
|
|
|
* analyzed:
|
|
|
|
(and
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1'))
|
|
|
|
define)
|
2016-08-21 06:33:57 +03:00
|
|
|
(not
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1')
|
|
|
|
follow)
|
|
|
|
define)
|
2016-08-21 06:33:57 +03:00
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001')
|
|
|
|
define)
|
|
|
|
('symbol', '1')
|
|
|
|
define)
|
2016-08-21 06:33:57 +03:00
|
|
|
0
|
|
|
|
|
|
|
|
$ hg debugrevspec -p unknown '0'
|
|
|
|
abort: invalid stage name: unknown
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ hg debugrevspec -p all --optimize '0'
|
|
|
|
abort: cannot use --optimize with --show-stage
|
|
|
|
[255]
|
|
|
|
|
2016-08-21 07:16:21 +03:00
|
|
|
verify optimized tree:
|
|
|
|
|
|
|
|
$ hg debugrevspec --verify '0|1'
|
|
|
|
|
|
|
|
$ hg debugrevspec --verify -v -p analyzed -p optimized 'r3232() & 2'
|
|
|
|
* analyzed:
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'r3232')
|
2016-08-07 11:46:12 +03:00
|
|
|
None
|
|
|
|
define)
|
|
|
|
('symbol', '2')
|
|
|
|
define)
|
2016-08-21 07:16:21 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
('symbol', '2')
|
|
|
|
(func
|
|
|
|
('symbol', 'r3232')
|
2016-08-07 11:46:12 +03:00
|
|
|
None
|
|
|
|
define)
|
|
|
|
define)
|
2016-08-21 07:16:21 +03:00
|
|
|
* analyzed set:
|
|
|
|
<baseset [2]>
|
|
|
|
* optimized set:
|
|
|
|
<baseset [2, 2]>
|
|
|
|
--- analyzed
|
|
|
|
+++ optimized
|
|
|
|
2
|
|
|
|
+2
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ hg debugrevspec --no-optimized --verify-optimized '0'
|
|
|
|
abort: cannot use --verify-optimized with --no-optimized
|
|
|
|
[255]
|
|
|
|
|
2015-05-03 19:28:15 +03:00
|
|
|
Test that symbols only get parsed as functions if there's an opening
|
|
|
|
parenthesis.
|
|
|
|
|
|
|
|
$ hg book only -r 9
|
|
|
|
$ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark
|
|
|
|
8
|
|
|
|
9
|
2010-08-30 08:23:32 +04:00
|
|
|
|
2016-10-01 14:20:11 +03:00
|
|
|
':y' behaves like '0:y', but can't be rewritten as such since the revision '0'
|
|
|
|
may be hidden (issue5385)
|
|
|
|
|
|
|
|
$ try -p parsed -p analyzed ':'
|
|
|
|
* parsed:
|
|
|
|
(rangeall
|
|
|
|
None)
|
|
|
|
* analyzed:
|
2017-01-09 10:55:56 +03:00
|
|
|
(rangeall
|
|
|
|
None
|
2016-10-01 14:20:11 +03:00
|
|
|
define)
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:10>
|
2016-10-01 14:20:11 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ try -p analyzed ':1'
|
|
|
|
* analyzed:
|
|
|
|
(rangepre
|
|
|
|
('symbol', '1')
|
|
|
|
define)
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>
|
2016-10-01 14:20:11 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
$ try -p analyzed ':(1|2)'
|
|
|
|
* analyzed:
|
|
|
|
(rangepre
|
|
|
|
(or
|
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-10-01 14:20:11 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
$ try -p analyzed ':(1&2)'
|
|
|
|
* analyzed:
|
|
|
|
(rangepre
|
|
|
|
(and
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<baseset []>
|
|
|
|
|
2016-08-06 13:59:28 +03:00
|
|
|
infix/suffix resolution of ^ operator (issue2884):
|
|
|
|
|
|
|
|
x^:y means (x^):y
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '1^:2'
|
2016-08-06 13:59:28 +03:00
|
|
|
(range
|
|
|
|
(parentpost
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-08-06 13:59:28 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '1^::2'
|
2016-08-06 13:59:28 +03:00
|
|
|
(dagrange
|
|
|
|
(parentpost
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
|
|
|
<baseset+ [0, 1, 2]>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:37:48 +03:00
|
|
|
$ try '9^:'
|
|
|
|
(rangepost
|
|
|
|
(parentpost
|
|
|
|
('symbol', '9')))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 8:10>
|
2016-08-06 14:37:48 +03:00
|
|
|
8
|
|
|
|
9
|
|
|
|
|
2016-08-06 13:59:28 +03:00
|
|
|
x^:y should be resolved before omitting group operators
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '1^(:2)'
|
2016-08-06 13:59:28 +03:00
|
|
|
(parent
|
|
|
|
('symbol', '1')
|
|
|
|
(group
|
|
|
|
(rangepre
|
|
|
|
('symbol', '2'))))
|
|
|
|
hg: parse error: ^ expects a number 0, 1, or 2
|
|
|
|
[255]
|
|
|
|
|
|
|
|
x^:y should be resolved recursively
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try 'sort(1^:2)'
|
2016-08-06 13:59:28 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(range
|
|
|
|
(parentpost
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2')))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-08-06 13:59:28 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '(3^:4)^:2'
|
2016-08-06 13:59:28 +03:00
|
|
|
(range
|
|
|
|
(parentpost
|
2016-08-06 14:21:00 +03:00
|
|
|
(group
|
|
|
|
(range
|
|
|
|
(parentpost
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', '4'))))
|
2016-08-06 13:59:28 +03:00
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-08-06 13:59:28 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '(3^::4)^::2'
|
2016-08-06 13:59:28 +03:00
|
|
|
(dagrange
|
|
|
|
(parentpost
|
2016-08-06 14:21:00 +03:00
|
|
|
(group
|
|
|
|
(dagrange
|
|
|
|
(parentpost
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', '4'))))
|
2016-08-06 13:59:28 +03:00
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
|
|
|
<baseset+ [0, 1, 2]>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:37:48 +03:00
|
|
|
$ try '(9^:)^:'
|
|
|
|
(rangepost
|
|
|
|
(parentpost
|
|
|
|
(group
|
|
|
|
(rangepost
|
|
|
|
(parentpost
|
|
|
|
('symbol', '9'))))))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 4:10>
|
2016-08-06 14:37:48 +03:00
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
2016-08-06 13:59:28 +03:00
|
|
|
x^ in alias should also be resolved
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try 'A' --config 'revsetalias.A=1^:2'
|
2016-08-06 13:59:28 +03:00
|
|
|
('symbol', 'A')
|
|
|
|
* expanded:
|
|
|
|
(range
|
|
|
|
(parentpost
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-08-06 13:59:28 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try 'A:2' --config 'revsetalias.A=1^'
|
2016-08-06 13:59:28 +03:00
|
|
|
(range
|
|
|
|
('symbol', 'A')
|
|
|
|
('symbol', '2'))
|
|
|
|
* expanded:
|
|
|
|
(range
|
|
|
|
(parentpost
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2'))
|
|
|
|
* set:
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>
|
2016-08-06 13:59:28 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
|
|
|
but not beyond the boundary of alias expansion, because the resolution should
|
|
|
|
be made at the parsing stage
|
|
|
|
|
2016-08-06 14:21:00 +03:00
|
|
|
$ try '1^A' --config 'revsetalias.A=:2'
|
2016-08-06 13:59:28 +03:00
|
|
|
(parent
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', 'A'))
|
|
|
|
* expanded:
|
|
|
|
(parent
|
|
|
|
('symbol', '1')
|
|
|
|
(rangepre
|
|
|
|
('symbol', '2')))
|
2016-08-06 14:21:00 +03:00
|
|
|
hg: parse error: ^ expects a number 0, 1, or 2
|
|
|
|
[255]
|
2016-08-06 13:59:28 +03:00
|
|
|
|
2013-01-29 00:19:21 +04:00
|
|
|
ancestor can accept 0 or more arguments
|
|
|
|
|
|
|
|
$ log 'ancestor()'
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'ancestor(1)'
|
2013-01-29 00:19:21 +04:00
|
|
|
1
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'ancestor(4,5)'
|
|
|
|
1
|
|
|
|
$ log 'ancestor(4,5) and 4'
|
2013-01-29 00:19:21 +04:00
|
|
|
$ log 'ancestor(0,0,1,3)'
|
|
|
|
0
|
|
|
|
$ log 'ancestor(3,1,5,3,5,1)'
|
|
|
|
1
|
|
|
|
$ log 'ancestor(0,1,3,5)'
|
|
|
|
0
|
|
|
|
$ log 'ancestor(1,2,3,4,5)'
|
|
|
|
1
|
2014-03-27 02:55:50 +04:00
|
|
|
|
|
|
|
test ancestors
|
|
|
|
|
2017-06-17 18:22:41 +03:00
|
|
|
$ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
|
|
|
|
@ 9
|
|
|
|
o 8
|
|
|
|
| o 7
|
|
|
|
| o 6
|
|
|
|
|/|
|
|
|
|
| o 5
|
|
|
|
o | 4
|
|
|
|
| o 3
|
|
|
|
o | 2
|
|
|
|
|/
|
|
|
|
o 1
|
|
|
|
o 0
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'ancestors(5)'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
2013-01-29 00:19:21 +04:00
|
|
|
$ log 'ancestor(ancestors(5))'
|
|
|
|
0
|
2014-03-27 02:55:50 +04:00
|
|
|
$ log '::r3232()'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
|
2017-06-17 18:22:41 +03:00
|
|
|
test ancestors with depth limit
|
|
|
|
|
|
|
|
(depth=0 selects the node itself)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(9, depth=0))'
|
|
|
|
9
|
|
|
|
|
|
|
|
(interleaved: '4' would be missing if heap queue were higher depth first)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(8:9, depth=1))'
|
|
|
|
9
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
|
|
|
(interleaved: '2' would be missing if heap queue were higher depth first)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(7+8, depth=2))'
|
|
|
|
8
|
|
|
|
7
|
|
|
|
6
|
|
|
|
5
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
|
|
|
(walk example above by separate queries)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(8, depth=2)) + reverse(ancestors(7, depth=2))'
|
|
|
|
8
|
|
|
|
4
|
|
|
|
2
|
|
|
|
7
|
|
|
|
6
|
|
|
|
5
|
|
|
|
|
2017-06-17 18:40:58 +03:00
|
|
|
(walk 2nd and 3rd ancestors)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(7, depth=3, startdepth=2))'
|
|
|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
|
|
|
(interleaved: '4' would be missing if higher-depth ancestors weren't scanned)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(7+8, depth=2, startdepth=2))'
|
|
|
|
5
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
|
|
|
(note that 'ancestors(x, depth=y, startdepth=z)' does not identical to
|
|
|
|
'ancestors(x, depth=y) - ancestors(x, depth=z-1)' because a node may have
|
|
|
|
multiple depths)
|
|
|
|
|
|
|
|
$ log 'reverse(ancestors(7+8, depth=2) - ancestors(7+8, depth=1))'
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
2017-06-17 18:22:41 +03:00
|
|
|
test bad arguments passed to ancestors()
|
|
|
|
|
|
|
|
$ log 'ancestors(., depth=-1)'
|
|
|
|
hg: parse error: negative depth
|
|
|
|
[255]
|
|
|
|
$ log 'ancestors(., depth=foo)'
|
|
|
|
hg: parse error: ancestors expects an integer depth
|
|
|
|
[255]
|
|
|
|
|
2017-06-20 16:11:23 +03:00
|
|
|
test descendants
|
|
|
|
|
|
|
|
$ hg log -G -T '{rev}\n' --config experimental.graphshorten=True
|
|
|
|
@ 9
|
|
|
|
o 8
|
|
|
|
| o 7
|
|
|
|
| o 6
|
|
|
|
|/|
|
|
|
|
| o 5
|
|
|
|
o | 4
|
|
|
|
| o 3
|
|
|
|
o | 2
|
|
|
|
|/
|
|
|
|
o 1
|
|
|
|
o 0
|
|
|
|
|
|
|
|
(null is ultimate root and has optimized path)
|
|
|
|
|
|
|
|
$ log 'null:4 & descendants(null)'
|
|
|
|
-1
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
|
|
|
|
(including merge)
|
|
|
|
|
|
|
|
$ log ':8 & descendants(2)'
|
|
|
|
2
|
|
|
|
4
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
|
|
|
|
(multiple roots)
|
|
|
|
|
|
|
|
$ log ':8 & descendants(2+5)'
|
|
|
|
2
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
|
revset: add depth limit to descendants() (issue5374)
This is naive implementation using two-pass scanning. Tracking descendants
isn't an easy problem if both start and stop depths are specified. It's
impractical to remember all possible depths of each node while scanning from
roots to descendants because the number of depths explodes. Instead, we could
cache (min, max) depths as a good approximation and track ancestors back when
needed, but that's likely to have off-by-one bug.
Since this implementation appears not significantly slower, and is quite
straightforward, I think it's good enough for practical use cases. The time
and space complexity is O(n) ish.
revisions:
0) 1-pass scanning with (min, max)-depth cache (worst-case quadratic)
1) 2-pass scanning (this version)
repository:
mozilla-central
# descendants(0) (for reference)
*) 0.430353
# descendants(0, depth=1000)
0) 0.264889
1) 0.398289
# descendants(limit(tip:0, 1, offset=10000), depth=1000)
0) 0.025478
1) 0.029099
# descendants(0, depth=2000, startdepth=1000)
0) painfully slow (due to quadratic backtracking of ancestors)
1) 1.531138
2017-06-24 17:05:57 +03:00
|
|
|
test descendants with depth limit
|
|
|
|
|
|
|
|
(depth=0 selects the node itself)
|
|
|
|
|
|
|
|
$ log 'descendants(0, depth=0)'
|
|
|
|
0
|
|
|
|
$ log 'null: & descendants(null, depth=0)'
|
|
|
|
-1
|
|
|
|
|
|
|
|
(p2 = null should be ignored)
|
|
|
|
|
|
|
|
$ log 'null: & descendants(null, depth=2)'
|
|
|
|
-1
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
|
|
|
(multiple paths: depth(6) = (2, 3))
|
|
|
|
|
|
|
|
$ log 'descendants(1+3, depth=2)'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
|
|
|
(multiple paths: depth(5) = (1, 2), depth(6) = (2, 3))
|
|
|
|
|
|
|
|
$ log 'descendants(3+1, depth=2, startdepth=2)'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
|
|
|
(multiple depths: depth(6) = (0, 2, 4), search for depth=2)
|
|
|
|
|
|
|
|
$ log 'descendants(0+3+6, depth=3, startdepth=1)'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
|
|
|
|
(multiple depths: depth(6) = (0, 4), no match)
|
|
|
|
|
|
|
|
$ log 'descendants(0+6, depth=3, startdepth=1)'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
7
|
|
|
|
|
2017-06-17 18:22:41 +03:00
|
|
|
test author
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'author(bob)'
|
|
|
|
2
|
2012-05-31 02:13:58 +04:00
|
|
|
$ log 'author("re:bob|test")'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
2017-01-12 06:42:10 +03:00
|
|
|
$ log 'author(r"re:\S")'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'branch(é)'
|
|
|
|
8
|
|
|
|
9
|
2012-05-31 02:13:33 +04:00
|
|
|
$ log 'branch(a)'
|
|
|
|
0
|
|
|
|
$ hg log -r 'branch("re:a")' --template '{rev} {branch}\n'
|
|
|
|
0 a
|
|
|
|
2 a-b-c-
|
|
|
|
3 +a+b+c+
|
|
|
|
4 -a-b-c-
|
test-revset: enable for Windows
In MSYS, the test fails like this if the hghave exit at the beginning is
removed:
--- C:\Users\adi\hgrepos\hg-main\tests\test-revset.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-revset.t.err
@@ -58,7 +58,7 @@
$ hg co 3
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch /a/b/c/
- marked working directory as branch /a/b/c/
+ marked working directory as branch a:/b/c/
(branches are permanent and global, did you want a bookmark?)
$ hg ci -Aqm"5 bug"
@@ -252,7 +252,7 @@
2 a-b-c-
3 +a+b+c+
4 -a-b-c-
- 5 /a/b/c/
+ 5 a:/b/c/
6 _a_b_c_
7 .a.b.c.
$ log 'children(ancestor(4,5))'
due to the posix path conversion done by MSYS globally, as explained here
http://www.mingw.org/wiki/Posix_path_conversion
The solution is a bit lame, but it is simple and works: don't use strings that
look like '/a/b', in order not to trigger the path magic done by MSYS.
So, if we can agree not to insist on testing branch names starting with '/',
then this relatively simple patch makes the test pass both on Windows with MSYS
and Linux.
2012-06-03 11:06:15 +04:00
|
|
|
5 !a/b/c/
|
2012-05-31 02:13:33 +04:00
|
|
|
6 _a_b_c_
|
|
|
|
7 .a.b.c.
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'children(ancestor(4,5))'
|
|
|
|
2
|
|
|
|
3
|
2015-05-23 05:04:11 +03:00
|
|
|
|
|
|
|
$ log 'children(4)'
|
|
|
|
6
|
|
|
|
8
|
|
|
|
$ log 'children(null)'
|
|
|
|
0
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'closed()'
|
|
|
|
$ log 'contains(a)'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
2014-01-17 18:42:12 +04:00
|
|
|
$ log 'contains("../repo/a")'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
2011-06-17 00:47:34 +04:00
|
|
|
$ log 'desc(B)'
|
|
|
|
5
|
2017-01-08 05:26:32 +03:00
|
|
|
$ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n"
|
|
|
|
5 5 bug
|
|
|
|
6 6 issue619
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'descendants(2 or 3)'
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
2012-04-11 13:32:00 +04:00
|
|
|
$ log 'file("b*")'
|
2010-08-30 08:23:32 +04:00
|
|
|
1
|
|
|
|
4
|
2014-01-17 18:55:03 +04:00
|
|
|
$ log 'filelog("b")'
|
|
|
|
1
|
|
|
|
4
|
|
|
|
$ log 'filelog("../repo/b")'
|
|
|
|
1
|
|
|
|
4
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'follow()'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
4
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'grep("issue\d+")'
|
|
|
|
6
|
2010-09-20 17:42:58 +04:00
|
|
|
$ try 'grep("(")' # invalid regular expression
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'grep')
|
|
|
|
('string', '('))
|
2010-09-20 17:42:58 +04:00
|
|
|
hg: parse error: invalid match pattern: unbalanced parenthesis
|
|
|
|
[255]
|
2010-09-25 00:36:53 +04:00
|
|
|
$ try 'grep("\bissue\d+")'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'grep')
|
|
|
|
('string', '\x08issue\\d+'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-13 14:05:57 +03:00
|
|
|
<grep '\x08issue\\d+'>>
|
2010-09-25 00:36:53 +04:00
|
|
|
$ try 'grep(r"\bissue\d+")'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'grep')
|
|
|
|
('string', '\\bissue\\d+'))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-13 14:05:57 +03:00
|
|
|
<grep '\\bissue\\d+'>>
|
2010-09-25 00:36:53 +04:00
|
|
|
6
|
|
|
|
$ try 'grep(r"\")'
|
|
|
|
hg: parse error at 7: unterminated string
|
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'head()'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
9
|
|
|
|
$ log 'heads(6::)'
|
|
|
|
7
|
|
|
|
$ log 'keyword(issue)'
|
|
|
|
6
|
2013-08-06 00:52:06 +04:00
|
|
|
$ log 'keyword("test a")'
|
2017-06-10 12:04:56 +03:00
|
|
|
|
|
|
|
Test first (=limit) and last
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'limit(head(), 1)'
|
|
|
|
0
|
2015-03-23 18:28:28 +03:00
|
|
|
$ log 'limit(author("re:bob|test"), 3, 5)'
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ log 'limit(author("re:bob|test"), offset=6)'
|
|
|
|
6
|
|
|
|
$ log 'limit(author("re:bob|test"), offset=10)'
|
|
|
|
$ log 'limit(all(), 1, -1)'
|
|
|
|
hg: parse error: negative offset
|
|
|
|
[255]
|
2017-06-10 12:35:11 +03:00
|
|
|
$ log 'limit(all(), -1)'
|
|
|
|
hg: parse error: negative number to select
|
|
|
|
[255]
|
|
|
|
$ log 'limit(all(), 0)'
|
2017-06-10 12:04:56 +03:00
|
|
|
|
2017-06-10 12:35:11 +03:00
|
|
|
$ log 'last(all(), -1)'
|
|
|
|
hg: parse error: negative number to select
|
|
|
|
[255]
|
2017-06-10 12:04:56 +03:00
|
|
|
$ log 'last(all(), 0)'
|
|
|
|
$ log 'last(all(), 1)'
|
|
|
|
9
|
|
|
|
$ log 'last(all(), 2)'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
2015-03-23 18:14:53 +03:00
|
|
|
Test smartset.slice() by first/last()
|
|
|
|
|
|
|
|
(using unoptimized set, filteredset as example)
|
|
|
|
|
|
|
|
$ hg debugrevspec --no-show-revs -s '0:7 & branch("re:")'
|
|
|
|
* set:
|
|
|
|
<filteredset
|
|
|
|
<spanset+ 0:8>,
|
|
|
|
<branch 're:'>>
|
|
|
|
$ log 'limit(0:7 & branch("re:"), 3, 4)'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log 'limit(7:0 & branch("re:"), 3, 4)'
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
$ log 'last(0:7 & branch("re:"), 2)'
|
|
|
|
6
|
|
|
|
7
|
|
|
|
|
2015-04-09 17:56:06 +03:00
|
|
|
(using baseset)
|
|
|
|
|
|
|
|
$ hg debugrevspec --no-show-revs -s 0+1+2+3+4+5+6+7
|
|
|
|
* set:
|
|
|
|
<baseset [0, 1, 2, 3, 4, 5, 6, 7]>
|
|
|
|
$ hg debugrevspec --no-show-revs -s 0::7
|
|
|
|
* set:
|
|
|
|
<baseset+ [0, 1, 2, 3, 4, 5, 6, 7]>
|
|
|
|
$ log 'limit(0+1+2+3+4+5+6+7, 3, 4)'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log 'limit(sort(0::7, rev), 3, 4)'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log 'limit(sort(0::7, -rev), 3, 4)'
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
$ log 'last(sort(0::7, rev), 2)'
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 6)'
|
|
|
|
* set:
|
|
|
|
<baseset+ [6, 7]>
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 9)'
|
|
|
|
* set:
|
|
|
|
<baseset+ []>
|
|
|
|
$ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 6)'
|
|
|
|
* set:
|
|
|
|
<baseset- [0, 1]>
|
|
|
|
1
|
|
|
|
0
|
|
|
|
$ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 9)'
|
|
|
|
* set:
|
|
|
|
<baseset- []>
|
|
|
|
$ hg debugrevspec -s 'limit(0::7, 0)'
|
|
|
|
* set:
|
|
|
|
<baseset+ []>
|
|
|
|
|
2015-04-09 18:14:16 +03:00
|
|
|
(using spanset)
|
|
|
|
|
|
|
|
$ hg debugrevspec --no-show-revs -s 0:7
|
|
|
|
* set:
|
|
|
|
<spanset+ 0:8>
|
|
|
|
$ log 'limit(0:7, 3, 4)'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log 'limit(7:0, 3, 4)'
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
$ log 'limit(0:7, 3, 6)'
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ log 'limit(7:0, 3, 6)'
|
|
|
|
1
|
|
|
|
0
|
|
|
|
$ log 'last(0:7, 2)'
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ hg debugrevspec -s 'limit(0:7, 3, 6)'
|
|
|
|
* set:
|
|
|
|
<spanset+ 6:8>
|
|
|
|
6
|
|
|
|
7
|
|
|
|
$ hg debugrevspec -s 'limit(0:7, 3, 9)'
|
|
|
|
* set:
|
|
|
|
<spanset+ 8:8>
|
|
|
|
$ hg debugrevspec -s 'limit(7:0, 3, 6)'
|
|
|
|
* set:
|
|
|
|
<spanset- 0:2>
|
|
|
|
1
|
|
|
|
0
|
|
|
|
$ hg debugrevspec -s 'limit(7:0, 3, 9)'
|
|
|
|
* set:
|
|
|
|
<spanset- 0:0>
|
|
|
|
$ hg debugrevspec -s 'limit(0:7, 0)'
|
|
|
|
* set:
|
|
|
|
<spanset+ 0:0>
|
|
|
|
|
2017-06-10 13:41:42 +03:00
|
|
|
Test order of first/last revisions
|
|
|
|
|
|
|
|
$ hg debugrevspec -s 'first(4:0, 3) & 3:'
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2015-04-09 18:14:16 +03:00
|
|
|
<spanset- 2:5>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 3:10>>
|
2017-06-10 13:41:42 +03:00
|
|
|
4
|
|
|
|
3
|
|
|
|
|
|
|
|
$ hg debugrevspec -s '3: & first(4:0, 3)'
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 3:10>,
|
2015-04-09 18:14:16 +03:00
|
|
|
<spanset- 2:5>>
|
2017-06-10 13:41:42 +03:00
|
|
|
3
|
2017-06-10 13:48:48 +03:00
|
|
|
4
|
2017-06-10 13:41:42 +03:00
|
|
|
|
|
|
|
$ hg debugrevspec -s 'last(4:0, 3) & :1'
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2015-04-09 18:14:16 +03:00
|
|
|
<spanset- 0:3>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>>
|
2017-06-10 13:41:42 +03:00
|
|
|
1
|
|
|
|
0
|
|
|
|
|
|
|
|
$ hg debugrevspec -s ':1 & last(4:0, 3)'
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>,
|
2015-04-09 18:14:16 +03:00
|
|
|
<spanset+ 0:3>>
|
2017-06-10 13:41:42 +03:00
|
|
|
0
|
2017-06-10 13:48:48 +03:00
|
|
|
1
|
2017-06-10 13:41:42 +03:00
|
|
|
|
2017-06-27 17:50:22 +03:00
|
|
|
Test scmutil.revsingle() should return the last revision
|
|
|
|
|
|
|
|
$ hg debugrevspec -s 'last(0::)'
|
|
|
|
* set:
|
|
|
|
<baseset slice=0:1
|
|
|
|
<generatorset->>
|
|
|
|
9
|
|
|
|
$ hg identify -r '0::' --num
|
|
|
|
9
|
|
|
|
|
2017-06-10 12:04:56 +03:00
|
|
|
Test matching
|
|
|
|
|
2012-04-15 02:27:31 +04:00
|
|
|
$ log 'matching(6)'
|
|
|
|
6
|
|
|
|
$ log 'matching(6:7, "phase parents user date branch summary files description substate")'
|
|
|
|
6
|
|
|
|
7
|
2014-03-29 04:00:13 +04:00
|
|
|
|
|
|
|
Testing min and max
|
|
|
|
|
|
|
|
max: simple
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'max(contains(a))'
|
|
|
|
5
|
2014-03-29 04:00:13 +04:00
|
|
|
|
|
|
|
max: simple on unordered set)
|
|
|
|
|
|
|
|
$ log 'max((4+0+2+5+7) and contains(a))'
|
|
|
|
5
|
|
|
|
|
|
|
|
max: no result
|
|
|
|
|
|
|
|
$ log 'max(contains(stringthatdoesnotappearanywhere))'
|
|
|
|
|
|
|
|
max: no result on unordered set
|
|
|
|
|
|
|
|
$ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
|
|
|
|
|
|
|
|
min: simple
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'min(contains(a))'
|
|
|
|
0
|
2014-03-29 04:00:13 +04:00
|
|
|
|
|
|
|
min: simple on unordered set
|
|
|
|
|
|
|
|
$ log 'min((4+0+2+5+7) and contains(a))'
|
|
|
|
0
|
|
|
|
|
|
|
|
min: empty
|
|
|
|
|
|
|
|
$ log 'min(contains(stringthatdoesnotappearanywhere))'
|
|
|
|
|
|
|
|
min: empty on unordered set
|
|
|
|
|
|
|
|
$ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
|
|
|
|
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'merge()'
|
|
|
|
6
|
2012-08-13 23:50:45 +04:00
|
|
|
$ log 'branchpoint()'
|
|
|
|
1
|
|
|
|
4
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'modifies(b)'
|
|
|
|
4
|
2012-04-26 16:24:46 +04:00
|
|
|
$ log 'modifies("path:b")'
|
|
|
|
4
|
|
|
|
$ log 'modifies("*")'
|
|
|
|
4
|
|
|
|
6
|
|
|
|
$ log 'modifies("set:modified()")'
|
|
|
|
4
|
2010-10-11 18:44:19 +04:00
|
|
|
$ log 'id(5)'
|
|
|
|
2
|
2013-11-16 20:57:08 +04:00
|
|
|
$ log 'only(9)'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'only(8)'
|
|
|
|
8
|
|
|
|
$ log 'only(9, 5)'
|
|
|
|
2
|
|
|
|
4
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'only(7 + 9, 5 + 2)'
|
|
|
|
4
|
|
|
|
6
|
|
|
|
7
|
2014-07-19 03:46:56 +04:00
|
|
|
8
|
|
|
|
9
|
|
|
|
|
|
|
|
Test empty set input
|
|
|
|
$ log 'only(p2())'
|
|
|
|
$ log 'only(p1(), p2())'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
4
|
2013-11-16 20:57:08 +04:00
|
|
|
8
|
|
|
|
9
|
2014-10-19 11:48:33 +04:00
|
|
|
|
2014-11-07 01:55:18 +03:00
|
|
|
Test '%' operator
|
|
|
|
|
|
|
|
$ log '9%'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log '9%5'
|
|
|
|
2
|
|
|
|
4
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log '(7 + 9)%(5 + 2)'
|
|
|
|
4
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
2016-10-18 00:16:55 +03:00
|
|
|
Test operand of '%' is optimized recursively (issue4670)
|
2015-05-15 16:32:31 +03:00
|
|
|
|
|
|
|
$ try --optimize '8:9-8%'
|
|
|
|
(onlypost
|
|
|
|
(minus
|
|
|
|
(range
|
|
|
|
('symbol', '8')
|
|
|
|
('symbol', '9'))
|
|
|
|
('symbol', '8')))
|
|
|
|
* optimized:
|
|
|
|
(func
|
|
|
|
('symbol', 'only')
|
2016-02-24 21:41:15 +03:00
|
|
|
(difference
|
2015-05-15 16:32:31 +03:00
|
|
|
(range
|
|
|
|
('symbol', '8')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '9')
|
|
|
|
define)
|
|
|
|
('symbol', '8')
|
|
|
|
define)
|
|
|
|
define)
|
2015-05-15 16:32:31 +03:00
|
|
|
* set:
|
|
|
|
<baseset+ [8, 9]>
|
|
|
|
8
|
|
|
|
9
|
2015-05-15 16:38:24 +03:00
|
|
|
$ try --optimize '(9)%(5)'
|
|
|
|
(only
|
|
|
|
(group
|
|
|
|
('symbol', '9'))
|
|
|
|
(group
|
|
|
|
('symbol', '5')))
|
|
|
|
* optimized:
|
|
|
|
(func
|
|
|
|
('symbol', 'only')
|
|
|
|
(list
|
|
|
|
('symbol', '9')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '5'))
|
|
|
|
define)
|
2015-05-15 16:38:24 +03:00
|
|
|
* set:
|
2016-04-05 03:45:15 +03:00
|
|
|
<baseset+ [2, 4, 8, 9]>
|
2015-05-15 16:38:24 +03:00
|
|
|
2
|
|
|
|
4
|
|
|
|
8
|
|
|
|
9
|
2015-05-15 16:32:31 +03:00
|
|
|
|
2014-11-07 01:55:18 +03:00
|
|
|
Test the order of operations
|
|
|
|
|
|
|
|
$ log '7 + 9%5 + 2'
|
|
|
|
7
|
|
|
|
2
|
|
|
|
4
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
2014-10-19 11:48:33 +04:00
|
|
|
Test explicit numeric revision
|
2015-01-10 06:56:38 +03:00
|
|
|
$ log 'rev(-2)'
|
2014-10-19 11:48:33 +04:00
|
|
|
$ log 'rev(-1)'
|
2015-01-10 06:56:38 +03:00
|
|
|
-1
|
2014-10-19 11:48:33 +04:00
|
|
|
$ log 'rev(0)'
|
|
|
|
0
|
|
|
|
$ log 'rev(9)'
|
|
|
|
9
|
|
|
|
$ log 'rev(10)'
|
|
|
|
$ log 'rev(tip)'
|
|
|
|
hg: parse error: rev expects a number
|
|
|
|
[255]
|
|
|
|
|
2015-04-20 10:52:20 +03:00
|
|
|
Test hexadecimal revision
|
|
|
|
$ log 'id(2)'
|
|
|
|
abort: 00changelog.i@2: ambiguous identifier!
|
|
|
|
[255]
|
|
|
|
$ log 'id(23268)'
|
|
|
|
4
|
|
|
|
$ log 'id(2785f51eece)'
|
|
|
|
0
|
|
|
|
$ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
|
|
|
|
8
|
|
|
|
$ log 'id(d5d0dcbdc4a)'
|
|
|
|
$ log 'id(d5d0dcbdc4w)'
|
|
|
|
$ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
|
|
|
|
$ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
|
|
|
|
$ log 'id(1.0)'
|
|
|
|
$ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
|
|
|
|
|
2015-01-25 14:20:27 +03:00
|
|
|
Test null revision
|
2015-01-08 17:05:45 +03:00
|
|
|
$ log '(null)'
|
|
|
|
-1
|
|
|
|
$ log '(null:0)'
|
|
|
|
-1
|
|
|
|
0
|
|
|
|
$ log '(0:null)'
|
|
|
|
0
|
|
|
|
-1
|
|
|
|
$ log 'null::0'
|
|
|
|
-1
|
|
|
|
0
|
|
|
|
$ log 'null:tip - 0:'
|
|
|
|
-1
|
|
|
|
$ log 'null: and null::' | head -1
|
|
|
|
-1
|
|
|
|
$ log 'null: or 0:' | head -2
|
|
|
|
-1
|
|
|
|
0
|
2015-01-25 14:20:27 +03:00
|
|
|
$ log 'ancestors(null)'
|
|
|
|
-1
|
2015-01-08 17:05:45 +03:00
|
|
|
$ log 'reverse(null:)' | tail -2
|
|
|
|
0
|
|
|
|
-1
|
|
|
|
$ log 'first(null:)'
|
2017-06-10 13:41:42 +03:00
|
|
|
-1
|
2015-01-08 17:05:45 +03:00
|
|
|
$ log 'min(null:)'
|
2017-06-10 13:41:42 +03:00
|
|
|
BROKEN: should be '-1'
|
2015-01-10 08:49:50 +03:00
|
|
|
$ log 'tip:null and all()' | tail -2
|
|
|
|
1
|
|
|
|
0
|
2015-01-25 14:20:27 +03:00
|
|
|
|
2014-08-16 08:44:16 +04:00
|
|
|
Test working-directory revision
|
|
|
|
$ hg debugrevspec 'wdir()'
|
2015-03-16 10:17:06 +03:00
|
|
|
2147483647
|
2017-05-19 17:36:45 +03:00
|
|
|
$ hg debugrevspec 'wdir()^'
|
|
|
|
9
|
|
|
|
$ hg up 7
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg debugrevspec 'wdir()^'
|
|
|
|
7
|
2017-05-21 23:05:53 +03:00
|
|
|
$ hg debugrevspec 'wdir()^0'
|
|
|
|
2147483647
|
2017-05-22 22:38:19 +03:00
|
|
|
$ hg debugrevspec 'wdir()~3'
|
|
|
|
5
|
2017-05-22 22:52:33 +03:00
|
|
|
$ hg debugrevspec 'ancestors(wdir())'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
2147483647
|
2017-05-21 23:05:53 +03:00
|
|
|
$ hg debugrevspec 'wdir()~0'
|
|
|
|
2147483647
|
|
|
|
$ hg debugrevspec 'p1(wdir())'
|
|
|
|
7
|
2017-05-21 23:44:22 +03:00
|
|
|
$ hg debugrevspec 'p2(wdir())'
|
2017-05-21 23:05:53 +03:00
|
|
|
$ hg debugrevspec 'parents(wdir())'
|
|
|
|
7
|
2017-05-21 22:31:45 +03:00
|
|
|
$ hg debugrevspec 'wdir()^1'
|
|
|
|
7
|
|
|
|
$ hg debugrevspec 'wdir()^2'
|
|
|
|
$ hg debugrevspec 'wdir()^3'
|
|
|
|
hg: parse error: ^ expects a number 0, 1, or 2
|
|
|
|
[255]
|
2017-05-19 17:36:45 +03:00
|
|
|
For tests consistency
|
|
|
|
$ hg up 9
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2014-08-16 08:44:16 +04:00
|
|
|
$ hg debugrevspec 'tip or wdir()'
|
|
|
|
9
|
2015-03-16 10:17:06 +03:00
|
|
|
2147483647
|
2014-08-16 08:44:16 +04:00
|
|
|
$ hg debugrevspec '0:tip and wdir()'
|
2015-06-28 10:08:07 +03:00
|
|
|
$ log '0:wdir()' | tail -3
|
|
|
|
8
|
|
|
|
9
|
|
|
|
2147483647
|
|
|
|
$ log 'wdir():0' | head -3
|
|
|
|
2147483647
|
|
|
|
9
|
|
|
|
8
|
|
|
|
$ log 'wdir():wdir()'
|
|
|
|
2147483647
|
2015-03-16 10:17:06 +03:00
|
|
|
$ log '(all() + wdir()) & min(. + wdir())'
|
|
|
|
9
|
|
|
|
$ log '(all() + wdir()) & max(. + wdir())'
|
|
|
|
2147483647
|
2017-06-10 13:41:42 +03:00
|
|
|
$ log 'first(wdir() + .)'
|
2015-03-16 10:17:06 +03:00
|
|
|
2147483647
|
2017-06-10 13:41:42 +03:00
|
|
|
$ log 'last(. + wdir())'
|
2015-03-16 10:17:06 +03:00
|
|
|
2147483647
|
2014-08-16 08:44:16 +04:00
|
|
|
|
2017-06-03 14:39:33 +03:00
|
|
|
Test working-directory integer revision and node id
|
|
|
|
(BUG: '0:wdir()' is still needed to populate wdir revision)
|
|
|
|
|
|
|
|
$ hg debugrevspec '0:wdir() & 2147483647'
|
|
|
|
2147483647
|
|
|
|
$ hg debugrevspec '0:wdir() & rev(2147483647)'
|
|
|
|
2147483647
|
|
|
|
$ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff'
|
|
|
|
2147483647
|
2016-08-19 12:26:04 +03:00
|
|
|
$ hg debugrevspec '0:wdir() & ffffffffffff'
|
|
|
|
2147483647
|
2017-06-03 14:39:33 +03:00
|
|
|
$ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)'
|
|
|
|
2147483647
|
|
|
|
$ hg debugrevspec '0:wdir() & id(ffffffffffff)'
|
2016-08-19 12:26:04 +03:00
|
|
|
2147483647
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Test short 'ff...' hash collision
|
|
|
|
(BUG: '0:wdir()' is still needed to populate wdir revision)
|
|
|
|
|
|
|
|
$ hg init wdir-hashcollision
|
|
|
|
$ cd wdir-hashcollision
|
|
|
|
$ cat <<EOF >> .hg/hgrc
|
|
|
|
> [experimental]
|
|
|
|
> evolution = createmarkers
|
|
|
|
> EOF
|
|
|
|
$ echo 0 > a
|
|
|
|
$ hg ci -qAm 0
|
|
|
|
$ for i in 2463 2961 6726 78127; do
|
|
|
|
> hg up -q 0
|
|
|
|
> echo $i > a
|
|
|
|
> hg ci -qm $i
|
|
|
|
> done
|
|
|
|
$ hg up -q null
|
|
|
|
$ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n'
|
|
|
|
0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e
|
|
|
|
1:fffbae3886c8fbb2114296380d276fd37715d571 fffba
|
|
|
|
2:fffb6093b00943f91034b9bdad069402c834e572 fffb6
|
|
|
|
3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4
|
|
|
|
4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8
|
|
|
|
2147483647:ffffffffffffffffffffffffffffffffffffffff fffff
|
|
|
|
$ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571
|
|
|
|
|
|
|
|
$ hg debugrevspec '0:wdir() & fff'
|
|
|
|
abort: 00changelog.i@fff: ambiguous identifier!
|
|
|
|
[255]
|
|
|
|
$ hg debugrevspec '0:wdir() & ffff'
|
|
|
|
abort: 00changelog.i@ffff: ambiguous identifier!
|
|
|
|
[255]
|
|
|
|
$ hg debugrevspec '0:wdir() & fffb'
|
|
|
|
abort: 00changelog.i@fffb: ambiguous identifier!
|
|
|
|
[255]
|
|
|
|
BROKEN should be '2' (node lookup uses unfiltered repo since dc25ed84bee8)
|
|
|
|
$ hg debugrevspec '0:wdir() & id(fffb)'
|
|
|
|
2
|
|
|
|
$ hg debugrevspec '0:wdir() & ffff8'
|
|
|
|
4
|
|
|
|
$ hg debugrevspec '0:wdir() & fffff'
|
|
|
|
2147483647
|
|
|
|
|
|
|
|
$ cd ..
|
2017-06-03 14:39:33 +03:00
|
|
|
|
2016-08-20 12:15:19 +03:00
|
|
|
Test branch() with wdir()
|
|
|
|
|
2016-08-19 12:26:04 +03:00
|
|
|
$ cd repo
|
|
|
|
|
2016-08-20 12:15:19 +03:00
|
|
|
$ log '0:wdir() & branch("literal:é")'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
2147483647
|
|
|
|
$ log '0:wdir() & branch("re:é")'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
2147483647
|
|
|
|
$ log '0:wdir() & branch("re:^a")'
|
|
|
|
0
|
|
|
|
2
|
|
|
|
$ log '0:wdir() & branch(8)'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
2147483647
|
|
|
|
|
|
|
|
branch(wdir()) returns all revisions belonging to the working branch. The wdir
|
|
|
|
itself isn't returned unless it is explicitly populated.
|
|
|
|
|
|
|
|
$ log 'branch(wdir())'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log '0:wdir() & branch(wdir())'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
2147483647
|
|
|
|
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'outgoing()'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'outgoing("../remote1")'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'outgoing("../remote2")'
|
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
9
|
|
|
|
$ log 'p1(merge())'
|
|
|
|
5
|
|
|
|
$ log 'p2(merge())'
|
|
|
|
4
|
|
|
|
$ log 'parents(merge())'
|
|
|
|
4
|
|
|
|
5
|
2012-08-13 23:50:45 +04:00
|
|
|
$ log 'p1(branchpoint())'
|
|
|
|
0
|
|
|
|
2
|
|
|
|
$ log 'p2(branchpoint())'
|
|
|
|
$ log 'parents(branchpoint())'
|
|
|
|
0
|
|
|
|
2
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'removes(a)'
|
|
|
|
2
|
|
|
|
6
|
|
|
|
$ log 'roots(all())'
|
|
|
|
0
|
|
|
|
$ log 'reverse(2 or 3 or 4 or 5)'
|
|
|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
2012-07-04 20:38:07 +04:00
|
|
|
$ log 'reverse(all())'
|
|
|
|
9
|
|
|
|
8
|
|
|
|
7
|
|
|
|
6
|
|
|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
0
|
2015-01-10 15:31:59 +03:00
|
|
|
$ log 'reverse(all()) & filelog(b)'
|
|
|
|
4
|
|
|
|
1
|
2010-10-11 18:44:19 +04:00
|
|
|
$ log 'rev(5)'
|
|
|
|
5
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'sort(limit(reverse(all()), 3))'
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
$ log 'sort(2 or 3 or 4 or 5, date)'
|
|
|
|
2
|
|
|
|
3
|
|
|
|
5
|
|
|
|
4
|
|
|
|
$ log 'tagged()'
|
|
|
|
6
|
2010-10-10 21:41:36 +04:00
|
|
|
$ log 'tag()'
|
|
|
|
6
|
|
|
|
$ log 'tag(1.0)'
|
|
|
|
6
|
|
|
|
$ log 'tag(tip)'
|
|
|
|
9
|
2012-05-31 02:13:33 +04:00
|
|
|
|
2016-05-03 06:36:44 +03:00
|
|
|
Test order of revisions in compound expression
|
|
|
|
----------------------------------------------
|
|
|
|
|
2016-06-22 16:02:25 +03:00
|
|
|
The general rule is that only the outermost (= leftmost) predicate can
|
|
|
|
enforce its ordering requirement. The other predicates should take the
|
|
|
|
ordering defined by it.
|
|
|
|
|
2016-05-03 06:36:44 +03:00
|
|
|
'A & B' should follow the order of 'A':
|
|
|
|
|
|
|
|
$ log '2:0 & 0::2'
|
|
|
|
2
|
|
|
|
1
|
|
|
|
0
|
|
|
|
|
2016-06-23 22:37:09 +03:00
|
|
|
'head()' combines sets in right order:
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
$ log '2:0 & head()'
|
|
|
|
2
|
2016-06-23 22:37:09 +03:00
|
|
|
1
|
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
|
2016-05-03 06:52:50 +03:00
|
|
|
'x:y' takes ordering parameter into account:
|
|
|
|
|
|
|
|
$ try -p optimized '3:0 & 0:3 & not 2:1'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '3')
|
|
|
|
('symbol', '0')
|
|
|
|
define)
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '3')
|
|
|
|
follow)
|
|
|
|
define)
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '1')
|
|
|
|
any)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<filteredset
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:4>,
|
|
|
|
<spanset+ 0:4>>,
|
2016-05-03 06:52:50 +03:00
|
|
|
<not
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 1:3>>>
|
2016-05-03 06:52:50 +03:00
|
|
|
3
|
|
|
|
0
|
|
|
|
|
2016-06-22 16:02:25 +03:00
|
|
|
'a + b', which is optimized to '_list(a b)', should take the ordering of
|
|
|
|
the left expression:
|
|
|
|
|
|
|
|
$ try --optimize '2:0 & (0 + 1 + 2)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001\x002')
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
2016-06-26 12:41:28 +03:00
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:41:28 +03:00
|
|
|
<baseset [0, 1, 2]>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
2016-06-26 12:41:28 +03:00
|
|
|
1
|
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
'A + B' should take the ordering of the left expression:
|
|
|
|
|
|
|
|
$ try --optimize '2:0 & (0:1 + 2)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
2016-05-14 14:51:57 +03:00
|
|
|
('symbol', '2')
|
2016-08-07 11:04:05 +03:00
|
|
|
(range
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1')
|
2016-05-14 14:51:57 +03:00
|
|
|
follow))
|
2016-08-07 11:46:12 +03:00
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
2016-06-26 12:17:12 +03:00
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:17:12 +03:00
|
|
|
<addset
|
2016-05-14 14:51:57 +03:00
|
|
|
<baseset [2]>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
2016-06-26 12:17:12 +03:00
|
|
|
1
|
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
'_intlist(a b)' should behave like 'a + b':
|
|
|
|
|
|
|
|
$ trylist --optimize '2:0 & %ld' 0 1 2
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(func
|
|
|
|
('symbol', '_intlist')
|
|
|
|
('string', '0\x001\x002')))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_intlist')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001\x002')
|
|
|
|
follow)
|
2016-06-22 16:02:25 +03:00
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:41:28 +03:00
|
|
|
<baseset+ [0, 1, 2]>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
|
|
|
1
|
|
|
|
0
|
|
|
|
|
|
|
|
$ trylist --optimize '%ld & 2:0' 0 2 1
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_intlist')
|
|
|
|
('string', '0\x002\x001'))
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0')))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_intlist')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x002\x001')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-05-03 06:52:50 +03:00
|
|
|
<baseset [0, 2, 1]>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>>
|
2016-05-03 06:52:50 +03:00
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
|
|
|
1
|
|
|
|
|
|
|
|
'_hexlist(a b)' should behave like 'a + b':
|
|
|
|
|
|
|
|
$ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2`
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(func
|
|
|
|
('symbol', '_hexlist')
|
|
|
|
('string', '*'))) (glob)
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', '_hexlist')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '*') (glob)
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
2016-06-26 12:41:28 +03:00
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:41:28 +03:00
|
|
|
<baseset [0, 1, 2]>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
2016-06-26 12:41:28 +03:00
|
|
|
1
|
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
$ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1`
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_hexlist')
|
|
|
|
('string', '*')) (glob)
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0')))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
follow)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', '_hexlist')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '*') (glob)
|
|
|
|
define)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<baseset [0, 2, 1]>
|
|
|
|
0
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2016-06-26 12:41:28 +03:00
|
|
|
'_list' should not go through the slow follow-order path if order doesn't
|
|
|
|
matter:
|
|
|
|
|
|
|
|
$ try -p optimized '2:0 & not (0 + 1)'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0')
|
|
|
|
define)
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
|
|
|
('string', '0\x001')
|
|
|
|
any)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:41:28 +03:00
|
|
|
<not
|
|
|
|
<baseset [0, 1]>>>
|
|
|
|
2
|
|
|
|
|
|
|
|
$ try -p optimized '2:0 & not (0:2 & (0 + 1))'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0')
|
|
|
|
define)
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
any)
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
|
|
|
('string', '0\x001')
|
|
|
|
any)
|
|
|
|
any)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-26 12:41:28 +03:00
|
|
|
<not
|
|
|
|
<baseset [0, 1]>>>
|
|
|
|
2
|
|
|
|
|
2016-06-01 14:54:04 +03:00
|
|
|
because 'present()' does nothing other than suppressing an error, the
|
|
|
|
ordering requirement should be forwarded to the nested expression
|
|
|
|
|
|
|
|
$ try -p optimized 'present(2 + 0 + 1)'
|
|
|
|
* optimized:
|
|
|
|
(func
|
|
|
|
('symbol', 'present')
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
|
|
|
('string', '2\x000\x001')
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<baseset [2, 0, 1]>
|
|
|
|
2
|
|
|
|
0
|
|
|
|
1
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
$ try --optimize '2:0 & present(0 + 1 + 2)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(func
|
|
|
|
('symbol', 'present')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'present')
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001\x002')
|
2016-06-01 14:54:04 +03:00
|
|
|
follow)
|
2016-08-07 11:46:12 +03:00
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
2016-06-01 14:54:04 +03:00
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-01 14:54:04 +03:00
|
|
|
<baseset [0, 1, 2]>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
2016-06-01 14:54:04 +03:00
|
|
|
1
|
|
|
|
0
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
'reverse()' should take effect only if it is the outermost expression:
|
|
|
|
|
|
|
|
$ try --optimize '0:2 & reverse(all())'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2'))
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'all')
|
|
|
|
None)))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '2')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'all')
|
2016-08-07 11:46:12 +03:00
|
|
|
None
|
|
|
|
define)
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>,
|
|
|
|
<spanset+ 0:10>>
|
2016-06-22 16:02:25 +03:00
|
|
|
0
|
2016-05-03 07:36:12 +03:00
|
|
|
1
|
|
|
|
2
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
'sort()' should take effect only if it is the outermost expression:
|
|
|
|
|
|
|
|
$ try --optimize '0:2 & sort(all(), -rev)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2'))
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'all')
|
|
|
|
None)
|
|
|
|
(negate
|
|
|
|
('symbol', 'rev')))))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '2')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'all')
|
2016-08-07 11:46:12 +03:00
|
|
|
None
|
|
|
|
define)
|
|
|
|
('string', '-rev'))
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>,
|
|
|
|
<spanset+ 0:10>>
|
2016-06-22 16:02:25 +03:00
|
|
|
0
|
2016-05-03 07:36:12 +03:00
|
|
|
1
|
|
|
|
2
|
|
|
|
|
|
|
|
invalid argument passed to noop sort():
|
|
|
|
|
|
|
|
$ log '0:2 & sort()'
|
|
|
|
hg: parse error: sort requires one or two arguments
|
|
|
|
[255]
|
|
|
|
$ log '0:2 & sort(all(), -invalid)'
|
|
|
|
hg: parse error: unknown sort key '-invalid'
|
|
|
|
[255]
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
for 'A & f(B)', 'B' should not be affected by the order of 'A':
|
|
|
|
|
|
|
|
$ try --optimize '2:0 & first(1 + 0 + 2)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(func
|
|
|
|
('symbol', 'first')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'first')
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '1\x000\x002')
|
|
|
|
define)
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
2017-06-10 13:41:42 +03:00
|
|
|
<filteredset
|
2015-04-09 17:56:06 +03:00
|
|
|
<baseset [1]>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>>
|
2016-06-22 16:02:25 +03:00
|
|
|
1
|
|
|
|
|
|
|
|
$ try --optimize '2:0 & not last(0 + 2 + 1)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(not
|
|
|
|
(func
|
|
|
|
('symbol', 'last')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '1'))))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'last')
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x002\x001')
|
|
|
|
define)
|
|
|
|
any)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-06-22 16:02:25 +03:00
|
|
|
<not
|
2015-04-09 17:56:06 +03:00
|
|
|
<baseset [1]>>>
|
2016-06-22 16:02:25 +03:00
|
|
|
2
|
|
|
|
0
|
|
|
|
|
|
|
|
for 'A & (op)(B)', 'B' should not be affected by the order of 'A':
|
|
|
|
|
|
|
|
$ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)'
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0'))
|
|
|
|
(range
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2'))))
|
2016-06-22 16:02:25 +03:00
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '1'))))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '0')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(range
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '1\x000\x002')
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x002\x001')
|
|
|
|
define)
|
|
|
|
follow)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-05-03 06:52:50 +03:00
|
|
|
<baseset [1]>>
|
2016-06-22 16:02:25 +03:00
|
|
|
1
|
|
|
|
|
2016-06-26 12:41:28 +03:00
|
|
|
'A & B' can be rewritten as 'B & A' by weight, but that's fine as long as
|
|
|
|
the ordering rule is determined before the rewrite; in this example,
|
|
|
|
'B' follows the order of the initial set, which is the same order as 'A'
|
|
|
|
since 'A' also follows the order:
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
$ try --optimize 'contains("glob:*") & (2 + 0 + 1)'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
|
|
|
('string', 'glob:*'))
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '2\x000\x001')
|
|
|
|
follow)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', 'glob:*')
|
|
|
|
define)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-06-26 12:41:28 +03:00
|
|
|
<baseset+ [0, 1, 2]>,
|
2016-06-22 16:02:25 +03:00
|
|
|
<contains 'glob:*'>>
|
|
|
|
0
|
|
|
|
1
|
2016-06-26 12:41:28 +03:00
|
|
|
2
|
|
|
|
|
|
|
|
and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides
|
|
|
|
the order appropriately:
|
2016-06-22 16:02:25 +03:00
|
|
|
|
|
|
|
$ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
|
|
|
('string', 'glob:*')))
|
|
|
|
(group
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '1')))))
|
2016-06-22 16:02:25 +03:00
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x002\x001')
|
|
|
|
follow)
|
2016-06-22 16:02:25 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', 'glob:*')
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
define)
|
2016-06-22 16:02:25 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2016-06-26 12:41:28 +03:00
|
|
|
<baseset- [0, 1, 2]>,
|
2016-06-22 16:02:25 +03:00
|
|
|
<contains 'glob:*'>>
|
|
|
|
2
|
2016-06-26 12:41:28 +03:00
|
|
|
1
|
2016-06-22 16:02:25 +03:00
|
|
|
0
|
|
|
|
|
2016-05-14 14:51:57 +03:00
|
|
|
'A + B' can be rewritten to 'B + A' by weight only when the order doesn't
|
|
|
|
matter (e.g. 'X & (A + B)' can be 'X & (B + A)', but '(A + B) & X' can't):
|
|
|
|
|
|
|
|
$ try -p optimized '0:2 & (reverse(contains("a")) + 2)'
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
define)
|
|
|
|
(or
|
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
|
|
|
('string', 'a')
|
|
|
|
define)
|
|
|
|
follow))
|
|
|
|
follow)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:3>,
|
2016-05-14 14:51:57 +03:00
|
|
|
<addset
|
|
|
|
<baseset [2]>,
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-05-14 14:51:57 +03:00
|
|
|
<contains 'a'>>>>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
|
|
|
$ try -p optimized '(reverse(contains("a")) + 2) & 0:2'
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '2')
|
|
|
|
follow)
|
|
|
|
(or
|
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'contains')
|
|
|
|
('string', 'a')
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
('symbol', '2'))
|
|
|
|
define)
|
|
|
|
define)
|
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset- 0:3>,
|
2016-05-14 14:51:57 +03:00
|
|
|
<contains 'a'>>,
|
|
|
|
<baseset [2]>>
|
|
|
|
1
|
|
|
|
0
|
|
|
|
2
|
|
|
|
|
2014-03-14 04:20:03 +04:00
|
|
|
test sort revset
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
test when adding two unordered revsets
|
|
|
|
|
|
|
|
$ log 'sort(keyword(issue) or modifies(b))'
|
|
|
|
4
|
|
|
|
6
|
|
|
|
|
|
|
|
test when sorting a reversed collection in the same way it is
|
|
|
|
|
|
|
|
$ log 'sort(reverse(all()), -rev)'
|
|
|
|
9
|
|
|
|
8
|
|
|
|
7
|
|
|
|
6
|
|
|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
0
|
|
|
|
|
|
|
|
test when sorting a reversed collection
|
|
|
|
|
|
|
|
$ log 'sort(reverse(all()), rev)'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
|
|
|
|
|
|
|
test sorting two sorted collections in different orders
|
|
|
|
|
|
|
|
$ log 'sort(outgoing() or reverse(removes(a)), rev)'
|
|
|
|
2
|
|
|
|
6
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
|
|
|
test sorting two sorted collections in different orders backwards
|
|
|
|
|
|
|
|
$ log 'sort(outgoing() or reverse(removes(a)), -rev)'
|
|
|
|
9
|
|
|
|
8
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
2016-06-15 14:37:24 +03:00
|
|
|
test empty sort key which is noop
|
|
|
|
|
|
|
|
$ log 'sort(0 + 2 + 1, "")'
|
|
|
|
0
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2016-05-14 13:46:18 +03:00
|
|
|
test invalid sort keys
|
|
|
|
|
|
|
|
$ log 'sort(all(), -invalid)'
|
|
|
|
hg: parse error: unknown sort key '-invalid'
|
|
|
|
[255]
|
|
|
|
|
revset: make sort() do dumb multi-pass sorting for multiple keys (issue5218)
Our invert() function was too clever to not take length into account. I could
fix the problem by appending '\xff' as a terminator (opposite to '\0'), but
it turned out to be slower than simple multi-pass sorting.
New implementation is pretty straightforward, which just calls sort() from the
last key. We can do that since Python sort() is guaranteed to be stable. It
doesn't sound nice to call sort() multiple times, but actually it is faster.
That's probably because we have fewer Python codes in hot loop, and can avoid
heavy string and list manipulation.
revset #0: sort(0:10000, 'branch')
0) 0.412753
1) 0.393254
revset #1: sort(0:10000, '-branch')
0) 0.455377
1) 0.389191 85%
revset #2: sort(0:10000, 'date')
0) 0.408082
1) 0.376332 92%
revset #3: sort(0:10000, '-date')
0) 0.406910
1) 0.380498 93%
revset #4: sort(0:10000, 'desc branch user date rev')
0) 0.542996
1) 0.486397 89%
revset #5: sort(0:10000, '-desc -branch -user -date -rev')
0) 0.965032
1) 0.518426 53%
2016-04-23 10:09:30 +03:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
test sorting by multiple keys including variable-length strings
|
|
|
|
|
|
|
|
$ hg init sorting
|
|
|
|
$ cd sorting
|
|
|
|
$ cat <<EOF >> .hg/hgrc
|
|
|
|
> [ui]
|
|
|
|
> logtemplate = '{rev} {branch|p5}{desc|p5}{author|p5}{date|hgdate}\n'
|
|
|
|
> [templatealias]
|
|
|
|
> p5(s) = pad(s, 5)
|
|
|
|
> EOF
|
|
|
|
$ hg branch -qf b12
|
|
|
|
$ hg ci -m m111 -u u112 -d '111 10800'
|
|
|
|
$ hg branch -qf b11
|
|
|
|
$ hg ci -m m12 -u u111 -d '112 7200'
|
|
|
|
$ hg branch -qf b111
|
|
|
|
$ hg ci -m m11 -u u12 -d '111 3600'
|
|
|
|
$ hg branch -qf b112
|
|
|
|
$ hg ci -m m111 -u u11 -d '120 0'
|
|
|
|
$ hg branch -qf b111
|
|
|
|
$ hg ci -m m112 -u u111 -d '110 14400'
|
|
|
|
created new head
|
|
|
|
|
|
|
|
compare revisions (has fast path):
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), rev)'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -rev)'
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
compare variable-length strings (issue5218):
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), branch)'
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -branch)'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), desc)'
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -desc)'
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), user)'
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -user)'
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
|
|
|
|
compare dates (tz offset should have no effect):
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), date)'
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -date)'
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
|
|
|
|
be aware that 'sort(x, -k)' is not exactly the same as 'reverse(sort(x, k))'
|
|
|
|
because '-k' reverses the comparison, not the list itself:
|
|
|
|
|
|
|
|
$ hg log -r 'sort(0 + 2, date)'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
|
|
|
$ hg log -r 'sort(0 + 2, -date)'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
|
|
|
$ hg log -r 'reverse(sort(0 + 2, date))'
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
sort by multiple keys:
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), "branch -rev")'
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), "-desc -date")'
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), "user -branch date rev")'
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
|
2016-06-13 20:20:00 +03:00
|
|
|
toposort prioritises graph branches
|
|
|
|
|
|
|
|
$ hg up 2
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ touch a
|
|
|
|
$ hg addremove
|
|
|
|
adding a
|
|
|
|
$ hg ci -m 't1' -u 'tu' -d '130 0'
|
|
|
|
created new head
|
|
|
|
$ echo 'a' >> a
|
|
|
|
$ hg ci -m 't2' -u 'tu' -d '130 0'
|
|
|
|
$ hg book book1
|
|
|
|
$ hg up 4
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
(leaving bookmark book1)
|
|
|
|
$ touch a
|
|
|
|
$ hg addremove
|
|
|
|
adding a
|
|
|
|
$ hg ci -m 't3' -u 'tu' -d '130 0'
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), topo)'
|
|
|
|
7 b111 t3 tu 130 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
6 b111 t2 tu 130 0
|
|
|
|
5 b111 t1 tu 130 0
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), -topo)'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
5 b111 t1 tu 130 0
|
|
|
|
6 b111 t2 tu 130 0
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
7 b111 t3 tu 130 0
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), topo, topo.firstbranch=book1)'
|
|
|
|
6 b111 t2 tu 130 0
|
|
|
|
5 b111 t1 tu 130 0
|
|
|
|
7 b111 t3 tu 130 0
|
|
|
|
4 b111 m112 u111 110 14400
|
|
|
|
3 b112 m111 u11 120 0
|
|
|
|
2 b111 m11 u12 111 3600
|
|
|
|
1 b11 m12 u111 112 7200
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
|
|
|
topographical sorting can't be combined with other sort keys, and you can't
|
|
|
|
use the topo.firstbranch option when topo sort is not active:
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), "topo user")'
|
|
|
|
hg: parse error: topo sort order cannot be combined with other sort keys
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ hg log -r 'sort(all(), user, topo.firstbranch=book1)'
|
|
|
|
hg: parse error: topo.firstbranch can only be used when using the topo sort key
|
|
|
|
[255]
|
|
|
|
|
2016-08-07 08:58:49 +03:00
|
|
|
topo.firstbranch should accept any kind of expressions:
|
|
|
|
|
|
|
|
$ hg log -r 'sort(0, topo, topo.firstbranch=(book1))'
|
|
|
|
0 b12 m111 u112 111 10800
|
|
|
|
|
revset: make sort() do dumb multi-pass sorting for multiple keys (issue5218)
Our invert() function was too clever to not take length into account. I could
fix the problem by appending '\xff' as a terminator (opposite to '\0'), but
it turned out to be slower than simple multi-pass sorting.
New implementation is pretty straightforward, which just calls sort() from the
last key. We can do that since Python sort() is guaranteed to be stable. It
doesn't sound nice to call sort() multiple times, but actually it is faster.
That's probably because we have fewer Python codes in hot loop, and can avoid
heavy string and list manipulation.
revset #0: sort(0:10000, 'branch')
0) 0.412753
1) 0.393254
revset #1: sort(0:10000, '-branch')
0) 0.455377
1) 0.389191 85%
revset #2: sort(0:10000, 'date')
0) 0.408082
1) 0.376332 92%
revset #3: sort(0:10000, '-date')
0) 0.406910
1) 0.380498 93%
revset #4: sort(0:10000, 'desc branch user date rev')
0) 0.542996
1) 0.486397 89%
revset #5: sort(0:10000, '-desc -branch -user -date -rev')
0) 0.965032
1) 0.518426 53%
2016-04-23 10:09:30 +03:00
|
|
|
$ cd ..
|
|
|
|
$ cd repo
|
|
|
|
|
2014-04-13 21:01:00 +04:00
|
|
|
test subtracting something from an addset
|
2014-03-12 04:25:53 +04:00
|
|
|
|
|
|
|
$ log '(outgoing() or removes(a)) - removes(a)'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
|
|
|
|
test intersecting something with an addset
|
|
|
|
|
|
|
|
$ log 'parents(outgoing() or removes(a))'
|
|
|
|
1
|
|
|
|
4
|
|
|
|
5
|
2014-09-17 15:55:55 +04:00
|
|
|
8
|
2014-03-12 04:25:53 +04:00
|
|
|
|
2014-10-09 15:24:51 +04:00
|
|
|
test that `or` operation combines elements in the right order:
|
|
|
|
|
|
|
|
$ log '3:4 or 2:5'
|
|
|
|
3
|
|
|
|
4
|
|
|
|
2
|
|
|
|
5
|
|
|
|
$ log '3:4 or 5:2'
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
2
|
|
|
|
$ log 'sort(3:4 or 2:5)'
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
$ log 'sort(3:4 or 5:2)'
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
2015-05-24 11:53:22 +03:00
|
|
|
test that more than one `-r`s are combined in the right order and deduplicated:
|
|
|
|
|
|
|
|
$ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)'
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
2
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
2015-03-30 13:51:40 +03:00
|
|
|
test that `or` operation skips duplicated revisions from right-hand side
|
|
|
|
|
|
|
|
$ try 'reverse(1::5) or ancestors(4)'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(dagrange
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '5')))
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '4'))))
|
2015-03-30 13:51:40 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
2015-08-21 03:23:21 +03:00
|
|
|
<baseset- [1, 3, 5]>,
|
2015-03-30 14:56:37 +03:00
|
|
|
<generatorset+>>
|
2015-03-30 13:51:40 +03:00
|
|
|
5
|
|
|
|
3
|
|
|
|
1
|
|
|
|
0
|
|
|
|
2
|
|
|
|
4
|
|
|
|
$ try 'sort(ancestors(4) or reverse(1::5))'
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '4'))
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(dagrange
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '5'))))))
|
2015-03-30 13:51:40 +03:00
|
|
|
* set:
|
|
|
|
<addset+
|
|
|
|
<generatorset+>,
|
2015-08-21 03:23:21 +03:00
|
|
|
<baseset- [1, 3, 5]>>
|
2015-03-30 13:51:40 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
2015-05-17 09:11:38 +03:00
|
|
|
test optimization of trivial `or` operation
|
|
|
|
|
|
|
|
$ try --optimize '0|(1)|"2"|-2|tip|null'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
(group
|
|
|
|
('symbol', '1'))
|
|
|
|
('string', '2')
|
|
|
|
(negate
|
|
|
|
('symbol', '2'))
|
|
|
|
('symbol', 'tip')
|
|
|
|
('symbol', 'null')))
|
2015-05-17 09:11:38 +03:00
|
|
|
* optimized:
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001\x002\x00-2\x00tip\x00null')
|
|
|
|
define)
|
2015-05-17 09:11:38 +03:00
|
|
|
* set:
|
|
|
|
<baseset [0, 1, 2, 8, 9, -1]>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
8
|
|
|
|
9
|
|
|
|
-1
|
|
|
|
|
|
|
|
$ try --optimize '0|1|2:3'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))))
|
2015-05-17 09:11:38 +03:00
|
|
|
* optimized:
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '0\x001')
|
|
|
|
define)
|
2016-08-07 11:04:05 +03:00
|
|
|
(range
|
|
|
|
('symbol', '2')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '3')
|
|
|
|
define))
|
|
|
|
define)
|
2015-05-17 09:11:38 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset [0, 1]>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 2:4>>
|
2015-05-17 09:11:38 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
|
|
|
|
$ try --optimize '0:1|2|3:4|5|6'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
('symbol', '2')
|
|
|
|
(range
|
|
|
|
('symbol', '3')
|
|
|
|
('symbol', '4'))
|
|
|
|
('symbol', '5')
|
|
|
|
('symbol', '6')))
|
2015-05-17 09:11:38 +03:00
|
|
|
* optimized:
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1')
|
|
|
|
define)
|
2016-08-07 11:04:05 +03:00
|
|
|
('symbol', '2')
|
|
|
|
(range
|
|
|
|
('symbol', '3')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '4')
|
|
|
|
define)
|
2016-08-07 11:04:05 +03:00
|
|
|
(func
|
|
|
|
('symbol', '_list')
|
2016-08-07 11:46:12 +03:00
|
|
|
('string', '5\x006')
|
|
|
|
define))
|
|
|
|
define)
|
2015-05-17 09:11:38 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>,
|
2015-05-17 09:11:38 +03:00
|
|
|
<baseset [2]>>,
|
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 3:5>,
|
2015-05-17 09:11:38 +03:00
|
|
|
<baseset [5, 6]>>>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
2016-08-21 06:40:02 +03:00
|
|
|
unoptimized `or` looks like this
|
|
|
|
|
|
|
|
$ try --no-optimized -p analyzed '0|1|2|3|4'
|
|
|
|
* analyzed:
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '4'))
|
|
|
|
define)
|
2016-08-21 06:40:02 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<addset
|
|
|
|
<baseset [0]>,
|
|
|
|
<baseset [1]>>,
|
|
|
|
<addset
|
|
|
|
<baseset [2]>,
|
|
|
|
<addset
|
|
|
|
<baseset [3]>,
|
|
|
|
<baseset [4]>>>>
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
|
2015-05-17 09:11:38 +03:00
|
|
|
test that `_list` should be narrowed by provided `subset`
|
|
|
|
|
|
|
|
$ log '0:2 and (null|1|2|3)'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
|
|
|
test that `_list` should remove duplicates
|
|
|
|
|
|
|
|
$ log '0|1|2|1|2|-1|tip'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
9
|
|
|
|
|
|
|
|
test unknown revision in `_list`
|
|
|
|
|
|
|
|
$ log '0|unknown'
|
|
|
|
abort: unknown revision 'unknown'!
|
|
|
|
[255]
|
|
|
|
|
2015-05-17 09:16:13 +03:00
|
|
|
test integer range in `_list`
|
|
|
|
|
|
|
|
$ log '-1|-10'
|
|
|
|
9
|
|
|
|
0
|
|
|
|
|
|
|
|
$ log '-10|-11'
|
|
|
|
abort: unknown revision '-11'!
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ log '9|10'
|
|
|
|
abort: unknown revision '10'!
|
|
|
|
[255]
|
|
|
|
|
|
|
|
test '0000' != '0' in `_list`
|
|
|
|
|
|
|
|
$ log '0|0000'
|
|
|
|
0
|
|
|
|
-1
|
|
|
|
|
2015-12-23 20:54:03 +03:00
|
|
|
test ',' in `_list`
|
|
|
|
$ log '0,1'
|
|
|
|
hg: parse error: can't use a list in this context
|
|
|
|
(see hg help "revsets.x or y")
|
|
|
|
[255]
|
2016-02-02 17:49:49 +03:00
|
|
|
$ try '0,1,2'
|
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
hg: parse error: can't use a list in this context
|
|
|
|
(see hg help "revsets.x or y")
|
|
|
|
[255]
|
2015-12-23 20:54:03 +03:00
|
|
|
|
2015-04-26 12:13:48 +03:00
|
|
|
test that chained `or` operations make balanced addsets
|
|
|
|
|
|
|
|
$ try '0:1|1:2|2:3|3:4|4:5'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
(range
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))
|
|
|
|
(range
|
|
|
|
('symbol', '3')
|
|
|
|
('symbol', '4'))
|
|
|
|
(range
|
|
|
|
('symbol', '4')
|
|
|
|
('symbol', '5'))))
|
2015-04-26 12:13:48 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>,
|
|
|
|
<spanset+ 1:3>>,
|
2015-04-26 12:13:48 +03:00
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 2:4>,
|
2015-04-26 12:13:48 +03:00
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 3:5>,
|
|
|
|
<spanset+ 4:6>>>>
|
2015-04-26 12:13:48 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
2015-08-09 10:09:41 +03:00
|
|
|
no crash by empty group "()" while optimizing `or` operations
|
|
|
|
|
|
|
|
$ try --optimize '0|()'
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
|
|
|
(group
|
|
|
|
None)))
|
2015-08-09 10:09:41 +03:00
|
|
|
* optimized:
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '0')
|
2016-08-07 11:46:12 +03:00
|
|
|
None)
|
|
|
|
define)
|
2015-08-09 10:09:41 +03:00
|
|
|
hg: parse error: missing argument
|
|
|
|
[255]
|
|
|
|
|
2015-04-26 12:13:48 +03:00
|
|
|
test that chained `or` operations never eat up stack (issue4624)
|
|
|
|
(uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
|
|
|
|
|
2017-06-21 00:31:18 +03:00
|
|
|
$ hg log -T '{rev}\n' -r `$PYTHON -c "print '+'.join(['0:1'] * 500)"`
|
2015-04-26 12:13:48 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
|
revrange: build balanced tree of addsets from revisions (issue4565)
This reduces the stack depth from O(n) to O(log(n)). Therefore, repeated
-rREV options will never exceed the Python stack limit.
Currently it depends on private revset._combinesets() function. But at some
point, we'll be able to drop the old-style parser, and revrange() can be
completely rewritten without using _combinesets():
trees = [parse(s) for s in revs]
optimize(('or',) + trees) # combine trees and optimize at once
...
Blockers that prevent eliminating old-style parser:
- nullary ":" operator
- revrange(repo, [intrev, ...]), can be mapped to 'rev(%d)' ?
- revrange(repo, [binnode, ...]), should be banned ?
2015-05-24 12:11:33 +03:00
|
|
|
test that repeated `-r` options never eat up stack (issue4565)
|
|
|
|
(uses `-r 0::1` to avoid possible optimization at old-style parser)
|
|
|
|
|
2017-06-21 00:31:18 +03:00
|
|
|
$ hg log -T '{rev}\n' `$PYTHON -c "for i in xrange(500): print '-r 0::1 ',"`
|
revrange: build balanced tree of addsets from revisions (issue4565)
This reduces the stack depth from O(n) to O(log(n)). Therefore, repeated
-rREV options will never exceed the Python stack limit.
Currently it depends on private revset._combinesets() function. But at some
point, we'll be able to drop the old-style parser, and revrange() can be
completely rewritten without using _combinesets():
trees = [parse(s) for s in revs]
optimize(('or',) + trees) # combine trees and optimize at once
...
Blockers that prevent eliminating old-style parser:
- nullary ":" operator
- revrange(repo, [intrev, ...]), can be mapped to 'rev(%d)' ?
- revrange(repo, [binnode, ...]), should be banned ?
2015-05-24 12:11:33 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
|
2014-07-12 11:31:36 +04:00
|
|
|
check that conversion to only works
|
2014-02-14 02:04:47 +04:00
|
|
|
$ try --optimize '::3 - ::1'
|
|
|
|
(minus
|
|
|
|
(dagrangepre
|
|
|
|
('symbol', '3'))
|
|
|
|
(dagrangepre
|
|
|
|
('symbol', '1')))
|
|
|
|
* optimized:
|
|
|
|
(func
|
2014-07-12 11:31:36 +04:00
|
|
|
('symbol', 'only')
|
2014-02-14 02:04:47 +04:00
|
|
|
(list
|
|
|
|
('symbol', '3')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1'))
|
|
|
|
define)
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset+ [3]>
|
2014-02-14 02:04:47 +04:00
|
|
|
3
|
|
|
|
$ try --optimize 'ancestors(1) - ancestors(3)'
|
|
|
|
(minus
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '1'))
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '3')))
|
|
|
|
* optimized:
|
|
|
|
(func
|
2014-07-12 11:31:36 +04:00
|
|
|
('symbol', 'only')
|
2014-02-14 02:04:47 +04:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '3'))
|
|
|
|
define)
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset+ []>
|
2014-02-14 02:04:47 +04:00
|
|
|
$ try --optimize 'not ::2 and ::6'
|
|
|
|
(and
|
|
|
|
(not
|
|
|
|
(dagrangepre
|
|
|
|
('symbol', '2')))
|
|
|
|
(dagrangepre
|
|
|
|
('symbol', '6')))
|
|
|
|
* optimized:
|
|
|
|
(func
|
2014-07-12 11:31:36 +04:00
|
|
|
('symbol', 'only')
|
2014-02-14 02:04:47 +04:00
|
|
|
(list
|
|
|
|
('symbol', '6')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '2'))
|
|
|
|
define)
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset+ [3, 4, 5, 6]>
|
2014-02-14 02:04:47 +04:00
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ try --optimize 'ancestors(6) and not ancestors(4)'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '6'))
|
|
|
|
(not
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '4'))))
|
|
|
|
* optimized:
|
|
|
|
(func
|
2014-07-12 11:31:36 +04:00
|
|
|
('symbol', 'only')
|
2014-02-14 02:04:47 +04:00
|
|
|
(list
|
|
|
|
('symbol', '6')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '4'))
|
|
|
|
define)
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset+ [3, 5, 6]>
|
2014-02-14 02:04:47 +04:00
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
2015-08-09 10:06:36 +03:00
|
|
|
no crash by empty group "()" while optimizing to "only()"
|
|
|
|
|
|
|
|
$ try --optimize '::1 and ()'
|
|
|
|
(and
|
|
|
|
(dagrangepre
|
|
|
|
('symbol', '1'))
|
|
|
|
(group
|
|
|
|
None))
|
|
|
|
* optimized:
|
|
|
|
(and
|
|
|
|
None
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
2016-08-07 11:46:12 +03:00
|
|
|
('symbol', '1')
|
|
|
|
define)
|
|
|
|
define)
|
2015-08-09 10:06:36 +03:00
|
|
|
hg: parse error: missing argument
|
|
|
|
[255]
|
|
|
|
|
2017-06-18 05:57:28 +03:00
|
|
|
optimization to only() works only if ancestors() takes only one argument
|
|
|
|
|
|
|
|
$ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '6')
|
|
|
|
define)
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
(list
|
|
|
|
('symbol', '4')
|
|
|
|
('symbol', '1'))
|
|
|
|
any)
|
|
|
|
define)
|
2017-06-17 18:22:41 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
2017-06-18 05:57:28 +03:00
|
|
|
$ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
(list
|
|
|
|
('symbol', '6')
|
|
|
|
('symbol', '1'))
|
|
|
|
define)
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
('symbol', '4')
|
|
|
|
any)
|
|
|
|
define)
|
2017-06-17 18:22:41 +03:00
|
|
|
5
|
|
|
|
6
|
2017-06-18 05:57:28 +03:00
|
|
|
|
|
|
|
optimization disabled if keyword arguments passed (because we're too lazy
|
|
|
|
to support it)
|
|
|
|
|
|
|
|
$ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)'
|
|
|
|
* optimized:
|
|
|
|
(difference
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
(keyvalue
|
|
|
|
('symbol', 'set')
|
|
|
|
('symbol', '6'))
|
|
|
|
define)
|
|
|
|
(func
|
|
|
|
('symbol', 'ancestors')
|
|
|
|
(keyvalue
|
|
|
|
('symbol', 'set')
|
|
|
|
('symbol', '4'))
|
|
|
|
any)
|
|
|
|
define)
|
2017-06-18 06:06:22 +03:00
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
2017-06-18 05:57:28 +03:00
|
|
|
|
2016-06-27 14:44:14 +03:00
|
|
|
invalid function call should not be optimized to only()
|
|
|
|
|
|
|
|
$ log '"ancestors"(6) and not ancestors(4)'
|
|
|
|
hg: parse error: not a symbol
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ log 'ancestors(6) and not "ancestors"(4)'
|
|
|
|
hg: parse error: not a symbol
|
|
|
|
[255]
|
|
|
|
|
2012-05-31 02:13:33 +04:00
|
|
|
we can use patterns when searching for tags
|
|
|
|
|
|
|
|
$ log 'tag("1..*")'
|
revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.
This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".
This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.
This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:
predicate "literal:" "re:"
---------- ----------- ------------
bookmark abort abort
named abort abort
tag abort continue (*1)
branch abort continue (*2)
---------- ----------- ------------
"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).
On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.
This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-30 19:00:50 +03:00
|
|
|
abort: tag '1..*' does not exist!
|
2012-05-31 02:13:33 +04:00
|
|
|
[255]
|
|
|
|
$ log 'tag("re:1..*")'
|
|
|
|
6
|
|
|
|
$ log 'tag("re:[0-9].[0-9]")'
|
|
|
|
6
|
|
|
|
$ log 'tag("literal:1.0")'
|
|
|
|
6
|
|
|
|
$ log 'tag("re:0..*")'
|
|
|
|
|
2011-04-10 12:30:53 +04:00
|
|
|
$ log 'tag(unknown)'
|
revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.
This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".
This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.
This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:
predicate "literal:" "re:"
---------- ----------- ------------
bookmark abort abort
named abort abort
tag abort continue (*1)
branch abort continue (*2)
---------- ----------- ------------
"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).
On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.
This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-30 19:00:50 +03:00
|
|
|
abort: tag 'unknown' does not exist!
|
2011-04-10 12:30:53 +04:00
|
|
|
[255]
|
revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.
This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".
This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.
This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:
predicate "literal:" "re:"
---------- ----------- ------------
bookmark abort abort
named abort abort
tag abort continue (*1)
branch abort continue (*2)
---------- ----------- ------------
"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).
On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.
This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-30 19:00:50 +03:00
|
|
|
$ log 'tag("re:unknown")'
|
|
|
|
$ log 'present(tag("unknown"))'
|
|
|
|
$ log 'present(tag("re:unknown"))'
|
2011-04-10 12:30:53 +04:00
|
|
|
$ log 'branch(unknown)'
|
|
|
|
abort: unknown revision 'unknown'!
|
|
|
|
[255]
|
2015-10-07 17:00:29 +03:00
|
|
|
$ log 'branch("literal:unknown")'
|
|
|
|
abort: branch 'unknown' does not exist!
|
|
|
|
[255]
|
revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.
This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".
This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.
This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:
predicate "literal:" "re:"
---------- ----------- ------------
bookmark abort abort
named abort abort
tag abort continue (*1)
branch abort continue (*2)
---------- ----------- ------------
"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).
On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.
This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-30 19:00:50 +03:00
|
|
|
$ log 'branch("re:unknown")'
|
|
|
|
$ log 'present(branch("unknown"))'
|
|
|
|
$ log 'present(branch("re:unknown"))'
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'user(bob)'
|
|
|
|
2
|
|
|
|
|
|
|
|
$ log '4::8'
|
|
|
|
4
|
|
|
|
8
|
|
|
|
$ log '4:8'
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
|
|
|
|
$ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
|
|
|
|
4
|
|
|
|
2
|
|
|
|
5
|
|
|
|
|
|
|
|
$ log 'not 0 and 0:2'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
$ log 'not 1 and 0:2'
|
|
|
|
0
|
|
|
|
2
|
|
|
|
$ log 'not 2 and 0:2'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
$ log '(1 and 2)::'
|
|
|
|
$ log '(1 and 2):'
|
|
|
|
$ log '(1 and 2):3'
|
|
|
|
$ log 'sort(head(), -rev)'
|
|
|
|
9
|
|
|
|
7
|
|
|
|
6
|
|
|
|
5
|
|
|
|
4
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
0
|
2010-10-07 20:45:17 +04:00
|
|
|
$ log '4::8 - 8'
|
|
|
|
4
|
2016-06-03 15:49:26 +03:00
|
|
|
|
|
|
|
matching() should preserve the order of the input set:
|
|
|
|
|
|
|
|
$ log '(2 or 3 or 1) and matching(1 or 2 or 3)'
|
2012-05-09 20:45:14 +04:00
|
|
|
2
|
|
|
|
3
|
|
|
|
1
|
2010-10-15 10:30:38 +04:00
|
|
|
|
revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.
This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".
This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.
This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:
predicate "literal:" "re:"
---------- ----------- ------------
bookmark abort abort
named abort abort
tag abort continue (*1)
branch abort continue (*2)
---------- ----------- ------------
"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).
On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.
This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-30 19:00:50 +03:00
|
|
|
$ log 'named("unknown")'
|
|
|
|
abort: namespace 'unknown' does not exist!
|
|
|
|
[255]
|
|
|
|
$ log 'named("re:unknown")'
|
|
|
|
abort: no namespace exists that match 'unknown'!
|
|
|
|
[255]
|
|
|
|
$ log 'present(named("unknown"))'
|
|
|
|
$ log 'present(named("re:unknown"))'
|
|
|
|
|
2015-02-03 15:56:29 +03:00
|
|
|
$ log 'tag()'
|
|
|
|
6
|
|
|
|
$ log 'named("tags")'
|
|
|
|
6
|
|
|
|
|
2010-10-15 10:30:38 +04:00
|
|
|
issue2437
|
|
|
|
|
|
|
|
$ log '3 and p1(5)'
|
|
|
|
3
|
|
|
|
$ log '4 and p2(6)'
|
|
|
|
4
|
|
|
|
$ log '1 and parents(:2)'
|
|
|
|
1
|
|
|
|
$ log '2 and children(1:)'
|
|
|
|
2
|
|
|
|
$ log 'roots(all()) or roots(all())'
|
|
|
|
0
|
2012-04-08 13:11:30 +04:00
|
|
|
$ hg debugrevspec 'roots(all()) or roots(all())'
|
|
|
|
0
|
2010-10-15 10:30:38 +04:00
|
|
|
$ log 'heads(branch(é)) or heads(branch(é))'
|
|
|
|
9
|
|
|
|
$ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))'
|
|
|
|
4
|
2011-03-17 01:09:14 +03:00
|
|
|
|
|
|
|
issue2654: report a parse error if the revset was not completely parsed
|
|
|
|
|
|
|
|
$ log '1 OR 2'
|
|
|
|
hg: parse error at 2: invalid token
|
|
|
|
[255]
|
|
|
|
|
2011-04-13 21:30:41 +04:00
|
|
|
or operator should preserve ordering:
|
|
|
|
$ log 'reverse(2::4) or tip'
|
|
|
|
4
|
|
|
|
2
|
|
|
|
9
|
2011-04-30 19:43:04 +04:00
|
|
|
|
|
|
|
parentrevspec
|
|
|
|
|
|
|
|
$ log 'merge()^0'
|
|
|
|
6
|
|
|
|
$ log 'merge()^'
|
|
|
|
5
|
|
|
|
$ log 'merge()^1'
|
|
|
|
5
|
|
|
|
$ log 'merge()^2'
|
|
|
|
4
|
2016-10-14 17:33:00 +03:00
|
|
|
$ log '(not merge())^2'
|
2011-04-30 20:53:56 +04:00
|
|
|
$ log 'merge()^^'
|
|
|
|
3
|
|
|
|
$ log 'merge()^1^'
|
|
|
|
3
|
|
|
|
$ log 'merge()^^^'
|
|
|
|
1
|
2011-04-30 19:43:04 +04:00
|
|
|
|
2017-06-18 06:25:23 +03:00
|
|
|
$ hg debugrevspec -s '(merge() | 0)~-1'
|
|
|
|
* set:
|
|
|
|
<baseset+ [1, 7]>
|
2017-05-27 20:25:09 +03:00
|
|
|
1
|
2017-06-18 06:25:23 +03:00
|
|
|
7
|
2017-05-27 20:25:09 +03:00
|
|
|
$ log 'merge()~-1'
|
|
|
|
7
|
|
|
|
$ log 'tip~-1'
|
|
|
|
$ log '(tip | merge())~-1'
|
|
|
|
7
|
2011-04-30 19:43:04 +04:00
|
|
|
$ log 'merge()~0'
|
|
|
|
6
|
|
|
|
$ log 'merge()~1'
|
|
|
|
5
|
|
|
|
$ log 'merge()~2'
|
|
|
|
3
|
2011-04-30 20:53:56 +04:00
|
|
|
$ log 'merge()~2^1'
|
|
|
|
1
|
2011-04-30 19:43:04 +04:00
|
|
|
$ log 'merge()~3'
|
|
|
|
1
|
|
|
|
|
|
|
|
$ log '(-3:tip)^'
|
|
|
|
4
|
|
|
|
6
|
|
|
|
8
|
|
|
|
|
|
|
|
$ log 'tip^foo'
|
|
|
|
hg: parse error: ^ expects a number 0, 1, or 2
|
|
|
|
[255]
|
2011-04-30 20:30:14 +04:00
|
|
|
|
2017-05-27 20:25:09 +03:00
|
|
|
$ log 'branchpoint()~-1'
|
|
|
|
abort: revision in set has more than one child!
|
|
|
|
[255]
|
|
|
|
|
2015-01-26 23:52:46 +03:00
|
|
|
Bogus function gets suggestions
|
|
|
|
$ log 'add()'
|
2015-02-10 23:59:12 +03:00
|
|
|
hg: parse error: unknown identifier: add
|
2016-01-05 08:52:44 +03:00
|
|
|
(did you mean adds?)
|
2015-01-26 23:52:46 +03:00
|
|
|
[255]
|
|
|
|
$ log 'added()'
|
2015-02-10 23:59:12 +03:00
|
|
|
hg: parse error: unknown identifier: added
|
2016-01-05 08:52:44 +03:00
|
|
|
(did you mean adds?)
|
2015-01-26 23:52:46 +03:00
|
|
|
[255]
|
|
|
|
$ log 'remo()'
|
2015-02-10 23:59:12 +03:00
|
|
|
hg: parse error: unknown identifier: remo
|
2015-01-26 23:43:13 +03:00
|
|
|
(did you mean one of remote, removes?)
|
2015-01-26 23:52:46 +03:00
|
|
|
[255]
|
|
|
|
$ log 'babar()'
|
2015-02-10 23:59:12 +03:00
|
|
|
hg: parse error: unknown identifier: babar
|
2015-01-26 23:52:46 +03:00
|
|
|
[255]
|
|
|
|
|
2015-06-20 17:59:56 +03:00
|
|
|
Bogus function with a similar internal name doesn't suggest the internal name
|
|
|
|
$ log 'matches()'
|
|
|
|
hg: parse error: unknown identifier: matches
|
2016-01-05 08:52:44 +03:00
|
|
|
(did you mean matching?)
|
2015-06-20 17:59:56 +03:00
|
|
|
[255]
|
|
|
|
|
|
|
|
Undocumented functions aren't suggested as similar either
|
2017-01-05 16:53:42 +03:00
|
|
|
$ log 'tagged2()'
|
|
|
|
hg: parse error: unknown identifier: tagged2
|
2015-06-20 17:59:56 +03:00
|
|
|
[255]
|
|
|
|
|
2014-03-20 20:55:44 +04:00
|
|
|
multiple revspecs
|
|
|
|
|
|
|
|
$ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n'
|
|
|
|
8
|
|
|
|
9
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
|
2014-03-21 05:44:25 +04:00
|
|
|
test usage in revpair (with "+")
|
|
|
|
|
|
|
|
(real pair)
|
|
|
|
|
|
|
|
$ hg diff -r 'tip^^' -r 'tip'
|
|
|
|
diff -r 2326846efdab -r 24286f4ae135 .hgtags
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
|
|
|
|
$ hg diff -r 'tip^^::tip'
|
|
|
|
diff -r 2326846efdab -r 24286f4ae135 .hgtags
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
|
|
|
|
|
|
|
|
(single rev)
|
|
|
|
|
|
|
|
$ hg diff -r 'tip^' -r 'tip^'
|
2015-08-13 10:15:43 +03:00
|
|
|
$ hg diff -r 'tip^:tip^'
|
2014-03-21 05:44:25 +04:00
|
|
|
|
|
|
|
(single rev that does not looks like a range)
|
|
|
|
|
2015-08-13 10:15:43 +03:00
|
|
|
$ hg diff -r 'tip^::tip^ or tip^'
|
|
|
|
diff -r d5d0dcbdc4d9 .hgtags
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/.hgtags * (glob)
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
|
2014-03-21 05:44:25 +04:00
|
|
|
$ hg diff -r 'tip^ or tip^'
|
|
|
|
diff -r d5d0dcbdc4d9 .hgtags
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/.hgtags * (glob)
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
|
|
|
|
|
|
|
|
(no rev)
|
|
|
|
|
|
|
|
$ hg diff -r 'author("babar") or author("celeste")'
|
|
|
|
abort: empty revision range
|
|
|
|
[255]
|
|
|
|
|
2011-04-30 20:30:14 +04:00
|
|
|
aliases:
|
|
|
|
|
|
|
|
$ echo '[revsetalias]' >> .hg/hgrc
|
|
|
|
$ echo 'm = merge()' >> .hg/hgrc
|
2015-04-30 17:46:54 +03:00
|
|
|
(revset aliases can override builtin revsets)
|
|
|
|
$ echo 'p2($1) = p1($1)' >> .hg/hgrc
|
2012-02-10 00:03:07 +04:00
|
|
|
$ echo 'sincem = descendants(m)' >> .hg/hgrc
|
2011-04-30 20:30:14 +04:00
|
|
|
$ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
|
|
|
|
$ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
|
2011-06-22 03:55:00 +04:00
|
|
|
$ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
|
2011-04-30 20:30:14 +04:00
|
|
|
|
|
|
|
$ try m
|
|
|
|
('symbol', 'm')
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'merge')
|
|
|
|
None)
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-13 14:05:57 +03:00
|
|
|
<merge>>
|
2011-04-30 20:30:14 +04:00
|
|
|
6
|
2012-02-10 00:03:07 +04:00
|
|
|
|
2015-05-01 18:15:03 +03:00
|
|
|
$ HGPLAIN=1
|
|
|
|
$ export HGPLAIN
|
|
|
|
$ try m
|
2015-04-30 17:46:54 +03:00
|
|
|
('symbol', 'm')
|
|
|
|
abort: unknown revision 'm'!
|
|
|
|
[255]
|
|
|
|
|
2015-05-01 18:15:03 +03:00
|
|
|
$ HGPLAINEXCEPT=revsetalias
|
|
|
|
$ export HGPLAINEXCEPT
|
|
|
|
$ try m
|
2015-04-30 17:46:54 +03:00
|
|
|
('symbol', 'm')
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2015-04-30 17:46:54 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'merge')
|
|
|
|
None)
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-13 14:05:57 +03:00
|
|
|
<merge>>
|
2015-04-30 17:46:54 +03:00
|
|
|
6
|
|
|
|
|
|
|
|
$ unset HGPLAIN
|
|
|
|
$ unset HGPLAINEXCEPT
|
|
|
|
|
|
|
|
$ try 'p2(.)'
|
|
|
|
(func
|
|
|
|
('symbol', 'p2')
|
|
|
|
('symbol', '.'))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2015-04-30 17:46:54 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'p1')
|
|
|
|
('symbol', '.'))
|
|
|
|
* set:
|
|
|
|
<baseset+ [8]>
|
|
|
|
8
|
|
|
|
|
2015-05-01 18:15:03 +03:00
|
|
|
$ HGPLAIN=1
|
|
|
|
$ export HGPLAIN
|
|
|
|
$ try 'p2(.)'
|
2015-04-30 17:46:54 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'p2')
|
|
|
|
('symbol', '.'))
|
|
|
|
* set:
|
|
|
|
<baseset+ []>
|
|
|
|
|
2015-05-01 18:15:03 +03:00
|
|
|
$ HGPLAINEXCEPT=revsetalias
|
|
|
|
$ export HGPLAINEXCEPT
|
|
|
|
$ try 'p2(.)'
|
2015-04-30 17:46:54 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'p2')
|
|
|
|
('symbol', '.'))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2015-04-30 17:46:54 +03:00
|
|
|
(func
|
|
|
|
('symbol', 'p1')
|
|
|
|
('symbol', '.'))
|
|
|
|
* set:
|
|
|
|
<baseset+ [8]>
|
|
|
|
8
|
|
|
|
|
|
|
|
$ unset HGPLAIN
|
|
|
|
$ unset HGPLAINEXCEPT
|
|
|
|
|
2012-02-10 00:03:07 +04:00
|
|
|
test alias recursion
|
|
|
|
|
|
|
|
$ try sincem
|
|
|
|
('symbol', 'sincem')
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'descendants')
|
|
|
|
(func
|
|
|
|
('symbol', 'merge')
|
|
|
|
None))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
2017-06-20 16:26:52 +03:00
|
|
|
<generatorset+>
|
2012-02-10 00:03:07 +04:00
|
|
|
6
|
|
|
|
7
|
|
|
|
|
|
|
|
test infinite recursion
|
|
|
|
|
|
|
|
$ echo 'recurse1 = recurse2' >> .hg/hgrc
|
|
|
|
$ echo 'recurse2 = recurse1' >> .hg/hgrc
|
|
|
|
$ try recurse1
|
|
|
|
('symbol', 'recurse1')
|
|
|
|
hg: parse error: infinite expansion of revset alias "recurse1" detected
|
|
|
|
[255]
|
|
|
|
|
2012-05-19 19:19:55 +04:00
|
|
|
$ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc
|
|
|
|
$ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc
|
|
|
|
$ try "level2(level1(1, 2), 3)"
|
|
|
|
(func
|
|
|
|
('symbol', 'level2')
|
|
|
|
(list
|
|
|
|
(func
|
|
|
|
('symbol', 'level1')
|
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))
|
|
|
|
('symbol', '3')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2012-05-19 19:19:55 +04:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '3')
|
|
|
|
(or
|
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset [3]>,
|
2015-05-17 09:11:38 +03:00
|
|
|
<baseset [1, 2]>>
|
2012-05-19 19:19:55 +04:00
|
|
|
3
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
2012-02-10 00:03:07 +04:00
|
|
|
test nesting and variable passing
|
|
|
|
|
|
|
|
$ echo 'nested($1) = nested2($1)' >> .hg/hgrc
|
|
|
|
$ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
|
|
|
|
$ echo 'nested3($1) = max($1)' >> .hg/hgrc
|
|
|
|
$ try 'nested(2:5)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'nested')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'max')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
2016-02-16 15:44:13 +03:00
|
|
|
<baseset
|
|
|
|
<max
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
|
|
|
<spanset+ 2:6>>>
|
2012-02-10 00:03:07 +04:00
|
|
|
5
|
|
|
|
|
2015-04-26 12:13:48 +03:00
|
|
|
test chained `or` operations are flattened at parsing phase
|
|
|
|
|
|
|
|
$ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc
|
|
|
|
$ try 'chainedorops(0:1, 1:2, 2:3)'
|
|
|
|
(func
|
|
|
|
('symbol', 'chainedorops')
|
|
|
|
(list
|
2016-02-02 17:49:49 +03:00
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
(range
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
2015-04-26 12:13:48 +03:00
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2015-04-26 12:13:48 +03:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '0')
|
|
|
|
('symbol', '1'))
|
|
|
|
(range
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))))
|
2015-04-26 12:13:48 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:2>,
|
2015-04-26 12:13:48 +03:00
|
|
|
<addset
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 1:3>,
|
|
|
|
<spanset+ 2:4>>>
|
2015-04-26 12:13:48 +03:00
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
|
2012-02-10 00:03:07 +04:00
|
|
|
test variable isolation, variable placeholders are rewritten as string
|
|
|
|
then parsed and matched again as string. Check they do not leak too
|
|
|
|
far away.
|
|
|
|
|
|
|
|
$ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
|
|
|
|
$ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
|
|
|
|
$ try 'callinjection(2:5)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'callinjection')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'descendants')
|
|
|
|
(func
|
|
|
|
('symbol', 'max')
|
|
|
|
('string', '$1')))
|
2012-02-10 00:03:07 +04:00
|
|
|
abort: unknown revision '$1'!
|
|
|
|
[255]
|
|
|
|
|
2016-02-14 15:46:50 +03:00
|
|
|
test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)',
|
2016-10-18 00:16:55 +03:00
|
|
|
but 'all()' should never be substituted to '0()'.
|
2016-02-14 15:46:50 +03:00
|
|
|
|
|
|
|
$ echo 'universe = all()' >> .hg/hgrc
|
|
|
|
$ echo 'shadowall(all) = all and universe' >> .hg/hgrc
|
|
|
|
$ try 'shadowall(0)'
|
|
|
|
(func
|
|
|
|
('symbol', 'shadowall')
|
|
|
|
('symbol', '0'))
|
|
|
|
* expanded:
|
|
|
|
(and
|
|
|
|
('symbol', '0')
|
|
|
|
(func
|
|
|
|
('symbol', 'all')
|
|
|
|
None))
|
|
|
|
* set:
|
|
|
|
<filteredset
|
|
|
|
<baseset [0]>,
|
2017-06-10 18:21:38 +03:00
|
|
|
<spanset+ 0:10>>
|
2016-02-14 15:46:50 +03:00
|
|
|
0
|
|
|
|
|
2016-02-14 14:27:08 +03:00
|
|
|
test unknown reference:
|
|
|
|
|
|
|
|
$ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2'
|
|
|
|
(func
|
|
|
|
('symbol', 'unknownref')
|
|
|
|
('symbol', '0'))
|
2016-04-17 06:31:06 +03:00
|
|
|
abort: bad definition of revset alias "unknownref": invalid symbol '$2'
|
2016-02-14 14:27:08 +03:00
|
|
|
[255]
|
|
|
|
|
2015-01-05 05:02:04 +03:00
|
|
|
$ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip"
|
|
|
|
('symbol', 'tip')
|
2016-04-17 06:31:06 +03:00
|
|
|
warning: bad definition of revset alias "anotherbadone": at 7: not a prefix: end
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [9]>
|
2015-01-05 05:02:04 +03:00
|
|
|
9
|
2012-05-19 19:18:29 +04:00
|
|
|
|
2015-01-05 05:02:04 +03:00
|
|
|
$ try 'tip'
|
|
|
|
('symbol', 'tip')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [9]>
|
2015-01-05 05:02:04 +03:00
|
|
|
9
|
2015-01-10 17:18:11 +03:00
|
|
|
|
|
|
|
$ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
|
|
|
|
('symbol', 'tip')
|
2016-04-17 06:31:06 +03:00
|
|
|
warning: bad declaration of revset alias "bad name": at 4: invalid token
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [9]>
|
2015-01-10 17:18:11 +03:00
|
|
|
9
|
2015-02-02 17:07:04 +03:00
|
|
|
$ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
|
|
|
|
$ try 'strictreplacing("foo", tip)'
|
|
|
|
(func
|
|
|
|
('symbol', 'strictreplacing')
|
|
|
|
(list
|
|
|
|
('string', 'foo')
|
|
|
|
('symbol', 'tip')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
2015-02-02 17:07:04 +03:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', 'tip')
|
|
|
|
(func
|
|
|
|
('symbol', 'desc')
|
|
|
|
('string', '$1'))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<addset
|
|
|
|
<baseset [9]>,
|
|
|
|
<filteredset
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-13 14:05:57 +03:00
|
|
|
<desc '$1'>>>
|
2015-02-02 17:07:04 +03:00
|
|
|
9
|
2015-01-10 17:18:11 +03:00
|
|
|
|
2011-04-30 20:30:14 +04:00
|
|
|
$ try 'd(2:5)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'd')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5'))
|
|
|
|
('symbol', 'date'))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [4, 5, 3, 2]>
|
2011-04-30 20:30:14 +04:00
|
|
|
4
|
|
|
|
5
|
|
|
|
3
|
|
|
|
2
|
|
|
|
$ try 'rs(2 or 3, date)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'rs')
|
|
|
|
(list
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
('symbol', 'date')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
('symbol', 'date'))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [3, 2]>
|
2011-04-30 20:30:14 +04:00
|
|
|
3
|
|
|
|
2
|
2011-06-22 03:55:00 +04:00
|
|
|
$ try 'rs()'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'rs')
|
|
|
|
None)
|
2011-06-22 03:55:00 +04:00
|
|
|
hg: parse error: invalid number of arguments: 0
|
|
|
|
[255]
|
|
|
|
$ try 'rs(2)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'rs')
|
|
|
|
('symbol', '2'))
|
2011-06-22 03:55:00 +04:00
|
|
|
hg: parse error: invalid number of arguments: 1
|
|
|
|
[255]
|
|
|
|
$ try 'rs(2, data, 7)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'rs')
|
|
|
|
(list
|
2016-02-02 17:49:49 +03:00
|
|
|
('symbol', '2')
|
|
|
|
('symbol', 'data')
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
('symbol', '7')))
|
2011-06-22 03:55:00 +04:00
|
|
|
hg: parse error: invalid number of arguments: 3
|
|
|
|
[255]
|
|
|
|
$ try 'rs4(2 or 3, x, x, date)'
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'rs4')
|
|
|
|
(list
|
2016-02-02 17:49:49 +03:00
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
2016-02-02 17:49:49 +03:00
|
|
|
('symbol', 'x')
|
|
|
|
('symbol', 'x')
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
('symbol', 'date')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
debugrevspec: pretty print output
Before:
('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or',
('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
After:
(func
('symbol', 'reverse')
(func
('symbol', 'sort')
(list
(or
('symbol', '2')
('symbol', '3'))
('symbol', 'date'))))
v2:
- Rebased on stable to avoid having to merge tests output
2012-02-24 14:02:21 +04:00
|
|
|
('symbol', 'date'))))
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [3, 2]>
|
2011-06-22 03:55:00 +04:00
|
|
|
3
|
|
|
|
2
|
2011-05-01 19:35:05 +04:00
|
|
|
|
2015-02-26 02:12:01 +03:00
|
|
|
issue4553: check that revset aliases override existing hash prefix
|
|
|
|
|
|
|
|
$ hg log -qr e
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
|
|
|
|
$ hg log -qr e --config revsetalias.e="all()"
|
|
|
|
0:2785f51eece5
|
|
|
|
1:d75937da8da0
|
|
|
|
2:5ed5505e9f1c
|
|
|
|
3:8528aa5637f2
|
|
|
|
4:2326846efdab
|
|
|
|
5:904fa392b941
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
7:013af1973af4
|
|
|
|
8:d5d0dcbdc4d9
|
|
|
|
9:24286f4ae135
|
|
|
|
|
|
|
|
$ hg log -qr e: --config revsetalias.e="0"
|
|
|
|
0:2785f51eece5
|
|
|
|
1:d75937da8da0
|
|
|
|
2:5ed5505e9f1c
|
|
|
|
3:8528aa5637f2
|
|
|
|
4:2326846efdab
|
|
|
|
5:904fa392b941
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
7:013af1973af4
|
|
|
|
8:d5d0dcbdc4d9
|
|
|
|
9:24286f4ae135
|
|
|
|
|
|
|
|
$ hg log -qr :e --config revsetalias.e="9"
|
|
|
|
0:2785f51eece5
|
|
|
|
1:d75937da8da0
|
|
|
|
2:5ed5505e9f1c
|
|
|
|
3:8528aa5637f2
|
|
|
|
4:2326846efdab
|
|
|
|
5:904fa392b941
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
7:013af1973af4
|
|
|
|
8:d5d0dcbdc4d9
|
|
|
|
9:24286f4ae135
|
|
|
|
|
|
|
|
$ hg log -qr e:
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
7:013af1973af4
|
|
|
|
8:d5d0dcbdc4d9
|
|
|
|
9:24286f4ae135
|
|
|
|
|
|
|
|
$ hg log -qr :e
|
|
|
|
0:2785f51eece5
|
|
|
|
1:d75937da8da0
|
|
|
|
2:5ed5505e9f1c
|
|
|
|
3:8528aa5637f2
|
|
|
|
4:2326846efdab
|
|
|
|
5:904fa392b941
|
|
|
|
6:e0cc66ef77e8
|
|
|
|
|
2011-05-01 19:35:05 +04:00
|
|
|
issue2549 - correct optimizations
|
|
|
|
|
2016-02-16 15:43:51 +03:00
|
|
|
$ try 'limit(1 or 2 or 3, 2) and not 2'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'limit')
|
|
|
|
(list
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
2016-02-16 15:43:51 +03:00
|
|
|
('symbol', '2')))
|
|
|
|
(not
|
|
|
|
('symbol', '2')))
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2015-04-09 17:56:06 +03:00
|
|
|
<baseset [1, 2]>,
|
2016-02-16 15:43:51 +03:00
|
|
|
<not
|
|
|
|
<baseset [2]>>>
|
2011-05-01 19:35:05 +04:00
|
|
|
1
|
2016-02-16 15:44:13 +03:00
|
|
|
$ try 'max(1 or 2) and not 2'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'max')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))))
|
2016-02-16 15:44:13 +03:00
|
|
|
(not
|
|
|
|
('symbol', '2')))
|
|
|
|
* set:
|
|
|
|
<filteredset
|
|
|
|
<baseset
|
|
|
|
<max
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-16 15:44:13 +03:00
|
|
|
<baseset [1, 2]>>>,
|
|
|
|
<not
|
|
|
|
<baseset [2]>>>
|
|
|
|
$ try 'min(1 or 2) and not 1'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'min')
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))))
|
2016-02-16 15:44:13 +03:00
|
|
|
(not
|
|
|
|
('symbol', '1')))
|
|
|
|
* set:
|
|
|
|
<filteredset
|
|
|
|
<baseset
|
|
|
|
<min
|
2017-06-10 18:21:38 +03:00
|
|
|
<fullreposet+ 0:10>,
|
2016-02-16 15:44:13 +03:00
|
|
|
<baseset [1, 2]>>>,
|
|
|
|
<not
|
|
|
|
<baseset [1]>>>
|
2016-02-16 15:43:51 +03:00
|
|
|
$ try 'last(1 or 2, 1) and not 2'
|
|
|
|
(and
|
|
|
|
(func
|
|
|
|
('symbol', 'last')
|
|
|
|
(list
|
|
|
|
(or
|
2016-08-07 11:04:05 +03:00
|
|
|
(list
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))
|
2016-02-16 15:43:51 +03:00
|
|
|
('symbol', '1')))
|
|
|
|
(not
|
|
|
|
('symbol', '2')))
|
|
|
|
* set:
|
|
|
|
<filteredset
|
2015-04-09 17:56:06 +03:00
|
|
|
<baseset [2]>,
|
2016-02-16 15:43:51 +03:00
|
|
|
<not
|
|
|
|
<baseset [2]>>>
|
2011-12-25 15:35:16 +04:00
|
|
|
|
2014-07-15 02:55:31 +04:00
|
|
|
issue4289 - ordering of built-ins
|
|
|
|
$ hg log -M -q -r 3:2
|
|
|
|
3:8528aa5637f2
|
|
|
|
2:5ed5505e9f1c
|
|
|
|
|
2012-10-23 12:06:31 +04:00
|
|
|
test revsets started with 40-chars hash (issue3669)
|
|
|
|
|
|
|
|
$ ISSUE3669_TIP=`hg tip --template '{node}'`
|
|
|
|
$ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n'
|
|
|
|
9
|
|
|
|
$ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n'
|
|
|
|
8
|
|
|
|
|
revset: evaluate sub expressions correctly (issue3775)
Before this patch, sub expression may return unexpected result, if it
is joined with another expression by "or":
- "^"/parentspec():
"R or R^1" is not equal to "R^1 or R". the former returns only "R".
- "~"/ancestorspec():
"R or R~1" is not equal to "R~1 or R". the former returns only "R".
- ":"/rangeset():
"10 or (10 or 15):" is not equal to "(10 or 15): or 10". the
former returns only 10 and 15 or grater (11 to 14 are not
included).
In "or"-ed expression "A or B", the "subset" passed to evaluation of
"B" doesn't contain revisions gotten from evaluation of "A", for
efficiency.
In the other hand, "stringset()" fails to look corresponding revision
for specified string/symbol up, if "subset" doesn't contain that
revision.
So, predicates looking revisions up indirectly should evaluate sub
expressions of themselves not with passed "subset" but with "entire
revisions in the repository", to prevent "stringset()" from unexpected
failing to look symbols in them up.
But predicates in above example don't so. For example, in the case of
"R or R^1":
1. "R^1" is evaluated with "subset" containing revisions other than
"R", because "R" is already gotten by the former of "or"-ed
expressions
2. "parentspec()" evaluates "R" of "R^1" with such "subset"
3. "stringset()" fails to look "R" up, because "R" is not contained
in "subset"
4. so, evaluation of "R^1" returns no revision
This patch evaluates sub expressions for predicates above with "entire
revisions in the repository".
2013-01-23 17:52:55 +04:00
|
|
|
test or-ed indirect predicates (issue3775)
|
|
|
|
|
|
|
|
$ log '6 or 6^1' | sort
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log '6^1 or 6' | sort
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log '4 or 4~1' | sort
|
|
|
|
2
|
|
|
|
4
|
|
|
|
$ log '4~1 or 4' | sort
|
|
|
|
2
|
|
|
|
4
|
|
|
|
$ log '(0 or 2):(4 or 6) or 0 or 6' | sort
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
$ log '0 or 6 or (0 or 2):(4 or 6)' | sort
|
|
|
|
0
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
2012-01-27 17:29:58 +04:00
|
|
|
tests for 'remote()' predicate:
|
|
|
|
#. (csets in remote) (id) (remote)
|
|
|
|
1. less than local current branch "default"
|
|
|
|
2. same with local specified "default"
|
|
|
|
3. more than local specified specified
|
|
|
|
|
|
|
|
$ hg clone --quiet -U . ../remote3
|
|
|
|
$ cd ../remote3
|
|
|
|
$ hg update -q 7
|
|
|
|
$ echo r > r
|
|
|
|
$ hg ci -Aqm 10
|
|
|
|
$ log 'remote()'
|
|
|
|
7
|
|
|
|
$ log 'remote("a-b-c-")'
|
|
|
|
2
|
|
|
|
$ cd ../repo
|
|
|
|
$ log 'remote(".a.b.c.", "../remote3")'
|
|
|
|
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
tests for concatenation of strings/symbols by "##"
|
|
|
|
|
|
|
|
$ try "278 ## '5f5' ## 1ee ## 'ce5'"
|
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
('symbol', '278')
|
|
|
|
('string', '5f5'))
|
|
|
|
('symbol', '1ee'))
|
|
|
|
('string', 'ce5'))
|
2016-03-26 13:01:12 +03:00
|
|
|
* concatenated:
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
('string', '2785f51eece5')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [0]>
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
0
|
|
|
|
|
|
|
|
$ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
|
|
|
|
$ try "cat4(278, '5f5', 1ee, 'ce5')"
|
|
|
|
(func
|
|
|
|
('symbol', 'cat4')
|
|
|
|
(list
|
2016-02-02 17:49:49 +03:00
|
|
|
('symbol', '278')
|
|
|
|
('string', '5f5')
|
|
|
|
('symbol', '1ee')
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
('string', 'ce5')))
|
2016-03-26 13:01:12 +03:00
|
|
|
* expanded:
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
('symbol', '278')
|
|
|
|
('string', '5f5'))
|
|
|
|
('symbol', '1ee'))
|
|
|
|
('string', 'ce5'))
|
2016-03-26 13:01:12 +03:00
|
|
|
* concatenated:
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
('string', '2785f51eece5')
|
2015-03-16 12:36:53 +03:00
|
|
|
* set:
|
|
|
|
<baseset [0]>
|
revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.
For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.
grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")
This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.
In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:
issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")
"##" operator does:
- concatenate not only strings but also symbols into the string
Exact distinction between strings and symbols seems not to be
convenience, because it is tiresome for users (and
"revset.getstring" treats both similarly)
For example of revset alias "issue()", "issue(1234)" is easier
than "issue('1234')".
- have higher priority than any other prefix, infix and postfix
operators (like as "##" of C pre-processor)
This patch (re-)assigns the priority 20 to "##", and 21 to "(",
because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 17:46:18 +03:00
|
|
|
0
|
|
|
|
|
|
|
|
(check concatenation in alias nesting)
|
|
|
|
|
|
|
|
$ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc
|
|
|
|
$ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc
|
|
|
|
$ log "cat2x2(278, '5f5', 1ee, 'ce5')"
|
|
|
|
0
|
|
|
|
|
|
|
|
(check operator priority)
|
|
|
|
|
|
|
|
$ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc
|
|
|
|
$ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)"
|
|
|
|
0
|
|
|
|
4
|
|
|
|
|
2011-12-25 15:35:16 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2015-05-24 04:29:33 +03:00
|
|
|
prepare repository that has "default" branches of multiple roots
|
|
|
|
|
|
|
|
$ hg init namedbranch
|
|
|
|
$ cd namedbranch
|
|
|
|
|
|
|
|
$ echo default0 >> a
|
|
|
|
$ hg ci -Aqm0
|
|
|
|
$ echo default1 >> a
|
|
|
|
$ hg ci -m1
|
|
|
|
|
|
|
|
$ hg branch -q stable
|
|
|
|
$ echo stable2 >> a
|
|
|
|
$ hg ci -m2
|
|
|
|
$ echo stable3 >> a
|
|
|
|
$ hg ci -m3
|
|
|
|
|
|
|
|
$ hg update -q null
|
|
|
|
$ echo default4 >> a
|
|
|
|
$ hg ci -Aqm4
|
|
|
|
$ echo default5 >> a
|
|
|
|
$ hg ci -m5
|
|
|
|
|
2015-05-23 05:14:00 +03:00
|
|
|
"null" revision belongs to "default" branch (issue4683)
|
|
|
|
|
|
|
|
$ log 'branch(null)'
|
|
|
|
0
|
|
|
|
1
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
2015-05-24 04:29:33 +03:00
|
|
|
"null" revision belongs to "default" branch, but it shouldn't appear in set
|
|
|
|
unless explicitly specified (issue4682)
|
|
|
|
|
|
|
|
$ log 'children(branch(default))'
|
|
|
|
1
|
|
|
|
2
|
|
|
|
5
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2011-12-25 15:35:16 +04:00
|
|
|
test author/desc/keyword in problematic encoding
|
|
|
|
# unicode: cp932:
|
|
|
|
# u30A2 0x83 0x41(= 'A')
|
|
|
|
# u30C2 0x83 0x61(= 'a')
|
|
|
|
|
|
|
|
$ hg init problematicencoding
|
|
|
|
$ cd problematicencoding
|
|
|
|
|
2017-07-05 19:10:11 +03:00
|
|
|
$ $PYTHON > setup.sh <<EOF
|
2011-12-25 15:35:16 +04:00
|
|
|
> print u'''
|
|
|
|
> echo a > text
|
|
|
|
> hg add text
|
|
|
|
> hg --encoding utf-8 commit -u '\u30A2' -m none
|
|
|
|
> echo b > text
|
|
|
|
> hg --encoding utf-8 commit -u '\u30C2' -m none
|
|
|
|
> echo c > text
|
|
|
|
> hg --encoding utf-8 commit -u none -m '\u30A2'
|
|
|
|
> echo d > text
|
|
|
|
> hg --encoding utf-8 commit -u none -m '\u30C2'
|
|
|
|
> '''.encode('utf-8')
|
|
|
|
> EOF
|
|
|
|
$ sh < setup.sh
|
|
|
|
|
|
|
|
test in problematic encoding
|
2017-07-05 19:10:11 +03:00
|
|
|
$ $PYTHON > test.sh <<EOF
|
2011-12-25 15:35:16 +04:00
|
|
|
> print u'''
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
|
|
|
|
> echo ====
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
|
|
|
|
> echo ====
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
|
|
|
|
> echo ====
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
|
|
|
|
> echo ====
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
|
|
|
|
> echo ====
|
|
|
|
> hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
|
|
|
|
> '''.encode('cp932')
|
|
|
|
> EOF
|
|
|
|
$ sh < test.sh
|
|
|
|
0
|
|
|
|
====
|
|
|
|
1
|
|
|
|
====
|
|
|
|
2
|
|
|
|
====
|
|
|
|
3
|
|
|
|
====
|
|
|
|
0
|
|
|
|
2
|
|
|
|
====
|
|
|
|
1
|
|
|
|
3
|
|
|
|
|
2015-04-14 07:06:21 +03:00
|
|
|
test error message of bad revset
|
|
|
|
$ hg log -r 'foo\\'
|
2015-04-14 06:53:05 +03:00
|
|
|
hg: parse error at 3: syntax error in revset 'foo\\'
|
2015-04-14 07:06:21 +03:00
|
|
|
[255]
|
|
|
|
|
2011-12-25 15:35:16 +04:00
|
|
|
$ cd ..
|
2015-12-29 17:58:30 +03:00
|
|
|
|
2016-03-08 17:04:53 +03:00
|
|
|
Test that revset predicate of extension isn't loaded at failure of
|
|
|
|
loading it
|
2015-12-29 17:58:30 +03:00
|
|
|
|
|
|
|
$ cd repo
|
|
|
|
|
|
|
|
$ cat <<EOF > $TESTTMP/custompredicate.py
|
2016-03-08 17:04:53 +03:00
|
|
|
> from mercurial import error, registrar, revset
|
2015-12-29 17:58:30 +03:00
|
|
|
>
|
2016-03-08 17:04:53 +03:00
|
|
|
> revsetpredicate = registrar.revsetpredicate()
|
2015-12-29 17:58:30 +03:00
|
|
|
>
|
|
|
|
> @revsetpredicate('custom1()')
|
|
|
|
> def custom1(repo, subset, x):
|
|
|
|
> return revset.baseset([1])
|
|
|
|
>
|
2016-03-08 17:04:53 +03:00
|
|
|
> raise error.Abort('intentional failure of loading extension')
|
2015-12-29 17:58:30 +03:00
|
|
|
> EOF
|
|
|
|
$ cat <<EOF > .hg/hgrc
|
|
|
|
> [extensions]
|
|
|
|
> custompredicate = $TESTTMP/custompredicate.py
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg debugrevspec "custom1()"
|
2016-03-08 17:04:53 +03:00
|
|
|
*** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension
|
2015-12-29 17:58:30 +03:00
|
|
|
hg: parse error: unknown identifier: custom1
|
|
|
|
[255]
|
|
|
|
|
2017-06-25 01:29:42 +03:00
|
|
|
Test repo.anyrevs with customized revset overrides
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/printprevset.py <<EOF
|
|
|
|
> from mercurial import encoding
|
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> alias = {}
|
|
|
|
> p = encoding.environ.get('P')
|
|
|
|
> if p:
|
|
|
|
> alias['P'] = p
|
|
|
|
> revs = repo.anyrevs(['P'], user=True, localalias=alias)
|
|
|
|
> ui.write('P=%r' % list(revs))
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> custompredicate = !
|
|
|
|
> printprevset = $TESTTMP/printprevset.py
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg --config revsetalias.P=1 log -r . -T '\n'
|
|
|
|
P=[1]
|
|
|
|
$ P=3 hg --config revsetalias.P=2 log -r . -T '\n'
|
|
|
|
P=[3]
|
|
|
|
|
2015-12-29 17:58:30 +03:00
|
|
|
$ cd ..
|