annotate tests/test-revset @ 11882:b75dea24e296 stable

revset: fix outgoing argument handling
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Thu, 12 Aug 2010 20:54:34 -0300
parents ebaf117c2642
children 73112cb2a6d7 40c40c6f20b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
3 HGENCODING=utf-8
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
4 export HGENCODING
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
8 hg debugrevspec --debug $@
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
9 }
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
10
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
11 log() {
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
12 echo "% log '$1'"
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
18
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
19 echo a > a
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
20 hg branch a
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
21 hg ci -Aqm0
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
22
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
23 echo b > b
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
24 hg branch b
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
25 hg ci -Aqm1
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
26
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
29 hg ci -Aqm2 -u Bob
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
30
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
31 hg co 1
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
32 hg branch +a+b+c+
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
33 hg ci -Aqm3
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
34
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
35 hg co 2 # interleave
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
38 hg ci -Aqm4 -d "May 12 2005"
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
39
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
42 hg ci -Aqm"5 bug"
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
43
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
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
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
46 hg ci -Aqm"6 issue619"
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
47
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
48 hg branch .a.b.c.
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
49 hg ci -Aqm7
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
50
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
51 hg branch all
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
52 hg ci --close-branch -Aqm8
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
53
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
54 hg co 4
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
55 hg branch é
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
56 hg ci -Aqm9
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
57
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
58 hg tag -r6 1.0
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
59
11882
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
60 hg clone --quiet -U -r 7 . ../remote1
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
61 hg clone --quiet -U -r 8 . ../remote2
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
62 echo "[paths]" >> .hg/hgrc
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
63 echo "default = ../remote1" >> .hg/hgrc
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
64
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
65 # names that should work without quoting
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
66 try a
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
67 try b-a
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
68 try _a_b_c_
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
69 try _a_b_c_-a
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
70 try .a.b.c.
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
71 try .a.b.c.-a
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
72 try -- '-a-b-c-' # complains
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
73 log -a-b-c- # succeeds with fallback
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
74 try -- -a-b-c--a # complains
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
75 try é
11409
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
76
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
77 # quoting needed
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
78 try '"-a-b-c-"-a'
7a6ac83a15b0 revset: add some tests
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
diff changeset
79
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
80 log '1 or 2'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
81 log '1|2'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
82 log '1 and 2'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
83 log '1&2'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
84 try '1&2|3' # precedence - and is higher
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
85 try '1|2&3'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
86 try '1&2&3' # associativity
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
87 try '1|(2|3)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
88 log '1.0' # tag
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
89 log 'a' # branch
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
90 log '2785f51ee'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
91 log 'date(2005)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
92 log 'date(this is a test)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
93 log 'date()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
94 log 'date'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
95 log 'date('
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
96 log 'date(tip)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
97 log '"date"'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
98 log 'date(2005) and 1::'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
99
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
100 log 'ancestor(1)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
101 log 'ancestor(4,5)'
11650
ebaf117c2642 revset: fix ancestor subset handling (issue2298)
Matt Mackall <mpm@selenic.com>
parents: 11467
diff changeset
102 log 'ancestor(4,5) and 4'
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
103 log 'ancestors(5)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
104 log 'author(bob)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
105 log 'branch(é)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
106 log 'children(ancestor(4,5))'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
107 log 'closed()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
108 log 'contains(a)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
109 log 'descendants(2 or 3)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
110 log 'file(b)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
111 log 'follow()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
112 log 'grep("issue\d+")'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
113 log 'head()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
114 log 'heads(6::)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
115 log 'keyword(issue)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
116 log 'limit(head(), 1)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
117 log 'max(contains(a))'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
118 log 'merge()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
119 log 'modifies(b)'
11882
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
120 log 'outgoing()'
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
121 log 'outgoing("../remote1")'
b75dea24e296 revset: fix outgoing argument handling
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 11650
diff changeset
122 log 'outgoing("../remote2")'
11419
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
123 log 'p1(merge())'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
124 log 'p2(merge())'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
125 log 'parents(merge())'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
126 log 'removes(a)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
127 log 'roots(all())'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
128 log 'reverse(2 or 3 or 4 or 5)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
129 log 'sort(limit(reverse(all()), 3))'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
130 log 'sort(2 or 3 or 4 or 5, date)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
131 log 'tagged()'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
132 log 'user(bob)'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
133
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
134 log '4::8'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
135 log '4:8'
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
136
3cc2e34d7a7d tests: extend revset test
Matt Mackall <mpm@selenic.com>
parents: 11409
diff changeset
137 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
138
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
139 log 'not 0 and 0:2'
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
140 log 'not 1 and 0:2'
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
141 log 'not 2 and 0:2'
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
142 log '(1 and 2)::'
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
143 log '(1 and 2):'
88abbb046e66 revset: deal with empty sets in range endpoints
Matt Mackall <mpm@selenic.com>
parents: 11419
diff changeset
144 log '(1 and 2):3'
11467
6b836d5c8c9e revset: make negate work for sort specs
Matt Mackall <mpm@selenic.com>
parents: 11456
diff changeset
145 log 'sort(head(), -rev)'