Show More
@@ -1,748 +1,748 b'' | |||
|
1 | 1 | $ cat > $TESTTMP/filter.py <<EOF |
|
2 | 2 | > from __future__ import absolute_import, print_function |
|
3 | 3 | > import re |
|
4 | 4 | > import sys |
|
5 | 5 | > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="") |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ cat <<EOF >> $HGRCPATH |
|
9 | 9 | > [extensions] |
|
10 | 10 | > notify= |
|
11 | 11 | > |
|
12 | 12 | > [hooks] |
|
13 | 13 | > incoming.notify = python:hgext.notify.hook |
|
14 | 14 | > |
|
15 | 15 | > [notify] |
|
16 | 16 | > sources = pull |
|
17 | 17 | > diffstat = False |
|
18 | 18 | > |
|
19 | 19 | > [usersubs] |
|
20 | 20 | > foo@bar = * |
|
21 | 21 | > |
|
22 | 22 | > [reposubs] |
|
23 | 23 | > * = baz |
|
24 | 24 | > EOF |
|
25 | 25 | $ hg help notify |
|
26 | 26 | notify extension - hooks for sending email push notifications |
|
27 | 27 | |
|
28 | 28 | This extension implements hooks to send email notifications when changesets |
|
29 | 29 | are sent from or received by the local repository. |
|
30 | 30 | |
|
31 | 31 | First, enable the extension as explained in 'hg help extensions', and register |
|
32 | 32 | the hook you want to run. "incoming" and "changegroup" hooks are run when |
|
33 | 33 | changesets are received, while "outgoing" hooks are for changesets sent to |
|
34 | 34 | another repository: |
|
35 | 35 | |
|
36 | 36 | [hooks] |
|
37 | 37 | # one email for each incoming changeset |
|
38 | 38 | incoming.notify = python:hgext.notify.hook |
|
39 | 39 | # one email for all incoming changesets |
|
40 | 40 | changegroup.notify = python:hgext.notify.hook |
|
41 | 41 | |
|
42 | 42 | # one email for all outgoing changesets |
|
43 | 43 | outgoing.notify = python:hgext.notify.hook |
|
44 | 44 | |
|
45 | 45 | This registers the hooks. To enable notification, subscribers must be assigned |
|
46 | 46 | to repositories. The "[usersubs]" section maps multiple repositories to a |
|
47 | 47 | given recipient. The "[reposubs]" section maps multiple recipients to a single |
|
48 | 48 | repository: |
|
49 | 49 | |
|
50 | 50 | [usersubs] |
|
51 | 51 | # key is subscriber email, value is a comma-separated list of repo patterns |
|
52 | 52 | user@host = pattern |
|
53 | 53 | |
|
54 | 54 | [reposubs] |
|
55 | 55 | # key is repo pattern, value is a comma-separated list of subscriber emails |
|
56 | 56 | pattern = user@host |
|
57 | 57 | |
|
58 | 58 | A "pattern" is a "glob" matching the absolute path to a repository, optionally |
|
59 | 59 | combined with a revset expression. A revset expression, if present, is |
|
60 | 60 | separated from the glob by a hash. Example: |
|
61 | 61 | |
|
62 | 62 | [reposubs] |
|
63 | 63 | */widgets#branch(release) = qa-team@example.com |
|
64 | 64 | |
|
65 | 65 | This sends to "qa-team@example.com" whenever a changeset on the "release" |
|
66 | 66 | branch triggers a notification in any repository ending in "widgets". |
|
67 | 67 | |
|
68 | 68 | In order to place them under direct user management, "[usersubs]" and |
|
69 | 69 | "[reposubs]" sections may be placed in a separate "hgrc" file and incorporated |
|
70 | 70 | by reference: |
|
71 | 71 | |
|
72 | 72 | [notify] |
|
73 | 73 | config = /path/to/subscriptionsfile |
|
74 | 74 | |
|
75 | 75 | Notifications will not be sent until the "notify.test" value is set to |
|
76 | 76 | "False"; see below. |
|
77 | 77 | |
|
78 | 78 | Notifications content can be tweaked with the following configuration entries: |
|
79 | 79 | |
|
80 | 80 | notify.test |
|
81 | 81 | If "True", print messages to stdout instead of sending them. Default: True. |
|
82 | 82 | |
|
83 | 83 | notify.sources |
|
84 | 84 | Space-separated list of change sources. Notifications are activated only |
|
85 | 85 | when a changeset's source is in this list. Sources may be: |
|
86 | 86 | |
|
87 | 87 | "serve" changesets received via http or ssh |
|
88 | 88 | "pull" changesets received via "hg pull" |
|
89 | 89 | "unbundle" changesets received via "hg unbundle" |
|
90 | 90 | "push" changesets sent or received via "hg push" |
|
91 | 91 | "bundle" changesets sent via "hg unbundle" |
|
92 | 92 | |
|
93 | 93 | Default: serve. |
|
94 | 94 | |
|
95 | 95 | notify.strip |
|
96 | 96 | Number of leading slashes to strip from url paths. By default, notifications |
|
97 | 97 | reference repositories with their absolute path. "notify.strip" lets you |
|
98 | 98 | turn them into relative paths. For example, "notify.strip=3" will change |
|
99 | 99 | "/long/path/repository" into "repository". Default: 0. |
|
100 | 100 | |
|
101 | 101 | notify.domain |
|
102 | 102 | Default email domain for sender or recipients with no explicit domain. |
|
103 | 103 | |
|
104 | 104 | notify.style |
|
105 | 105 | Style file to use when formatting emails. |
|
106 | 106 | |
|
107 | 107 | notify.template |
|
108 | 108 | Template to use when formatting emails. |
|
109 | 109 | |
|
110 | 110 | notify.incoming |
|
111 | 111 | Template to use when run as an incoming hook, overriding "notify.template". |
|
112 | 112 | |
|
113 | 113 | notify.outgoing |
|
114 | 114 | Template to use when run as an outgoing hook, overriding "notify.template". |
|
115 | 115 | |
|
116 | 116 | notify.changegroup |
|
117 | 117 | Template to use when running as a changegroup hook, overriding |
|
118 | 118 | "notify.template". |
|
119 | 119 | |
|
120 | 120 | notify.maxdiff |
|
121 | 121 | Maximum number of diff lines to include in notification email. Set to 0 to |
|
122 | 122 | disable the diff, or -1 to include all of it. Default: 300. |
|
123 | 123 | |
|
124 | 124 | notify.maxdiffstat |
|
125 | 125 | Maximum number of diffstat lines to include in notification email. Set to -1 |
|
126 | 126 | to include all of it. Default: -1. |
|
127 | 127 | |
|
128 | 128 | notify.maxsubject |
|
129 | 129 | Maximum number of characters in email's subject line. Default: 67. |
|
130 | 130 | |
|
131 | 131 | notify.diffstat |
|
132 | 132 | Set to True to include a diffstat before diff content. Default: True. |
|
133 | 133 | |
|
134 | 134 | notify.showfunc |
|
135 | 135 | If set, override "diff.showfunc" for the diff content. Default: None. |
|
136 | 136 | |
|
137 | 137 | notify.merge |
|
138 | 138 | If True, send notifications for merge changesets. Default: True. |
|
139 | 139 | |
|
140 | 140 | notify.mbox |
|
141 | 141 | If set, append mails to this mbox file instead of sending. Default: None. |
|
142 | 142 | |
|
143 | 143 | notify.fromauthor |
|
144 | 144 | If set, use the committer of the first changeset in a changegroup for the |
|
145 | 145 | "From" field of the notification mail. If not set, take the user from the |
|
146 | 146 | pushing repo. Default: False. |
|
147 | 147 | |
|
148 | 148 | If set, the following entries will also be used to customize the |
|
149 | 149 | notifications: |
|
150 | 150 | |
|
151 | 151 | email.from |
|
152 | 152 | Email "From" address to use if none can be found in the generated email |
|
153 | 153 | content. |
|
154 | 154 | |
|
155 | 155 | web.baseurl |
|
156 | 156 | Root repository URL to combine with repository paths when making references. |
|
157 | 157 | See also "notify.strip". |
|
158 | 158 | |
|
159 | 159 | no commands defined |
|
160 | 160 | $ hg init a |
|
161 | 161 | $ echo a > a/a |
|
162 | 162 | $ echo b > a/b |
|
163 | 163 | |
|
164 | 164 | commit |
|
165 | 165 | |
|
166 | 166 | $ hg --cwd a commit -Ama -d '0 0' |
|
167 | 167 | adding a |
|
168 | 168 | adding b |
|
169 | 169 | |
|
170 | 170 | clone |
|
171 | 171 | |
|
172 | 172 | $ hg --traceback clone a b |
|
173 | 173 | updating to branch default |
|
174 | 174 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 175 | $ echo a >> a/a |
|
176 | 176 | $ echo b >> a/b |
|
177 | 177 | |
|
178 | 178 | commit |
|
179 | 179 | |
|
180 | 180 | $ hg --traceback --cwd a commit -Amb -d '1 0' |
|
181 | 181 | |
|
182 | 182 | on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line |
|
183 | 183 | |
|
184 | 184 | $ cat <<EOF >> $HGRCPATH |
|
185 | 185 | > [notify] |
|
186 | 186 | > maxsubject = 200 |
|
187 | 187 | > EOF |
|
188 | 188 | |
|
189 | 189 | the python call below wraps continuation lines, which appear on Mac OS X 10.5 because |
|
190 | 190 | of the very long subject line |
|
191 | 191 | pull (minimal config) |
|
192 | 192 | |
|
193 | 193 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
194 | 194 | pulling from ../a |
|
195 | 195 | searching for changes |
|
196 | 196 | adding changesets |
|
197 | 197 | adding manifests |
|
198 | 198 | adding file changes |
|
199 | 199 | added 1 changesets with 2 changes to 2 files |
|
200 | 200 | new changesets 00a13f371396 |
|
201 | 201 | MIME-Version: 1.0 |
|
202 | 202 | Content-Type: text/plain; charset="us-ascii" |
|
203 | 203 | Content-Transfer-Encoding: 7bit |
|
204 | 204 | Date: * (glob) |
|
205 | 205 | Subject: changeset in $TESTTMP/b: b |
|
206 | 206 | From: test |
|
207 | 207 | X-Hg-Notification: changeset 00a13f371396 |
|
208 | 208 | Message-Id: <*> (glob) |
|
209 | 209 | To: baz, foo@bar |
|
210 | 210 | |
|
211 | 211 | changeset 00a13f371396 in $TESTTMP/b |
|
212 | 212 | details: $TESTTMP/b?cmd=changeset;node=00a13f371396 |
|
213 | 213 | description: b |
|
214 | 214 | |
|
215 | 215 | diffs (12 lines): |
|
216 | 216 | |
|
217 | 217 | diff -r 0cd96de13884 -r 00a13f371396 a |
|
218 | 218 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
219 | 219 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
220 | 220 | @@ -1,1 +1,2 @@ a |
|
221 | 221 | +a |
|
222 | 222 | diff -r 0cd96de13884 -r 00a13f371396 b |
|
223 | 223 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
224 | 224 | +++ b/b Thu Jan 01 00:00:01 1970 +0000 |
|
225 | 225 | @@ -1,1 +1,2 @@ b |
|
226 | 226 | +b |
|
227 | 227 | (run 'hg update' to get a working copy) |
|
228 | 228 | |
|
229 | 229 | $ cat <<EOF >> $HGRCPATH |
|
230 | 230 | > [notify] |
|
231 | 231 | > config = `pwd`/.notify.conf |
|
232 | 232 | > domain = test.com |
|
233 | 233 | > strip = 42 |
|
234 | 234 | > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} |
|
235 | 235 | > |
|
236 | 236 | > [web] |
|
237 | 237 | > baseurl = http://test/ |
|
238 | 238 | > EOF |
|
239 | 239 | |
|
240 | 240 | fail for config file is missing |
|
241 | 241 | |
|
242 | 242 | $ hg --cwd b rollback |
|
243 | 243 | repository tip rolled back to revision 0 (undo pull) |
|
244 | 244 | $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed |
|
245 | 245 | pull failed |
|
246 | 246 | $ touch ".notify.conf" |
|
247 | 247 | |
|
248 | 248 | pull |
|
249 | 249 | |
|
250 | 250 | $ hg --cwd b rollback |
|
251 | 251 | repository tip rolled back to revision 0 (undo pull) |
|
252 | 252 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
253 | 253 | pulling from ../a |
|
254 | 254 | searching for changes |
|
255 | 255 | adding changesets |
|
256 | 256 | adding manifests |
|
257 | 257 | adding file changes |
|
258 | 258 | added 1 changesets with 2 changes to 2 files |
|
259 | 259 | new changesets 00a13f371396 |
|
260 | 260 | MIME-Version: 1.0 |
|
261 | 261 | Content-Type: text/plain; charset="us-ascii" |
|
262 | 262 | Content-Transfer-Encoding: 7bit |
|
263 | 263 | X-Test: foo |
|
264 | 264 | Date: * (glob) |
|
265 | 265 | Subject: b |
|
266 | 266 | From: test@test.com |
|
267 | 267 | X-Hg-Notification: changeset 00a13f371396 |
|
268 | 268 | Message-Id: <*> (glob) |
|
269 | 269 | To: baz@test.com, foo@bar |
|
270 | 270 | |
|
271 | 271 | changeset 00a13f371396 in b |
|
272 | 272 | description: b |
|
273 | 273 | diffs (12 lines): |
|
274 | 274 | |
|
275 | 275 | diff -r 0cd96de13884 -r 00a13f371396 a |
|
276 | 276 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
277 | 277 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
278 | 278 | @@ -1,1 +1,2 @@ a |
|
279 | 279 | +a |
|
280 | 280 | diff -r 0cd96de13884 -r 00a13f371396 b |
|
281 | 281 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
282 | 282 | +++ b/b Thu Jan 01 00:00:01 1970 +0000 |
|
283 | 283 | @@ -1,1 +1,2 @@ b |
|
284 | 284 | +b |
|
285 | 285 | (run 'hg update' to get a working copy) |
|
286 | 286 | |
|
287 | 287 | $ cat << EOF >> $HGRCPATH |
|
288 | 288 | > [hooks] |
|
289 | 289 | > incoming.notify = python:hgext.notify.hook |
|
290 | 290 | > |
|
291 | 291 | > [notify] |
|
292 | 292 | > sources = pull |
|
293 | 293 | > diffstat = True |
|
294 | 294 | > EOF |
|
295 | 295 | |
|
296 | 296 | pull |
|
297 | 297 | |
|
298 | 298 | $ hg --cwd b rollback |
|
299 | 299 | repository tip rolled back to revision 0 (undo pull) |
|
300 | 300 | $ hg --traceback --config notify.maxdiffstat=1 --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
301 | 301 | pulling from ../a |
|
302 | 302 | searching for changes |
|
303 | 303 | adding changesets |
|
304 | 304 | adding manifests |
|
305 | 305 | adding file changes |
|
306 | 306 | added 1 changesets with 2 changes to 2 files |
|
307 | 307 | new changesets 00a13f371396 |
|
308 | 308 | MIME-Version: 1.0 |
|
309 | 309 | Content-Type: text/plain; charset="us-ascii" |
|
310 | 310 | Content-Transfer-Encoding: 7bit |
|
311 | 311 | X-Test: foo |
|
312 | 312 | Date: * (glob) |
|
313 | 313 | Subject: b |
|
314 | 314 | From: test@test.com |
|
315 | 315 | X-Hg-Notification: changeset 00a13f371396 |
|
316 | 316 | Message-Id: <*> (glob) |
|
317 | 317 | To: baz@test.com, foo@bar |
|
318 | 318 | |
|
319 | 319 | changeset 00a13f371396 in b |
|
320 | 320 | description: b |
|
321 | 321 | diffstat (truncated from 2 to 1 lines): |
|
322 | 322 | a | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) |
|
323 | 323 | |
|
324 | 324 | diffs (12 lines): |
|
325 | 325 | |
|
326 | 326 | diff -r 0cd96de13884 -r 00a13f371396 a |
|
327 | 327 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
328 | 328 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
329 | 329 | @@ -1,1 +1,2 @@ a |
|
330 | 330 | +a |
|
331 | 331 | diff -r 0cd96de13884 -r 00a13f371396 b |
|
332 | 332 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
333 | 333 | +++ b/b Thu Jan 01 00:00:01 1970 +0000 |
|
334 | 334 | @@ -1,1 +1,2 @@ b |
|
335 | 335 | +b |
|
336 | 336 | (run 'hg update' to get a working copy) |
|
337 | 337 | |
|
338 | 338 | test merge |
|
339 | 339 | |
|
340 | 340 | $ cd a |
|
341 | 341 | $ hg up -C 0 |
|
342 | 342 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
343 | 343 | $ echo a >> a |
|
344 | 344 | $ hg ci -Am adda2 -d '2 0' |
|
345 | 345 | created new head |
|
346 | 346 | $ hg merge |
|
347 | 347 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
348 | 348 | (branch merge, don't forget to commit) |
|
349 | 349 | $ hg ci -m merge -d '3 0' |
|
350 | 350 | $ cd .. |
|
351 | 351 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
352 | 352 | pulling from ../a |
|
353 | 353 | searching for changes |
|
354 | 354 | adding changesets |
|
355 | 355 | adding manifests |
|
356 | 356 | adding file changes |
|
357 | 357 | added 2 changesets with 0 changes to 0 files |
|
358 | 358 | new changesets 3332653e1f3c:fccf66cd0c35 |
|
359 | 359 | MIME-Version: 1.0 |
|
360 | 360 | Content-Type: text/plain; charset="us-ascii" |
|
361 | 361 | Content-Transfer-Encoding: 7bit |
|
362 | 362 | X-Test: foo |
|
363 | 363 | Date: * (glob) |
|
364 | 364 | Subject: adda2 |
|
365 | 365 | From: test@test.com |
|
366 | 366 | X-Hg-Notification: changeset 3332653e1f3c |
|
367 | 367 | Message-Id: <*> (glob) |
|
368 | 368 | To: baz@test.com, foo@bar |
|
369 | 369 | |
|
370 | 370 | changeset 3332653e1f3c in b |
|
371 | 371 | description: adda2 |
|
372 | 372 | diffstat: |
|
373 | 373 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
374 | 374 | |
|
375 | 375 | diffs (6 lines): |
|
376 | 376 | |
|
377 | 377 | diff -r 0cd96de13884 -r 3332653e1f3c a |
|
378 | 378 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
379 | 379 | +++ b/a Thu Jan 01 00:00:02 1970 +0000 |
|
380 | 380 | @@ -1,1 +1,2 @@ a |
|
381 | 381 | +a |
|
382 | 382 | MIME-Version: 1.0 |
|
383 | 383 | Content-Type: text/plain; charset="us-ascii" |
|
384 | 384 | Content-Transfer-Encoding: 7bit |
|
385 | 385 | X-Test: foo |
|
386 | 386 | Date: * (glob) |
|
387 | 387 | Subject: merge |
|
388 | 388 | From: test@test.com |
|
389 | 389 | X-Hg-Notification: changeset fccf66cd0c35 |
|
390 | 390 | Message-Id: <*> (glob) |
|
391 | 391 | To: baz@test.com, foo@bar |
|
392 | 392 | |
|
393 | 393 | changeset fccf66cd0c35 in b |
|
394 | 394 | description: merge |
|
395 | 395 | diffstat: |
|
396 | 396 | b | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
397 | 397 | |
|
398 | 398 | diffs (6 lines): |
|
399 | 399 | |
|
400 | 400 | diff -r 3332653e1f3c -r fccf66cd0c35 b |
|
401 | 401 | --- a/b Thu Jan 01 00:00:02 1970 +0000 |
|
402 | 402 | +++ b/b Thu Jan 01 00:00:03 1970 +0000 |
|
403 | 403 | @@ -1,1 +1,2 @@ b |
|
404 | 404 | +b |
|
405 | 405 | (run 'hg update' to get a working copy) |
|
406 | 406 | |
|
407 | 407 | non-ascii content and truncation of multi-byte subject |
|
408 | 408 | |
|
409 | 409 | $ cat <<EOF >> $HGRCPATH |
|
410 | 410 | > [notify] |
|
411 | 411 | > maxsubject = 4 |
|
412 | 412 | > EOF |
|
413 | 413 | $ echo a >> a/a |
|
414 | 414 | $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \ |
|
415 |
> -m `"$PYTHON" -c 'print |
|
|
415 | > -m `"$PYTHON" -c 'print("\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4")'` | |
|
416 | 416 | $ hg --traceback --cwd b --encoding utf-8 pull ../a | \ |
|
417 | 417 | > "$PYTHON" $TESTTMP/filter.py |
|
418 | 418 | pulling from ../a |
|
419 | 419 | searching for changes |
|
420 | 420 | adding changesets |
|
421 | 421 | adding manifests |
|
422 | 422 | adding file changes |
|
423 | 423 | added 1 changesets with 1 changes to 1 files |
|
424 | 424 | new changesets 0f25f9c22b4c |
|
425 | 425 | MIME-Version: 1.0 |
|
426 | 426 | Content-Type: text/plain; charset="us-ascii" |
|
427 | 427 | Content-Transfer-Encoding: 8bit |
|
428 | 428 | X-Test: foo |
|
429 | 429 | Date: * (glob) |
|
430 | 430 | Subject: \xc3\xa0... (esc) |
|
431 | 431 | From: test@test.com |
|
432 | 432 | X-Hg-Notification: changeset 0f25f9c22b4c |
|
433 | 433 | Message-Id: <*> (glob) |
|
434 | 434 | To: baz@test.com, foo@bar |
|
435 | 435 | |
|
436 | 436 | changeset 0f25f9c22b4c in b |
|
437 | 437 | description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc) |
|
438 | 438 | diffstat: |
|
439 | 439 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
440 | 440 | |
|
441 | 441 | diffs (7 lines): |
|
442 | 442 | |
|
443 | 443 | diff -r fccf66cd0c35 -r 0f25f9c22b4c a |
|
444 | 444 | --- a/a Thu Jan 01 00:00:03 1970 +0000 |
|
445 | 445 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
446 | 446 | @@ -1,2 +1,3 @@ a a |
|
447 | 447 | +a |
|
448 | 448 | (run 'hg update' to get a working copy) |
|
449 | 449 | |
|
450 | 450 | long lines |
|
451 | 451 | |
|
452 | 452 | $ cat <<EOF >> $HGRCPATH |
|
453 | 453 | > [notify] |
|
454 | 454 | > maxsubject = 67 |
|
455 | 455 | > test = False |
|
456 | 456 | > mbox = mbox |
|
457 | 457 | > EOF |
|
458 | 458 | $ "$PYTHON" -c 'open("a/a", "ab").write("no" * 500 + "\xd1\x84" + "\n")' |
|
459 | 459 | $ hg --cwd a commit -A -m "long line" |
|
460 | 460 | $ hg --traceback --cwd b pull ../a |
|
461 | 461 | pulling from ../a |
|
462 | 462 | searching for changes |
|
463 | 463 | adding changesets |
|
464 | 464 | adding manifests |
|
465 | 465 | adding file changes |
|
466 | 466 | added 1 changesets with 1 changes to 1 files |
|
467 | 467 | new changesets a846b5f6ebb7 |
|
468 | 468 | notify: sending 2 subscribers 1 changes |
|
469 | 469 | (run 'hg update' to get a working copy) |
|
470 | 470 | $ "$PYTHON" $TESTTMP/filter.py < b/mbox |
|
471 | 471 | From test@test.com ... ... .. ..:..:.. .... (re) |
|
472 | 472 | MIME-Version: 1.0 |
|
473 | 473 | Content-Type: text/plain; charset="*" (glob) |
|
474 | 474 | Content-Transfer-Encoding: quoted-printable |
|
475 | 475 | X-Test: foo |
|
476 | 476 | Date: * (glob) |
|
477 | 477 | Subject: long line |
|
478 | 478 | From: test@test.com |
|
479 | 479 | X-Hg-Notification: changeset a846b5f6ebb7 |
|
480 | 480 | Message-Id: <hg.a846b5f6ebb7.*.*@*> (glob) |
|
481 | 481 | To: baz@test.com, foo@bar |
|
482 | 482 | |
|
483 | 483 | changeset a846b5f6ebb7 in b |
|
484 | 484 | description: long line |
|
485 | 485 | diffstat: |
|
486 | 486 | a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) |
|
487 | 487 | |
|
488 | 488 | diffs (8 lines): |
|
489 | 489 | |
|
490 | 490 | diff -r 0f25f9c22b4c -r a846b5f6ebb7 a |
|
491 | 491 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
492 | 492 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
493 | 493 | @@ -1,3 +1,4 @@ a a a |
|
494 | 494 | +nonononononononononononononononononononononononononononononononononononono= |
|
495 | 495 | nononononononononononononononononononononononononononononononononononononon= |
|
496 | 496 | ononononononononononononononononononononononononononononononononononononono= |
|
497 | 497 | nononononononononononononononononononononononononononononononononononononon= |
|
498 | 498 | ononononononononononononononononononononononononononononononononononononono= |
|
499 | 499 | nononononononononononononononononononononononononononononononononononononon= |
|
500 | 500 | ononononononononononononononononononononononononononononononononononononono= |
|
501 | 501 | nononononononononononononononononononononononononononononononononononononon= |
|
502 | 502 | ononononononononononononononononononononononononononononononononononononono= |
|
503 | 503 | nononononononononononononononononononononononononononononononononononononon= |
|
504 | 504 | ononononononononononononononononononononononononononononononononononononono= |
|
505 | 505 | nononononononononononononononononononononononononononononononononononononon= |
|
506 | 506 | ononononononononononononononononononononononononononononononononononononono= |
|
507 | 507 | nonononononononononononono=D1=84 |
|
508 | 508 | |
|
509 | 509 | revset selection: send to address that matches branch and repo |
|
510 | 510 | |
|
511 | 511 | $ cat << EOF >> $HGRCPATH |
|
512 | 512 | > [hooks] |
|
513 | 513 | > incoming.notify = python:hgext.notify.hook |
|
514 | 514 | > |
|
515 | 515 | > [notify] |
|
516 | 516 | > sources = pull |
|
517 | 517 | > test = True |
|
518 | 518 | > diffstat = False |
|
519 | 519 | > maxdiff = 0 |
|
520 | 520 | > |
|
521 | 521 | > [reposubs] |
|
522 | 522 | > */a#branch(test) = will_no_be_send@example.com |
|
523 | 523 | > */b#branch(test) = notify@example.com |
|
524 | 524 | > EOF |
|
525 | 525 | $ hg --cwd a branch test |
|
526 | 526 | marked working directory as branch test |
|
527 | 527 | (branches are permanent and global, did you want a bookmark?) |
|
528 | 528 | $ echo a >> a/a |
|
529 | 529 | $ hg --cwd a ci -m test -d '1 0' |
|
530 | 530 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
531 | 531 | pulling from ../a |
|
532 | 532 | searching for changes |
|
533 | 533 | adding changesets |
|
534 | 534 | adding manifests |
|
535 | 535 | adding file changes |
|
536 | 536 | added 1 changesets with 1 changes to 1 files |
|
537 | 537 | new changesets f7e5aaed4080 |
|
538 | 538 | MIME-Version: 1.0 |
|
539 | 539 | Content-Type: text/plain; charset="us-ascii" |
|
540 | 540 | Content-Transfer-Encoding: 7bit |
|
541 | 541 | X-Test: foo |
|
542 | 542 | Date: * (glob) |
|
543 | 543 | Subject: test |
|
544 | 544 | From: test@test.com |
|
545 | 545 | X-Hg-Notification: changeset f7e5aaed4080 |
|
546 | 546 | Message-Id: <hg.f7e5aaed4080.*.*@*> (glob) |
|
547 | 547 | To: baz@test.com, foo@bar, notify@example.com |
|
548 | 548 | |
|
549 | 549 | changeset f7e5aaed4080 in b |
|
550 | 550 | description: test |
|
551 | 551 | (run 'hg update' to get a working copy) |
|
552 | 552 | |
|
553 | 553 | revset selection: don't send to address that waits for mails |
|
554 | 554 | from different branch |
|
555 | 555 | |
|
556 | 556 | $ hg --cwd a update default |
|
557 | 557 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
558 | 558 | $ echo a >> a/a |
|
559 | 559 | $ hg --cwd a ci -m test -d '1 0' |
|
560 | 560 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py |
|
561 | 561 | pulling from ../a |
|
562 | 562 | searching for changes |
|
563 | 563 | adding changesets |
|
564 | 564 | adding manifests |
|
565 | 565 | adding file changes |
|
566 | 566 | added 1 changesets with 0 changes to 0 files (+1 heads) |
|
567 | 567 | new changesets 645eb6690ecf |
|
568 | 568 | MIME-Version: 1.0 |
|
569 | 569 | Content-Type: text/plain; charset="us-ascii" |
|
570 | 570 | Content-Transfer-Encoding: 7bit |
|
571 | 571 | X-Test: foo |
|
572 | 572 | Date: * (glob) |
|
573 | 573 | Subject: test |
|
574 | 574 | From: test@test.com |
|
575 | 575 | X-Hg-Notification: changeset 645eb6690ecf |
|
576 | 576 | Message-Id: <hg.645eb6690ecf.*.*@*> (glob) |
|
577 | 577 | To: baz@test.com, foo@bar |
|
578 | 578 | |
|
579 | 579 | changeset 645eb6690ecf in b |
|
580 | 580 | description: test |
|
581 | 581 | (run 'hg heads' to see heads) |
|
582 | 582 | |
|
583 | 583 | default template: |
|
584 | 584 | |
|
585 | 585 | $ grep -v '^template =' $HGRCPATH > "$HGRCPATH.new" |
|
586 | 586 | $ mv "$HGRCPATH.new" $HGRCPATH |
|
587 | 587 | $ echo a >> a/a |
|
588 | 588 | $ hg --cwd a commit -m 'default template' |
|
589 | 589 | $ hg --cwd b pull ../a -q | "$PYTHON" $TESTTMP/filter.py |
|
590 | 590 | MIME-Version: 1.0 |
|
591 | 591 | Content-Type: text/plain; charset="us-ascii" |
|
592 | 592 | Content-Transfer-Encoding: 7bit |
|
593 | 593 | Date: * (glob) |
|
594 | 594 | Subject: changeset in b: default template |
|
595 | 595 | From: test@test.com |
|
596 | 596 | X-Hg-Notification: changeset 5cd4346eed47 |
|
597 | 597 | Message-Id: <hg.5cd4346eed47.*.*@*> (glob) |
|
598 | 598 | To: baz@test.com, foo@bar |
|
599 | 599 | |
|
600 | 600 | changeset 5cd4346eed47 in $TESTTMP/b |
|
601 | 601 | details: http://test/b?cmd=changeset;node=5cd4346eed47 |
|
602 | 602 | description: default template |
|
603 | 603 | |
|
604 | 604 | with style: |
|
605 | 605 | |
|
606 | 606 | $ cat <<EOF > notifystyle.map |
|
607 | 607 | > changeset = "Subject: {desc|firstline|strip} |
|
608 | 608 | > From: {author} |
|
609 | 609 | > {""} |
|
610 | 610 | > changeset {node|short}" |
|
611 | 611 | > EOF |
|
612 | 612 | $ cat <<EOF >> $HGRCPATH |
|
613 | 613 | > [notify] |
|
614 | 614 | > style = $TESTTMP/notifystyle.map |
|
615 | 615 | > EOF |
|
616 | 616 | $ echo a >> a/a |
|
617 | 617 | $ hg --cwd a commit -m 'with style' |
|
618 | 618 | $ hg --cwd b pull ../a -q | "$PYTHON" $TESTTMP/filter.py |
|
619 | 619 | MIME-Version: 1.0 |
|
620 | 620 | Content-Type: text/plain; charset="us-ascii" |
|
621 | 621 | Content-Transfer-Encoding: 7bit |
|
622 | 622 | Date: * (glob) |
|
623 | 623 | Subject: with style |
|
624 | 624 | From: test@test.com |
|
625 | 625 | X-Hg-Notification: changeset ec8d9d852f56 |
|
626 | 626 | Message-Id: <hg.ec8d9d852f56.*.*@*> (glob) |
|
627 | 627 | To: baz@test.com, foo@bar |
|
628 | 628 | |
|
629 | 629 | changeset ec8d9d852f56 |
|
630 | 630 | |
|
631 | 631 | with template (overrides style): |
|
632 | 632 | |
|
633 | 633 | $ cat <<EOF >> $HGRCPATH |
|
634 | 634 | > template = Subject: {node|short}: {desc|firstline|strip} |
|
635 | 635 | > From: {author} |
|
636 | 636 | > {""} |
|
637 | 637 | > {desc} |
|
638 | 638 | > EOF |
|
639 | 639 | $ echo a >> a/a |
|
640 | 640 | $ hg --cwd a commit -m 'with template' |
|
641 | 641 | $ hg --cwd b pull ../a -q | "$PYTHON" $TESTTMP/filter.py |
|
642 | 642 | MIME-Version: 1.0 |
|
643 | 643 | Content-Type: text/plain; charset="us-ascii" |
|
644 | 644 | Content-Transfer-Encoding: 7bit |
|
645 | 645 | Date: * (glob) |
|
646 | 646 | Subject: 14721b538ae3: with template |
|
647 | 647 | From: test@test.com |
|
648 | 648 | X-Hg-Notification: changeset 14721b538ae3 |
|
649 | 649 | Message-Id: <hg.14721b538ae3.*.*@*> (glob) |
|
650 | 650 | To: baz@test.com, foo@bar |
|
651 | 651 | |
|
652 | 652 | with template |
|
653 | 653 | |
|
654 | 654 | showfunc diff |
|
655 | 655 | $ cat <<EOF >> $HGRCPATH |
|
656 | 656 | > showfunc = True |
|
657 | 657 | > template = |
|
658 | 658 | > maxdiff = -1 |
|
659 | 659 | > EOF |
|
660 | 660 | $ cd a |
|
661 | 661 | $ cat > f1 << EOF |
|
662 | 662 | > int main() { |
|
663 | 663 | > int a = 0; |
|
664 | 664 | > int b = 1; |
|
665 | 665 | > int c = 2; |
|
666 | 666 | > int d = 3; |
|
667 | 667 | > return a + b + c + d; |
|
668 | 668 | > } |
|
669 | 669 | > EOF |
|
670 | 670 | $ hg commit -Am addfunction |
|
671 | 671 | adding f1 |
|
672 | 672 | $ hg --cwd ../b pull ../a |
|
673 | 673 | pulling from ../a |
|
674 | 674 | searching for changes |
|
675 | 675 | adding changesets |
|
676 | 676 | adding manifests |
|
677 | 677 | adding file changes |
|
678 | 678 | added 1 changesets with 1 changes to 1 files |
|
679 | 679 | new changesets b86bc16ff894 |
|
680 | 680 | MIME-Version: 1.0 |
|
681 | 681 | Content-Type: text/plain; charset="us-ascii" |
|
682 | 682 | Content-Transfer-Encoding: 7bit |
|
683 | 683 | Date: * (glob) |
|
684 | 684 | Subject: addfunction |
|
685 | 685 | From: test@test.com |
|
686 | 686 | X-Hg-Notification: changeset b86bc16ff894 |
|
687 | 687 | Message-Id: <hg.b86bc16ff894.*.*@*> (glob) |
|
688 | 688 | To: baz@test.com, foo@bar |
|
689 | 689 | |
|
690 | 690 | changeset b86bc16ff894 |
|
691 | 691 | diffs (11 lines): |
|
692 | 692 | |
|
693 | 693 | diff -r 14721b538ae3 -r b86bc16ff894 f1 |
|
694 | 694 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
695 | 695 | +++ b/f1 Thu Jan 01 00:00:00 1970 +0000 |
|
696 | 696 | @@ -0,0 +1,7 @@ |
|
697 | 697 | +int main() { |
|
698 | 698 | + int a = 0; |
|
699 | 699 | + int b = 1; |
|
700 | 700 | + int c = 2; |
|
701 | 701 | + int d = 3; |
|
702 | 702 | + return a + b + c + d; |
|
703 | 703 | +} |
|
704 | 704 | (run 'hg update' to get a working copy) |
|
705 | 705 | $ cat > f1 << EOF |
|
706 | 706 | > int main() { |
|
707 | 707 | > int a = 0; |
|
708 | 708 | > int b = 1; |
|
709 | 709 | > int c = 2; |
|
710 | 710 | > int e = 3; |
|
711 | 711 | > return a + b + c + e; |
|
712 | 712 | > } |
|
713 | 713 | > EOF |
|
714 | 714 | $ hg commit -m changefunction |
|
715 | 715 | $ hg --cwd ../b --config notify.showfunc=True pull ../a |
|
716 | 716 | pulling from ../a |
|
717 | 717 | searching for changes |
|
718 | 718 | adding changesets |
|
719 | 719 | adding manifests |
|
720 | 720 | adding file changes |
|
721 | 721 | added 1 changesets with 1 changes to 1 files |
|
722 | 722 | new changesets e81040e9838c |
|
723 | 723 | MIME-Version: 1.0 |
|
724 | 724 | Content-Type: text/plain; charset="us-ascii" |
|
725 | 725 | Content-Transfer-Encoding: 7bit |
|
726 | 726 | Date: * (glob) |
|
727 | 727 | Subject: changefunction |
|
728 | 728 | From: test@test.com |
|
729 | 729 | X-Hg-Notification: changeset e81040e9838c |
|
730 | 730 | Message-Id: <hg.e81040e9838c.*.*@*> (glob) |
|
731 | 731 | To: baz@test.com, foo@bar |
|
732 | 732 | |
|
733 | 733 | changeset e81040e9838c |
|
734 | 734 | diffs (12 lines): |
|
735 | 735 | |
|
736 | 736 | diff -r b86bc16ff894 -r e81040e9838c f1 |
|
737 | 737 | --- a/f1 Thu Jan 01 00:00:00 1970 +0000 |
|
738 | 738 | +++ b/f1 Thu Jan 01 00:00:00 1970 +0000 |
|
739 | 739 | @@ -2,6 +2,6 @@ int main() { |
|
740 | 740 | int a = 0; |
|
741 | 741 | int b = 1; |
|
742 | 742 | int c = 2; |
|
743 | 743 | - int d = 3; |
|
744 | 744 | - return a + b + c + d; |
|
745 | 745 | + int e = 3; |
|
746 | 746 | + return a + b + c + e; |
|
747 | 747 | } |
|
748 | 748 | (run 'hg update' to get a working copy) |
@@ -1,1854 +1,1854 b'' | |||
|
1 | 1 | $ HGENCODING=utf-8 |
|
2 | 2 | $ export HGENCODING |
|
3 | 3 | $ cat >> $HGRCPATH << EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > drawdag=$TESTDIR/drawdag.py |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ try() { |
|
9 | 9 | > hg debugrevspec --debug "$@" |
|
10 | 10 | > } |
|
11 | 11 | |
|
12 | 12 | $ log() { |
|
13 | 13 | > hg log --template '{rev}\n' -r "$1" |
|
14 | 14 | > } |
|
15 | 15 | |
|
16 | 16 | $ hg init repo |
|
17 | 17 | $ cd repo |
|
18 | 18 | |
|
19 | 19 | $ echo a > a |
|
20 | 20 | $ hg branch a |
|
21 | 21 | marked working directory as branch a |
|
22 | 22 | (branches are permanent and global, did you want a bookmark?) |
|
23 | 23 | $ hg ci -Aqm0 |
|
24 | 24 | |
|
25 | 25 | $ echo b > b |
|
26 | 26 | $ hg branch b |
|
27 | 27 | marked working directory as branch b |
|
28 | 28 | $ hg ci -Aqm1 |
|
29 | 29 | |
|
30 | 30 | $ rm a |
|
31 | 31 | $ hg branch a-b-c- |
|
32 | 32 | marked working directory as branch a-b-c- |
|
33 | 33 | $ hg ci -Aqm2 -u Bob |
|
34 | 34 | |
|
35 | 35 | $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n' |
|
36 | 36 | 2 |
|
37 | 37 | $ hg log -r "extra('branch')" --template '{rev}\n' |
|
38 | 38 | 0 |
|
39 | 39 | 1 |
|
40 | 40 | 2 |
|
41 | 41 | $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n' |
|
42 | 42 | 0 a |
|
43 | 43 | 2 a-b-c- |
|
44 | 44 | |
|
45 | 45 | $ hg co 1 |
|
46 | 46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
47 | 47 | $ hg branch +a+b+c+ |
|
48 | 48 | marked working directory as branch +a+b+c+ |
|
49 | 49 | $ hg ci -Aqm3 |
|
50 | 50 | |
|
51 | 51 | $ hg co 2 # interleave |
|
52 | 52 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
53 | 53 | $ echo bb > b |
|
54 | 54 | $ hg branch -- -a-b-c- |
|
55 | 55 | marked working directory as branch -a-b-c- |
|
56 | 56 | $ hg ci -Aqm4 -d "May 12 2005" |
|
57 | 57 | |
|
58 | 58 | $ hg co 3 |
|
59 | 59 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
60 | 60 | $ hg branch !a/b/c/ |
|
61 | 61 | marked working directory as branch !a/b/c/ |
|
62 | 62 | $ hg ci -Aqm"5 bug" |
|
63 | 63 | |
|
64 | 64 | $ hg merge 4 |
|
65 | 65 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
66 | 66 | (branch merge, don't forget to commit) |
|
67 | 67 | $ hg branch _a_b_c_ |
|
68 | 68 | marked working directory as branch _a_b_c_ |
|
69 | 69 | $ hg ci -Aqm"6 issue619" |
|
70 | 70 | |
|
71 | 71 | $ hg branch .a.b.c. |
|
72 | 72 | marked working directory as branch .a.b.c. |
|
73 | 73 | $ hg ci -Aqm7 |
|
74 | 74 | |
|
75 | 75 | $ hg branch all |
|
76 | 76 | marked working directory as branch all |
|
77 | 77 | |
|
78 | 78 | $ hg co 4 |
|
79 | 79 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
80 | 80 | $ hg branch Γ© |
|
81 | 81 | marked working directory as branch \xc3\xa9 (esc) |
|
82 | 82 | $ hg ci -Aqm9 |
|
83 | 83 | |
|
84 | 84 | $ hg tag -r6 1.0 |
|
85 | 85 | $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
86 | 86 | |
|
87 | 87 | $ hg clone --quiet -U -r 7 . ../remote1 |
|
88 | 88 | $ hg clone --quiet -U -r 8 . ../remote2 |
|
89 | 89 | $ echo "[paths]" >> .hg/hgrc |
|
90 | 90 | $ echo "default = ../remote1" >> .hg/hgrc |
|
91 | 91 | |
|
92 | 92 | test subtracting something from an addset |
|
93 | 93 | |
|
94 | 94 | $ log '(outgoing() or removes(a)) - removes(a)' |
|
95 | 95 | 8 |
|
96 | 96 | 9 |
|
97 | 97 | |
|
98 | 98 | test intersecting something with an addset |
|
99 | 99 | |
|
100 | 100 | $ log 'parents(outgoing() or removes(a))' |
|
101 | 101 | 1 |
|
102 | 102 | 4 |
|
103 | 103 | 5 |
|
104 | 104 | 8 |
|
105 | 105 | |
|
106 | 106 | test that `or` operation combines elements in the right order: |
|
107 | 107 | |
|
108 | 108 | $ log '3:4 or 2:5' |
|
109 | 109 | 3 |
|
110 | 110 | 4 |
|
111 | 111 | 2 |
|
112 | 112 | 5 |
|
113 | 113 | $ log '3:4 or 5:2' |
|
114 | 114 | 3 |
|
115 | 115 | 4 |
|
116 | 116 | 5 |
|
117 | 117 | 2 |
|
118 | 118 | $ log 'sort(3:4 or 2:5)' |
|
119 | 119 | 2 |
|
120 | 120 | 3 |
|
121 | 121 | 4 |
|
122 | 122 | 5 |
|
123 | 123 | $ log 'sort(3:4 or 5:2)' |
|
124 | 124 | 2 |
|
125 | 125 | 3 |
|
126 | 126 | 4 |
|
127 | 127 | 5 |
|
128 | 128 | |
|
129 | 129 | test that more than one `-r`s are combined in the right order and deduplicated: |
|
130 | 130 | |
|
131 | 131 | $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)' |
|
132 | 132 | 3 |
|
133 | 133 | 4 |
|
134 | 134 | 5 |
|
135 | 135 | 2 |
|
136 | 136 | 0 |
|
137 | 137 | 1 |
|
138 | 138 | |
|
139 | 139 | test that `or` operation skips duplicated revisions from right-hand side |
|
140 | 140 | |
|
141 | 141 | $ try 'reverse(1::5) or ancestors(4)' |
|
142 | 142 | (or |
|
143 | 143 | (list |
|
144 | 144 | (func |
|
145 | 145 | (symbol 'reverse') |
|
146 | 146 | (dagrange |
|
147 | 147 | (symbol '1') |
|
148 | 148 | (symbol '5'))) |
|
149 | 149 | (func |
|
150 | 150 | (symbol 'ancestors') |
|
151 | 151 | (symbol '4')))) |
|
152 | 152 | * set: |
|
153 | 153 | <addset |
|
154 | 154 | <baseset- [1, 3, 5]>, |
|
155 | 155 | <generatorsetdesc+>> |
|
156 | 156 | 5 |
|
157 | 157 | 3 |
|
158 | 158 | 1 |
|
159 | 159 | 0 |
|
160 | 160 | 2 |
|
161 | 161 | 4 |
|
162 | 162 | $ try 'sort(ancestors(4) or reverse(1::5))' |
|
163 | 163 | (func |
|
164 | 164 | (symbol 'sort') |
|
165 | 165 | (or |
|
166 | 166 | (list |
|
167 | 167 | (func |
|
168 | 168 | (symbol 'ancestors') |
|
169 | 169 | (symbol '4')) |
|
170 | 170 | (func |
|
171 | 171 | (symbol 'reverse') |
|
172 | 172 | (dagrange |
|
173 | 173 | (symbol '1') |
|
174 | 174 | (symbol '5')))))) |
|
175 | 175 | * set: |
|
176 | 176 | <addset+ |
|
177 | 177 | <generatorsetdesc+>, |
|
178 | 178 | <baseset- [1, 3, 5]>> |
|
179 | 179 | 0 |
|
180 | 180 | 1 |
|
181 | 181 | 2 |
|
182 | 182 | 3 |
|
183 | 183 | 4 |
|
184 | 184 | 5 |
|
185 | 185 | |
|
186 | 186 | test optimization of trivial `or` operation |
|
187 | 187 | |
|
188 | 188 | $ try --optimize '0|(1)|"2"|-2|tip|null' |
|
189 | 189 | (or |
|
190 | 190 | (list |
|
191 | 191 | (symbol '0') |
|
192 | 192 | (group |
|
193 | 193 | (symbol '1')) |
|
194 | 194 | (string '2') |
|
195 | 195 | (negate |
|
196 | 196 | (symbol '2')) |
|
197 | 197 | (symbol 'tip') |
|
198 | 198 | (symbol 'null'))) |
|
199 | 199 | * optimized: |
|
200 | 200 | (func |
|
201 | 201 | (symbol '_list') |
|
202 | 202 | (string '0\x001\x002\x00-2\x00tip\x00null')) |
|
203 | 203 | * set: |
|
204 | 204 | <baseset [0, 1, 2, 8, 9, -1]> |
|
205 | 205 | 0 |
|
206 | 206 | 1 |
|
207 | 207 | 2 |
|
208 | 208 | 8 |
|
209 | 209 | 9 |
|
210 | 210 | -1 |
|
211 | 211 | |
|
212 | 212 | $ try --optimize '0|1|2:3' |
|
213 | 213 | (or |
|
214 | 214 | (list |
|
215 | 215 | (symbol '0') |
|
216 | 216 | (symbol '1') |
|
217 | 217 | (range |
|
218 | 218 | (symbol '2') |
|
219 | 219 | (symbol '3')))) |
|
220 | 220 | * optimized: |
|
221 | 221 | (or |
|
222 | 222 | (list |
|
223 | 223 | (func |
|
224 | 224 | (symbol '_list') |
|
225 | 225 | (string '0\x001')) |
|
226 | 226 | (range |
|
227 | 227 | (symbol '2') |
|
228 | 228 | (symbol '3')))) |
|
229 | 229 | * set: |
|
230 | 230 | <addset |
|
231 | 231 | <baseset [0, 1]>, |
|
232 | 232 | <spanset+ 2:4>> |
|
233 | 233 | 0 |
|
234 | 234 | 1 |
|
235 | 235 | 2 |
|
236 | 236 | 3 |
|
237 | 237 | |
|
238 | 238 | $ try --optimize '0:1|2|3:4|5|6' |
|
239 | 239 | (or |
|
240 | 240 | (list |
|
241 | 241 | (range |
|
242 | 242 | (symbol '0') |
|
243 | 243 | (symbol '1')) |
|
244 | 244 | (symbol '2') |
|
245 | 245 | (range |
|
246 | 246 | (symbol '3') |
|
247 | 247 | (symbol '4')) |
|
248 | 248 | (symbol '5') |
|
249 | 249 | (symbol '6'))) |
|
250 | 250 | * optimized: |
|
251 | 251 | (or |
|
252 | 252 | (list |
|
253 | 253 | (range |
|
254 | 254 | (symbol '0') |
|
255 | 255 | (symbol '1')) |
|
256 | 256 | (symbol '2') |
|
257 | 257 | (range |
|
258 | 258 | (symbol '3') |
|
259 | 259 | (symbol '4')) |
|
260 | 260 | (func |
|
261 | 261 | (symbol '_list') |
|
262 | 262 | (string '5\x006')))) |
|
263 | 263 | * set: |
|
264 | 264 | <addset |
|
265 | 265 | <addset |
|
266 | 266 | <spanset+ 0:2>, |
|
267 | 267 | <baseset [2]>>, |
|
268 | 268 | <addset |
|
269 | 269 | <spanset+ 3:5>, |
|
270 | 270 | <baseset [5, 6]>>> |
|
271 | 271 | 0 |
|
272 | 272 | 1 |
|
273 | 273 | 2 |
|
274 | 274 | 3 |
|
275 | 275 | 4 |
|
276 | 276 | 5 |
|
277 | 277 | 6 |
|
278 | 278 | |
|
279 | 279 | unoptimized `or` looks like this |
|
280 | 280 | |
|
281 | 281 | $ try --no-optimized -p analyzed '0|1|2|3|4' |
|
282 | 282 | * analyzed: |
|
283 | 283 | (or |
|
284 | 284 | (list |
|
285 | 285 | (symbol '0') |
|
286 | 286 | (symbol '1') |
|
287 | 287 | (symbol '2') |
|
288 | 288 | (symbol '3') |
|
289 | 289 | (symbol '4'))) |
|
290 | 290 | * set: |
|
291 | 291 | <addset |
|
292 | 292 | <addset |
|
293 | 293 | <baseset [0]>, |
|
294 | 294 | <baseset [1]>>, |
|
295 | 295 | <addset |
|
296 | 296 | <baseset [2]>, |
|
297 | 297 | <addset |
|
298 | 298 | <baseset [3]>, |
|
299 | 299 | <baseset [4]>>>> |
|
300 | 300 | 0 |
|
301 | 301 | 1 |
|
302 | 302 | 2 |
|
303 | 303 | 3 |
|
304 | 304 | 4 |
|
305 | 305 | |
|
306 | 306 | test that `_list` should be narrowed by provided `subset` |
|
307 | 307 | |
|
308 | 308 | $ log '0:2 and (null|1|2|3)' |
|
309 | 309 | 1 |
|
310 | 310 | 2 |
|
311 | 311 | |
|
312 | 312 | test that `_list` should remove duplicates |
|
313 | 313 | |
|
314 | 314 | $ log '0|1|2|1|2|-1|tip' |
|
315 | 315 | 0 |
|
316 | 316 | 1 |
|
317 | 317 | 2 |
|
318 | 318 | 9 |
|
319 | 319 | |
|
320 | 320 | test unknown revision in `_list` |
|
321 | 321 | |
|
322 | 322 | $ log '0|unknown' |
|
323 | 323 | abort: unknown revision 'unknown'! |
|
324 | 324 | [255] |
|
325 | 325 | |
|
326 | 326 | test integer range in `_list` |
|
327 | 327 | |
|
328 | 328 | $ log '-1|-10' |
|
329 | 329 | 9 |
|
330 | 330 | 0 |
|
331 | 331 | |
|
332 | 332 | $ log '-10|-11' |
|
333 | 333 | abort: unknown revision '-11'! |
|
334 | 334 | [255] |
|
335 | 335 | |
|
336 | 336 | $ log '9|10' |
|
337 | 337 | abort: unknown revision '10'! |
|
338 | 338 | [255] |
|
339 | 339 | |
|
340 | 340 | test '0000' != '0' in `_list` |
|
341 | 341 | |
|
342 | 342 | $ log '0|0000' |
|
343 | 343 | 0 |
|
344 | 344 | -1 |
|
345 | 345 | |
|
346 | 346 | test ',' in `_list` |
|
347 | 347 | $ log '0,1' |
|
348 | 348 | hg: parse error: can't use a list in this context |
|
349 | 349 | (see 'hg help "revsets.x or y"') |
|
350 | 350 | [255] |
|
351 | 351 | $ try '0,1,2' |
|
352 | 352 | (list |
|
353 | 353 | (symbol '0') |
|
354 | 354 | (symbol '1') |
|
355 | 355 | (symbol '2')) |
|
356 | 356 | hg: parse error: can't use a list in this context |
|
357 | 357 | (see 'hg help "revsets.x or y"') |
|
358 | 358 | [255] |
|
359 | 359 | |
|
360 | 360 | test that chained `or` operations make balanced addsets |
|
361 | 361 | |
|
362 | 362 | $ try '0:1|1:2|2:3|3:4|4:5' |
|
363 | 363 | (or |
|
364 | 364 | (list |
|
365 | 365 | (range |
|
366 | 366 | (symbol '0') |
|
367 | 367 | (symbol '1')) |
|
368 | 368 | (range |
|
369 | 369 | (symbol '1') |
|
370 | 370 | (symbol '2')) |
|
371 | 371 | (range |
|
372 | 372 | (symbol '2') |
|
373 | 373 | (symbol '3')) |
|
374 | 374 | (range |
|
375 | 375 | (symbol '3') |
|
376 | 376 | (symbol '4')) |
|
377 | 377 | (range |
|
378 | 378 | (symbol '4') |
|
379 | 379 | (symbol '5')))) |
|
380 | 380 | * set: |
|
381 | 381 | <addset |
|
382 | 382 | <addset |
|
383 | 383 | <spanset+ 0:2>, |
|
384 | 384 | <spanset+ 1:3>>, |
|
385 | 385 | <addset |
|
386 | 386 | <spanset+ 2:4>, |
|
387 | 387 | <addset |
|
388 | 388 | <spanset+ 3:5>, |
|
389 | 389 | <spanset+ 4:6>>>> |
|
390 | 390 | 0 |
|
391 | 391 | 1 |
|
392 | 392 | 2 |
|
393 | 393 | 3 |
|
394 | 394 | 4 |
|
395 | 395 | 5 |
|
396 | 396 | |
|
397 | 397 | no crash by empty group "()" while optimizing `or` operations |
|
398 | 398 | |
|
399 | 399 | $ try --optimize '0|()' |
|
400 | 400 | (or |
|
401 | 401 | (list |
|
402 | 402 | (symbol '0') |
|
403 | 403 | (group |
|
404 | 404 | None))) |
|
405 | 405 | * optimized: |
|
406 | 406 | (or |
|
407 | 407 | (list |
|
408 | 408 | (symbol '0') |
|
409 | 409 | None)) |
|
410 | 410 | hg: parse error: missing argument |
|
411 | 411 | [255] |
|
412 | 412 | |
|
413 | 413 | test that chained `or` operations never eat up stack (issue4624) |
|
414 | 414 | (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) |
|
415 | 415 | |
|
416 |
$ hg log -T '{rev}\n' -r `"$PYTHON" -c "print |
|
|
416 | $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print('+'.join(['0:1'] * 500))"` | |
|
417 | 417 | 0 |
|
418 | 418 | 1 |
|
419 | 419 | |
|
420 | 420 | test that repeated `-r` options never eat up stack (issue4565) |
|
421 | 421 | (uses `-r 0::1` to avoid possible optimization at old-style parser) |
|
422 | 422 | |
|
423 |
$ hg log -T '{rev}\n' `"$PYTHON" -c "for i in range(500): print |
|
|
423 | $ hg log -T '{rev}\n' `"$PYTHON" -c "for i in range(500): print('-r 0::1 ')"` | |
|
424 | 424 | 0 |
|
425 | 425 | 1 |
|
426 | 426 | |
|
427 | 427 | check that conversion to only works |
|
428 | 428 | $ try --optimize '::3 - ::1' |
|
429 | 429 | (minus |
|
430 | 430 | (dagrangepre |
|
431 | 431 | (symbol '3')) |
|
432 | 432 | (dagrangepre |
|
433 | 433 | (symbol '1'))) |
|
434 | 434 | * optimized: |
|
435 | 435 | (func |
|
436 | 436 | (symbol 'only') |
|
437 | 437 | (list |
|
438 | 438 | (symbol '3') |
|
439 | 439 | (symbol '1'))) |
|
440 | 440 | * set: |
|
441 | 441 | <baseset+ [3]> |
|
442 | 442 | 3 |
|
443 | 443 | $ try --optimize 'ancestors(1) - ancestors(3)' |
|
444 | 444 | (minus |
|
445 | 445 | (func |
|
446 | 446 | (symbol 'ancestors') |
|
447 | 447 | (symbol '1')) |
|
448 | 448 | (func |
|
449 | 449 | (symbol 'ancestors') |
|
450 | 450 | (symbol '3'))) |
|
451 | 451 | * optimized: |
|
452 | 452 | (func |
|
453 | 453 | (symbol 'only') |
|
454 | 454 | (list |
|
455 | 455 | (symbol '1') |
|
456 | 456 | (symbol '3'))) |
|
457 | 457 | * set: |
|
458 | 458 | <baseset+ []> |
|
459 | 459 | $ try --optimize 'not ::2 and ::6' |
|
460 | 460 | (and |
|
461 | 461 | (not |
|
462 | 462 | (dagrangepre |
|
463 | 463 | (symbol '2'))) |
|
464 | 464 | (dagrangepre |
|
465 | 465 | (symbol '6'))) |
|
466 | 466 | * optimized: |
|
467 | 467 | (func |
|
468 | 468 | (symbol 'only') |
|
469 | 469 | (list |
|
470 | 470 | (symbol '6') |
|
471 | 471 | (symbol '2'))) |
|
472 | 472 | * set: |
|
473 | 473 | <baseset+ [3, 4, 5, 6]> |
|
474 | 474 | 3 |
|
475 | 475 | 4 |
|
476 | 476 | 5 |
|
477 | 477 | 6 |
|
478 | 478 | $ try --optimize 'ancestors(6) and not ancestors(4)' |
|
479 | 479 | (and |
|
480 | 480 | (func |
|
481 | 481 | (symbol 'ancestors') |
|
482 | 482 | (symbol '6')) |
|
483 | 483 | (not |
|
484 | 484 | (func |
|
485 | 485 | (symbol 'ancestors') |
|
486 | 486 | (symbol '4')))) |
|
487 | 487 | * optimized: |
|
488 | 488 | (func |
|
489 | 489 | (symbol 'only') |
|
490 | 490 | (list |
|
491 | 491 | (symbol '6') |
|
492 | 492 | (symbol '4'))) |
|
493 | 493 | * set: |
|
494 | 494 | <baseset+ [3, 5, 6]> |
|
495 | 495 | 3 |
|
496 | 496 | 5 |
|
497 | 497 | 6 |
|
498 | 498 | |
|
499 | 499 | no crash by empty group "()" while optimizing to "only()" |
|
500 | 500 | |
|
501 | 501 | $ try --optimize '::1 and ()' |
|
502 | 502 | (and |
|
503 | 503 | (dagrangepre |
|
504 | 504 | (symbol '1')) |
|
505 | 505 | (group |
|
506 | 506 | None)) |
|
507 | 507 | * optimized: |
|
508 | 508 | (andsmally |
|
509 | 509 | (func |
|
510 | 510 | (symbol 'ancestors') |
|
511 | 511 | (symbol '1')) |
|
512 | 512 | None) |
|
513 | 513 | hg: parse error: missing argument |
|
514 | 514 | [255] |
|
515 | 515 | |
|
516 | 516 | optimization to only() works only if ancestors() takes only one argument |
|
517 | 517 | |
|
518 | 518 | $ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)' |
|
519 | 519 | * optimized: |
|
520 | 520 | (difference |
|
521 | 521 | (func |
|
522 | 522 | (symbol 'ancestors') |
|
523 | 523 | (symbol '6')) |
|
524 | 524 | (func |
|
525 | 525 | (symbol 'ancestors') |
|
526 | 526 | (list |
|
527 | 527 | (symbol '4') |
|
528 | 528 | (symbol '1')))) |
|
529 | 529 | 0 |
|
530 | 530 | 1 |
|
531 | 531 | 3 |
|
532 | 532 | 5 |
|
533 | 533 | 6 |
|
534 | 534 | $ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)' |
|
535 | 535 | * optimized: |
|
536 | 536 | (difference |
|
537 | 537 | (func |
|
538 | 538 | (symbol 'ancestors') |
|
539 | 539 | (list |
|
540 | 540 | (symbol '6') |
|
541 | 541 | (symbol '1'))) |
|
542 | 542 | (func |
|
543 | 543 | (symbol 'ancestors') |
|
544 | 544 | (symbol '4'))) |
|
545 | 545 | 5 |
|
546 | 546 | 6 |
|
547 | 547 | |
|
548 | 548 | optimization disabled if keyword arguments passed (because we're too lazy |
|
549 | 549 | to support it) |
|
550 | 550 | |
|
551 | 551 | $ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)' |
|
552 | 552 | * optimized: |
|
553 | 553 | (difference |
|
554 | 554 | (func |
|
555 | 555 | (symbol 'ancestors') |
|
556 | 556 | (keyvalue |
|
557 | 557 | (symbol 'set') |
|
558 | 558 | (symbol '6'))) |
|
559 | 559 | (func |
|
560 | 560 | (symbol 'ancestors') |
|
561 | 561 | (keyvalue |
|
562 | 562 | (symbol 'set') |
|
563 | 563 | (symbol '4')))) |
|
564 | 564 | 3 |
|
565 | 565 | 5 |
|
566 | 566 | 6 |
|
567 | 567 | |
|
568 | 568 | invalid function call should not be optimized to only() |
|
569 | 569 | |
|
570 | 570 | $ log '"ancestors"(6) and not ancestors(4)' |
|
571 | 571 | hg: parse error: not a symbol |
|
572 | 572 | [255] |
|
573 | 573 | |
|
574 | 574 | $ log 'ancestors(6) and not "ancestors"(4)' |
|
575 | 575 | hg: parse error: not a symbol |
|
576 | 576 | [255] |
|
577 | 577 | |
|
578 | 578 | test empty string |
|
579 | 579 | |
|
580 | 580 | $ log '' |
|
581 | 581 | hg: parse error: empty query |
|
582 | 582 | [255] |
|
583 | 583 | $ log 'parents("")' |
|
584 | 584 | hg: parse error: empty string is not a valid revision |
|
585 | 585 | [255] |
|
586 | 586 | |
|
587 | 587 | test empty revset |
|
588 | 588 | $ hg log 'none()' |
|
589 | 589 | |
|
590 | 590 | we can use patterns when searching for tags |
|
591 | 591 | |
|
592 | 592 | $ log 'tag("1..*")' |
|
593 | 593 | abort: tag '1..*' does not exist! |
|
594 | 594 | [255] |
|
595 | 595 | $ log 'tag("re:1..*")' |
|
596 | 596 | 6 |
|
597 | 597 | $ log 'tag("re:[0-9].[0-9]")' |
|
598 | 598 | 6 |
|
599 | 599 | $ log 'tag("literal:1.0")' |
|
600 | 600 | 6 |
|
601 | 601 | $ log 'tag("re:0..*")' |
|
602 | 602 | |
|
603 | 603 | $ log 'tag(unknown)' |
|
604 | 604 | abort: tag 'unknown' does not exist! |
|
605 | 605 | [255] |
|
606 | 606 | $ log 'tag("re:unknown")' |
|
607 | 607 | $ log 'present(tag("unknown"))' |
|
608 | 608 | $ log 'present(tag("re:unknown"))' |
|
609 | 609 | $ log 'branch(unknown)' |
|
610 | 610 | abort: unknown revision 'unknown'! |
|
611 | 611 | [255] |
|
612 | 612 | $ log 'branch("literal:unknown")' |
|
613 | 613 | abort: branch 'unknown' does not exist! |
|
614 | 614 | [255] |
|
615 | 615 | $ log 'branch("re:unknown")' |
|
616 | 616 | $ log 'present(branch("unknown"))' |
|
617 | 617 | $ log 'present(branch("re:unknown"))' |
|
618 | 618 | $ log 'user(bob)' |
|
619 | 619 | 2 |
|
620 | 620 | |
|
621 | 621 | $ log '4::8' |
|
622 | 622 | 4 |
|
623 | 623 | 8 |
|
624 | 624 | $ log '4:8' |
|
625 | 625 | 4 |
|
626 | 626 | 5 |
|
627 | 627 | 6 |
|
628 | 628 | 7 |
|
629 | 629 | 8 |
|
630 | 630 | |
|
631 | 631 | $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' |
|
632 | 632 | 4 |
|
633 | 633 | 2 |
|
634 | 634 | 5 |
|
635 | 635 | |
|
636 | 636 | $ log 'not 0 and 0:2' |
|
637 | 637 | 1 |
|
638 | 638 | 2 |
|
639 | 639 | $ log 'not 1 and 0:2' |
|
640 | 640 | 0 |
|
641 | 641 | 2 |
|
642 | 642 | $ log 'not 2 and 0:2' |
|
643 | 643 | 0 |
|
644 | 644 | 1 |
|
645 | 645 | $ log '(1 and 2)::' |
|
646 | 646 | $ log '(1 and 2):' |
|
647 | 647 | $ log '(1 and 2):3' |
|
648 | 648 | $ log 'sort(head(), -rev)' |
|
649 | 649 | 9 |
|
650 | 650 | 7 |
|
651 | 651 | 6 |
|
652 | 652 | 5 |
|
653 | 653 | 4 |
|
654 | 654 | 3 |
|
655 | 655 | 2 |
|
656 | 656 | 1 |
|
657 | 657 | 0 |
|
658 | 658 | $ log '4::8 - 8' |
|
659 | 659 | 4 |
|
660 | 660 | |
|
661 | 661 | matching() should preserve the order of the input set: |
|
662 | 662 | |
|
663 | 663 | $ log '(2 or 3 or 1) and matching(1 or 2 or 3)' |
|
664 | 664 | 2 |
|
665 | 665 | 3 |
|
666 | 666 | 1 |
|
667 | 667 | |
|
668 | 668 | $ log 'named("unknown")' |
|
669 | 669 | abort: namespace 'unknown' does not exist! |
|
670 | 670 | [255] |
|
671 | 671 | $ log 'named("re:unknown")' |
|
672 | 672 | abort: no namespace exists that match 'unknown'! |
|
673 | 673 | [255] |
|
674 | 674 | $ log 'present(named("unknown"))' |
|
675 | 675 | $ log 'present(named("re:unknown"))' |
|
676 | 676 | |
|
677 | 677 | $ log 'tag()' |
|
678 | 678 | 6 |
|
679 | 679 | $ log 'named("tags")' |
|
680 | 680 | 6 |
|
681 | 681 | |
|
682 | 682 | issue2437 |
|
683 | 683 | |
|
684 | 684 | $ log '3 and p1(5)' |
|
685 | 685 | 3 |
|
686 | 686 | $ log '4 and p2(6)' |
|
687 | 687 | 4 |
|
688 | 688 | $ log '1 and parents(:2)' |
|
689 | 689 | 1 |
|
690 | 690 | $ log '2 and children(1:)' |
|
691 | 691 | 2 |
|
692 | 692 | $ log 'roots(all()) or roots(all())' |
|
693 | 693 | 0 |
|
694 | 694 | $ hg debugrevspec 'roots(all()) or roots(all())' |
|
695 | 695 | 0 |
|
696 | 696 | $ log 'heads(branch(Γ©)) or heads(branch(Γ©))' |
|
697 | 697 | 9 |
|
698 | 698 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))' |
|
699 | 699 | 4 |
|
700 | 700 | |
|
701 | 701 | issue2654: report a parse error if the revset was not completely parsed |
|
702 | 702 | |
|
703 | 703 | $ log '1 OR 2' |
|
704 | 704 | hg: parse error at 2: invalid token |
|
705 | 705 | (1 OR 2 |
|
706 | 706 | ^ here) |
|
707 | 707 | [255] |
|
708 | 708 | |
|
709 | 709 | or operator should preserve ordering: |
|
710 | 710 | $ log 'reverse(2::4) or tip' |
|
711 | 711 | 4 |
|
712 | 712 | 2 |
|
713 | 713 | 9 |
|
714 | 714 | |
|
715 | 715 | parentrevspec |
|
716 | 716 | |
|
717 | 717 | $ log 'merge()^0' |
|
718 | 718 | 6 |
|
719 | 719 | $ log 'merge()^' |
|
720 | 720 | 5 |
|
721 | 721 | $ log 'merge()^1' |
|
722 | 722 | 5 |
|
723 | 723 | $ log 'merge()^2' |
|
724 | 724 | 4 |
|
725 | 725 | $ log '(not merge())^2' |
|
726 | 726 | $ log 'merge()^^' |
|
727 | 727 | 3 |
|
728 | 728 | $ log 'merge()^1^' |
|
729 | 729 | 3 |
|
730 | 730 | $ log 'merge()^^^' |
|
731 | 731 | 1 |
|
732 | 732 | |
|
733 | 733 | $ hg debugrevspec -s '(merge() | 0)~-1' |
|
734 | 734 | * set: |
|
735 | 735 | <baseset+ [1, 7]> |
|
736 | 736 | 1 |
|
737 | 737 | 7 |
|
738 | 738 | $ log 'merge()~-1' |
|
739 | 739 | 7 |
|
740 | 740 | $ log 'tip~-1' |
|
741 | 741 | $ log '(tip | merge())~-1' |
|
742 | 742 | 7 |
|
743 | 743 | $ log 'merge()~0' |
|
744 | 744 | 6 |
|
745 | 745 | $ log 'merge()~1' |
|
746 | 746 | 5 |
|
747 | 747 | $ log 'merge()~2' |
|
748 | 748 | 3 |
|
749 | 749 | $ log 'merge()~2^1' |
|
750 | 750 | 1 |
|
751 | 751 | $ log 'merge()~3' |
|
752 | 752 | 1 |
|
753 | 753 | |
|
754 | 754 | $ log '(-3:tip)^' |
|
755 | 755 | 4 |
|
756 | 756 | 6 |
|
757 | 757 | 8 |
|
758 | 758 | |
|
759 | 759 | $ log 'tip^foo' |
|
760 | 760 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
761 | 761 | [255] |
|
762 | 762 | |
|
763 | 763 | $ log 'branchpoint()~-1' |
|
764 | 764 | abort: revision in set has more than one child! |
|
765 | 765 | [255] |
|
766 | 766 | |
|
767 | 767 | Bogus function gets suggestions |
|
768 | 768 | $ log 'add()' |
|
769 | 769 | hg: parse error: unknown identifier: add |
|
770 | 770 | (did you mean adds?) |
|
771 | 771 | [255] |
|
772 | 772 | $ log 'added()' |
|
773 | 773 | hg: parse error: unknown identifier: added |
|
774 | 774 | (did you mean adds?) |
|
775 | 775 | [255] |
|
776 | 776 | $ log 'remo()' |
|
777 | 777 | hg: parse error: unknown identifier: remo |
|
778 | 778 | (did you mean one of remote, removes?) |
|
779 | 779 | [255] |
|
780 | 780 | $ log 'babar()' |
|
781 | 781 | hg: parse error: unknown identifier: babar |
|
782 | 782 | [255] |
|
783 | 783 | |
|
784 | 784 | Bogus function with a similar internal name doesn't suggest the internal name |
|
785 | 785 | $ log 'matches()' |
|
786 | 786 | hg: parse error: unknown identifier: matches |
|
787 | 787 | (did you mean matching?) |
|
788 | 788 | [255] |
|
789 | 789 | |
|
790 | 790 | Undocumented functions aren't suggested as similar either |
|
791 | 791 | $ log 'tagged2()' |
|
792 | 792 | hg: parse error: unknown identifier: tagged2 |
|
793 | 793 | [255] |
|
794 | 794 | |
|
795 | 795 | multiple revspecs |
|
796 | 796 | |
|
797 | 797 | $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' |
|
798 | 798 | 8 |
|
799 | 799 | 9 |
|
800 | 800 | 4 |
|
801 | 801 | 5 |
|
802 | 802 | 6 |
|
803 | 803 | 7 |
|
804 | 804 | |
|
805 | 805 | test usage in revpair (with "+") |
|
806 | 806 | |
|
807 | 807 | (real pair) |
|
808 | 808 | |
|
809 | 809 | $ hg diff -r 'tip^^' -r 'tip' |
|
810 | 810 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
811 | 811 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
812 | 812 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
813 | 813 | @@ -0,0 +1,1 @@ |
|
814 | 814 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
815 | 815 | $ hg diff -r 'tip^^::tip' |
|
816 | 816 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
817 | 817 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
818 | 818 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
819 | 819 | @@ -0,0 +1,1 @@ |
|
820 | 820 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
821 | 821 | |
|
822 | 822 | (single rev) |
|
823 | 823 | |
|
824 | 824 | $ hg diff -r 'tip^' -r 'tip^' |
|
825 | 825 | $ hg diff -r 'tip^:tip^' |
|
826 | 826 | |
|
827 | 827 | (single rev that does not looks like a range) |
|
828 | 828 | |
|
829 | 829 | $ hg diff -r 'tip^::tip^ or tip^' |
|
830 | 830 | diff -r d5d0dcbdc4d9 .hgtags |
|
831 | 831 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
832 | 832 | +++ b/.hgtags * (glob) |
|
833 | 833 | @@ -0,0 +1,1 @@ |
|
834 | 834 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
835 | 835 | $ hg diff -r 'tip^ or tip^' |
|
836 | 836 | diff -r d5d0dcbdc4d9 .hgtags |
|
837 | 837 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
838 | 838 | +++ b/.hgtags * (glob) |
|
839 | 839 | @@ -0,0 +1,1 @@ |
|
840 | 840 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
841 | 841 | |
|
842 | 842 | (no rev) |
|
843 | 843 | |
|
844 | 844 | $ hg diff -r 'author("babar") or author("celeste")' |
|
845 | 845 | abort: empty revision range |
|
846 | 846 | [255] |
|
847 | 847 | |
|
848 | 848 | aliases: |
|
849 | 849 | |
|
850 | 850 | $ echo '[revsetalias]' >> .hg/hgrc |
|
851 | 851 | $ echo 'm = merge()' >> .hg/hgrc |
|
852 | 852 | (revset aliases can override builtin revsets) |
|
853 | 853 | $ echo 'p2($1) = p1($1)' >> .hg/hgrc |
|
854 | 854 | $ echo 'sincem = descendants(m)' >> .hg/hgrc |
|
855 | 855 | $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc |
|
856 | 856 | $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
857 | 857 | $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
858 | 858 | |
|
859 | 859 | $ try m |
|
860 | 860 | (symbol 'm') |
|
861 | 861 | * expanded: |
|
862 | 862 | (func |
|
863 | 863 | (symbol 'merge') |
|
864 | 864 | None) |
|
865 | 865 | * set: |
|
866 | 866 | <filteredset |
|
867 | 867 | <fullreposet+ 0:10>, |
|
868 | 868 | <merge>> |
|
869 | 869 | 6 |
|
870 | 870 | |
|
871 | 871 | $ HGPLAIN=1 |
|
872 | 872 | $ export HGPLAIN |
|
873 | 873 | $ try m |
|
874 | 874 | (symbol 'm') |
|
875 | 875 | abort: unknown revision 'm'! |
|
876 | 876 | [255] |
|
877 | 877 | |
|
878 | 878 | $ HGPLAINEXCEPT=revsetalias |
|
879 | 879 | $ export HGPLAINEXCEPT |
|
880 | 880 | $ try m |
|
881 | 881 | (symbol 'm') |
|
882 | 882 | * expanded: |
|
883 | 883 | (func |
|
884 | 884 | (symbol 'merge') |
|
885 | 885 | None) |
|
886 | 886 | * set: |
|
887 | 887 | <filteredset |
|
888 | 888 | <fullreposet+ 0:10>, |
|
889 | 889 | <merge>> |
|
890 | 890 | 6 |
|
891 | 891 | |
|
892 | 892 | $ unset HGPLAIN |
|
893 | 893 | $ unset HGPLAINEXCEPT |
|
894 | 894 | |
|
895 | 895 | $ try 'p2(.)' |
|
896 | 896 | (func |
|
897 | 897 | (symbol 'p2') |
|
898 | 898 | (symbol '.')) |
|
899 | 899 | * expanded: |
|
900 | 900 | (func |
|
901 | 901 | (symbol 'p1') |
|
902 | 902 | (symbol '.')) |
|
903 | 903 | * set: |
|
904 | 904 | <baseset+ [8]> |
|
905 | 905 | 8 |
|
906 | 906 | |
|
907 | 907 | $ HGPLAIN=1 |
|
908 | 908 | $ export HGPLAIN |
|
909 | 909 | $ try 'p2(.)' |
|
910 | 910 | (func |
|
911 | 911 | (symbol 'p2') |
|
912 | 912 | (symbol '.')) |
|
913 | 913 | * set: |
|
914 | 914 | <baseset+ []> |
|
915 | 915 | |
|
916 | 916 | $ HGPLAINEXCEPT=revsetalias |
|
917 | 917 | $ export HGPLAINEXCEPT |
|
918 | 918 | $ try 'p2(.)' |
|
919 | 919 | (func |
|
920 | 920 | (symbol 'p2') |
|
921 | 921 | (symbol '.')) |
|
922 | 922 | * expanded: |
|
923 | 923 | (func |
|
924 | 924 | (symbol 'p1') |
|
925 | 925 | (symbol '.')) |
|
926 | 926 | * set: |
|
927 | 927 | <baseset+ [8]> |
|
928 | 928 | 8 |
|
929 | 929 | |
|
930 | 930 | $ unset HGPLAIN |
|
931 | 931 | $ unset HGPLAINEXCEPT |
|
932 | 932 | |
|
933 | 933 | test alias recursion |
|
934 | 934 | |
|
935 | 935 | $ try sincem |
|
936 | 936 | (symbol 'sincem') |
|
937 | 937 | * expanded: |
|
938 | 938 | (func |
|
939 | 939 | (symbol 'descendants') |
|
940 | 940 | (func |
|
941 | 941 | (symbol 'merge') |
|
942 | 942 | None)) |
|
943 | 943 | * set: |
|
944 | 944 | <generatorsetasc+> |
|
945 | 945 | 6 |
|
946 | 946 | 7 |
|
947 | 947 | |
|
948 | 948 | test infinite recursion |
|
949 | 949 | |
|
950 | 950 | $ echo 'recurse1 = recurse2' >> .hg/hgrc |
|
951 | 951 | $ echo 'recurse2 = recurse1' >> .hg/hgrc |
|
952 | 952 | $ try recurse1 |
|
953 | 953 | (symbol 'recurse1') |
|
954 | 954 | hg: parse error: infinite expansion of revset alias "recurse1" detected |
|
955 | 955 | [255] |
|
956 | 956 | |
|
957 | 957 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc |
|
958 | 958 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc |
|
959 | 959 | $ try "level2(level1(1, 2), 3)" |
|
960 | 960 | (func |
|
961 | 961 | (symbol 'level2') |
|
962 | 962 | (list |
|
963 | 963 | (func |
|
964 | 964 | (symbol 'level1') |
|
965 | 965 | (list |
|
966 | 966 | (symbol '1') |
|
967 | 967 | (symbol '2'))) |
|
968 | 968 | (symbol '3'))) |
|
969 | 969 | * expanded: |
|
970 | 970 | (or |
|
971 | 971 | (list |
|
972 | 972 | (symbol '3') |
|
973 | 973 | (or |
|
974 | 974 | (list |
|
975 | 975 | (symbol '1') |
|
976 | 976 | (symbol '2'))))) |
|
977 | 977 | * set: |
|
978 | 978 | <addset |
|
979 | 979 | <baseset [3]>, |
|
980 | 980 | <baseset [1, 2]>> |
|
981 | 981 | 3 |
|
982 | 982 | 1 |
|
983 | 983 | 2 |
|
984 | 984 | |
|
985 | 985 | test nesting and variable passing |
|
986 | 986 | |
|
987 | 987 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
|
988 | 988 | $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc |
|
989 | 989 | $ echo 'nested3($1) = max($1)' >> .hg/hgrc |
|
990 | 990 | $ try 'nested(2:5)' |
|
991 | 991 | (func |
|
992 | 992 | (symbol 'nested') |
|
993 | 993 | (range |
|
994 | 994 | (symbol '2') |
|
995 | 995 | (symbol '5'))) |
|
996 | 996 | * expanded: |
|
997 | 997 | (func |
|
998 | 998 | (symbol 'max') |
|
999 | 999 | (range |
|
1000 | 1000 | (symbol '2') |
|
1001 | 1001 | (symbol '5'))) |
|
1002 | 1002 | * set: |
|
1003 | 1003 | <baseset |
|
1004 | 1004 | <max |
|
1005 | 1005 | <fullreposet+ 0:10>, |
|
1006 | 1006 | <spanset+ 2:6>>> |
|
1007 | 1007 | 5 |
|
1008 | 1008 | |
|
1009 | 1009 | test chained `or` operations are flattened at parsing phase |
|
1010 | 1010 | |
|
1011 | 1011 | $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc |
|
1012 | 1012 | $ try 'chainedorops(0:1, 1:2, 2:3)' |
|
1013 | 1013 | (func |
|
1014 | 1014 | (symbol 'chainedorops') |
|
1015 | 1015 | (list |
|
1016 | 1016 | (range |
|
1017 | 1017 | (symbol '0') |
|
1018 | 1018 | (symbol '1')) |
|
1019 | 1019 | (range |
|
1020 | 1020 | (symbol '1') |
|
1021 | 1021 | (symbol '2')) |
|
1022 | 1022 | (range |
|
1023 | 1023 | (symbol '2') |
|
1024 | 1024 | (symbol '3')))) |
|
1025 | 1025 | * expanded: |
|
1026 | 1026 | (or |
|
1027 | 1027 | (list |
|
1028 | 1028 | (range |
|
1029 | 1029 | (symbol '0') |
|
1030 | 1030 | (symbol '1')) |
|
1031 | 1031 | (range |
|
1032 | 1032 | (symbol '1') |
|
1033 | 1033 | (symbol '2')) |
|
1034 | 1034 | (range |
|
1035 | 1035 | (symbol '2') |
|
1036 | 1036 | (symbol '3')))) |
|
1037 | 1037 | * set: |
|
1038 | 1038 | <addset |
|
1039 | 1039 | <spanset+ 0:2>, |
|
1040 | 1040 | <addset |
|
1041 | 1041 | <spanset+ 1:3>, |
|
1042 | 1042 | <spanset+ 2:4>>> |
|
1043 | 1043 | 0 |
|
1044 | 1044 | 1 |
|
1045 | 1045 | 2 |
|
1046 | 1046 | 3 |
|
1047 | 1047 | |
|
1048 | 1048 | test variable isolation, variable placeholders are rewritten as string |
|
1049 | 1049 | then parsed and matched again as string. Check they do not leak too |
|
1050 | 1050 | far away. |
|
1051 | 1051 | |
|
1052 | 1052 | $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc |
|
1053 | 1053 | $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc |
|
1054 | 1054 | $ try 'callinjection(2:5)' |
|
1055 | 1055 | (func |
|
1056 | 1056 | (symbol 'callinjection') |
|
1057 | 1057 | (range |
|
1058 | 1058 | (symbol '2') |
|
1059 | 1059 | (symbol '5'))) |
|
1060 | 1060 | * expanded: |
|
1061 | 1061 | (func |
|
1062 | 1062 | (symbol 'descendants') |
|
1063 | 1063 | (func |
|
1064 | 1064 | (symbol 'max') |
|
1065 | 1065 | (string '$1'))) |
|
1066 | 1066 | abort: unknown revision '$1'! |
|
1067 | 1067 | [255] |
|
1068 | 1068 | |
|
1069 | 1069 | test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)', |
|
1070 | 1070 | but 'all()' should never be substituted to '0()'. |
|
1071 | 1071 | |
|
1072 | 1072 | $ echo 'universe = all()' >> .hg/hgrc |
|
1073 | 1073 | $ echo 'shadowall(all) = all and universe' >> .hg/hgrc |
|
1074 | 1074 | $ try 'shadowall(0)' |
|
1075 | 1075 | (func |
|
1076 | 1076 | (symbol 'shadowall') |
|
1077 | 1077 | (symbol '0')) |
|
1078 | 1078 | * expanded: |
|
1079 | 1079 | (and |
|
1080 | 1080 | (symbol '0') |
|
1081 | 1081 | (func |
|
1082 | 1082 | (symbol 'all') |
|
1083 | 1083 | None)) |
|
1084 | 1084 | * set: |
|
1085 | 1085 | <filteredset |
|
1086 | 1086 | <baseset [0]>, |
|
1087 | 1087 | <spanset+ 0:10>> |
|
1088 | 1088 | 0 |
|
1089 | 1089 | |
|
1090 | 1090 | test unknown reference: |
|
1091 | 1091 | |
|
1092 | 1092 | $ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2' |
|
1093 | 1093 | (func |
|
1094 | 1094 | (symbol 'unknownref') |
|
1095 | 1095 | (symbol '0')) |
|
1096 | 1096 | abort: bad definition of revset alias "unknownref": invalid symbol '$2' |
|
1097 | 1097 | [255] |
|
1098 | 1098 | |
|
1099 | 1099 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" |
|
1100 | 1100 | (symbol 'tip') |
|
1101 | 1101 | warning: bad definition of revset alias "anotherbadone": at 7: not a prefix: end |
|
1102 | 1102 | * set: |
|
1103 | 1103 | <baseset [9]> |
|
1104 | 1104 | 9 |
|
1105 | 1105 | |
|
1106 | 1106 | $ try 'tip' |
|
1107 | 1107 | (symbol 'tip') |
|
1108 | 1108 | * set: |
|
1109 | 1109 | <baseset [9]> |
|
1110 | 1110 | 9 |
|
1111 | 1111 | |
|
1112 | 1112 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" |
|
1113 | 1113 | (symbol 'tip') |
|
1114 | 1114 | warning: bad declaration of revset alias "bad name": at 4: invalid token |
|
1115 | 1115 | * set: |
|
1116 | 1116 | <baseset [9]> |
|
1117 | 1117 | 9 |
|
1118 | 1118 | $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc |
|
1119 | 1119 | $ try 'strictreplacing("foo", tip)' |
|
1120 | 1120 | (func |
|
1121 | 1121 | (symbol 'strictreplacing') |
|
1122 | 1122 | (list |
|
1123 | 1123 | (string 'foo') |
|
1124 | 1124 | (symbol 'tip'))) |
|
1125 | 1125 | * expanded: |
|
1126 | 1126 | (or |
|
1127 | 1127 | (list |
|
1128 | 1128 | (symbol 'tip') |
|
1129 | 1129 | (func |
|
1130 | 1130 | (symbol 'desc') |
|
1131 | 1131 | (string '$1')))) |
|
1132 | 1132 | * set: |
|
1133 | 1133 | <addset |
|
1134 | 1134 | <baseset [9]>, |
|
1135 | 1135 | <filteredset |
|
1136 | 1136 | <fullreposet+ 0:10>, |
|
1137 | 1137 | <desc '$1'>>> |
|
1138 | 1138 | 9 |
|
1139 | 1139 | |
|
1140 | 1140 | $ try 'd(2:5)' |
|
1141 | 1141 | (func |
|
1142 | 1142 | (symbol 'd') |
|
1143 | 1143 | (range |
|
1144 | 1144 | (symbol '2') |
|
1145 | 1145 | (symbol '5'))) |
|
1146 | 1146 | * expanded: |
|
1147 | 1147 | (func |
|
1148 | 1148 | (symbol 'reverse') |
|
1149 | 1149 | (func |
|
1150 | 1150 | (symbol 'sort') |
|
1151 | 1151 | (list |
|
1152 | 1152 | (range |
|
1153 | 1153 | (symbol '2') |
|
1154 | 1154 | (symbol '5')) |
|
1155 | 1155 | (symbol 'date')))) |
|
1156 | 1156 | * set: |
|
1157 | 1157 | <baseset [4, 5, 3, 2]> |
|
1158 | 1158 | 4 |
|
1159 | 1159 | 5 |
|
1160 | 1160 | 3 |
|
1161 | 1161 | 2 |
|
1162 | 1162 | $ try 'rs(2 or 3, date)' |
|
1163 | 1163 | (func |
|
1164 | 1164 | (symbol 'rs') |
|
1165 | 1165 | (list |
|
1166 | 1166 | (or |
|
1167 | 1167 | (list |
|
1168 | 1168 | (symbol '2') |
|
1169 | 1169 | (symbol '3'))) |
|
1170 | 1170 | (symbol 'date'))) |
|
1171 | 1171 | * expanded: |
|
1172 | 1172 | (func |
|
1173 | 1173 | (symbol 'reverse') |
|
1174 | 1174 | (func |
|
1175 | 1175 | (symbol 'sort') |
|
1176 | 1176 | (list |
|
1177 | 1177 | (or |
|
1178 | 1178 | (list |
|
1179 | 1179 | (symbol '2') |
|
1180 | 1180 | (symbol '3'))) |
|
1181 | 1181 | (symbol 'date')))) |
|
1182 | 1182 | * set: |
|
1183 | 1183 | <baseset [3, 2]> |
|
1184 | 1184 | 3 |
|
1185 | 1185 | 2 |
|
1186 | 1186 | $ try 'rs()' |
|
1187 | 1187 | (func |
|
1188 | 1188 | (symbol 'rs') |
|
1189 | 1189 | None) |
|
1190 | 1190 | hg: parse error: invalid number of arguments: 0 |
|
1191 | 1191 | [255] |
|
1192 | 1192 | $ try 'rs(2)' |
|
1193 | 1193 | (func |
|
1194 | 1194 | (symbol 'rs') |
|
1195 | 1195 | (symbol '2')) |
|
1196 | 1196 | hg: parse error: invalid number of arguments: 1 |
|
1197 | 1197 | [255] |
|
1198 | 1198 | $ try 'rs(2, data, 7)' |
|
1199 | 1199 | (func |
|
1200 | 1200 | (symbol 'rs') |
|
1201 | 1201 | (list |
|
1202 | 1202 | (symbol '2') |
|
1203 | 1203 | (symbol 'data') |
|
1204 | 1204 | (symbol '7'))) |
|
1205 | 1205 | hg: parse error: invalid number of arguments: 3 |
|
1206 | 1206 | [255] |
|
1207 | 1207 | $ try 'rs4(2 or 3, x, x, date)' |
|
1208 | 1208 | (func |
|
1209 | 1209 | (symbol 'rs4') |
|
1210 | 1210 | (list |
|
1211 | 1211 | (or |
|
1212 | 1212 | (list |
|
1213 | 1213 | (symbol '2') |
|
1214 | 1214 | (symbol '3'))) |
|
1215 | 1215 | (symbol 'x') |
|
1216 | 1216 | (symbol 'x') |
|
1217 | 1217 | (symbol 'date'))) |
|
1218 | 1218 | * expanded: |
|
1219 | 1219 | (func |
|
1220 | 1220 | (symbol 'reverse') |
|
1221 | 1221 | (func |
|
1222 | 1222 | (symbol 'sort') |
|
1223 | 1223 | (list |
|
1224 | 1224 | (or |
|
1225 | 1225 | (list |
|
1226 | 1226 | (symbol '2') |
|
1227 | 1227 | (symbol '3'))) |
|
1228 | 1228 | (symbol 'date')))) |
|
1229 | 1229 | * set: |
|
1230 | 1230 | <baseset [3, 2]> |
|
1231 | 1231 | 3 |
|
1232 | 1232 | 2 |
|
1233 | 1233 | |
|
1234 | 1234 | issue4553: check that revset aliases override existing hash prefix |
|
1235 | 1235 | |
|
1236 | 1236 | $ hg log -qr e |
|
1237 | 1237 | 6:e0cc66ef77e8 |
|
1238 | 1238 | |
|
1239 | 1239 | $ hg log -qr e --config revsetalias.e="all()" |
|
1240 | 1240 | 0:2785f51eece5 |
|
1241 | 1241 | 1:d75937da8da0 |
|
1242 | 1242 | 2:5ed5505e9f1c |
|
1243 | 1243 | 3:8528aa5637f2 |
|
1244 | 1244 | 4:2326846efdab |
|
1245 | 1245 | 5:904fa392b941 |
|
1246 | 1246 | 6:e0cc66ef77e8 |
|
1247 | 1247 | 7:013af1973af4 |
|
1248 | 1248 | 8:d5d0dcbdc4d9 |
|
1249 | 1249 | 9:24286f4ae135 |
|
1250 | 1250 | |
|
1251 | 1251 | $ hg log -qr e: --config revsetalias.e="0" |
|
1252 | 1252 | 0:2785f51eece5 |
|
1253 | 1253 | 1:d75937da8da0 |
|
1254 | 1254 | 2:5ed5505e9f1c |
|
1255 | 1255 | 3:8528aa5637f2 |
|
1256 | 1256 | 4:2326846efdab |
|
1257 | 1257 | 5:904fa392b941 |
|
1258 | 1258 | 6:e0cc66ef77e8 |
|
1259 | 1259 | 7:013af1973af4 |
|
1260 | 1260 | 8:d5d0dcbdc4d9 |
|
1261 | 1261 | 9:24286f4ae135 |
|
1262 | 1262 | |
|
1263 | 1263 | $ hg log -qr :e --config revsetalias.e="9" |
|
1264 | 1264 | 0:2785f51eece5 |
|
1265 | 1265 | 1:d75937da8da0 |
|
1266 | 1266 | 2:5ed5505e9f1c |
|
1267 | 1267 | 3:8528aa5637f2 |
|
1268 | 1268 | 4:2326846efdab |
|
1269 | 1269 | 5:904fa392b941 |
|
1270 | 1270 | 6:e0cc66ef77e8 |
|
1271 | 1271 | 7:013af1973af4 |
|
1272 | 1272 | 8:d5d0dcbdc4d9 |
|
1273 | 1273 | 9:24286f4ae135 |
|
1274 | 1274 | |
|
1275 | 1275 | $ hg log -qr e: |
|
1276 | 1276 | 6:e0cc66ef77e8 |
|
1277 | 1277 | 7:013af1973af4 |
|
1278 | 1278 | 8:d5d0dcbdc4d9 |
|
1279 | 1279 | 9:24286f4ae135 |
|
1280 | 1280 | |
|
1281 | 1281 | $ hg log -qr :e |
|
1282 | 1282 | 0:2785f51eece5 |
|
1283 | 1283 | 1:d75937da8da0 |
|
1284 | 1284 | 2:5ed5505e9f1c |
|
1285 | 1285 | 3:8528aa5637f2 |
|
1286 | 1286 | 4:2326846efdab |
|
1287 | 1287 | 5:904fa392b941 |
|
1288 | 1288 | 6:e0cc66ef77e8 |
|
1289 | 1289 | |
|
1290 | 1290 | issue2549 - correct optimizations |
|
1291 | 1291 | |
|
1292 | 1292 | $ try 'limit(1 or 2 or 3, 2) and not 2' |
|
1293 | 1293 | (and |
|
1294 | 1294 | (func |
|
1295 | 1295 | (symbol 'limit') |
|
1296 | 1296 | (list |
|
1297 | 1297 | (or |
|
1298 | 1298 | (list |
|
1299 | 1299 | (symbol '1') |
|
1300 | 1300 | (symbol '2') |
|
1301 | 1301 | (symbol '3'))) |
|
1302 | 1302 | (symbol '2'))) |
|
1303 | 1303 | (not |
|
1304 | 1304 | (symbol '2'))) |
|
1305 | 1305 | * set: |
|
1306 | 1306 | <filteredset |
|
1307 | 1307 | <baseset [1, 2]>, |
|
1308 | 1308 | <not |
|
1309 | 1309 | <baseset [2]>>> |
|
1310 | 1310 | 1 |
|
1311 | 1311 | $ try 'max(1 or 2) and not 2' |
|
1312 | 1312 | (and |
|
1313 | 1313 | (func |
|
1314 | 1314 | (symbol 'max') |
|
1315 | 1315 | (or |
|
1316 | 1316 | (list |
|
1317 | 1317 | (symbol '1') |
|
1318 | 1318 | (symbol '2')))) |
|
1319 | 1319 | (not |
|
1320 | 1320 | (symbol '2'))) |
|
1321 | 1321 | * set: |
|
1322 | 1322 | <filteredset |
|
1323 | 1323 | <baseset |
|
1324 | 1324 | <max |
|
1325 | 1325 | <fullreposet+ 0:10>, |
|
1326 | 1326 | <baseset [1, 2]>>>, |
|
1327 | 1327 | <not |
|
1328 | 1328 | <baseset [2]>>> |
|
1329 | 1329 | $ try 'min(1 or 2) and not 1' |
|
1330 | 1330 | (and |
|
1331 | 1331 | (func |
|
1332 | 1332 | (symbol 'min') |
|
1333 | 1333 | (or |
|
1334 | 1334 | (list |
|
1335 | 1335 | (symbol '1') |
|
1336 | 1336 | (symbol '2')))) |
|
1337 | 1337 | (not |
|
1338 | 1338 | (symbol '1'))) |
|
1339 | 1339 | * set: |
|
1340 | 1340 | <filteredset |
|
1341 | 1341 | <baseset |
|
1342 | 1342 | <min |
|
1343 | 1343 | <fullreposet+ 0:10>, |
|
1344 | 1344 | <baseset [1, 2]>>>, |
|
1345 | 1345 | <not |
|
1346 | 1346 | <baseset [1]>>> |
|
1347 | 1347 | $ try 'last(1 or 2, 1) and not 2' |
|
1348 | 1348 | (and |
|
1349 | 1349 | (func |
|
1350 | 1350 | (symbol 'last') |
|
1351 | 1351 | (list |
|
1352 | 1352 | (or |
|
1353 | 1353 | (list |
|
1354 | 1354 | (symbol '1') |
|
1355 | 1355 | (symbol '2'))) |
|
1356 | 1356 | (symbol '1'))) |
|
1357 | 1357 | (not |
|
1358 | 1358 | (symbol '2'))) |
|
1359 | 1359 | * set: |
|
1360 | 1360 | <filteredset |
|
1361 | 1361 | <baseset [2]>, |
|
1362 | 1362 | <not |
|
1363 | 1363 | <baseset [2]>>> |
|
1364 | 1364 | |
|
1365 | 1365 | issue4289 - ordering of built-ins |
|
1366 | 1366 | $ hg log -M -q -r 3:2 |
|
1367 | 1367 | 3:8528aa5637f2 |
|
1368 | 1368 | 2:5ed5505e9f1c |
|
1369 | 1369 | |
|
1370 | 1370 | test revsets started with 40-chars hash (issue3669) |
|
1371 | 1371 | |
|
1372 | 1372 | $ ISSUE3669_TIP=`hg tip --template '{node}'` |
|
1373 | 1373 | $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n' |
|
1374 | 1374 | 9 |
|
1375 | 1375 | $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n' |
|
1376 | 1376 | 8 |
|
1377 | 1377 | |
|
1378 | 1378 | test or-ed indirect predicates (issue3775) |
|
1379 | 1379 | |
|
1380 | 1380 | $ log '6 or 6^1' | sort |
|
1381 | 1381 | 5 |
|
1382 | 1382 | 6 |
|
1383 | 1383 | $ log '6^1 or 6' | sort |
|
1384 | 1384 | 5 |
|
1385 | 1385 | 6 |
|
1386 | 1386 | $ log '4 or 4~1' | sort |
|
1387 | 1387 | 2 |
|
1388 | 1388 | 4 |
|
1389 | 1389 | $ log '4~1 or 4' | sort |
|
1390 | 1390 | 2 |
|
1391 | 1391 | 4 |
|
1392 | 1392 | $ log '(0 or 2):(4 or 6) or 0 or 6' | sort |
|
1393 | 1393 | 0 |
|
1394 | 1394 | 1 |
|
1395 | 1395 | 2 |
|
1396 | 1396 | 3 |
|
1397 | 1397 | 4 |
|
1398 | 1398 | 5 |
|
1399 | 1399 | 6 |
|
1400 | 1400 | $ log '0 or 6 or (0 or 2):(4 or 6)' | sort |
|
1401 | 1401 | 0 |
|
1402 | 1402 | 1 |
|
1403 | 1403 | 2 |
|
1404 | 1404 | 3 |
|
1405 | 1405 | 4 |
|
1406 | 1406 | 5 |
|
1407 | 1407 | 6 |
|
1408 | 1408 | |
|
1409 | 1409 | tests for 'remote()' predicate: |
|
1410 | 1410 | #. (csets in remote) (id) (remote) |
|
1411 | 1411 | 1. less than local current branch "default" |
|
1412 | 1412 | 2. same with local specified "default" |
|
1413 | 1413 | 3. more than local specified specified |
|
1414 | 1414 | |
|
1415 | 1415 | $ hg clone --quiet -U . ../remote3 |
|
1416 | 1416 | $ cd ../remote3 |
|
1417 | 1417 | $ hg update -q 7 |
|
1418 | 1418 | $ echo r > r |
|
1419 | 1419 | $ hg ci -Aqm 10 |
|
1420 | 1420 | $ log 'remote()' |
|
1421 | 1421 | 7 |
|
1422 | 1422 | $ log 'remote("a-b-c-")' |
|
1423 | 1423 | 2 |
|
1424 | 1424 | $ cd ../repo |
|
1425 | 1425 | $ log 'remote(".a.b.c.", "../remote3")' |
|
1426 | 1426 | |
|
1427 | 1427 | tests for concatenation of strings/symbols by "##" |
|
1428 | 1428 | |
|
1429 | 1429 | $ try "278 ## '5f5' ## 1ee ## 'ce5'" |
|
1430 | 1430 | (_concat |
|
1431 | 1431 | (_concat |
|
1432 | 1432 | (_concat |
|
1433 | 1433 | (symbol '278') |
|
1434 | 1434 | (string '5f5')) |
|
1435 | 1435 | (symbol '1ee')) |
|
1436 | 1436 | (string 'ce5')) |
|
1437 | 1437 | * concatenated: |
|
1438 | 1438 | (string '2785f51eece5') |
|
1439 | 1439 | * set: |
|
1440 | 1440 | <baseset [0]> |
|
1441 | 1441 | 0 |
|
1442 | 1442 | |
|
1443 | 1443 | $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc |
|
1444 | 1444 | $ try "cat4(278, '5f5', 1ee, 'ce5')" |
|
1445 | 1445 | (func |
|
1446 | 1446 | (symbol 'cat4') |
|
1447 | 1447 | (list |
|
1448 | 1448 | (symbol '278') |
|
1449 | 1449 | (string '5f5') |
|
1450 | 1450 | (symbol '1ee') |
|
1451 | 1451 | (string 'ce5'))) |
|
1452 | 1452 | * expanded: |
|
1453 | 1453 | (_concat |
|
1454 | 1454 | (_concat |
|
1455 | 1455 | (_concat |
|
1456 | 1456 | (symbol '278') |
|
1457 | 1457 | (string '5f5')) |
|
1458 | 1458 | (symbol '1ee')) |
|
1459 | 1459 | (string 'ce5')) |
|
1460 | 1460 | * concatenated: |
|
1461 | 1461 | (string '2785f51eece5') |
|
1462 | 1462 | * set: |
|
1463 | 1463 | <baseset [0]> |
|
1464 | 1464 | 0 |
|
1465 | 1465 | |
|
1466 | 1466 | (check concatenation in alias nesting) |
|
1467 | 1467 | |
|
1468 | 1468 | $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc |
|
1469 | 1469 | $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc |
|
1470 | 1470 | $ log "cat2x2(278, '5f5', 1ee, 'ce5')" |
|
1471 | 1471 | 0 |
|
1472 | 1472 | |
|
1473 | 1473 | (check operator priority) |
|
1474 | 1474 | |
|
1475 | 1475 | $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc |
|
1476 | 1476 | $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)" |
|
1477 | 1477 | 0 |
|
1478 | 1478 | 4 |
|
1479 | 1479 | |
|
1480 | 1480 | $ cd .. |
|
1481 | 1481 | |
|
1482 | 1482 | prepare repository that has "default" branches of multiple roots |
|
1483 | 1483 | |
|
1484 | 1484 | $ hg init namedbranch |
|
1485 | 1485 | $ cd namedbranch |
|
1486 | 1486 | |
|
1487 | 1487 | $ echo default0 >> a |
|
1488 | 1488 | $ hg ci -Aqm0 |
|
1489 | 1489 | $ echo default1 >> a |
|
1490 | 1490 | $ hg ci -m1 |
|
1491 | 1491 | |
|
1492 | 1492 | $ hg branch -q stable |
|
1493 | 1493 | $ echo stable2 >> a |
|
1494 | 1494 | $ hg ci -m2 |
|
1495 | 1495 | $ echo stable3 >> a |
|
1496 | 1496 | $ hg ci -m3 |
|
1497 | 1497 | |
|
1498 | 1498 | $ hg update -q null |
|
1499 | 1499 | $ echo default4 >> a |
|
1500 | 1500 | $ hg ci -Aqm4 |
|
1501 | 1501 | $ echo default5 >> a |
|
1502 | 1502 | $ hg ci -m5 |
|
1503 | 1503 | |
|
1504 | 1504 | "null" revision belongs to "default" branch (issue4683) |
|
1505 | 1505 | |
|
1506 | 1506 | $ log 'branch(null)' |
|
1507 | 1507 | 0 |
|
1508 | 1508 | 1 |
|
1509 | 1509 | 4 |
|
1510 | 1510 | 5 |
|
1511 | 1511 | |
|
1512 | 1512 | "null" revision belongs to "default" branch, but it shouldn't appear in set |
|
1513 | 1513 | unless explicitly specified (issue4682) |
|
1514 | 1514 | |
|
1515 | 1515 | $ log 'children(branch(default))' |
|
1516 | 1516 | 1 |
|
1517 | 1517 | 2 |
|
1518 | 1518 | 5 |
|
1519 | 1519 | |
|
1520 | 1520 | $ cd .. |
|
1521 | 1521 | |
|
1522 | 1522 | test author/desc/keyword in problematic encoding |
|
1523 | 1523 | # unicode: cp932: |
|
1524 | 1524 | # u30A2 0x83 0x41(= 'A') |
|
1525 | 1525 | # u30C2 0x83 0x61(= 'a') |
|
1526 | 1526 | |
|
1527 | 1527 | $ hg init problematicencoding |
|
1528 | 1528 | $ cd problematicencoding |
|
1529 | 1529 | |
|
1530 | 1530 | $ "$PYTHON" > setup.sh <<EOF |
|
1531 |
> print |
|
|
1531 | > print(u''' | |
|
1532 | 1532 | > echo a > text |
|
1533 | 1533 | > hg add text |
|
1534 | 1534 | > hg --encoding utf-8 commit -u '\u30A2' -m none |
|
1535 | 1535 | > echo b > text |
|
1536 | 1536 | > hg --encoding utf-8 commit -u '\u30C2' -m none |
|
1537 | 1537 | > echo c > text |
|
1538 | 1538 | > hg --encoding utf-8 commit -u none -m '\u30A2' |
|
1539 | 1539 | > echo d > text |
|
1540 | 1540 | > hg --encoding utf-8 commit -u none -m '\u30C2' |
|
1541 | > '''.encode('utf-8') | |
|
1541 | > '''.encode('utf-8')) | |
|
1542 | 1542 | > EOF |
|
1543 | 1543 | $ sh < setup.sh |
|
1544 | 1544 | |
|
1545 | 1545 | test in problematic encoding |
|
1546 | 1546 | $ "$PYTHON" > test.sh <<EOF |
|
1547 |
> print |
|
|
1547 | > print(u''' | |
|
1548 | 1548 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' |
|
1549 | 1549 | > echo ==== |
|
1550 | 1550 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' |
|
1551 | 1551 | > echo ==== |
|
1552 | 1552 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' |
|
1553 | 1553 | > echo ==== |
|
1554 | 1554 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' |
|
1555 | 1555 | > echo ==== |
|
1556 | 1556 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' |
|
1557 | 1557 | > echo ==== |
|
1558 | 1558 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' |
|
1559 | > '''.encode('cp932') | |
|
1559 | > '''.encode('cp932')) | |
|
1560 | 1560 | > EOF |
|
1561 | 1561 | $ sh < test.sh |
|
1562 | 1562 | 0 |
|
1563 | 1563 | ==== |
|
1564 | 1564 | 1 |
|
1565 | 1565 | ==== |
|
1566 | 1566 | 2 |
|
1567 | 1567 | ==== |
|
1568 | 1568 | 3 |
|
1569 | 1569 | ==== |
|
1570 | 1570 | 0 |
|
1571 | 1571 | 2 |
|
1572 | 1572 | ==== |
|
1573 | 1573 | 1 |
|
1574 | 1574 | 3 |
|
1575 | 1575 | |
|
1576 | 1576 | test error message of bad revset |
|
1577 | 1577 | $ hg log -r 'foo\\' |
|
1578 | 1578 | hg: parse error at 3: syntax error in revset 'foo\\' |
|
1579 | 1579 | (foo\\ |
|
1580 | 1580 | ^ here) |
|
1581 | 1581 | [255] |
|
1582 | 1582 | |
|
1583 | 1583 | $ cd .. |
|
1584 | 1584 | |
|
1585 | 1585 | Test that revset predicate of extension isn't loaded at failure of |
|
1586 | 1586 | loading it |
|
1587 | 1587 | |
|
1588 | 1588 | $ cd repo |
|
1589 | 1589 | |
|
1590 | 1590 | $ cat <<EOF > $TESTTMP/custompredicate.py |
|
1591 | 1591 | > from mercurial import error, registrar, revset |
|
1592 | 1592 | > |
|
1593 | 1593 | > revsetpredicate = registrar.revsetpredicate() |
|
1594 | 1594 | > |
|
1595 | 1595 | > @revsetpredicate(b'custom1()') |
|
1596 | 1596 | > def custom1(repo, subset, x): |
|
1597 | 1597 | > return revset.baseset([1]) |
|
1598 | 1598 | > |
|
1599 | 1599 | > raise error.Abort(b'intentional failure of loading extension') |
|
1600 | 1600 | > EOF |
|
1601 | 1601 | $ cat <<EOF > .hg/hgrc |
|
1602 | 1602 | > [extensions] |
|
1603 | 1603 | > custompredicate = $TESTTMP/custompredicate.py |
|
1604 | 1604 | > EOF |
|
1605 | 1605 | |
|
1606 | 1606 | $ hg debugrevspec "custom1()" |
|
1607 | 1607 | *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension |
|
1608 | 1608 | hg: parse error: unknown identifier: custom1 |
|
1609 | 1609 | [255] |
|
1610 | 1610 | |
|
1611 | 1611 | Test repo.anyrevs with customized revset overrides |
|
1612 | 1612 | |
|
1613 | 1613 | $ cat > $TESTTMP/printprevset.py <<EOF |
|
1614 | 1614 | > from mercurial import encoding, registrar |
|
1615 | 1615 | > cmdtable = {} |
|
1616 | 1616 | > command = registrar.command(cmdtable) |
|
1617 | 1617 | > @command(b'printprevset') |
|
1618 | 1618 | > def printprevset(ui, repo): |
|
1619 | 1619 | > alias = {} |
|
1620 | 1620 | > p = encoding.environ.get(b'P') |
|
1621 | 1621 | > if p: |
|
1622 | 1622 | > alias[b'P'] = p |
|
1623 | 1623 | > revs = repo.anyrevs([b'P'], user=True, localalias=alias) |
|
1624 | 1624 | > ui.write(b'P=%r\n' % list(revs)) |
|
1625 | 1625 | > EOF |
|
1626 | 1626 | |
|
1627 | 1627 | $ cat >> .hg/hgrc <<EOF |
|
1628 | 1628 | > custompredicate = ! |
|
1629 | 1629 | > printprevset = $TESTTMP/printprevset.py |
|
1630 | 1630 | > EOF |
|
1631 | 1631 | |
|
1632 | 1632 | $ hg --config revsetalias.P=1 printprevset |
|
1633 | 1633 | P=[1] |
|
1634 | 1634 | $ P=3 hg --config revsetalias.P=2 printprevset |
|
1635 | 1635 | P=[3] |
|
1636 | 1636 | |
|
1637 | 1637 | $ cd .. |
|
1638 | 1638 | |
|
1639 | 1639 | Test obsstore related revsets |
|
1640 | 1640 | |
|
1641 | 1641 | $ hg init repo1 |
|
1642 | 1642 | $ cd repo1 |
|
1643 | 1643 | $ cat <<EOF >> .hg/hgrc |
|
1644 | 1644 | > [experimental] |
|
1645 | 1645 | > evolution.createmarkers=True |
|
1646 | 1646 | > EOF |
|
1647 | 1647 | |
|
1648 | 1648 | $ hg debugdrawdag <<'EOS' |
|
1649 | 1649 | > F G |
|
1650 | 1650 | > |/ # split: B -> E, F |
|
1651 | 1651 | > B C D E # amend: B -> C -> D |
|
1652 | 1652 | > \|/ | # amend: F -> G |
|
1653 | 1653 | > A A Z # amend: A -> Z |
|
1654 | 1654 | > EOS |
|
1655 | 1655 | 3 new orphan changesets |
|
1656 | 1656 | 3 new content-divergent changesets |
|
1657 | 1657 | |
|
1658 | 1658 | $ hg log -r 'successors(Z)' -T '{desc}\n' |
|
1659 | 1659 | Z |
|
1660 | 1660 | |
|
1661 | 1661 | $ hg log -r 'successors(F)' -T '{desc}\n' |
|
1662 | 1662 | F |
|
1663 | 1663 | G |
|
1664 | 1664 | |
|
1665 | 1665 | $ hg tag --remove --local C D E F G |
|
1666 | 1666 | |
|
1667 | 1667 | $ hg log -r 'successors(B)' -T '{desc}\n' |
|
1668 | 1668 | B |
|
1669 | 1669 | D |
|
1670 | 1670 | E |
|
1671 | 1671 | G |
|
1672 | 1672 | |
|
1673 | 1673 | $ hg log -r 'successors(B)' -T '{desc}\n' --hidden |
|
1674 | 1674 | B |
|
1675 | 1675 | C |
|
1676 | 1676 | D |
|
1677 | 1677 | E |
|
1678 | 1678 | F |
|
1679 | 1679 | G |
|
1680 | 1680 | |
|
1681 | 1681 | $ hg log -r 'successors(B)-obsolete()' -T '{desc}\n' --hidden |
|
1682 | 1682 | D |
|
1683 | 1683 | E |
|
1684 | 1684 | G |
|
1685 | 1685 | |
|
1686 | 1686 | $ hg log -r 'successors(B+A)-contentdivergent()' -T '{desc}\n' |
|
1687 | 1687 | A |
|
1688 | 1688 | Z |
|
1689 | 1689 | B |
|
1690 | 1690 | |
|
1691 | 1691 | $ hg log -r 'successors(B+A)-contentdivergent()-obsolete()' -T '{desc}\n' |
|
1692 | 1692 | Z |
|
1693 | 1693 | |
|
1694 | 1694 | Test `draft() & ::x` optimization |
|
1695 | 1695 | |
|
1696 | 1696 | $ hg init $TESTTMP/repo2 |
|
1697 | 1697 | $ cd $TESTTMP/repo2 |
|
1698 | 1698 | $ hg debugdrawdag <<'EOS' |
|
1699 | 1699 | > P5 S1 |
|
1700 | 1700 | > | | |
|
1701 | 1701 | > S2 | D3 |
|
1702 | 1702 | > \|/ |
|
1703 | 1703 | > P4 |
|
1704 | 1704 | > | |
|
1705 | 1705 | > P3 D2 |
|
1706 | 1706 | > | | |
|
1707 | 1707 | > P2 D1 |
|
1708 | 1708 | > |/ |
|
1709 | 1709 | > P1 |
|
1710 | 1710 | > | |
|
1711 | 1711 | > P0 |
|
1712 | 1712 | > EOS |
|
1713 | 1713 | $ hg phase --public -r P5 |
|
1714 | 1714 | $ hg phase --force --secret -r S1+S2 |
|
1715 | 1715 | $ hg log -G -T '{rev} {desc} {phase}' -r 'sort(all(), topo, topo.firstbranch=P5)' |
|
1716 | 1716 | o 8 P5 public |
|
1717 | 1717 | | |
|
1718 | 1718 | | o 10 S1 secret |
|
1719 | 1719 | | | |
|
1720 | 1720 | | o 7 D3 draft |
|
1721 | 1721 | |/ |
|
1722 | 1722 | | o 9 S2 secret |
|
1723 | 1723 | |/ |
|
1724 | 1724 | o 6 P4 public |
|
1725 | 1725 | | |
|
1726 | 1726 | o 5 P3 public |
|
1727 | 1727 | | |
|
1728 | 1728 | o 3 P2 public |
|
1729 | 1729 | | |
|
1730 | 1730 | | o 4 D2 draft |
|
1731 | 1731 | | | |
|
1732 | 1732 | | o 2 D1 draft |
|
1733 | 1733 | |/ |
|
1734 | 1734 | o 1 P1 public |
|
1735 | 1735 | | |
|
1736 | 1736 | o 0 P0 public |
|
1737 | 1737 | |
|
1738 | 1738 | $ hg debugrevspec --verify -p analyzed -p optimized 'draft() & ::(((S1+D1+P5)-D3)+S2)' |
|
1739 | 1739 | * analyzed: |
|
1740 | 1740 | (and |
|
1741 | 1741 | (func |
|
1742 | 1742 | (symbol 'draft') |
|
1743 | 1743 | None) |
|
1744 | 1744 | (func |
|
1745 | 1745 | (symbol 'ancestors') |
|
1746 | 1746 | (or |
|
1747 | 1747 | (list |
|
1748 | 1748 | (and |
|
1749 | 1749 | (or |
|
1750 | 1750 | (list |
|
1751 | 1751 | (symbol 'S1') |
|
1752 | 1752 | (symbol 'D1') |
|
1753 | 1753 | (symbol 'P5'))) |
|
1754 | 1754 | (not |
|
1755 | 1755 | (symbol 'D3'))) |
|
1756 | 1756 | (symbol 'S2'))))) |
|
1757 | 1757 | * optimized: |
|
1758 | 1758 | (func |
|
1759 | 1759 | (symbol '_phaseandancestors') |
|
1760 | 1760 | (list |
|
1761 | 1761 | (symbol 'draft') |
|
1762 | 1762 | (or |
|
1763 | 1763 | (list |
|
1764 | 1764 | (difference |
|
1765 | 1765 | (func |
|
1766 | 1766 | (symbol '_list') |
|
1767 | 1767 | (string 'S1\x00D1\x00P5')) |
|
1768 | 1768 | (symbol 'D3')) |
|
1769 | 1769 | (symbol 'S2'))))) |
|
1770 | 1770 | $ hg debugrevspec --verify -p analyzed -p optimized 'secret() & ::9' |
|
1771 | 1771 | * analyzed: |
|
1772 | 1772 | (and |
|
1773 | 1773 | (func |
|
1774 | 1774 | (symbol 'secret') |
|
1775 | 1775 | None) |
|
1776 | 1776 | (func |
|
1777 | 1777 | (symbol 'ancestors') |
|
1778 | 1778 | (symbol '9'))) |
|
1779 | 1779 | * optimized: |
|
1780 | 1780 | (func |
|
1781 | 1781 | (symbol '_phaseandancestors') |
|
1782 | 1782 | (list |
|
1783 | 1783 | (symbol 'secret') |
|
1784 | 1784 | (symbol '9'))) |
|
1785 | 1785 | $ hg debugrevspec --verify -p analyzed -p optimized '7 & ( (not public()) & ::(tag()) )' |
|
1786 | 1786 | * analyzed: |
|
1787 | 1787 | (and |
|
1788 | 1788 | (symbol '7') |
|
1789 | 1789 | (and |
|
1790 | 1790 | (not |
|
1791 | 1791 | (func |
|
1792 | 1792 | (symbol 'public') |
|
1793 | 1793 | None)) |
|
1794 | 1794 | (func |
|
1795 | 1795 | (symbol 'ancestors') |
|
1796 | 1796 | (func |
|
1797 | 1797 | (symbol 'tag') |
|
1798 | 1798 | None)))) |
|
1799 | 1799 | * optimized: |
|
1800 | 1800 | (and |
|
1801 | 1801 | (symbol '7') |
|
1802 | 1802 | (func |
|
1803 | 1803 | (symbol '_phaseandancestors') |
|
1804 | 1804 | (list |
|
1805 | 1805 | (symbol '_notpublic') |
|
1806 | 1806 | (func |
|
1807 | 1807 | (symbol 'tag') |
|
1808 | 1808 | None)))) |
|
1809 | 1809 | $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, 1)' |
|
1810 | 1810 | * optimized: |
|
1811 | 1811 | (and |
|
1812 | 1812 | (func |
|
1813 | 1813 | (symbol '_notpublic') |
|
1814 | 1814 | None) |
|
1815 | 1815 | (func |
|
1816 | 1816 | (symbol 'ancestors') |
|
1817 | 1817 | (list |
|
1818 | 1818 | (func |
|
1819 | 1819 | (symbol '_list') |
|
1820 | 1820 | (string 'S1\x00D2\x00P5')) |
|
1821 | 1821 | (symbol '1')))) |
|
1822 | 1822 | $ hg debugrevspec --verify -p optimized '(not public()) & ancestors(S1+D2+P5, depth=1)' |
|
1823 | 1823 | * optimized: |
|
1824 | 1824 | (and |
|
1825 | 1825 | (func |
|
1826 | 1826 | (symbol '_notpublic') |
|
1827 | 1827 | None) |
|
1828 | 1828 | (func |
|
1829 | 1829 | (symbol 'ancestors') |
|
1830 | 1830 | (list |
|
1831 | 1831 | (func |
|
1832 | 1832 | (symbol '_list') |
|
1833 | 1833 | (string 'S1\x00D2\x00P5')) |
|
1834 | 1834 | (keyvalue |
|
1835 | 1835 | (symbol 'depth') |
|
1836 | 1836 | (symbol '1'))))) |
|
1837 | 1837 | |
|
1838 | 1838 | test commonancestors and its optimization |
|
1839 | 1839 | |
|
1840 | 1840 | $ hg debugrevspec --verify -p analyzed -p optimized 'heads(commonancestors(head()))' |
|
1841 | 1841 | * analyzed: |
|
1842 | 1842 | (func |
|
1843 | 1843 | (symbol 'heads') |
|
1844 | 1844 | (func |
|
1845 | 1845 | (symbol 'commonancestors') |
|
1846 | 1846 | (func |
|
1847 | 1847 | (symbol 'head') |
|
1848 | 1848 | None))) |
|
1849 | 1849 | * optimized: |
|
1850 | 1850 | (func |
|
1851 | 1851 | (symbol '_commonancestorheads') |
|
1852 | 1852 | (func |
|
1853 | 1853 | (symbol 'head') |
|
1854 | 1854 | None)) |
General Comments 0
You need to be logged in to leave comments.
Login now