2010-08-30 08:23:32 +04:00
|
|
|
$ HGENCODING=utf-8
|
|
|
|
$ export HGENCODING
|
|
|
|
|
|
|
|
$ 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"
|
|
|
|
> }
|
|
|
|
|
|
|
|
$ 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
|
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 -Aqm1
|
|
|
|
|
|
|
|
$ rm a
|
|
|
|
$ hg branch a-b-c-
|
|
|
|
marked working directory as branch a-b-c-
|
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 -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+
|
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 -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-
|
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 -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/
|
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 -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_
|
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 -Aqm"6 issue619"
|
|
|
|
|
|
|
|
$ hg branch .a.b.c.
|
|
|
|
marked working directory as branch .a.b.c.
|
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 -Aqm7
|
|
|
|
|
|
|
|
$ hg branch all
|
|
|
|
marked working directory as branch all
|
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 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)
|
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 -Aqm9
|
|
|
|
|
|
|
|
$ hg tag -r6 1.0
|
|
|
|
|
|
|
|
$ hg clone --quiet -U -r 7 . ../remote1
|
|
|
|
$ hg clone --quiet -U -r 8 . ../remote2
|
|
|
|
$ echo "[paths]" >> .hg/hgrc
|
|
|
|
$ echo "default = ../remote1" >> .hg/hgrc
|
|
|
|
|
|
|
|
names that should work without quoting
|
|
|
|
|
|
|
|
$ try a
|
|
|
|
('symbol', 'a')
|
|
|
|
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'))
|
2010-08-30 08:23:32 +04:00
|
|
|
1
|
|
|
|
$ try _a_b_c_
|
|
|
|
('symbol', '_a_b_c_')
|
|
|
|
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'))
|
2010-08-30 08:23:32 +04:00
|
|
|
6
|
|
|
|
$ try .a.b.c.
|
|
|
|
('symbol', '.a.b.c.')
|
|
|
|
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'))
|
2010-08-30 08:23:32 +04:00
|
|
|
7
|
|
|
|
$ try -- '-a-b-c-' # complains
|
|
|
|
hg: parse error at 7: not a prefix: end
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log -a-b-c- # succeeds with fallback
|
|
|
|
4
|
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')
|
|
|
|
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'))
|
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
|
|
|
|
(and
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2'))
|
|
|
|
('symbol', '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
|
|
|
|
('symbol', '1')
|
|
|
|
(and
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3')))
|
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'))
|
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
|
|
|
|
('symbol', '1')
|
|
|
|
(group
|
|
|
|
(or
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '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'
|
|
|
|
hg: parse error: can't use date here
|
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]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date(tip)'
|
2010-08-30 08:29:44 +04:00
|
|
|
abort: invalid date: 'tip'
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log '"date"'
|
|
|
|
abort: unknown revision 'date'!
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'date(2005) and 1::'
|
|
|
|
4
|
|
|
|
|
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
|
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
|
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
|
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
|
|
|
|
$ 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
|
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+'))
|
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+'))
|
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")'
|
2010-08-30 08:23:32 +04:00
|
|
|
$ log 'limit(head(), 1)'
|
|
|
|
0
|
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
|
|
|
|
|
|
|
|
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-01-25 14:20:27 +03:00
|
|
|
Test null revision
|
|
|
|
$ log 'ancestors(null)'
|
|
|
|
-1
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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')
|
|
|
|
('symbol', '1')))
|
|
|
|
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')
|
|
|
|
('symbol', '3')))
|
|
|
|
$ 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')
|
|
|
|
('symbol', '2')))
|
|
|
|
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')
|
|
|
|
('symbol', '4')))
|
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
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]
|
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
|
2012-05-09 20:45:14 +04:00
|
|
|
$ log 'matching(1 or 2 or 3) and (2 or 3 or 1)'
|
|
|
|
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
|
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
|
|
|
|
|
|
|
$ 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
|
|
|
|
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^'
|
|
|
|
$ hg diff -r 'tip^::tip^ or tip^'
|
|
|
|
|
|
|
|
(single rev that does not looks like a range)
|
|
|
|
|
|
|
|
$ 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
|
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')
|
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)
|
2011-04-30 20:30:14 +04:00
|
|
|
6
|
2012-02-10 00:03:07 +04:00
|
|
|
|
|
|
|
test alias recursion
|
|
|
|
|
|
|
|
$ try sincem
|
|
|
|
('symbol', 'sincem')
|
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))
|
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')))
|
|
|
|
(or
|
|
|
|
('symbol', '3')
|
|
|
|
(or
|
|
|
|
('symbol', '1')
|
|
|
|
('symbol', '2')))
|
|
|
|
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')))
|
|
|
|
(func
|
|
|
|
('symbol', 'max')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2012-02-10 00:03:07 +04:00
|
|
|
5
|
|
|
|
|
|
|
|
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')))
|
|
|
|
(func
|
|
|
|
('symbol', 'descendants')
|
|
|
|
(func
|
|
|
|
('symbol', 'max')
|
|
|
|
('string', '$1')))
|
2012-02-10 00:03:07 +04:00
|
|
|
abort: unknown revision '$1'!
|
|
|
|
[255]
|
|
|
|
|
2012-05-19 19:18:29 +04:00
|
|
|
$ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc
|
|
|
|
$ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc
|
|
|
|
$ try 'callinjection2(2:5)'
|
|
|
|
(func
|
|
|
|
('symbol', 'callinjection2')
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5')))
|
2015-01-10 17:18:11 +03:00
|
|
|
abort: failed to parse the definition of revset alias "injectparamasstring2": not a function: _aliasarg
|
2012-05-19 19:18:29 +04:00
|
|
|
[255]
|
2015-01-05 05:02:04 +03:00
|
|
|
$ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip"
|
|
|
|
('symbol', 'tip')
|
2015-01-10 17:18:11 +03:00
|
|
|
warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end
|
|
|
|
warning: failed to parse the definition of revset alias "injectparamasstring2": not a function: _aliasarg
|
2015-01-05 05:02:04 +03:00
|
|
|
9
|
2012-05-19 19:18:29 +04:00
|
|
|
>>> data = file('.hg/hgrc', 'rb').read()
|
|
|
|
>>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', ''))
|
|
|
|
|
2015-01-05 05:02:04 +03:00
|
|
|
$ try 'tip'
|
|
|
|
('symbol', 'tip')
|
|
|
|
9
|
2015-01-10 17:18:11 +03:00
|
|
|
|
|
|
|
$ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
|
|
|
|
('symbol', 'tip')
|
|
|
|
warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token
|
|
|
|
9
|
|
|
|
|
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')))
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(range
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '5'))
|
|
|
|
('symbol', 'date'))))
|
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
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', 'date')))
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(or
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', 'date'))))
|
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
|
|
|
|
(list
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', 'data'))
|
|
|
|
('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
|
|
|
|
(list
|
|
|
|
(list
|
|
|
|
(or
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', 'x'))
|
|
|
|
('symbol', 'x'))
|
|
|
|
('symbol', 'date')))
|
|
|
|
(func
|
|
|
|
('symbol', 'reverse')
|
|
|
|
(func
|
|
|
|
('symbol', 'sort')
|
|
|
|
(list
|
|
|
|
(or
|
|
|
|
('symbol', '2')
|
|
|
|
('symbol', '3'))
|
|
|
|
('symbol', 'date'))))
|
2011-06-22 03:55:00 +04:00
|
|
|
3
|
|
|
|
2
|
2011-05-01 19:35:05 +04:00
|
|
|
|
|
|
|
issue2549 - correct optimizations
|
|
|
|
|
|
|
|
$ log 'limit(1 or 2 or 3, 2) and not 2'
|
|
|
|
1
|
|
|
|
$ log 'max(1 or 2) and not 2'
|
|
|
|
$ log 'min(1 or 2) and not 1'
|
|
|
|
$ log 'last(1 or 2, 1) and not 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'))
|
|
|
|
('string', '2785f51eece5')
|
|
|
|
0
|
|
|
|
|
|
|
|
$ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
|
|
|
|
$ try "cat4(278, '5f5', 1ee, 'ce5')"
|
|
|
|
(func
|
|
|
|
('symbol', 'cat4')
|
|
|
|
(list
|
|
|
|
(list
|
|
|
|
(list
|
|
|
|
('symbol', '278')
|
|
|
|
('string', '5f5'))
|
|
|
|
('symbol', '1ee'))
|
|
|
|
('string', 'ce5')))
|
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
(_concat
|
|
|
|
('symbol', '278')
|
|
|
|
('string', '5f5'))
|
|
|
|
('symbol', '1ee'))
|
|
|
|
('string', 'ce5'))
|
|
|
|
('string', '2785f51eece5')
|
|
|
|
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 ..
|
|
|
|
|
|
|
|
test author/desc/keyword in problematic encoding
|
|
|
|
# unicode: cp932:
|
|
|
|
# u30A2 0x83 0x41(= 'A')
|
|
|
|
# u30C2 0x83 0x61(= 'a')
|
|
|
|
|
|
|
|
$ hg init problematicencoding
|
|
|
|
$ cd problematicencoding
|
|
|
|
|
|
|
|
$ python > setup.sh <<EOF
|
|
|
|
> 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
|
|
|
|
$ python > test.sh <<EOF
|
|
|
|
> 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
|
|
|
|
|
|
|
|
$ cd ..
|