Mercurial > hg
annotate tests/test-revset @ 11456:88abbb046e66 stable
revset: deal with empty sets in range endpoints
(spotted by Julian Cowley <julian@lava.net>)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 28 Jun 2010 11:07:27 -0500 |
parents | 3cc2e34d7a7d |
children | 6b836d5c8c9e |
rev | line source |
---|---|
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
2 |
11419 | 3 HGENCODING=utf-8 |
4 export HGENCODING | |
5 | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
6 try() { |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
7 echo '% hg debugrevspec' $@ |
11419 | 8 hg debugrevspec --debug $@ |
9 } | |
10 | |
11 log() { | |
12 echo "% log '$1'" | |
13 hg log --template '{rev}\n' -r "$1" | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
14 } |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
15 |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
16 hg init repo |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
17 cd repo |
11419 | 18 |
19 echo a > a | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
20 hg branch a |
11419 | 21 hg ci -Aqm0 |
22 | |
23 echo b > b | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
24 hg branch b |
11419 | 25 hg ci -Aqm1 |
26 | |
27 rm a | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
28 hg branch a-b-c- |
11419 | 29 hg ci -Aqm2 -u Bob |
30 | |
31 hg co 1 | |
32 hg branch +a+b+c+ | |
33 hg ci -Aqm3 | |
34 | |
35 hg co 2 # interleave | |
36 echo bb > b | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
37 hg branch -- -a-b-c- |
11419 | 38 hg ci -Aqm4 -d "May 12 2005" |
39 | |
40 hg co 3 | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
41 hg branch /a/b/c/ |
11419 | 42 hg ci -Aqm"5 bug" |
43 | |
44 hg merge 4 | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
45 hg branch _a_b_c_ |
11419 | 46 hg ci -Aqm"6 issue619" |
47 | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
48 hg branch .a.b.c. |
11419 | 49 hg ci -Aqm7 |
50 | |
51 hg branch all | |
52 hg ci --close-branch -Aqm8 | |
53 | |
54 hg co 4 | |
55 hg branch é | |
56 hg ci -Aqm9 | |
57 | |
58 hg tag -r6 1.0 | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
59 |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
60 # names that should work without quoting |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
61 try a |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
62 try b-a |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
63 try _a_b_c_ |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
64 try _a_b_c_-a |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
65 try .a.b.c. |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
66 try .a.b.c.-a |
11419 | 67 try -- '-a-b-c-' # complains |
68 log -a-b-c- # succeeds with fallback | |
69 try -- -a-b-c--a # complains | |
70 try é | |
11409
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
71 |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
72 # quoting needed |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
73 try '"-a-b-c-"-a' |
7a6ac83a15b0
revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff
changeset
|
74 |
11419 | 75 log '1 or 2' |
76 log '1|2' | |
77 log '1 and 2' | |
78 log '1&2' | |
79 try '1&2|3' # precedence - and is higher | |
80 try '1|2&3' | |
81 try '1&2&3' # associativity | |
82 try '1|(2|3)' | |
83 log '1.0' # tag | |
84 log 'a' # branch | |
85 log '2785f51ee' | |
86 log 'date(2005)' | |
87 log 'date(this is a test)' | |
88 log 'date()' | |
89 log 'date' | |
90 log 'date(' | |
91 log 'date(tip)' | |
92 log '"date"' | |
93 log 'date(2005) and 1::' | |
94 | |
95 log 'ancestor(1)' | |
96 log 'ancestor(4,5)' | |
97 log 'ancestors(5)' | |
98 log 'author(bob)' | |
99 log 'branch(é)' | |
100 log 'children(ancestor(4,5))' | |
101 log 'closed()' | |
102 log 'contains(a)' | |
103 log 'descendants(2 or 3)' | |
104 log 'file(b)' | |
105 log 'follow()' | |
106 log 'grep("issue\d+")' | |
107 log 'head()' | |
108 log 'heads(6::)' | |
109 log 'keyword(issue)' | |
110 log 'limit(head(), 1)' | |
111 log 'max(contains(a))' | |
112 log 'merge()' | |
113 log 'modifies(b)' | |
114 log 'p1(merge())' | |
115 log 'p2(merge())' | |
116 log 'parents(merge())' | |
117 log 'removes(a)' | |
118 log 'roots(all())' | |
119 log 'reverse(2 or 3 or 4 or 5)' | |
120 log 'sort(limit(reverse(all()), 3))' | |
121 log 'sort(2 or 3 or 4 or 5, date)' | |
122 log 'tagged()' | |
123 log 'user(bob)' | |
124 | |
125 log '4::8' | |
126 log '4:8' | |
127 | |
128 log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' | |
11456
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
129 |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
130 log 'not 0 and 0:2' |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
131 log 'not 1 and 0:2' |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
132 log 'not 2 and 0:2' |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
133 log '(1 and 2)::' |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
134 log '(1 and 2):' |
88abbb046e66
revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents:
11419
diff
changeset
|
135 log '(1 and 2):3' |