tests: unify test-revset
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Mon, 30 Aug 2010 13:23:32 +0900
changeset 12104 256d447a0fe3
parent 12103 437579a0068a
child 12105 6f58430dfdd0
tests: unify test-revset
tests/test-bisect.t
tests/test-churn.t
tests/test-inherit-mode.t
tests/test-remove-new.t
tests/test-remove.t
tests/test-rename.t
tests/test-revset
tests/test-revset.out
tests/test-revset.t
tests/test-strict.t
--- a/tests/test-revset	Mon Aug 30 13:18:19 2010 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-#!/bin/sh
-
-HGENCODING=utf-8
-export HGENCODING
-
-try() {
-	echo '% hg debugrevspec' $@
-	hg debugrevspec --debug $@
-}
-
-log() {
-    echo "% log '$1'"
-    hg log --template '{rev}\n' -r "$1"
-}
-
-hg init repo
-cd repo
-
-echo a > a
-hg branch a
-hg ci -Aqm0
-
-echo b > b
-hg branch b
-hg ci -Aqm1
-
-rm a
-hg branch a-b-c-
-hg ci -Aqm2 -u Bob
-
-hg co 1
-hg branch +a+b+c+
-hg ci -Aqm3
-
-hg co 2  # interleave
-echo bb > b
-hg branch -- -a-b-c-
-hg ci -Aqm4 -d "May 12 2005"
-
-hg co 3
-hg branch /a/b/c/
-hg ci -Aqm"5 bug"
-
-hg merge 4
-hg branch _a_b_c_
-hg ci -Aqm"6 issue619"
-
-hg branch .a.b.c.
-hg ci -Aqm7
-
-hg branch all
-hg ci --close-branch -Aqm8
-
-hg co 4
-hg branch é
-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
-try b-a
-try _a_b_c_
-try _a_b_c_-a
-try .a.b.c.
-try .a.b.c.-a
-try -- '-a-b-c-' # complains
-log -a-b-c- # succeeds with fallback
-try -- -a-b-c--a # complains
-try é
-
-# quoting needed
-try '"-a-b-c-"-a'
-
-log '1 or 2'
-log '1|2'
-log '1 and 2'
-log '1&2'
-try '1&2|3' # precedence - and is higher
-try '1|2&3'
-try '1&2&3' # associativity
-try '1|(2|3)'
-log '1.0' # tag
-log 'a' # branch
-log '2785f51ee'
-log 'date(2005)'
-log 'date(this is a test)'
-log 'date()'
-log 'date'
-log 'date('
-log 'date(tip)'
-log '"date"'
-log 'date(2005) and 1::'
-
-log 'ancestor(1)'
-log 'ancestor(4,5)'
-log 'ancestor(4,5) and 4'
-log 'ancestors(5)'
-log 'author(bob)'
-log 'branch(é)'
-log 'children(ancestor(4,5))'
-log 'closed()'
-log 'contains(a)'
-log 'descendants(2 or 3)'
-log 'file(b)'
-log 'follow()'
-log 'grep("issue\d+")'
-log 'head()'
-log 'heads(6::)'
-log 'keyword(issue)'
-log 'limit(head(), 1)'
-log 'max(contains(a))'
-log 'min(contains(a))'
-log 'merge()'
-log 'modifies(b)'
-log 'outgoing()'
-log 'outgoing("../remote1")'
-log 'outgoing("../remote2")'
-log 'p1(merge())'
-log 'p2(merge())'
-log 'parents(merge())'
-log 'removes(a)'
-log 'roots(all())'
-log 'reverse(2 or 3 or 4 or 5)'
-log 'sort(limit(reverse(all()), 3))'
-log 'sort(2 or 3 or 4 or 5, date)'
-log 'tagged()'
-log 'user(bob)'
-
-log '4::8'
-log '4:8'
-
-log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
-
-log 'not 0 and 0:2'
-log 'not 1 and 0:2'
-log 'not 2 and 0:2'
-log '(1 and 2)::'
-log '(1 and 2):'
-log '(1 and 2):3'
-log 'sort(head(), -rev)'
--- a/tests/test-revset.out	Mon Aug 30 13:18:19 2010 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-marked working directory as branch a
-marked working directory as branch b
-marked working directory as branch a-b-c-
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch +a+b+c+
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch -a-b-c-
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch /a/b/c/
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-marked working directory as branch _a_b_c_
-marked working directory as branch .a.b.c.
-marked working directory as branch all
-abort: can only close branch heads
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch é
-% hg debugrevspec a
-('symbol', 'a')
-0
-% hg debugrevspec b-a
-('minus', ('symbol', 'b'), ('symbol', 'a'))
-1
-% hg debugrevspec _a_b_c_
-('symbol', '_a_b_c_')
-6
-% hg debugrevspec _a_b_c_-a
-('minus', ('symbol', '_a_b_c_'), ('symbol', 'a'))
-6
-% hg debugrevspec .a.b.c.
-('symbol', '.a.b.c.')
-7
-% hg debugrevspec .a.b.c.-a
-('minus', ('symbol', '.a.b.c.'), ('symbol', 'a'))
-7
-% hg debugrevspec -- -a-b-c-
-hg: parse error at 7: not a prefix: end
-% log '-a-b-c-'
-4
-% hg debugrevspec -- -a-b-c--a
-('minus', ('minus', ('minus', ('negate', ('symbol', 'a')), ('symbol', 'b')), ('symbol', 'c')), ('negate', ('symbol', 'a')))
-abort: unknown revision '-a'!
-% hg debugrevspec é
-('symbol', '\xc3\xa9')
-9
-% hg debugrevspec "-a-b-c-"-a
-('minus', ('string', '-a-b-c-'), ('symbol', 'a'))
-4
-% log '1 or 2'
-1
-2
-% log '1|2'
-1
-2
-% log '1 and 2'
-% log '1&2'
-% hg debugrevspec 1&2|3
-('or', ('and', ('symbol', '1'), ('symbol', '2')), ('symbol', '3'))
-3
-% hg debugrevspec 1|2&3
-('or', ('symbol', '1'), ('and', ('symbol', '2'), ('symbol', '3')))
-1
-% hg debugrevspec 1&2&3
-('and', ('and', ('symbol', '1'), ('symbol', '2')), ('symbol', '3'))
-% hg debugrevspec 1|(2|3)
-('or', ('symbol', '1'), ('group', ('or', ('symbol', '2'), ('symbol', '3'))))
-1
-2
-3
-% log '1.0'
-6
-% log 'a'
-0
-% log '2785f51ee'
-0
-% log 'date(2005)'
-4
-% log 'date(this is a test)'
-hg: parse error at 10: unexpected token: symbol
-% log 'date()'
-hg: parse error: date wants a string
-% log 'date'
-hg: parse error: can't use date here
-% log 'date('
-hg: parse error at 5: not a prefix: end
-% log 'date(tip)'
-abort: invalid date: 'tip' 
-% log '"date"'
-abort: unknown revision 'date'!
-% log 'date(2005) and 1::'
-4
-% log 'ancestor(1)'
-hg: parse error: ancestor wants two arguments
-% log 'ancestor(4,5)'
-1
-% log 'ancestor(4,5) and 4'
-% log 'ancestors(5)'
-0
-1
-3
-5
-% log 'author(bob)'
-2
-% log 'branch(é)'
-8
-9
-% log 'children(ancestor(4,5))'
-2
-3
-% log 'closed()'
-% log 'contains(a)'
-0
-1
-3
-5
-% log 'descendants(2 or 3)'
-2
-3
-4
-5
-6
-7
-8
-9
-% log 'file(b)'
-1
-4
-% log 'follow()'
-0
-1
-2
-4
-8
-9
-% log 'grep("issue\d+")'
-6
-% log 'head()'
-0
-1
-2
-3
-4
-5
-6
-7
-9
-% log 'heads(6::)'
-7
-% log 'keyword(issue)'
-6
-% log 'limit(head(), 1)'
-0
-% log 'max(contains(a))'
-5
-% log 'min(contains(a))'
-0
-% log 'merge()'
-6
-% log 'modifies(b)'
-4
-% 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
-% log 'removes(a)'
-2
-6
-% log 'roots(all())'
-0
-% log 'reverse(2 or 3 or 4 or 5)'
-5
-4
-3
-2
-% 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
-% 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revset.t	Mon Aug 30 13:23:32 2010 +0900
@@ -0,0 +1,307 @@
+  $ HGENCODING=utf-8
+  $ export HGENCODING
+
+  $ try() {
+  >   hg debugrevspec --debug $@
+  > }
+
+  $ 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
+  $ 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
+
+  $ 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
+  $ hg branch /a/b/c/
+  marked working directory as branch /a/b/c/
+  $ 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 ci --close-branch -Aqm8
+  abort: can only close branch heads
+
+  $ hg co 4
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch é
+  marked working directory as branch é
+  $ 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
+  ('minus', ('symbol', 'b'), ('symbol', 'a'))
+  1
+  $ try _a_b_c_
+  ('symbol', '_a_b_c_')
+  6
+  $ try _a_b_c_-a
+  ('minus', ('symbol', '_a_b_c_'), ('symbol', 'a'))
+  6
+  $ try .a.b.c.
+  ('symbol', '.a.b.c.')
+  7
+  $ try .a.b.c.-a
+  ('minus', ('symbol', '.a.b.c.'), ('symbol', 'a'))
+  7
+  $ try -- '-a-b-c-' # complains
+  hg: parse error at 7: not a prefix: end
+  $ log -a-b-c- # succeeds with fallback
+  4
+  $ try -- -a-b-c--a # complains
+  ('minus', ('minus', ('minus', ('negate', ('symbol', 'a')), ('symbol', 'b')), ('symbol', 'c')), ('negate', ('symbol', 'a')))
+  abort: unknown revision '-a'!
+  $ try é
+  ('symbol', '\xc3\xa9')
+  9
+
+quoting needed
+
+  $ try '"-a-b-c-"-a'
+  ('minus', ('string', '-a-b-c-'), ('symbol', 'a'))
+  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
+  ('or', ('and', ('symbol', '1'), ('symbol', '2')), ('symbol', '3'))
+  3
+  $ try '1|2&3'
+  ('or', ('symbol', '1'), ('and', ('symbol', '2'), ('symbol', '3')))
+  1
+  $ try '1&2&3' # associativity
+  ('and', ('and', ('symbol', '1'), ('symbol', '2')), ('symbol', '3'))
+  $ try '1|(2|3)'
+  ('or', ('symbol', '1'), ('group', ('or', ('symbol', '2'), ('symbol', '3'))))
+  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
+  $ log 'date()'
+  hg: parse error: date wants a string
+  $ log 'date'
+  hg: parse error: can't use date here
+  $ log 'date('
+  hg: parse error at 5: not a prefix: end
+  $ log 'date(tip)'
+  abort: invalid date: 'tip' 
+  $ log '"date"'
+  abort: unknown revision 'date'!
+  $ log 'date(2005) and 1::'
+  4
+
+  $ log 'ancestor(1)'
+  hg: parse error: ancestor wants two arguments
+  $ log 'ancestor(4,5)'
+  1
+  $ log 'ancestor(4,5) and 4'
+  $ log 'ancestors(5)'
+  0
+  1
+  3
+  5
+  $ log 'author(bob)'
+  2
+  $ log 'branch(é)'
+  8
+  9
+  $ log 'children(ancestor(4,5))'
+  2
+  3
+  $ log 'closed()'
+  $ log 'contains(a)'
+  0
+  1
+  3
+  5
+  $ log 'descendants(2 or 3)'
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  $ log 'file(b)'
+  1
+  4
+  $ log 'follow()'
+  0
+  1
+  2
+  4
+  8
+  9
+  $ log 'grep("issue\d+")'
+  6
+  $ log 'head()'
+  0
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  9
+  $ log 'heads(6::)'
+  7
+  $ log 'keyword(issue)'
+  6
+  $ log 'limit(head(), 1)'
+  0
+  $ log 'max(contains(a))'
+  5
+  $ log 'min(contains(a))'
+  0
+  $ log 'merge()'
+  6
+  $ log 'modifies(b)'
+  4
+  $ 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
+  $ log 'removes(a)'
+  2
+  6
+  $ log 'roots(all())'
+  0
+  $ log 'reverse(2 or 3 or 4 or 5)'
+  5
+  4
+  3
+  2
+  $ 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
+  $ 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