##// END OF EJS Templates
tests: extract test-template-map.t from test-command-template.t...
Yuya Nishihara -
r38452:ddce7bdf default
parent child Browse files
Show More
@@ -1,525 +1,526 b''
1 1 test-abort-checkin.t
2 2 test-add.t
3 3 test-addremove-similar.t
4 4 test-addremove.t
5 5 test-amend-subrepo.t
6 6 test-amend.t
7 7 test-ancestor.py
8 8 test-annotate.py
9 9 test-annotate.t
10 10 test-archive-symlinks.t
11 11 test-atomictempfile.py
12 12 test-audit-path.t
13 13 test-audit-subrepo.t
14 14 test-automv.t
15 15 test-backout.t
16 16 test-backwards-remove.t
17 17 test-basic.t
18 18 test-bheads.t
19 19 test-bisect.t
20 20 test-bisect2.t
21 21 test-bisect3.t
22 22 test-blackbox.t
23 23 test-bookmarks-current.t
24 24 test-bookmarks-merge.t
25 25 test-bookmarks-rebase.t
26 26 test-bookmarks-strip.t
27 27 test-bookmarks.t
28 28 test-branch-change.t
29 29 test-branch-option.t
30 30 test-branch-tag-confict.t
31 31 test-branches.t
32 32 test-bundle-phases.t
33 33 test-bundle-type.t
34 34 test-bundle-vs-outgoing.t
35 35 test-bundle2-multiple-changegroups.t
36 36 test-cappedreader.py
37 37 test-casecollision.t
38 38 test-cat.t
39 39 test-cbor.py
40 40 test-censor.t
41 41 test-changelog-exec.t
42 42 test-check-commit.t
43 43 test-check-execute.t
44 44 test-check-interfaces.py
45 45 test-check-module-imports.t
46 46 test-check-pyflakes.t
47 47 test-check-pylint.t
48 48 test-check-shbang.t
49 49 test-children.t
50 50 test-clone-cgi.t
51 51 test-clone-pull-corruption.t
52 52 test-clone-r.t
53 53 test-clone-update-order.t
54 54 test-command-template.t
55 55 test-commit-amend.t
56 56 test-commit-interactive.t
57 57 test-commit-multiple.t
58 58 test-commit-unresolved.t
59 59 test-commit.t
60 60 test-committer.t
61 61 test-completion.t
62 62 test-config-env.py
63 63 test-config.t
64 64 test-conflict.t
65 65 test-confused-revert.t
66 66 test-context.py
67 67 test-contrib-check-code.t
68 68 test-contrib-check-commit.t
69 69 test-convert-authormap.t
70 70 test-convert-clonebranches.t
71 71 test-convert-cvs-branch.t
72 72 test-convert-cvs-detectmerge.t
73 73 test-convert-cvs-synthetic.t
74 74 test-convert-cvs.t
75 75 test-convert-cvsnt-mergepoints.t
76 76 test-convert-datesort.t
77 77 test-convert-filemap.t
78 78 test-convert-hg-sink.t
79 79 test-convert-hg-source.t
80 80 test-convert-hg-startrev.t
81 81 test-convert-splicemap.t
82 82 test-convert-tagsbranch-topology.t
83 83 test-copy-move-merge.t
84 84 test-copy.t
85 85 test-copytrace-heuristics.t
86 86 test-debugbuilddag.t
87 87 test-debugbundle.t
88 88 test-debugextensions.t
89 89 test-debugindexdot.t
90 90 test-debugrename.t
91 91 test-default-push.t
92 92 test-diff-binary-file.t
93 93 test-diff-change.t
94 94 test-diff-copy-depth.t
95 95 test-diff-hashes.t
96 96 test-diff-ignore-whitespace.t
97 97 test-diff-indent-heuristic.t
98 98 test-diff-issue2761.t
99 99 test-diff-newlines.t
100 100 test-diff-reverse.t
101 101 test-diff-subdir.t
102 102 test-diff-unified.t
103 103 test-diff-upgrade.t
104 104 test-diffdir.t
105 105 test-diffstat.t
106 106 test-directaccess.t
107 107 test-dirstate-backup.t
108 108 test-dirstate-nonnormalset.t
109 109 test-dirstate.t
110 110 test-dispatch.py
111 111 test-doctest.py
112 112 test-double-merge.t
113 113 test-drawdag.t
114 114 test-duplicateoptions.py
115 115 test-editor-filename.t
116 116 test-empty-dir.t
117 117 test-empty-file.t
118 118 test-empty-group.t
119 119 test-empty.t
120 120 test-encode.t
121 121 test-encoding-func.py
122 122 test-encoding.t
123 123 test-eol-add.t
124 124 test-eol-clone.t
125 125 test-eol-hook.t
126 126 test-eol-patch.t
127 127 test-eol-tag.t
128 128 test-eol-update.t
129 129 test-eol.t
130 130 test-eolfilename.t
131 131 test-excessive-merge.t
132 132 test-exchange-obsmarkers-case-A1.t
133 133 test-exchange-obsmarkers-case-A2.t
134 134 test-exchange-obsmarkers-case-A3.t
135 135 test-exchange-obsmarkers-case-A4.t
136 136 test-exchange-obsmarkers-case-A5.t
137 137 test-exchange-obsmarkers-case-A6.t
138 138 test-exchange-obsmarkers-case-A7.t
139 139 test-exchange-obsmarkers-case-B1.t
140 140 test-exchange-obsmarkers-case-B2.t
141 141 test-exchange-obsmarkers-case-B3.t
142 142 test-exchange-obsmarkers-case-B4.t
143 143 test-exchange-obsmarkers-case-B5.t
144 144 test-exchange-obsmarkers-case-B6.t
145 145 test-exchange-obsmarkers-case-B7.t
146 146 test-exchange-obsmarkers-case-C1.t
147 147 test-exchange-obsmarkers-case-C2.t
148 148 test-exchange-obsmarkers-case-C3.t
149 149 test-exchange-obsmarkers-case-C4.t
150 150 test-exchange-obsmarkers-case-D1.t
151 151 test-exchange-obsmarkers-case-D2.t
152 152 test-exchange-obsmarkers-case-D3.t
153 153 test-exchange-obsmarkers-case-D4.t
154 154 test-execute-bit.t
155 155 test-export.t
156 156 test-extdata.t
157 157 test-extdiff.t
158 158 test-extensions-afterloaded.t
159 159 test-extensions-wrapfunction.py
160 160 test-extra-filelog-entry.t
161 161 test-fetch.t
162 162 test-filebranch.t
163 163 test-filecache.py
164 164 test-filelog.py
165 165 test-fileset-generated.t
166 166 test-fileset.t
167 167 test-fix-topology.t
168 168 test-flags.t
169 169 test-generaldelta.t
170 170 test-getbundle.t
171 171 test-git-export.t
172 172 test-glog-topological.t
173 173 test-gpg.t
174 174 test-graft.t
175 175 test-hg-parseurl.py
176 176 test-hghave.t
177 177 test-hgignore.t
178 178 test-hgk.t
179 179 test-hgrc.t
180 180 test-hgweb-bundle.t
181 181 test-hgweb-descend-empties.t
182 182 test-hgweb-empty.t
183 183 test-hgweb-removed.t
184 184 test-hgwebdir-paths.py
185 185 test-hgwebdirsym.t
186 186 test-histedit-arguments.t
187 187 test-histedit-base.t
188 188 test-histedit-bookmark-motion.t
189 189 test-histedit-commute.t
190 190 test-histedit-drop.t
191 191 test-histedit-edit.t
192 192 test-histedit-fold-non-commute.t
193 193 test-histedit-fold.t
194 194 test-histedit-no-change.t
195 195 test-histedit-non-commute-abort.t
196 196 test-histedit-non-commute.t
197 197 test-histedit-obsolete.t
198 198 test-histedit-outgoing.t
199 199 test-histedit-templates.t
200 200 test-http-branchmap.t
201 201 test-http-bundle1.t
202 202 test-http-clone-r.t
203 203 test-http.t
204 204 test-hybridencode.py
205 205 test-identify.t
206 206 test-impexp-branch.t
207 207 test-import-bypass.t
208 208 test-import-eol.t
209 209 test-import-merge.t
210 210 test-import-unknown.t
211 211 test-import.t
212 212 test-imports-checker.t
213 213 test-incoming-outgoing.t
214 214 test-inherit-mode.t
215 215 test-init.t
216 216 test-issue1089.t
217 217 test-issue1102.t
218 218 test-issue1175.t
219 219 test-issue1306.t
220 220 test-issue1438.t
221 221 test-issue1502.t
222 222 test-issue1802.t
223 223 test-issue1877.t
224 224 test-issue1993.t
225 225 test-issue2137.t
226 226 test-issue3084.t
227 227 test-issue4074.t
228 228 test-issue522.t
229 229 test-issue586.t
230 230 test-issue612.t
231 231 test-issue619.t
232 232 test-issue660.t
233 233 test-issue672.t
234 234 test-issue842.t
235 235 test-journal-exists.t
236 236 test-journal-share.t
237 237 test-journal.t
238 238 test-known.t
239 239 test-largefiles-cache.t
240 240 test-largefiles-misc.t
241 241 test-largefiles-small-disk.t
242 242 test-largefiles-update.t
243 243 test-largefiles.t
244 244 test-lfs-largefiles.t
245 245 test-lfs-pointer.py
246 246 test-linerange.py
247 247 test-locate.t
248 248 test-lock-badness.t
249 249 test-log-linerange.t
250 250 test-log.t
251 251 test-logexchange.t
252 252 test-lrucachedict.py
253 253 test-mactext.t
254 254 test-mailmap.t
255 255 test-manifest-merging.t
256 256 test-manifest.py
257 257 test-manifest.t
258 258 test-match.py
259 259 test-mdiff.py
260 260 test-merge-changedelete.t
261 261 test-merge-closedheads.t
262 262 test-merge-commit.t
263 263 test-merge-criss-cross.t
264 264 test-merge-default.t
265 265 test-merge-force.t
266 266 test-merge-halt.t
267 267 test-merge-internal-tools-pattern.t
268 268 test-merge-local.t
269 269 test-merge-remove.t
270 270 test-merge-revert.t
271 271 test-merge-revert2.t
272 272 test-merge-subrepos.t
273 273 test-merge-symlinks.t
274 274 test-merge-tools.t
275 275 test-merge-types.t
276 276 test-merge1.t
277 277 test-merge10.t
278 278 test-merge2.t
279 279 test-merge4.t
280 280 test-merge5.t
281 281 test-merge6.t
282 282 test-merge7.t
283 283 test-merge8.t
284 284 test-merge9.t
285 285 test-minifileset.py
286 286 test-minirst.py
287 287 test-mq-git.t
288 288 test-mq-header-date.t
289 289 test-mq-header-from.t
290 290 test-mq-merge.t
291 291 test-mq-pull-from-bundle.t
292 292 test-mq-qclone-http.t
293 293 test-mq-qdelete.t
294 294 test-mq-qdiff.t
295 295 test-mq-qfold.t
296 296 test-mq-qgoto.t
297 297 test-mq-qimport-fail-cleanup.t
298 298 test-mq-qnew.t
299 299 test-mq-qpush-exact.t
300 300 test-mq-qqueue.t
301 301 test-mq-qrefresh-interactive.t
302 302 test-mq-qrefresh-replace-log-message.t
303 303 test-mq-qrefresh.t
304 304 test-mq-qrename.t
305 305 test-mq-qsave.t
306 306 test-mq-safety.t
307 307 test-mq-subrepo.t
308 308 test-mq-symlinks.t
309 309 test-mv-cp-st-diff.t
310 310 test-narrow-archive.t
311 311 test-narrow-clone-no-ellipsis.t
312 312 test-narrow-clone-non-narrow-server.t
313 313 test-narrow-clone-nonlinear.t
314 314 test-narrow-clone.t
315 315 test-narrow-commit.t
316 316 test-narrow-copies.t
317 317 test-narrow-debugcommands.t
318 318 test-narrow-debugrebuilddirstate.t
319 319 test-narrow-exchange-merges.t
320 320 test-narrow-exchange.t
321 321 test-narrow-expanddirstate.t
322 322 test-narrow-merge.t
323 323 test-narrow-patch.t
324 324 test-narrow-patterns.t
325 325 test-narrow-pull.t
326 326 test-narrow-rebase.t
327 327 test-narrow-shallow-merges.t
328 328 test-narrow-shallow.t
329 329 test-narrow-strip.t
330 330 test-narrow-update.t
331 331 test-narrow-widen.t
332 332 test-narrow.t
333 333 test-nested-repo.t
334 334 test-newbranch.t
335 335 test-obshistory.t
336 336 test-obsmarker-template.t
337 337 test-obsmarkers-effectflag.t
338 338 test-obsolete-bundle-strip.t
339 339 test-obsolete-changeset-exchange.t
340 340 test-obsolete-checkheads.t
341 341 test-obsolete-distributed.t
342 342 test-obsolete-tag-cache.t
343 343 test-pager.t
344 344 test-parents.t
345 345 test-parseindex2.py
346 346 test-patch-offset.t
347 347 test-patch.t
348 348 test-pathconflicts-merge.t
349 349 test-pathconflicts-update.t
350 350 test-pathencode.py
351 351 test-pending.t
352 352 test-permissions.t
353 353 test-phases.t
354 354 test-pull-branch.t
355 355 test-pull-http.t
356 356 test-pull-permission.t
357 357 test-pull-pull-corruption.t
358 358 test-pull-r.t
359 359 test-pull-update.t
360 360 test-pull.t
361 361 test-purge.t
362 362 test-push-checkheads-partial-C1.t
363 363 test-push-checkheads-partial-C2.t
364 364 test-push-checkheads-partial-C3.t
365 365 test-push-checkheads-partial-C4.t
366 366 test-push-checkheads-pruned-B1.t
367 367 test-push-checkheads-pruned-B2.t
368 368 test-push-checkheads-pruned-B3.t
369 369 test-push-checkheads-pruned-B4.t
370 370 test-push-checkheads-pruned-B5.t
371 371 test-push-checkheads-pruned-B6.t
372 372 test-push-checkheads-pruned-B7.t
373 373 test-push-checkheads-pruned-B8.t
374 374 test-push-checkheads-superceed-A1.t
375 375 test-push-checkheads-superceed-A2.t
376 376 test-push-checkheads-superceed-A3.t
377 377 test-push-checkheads-superceed-A4.t
378 378 test-push-checkheads-superceed-A5.t
379 379 test-push-checkheads-superceed-A6.t
380 380 test-push-checkheads-superceed-A7.t
381 381 test-push-checkheads-superceed-A8.t
382 382 test-push-checkheads-unpushed-D1.t
383 383 test-push-checkheads-unpushed-D2.t
384 384 test-push-checkheads-unpushed-D3.t
385 385 test-push-checkheads-unpushed-D4.t
386 386 test-push-checkheads-unpushed-D5.t
387 387 test-push-checkheads-unpushed-D6.t
388 388 test-push-checkheads-unpushed-D7.t
389 389 test-push-http.t
390 390 test-push-warn.t
391 391 test-push.t
392 392 test-pushvars.t
393 393 test-qrecord.t
394 394 test-rebase-abort.t
395 395 test-rebase-base-flag.t
396 396 test-rebase-bookmarks.t
397 397 test-rebase-brute-force.t
398 398 test-rebase-cache.t
399 399 test-rebase-check-restore.t
400 400 test-rebase-collapse.t
401 401 test-rebase-conflicts.t
402 402 test-rebase-dest.t
403 403 test-rebase-detach.t
404 404 test-rebase-emptycommit.t
405 405 test-rebase-inmemory.t
406 406 test-rebase-interruptions.t
407 407 test-rebase-issue-noparam-single-rev.t
408 408 test-rebase-legacy.t
409 409 test-rebase-mq-skip.t
410 410 test-rebase-mq.t
411 411 test-rebase-named-branches.t
412 412 test-rebase-newancestor.t
413 413 test-rebase-obsolete.t
414 414 test-rebase-parameters.t
415 415 test-rebase-partial.t
416 416 test-rebase-pull.t
417 417 test-rebase-rename.t
418 418 test-rebase-scenario-global.t
419 419 test-rebase-templates.t
420 420 test-rebase-transaction.t
421 421 test-rebuildstate.t
422 422 test-record.t
423 423 test-relink.t
424 424 test-remove.t
425 425 test-rename-after-merge.t
426 426 test-rename-dir-merge.t
427 427 test-rename-merge1.t
428 428 test-rename.t
429 429 test-repair-strip.t
430 430 test-repo-compengines.t
431 431 test-resolve.t
432 432 test-revert-flags.t
433 433 test-revert-interactive.t
434 434 test-revert-unknown.t
435 435 test-revlog-ancestry.py
436 436 test-revlog-group-emptyiter.t
437 437 test-revlog-mmapindex.t
438 438 test-revlog-packentry.t
439 439 test-revlog-raw.py
440 440 test-revlog-v2.t
441 441 test-revset-dirstate-parents.t
442 442 test-revset-legacy-lookup.t
443 443 test-revset-outgoing.t
444 444 test-rollback.t
445 445 test-run-tests.py
446 446 test-run-tests.t
447 447 test-schemes.t
448 448 test-serve.t
449 449 test-setdiscovery.t
450 450 test-share.t
451 451 test-shelve.t
452 452 test-show-stack.t
453 453 test-show-work.t
454 454 test-show.t
455 455 test-simple-update.t
456 456 test-simplekeyvaluefile.py
457 457 test-simplemerge.py
458 458 test-single-head.t
459 459 test-sparse-clear.t
460 460 test-sparse-clone.t
461 461 test-sparse-import.t
462 462 test-sparse-merges.t
463 463 test-sparse-profiles.t
464 464 test-sparse-requirement.t
465 465 test-sparse-verbose-json.t
466 466 test-sparse.t
467 467 test-split.t
468 468 test-ssh-bundle1.t
469 469 test-ssh-clone-r.t
470 470 test-ssh-proto-unbundle.t
471 471 test-ssh-proto.t
472 472 test-ssh.t
473 473 test-sshserver.py
474 474 test-stack.t
475 475 test-status-inprocess.py
476 476 test-status-rev.t
477 477 test-status-terse.t
478 478 test-strict.t
479 479 test-strip-cross.t
480 480 test-strip.t
481 481 test-subrepo-deep-nested-change.t
482 482 test-subrepo-missing.t
483 483 test-subrepo-paths.t
484 484 test-subrepo-recursion.t
485 485 test-subrepo-relative-path.t
486 486 test-subrepo.t
487 487 test-symlink-os-yes-fs-no.py
488 488 test-symlink-placeholder.t
489 489 test-symlinks.t
490 490 test-tag.t
491 491 test-tags.t
492 492 test-template-filters.t
493 test-template-map.t
493 494 test-transplant.t
494 495 test-treemanifest.t
495 496 test-ui-color.py
496 497 test-ui-config.py
497 498 test-ui-verbosity.py
498 499 test-unamend.t
499 500 test-unbundlehash.t
500 501 test-uncommit.t
501 502 test-unified-test.t
502 503 test-unionrepo.t
503 504 test-unrelated-pull.t
504 505 test-up-local-change.t
505 506 test-update-branches.t
506 507 test-update-dest.t
507 508 test-update-issue1456.t
508 509 test-update-names.t
509 510 test-update-reverse.t
510 511 test-upgrade-repo.t
511 512 test-url-download.t
512 513 test-url-rev.t
513 514 test-url.py
514 515 test-username-newline.t
515 516 test-verify.t
516 517 test-walk.t
517 518 test-walkrepo.py
518 519 test-websub.t
519 520 test-win32text.t
520 521 test-wireproto-clientreactor.py
521 522 test-wireproto-framing.py
522 523 test-wireproto-serverreactor.py
523 524 test-wireproto.py
524 525 test-wsgirequest.py
525 526 test-xdg.t
This diff has been collapsed as it changes many lines, (1668 lines changed) Show them Hide them
@@ -1,5041 +1,3389 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo a > a
4 4 $ hg add a
5 5 $ echo line 1 > b
6 6 $ echo line 2 >> b
7 7 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
8 8
9 9 $ hg add b
10 10 $ echo other 1 > c
11 11 $ echo other 2 >> c
12 12 $ echo >> c
13 13 $ echo other 3 >> c
14 14 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
15 15
16 16 $ hg add c
17 17 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 18 $ echo c >> c
19 19 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20 20
21 21 $ echo foo > .hg/branch
22 22 $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
23 23
24 24 $ hg co -q 3
25 25 $ echo other 4 >> d
26 26 $ hg add d
27 27 $ hg commit -m 'new head' -d '1500000 0' -u 'person'
28 28
29 29 $ hg merge -q foo
30 30 $ hg commit -m 'merge' -d '1500001 0' -u 'person'
31 31
32 32 Test arithmetic operators have the right precedence:
33 33
34 34 $ hg log -l 1 -T '{date(date, "%Y") + 5 * 10} {date(date, "%Y") - 2 * 3}\n'
35 35 2020 1964
36 36 $ hg log -l 1 -T '{date(date, "%Y") * 5 + 10} {date(date, "%Y") * 3 - 2}\n'
37 37 9860 5908
38 38
39 39 Test division:
40 40
41 41 $ hg debugtemplate -r0 -v '{5 / 2} {mod(5, 2)}\n'
42 42 (template
43 43 (/
44 44 (integer '5')
45 45 (integer '2'))
46 46 (string ' ')
47 47 (func
48 48 (symbol 'mod')
49 49 (list
50 50 (integer '5')
51 51 (integer '2')))
52 52 (string '\n'))
53 53 * keywords:
54 54 * functions: mod
55 55 2 1
56 56 $ hg debugtemplate -r0 -v '{5 / -2} {mod(5, -2)}\n'
57 57 (template
58 58 (/
59 59 (integer '5')
60 60 (negate
61 61 (integer '2')))
62 62 (string ' ')
63 63 (func
64 64 (symbol 'mod')
65 65 (list
66 66 (integer '5')
67 67 (negate
68 68 (integer '2'))))
69 69 (string '\n'))
70 70 * keywords:
71 71 * functions: mod
72 72 -3 -1
73 73 $ hg debugtemplate -r0 -v '{-5 / 2} {mod(-5, 2)}\n'
74 74 (template
75 75 (/
76 76 (negate
77 77 (integer '5'))
78 78 (integer '2'))
79 79 (string ' ')
80 80 (func
81 81 (symbol 'mod')
82 82 (list
83 83 (negate
84 84 (integer '5'))
85 85 (integer '2')))
86 86 (string '\n'))
87 87 * keywords:
88 88 * functions: mod
89 89 -3 1
90 90 $ hg debugtemplate -r0 -v '{-5 / -2} {mod(-5, -2)}\n'
91 91 (template
92 92 (/
93 93 (negate
94 94 (integer '5'))
95 95 (negate
96 96 (integer '2')))
97 97 (string ' ')
98 98 (func
99 99 (symbol 'mod')
100 100 (list
101 101 (negate
102 102 (integer '5'))
103 103 (negate
104 104 (integer '2'))))
105 105 (string '\n'))
106 106 * keywords:
107 107 * functions: mod
108 108 2 -1
109 109
110 110 Filters bind closer than arithmetic:
111 111
112 112 $ hg debugtemplate -r0 -v '{revset(".")|count - 1}\n'
113 113 (template
114 114 (-
115 115 (|
116 116 (func
117 117 (symbol 'revset')
118 118 (string '.'))
119 119 (symbol 'count'))
120 120 (integer '1'))
121 121 (string '\n'))
122 122 * keywords:
123 123 * functions: count, revset
124 124 0
125 125
126 126 But negate binds closer still:
127 127
128 128 $ hg debugtemplate -r0 -v '{1-3|stringify}\n'
129 129 (template
130 130 (-
131 131 (integer '1')
132 132 (|
133 133 (integer '3')
134 134 (symbol 'stringify')))
135 135 (string '\n'))
136 136 * keywords:
137 137 * functions: stringify
138 138 hg: parse error: arithmetic only defined on integers
139 139 [255]
140 140 $ hg debugtemplate -r0 -v '{-3|stringify}\n'
141 141 (template
142 142 (|
143 143 (negate
144 144 (integer '3'))
145 145 (symbol 'stringify'))
146 146 (string '\n'))
147 147 * keywords:
148 148 * functions: stringify
149 149 -3
150 150
151 151 Filters bind as close as map operator:
152 152
153 153 $ hg debugtemplate -r0 -v '{desc|splitlines % "{line}\n"}'
154 154 (template
155 155 (%
156 156 (|
157 157 (symbol 'desc')
158 158 (symbol 'splitlines'))
159 159 (template
160 160 (symbol 'line')
161 161 (string '\n'))))
162 162 * keywords: desc, line
163 163 * functions: splitlines
164 164 line 1
165 165 line 2
166 166
167 167 Keyword arguments:
168 168
169 169 $ hg debugtemplate -r0 -v '{foo=bar|baz}'
170 170 (template
171 171 (keyvalue
172 172 (symbol 'foo')
173 173 (|
174 174 (symbol 'bar')
175 175 (symbol 'baz'))))
176 176 * keywords: bar, foo
177 177 * functions: baz
178 178 hg: parse error: can't use a key-value pair in this context
179 179 [255]
180 180
181 181 $ hg debugtemplate '{pad("foo", width=10, left=true)}\n'
182 182 foo
183 183
184 184 Call function which takes named arguments by filter syntax:
185 185
186 186 $ hg debugtemplate '{" "|separate}'
187 187 $ hg debugtemplate '{("not", "an", "argument", "list")|separate}'
188 188 hg: parse error: unknown method 'list'
189 189 [255]
190 190
191 191 Second branch starting at nullrev:
192 192
193 193 $ hg update null
194 194 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
195 195 $ echo second > second
196 196 $ hg add second
197 197 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
198 198 created new head
199 199
200 200 $ echo third > third
201 201 $ hg add third
202 202 $ hg mv second fourth
203 203 $ hg commit -m third -d "2020-01-01 10:01"
204 204
205 205 $ hg log --template '{join(file_copies, ",\n")}\n' -r .
206 206 fourth (second)
207 207 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
208 208 second -> fourth
209 209 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
210 210 8 t
211 211 7 f
212 212
213 213 Working-directory revision has special identifiers, though they are still
214 214 experimental:
215 215
216 216 $ hg log -r 'wdir()' -T '{rev}:{node}\n'
217 217 2147483647:ffffffffffffffffffffffffffffffffffffffff
218 218
219 219 Some keywords are invalid for working-directory revision, but they should
220 220 never cause crash:
221 221
222 222 $ hg log -r 'wdir()' -T '{manifest}\n'
223 223
224 224
225 225 Internal resources shouldn't be exposed (issue5699):
226 226
227 227 $ hg log -r. -T '{cache}{ctx}{repo}{revcache}{templ}{ui}'
228 228
229 229 Never crash on internal resource not available:
230 230
231 231 $ hg --cwd .. debugtemplate '{"c0bebeef"|shortest}\n'
232 232 abort: template resource not available: repo
233 233 [255]
234 234
235 235 $ hg config -T '{author}'
236 236
237 237 Quoting for ui.logtemplate
238 238
239 239 $ hg tip --config "ui.logtemplate={rev}\n"
240 240 8
241 241 $ hg tip --config "ui.logtemplate='{rev}\n'"
242 242 8
243 243 $ hg tip --config 'ui.logtemplate="{rev}\n"'
244 244 8
245 245 $ hg tip --config 'ui.logtemplate=n{rev}\n'
246 246 n8
247 247
248 Make sure user/global hgrc does not affect tests
249
250 $ echo '[ui]' > .hg/hgrc
251 $ echo 'logtemplate =' >> .hg/hgrc
252 $ echo 'style =' >> .hg/hgrc
253
254 Add some simple styles to settings
255
256 $ cat <<'EOF' >> .hg/hgrc
257 > [templates]
258 > simple = "{rev}\n"
259 > simple2 = {rev}\n
260 > rev = "should not precede {rev} keyword\n"
261 > EOF
262
263 $ hg log -l1 -Tsimple
264 8
265 $ hg log -l1 -Tsimple2
266 8
267 $ hg log -l1 -Trev
268 should not precede 8 keyword
269 $ hg log -l1 -T '{simple}'
270 8
271
272 Map file shouldn't see user templates:
273
274 $ cat <<EOF > tmpl
275 > changeset = 'nothing expanded:{simple}\n'
276 > EOF
277 $ hg log -l1 --style ./tmpl
278 nothing expanded:
279
280 Test templates and style maps in files:
281
282 $ echo "{rev}" > tmpl
283 $ hg log -l1 -T./tmpl
284 8
285 $ hg log -l1 -Tblah/blah
286 blah/blah (no-eol)
287
288 $ printf 'changeset = "{rev}\\n"\n' > map-simple
289 $ hg log -l1 -T./map-simple
290 8
291
292 a map file may have [templates] and [templatealias] sections:
293
294 $ cat <<'EOF' > map-simple
295 > [templates]
296 > changeset = "{a}\n"
297 > [templatealias]
298 > a = rev
299 > EOF
300 $ hg log -l1 -T./map-simple
301 8
302
303 so it can be included in hgrc
304
305 $ cat <<EOF > myhgrc
306 > %include $HGRCPATH
307 > %include map-simple
308 > [templates]
309 > foo = "{changeset}"
310 > EOF
311 $ HGRCPATH=./myhgrc hg log -l1 -Tfoo
312 8
313 $ HGRCPATH=./myhgrc hg log -l1 -T'{a}\n'
314 8
315
316 Test template map inheritance
317
318 $ echo "__base__ = map-cmdline.default" > map-simple
319 $ printf 'cset = "changeset: ***{rev}***\\n"\n' >> map-simple
320 $ hg log -l1 -T./map-simple
321 changeset: ***8***
322 tag: tip
323 user: test
324 date: Wed Jan 01 10:01:00 2020 +0000
325 summary: third
326
327
328 Test docheader, docfooter and separator in template map
329
330 $ cat <<'EOF' > map-myjson
331 > docheader = '\{\n'
332 > docfooter = '\n}\n'
333 > separator = ',\n'
334 > changeset = ' {dict(rev, node|short)|json}'
335 > EOF
336 $ hg log -l2 -T./map-myjson
337 {
338 {"node": "95c24699272e", "rev": 8},
339 {"node": "29114dbae42b", "rev": 7}
340 }
341
342 Test docheader, docfooter and separator in [templates] section
343
344 $ cat <<'EOF' >> .hg/hgrc
345 > [templates]
346 > myjson = ' {dict(rev, node|short)|json}'
347 > myjson:docheader = '\{\n'
348 > myjson:docfooter = '\n}\n'
349 > myjson:separator = ',\n'
350 > :docheader = 'should not be selected as a docheader for literal templates\n'
351 > EOF
352 $ hg log -l2 -Tmyjson
353 {
354 {"node": "95c24699272e", "rev": 8},
355 {"node": "29114dbae42b", "rev": 7}
356 }
357 $ hg log -l1 -T'{rev}\n'
358 8
359
360 Template should precede style option
361
362 $ hg log -l1 --style default -T '{rev}\n'
363 8
364
365 Add a commit with empty description, to ensure that the templates
366 below will omit the description line.
367
368 $ echo c >> c
369 $ hg add c
370 $ hg commit -qm ' '
371
372 Default style is like normal output. Phases style should be the same
373 as default style, except for extra phase lines.
374
375 $ hg log > log.out
376 $ hg log --style default > style.out
377 $ cmp log.out style.out || diff -u log.out style.out
378 $ hg log -T phases > phases.out
379 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
380 +phase: draft
381 +phase: draft
382 +phase: draft
383 +phase: draft
384 +phase: draft
385 +phase: draft
386 +phase: draft
387 +phase: draft
388 +phase: draft
389 +phase: draft
390
391 $ hg log -v > log.out
392 $ hg log -v --style default > style.out
393 $ cmp log.out style.out || diff -u log.out style.out
394 $ hg log -v -T phases > phases.out
395 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
396 +phase: draft
397 +phase: draft
398 +phase: draft
399 +phase: draft
400 +phase: draft
401 +phase: draft
402 +phase: draft
403 +phase: draft
404 +phase: draft
405 +phase: draft
406
407 $ hg log -q > log.out
408 $ hg log -q --style default > style.out
409 $ cmp log.out style.out || diff -u log.out style.out
410 $ hg log -q -T phases > phases.out
411 $ cmp log.out phases.out || diff -u log.out phases.out
412
413 $ hg log --debug > log.out
414 $ hg log --debug --style default > style.out
415 $ cmp log.out style.out || diff -u log.out style.out
416 $ hg log --debug -T phases > phases.out
417 $ cmp log.out phases.out || diff -u log.out phases.out
418
419 Default style of working-directory revision should also be the same (but
420 date may change while running tests):
421
422 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
423 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
424 $ cmp log.out style.out || diff -u log.out style.out
425
426 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
427 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
428 $ cmp log.out style.out || diff -u log.out style.out
429
430 $ hg log -r 'wdir()' -q > log.out
431 $ hg log -r 'wdir()' -q --style default > style.out
432 $ cmp log.out style.out || diff -u log.out style.out
433
434 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
435 $ hg log -r 'wdir()' --debug --style default \
436 > | sed 's|^date:.*|date:|' > style.out
437 $ cmp log.out style.out || diff -u log.out style.out
438
439 Default style should also preserve color information (issue2866):
440
441 $ cp $HGRCPATH $HGRCPATH-bak
442 $ cat <<EOF >> $HGRCPATH
443 > [extensions]
444 > color=
445 > EOF
446
447 $ hg --color=debug log > log.out
448 $ hg --color=debug log --style default > style.out
449 $ cmp log.out style.out || diff -u log.out style.out
450 $ hg --color=debug log -T phases > phases.out
451 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
452 +[log.phase|phase: draft]
453 +[log.phase|phase: draft]
454 +[log.phase|phase: draft]
455 +[log.phase|phase: draft]
456 +[log.phase|phase: draft]
457 +[log.phase|phase: draft]
458 +[log.phase|phase: draft]
459 +[log.phase|phase: draft]
460 +[log.phase|phase: draft]
461 +[log.phase|phase: draft]
462
463 $ hg --color=debug -v log > log.out
464 $ hg --color=debug -v log --style default > style.out
465 $ cmp log.out style.out || diff -u log.out style.out
466 $ hg --color=debug -v log -T phases > phases.out
467 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
468 +[log.phase|phase: draft]
469 +[log.phase|phase: draft]
470 +[log.phase|phase: draft]
471 +[log.phase|phase: draft]
472 +[log.phase|phase: draft]
473 +[log.phase|phase: draft]
474 +[log.phase|phase: draft]
475 +[log.phase|phase: draft]
476 +[log.phase|phase: draft]
477 +[log.phase|phase: draft]
478
479 $ hg --color=debug -q log > log.out
480 $ hg --color=debug -q log --style default > style.out
481 $ cmp log.out style.out || diff -u log.out style.out
482 $ hg --color=debug -q log -T phases > phases.out
483 $ cmp log.out phases.out || diff -u log.out phases.out
484
485 $ hg --color=debug --debug log > log.out
486 $ hg --color=debug --debug log --style default > style.out
487 $ cmp log.out style.out || diff -u log.out style.out
488 $ hg --color=debug --debug log -T phases > phases.out
489 $ cmp log.out phases.out || diff -u log.out phases.out
490
491 $ mv $HGRCPATH-bak $HGRCPATH
492
493 Remove commit with empty commit message, so as to not pollute further
494 tests.
495
496 $ hg --config extensions.strip= strip -q .
497
498 Revision with no copies (used to print a traceback):
499
500 $ hg tip -v --template '\n'
501
502
503 Compact style works:
504
505 $ hg log -Tcompact
506 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
507 third
508
509 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
510 second
511
512 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
513 merge
514
515 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
516 new head
517
518 4 bbe44766e73d 1970-01-17 04:53 +0000 person
519 new branch
520
521 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
522 no user, no domain
523
524 2 97054abb4ab8 1970-01-14 21:20 +0000 other
525 no person
526
527 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
528 other 1
529
530 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
531 line 1
532
533
534 $ hg log -v --style compact
535 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
536 third
537
538 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
539 second
540
541 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
542 merge
543
544 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
545 new head
546
547 4 bbe44766e73d 1970-01-17 04:53 +0000 person
548 new branch
549
550 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
551 no user, no domain
552
553 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
554 no person
555
556 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
557 other 1
558 other 2
559
560 other 3
561
562 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
563 line 1
564 line 2
565
566
567 $ hg log --debug --style compact
568 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
569 third
570
571 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
572 second
573
574 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
575 merge
576
577 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
578 new head
579
580 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
581 new branch
582
583 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
584 no user, no domain
585
586 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
587 no person
588
589 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
590 other 1
591 other 2
592
593 other 3
594
595 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
596 line 1
597 line 2
598
599
600 Test xml styles:
601
602 $ hg log --style xml -r 'not all()'
603 <?xml version="1.0"?>
604 <log>
605 </log>
606
607 $ hg log --style xml
608 <?xml version="1.0"?>
609 <log>
610 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
611 <tag>tip</tag>
612 <author email="test">test</author>
613 <date>2020-01-01T10:01:00+00:00</date>
614 <msg xml:space="preserve">third</msg>
615 </logentry>
616 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
617 <parent revision="-1" node="0000000000000000000000000000000000000000" />
618 <author email="user@hostname">User Name</author>
619 <date>1970-01-12T13:46:40+00:00</date>
620 <msg xml:space="preserve">second</msg>
621 </logentry>
622 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
623 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
624 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
625 <author email="person">person</author>
626 <date>1970-01-18T08:40:01+00:00</date>
627 <msg xml:space="preserve">merge</msg>
628 </logentry>
629 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
630 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
631 <author email="person">person</author>
632 <date>1970-01-18T08:40:00+00:00</date>
633 <msg xml:space="preserve">new head</msg>
634 </logentry>
635 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
636 <branch>foo</branch>
637 <author email="person">person</author>
638 <date>1970-01-17T04:53:20+00:00</date>
639 <msg xml:space="preserve">new branch</msg>
640 </logentry>
641 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
642 <author email="person">person</author>
643 <date>1970-01-16T01:06:40+00:00</date>
644 <msg xml:space="preserve">no user, no domain</msg>
645 </logentry>
646 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
647 <author email="other@place">other</author>
648 <date>1970-01-14T21:20:00+00:00</date>
649 <msg xml:space="preserve">no person</msg>
650 </logentry>
651 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
652 <author email="other@place">A. N. Other</author>
653 <date>1970-01-13T17:33:20+00:00</date>
654 <msg xml:space="preserve">other 1
655 other 2
656
657 other 3</msg>
658 </logentry>
659 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
660 <author email="user@hostname">User Name</author>
661 <date>1970-01-12T13:46:40+00:00</date>
662 <msg xml:space="preserve">line 1
663 line 2</msg>
664 </logentry>
665 </log>
666
667 $ hg log -v --style xml
668 <?xml version="1.0"?>
669 <log>
670 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
671 <tag>tip</tag>
672 <author email="test">test</author>
673 <date>2020-01-01T10:01:00+00:00</date>
674 <msg xml:space="preserve">third</msg>
675 <paths>
676 <path action="A">fourth</path>
677 <path action="A">third</path>
678 <path action="R">second</path>
679 </paths>
680 <copies>
681 <copy source="second">fourth</copy>
682 </copies>
683 </logentry>
684 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
685 <parent revision="-1" node="0000000000000000000000000000000000000000" />
686 <author email="user@hostname">User Name</author>
687 <date>1970-01-12T13:46:40+00:00</date>
688 <msg xml:space="preserve">second</msg>
689 <paths>
690 <path action="A">second</path>
691 </paths>
692 </logentry>
693 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
694 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
695 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
696 <author email="person">person</author>
697 <date>1970-01-18T08:40:01+00:00</date>
698 <msg xml:space="preserve">merge</msg>
699 <paths>
700 </paths>
701 </logentry>
702 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
703 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
704 <author email="person">person</author>
705 <date>1970-01-18T08:40:00+00:00</date>
706 <msg xml:space="preserve">new head</msg>
707 <paths>
708 <path action="A">d</path>
709 </paths>
710 </logentry>
711 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
712 <branch>foo</branch>
713 <author email="person">person</author>
714 <date>1970-01-17T04:53:20+00:00</date>
715 <msg xml:space="preserve">new branch</msg>
716 <paths>
717 </paths>
718 </logentry>
719 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
720 <author email="person">person</author>
721 <date>1970-01-16T01:06:40+00:00</date>
722 <msg xml:space="preserve">no user, no domain</msg>
723 <paths>
724 <path action="M">c</path>
725 </paths>
726 </logentry>
727 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
728 <author email="other@place">other</author>
729 <date>1970-01-14T21:20:00+00:00</date>
730 <msg xml:space="preserve">no person</msg>
731 <paths>
732 <path action="A">c</path>
733 </paths>
734 </logentry>
735 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
736 <author email="other@place">A. N. Other</author>
737 <date>1970-01-13T17:33:20+00:00</date>
738 <msg xml:space="preserve">other 1
739 other 2
740
741 other 3</msg>
742 <paths>
743 <path action="A">b</path>
744 </paths>
745 </logentry>
746 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
747 <author email="user@hostname">User Name</author>
748 <date>1970-01-12T13:46:40+00:00</date>
749 <msg xml:space="preserve">line 1
750 line 2</msg>
751 <paths>
752 <path action="A">a</path>
753 </paths>
754 </logentry>
755 </log>
756
757 $ hg log --debug --style xml
758 <?xml version="1.0"?>
759 <log>
760 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
761 <tag>tip</tag>
762 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
763 <parent revision="-1" node="0000000000000000000000000000000000000000" />
764 <author email="test">test</author>
765 <date>2020-01-01T10:01:00+00:00</date>
766 <msg xml:space="preserve">third</msg>
767 <paths>
768 <path action="A">fourth</path>
769 <path action="A">third</path>
770 <path action="R">second</path>
771 </paths>
772 <copies>
773 <copy source="second">fourth</copy>
774 </copies>
775 <extra key="branch">default</extra>
776 </logentry>
777 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
778 <parent revision="-1" node="0000000000000000000000000000000000000000" />
779 <parent revision="-1" node="0000000000000000000000000000000000000000" />
780 <author email="user@hostname">User Name</author>
781 <date>1970-01-12T13:46:40+00:00</date>
782 <msg xml:space="preserve">second</msg>
783 <paths>
784 <path action="A">second</path>
785 </paths>
786 <extra key="branch">default</extra>
787 </logentry>
788 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
789 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
790 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
791 <author email="person">person</author>
792 <date>1970-01-18T08:40:01+00:00</date>
793 <msg xml:space="preserve">merge</msg>
794 <paths>
795 </paths>
796 <extra key="branch">default</extra>
797 </logentry>
798 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
799 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
800 <parent revision="-1" node="0000000000000000000000000000000000000000" />
801 <author email="person">person</author>
802 <date>1970-01-18T08:40:00+00:00</date>
803 <msg xml:space="preserve">new head</msg>
804 <paths>
805 <path action="A">d</path>
806 </paths>
807 <extra key="branch">default</extra>
808 </logentry>
809 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
810 <branch>foo</branch>
811 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
812 <parent revision="-1" node="0000000000000000000000000000000000000000" />
813 <author email="person">person</author>
814 <date>1970-01-17T04:53:20+00:00</date>
815 <msg xml:space="preserve">new branch</msg>
816 <paths>
817 </paths>
818 <extra key="branch">foo</extra>
819 </logentry>
820 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
821 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
822 <parent revision="-1" node="0000000000000000000000000000000000000000" />
823 <author email="person">person</author>
824 <date>1970-01-16T01:06:40+00:00</date>
825 <msg xml:space="preserve">no user, no domain</msg>
826 <paths>
827 <path action="M">c</path>
828 </paths>
829 <extra key="branch">default</extra>
830 </logentry>
831 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
832 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
833 <parent revision="-1" node="0000000000000000000000000000000000000000" />
834 <author email="other@place">other</author>
835 <date>1970-01-14T21:20:00+00:00</date>
836 <msg xml:space="preserve">no person</msg>
837 <paths>
838 <path action="A">c</path>
839 </paths>
840 <extra key="branch">default</extra>
841 </logentry>
842 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
843 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
844 <parent revision="-1" node="0000000000000000000000000000000000000000" />
845 <author email="other@place">A. N. Other</author>
846 <date>1970-01-13T17:33:20+00:00</date>
847 <msg xml:space="preserve">other 1
848 other 2
849
850 other 3</msg>
851 <paths>
852 <path action="A">b</path>
853 </paths>
854 <extra key="branch">default</extra>
855 </logentry>
856 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
857 <parent revision="-1" node="0000000000000000000000000000000000000000" />
858 <parent revision="-1" node="0000000000000000000000000000000000000000" />
859 <author email="user@hostname">User Name</author>
860 <date>1970-01-12T13:46:40+00:00</date>
861 <msg xml:space="preserve">line 1
862 line 2</msg>
863 <paths>
864 <path action="A">a</path>
865 </paths>
866 <extra key="branch">default</extra>
867 </logentry>
868 </log>
869
870
871 Test JSON style:
872
873 $ hg log -k nosuch -Tjson
874 [
875 ]
876
877 $ hg log -qr . -Tjson
878 [
879 {
880 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
881 "rev": 8
882 }
883 ]
884
885 $ hg log -vpr . -Tjson --stat
886 [
887 {
888 "bookmarks": [],
889 "branch": "default",
890 "date": [1577872860, 0],
891 "desc": "third",
892 "diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n",
893 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
894 "files": ["fourth", "second", "third"],
895 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
896 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
897 "phase": "draft",
898 "rev": 8,
899 "tags": ["tip"],
900 "user": "test"
901 }
902 ]
903
904 honor --git but not format-breaking diffopts
905 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
906 [
907 {
908 "bookmarks": [],
909 "branch": "default",
910 "date": [1577872860, 0],
911 "desc": "third",
912 "diff": "diff --git a/second b/fourth\nrename from second\nrename to fourth\ndiff --git a/third b/third\nnew file mode 100644\n--- /dev/null\n+++ b/third\n@@ -0,0 +1,1 @@\n+third\n",
913 "files": ["fourth", "second", "third"],
914 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
915 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
916 "phase": "draft",
917 "rev": 8,
918 "tags": ["tip"],
919 "user": "test"
920 }
921 ]
922
923 $ hg log -T json
924 [
925 {
926 "bookmarks": [],
927 "branch": "default",
928 "date": [1577872860, 0],
929 "desc": "third",
930 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
931 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
932 "phase": "draft",
933 "rev": 8,
934 "tags": ["tip"],
935 "user": "test"
936 },
937 {
938 "bookmarks": [],
939 "branch": "default",
940 "date": [1000000, 0],
941 "desc": "second",
942 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
943 "parents": ["0000000000000000000000000000000000000000"],
944 "phase": "draft",
945 "rev": 7,
946 "tags": [],
947 "user": "User Name <user@hostname>"
948 },
949 {
950 "bookmarks": [],
951 "branch": "default",
952 "date": [1500001, 0],
953 "desc": "merge",
954 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
955 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
956 "phase": "draft",
957 "rev": 6,
958 "tags": [],
959 "user": "person"
960 },
961 {
962 "bookmarks": [],
963 "branch": "default",
964 "date": [1500000, 0],
965 "desc": "new head",
966 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
967 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
968 "phase": "draft",
969 "rev": 5,
970 "tags": [],
971 "user": "person"
972 },
973 {
974 "bookmarks": [],
975 "branch": "foo",
976 "date": [1400000, 0],
977 "desc": "new branch",
978 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
979 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
980 "phase": "draft",
981 "rev": 4,
982 "tags": [],
983 "user": "person"
984 },
985 {
986 "bookmarks": [],
987 "branch": "default",
988 "date": [1300000, 0],
989 "desc": "no user, no domain",
990 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
991 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
992 "phase": "draft",
993 "rev": 3,
994 "tags": [],
995 "user": "person"
996 },
997 {
998 "bookmarks": [],
999 "branch": "default",
1000 "date": [1200000, 0],
1001 "desc": "no person",
1002 "node": "97054abb4ab824450e9164180baf491ae0078465",
1003 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1004 "phase": "draft",
1005 "rev": 2,
1006 "tags": [],
1007 "user": "other@place"
1008 },
1009 {
1010 "bookmarks": [],
1011 "branch": "default",
1012 "date": [1100000, 0],
1013 "desc": "other 1\nother 2\n\nother 3",
1014 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1015 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1016 "phase": "draft",
1017 "rev": 1,
1018 "tags": [],
1019 "user": "A. N. Other <other@place>"
1020 },
1021 {
1022 "bookmarks": [],
1023 "branch": "default",
1024 "date": [1000000, 0],
1025 "desc": "line 1\nline 2",
1026 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1027 "parents": ["0000000000000000000000000000000000000000"],
1028 "phase": "draft",
1029 "rev": 0,
1030 "tags": [],
1031 "user": "User Name <user@hostname>"
1032 }
1033 ]
1034
1035 $ hg heads -v -Tjson
1036 [
1037 {
1038 "bookmarks": [],
1039 "branch": "default",
1040 "date": [1577872860, 0],
1041 "desc": "third",
1042 "files": ["fourth", "second", "third"],
1043 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1044 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1045 "phase": "draft",
1046 "rev": 8,
1047 "tags": ["tip"],
1048 "user": "test"
1049 },
1050 {
1051 "bookmarks": [],
1052 "branch": "default",
1053 "date": [1500001, 0],
1054 "desc": "merge",
1055 "files": [],
1056 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1057 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1058 "phase": "draft",
1059 "rev": 6,
1060 "tags": [],
1061 "user": "person"
1062 },
1063 {
1064 "bookmarks": [],
1065 "branch": "foo",
1066 "date": [1400000, 0],
1067 "desc": "new branch",
1068 "files": [],
1069 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1070 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1071 "phase": "draft",
1072 "rev": 4,
1073 "tags": [],
1074 "user": "person"
1075 }
1076 ]
1077
1078 $ hg log --debug -Tjson
1079 [
1080 {
1081 "added": ["fourth", "third"],
1082 "bookmarks": [],
1083 "branch": "default",
1084 "date": [1577872860, 0],
1085 "desc": "third",
1086 "extra": {"branch": "default"},
1087 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
1088 "modified": [],
1089 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1090 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1091 "phase": "draft",
1092 "removed": ["second"],
1093 "rev": 8,
1094 "tags": ["tip"],
1095 "user": "test"
1096 },
1097 {
1098 "added": ["second"],
1099 "bookmarks": [],
1100 "branch": "default",
1101 "date": [1000000, 0],
1102 "desc": "second",
1103 "extra": {"branch": "default"},
1104 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
1105 "modified": [],
1106 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
1107 "parents": ["0000000000000000000000000000000000000000"],
1108 "phase": "draft",
1109 "removed": [],
1110 "rev": 7,
1111 "tags": [],
1112 "user": "User Name <user@hostname>"
1113 },
1114 {
1115 "added": [],
1116 "bookmarks": [],
1117 "branch": "default",
1118 "date": [1500001, 0],
1119 "desc": "merge",
1120 "extra": {"branch": "default"},
1121 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1122 "modified": [],
1123 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1124 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1125 "phase": "draft",
1126 "removed": [],
1127 "rev": 6,
1128 "tags": [],
1129 "user": "person"
1130 },
1131 {
1132 "added": ["d"],
1133 "bookmarks": [],
1134 "branch": "default",
1135 "date": [1500000, 0],
1136 "desc": "new head",
1137 "extra": {"branch": "default"},
1138 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1139 "modified": [],
1140 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
1141 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1142 "phase": "draft",
1143 "removed": [],
1144 "rev": 5,
1145 "tags": [],
1146 "user": "person"
1147 },
1148 {
1149 "added": [],
1150 "bookmarks": [],
1151 "branch": "foo",
1152 "date": [1400000, 0],
1153 "desc": "new branch",
1154 "extra": {"branch": "foo"},
1155 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1156 "modified": [],
1157 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1158 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1159 "phase": "draft",
1160 "removed": [],
1161 "rev": 4,
1162 "tags": [],
1163 "user": "person"
1164 },
1165 {
1166 "added": [],
1167 "bookmarks": [],
1168 "branch": "default",
1169 "date": [1300000, 0],
1170 "desc": "no user, no domain",
1171 "extra": {"branch": "default"},
1172 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1173 "modified": ["c"],
1174 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
1175 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
1176 "phase": "draft",
1177 "removed": [],
1178 "rev": 3,
1179 "tags": [],
1180 "user": "person"
1181 },
1182 {
1183 "added": ["c"],
1184 "bookmarks": [],
1185 "branch": "default",
1186 "date": [1200000, 0],
1187 "desc": "no person",
1188 "extra": {"branch": "default"},
1189 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
1190 "modified": [],
1191 "node": "97054abb4ab824450e9164180baf491ae0078465",
1192 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1193 "phase": "draft",
1194 "removed": [],
1195 "rev": 2,
1196 "tags": [],
1197 "user": "other@place"
1198 },
1199 {
1200 "added": ["b"],
1201 "bookmarks": [],
1202 "branch": "default",
1203 "date": [1100000, 0],
1204 "desc": "other 1\nother 2\n\nother 3",
1205 "extra": {"branch": "default"},
1206 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
1207 "modified": [],
1208 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1209 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1210 "phase": "draft",
1211 "removed": [],
1212 "rev": 1,
1213 "tags": [],
1214 "user": "A. N. Other <other@place>"
1215 },
1216 {
1217 "added": ["a"],
1218 "bookmarks": [],
1219 "branch": "default",
1220 "date": [1000000, 0],
1221 "desc": "line 1\nline 2",
1222 "extra": {"branch": "default"},
1223 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
1224 "modified": [],
1225 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1226 "parents": ["0000000000000000000000000000000000000000"],
1227 "phase": "draft",
1228 "removed": [],
1229 "rev": 0,
1230 "tags": [],
1231 "user": "User Name <user@hostname>"
1232 }
1233 ]
1234
1235 Error if style not readable:
1236
1237 #if unix-permissions no-root
1238 $ touch q
1239 $ chmod 0 q
1240 $ hg log --style ./q
1241 abort: Permission denied: ./q
1242 [255]
1243 #endif
1244
1245 Error if no style:
1246
1247 $ hg log --style notexist
1248 abort: style 'notexist' not found
1249 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
1250 [255]
1251
1252 $ hg log -T list
1253 available styles: bisect, changelog, compact, default, phases, show, status, xml
1254 abort: specify a template
1255 [255]
1256
1257 Error if style missing key:
1258
1259 $ echo 'q = q' > t
1260 $ hg log --style ./t
1261 abort: "changeset" not in template map
1262 [255]
1263
1264 Error if style missing value:
1265
1266 $ echo 'changeset =' > t
1267 $ hg log --style t
1268 hg: parse error at t:1: missing value
1269 [255]
1270
1271 Error if include fails:
1272
1273 $ echo 'changeset = q' >> t
1274 #if unix-permissions no-root
1275 $ hg log --style ./t
1276 abort: template file ./q: Permission denied
1277 [255]
1278 $ rm -f q
1279 #endif
1280
1281 Include works:
1282
1283 $ echo '{rev}' > q
1284 $ hg log --style ./t
1285 8
1286 7
1287 6
1288 5
1289 4
1290 3
1291 2
1292 1
1293 0
1294
1295 248 Check that recursive reference does not fall into RuntimeError (issue4758):
1296 249
1297 250 common mistake:
1298 251
1299 252 $ cat << EOF > issue4758
1300 253 > changeset = '{changeset}\n'
1301 254 > EOF
1302 255 $ hg log --style ./issue4758
1303 256 abort: recursive reference 'changeset' in template
1304 257 [255]
1305 258
1306 259 circular reference:
1307 260
1308 261 $ cat << EOF > issue4758
1309 262 > changeset = '{foo}'
1310 263 > foo = '{changeset}'
1311 264 > EOF
1312 265 $ hg log --style ./issue4758
1313 266 abort: recursive reference 'foo' in template
1314 267 [255]
1315 268
1316 269 buildmap() -> gettemplate(), where no thunk was made:
1317 270
1318 271 $ cat << EOF > issue4758
1319 272 > changeset = '{files % changeset}\n'
1320 273 > EOF
1321 274 $ hg log --style ./issue4758
1322 275 abort: recursive reference 'changeset' in template
1323 276 [255]
1324 277
1325 278 not a recursion if a keyword of the same name exists:
1326 279
1327 280 $ cat << EOF > issue4758
1328 281 > changeset = '{tags % rev}'
1329 282 > rev = '{rev} {tag}\n'
1330 283 > EOF
1331 284 $ hg log --style ./issue4758 -r tip
1332 285 8 tip
1333 286
1334 287 Check that {phase} works correctly on parents:
1335 288
1336 289 $ cat << EOF > parentphase
1337 290 > changeset_debug = '{rev} ({phase}):{parents}\n'
1338 291 > parent = ' {rev} ({phase})'
1339 292 > EOF
1340 293 $ hg phase -r 5 --public
1341 294 $ hg phase -r 7 --secret --force
1342 295 $ hg log --debug -G --style ./parentphase
1343 296 @ 8 (secret): 7 (secret) -1 (public)
1344 297 |
1345 298 o 7 (secret): -1 (public) -1 (public)
1346 299
1347 300 o 6 (draft): 5 (public) 4 (draft)
1348 301 |\
1349 302 | o 5 (public): 3 (public) -1 (public)
1350 303 | |
1351 304 o | 4 (draft): 3 (public) -1 (public)
1352 305 |/
1353 306 o 3 (public): 2 (public) -1 (public)
1354 307 |
1355 308 o 2 (public): 1 (public) -1 (public)
1356 309 |
1357 310 o 1 (public): 0 (public) -1 (public)
1358 311 |
1359 312 o 0 (public): -1 (public) -1 (public)
1360 313
1361 314
1362 Missing non-standard names give no error (backward compatibility):
1363
1364 $ echo "changeset = '{c}'" > t
1365 $ hg log --style ./t
1366
1367 Defining non-standard name works:
1368
1369 $ cat <<EOF > t
1370 > changeset = '{c}'
1371 > c = q
1372 > EOF
1373 $ hg log --style ./t
1374 8
1375 7
1376 6
1377 5
1378 4
1379 3
1380 2
1381 1
1382 0
1383
1384 ui.style works:
1385
1386 $ echo '[ui]' > .hg/hgrc
1387 $ echo 'style = t' >> .hg/hgrc
1388 $ hg log
1389 8
1390 7
1391 6
1392 5
1393 4
1394 3
1395 2
1396 1
1397 0
1398
1399
1400 Issue338:
1401
1402 $ hg log --style=changelog > changelog
1403
1404 $ cat changelog
1405 2020-01-01 test <test>
1406
1407 * fourth, second, third:
1408 third
1409 [95c24699272e] [tip]
1410
1411 1970-01-12 User Name <user@hostname>
1412
1413 * second:
1414 second
1415 [29114dbae42b]
1416
1417 1970-01-18 person <person>
1418
1419 * merge
1420 [d41e714fe50d]
1421
1422 * d:
1423 new head
1424 [13207e5a10d9]
1425
1426 1970-01-17 person <person>
1427
1428 * new branch
1429 [bbe44766e73d] <foo>
1430
1431 1970-01-16 person <person>
1432
1433 * c:
1434 no user, no domain
1435 [10e46f2dcbf4]
1436
1437 1970-01-14 other <other@place>
1438
1439 * c:
1440 no person
1441 [97054abb4ab8]
1442
1443 1970-01-13 A. N. Other <other@place>
1444
1445 * b:
1446 other 1 other 2
1447
1448 other 3
1449 [b608e9d1a3f0]
1450
1451 1970-01-12 User Name <user@hostname>
1452
1453 * a:
1454 line 1 line 2
1455 [1e4e1b8f71e0]
1456
1457
1458 Issue2130: xml output for 'hg heads' is malformed
1459
1460 $ hg heads --style changelog
1461 2020-01-01 test <test>
1462
1463 * fourth, second, third:
1464 third
1465 [95c24699272e] [tip]
1466
1467 1970-01-18 person <person>
1468
1469 * merge
1470 [d41e714fe50d]
1471
1472 1970-01-17 person <person>
1473
1474 * new branch
1475 [bbe44766e73d] <foo>
1476
1477
1478 315 Keys work:
1479 316
1480 317 $ for key in author branch branches date desc file_adds file_dels file_mods \
1481 318 > file_copies file_copies_switch files \
1482 319 > manifest node parents rev tags diffstat extras \
1483 320 > p1rev p2rev p1node p2node; do
1484 321 > for mode in '' --verbose --debug; do
1485 322 > hg log $mode --template "$key$mode: {$key}\n"
1486 323 > done
1487 324 > done
1488 325 author: test
1489 326 author: User Name <user@hostname>
1490 327 author: person
1491 328 author: person
1492 329 author: person
1493 330 author: person
1494 331 author: other@place
1495 332 author: A. N. Other <other@place>
1496 333 author: User Name <user@hostname>
1497 334 author--verbose: test
1498 335 author--verbose: User Name <user@hostname>
1499 336 author--verbose: person
1500 337 author--verbose: person
1501 338 author--verbose: person
1502 339 author--verbose: person
1503 340 author--verbose: other@place
1504 341 author--verbose: A. N. Other <other@place>
1505 342 author--verbose: User Name <user@hostname>
1506 343 author--debug: test
1507 344 author--debug: User Name <user@hostname>
1508 345 author--debug: person
1509 346 author--debug: person
1510 347 author--debug: person
1511 348 author--debug: person
1512 349 author--debug: other@place
1513 350 author--debug: A. N. Other <other@place>
1514 351 author--debug: User Name <user@hostname>
1515 352 branch: default
1516 353 branch: default
1517 354 branch: default
1518 355 branch: default
1519 356 branch: foo
1520 357 branch: default
1521 358 branch: default
1522 359 branch: default
1523 360 branch: default
1524 361 branch--verbose: default
1525 362 branch--verbose: default
1526 363 branch--verbose: default
1527 364 branch--verbose: default
1528 365 branch--verbose: foo
1529 366 branch--verbose: default
1530 367 branch--verbose: default
1531 368 branch--verbose: default
1532 369 branch--verbose: default
1533 370 branch--debug: default
1534 371 branch--debug: default
1535 372 branch--debug: default
1536 373 branch--debug: default
1537 374 branch--debug: foo
1538 375 branch--debug: default
1539 376 branch--debug: default
1540 377 branch--debug: default
1541 378 branch--debug: default
1542 379 branches:
1543 380 branches:
1544 381 branches:
1545 382 branches:
1546 383 branches: foo
1547 384 branches:
1548 385 branches:
1549 386 branches:
1550 387 branches:
1551 388 branches--verbose:
1552 389 branches--verbose:
1553 390 branches--verbose:
1554 391 branches--verbose:
1555 392 branches--verbose: foo
1556 393 branches--verbose:
1557 394 branches--verbose:
1558 395 branches--verbose:
1559 396 branches--verbose:
1560 397 branches--debug:
1561 398 branches--debug:
1562 399 branches--debug:
1563 400 branches--debug:
1564 401 branches--debug: foo
1565 402 branches--debug:
1566 403 branches--debug:
1567 404 branches--debug:
1568 405 branches--debug:
1569 406 date: 1577872860.00
1570 407 date: 1000000.00
1571 408 date: 1500001.00
1572 409 date: 1500000.00
1573 410 date: 1400000.00
1574 411 date: 1300000.00
1575 412 date: 1200000.00
1576 413 date: 1100000.00
1577 414 date: 1000000.00
1578 415 date--verbose: 1577872860.00
1579 416 date--verbose: 1000000.00
1580 417 date--verbose: 1500001.00
1581 418 date--verbose: 1500000.00
1582 419 date--verbose: 1400000.00
1583 420 date--verbose: 1300000.00
1584 421 date--verbose: 1200000.00
1585 422 date--verbose: 1100000.00
1586 423 date--verbose: 1000000.00
1587 424 date--debug: 1577872860.00
1588 425 date--debug: 1000000.00
1589 426 date--debug: 1500001.00
1590 427 date--debug: 1500000.00
1591 428 date--debug: 1400000.00
1592 429 date--debug: 1300000.00
1593 430 date--debug: 1200000.00
1594 431 date--debug: 1100000.00
1595 432 date--debug: 1000000.00
1596 433 desc: third
1597 434 desc: second
1598 435 desc: merge
1599 436 desc: new head
1600 437 desc: new branch
1601 438 desc: no user, no domain
1602 439 desc: no person
1603 440 desc: other 1
1604 441 other 2
1605 442
1606 443 other 3
1607 444 desc: line 1
1608 445 line 2
1609 446 desc--verbose: third
1610 447 desc--verbose: second
1611 448 desc--verbose: merge
1612 449 desc--verbose: new head
1613 450 desc--verbose: new branch
1614 451 desc--verbose: no user, no domain
1615 452 desc--verbose: no person
1616 453 desc--verbose: other 1
1617 454 other 2
1618 455
1619 456 other 3
1620 457 desc--verbose: line 1
1621 458 line 2
1622 459 desc--debug: third
1623 460 desc--debug: second
1624 461 desc--debug: merge
1625 462 desc--debug: new head
1626 463 desc--debug: new branch
1627 464 desc--debug: no user, no domain
1628 465 desc--debug: no person
1629 466 desc--debug: other 1
1630 467 other 2
1631 468
1632 469 other 3
1633 470 desc--debug: line 1
1634 471 line 2
1635 472 file_adds: fourth third
1636 473 file_adds: second
1637 474 file_adds:
1638 475 file_adds: d
1639 476 file_adds:
1640 477 file_adds:
1641 478 file_adds: c
1642 479 file_adds: b
1643 480 file_adds: a
1644 481 file_adds--verbose: fourth third
1645 482 file_adds--verbose: second
1646 483 file_adds--verbose:
1647 484 file_adds--verbose: d
1648 485 file_adds--verbose:
1649 486 file_adds--verbose:
1650 487 file_adds--verbose: c
1651 488 file_adds--verbose: b
1652 489 file_adds--verbose: a
1653 490 file_adds--debug: fourth third
1654 491 file_adds--debug: second
1655 492 file_adds--debug:
1656 493 file_adds--debug: d
1657 494 file_adds--debug:
1658 495 file_adds--debug:
1659 496 file_adds--debug: c
1660 497 file_adds--debug: b
1661 498 file_adds--debug: a
1662 499 file_dels: second
1663 500 file_dels:
1664 501 file_dels:
1665 502 file_dels:
1666 503 file_dels:
1667 504 file_dels:
1668 505 file_dels:
1669 506 file_dels:
1670 507 file_dels:
1671 508 file_dels--verbose: second
1672 509 file_dels--verbose:
1673 510 file_dels--verbose:
1674 511 file_dels--verbose:
1675 512 file_dels--verbose:
1676 513 file_dels--verbose:
1677 514 file_dels--verbose:
1678 515 file_dels--verbose:
1679 516 file_dels--verbose:
1680 517 file_dels--debug: second
1681 518 file_dels--debug:
1682 519 file_dels--debug:
1683 520 file_dels--debug:
1684 521 file_dels--debug:
1685 522 file_dels--debug:
1686 523 file_dels--debug:
1687 524 file_dels--debug:
1688 525 file_dels--debug:
1689 526 file_mods:
1690 527 file_mods:
1691 528 file_mods:
1692 529 file_mods:
1693 530 file_mods:
1694 531 file_mods: c
1695 532 file_mods:
1696 533 file_mods:
1697 534 file_mods:
1698 535 file_mods--verbose:
1699 536 file_mods--verbose:
1700 537 file_mods--verbose:
1701 538 file_mods--verbose:
1702 539 file_mods--verbose:
1703 540 file_mods--verbose: c
1704 541 file_mods--verbose:
1705 542 file_mods--verbose:
1706 543 file_mods--verbose:
1707 544 file_mods--debug:
1708 545 file_mods--debug:
1709 546 file_mods--debug:
1710 547 file_mods--debug:
1711 548 file_mods--debug:
1712 549 file_mods--debug: c
1713 550 file_mods--debug:
1714 551 file_mods--debug:
1715 552 file_mods--debug:
1716 553 file_copies: fourth (second)
1717 554 file_copies:
1718 555 file_copies:
1719 556 file_copies:
1720 557 file_copies:
1721 558 file_copies:
1722 559 file_copies:
1723 560 file_copies:
1724 561 file_copies:
1725 562 file_copies--verbose: fourth (second)
1726 563 file_copies--verbose:
1727 564 file_copies--verbose:
1728 565 file_copies--verbose:
1729 566 file_copies--verbose:
1730 567 file_copies--verbose:
1731 568 file_copies--verbose:
1732 569 file_copies--verbose:
1733 570 file_copies--verbose:
1734 571 file_copies--debug: fourth (second)
1735 572 file_copies--debug:
1736 573 file_copies--debug:
1737 574 file_copies--debug:
1738 575 file_copies--debug:
1739 576 file_copies--debug:
1740 577 file_copies--debug:
1741 578 file_copies--debug:
1742 579 file_copies--debug:
1743 580 file_copies_switch:
1744 581 file_copies_switch:
1745 582 file_copies_switch:
1746 583 file_copies_switch:
1747 584 file_copies_switch:
1748 585 file_copies_switch:
1749 586 file_copies_switch:
1750 587 file_copies_switch:
1751 588 file_copies_switch:
1752 589 file_copies_switch--verbose:
1753 590 file_copies_switch--verbose:
1754 591 file_copies_switch--verbose:
1755 592 file_copies_switch--verbose:
1756 593 file_copies_switch--verbose:
1757 594 file_copies_switch--verbose:
1758 595 file_copies_switch--verbose:
1759 596 file_copies_switch--verbose:
1760 597 file_copies_switch--verbose:
1761 598 file_copies_switch--debug:
1762 599 file_copies_switch--debug:
1763 600 file_copies_switch--debug:
1764 601 file_copies_switch--debug:
1765 602 file_copies_switch--debug:
1766 603 file_copies_switch--debug:
1767 604 file_copies_switch--debug:
1768 605 file_copies_switch--debug:
1769 606 file_copies_switch--debug:
1770 607 files: fourth second third
1771 608 files: second
1772 609 files:
1773 610 files: d
1774 611 files:
1775 612 files: c
1776 613 files: c
1777 614 files: b
1778 615 files: a
1779 616 files--verbose: fourth second third
1780 617 files--verbose: second
1781 618 files--verbose:
1782 619 files--verbose: d
1783 620 files--verbose:
1784 621 files--verbose: c
1785 622 files--verbose: c
1786 623 files--verbose: b
1787 624 files--verbose: a
1788 625 files--debug: fourth second third
1789 626 files--debug: second
1790 627 files--debug:
1791 628 files--debug: d
1792 629 files--debug:
1793 630 files--debug: c
1794 631 files--debug: c
1795 632 files--debug: b
1796 633 files--debug: a
1797 634 manifest: 6:94961b75a2da
1798 635 manifest: 5:f2dbc354b94e
1799 636 manifest: 4:4dc3def4f9b4
1800 637 manifest: 4:4dc3def4f9b4
1801 638 manifest: 3:cb5a1327723b
1802 639 manifest: 3:cb5a1327723b
1803 640 manifest: 2:6e0e82995c35
1804 641 manifest: 1:4e8d705b1e53
1805 642 manifest: 0:a0c8bcbbb45c
1806 643 manifest--verbose: 6:94961b75a2da
1807 644 manifest--verbose: 5:f2dbc354b94e
1808 645 manifest--verbose: 4:4dc3def4f9b4
1809 646 manifest--verbose: 4:4dc3def4f9b4
1810 647 manifest--verbose: 3:cb5a1327723b
1811 648 manifest--verbose: 3:cb5a1327723b
1812 649 manifest--verbose: 2:6e0e82995c35
1813 650 manifest--verbose: 1:4e8d705b1e53
1814 651 manifest--verbose: 0:a0c8bcbbb45c
1815 652 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1816 653 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1817 654 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1818 655 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1819 656 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1820 657 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1821 658 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1822 659 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1823 660 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1824 661 node: 95c24699272ef57d062b8bccc32c878bf841784a
1825 662 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1826 663 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1827 664 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1828 665 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1829 666 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1830 667 node: 97054abb4ab824450e9164180baf491ae0078465
1831 668 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1832 669 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1833 670 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1834 671 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1835 672 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1836 673 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1837 674 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1838 675 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1839 676 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1840 677 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1841 678 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1842 679 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1843 680 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1844 681 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1845 682 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1846 683 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1847 684 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1848 685 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1849 686 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1850 687 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1851 688 parents:
1852 689 parents: -1:000000000000
1853 690 parents: 5:13207e5a10d9 4:bbe44766e73d
1854 691 parents: 3:10e46f2dcbf4
1855 692 parents:
1856 693 parents:
1857 694 parents:
1858 695 parents:
1859 696 parents:
1860 697 parents--verbose:
1861 698 parents--verbose: -1:000000000000
1862 699 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1863 700 parents--verbose: 3:10e46f2dcbf4
1864 701 parents--verbose:
1865 702 parents--verbose:
1866 703 parents--verbose:
1867 704 parents--verbose:
1868 705 parents--verbose:
1869 706 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1870 707 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1871 708 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1872 709 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1873 710 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1874 711 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1875 712 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1876 713 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1877 714 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1878 715 rev: 8
1879 716 rev: 7
1880 717 rev: 6
1881 718 rev: 5
1882 719 rev: 4
1883 720 rev: 3
1884 721 rev: 2
1885 722 rev: 1
1886 723 rev: 0
1887 724 rev--verbose: 8
1888 725 rev--verbose: 7
1889 726 rev--verbose: 6
1890 727 rev--verbose: 5
1891 728 rev--verbose: 4
1892 729 rev--verbose: 3
1893 730 rev--verbose: 2
1894 731 rev--verbose: 1
1895 732 rev--verbose: 0
1896 733 rev--debug: 8
1897 734 rev--debug: 7
1898 735 rev--debug: 6
1899 736 rev--debug: 5
1900 737 rev--debug: 4
1901 738 rev--debug: 3
1902 739 rev--debug: 2
1903 740 rev--debug: 1
1904 741 rev--debug: 0
1905 742 tags: tip
1906 743 tags:
1907 744 tags:
1908 745 tags:
1909 746 tags:
1910 747 tags:
1911 748 tags:
1912 749 tags:
1913 750 tags:
1914 751 tags--verbose: tip
1915 752 tags--verbose:
1916 753 tags--verbose:
1917 754 tags--verbose:
1918 755 tags--verbose:
1919 756 tags--verbose:
1920 757 tags--verbose:
1921 758 tags--verbose:
1922 759 tags--verbose:
1923 760 tags--debug: tip
1924 761 tags--debug:
1925 762 tags--debug:
1926 763 tags--debug:
1927 764 tags--debug:
1928 765 tags--debug:
1929 766 tags--debug:
1930 767 tags--debug:
1931 768 tags--debug:
1932 769 diffstat: 3: +2/-1
1933 770 diffstat: 1: +1/-0
1934 771 diffstat: 0: +0/-0
1935 772 diffstat: 1: +1/-0
1936 773 diffstat: 0: +0/-0
1937 774 diffstat: 1: +1/-0
1938 775 diffstat: 1: +4/-0
1939 776 diffstat: 1: +2/-0
1940 777 diffstat: 1: +1/-0
1941 778 diffstat--verbose: 3: +2/-1
1942 779 diffstat--verbose: 1: +1/-0
1943 780 diffstat--verbose: 0: +0/-0
1944 781 diffstat--verbose: 1: +1/-0
1945 782 diffstat--verbose: 0: +0/-0
1946 783 diffstat--verbose: 1: +1/-0
1947 784 diffstat--verbose: 1: +4/-0
1948 785 diffstat--verbose: 1: +2/-0
1949 786 diffstat--verbose: 1: +1/-0
1950 787 diffstat--debug: 3: +2/-1
1951 788 diffstat--debug: 1: +1/-0
1952 789 diffstat--debug: 0: +0/-0
1953 790 diffstat--debug: 1: +1/-0
1954 791 diffstat--debug: 0: +0/-0
1955 792 diffstat--debug: 1: +1/-0
1956 793 diffstat--debug: 1: +4/-0
1957 794 diffstat--debug: 1: +2/-0
1958 795 diffstat--debug: 1: +1/-0
1959 796 extras: branch=default
1960 797 extras: branch=default
1961 798 extras: branch=default
1962 799 extras: branch=default
1963 800 extras: branch=foo
1964 801 extras: branch=default
1965 802 extras: branch=default
1966 803 extras: branch=default
1967 804 extras: branch=default
1968 805 extras--verbose: branch=default
1969 806 extras--verbose: branch=default
1970 807 extras--verbose: branch=default
1971 808 extras--verbose: branch=default
1972 809 extras--verbose: branch=foo
1973 810 extras--verbose: branch=default
1974 811 extras--verbose: branch=default
1975 812 extras--verbose: branch=default
1976 813 extras--verbose: branch=default
1977 814 extras--debug: branch=default
1978 815 extras--debug: branch=default
1979 816 extras--debug: branch=default
1980 817 extras--debug: branch=default
1981 818 extras--debug: branch=foo
1982 819 extras--debug: branch=default
1983 820 extras--debug: branch=default
1984 821 extras--debug: branch=default
1985 822 extras--debug: branch=default
1986 823 p1rev: 7
1987 824 p1rev: -1
1988 825 p1rev: 5
1989 826 p1rev: 3
1990 827 p1rev: 3
1991 828 p1rev: 2
1992 829 p1rev: 1
1993 830 p1rev: 0
1994 831 p1rev: -1
1995 832 p1rev--verbose: 7
1996 833 p1rev--verbose: -1
1997 834 p1rev--verbose: 5
1998 835 p1rev--verbose: 3
1999 836 p1rev--verbose: 3
2000 837 p1rev--verbose: 2
2001 838 p1rev--verbose: 1
2002 839 p1rev--verbose: 0
2003 840 p1rev--verbose: -1
2004 841 p1rev--debug: 7
2005 842 p1rev--debug: -1
2006 843 p1rev--debug: 5
2007 844 p1rev--debug: 3
2008 845 p1rev--debug: 3
2009 846 p1rev--debug: 2
2010 847 p1rev--debug: 1
2011 848 p1rev--debug: 0
2012 849 p1rev--debug: -1
2013 850 p2rev: -1
2014 851 p2rev: -1
2015 852 p2rev: 4
2016 853 p2rev: -1
2017 854 p2rev: -1
2018 855 p2rev: -1
2019 856 p2rev: -1
2020 857 p2rev: -1
2021 858 p2rev: -1
2022 859 p2rev--verbose: -1
2023 860 p2rev--verbose: -1
2024 861 p2rev--verbose: 4
2025 862 p2rev--verbose: -1
2026 863 p2rev--verbose: -1
2027 864 p2rev--verbose: -1
2028 865 p2rev--verbose: -1
2029 866 p2rev--verbose: -1
2030 867 p2rev--verbose: -1
2031 868 p2rev--debug: -1
2032 869 p2rev--debug: -1
2033 870 p2rev--debug: 4
2034 871 p2rev--debug: -1
2035 872 p2rev--debug: -1
2036 873 p2rev--debug: -1
2037 874 p2rev--debug: -1
2038 875 p2rev--debug: -1
2039 876 p2rev--debug: -1
2040 877 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2041 878 p1node: 0000000000000000000000000000000000000000
2042 879 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
2043 880 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2044 881 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2045 882 p1node: 97054abb4ab824450e9164180baf491ae0078465
2046 883 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2047 884 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
2048 885 p1node: 0000000000000000000000000000000000000000
2049 886 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2050 887 p1node--verbose: 0000000000000000000000000000000000000000
2051 888 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
2052 889 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2053 890 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2054 891 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
2055 892 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2056 893 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
2057 894 p1node--verbose: 0000000000000000000000000000000000000000
2058 895 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2059 896 p1node--debug: 0000000000000000000000000000000000000000
2060 897 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
2061 898 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2062 899 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2063 900 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
2064 901 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2065 902 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
2066 903 p1node--debug: 0000000000000000000000000000000000000000
2067 904 p2node: 0000000000000000000000000000000000000000
2068 905 p2node: 0000000000000000000000000000000000000000
2069 906 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2070 907 p2node: 0000000000000000000000000000000000000000
2071 908 p2node: 0000000000000000000000000000000000000000
2072 909 p2node: 0000000000000000000000000000000000000000
2073 910 p2node: 0000000000000000000000000000000000000000
2074 911 p2node: 0000000000000000000000000000000000000000
2075 912 p2node: 0000000000000000000000000000000000000000
2076 913 p2node--verbose: 0000000000000000000000000000000000000000
2077 914 p2node--verbose: 0000000000000000000000000000000000000000
2078 915 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2079 916 p2node--verbose: 0000000000000000000000000000000000000000
2080 917 p2node--verbose: 0000000000000000000000000000000000000000
2081 918 p2node--verbose: 0000000000000000000000000000000000000000
2082 919 p2node--verbose: 0000000000000000000000000000000000000000
2083 920 p2node--verbose: 0000000000000000000000000000000000000000
2084 921 p2node--verbose: 0000000000000000000000000000000000000000
2085 922 p2node--debug: 0000000000000000000000000000000000000000
2086 923 p2node--debug: 0000000000000000000000000000000000000000
2087 924 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2088 925 p2node--debug: 0000000000000000000000000000000000000000
2089 926 p2node--debug: 0000000000000000000000000000000000000000
2090 927 p2node--debug: 0000000000000000000000000000000000000000
2091 928 p2node--debug: 0000000000000000000000000000000000000000
2092 929 p2node--debug: 0000000000000000000000000000000000000000
2093 930 p2node--debug: 0000000000000000000000000000000000000000
2094 931
2095 932 Filters work:
2096 933
2097 934 $ hg log --template '{author|domain}\n'
2098 935
2099 936 hostname
2100 937
2101 938
2102 939
2103 940
2104 941 place
2105 942 place
2106 943 hostname
2107 944
2108 945 $ hg log --template '{author|person}\n'
2109 946 test
2110 947 User Name
2111 948 person
2112 949 person
2113 950 person
2114 951 person
2115 952 other
2116 953 A. N. Other
2117 954 User Name
2118 955
2119 956 $ hg log --template '{author|user}\n'
2120 957 test
2121 958 user
2122 959 person
2123 960 person
2124 961 person
2125 962 person
2126 963 other
2127 964 other
2128 965 user
2129 966
2130 967 $ hg log --template '{date|date}\n'
2131 968 Wed Jan 01 10:01:00 2020 +0000
2132 969 Mon Jan 12 13:46:40 1970 +0000
2133 970 Sun Jan 18 08:40:01 1970 +0000
2134 971 Sun Jan 18 08:40:00 1970 +0000
2135 972 Sat Jan 17 04:53:20 1970 +0000
2136 973 Fri Jan 16 01:06:40 1970 +0000
2137 974 Wed Jan 14 21:20:00 1970 +0000
2138 975 Tue Jan 13 17:33:20 1970 +0000
2139 976 Mon Jan 12 13:46:40 1970 +0000
2140 977
2141 978 $ hg log --template '{date|isodate}\n'
2142 979 2020-01-01 10:01 +0000
2143 980 1970-01-12 13:46 +0000
2144 981 1970-01-18 08:40 +0000
2145 982 1970-01-18 08:40 +0000
2146 983 1970-01-17 04:53 +0000
2147 984 1970-01-16 01:06 +0000
2148 985 1970-01-14 21:20 +0000
2149 986 1970-01-13 17:33 +0000
2150 987 1970-01-12 13:46 +0000
2151 988
2152 989 $ hg log --template '{date|isodatesec}\n'
2153 990 2020-01-01 10:01:00 +0000
2154 991 1970-01-12 13:46:40 +0000
2155 992 1970-01-18 08:40:01 +0000
2156 993 1970-01-18 08:40:00 +0000
2157 994 1970-01-17 04:53:20 +0000
2158 995 1970-01-16 01:06:40 +0000
2159 996 1970-01-14 21:20:00 +0000
2160 997 1970-01-13 17:33:20 +0000
2161 998 1970-01-12 13:46:40 +0000
2162 999
2163 1000 $ hg log --template '{date|rfc822date}\n'
2164 1001 Wed, 01 Jan 2020 10:01:00 +0000
2165 1002 Mon, 12 Jan 1970 13:46:40 +0000
2166 1003 Sun, 18 Jan 1970 08:40:01 +0000
2167 1004 Sun, 18 Jan 1970 08:40:00 +0000
2168 1005 Sat, 17 Jan 1970 04:53:20 +0000
2169 1006 Fri, 16 Jan 1970 01:06:40 +0000
2170 1007 Wed, 14 Jan 1970 21:20:00 +0000
2171 1008 Tue, 13 Jan 1970 17:33:20 +0000
2172 1009 Mon, 12 Jan 1970 13:46:40 +0000
2173 1010
2174 1011 $ hg log --template '{desc|firstline}\n'
2175 1012 third
2176 1013 second
2177 1014 merge
2178 1015 new head
2179 1016 new branch
2180 1017 no user, no domain
2181 1018 no person
2182 1019 other 1
2183 1020 line 1
2184 1021
2185 1022 $ hg log --template '{node|short}\n'
2186 1023 95c24699272e
2187 1024 29114dbae42b
2188 1025 d41e714fe50d
2189 1026 13207e5a10d9
2190 1027 bbe44766e73d
2191 1028 10e46f2dcbf4
2192 1029 97054abb4ab8
2193 1030 b608e9d1a3f0
2194 1031 1e4e1b8f71e0
2195 1032
2196 1033 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
2197 1034 <changeset author="test"/>
2198 1035 <changeset author="User Name &lt;user@hostname&gt;"/>
2199 1036 <changeset author="person"/>
2200 1037 <changeset author="person"/>
2201 1038 <changeset author="person"/>
2202 1039 <changeset author="person"/>
2203 1040 <changeset author="other@place"/>
2204 1041 <changeset author="A. N. Other &lt;other@place&gt;"/>
2205 1042 <changeset author="User Name &lt;user@hostname&gt;"/>
2206 1043
2207 1044 $ hg log --template '{rev}: {children}\n'
2208 1045 8:
2209 1046 7: 8:95c24699272e
2210 1047 6:
2211 1048 5: 6:d41e714fe50d
2212 1049 4: 6:d41e714fe50d
2213 1050 3: 4:bbe44766e73d 5:13207e5a10d9
2214 1051 2: 3:10e46f2dcbf4
2215 1052 1: 2:97054abb4ab8
2216 1053 0: 1:b608e9d1a3f0
2217 1054
2218 1055 Formatnode filter works:
2219 1056
2220 1057 $ hg -q log -r 0 --template '{node|formatnode}\n'
2221 1058 1e4e1b8f71e0
2222 1059
2223 1060 $ hg log -r 0 --template '{node|formatnode}\n'
2224 1061 1e4e1b8f71e0
2225 1062
2226 1063 $ hg -v log -r 0 --template '{node|formatnode}\n'
2227 1064 1e4e1b8f71e0
2228 1065
2229 1066 $ hg --debug log -r 0 --template '{node|formatnode}\n'
2230 1067 1e4e1b8f71e05681d422154f5421e385fec3454f
2231 1068
2232 1069 Age filter:
2233 1070
2234 1071 $ hg init unstable-hash
2235 1072 $ cd unstable-hash
2236 1073 $ hg log --template '{date|age}\n' > /dev/null || exit 1
2237 1074
2238 1075 >>> from __future__ import absolute_import
2239 1076 >>> import datetime
2240 1077 >>> fp = open('a', 'wb')
2241 1078 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7)
2242 1079 >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) and None
2243 1080 >>> fp.close()
2244 1081 $ hg add a
2245 1082 $ hg commit -m future -d "`cat a`"
2246 1083
2247 1084 $ hg log -l1 --template '{date|age}\n'
2248 1085 7 years from now
2249 1086
2250 1087 $ cd ..
2251 1088 $ rm -rf unstable-hash
2252 1089
2253 1090 Filename filters:
2254 1091
2255 1092 $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n'
2256 1093 bar||foo|
2257 1094 $ hg debugtemplate '{"foo/bar"|dirname}|{"foo/"|dirname}|{"foo"|dirname}|\n'
2258 1095 foo|foo||
2259 1096 $ hg debugtemplate '{"foo/bar"|stripdir}|{"foo/"|stripdir}|{"foo"|stripdir}|\n'
2260 1097 foo|foo|foo|
2261 1098
2262 1099 Add a dummy commit to make up for the instability of the above:
2263 1100
2264 1101 $ echo a > a
2265 1102 $ hg add a
2266 1103 $ hg ci -m future
2267 1104
2268 1105 Count filter:
2269 1106
2270 1107 $ hg log -l1 --template '{node|count} {node|short|count}\n'
2271 1108 40 12
2272 1109
2273 1110 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2274 1111 0 1 4
2275 1112
2276 1113 $ hg log -G --template '{rev}: children: {children|count}, \
2277 1114 > tags: {tags|count}, file_adds: {file_adds|count}, \
2278 1115 > ancestors: {revset("ancestors(%s)", rev)|count}'
2279 1116 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2280 1117 |
2281 1118 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2282 1119 |
2283 1120 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2284 1121
2285 1122 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2286 1123 |\
2287 1124 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2288 1125 | |
2289 1126 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2290 1127 |/
2291 1128 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2292 1129 |
2293 1130 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2294 1131 |
2295 1132 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2296 1133 |
2297 1134 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2298 1135
2299 1136
2300 1137 $ hg log -l1 -T '{termwidth|count}\n'
2301 1138 hg: parse error: not countable
2302 1139 (template filter 'count' is not compatible with keyword 'termwidth')
2303 1140 [255]
2304 1141
2305 1142 Upper/lower filters:
2306 1143
2307 1144 $ hg log -r0 --template '{branch|upper}\n'
2308 1145 DEFAULT
2309 1146 $ hg log -r0 --template '{author|lower}\n'
2310 1147 user name <user@hostname>
2311 1148 $ hg log -r0 --template '{date|upper}\n'
2312 1149 1000000.00
2313 1150
2314 1151 Add a commit that does all possible modifications at once
2315 1152
2316 1153 $ echo modify >> third
2317 1154 $ touch b
2318 1155 $ hg add b
2319 1156 $ hg mv fourth fifth
2320 1157 $ hg rm a
2321 1158 $ hg ci -m "Modify, add, remove, rename"
2322 1159
2323 Check the status template
2324
2325 $ cat <<EOF >> $HGRCPATH
2326 > [extensions]
2327 > color=
1160 Error on syntax:
1161
1162 $ cat <<EOF > t
1163 > changeset = '{c}'
1164 > c = q
1165 > x = "f
2328 1166 > EOF
2329
2330 $ hg log -T status -r 10
2331 changeset: 10:0f9759ec227a
2332 tag: tip
2333 user: test
2334 date: Thu Jan 01 00:00:00 1970 +0000
2335 summary: Modify, add, remove, rename
2336 files:
2337 M third
2338 A b
2339 A fifth
2340 R a
2341 R fourth
2342
2343 $ hg log -T status -C -r 10
2344 changeset: 10:0f9759ec227a
2345 tag: tip
2346 user: test
2347 date: Thu Jan 01 00:00:00 1970 +0000
2348 summary: Modify, add, remove, rename
2349 files:
2350 M third
2351 A b
2352 A fifth
2353 fourth
2354 R a
2355 R fourth
2356
2357 $ hg log -T status -C -r 10 -v
2358 changeset: 10:0f9759ec227a
2359 tag: tip
2360 user: test
2361 date: Thu Jan 01 00:00:00 1970 +0000
2362 description:
2363 Modify, add, remove, rename
2364
2365 files:
2366 M third
2367 A b
2368 A fifth
2369 fourth
2370 R a
2371 R fourth
2372
2373 $ hg log -T status -C -r 10 --debug
2374 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2375 tag: tip
2376 phase: secret
2377 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2378 parent: -1:0000000000000000000000000000000000000000
2379 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2380 user: test
2381 date: Thu Jan 01 00:00:00 1970 +0000
2382 extra: branch=default
2383 description:
2384 Modify, add, remove, rename
2385
2386 files:
2387 M third
2388 A b
2389 A fifth
2390 fourth
2391 R a
2392 R fourth
2393
2394 $ hg log -T status -C -r 10 --quiet
2395 10:0f9759ec227a
2396 $ hg --color=debug log -T status -r 10
2397 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2398 [log.tag|tag: tip]
2399 [log.user|user: test]
2400 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2401 [log.summary|summary: Modify, add, remove, rename]
2402 [ui.note log.files|files:]
2403 [status.modified|M third]
2404 [status.added|A b]
2405 [status.added|A fifth]
2406 [status.removed|R a]
2407 [status.removed|R fourth]
2408
2409 $ hg --color=debug log -T status -C -r 10
2410 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2411 [log.tag|tag: tip]
2412 [log.user|user: test]
2413 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2414 [log.summary|summary: Modify, add, remove, rename]
2415 [ui.note log.files|files:]
2416 [status.modified|M third]
2417 [status.added|A b]
2418 [status.added|A fifth]
2419 [status.copied| fourth]
2420 [status.removed|R a]
2421 [status.removed|R fourth]
2422
2423 $ hg --color=debug log -T status -C -r 10 -v
2424 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2425 [log.tag|tag: tip]
2426 [log.user|user: test]
2427 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2428 [ui.note log.description|description:]
2429 [ui.note log.description|Modify, add, remove, rename]
2430
2431 [ui.note log.files|files:]
2432 [status.modified|M third]
2433 [status.added|A b]
2434 [status.added|A fifth]
2435 [status.copied| fourth]
2436 [status.removed|R a]
2437 [status.removed|R fourth]
2438
2439 $ hg --color=debug log -T status -C -r 10 --debug
2440 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2441 [log.tag|tag: tip]
2442 [log.phase|phase: secret]
2443 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2444 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2445 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2446 [log.user|user: test]
2447 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2448 [ui.debug log.extra|extra: branch=default]
2449 [ui.note log.description|description:]
2450 [ui.note log.description|Modify, add, remove, rename]
2451
2452 [ui.note log.files|files:]
2453 [status.modified|M third]
2454 [status.added|A b]
2455 [status.added|A fifth]
2456 [status.copied| fourth]
2457 [status.removed|R a]
2458 [status.removed|R fourth]
2459
2460 $ hg --color=debug log -T status -C -r 10 --quiet
2461 [log.node|10:0f9759ec227a]
2462
2463 Check the bisect template
2464
2465 $ hg bisect -g 1
2466 $ hg bisect -b 3 --noupdate
2467 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2468 $ hg log -T bisect -r 0:4
2469 changeset: 0:1e4e1b8f71e0
2470 bisect: good (implicit)
2471 user: User Name <user@hostname>
2472 date: Mon Jan 12 13:46:40 1970 +0000
2473 summary: line 1
2474
2475 changeset: 1:b608e9d1a3f0
2476 bisect: good
2477 user: A. N. Other <other@place>
2478 date: Tue Jan 13 17:33:20 1970 +0000
2479 summary: other 1
2480
2481 changeset: 2:97054abb4ab8
2482 bisect: untested
2483 user: other@place
2484 date: Wed Jan 14 21:20:00 1970 +0000
2485 summary: no person
2486
2487 changeset: 3:10e46f2dcbf4
2488 bisect: bad
2489 user: person
2490 date: Fri Jan 16 01:06:40 1970 +0000
2491 summary: no user, no domain
2492
2493 changeset: 4:bbe44766e73d
2494 bisect: bad (implicit)
2495 branch: foo
2496 user: person
2497 date: Sat Jan 17 04:53:20 1970 +0000
2498 summary: new branch
2499
2500 $ hg log --debug -T bisect -r 0:4
2501 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2502 bisect: good (implicit)
2503 phase: public
2504 parent: -1:0000000000000000000000000000000000000000
2505 parent: -1:0000000000000000000000000000000000000000
2506 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2507 user: User Name <user@hostname>
2508 date: Mon Jan 12 13:46:40 1970 +0000
2509 files+: a
2510 extra: branch=default
2511 description:
2512 line 1
2513 line 2
2514
2515
2516 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2517 bisect: good
2518 phase: public
2519 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2520 parent: -1:0000000000000000000000000000000000000000
2521 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2522 user: A. N. Other <other@place>
2523 date: Tue Jan 13 17:33:20 1970 +0000
2524 files+: b
2525 extra: branch=default
2526 description:
2527 other 1
2528 other 2
2529
2530 other 3
2531
2532
2533 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2534 bisect: untested
2535 phase: public
2536 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2537 parent: -1:0000000000000000000000000000000000000000
2538 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2539 user: other@place
2540 date: Wed Jan 14 21:20:00 1970 +0000
2541 files+: c
2542 extra: branch=default
2543 description:
2544 no person
2545
2546
2547 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2548 bisect: bad
2549 phase: public
2550 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2551 parent: -1:0000000000000000000000000000000000000000
2552 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2553 user: person
2554 date: Fri Jan 16 01:06:40 1970 +0000
2555 files: c
2556 extra: branch=default
2557 description:
2558 no user, no domain
2559
2560
2561 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2562 bisect: bad (implicit)
2563 branch: foo
2564 phase: draft
2565 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2566 parent: -1:0000000000000000000000000000000000000000
2567 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2568 user: person
2569 date: Sat Jan 17 04:53:20 1970 +0000
2570 extra: branch=foo
2571 description:
2572 new branch
2573
2574
2575 $ hg log -v -T bisect -r 0:4
2576 changeset: 0:1e4e1b8f71e0
2577 bisect: good (implicit)
2578 user: User Name <user@hostname>
2579 date: Mon Jan 12 13:46:40 1970 +0000
2580 files: a
2581 description:
2582 line 1
2583 line 2
2584
2585
2586 changeset: 1:b608e9d1a3f0
2587 bisect: good
2588 user: A. N. Other <other@place>
2589 date: Tue Jan 13 17:33:20 1970 +0000
2590 files: b
2591 description:
2592 other 1
2593 other 2
2594
2595 other 3
2596
2597
2598 changeset: 2:97054abb4ab8
2599 bisect: untested
2600 user: other@place
2601 date: Wed Jan 14 21:20:00 1970 +0000
2602 files: c
2603 description:
2604 no person
2605
2606
2607 changeset: 3:10e46f2dcbf4
2608 bisect: bad
2609 user: person
2610 date: Fri Jan 16 01:06:40 1970 +0000
2611 files: c
2612 description:
2613 no user, no domain
2614
2615
2616 changeset: 4:bbe44766e73d
2617 bisect: bad (implicit)
2618 branch: foo
2619 user: person
2620 date: Sat Jan 17 04:53:20 1970 +0000
2621 description:
2622 new branch
2623
2624
2625 $ hg --color=debug log -T bisect -r 0:4
2626 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2627 [log.bisect bisect.good|bisect: good (implicit)]
2628 [log.user|user: User Name <user@hostname>]
2629 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2630 [log.summary|summary: line 1]
2631
2632 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2633 [log.bisect bisect.good|bisect: good]
2634 [log.user|user: A. N. Other <other@place>]
2635 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2636 [log.summary|summary: other 1]
2637
2638 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2639 [log.bisect bisect.untested|bisect: untested]
2640 [log.user|user: other@place]
2641 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2642 [log.summary|summary: no person]
2643
2644 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2645 [log.bisect bisect.bad|bisect: bad]
2646 [log.user|user: person]
2647 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2648 [log.summary|summary: no user, no domain]
2649
2650 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2651 [log.bisect bisect.bad|bisect: bad (implicit)]
2652 [log.branch|branch: foo]
2653 [log.user|user: person]
2654 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2655 [log.summary|summary: new branch]
2656
2657 $ hg --color=debug log --debug -T bisect -r 0:4
2658 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2659 [log.bisect bisect.good|bisect: good (implicit)]
2660 [log.phase|phase: public]
2661 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2662 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2663 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2664 [log.user|user: User Name <user@hostname>]
2665 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2666 [ui.debug log.files|files+: a]
2667 [ui.debug log.extra|extra: branch=default]
2668 [ui.note log.description|description:]
2669 [ui.note log.description|line 1
2670 line 2]
2671
2672
2673 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2674 [log.bisect bisect.good|bisect: good]
2675 [log.phase|phase: public]
2676 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2677 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2678 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2679 [log.user|user: A. N. Other <other@place>]
2680 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2681 [ui.debug log.files|files+: b]
2682 [ui.debug log.extra|extra: branch=default]
2683 [ui.note log.description|description:]
2684 [ui.note log.description|other 1
2685 other 2
2686
2687 other 3]
2688
2689
2690 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2691 [log.bisect bisect.untested|bisect: untested]
2692 [log.phase|phase: public]
2693 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2694 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2695 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2696 [log.user|user: other@place]
2697 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2698 [ui.debug log.files|files+: c]
2699 [ui.debug log.extra|extra: branch=default]
2700 [ui.note log.description|description:]
2701 [ui.note log.description|no person]
2702
2703
2704 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2705 [log.bisect bisect.bad|bisect: bad]
2706 [log.phase|phase: public]
2707 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2708 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2709 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2710 [log.user|user: person]
2711 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2712 [ui.debug log.files|files: c]
2713 [ui.debug log.extra|extra: branch=default]
2714 [ui.note log.description|description:]
2715 [ui.note log.description|no user, no domain]
2716
2717
2718 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2719 [log.bisect bisect.bad|bisect: bad (implicit)]
2720 [log.branch|branch: foo]
2721 [log.phase|phase: draft]
2722 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2723 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2724 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2725 [log.user|user: person]
2726 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2727 [ui.debug log.extra|extra: branch=foo]
2728 [ui.note log.description|description:]
2729 [ui.note log.description|new branch]
2730
2731
2732 $ hg --color=debug log -v -T bisect -r 0:4
2733 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2734 [log.bisect bisect.good|bisect: good (implicit)]
2735 [log.user|user: User Name <user@hostname>]
2736 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2737 [ui.note log.files|files: a]
2738 [ui.note log.description|description:]
2739 [ui.note log.description|line 1
2740 line 2]
2741
2742
2743 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2744 [log.bisect bisect.good|bisect: good]
2745 [log.user|user: A. N. Other <other@place>]
2746 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2747 [ui.note log.files|files: b]
2748 [ui.note log.description|description:]
2749 [ui.note log.description|other 1
2750 other 2
2751
2752 other 3]
2753
2754
2755 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2756 [log.bisect bisect.untested|bisect: untested]
2757 [log.user|user: other@place]
2758 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2759 [ui.note log.files|files: c]
2760 [ui.note log.description|description:]
2761 [ui.note log.description|no person]
2762
2763
2764 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2765 [log.bisect bisect.bad|bisect: bad]
2766 [log.user|user: person]
2767 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2768 [ui.note log.files|files: c]
2769 [ui.note log.description|description:]
2770 [ui.note log.description|no user, no domain]
2771
2772
2773 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2774 [log.bisect bisect.bad|bisect: bad (implicit)]
2775 [log.branch|branch: foo]
2776 [log.user|user: person]
2777 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2778 [ui.note log.description|description:]
2779 [ui.note log.description|new branch]
2780
2781
2782 $ hg bisect --reset
2783
2784 Error on syntax:
2785
2786 $ echo 'x = "f' >> t
1167 $ echo '[ui]' > .hg/hgrc
1168 $ echo 'style = t' >> .hg/hgrc
2787 1169 $ hg log
2788 1170 hg: parse error at t:3: unmatched quotes
2789 1171 [255]
2790 1172
2791 1173 $ hg log -T '{date'
2792 1174 hg: parse error at 1: unterminated template expansion
2793 1175 ({date
2794 1176 ^ here)
2795 1177 [255]
2796 1178 $ hg log -T '{date(}'
2797 1179 hg: parse error at 6: not a prefix: end
2798 1180 ({date(}
2799 1181 ^ here)
2800 1182 [255]
2801 1183 $ hg log -T '{date)}'
2802 1184 hg: parse error at 5: invalid token
2803 1185 ({date)}
2804 1186 ^ here)
2805 1187 [255]
2806 1188 $ hg log -T '{date date}'
2807 1189 hg: parse error at 6: invalid token
2808 1190 ({date date}
2809 1191 ^ here)
2810 1192 [255]
2811 1193
2812 1194 $ hg log -T '{}'
2813 1195 hg: parse error at 1: not a prefix: end
2814 1196 ({}
2815 1197 ^ here)
2816 1198 [255]
2817 1199 $ hg debugtemplate -v '{()}'
2818 1200 (template
2819 1201 (group
2820 1202 None))
2821 1203 * keywords:
2822 1204 * functions:
2823 1205 hg: parse error: missing argument
2824 1206 [255]
2825 1207
2826 1208 Behind the scenes, this would throw TypeError without intype=bytes
2827 1209
2828 1210 $ hg log -l 3 --template '{date|obfuscate}\n'
2829 1211 &#48;&#46;&#48;&#48;
2830 1212 &#48;&#46;&#48;&#48;
2831 1213 &#49;&#53;&#55;&#55;&#56;&#55;&#50;&#56;&#54;&#48;&#46;&#48;&#48;
2832 1214
2833 1215 Behind the scenes, this will throw a ValueError
2834 1216
2835 1217 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2836 1218 hg: parse error: invalid date: 'Modify, add, remove, rename'
2837 1219 (template filter 'shortdate' is not compatible with keyword 'desc')
2838 1220 [255]
2839 1221
2840 1222 Behind the scenes, this would throw AttributeError without intype=bytes
2841 1223
2842 1224 $ hg log -l 3 --template 'line: {date|escape}\n'
2843 1225 line: 0.00
2844 1226 line: 0.00
2845 1227 line: 1577872860.00
2846 1228
2847 1229 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2848 1230 hg: parse error: localdate expects a date information
2849 1231 [255]
2850 1232
2851 1233 Behind the scenes, this will throw ValueError
2852 1234
2853 1235 $ hg tip --template '{author|email|date}\n'
2854 1236 hg: parse error: date expects a date information
2855 1237 [255]
2856 1238
2857 1239 $ hg tip -T '{author|email|shortdate}\n'
2858 1240 hg: parse error: invalid date: 'test'
2859 1241 (template filter 'shortdate' is not compatible with keyword 'author')
2860 1242 [255]
2861 1243
2862 1244 $ hg tip -T '{get(extras, "branch")|shortdate}\n'
2863 1245 hg: parse error: invalid date: 'default'
2864 1246 (incompatible use of template filter 'shortdate')
2865 1247 [255]
2866 1248
2867 1249 Error in nested template:
2868 1250
2869 1251 $ hg log -T '{"date'
2870 1252 hg: parse error at 2: unterminated string
2871 1253 ({"date
2872 1254 ^ here)
2873 1255 [255]
2874 1256
2875 1257 $ hg log -T '{"foo{date|?}"}'
2876 1258 hg: parse error at 11: syntax error
2877 1259 ({"foo{date|?}"}
2878 1260 ^ here)
2879 1261 [255]
2880 1262
2881 1263 Thrown an error if a template function doesn't exist
2882 1264
2883 1265 $ hg tip --template '{foo()}\n'
2884 1266 hg: parse error: unknown function 'foo'
2885 1267 [255]
2886 1268
2887 1269 Pass generator object created by template function to filter
2888 1270
2889 1271 $ hg log -l 1 --template '{if(author, author)|user}\n'
2890 1272 test
2891 1273
2892 1274 Test index keyword:
2893 1275
2894 1276 $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
2895 1277 10 0:a 1:b 2:fifth 3:fourth 4:third
2896 1278 11 0:a
2897 1279
2898 1280 $ hg branches -T '{index} {branch}\n'
2899 1281 0 default
2900 1282 1 foo
2901 1283
2902 1284 Test diff function:
2903 1285
2904 1286 $ hg diff -c 8
2905 1287 diff -r 29114dbae42b -r 95c24699272e fourth
2906 1288 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2907 1289 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2908 1290 @@ -0,0 +1,1 @@
2909 1291 +second
2910 1292 diff -r 29114dbae42b -r 95c24699272e second
2911 1293 --- a/second Mon Jan 12 13:46:40 1970 +0000
2912 1294 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2913 1295 @@ -1,1 +0,0 @@
2914 1296 -second
2915 1297 diff -r 29114dbae42b -r 95c24699272e third
2916 1298 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2917 1299 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2918 1300 @@ -0,0 +1,1 @@
2919 1301 +third
2920 1302
2921 1303 $ hg log -r 8 -T "{diff()}"
2922 1304 diff -r 29114dbae42b -r 95c24699272e fourth
2923 1305 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2924 1306 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2925 1307 @@ -0,0 +1,1 @@
2926 1308 +second
2927 1309 diff -r 29114dbae42b -r 95c24699272e second
2928 1310 --- a/second Mon Jan 12 13:46:40 1970 +0000
2929 1311 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2930 1312 @@ -1,1 +0,0 @@
2931 1313 -second
2932 1314 diff -r 29114dbae42b -r 95c24699272e third
2933 1315 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2934 1316 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2935 1317 @@ -0,0 +1,1 @@
2936 1318 +third
2937 1319
2938 1320 $ hg log -r 8 -T "{diff('glob:f*')}"
2939 1321 diff -r 29114dbae42b -r 95c24699272e fourth
2940 1322 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2941 1323 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2942 1324 @@ -0,0 +1,1 @@
2943 1325 +second
2944 1326
2945 1327 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2946 1328 diff -r 29114dbae42b -r 95c24699272e second
2947 1329 --- a/second Mon Jan 12 13:46:40 1970 +0000
2948 1330 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2949 1331 @@ -1,1 +0,0 @@
2950 1332 -second
2951 1333 diff -r 29114dbae42b -r 95c24699272e third
2952 1334 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2953 1335 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2954 1336 @@ -0,0 +1,1 @@
2955 1337 +third
2956 1338
2957 1339 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2958 1340 diff -r 29114dbae42b -r 95c24699272e fourth
2959 1341 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2960 1342 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2961 1343 @@ -0,0 +1,1 @@
2962 1344 +second
2963 1345
2964 1346 ui verbosity:
2965 1347
2966 1348 $ hg log -l1 -T '{verbosity}\n'
2967 1349
2968 1350 $ hg log -l1 -T '{verbosity}\n' --debug
2969 1351 debug
2970 1352 $ hg log -l1 -T '{verbosity}\n' --quiet
2971 1353 quiet
2972 1354 $ hg log -l1 -T '{verbosity}\n' --verbose
2973 1355 verbose
2974 1356
2975 1357 $ cd ..
2976 1358
2977 1359
2978 1360 latesttag:
2979 1361
2980 1362 $ hg init latesttag
2981 1363 $ cd latesttag
2982 1364
2983 1365 $ echo a > file
2984 1366 $ hg ci -Am a -d '0 0'
2985 1367 adding file
2986 1368
2987 1369 $ echo b >> file
2988 1370 $ hg ci -m b -d '1 0'
2989 1371
2990 1372 $ echo c >> head1
2991 1373 $ hg ci -Am h1c -d '2 0'
2992 1374 adding head1
2993 1375
2994 1376 $ hg update -q 1
2995 1377 $ echo d >> head2
2996 1378 $ hg ci -Am h2d -d '3 0'
2997 1379 adding head2
2998 1380 created new head
2999 1381
3000 1382 $ echo e >> head2
3001 1383 $ hg ci -m h2e -d '4 0'
3002 1384
3003 1385 $ hg merge -q
3004 1386 $ hg ci -m merge -d '5 -3600'
3005 1387
3006 1388 No tag set:
3007 1389
3008 1390 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3009 1391 @ 5: null+5
3010 1392 |\
3011 1393 | o 4: null+4
3012 1394 | |
3013 1395 | o 3: null+3
3014 1396 | |
3015 1397 o | 2: null+3
3016 1398 |/
3017 1399 o 1: null+2
3018 1400 |
3019 1401 o 0: null+1
3020 1402
3021 1403
3022 1404 One common tag: longest path wins for {latesttagdistance}:
3023 1405
3024 1406 $ hg tag -r 1 -m t1 -d '6 0' t1
3025 1407 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3026 1408 @ 6: t1+4
3027 1409 |
3028 1410 o 5: t1+3
3029 1411 |\
3030 1412 | o 4: t1+2
3031 1413 | |
3032 1414 | o 3: t1+1
3033 1415 | |
3034 1416 o | 2: t1+1
3035 1417 |/
3036 1418 o 1: t1+0
3037 1419 |
3038 1420 o 0: null+1
3039 1421
3040 1422
3041 1423 One ancestor tag: closest wins:
3042 1424
3043 1425 $ hg tag -r 2 -m t2 -d '7 0' t2
3044 1426 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3045 1427 @ 7: t2+3
3046 1428 |
3047 1429 o 6: t2+2
3048 1430 |
3049 1431 o 5: t2+1
3050 1432 |\
3051 1433 | o 4: t1+2
3052 1434 | |
3053 1435 | o 3: t1+1
3054 1436 | |
3055 1437 o | 2: t2+0
3056 1438 |/
3057 1439 o 1: t1+0
3058 1440 |
3059 1441 o 0: null+1
3060 1442
3061 1443
3062 1444 Two branch tags: more recent wins if same number of changes:
3063 1445
3064 1446 $ hg tag -r 3 -m t3 -d '8 0' t3
3065 1447 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3066 1448 @ 8: t3+5
3067 1449 |
3068 1450 o 7: t3+4
3069 1451 |
3070 1452 o 6: t3+3
3071 1453 |
3072 1454 o 5: t3+2
3073 1455 |\
3074 1456 | o 4: t3+1
3075 1457 | |
3076 1458 | o 3: t3+0
3077 1459 | |
3078 1460 o | 2: t2+0
3079 1461 |/
3080 1462 o 1: t1+0
3081 1463 |
3082 1464 o 0: null+1
3083 1465
3084 1466
3085 1467 Two branch tags: fewest changes wins:
3086 1468
3087 1469 $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
3088 1470 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3089 1471 @ 9: t4+5,6
3090 1472 |
3091 1473 o 8: t4+4,5
3092 1474 |
3093 1475 o 7: t4+3,4
3094 1476 |
3095 1477 o 6: t4+2,3
3096 1478 |
3097 1479 o 5: t4+1,2
3098 1480 |\
3099 1481 | o 4: t4+0,0
3100 1482 | |
3101 1483 | o 3: t3+0,0
3102 1484 | |
3103 1485 o | 2: t2+0,0
3104 1486 |/
3105 1487 o 1: t1+0,0
3106 1488 |
3107 1489 o 0: null+1,1
3108 1490
3109 1491
3110 1492 Merged tag overrides:
3111 1493
3112 1494 $ hg tag -r 5 -m t5 -d '9 0' t5
3113 1495 $ hg tag -r 3 -m at3 -d '10 0' at3
3114 1496 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3115 1497 @ 11: t5+6
3116 1498 |
3117 1499 o 10: t5+5
3118 1500 |
3119 1501 o 9: t5+4
3120 1502 |
3121 1503 o 8: t5+3
3122 1504 |
3123 1505 o 7: t5+2
3124 1506 |
3125 1507 o 6: t5+1
3126 1508 |
3127 1509 o 5: t5+0
3128 1510 |\
3129 1511 | o 4: t4+0
3130 1512 | |
3131 1513 | o 3: at3:t3+0
3132 1514 | |
3133 1515 o | 2: t2+0
3134 1516 |/
3135 1517 o 1: t1+0
3136 1518 |
3137 1519 o 0: null+1
3138 1520
3139 1521
3140 1522 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3141 1523 @ 11: t5+6,6
3142 1524 |
3143 1525 o 10: t5+5,5
3144 1526 |
3145 1527 o 9: t5+4,4
3146 1528 |
3147 1529 o 8: t5+3,3
3148 1530 |
3149 1531 o 7: t5+2,2
3150 1532 |
3151 1533 o 6: t5+1,1
3152 1534 |
3153 1535 o 5: t5+0,0
3154 1536 |\
3155 1537 | o 4: t4+0,0
3156 1538 | |
3157 1539 | o 3: at3+0,0 t3+0,0
3158 1540 | |
3159 1541 o | 2: t2+0,0
3160 1542 |/
3161 1543 o 1: t1+0,0
3162 1544 |
3163 1545 o 0: null+1,1
3164 1546
3165 1547
3166 1548 $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
3167 1549 @ 11: t3, C: 9, D: 8
3168 1550 |
3169 1551 o 10: t3, C: 8, D: 7
3170 1552 |
3171 1553 o 9: t3, C: 7, D: 6
3172 1554 |
3173 1555 o 8: t3, C: 6, D: 5
3174 1556 |
3175 1557 o 7: t3, C: 5, D: 4
3176 1558 |
3177 1559 o 6: t3, C: 4, D: 3
3178 1560 |
3179 1561 o 5: t3, C: 3, D: 2
3180 1562 |\
3181 1563 | o 4: t3, C: 1, D: 1
3182 1564 | |
3183 1565 | o 3: t3, C: 0, D: 0
3184 1566 | |
3185 1567 o | 2: t1, C: 1, D: 1
3186 1568 |/
3187 1569 o 1: t1, C: 0, D: 0
3188 1570 |
3189 1571 o 0: null, C: 1, D: 1
3190 1572
3191 1573
3192 1574 $ cd ..
3193 1575
3194
3195 Style path expansion: issue1948 - ui.style option doesn't work on OSX
3196 if it is a relative path
3197
3198 $ mkdir -p home/styles
3199
3200 $ cat > home/styles/teststyle <<EOF
3201 > changeset = 'test {rev}:{node|short}\n'
3202 > EOF
3203
3204 $ HOME=`pwd`/home; export HOME
3205
3206 $ cat > latesttag/.hg/hgrc <<EOF
3207 > [ui]
3208 > style = ~/styles/teststyle
3209 > EOF
3210
3211 $ hg -R latesttag tip
3212 test 11:97e5943b523a
3213
3214 Test recursive showlist template (issue1989):
3215
3216 $ cat > style1989 <<EOF
3217 > changeset = '{file_mods}{manifest}{extras}'
3218 > file_mod = 'M|{author|person}\n'
3219 > manifest = '{rev},{author}\n'
3220 > extra = '{key}: {author}\n'
3221 > EOF
3222
3223 $ hg -R latesttag log -r tip --style=style1989
3224 M|test
3225 11,test
3226 branch: test
3227
3228 1576 Test new-style inline templating:
3229 1577
3230 1578 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
3231 1579 modified files: .hgtags
3232 1580
3233 1581
3234 1582 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
3235 1583 hg: parse error: 11 is not iterable of mappings
3236 1584 (keyword 'rev' does not support map operation)
3237 1585 [255]
3238 1586 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
3239 1587 hg: parse error: None is not iterable of mappings
3240 1588 [255]
3241 1589 $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}'
3242 1590 hg: parse error: list of strings is not mappable
3243 1591 [255]
3244 1592
3245 1593 Test new-style inline templating of non-list/dict type:
3246 1594
3247 1595 $ hg log -R latesttag -r tip -T '{manifest}\n'
3248 1596 11:2bc6e9006ce2
3249 1597 $ hg log -R latesttag -r tip -T 'string length: {manifest|count}\n'
3250 1598 string length: 15
3251 1599 $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n'
3252 1600 11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc
3253 1601
3254 1602 $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}'
3255 1603 branch: default
3256 1604 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}'
3257 1605 hg: parse error: None is not iterable of mappings
3258 1606 [255]
3259 1607 $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}'
3260 1608 branch: default
3261 1609 $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}'
3262 1610 0:ce3cec86e6c2
3263 1611 $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}'
3264 1612 9:fbc7cd862e9c
3265 1613
3266 1614 Test manifest/get() can be join()-ed as string, though it's silly:
3267 1615
3268 1616 $ hg log -R latesttag -r tip -T '{join(manifest, ".")}\n'
3269 1617 1.1.:.2.b.c.6.e.9.0.0.6.c.e.2
3270 1618 $ hg log -R latesttag -r tip -T '{join(get(extras, "branch"), ".")}\n'
3271 1619 d.e.f.a.u.l.t
3272 1620
3273 1621 Test join() over string
3274 1622
3275 1623 $ hg log -R latesttag -r tip -T '{join(rev|stringify, ".")}\n'
3276 1624 1.1
3277 1625
3278 1626 Test join() over uniterable
3279 1627
3280 1628 $ hg log -R latesttag -r tip -T '{join(rev, "")}\n'
3281 1629 hg: parse error: 11 is not iterable
3282 1630 [255]
3283 1631
3284 1632 Test min/max of integers
3285 1633
3286 1634 $ hg log -R latesttag -l1 -T '{min(revset("9:10"))}\n'
3287 1635 9
3288 1636 $ hg log -R latesttag -l1 -T '{max(revset("9:10"))}\n'
3289 1637 10
3290 1638
3291 1639 Test min/max over map operation:
3292 1640
3293 1641 $ hg log -R latesttag -r3 -T '{min(tags % "{tag}")}\n'
3294 1642 at3
3295 1643 $ hg log -R latesttag -r3 -T '{max(tags % "{tag}")}\n'
3296 1644 t3
3297 1645
3298 1646 Test min/max of strings:
3299 1647
3300 1648 $ hg log -R latesttag -l1 -T '{min(desc)}\n'
3301 1649 3
3302 1650 $ hg log -R latesttag -l1 -T '{max(desc)}\n'
3303 1651 t
3304 1652
3305 1653 Test min/max of non-iterable:
3306 1654
3307 1655 $ hg debugtemplate '{min(1)}'
3308 1656 hg: parse error: 1 is not iterable
3309 1657 (min first argument should be an iterable)
3310 1658 [255]
3311 1659 $ hg debugtemplate '{max(2)}'
3312 1660 hg: parse error: 2 is not iterable
3313 1661 (max first argument should be an iterable)
3314 1662 [255]
3315 1663
3316 1664 $ hg log -R latesttag -l1 -T '{min(date)}'
3317 1665 hg: parse error: date is not iterable
3318 1666 (min first argument should be an iterable)
3319 1667 [255]
3320 1668 $ hg log -R latesttag -l1 -T '{max(date)}'
3321 1669 hg: parse error: date is not iterable
3322 1670 (max first argument should be an iterable)
3323 1671 [255]
3324 1672
3325 1673 Test min/max of empty sequence:
3326 1674
3327 1675 $ hg debugtemplate '{min("")}'
3328 1676 hg: parse error: empty string
3329 1677 (min first argument should be an iterable)
3330 1678 [255]
3331 1679 $ hg debugtemplate '{max("")}'
3332 1680 hg: parse error: empty string
3333 1681 (max first argument should be an iterable)
3334 1682 [255]
3335 1683 $ hg debugtemplate '{min(dict())}'
3336 1684 hg: parse error: empty sequence
3337 1685 (min first argument should be an iterable)
3338 1686 [255]
3339 1687 $ hg debugtemplate '{max(dict())}'
3340 1688 hg: parse error: empty sequence
3341 1689 (max first argument should be an iterable)
3342 1690 [255]
3343 1691 $ hg debugtemplate '{min(dict() % "")}'
3344 1692 hg: parse error: empty sequence
3345 1693 (min first argument should be an iterable)
3346 1694 [255]
3347 1695 $ hg debugtemplate '{max(dict() % "")}'
3348 1696 hg: parse error: empty sequence
3349 1697 (max first argument should be an iterable)
3350 1698 [255]
3351 1699
3352 1700 Test min/max of if() result
3353 1701
3354 1702 $ cd latesttag
3355 1703 $ hg log -l1 -T '{min(if(true, revset("9:10"), ""))}\n'
3356 1704 9
3357 1705 $ hg log -l1 -T '{max(if(false, "", revset("9:10")))}\n'
3358 1706 10
3359 1707 $ hg log -l1 -T '{min(ifcontains("a", "aa", revset("9:10"), ""))}\n'
3360 1708 9
3361 1709 $ hg log -l1 -T '{max(ifcontains("a", "bb", "", revset("9:10")))}\n'
3362 1710 10
3363 1711 $ hg log -l1 -T '{min(ifeq(0, 0, revset("9:10"), ""))}\n'
3364 1712 9
3365 1713 $ hg log -l1 -T '{max(ifeq(0, 1, "", revset("9:10")))}\n'
3366 1714 10
3367 1715 $ cd ..
3368 1716
3369 1717 Test laziness of if() then/else clause
3370 1718
3371 1719 $ hg debugtemplate '{count(0)}'
3372 1720 hg: parse error: not countable
3373 1721 (incompatible use of template filter 'count')
3374 1722 [255]
3375 1723 $ hg debugtemplate '{if(true, "", count(0))}'
3376 1724 $ hg debugtemplate '{if(false, count(0), "")}'
3377 1725 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}'
3378 1726 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}'
3379 1727 $ hg debugtemplate '{ifeq(0, 0, "", count(0))}'
3380 1728 $ hg debugtemplate '{ifeq(0, 1, count(0), "")}'
3381 1729
3382 1730 Test dot operator precedence:
3383 1731
3384 1732 $ hg debugtemplate -R latesttag -r0 -v '{manifest.node|short}\n'
3385 1733 (template
3386 1734 (|
3387 1735 (.
3388 1736 (symbol 'manifest')
3389 1737 (symbol 'node'))
3390 1738 (symbol 'short'))
3391 1739 (string '\n'))
3392 1740 * keywords: manifest, node, rev
3393 1741 * functions: formatnode, short
3394 1742 89f4071fec70
3395 1743
3396 1744 (the following examples are invalid, but seem natural in parsing POV)
3397 1745
3398 1746 $ hg debugtemplate -R latesttag -r0 -v '{foo|bar.baz}\n' 2> /dev/null
3399 1747 (template
3400 1748 (|
3401 1749 (symbol 'foo')
3402 1750 (.
3403 1751 (symbol 'bar')
3404 1752 (symbol 'baz')))
3405 1753 (string '\n'))
3406 1754 [255]
3407 1755 $ hg debugtemplate -R latesttag -r0 -v '{foo.bar()}\n' 2> /dev/null
3408 1756 (template
3409 1757 (.
3410 1758 (symbol 'foo')
3411 1759 (func
3412 1760 (symbol 'bar')
3413 1761 None))
3414 1762 (string '\n'))
3415 1763 * keywords: foo
3416 1764 * functions: bar
3417 1765 [255]
3418 1766
3419 1767 Test evaluation of dot operator:
3420 1768
3421 1769 $ hg log -R latesttag -l1 -T '{min(revset("0:9")).node}\n'
3422 1770 ce3cec86e6c26bd9bdfc590a6b92abc9680f1796
3423 1771 $ hg log -R latesttag -r0 -T '{extras.branch}\n'
3424 1772 default
3425 1773 $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n'
3426 1774 0 -7200
3427 1775
3428 1776 $ hg log -R latesttag -l1 -T '{author.invalid}\n'
3429 1777 hg: parse error: 'test' is not a dictionary
3430 1778 (keyword 'author' does not support member operation)
3431 1779 [255]
3432 1780 $ hg log -R latesttag -l1 -T '{min("abc").invalid}\n'
3433 1781 hg: parse error: 'a' is not a dictionary
3434 1782 [255]
3435 1783
3436 1784 Test the sub function of templating for expansion:
3437 1785
3438 1786 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
3439 1787 xx
3440 1788
3441 1789 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
3442 1790 hg: parse error: sub got an invalid pattern: [
3443 1791 [255]
3444 1792 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
3445 1793 hg: parse error: sub got an invalid replacement: \1
3446 1794 [255]
3447 1795
3448 1796 Test the strip function with chars specified:
3449 1797
3450 1798 $ hg log -R latesttag --template '{desc}\n'
3451 1799 at3
3452 1800 t5
3453 1801 t4
3454 1802 t3
3455 1803 t2
3456 1804 t1
3457 1805 merge
3458 1806 h2e
3459 1807 h2d
3460 1808 h1c
3461 1809 b
3462 1810 a
3463 1811
3464 1812 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
3465 1813 at3
3466 1814 5
3467 1815 4
3468 1816 3
3469 1817 2
3470 1818 1
3471 1819 merg
3472 1820 h2
3473 1821 h2d
3474 1822 h1c
3475 1823 b
3476 1824 a
3477 1825
3478 1826 Test date format:
3479 1827
3480 1828 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
3481 1829 date: 70 01 01 10 +0000
3482 1830 date: 70 01 01 09 +0000
3483 1831 date: 70 01 01 04 +0000
3484 1832 date: 70 01 01 08 +0000
3485 1833 date: 70 01 01 07 +0000
3486 1834 date: 70 01 01 06 +0000
3487 1835 date: 70 01 01 05 +0100
3488 1836 date: 70 01 01 04 +0000
3489 1837 date: 70 01 01 03 +0000
3490 1838 date: 70 01 01 02 +0000
3491 1839 date: 70 01 01 01 +0000
3492 1840 date: 70 01 01 00 +0000
3493 1841
3494 1842 Test invalid date:
3495 1843
3496 1844 $ hg log -R latesttag -T '{date(rev)}\n'
3497 1845 hg: parse error: date expects a date information
3498 1846 [255]
3499 1847
3500 1848 Test integer literal:
3501 1849
3502 1850 $ hg debugtemplate -v '{(0)}\n'
3503 1851 (template
3504 1852 (group
3505 1853 (integer '0'))
3506 1854 (string '\n'))
3507 1855 * keywords:
3508 1856 * functions:
3509 1857 0
3510 1858 $ hg debugtemplate -v '{(123)}\n'
3511 1859 (template
3512 1860 (group
3513 1861 (integer '123'))
3514 1862 (string '\n'))
3515 1863 * keywords:
3516 1864 * functions:
3517 1865 123
3518 1866 $ hg debugtemplate -v '{(-4)}\n'
3519 1867 (template
3520 1868 (group
3521 1869 (negate
3522 1870 (integer '4')))
3523 1871 (string '\n'))
3524 1872 * keywords:
3525 1873 * functions:
3526 1874 -4
3527 1875 $ hg debugtemplate '{(-)}\n'
3528 1876 hg: parse error at 3: not a prefix: )
3529 1877 ({(-)}\n
3530 1878 ^ here)
3531 1879 [255]
3532 1880 $ hg debugtemplate '{(-a)}\n'
3533 1881 hg: parse error: negation needs an integer argument
3534 1882 [255]
3535 1883
3536 1884 top-level integer literal is interpreted as symbol (i.e. variable name):
3537 1885
3538 1886 $ hg debugtemplate -D 1=one -v '{1}\n'
3539 1887 (template
3540 1888 (integer '1')
3541 1889 (string '\n'))
3542 1890 * keywords:
3543 1891 * functions:
3544 1892 one
3545 1893 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
3546 1894 (template
3547 1895 (func
3548 1896 (symbol 'if')
3549 1897 (list
3550 1898 (string 't')
3551 1899 (template
3552 1900 (integer '1'))))
3553 1901 (string '\n'))
3554 1902 * keywords:
3555 1903 * functions: if
3556 1904 one
3557 1905 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
3558 1906 (template
3559 1907 (|
3560 1908 (integer '1')
3561 1909 (symbol 'stringify'))
3562 1910 (string '\n'))
3563 1911 * keywords:
3564 1912 * functions: stringify
3565 1913 one
3566 1914
3567 1915 unless explicit symbol is expected:
3568 1916
3569 1917 $ hg log -Ra -r0 -T '{desc|1}\n'
3570 1918 hg: parse error: expected a symbol, got 'integer'
3571 1919 [255]
3572 1920 $ hg log -Ra -r0 -T '{1()}\n'
3573 1921 hg: parse error: expected a symbol, got 'integer'
3574 1922 [255]
3575 1923
3576 1924 Test string literal:
3577 1925
3578 1926 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
3579 1927 (template
3580 1928 (string 'string with no template fragment')
3581 1929 (string '\n'))
3582 1930 * keywords:
3583 1931 * functions:
3584 1932 string with no template fragment
3585 1933 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
3586 1934 (template
3587 1935 (template
3588 1936 (string 'template: ')
3589 1937 (symbol 'rev'))
3590 1938 (string '\n'))
3591 1939 * keywords: rev
3592 1940 * functions:
3593 1941 template: 0
3594 1942 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
3595 1943 (template
3596 1944 (string 'rawstring: {rev}')
3597 1945 (string '\n'))
3598 1946 * keywords:
3599 1947 * functions:
3600 1948 rawstring: {rev}
3601 1949 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
3602 1950 (template
3603 1951 (%
3604 1952 (symbol 'files')
3605 1953 (string 'rawstring: {file}'))
3606 1954 (string '\n'))
3607 1955 * keywords: files
3608 1956 * functions:
3609 1957 rawstring: {file}
3610 1958
3611 1959 Test string escaping:
3612 1960
3613 1961 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3614 1962 >
3615 1963 <>\n<[>
3616 1964 <>\n<]>
3617 1965 <>\n<
3618 1966
3619 1967 $ hg log -R latesttag -r 0 \
3620 1968 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3621 1969 >
3622 1970 <>\n<[>
3623 1971 <>\n<]>
3624 1972 <>\n<
3625 1973
3626 1974 $ hg log -R latesttag -r 0 -T esc \
3627 1975 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3628 1976 >
3629 1977 <>\n<[>
3630 1978 <>\n<]>
3631 1979 <>\n<
3632 1980
3633 1981 $ cat <<'EOF' > esctmpl
3634 1982 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3635 1983 > EOF
3636 1984 $ hg log -R latesttag -r 0 --style ./esctmpl
3637 1985 >
3638 1986 <>\n<[>
3639 1987 <>\n<]>
3640 1988 <>\n<
3641 1989
3642 1990 Test string escaping of quotes:
3643 1991
3644 1992 $ hg log -Ra -r0 -T '{"\""}\n'
3645 1993 "
3646 1994 $ hg log -Ra -r0 -T '{"\\\""}\n'
3647 1995 \"
3648 1996 $ hg log -Ra -r0 -T '{r"\""}\n'
3649 1997 \"
3650 1998 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3651 1999 \\\"
3652 2000
3653 2001
3654 2002 $ hg log -Ra -r0 -T '{"\""}\n'
3655 2003 "
3656 2004 $ hg log -Ra -r0 -T '{"\\\""}\n'
3657 2005 \"
3658 2006 $ hg log -Ra -r0 -T '{r"\""}\n'
3659 2007 \"
3660 2008 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3661 2009 \\\"
3662 2010
3663 2011 Test exception in quoted template. single backslash before quotation mark is
3664 2012 stripped before parsing:
3665 2013
3666 2014 $ cat <<'EOF' > escquotetmpl
3667 2015 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3668 2016 > EOF
3669 2017 $ cd latesttag
3670 2018 $ hg log -r 2 --style ../escquotetmpl
3671 2019 " \" \" \\" head1
3672 2020
3673 2021 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3674 2022 valid
3675 2023 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3676 2024 valid
3677 2025
3678 2026 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3679 2027 _evalifliteral() templates (issue4733):
3680 2028
3681 2029 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3682 2030 "2
3683 2031 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3684 2032 "2
3685 2033 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3686 2034 "2
3687 2035
3688 2036 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3689 2037 \"
3690 2038 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3691 2039 \"
3692 2040 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3693 2041 \"
3694 2042
3695 2043 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3696 2044 \\\"
3697 2045 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3698 2046 \\\"
3699 2047 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3700 2048 \\\"
3701 2049
3702 2050 escaped single quotes and errors:
3703 2051
3704 2052 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3705 2053 foo
3706 2054 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3707 2055 foo
3708 2056 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3709 2057 hg: parse error at 21: unterminated string
3710 2058 ({if(rev, "{if(rev, \")}")}\n
3711 2059 ^ here)
3712 2060 [255]
3713 2061 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3714 2062 hg: parse error: trailing \ in string
3715 2063 [255]
3716 2064 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3717 2065 hg: parse error: trailing \ in string
3718 2066 [255]
3719 2067
3720 2068 $ cd ..
3721 2069
3722 2070 Test leading backslashes:
3723 2071
3724 2072 $ cd latesttag
3725 2073 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3726 2074 {rev} {file}
3727 2075 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3728 2076 \2 \head1
3729 2077 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3730 2078 \{rev} \{file}
3731 2079 $ cd ..
3732 2080
3733 2081 Test leading backslashes in "if" expression (issue4714):
3734 2082
3735 2083 $ cd latesttag
3736 2084 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3737 2085 {rev} \{rev}
3738 2086 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3739 2087 \2 \\{rev}
3740 2088 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3741 2089 \{rev} \\\{rev}
3742 2090 $ cd ..
3743 2091
3744 2092 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3745 2093
3746 2094 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3747 2095 \x6e
3748 2096 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3749 2097 \x5c\x786e
3750 2098 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3751 2099 \x6e
3752 2100 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3753 2101 \x5c\x786e
3754 2102
3755 2103 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3756 2104 \x6e
3757 2105 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3758 2106 \x5c\x786e
3759 2107 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3760 2108 \x6e
3761 2109 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3762 2110 \x5c\x786e
3763 2111
3764 2112 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3765 2113 fourth
3766 2114 second
3767 2115 third
3768 2116 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3769 2117 fourth\nsecond\nthird
3770 2118
3771 2119 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3772 2120 <p>
3773 2121 1st
3774 2122 </p>
3775 2123 <p>
3776 2124 2nd
3777 2125 </p>
3778 2126 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3779 2127 <p>
3780 2128 1st\n\n2nd
3781 2129 </p>
3782 2130 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3783 2131 1st
3784 2132
3785 2133 2nd
3786 2134
3787 2135 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3788 2136 o perso
3789 2137 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3790 2138 no person
3791 2139 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3792 2140 o perso
3793 2141 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3794 2142 no perso
3795 2143
3796 2144 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3797 2145 -o perso-
3798 2146 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3799 2147 no person
3800 2148 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3801 2149 \x2do perso\x2d
3802 2150 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3803 2151 -o perso-
3804 2152 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3805 2153 \x2do perso\x6e
3806 2154
3807 2155 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3808 2156 fourth
3809 2157 second
3810 2158 third
3811 2159
3812 2160 Test string escaping in nested expression:
3813 2161
3814 2162 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3815 2163 fourth\x6esecond\x6ethird
3816 2164 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3817 2165 fourth\x6esecond\x6ethird
3818 2166
3819 2167 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3820 2168 fourth\x6esecond\x6ethird
3821 2169 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3822 2170 fourth\x5c\x786esecond\x5c\x786ethird
3823 2171
3824 2172 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3825 2173 3:\x6eo user, \x6eo domai\x6e
3826 2174 4:\x5c\x786eew bra\x5c\x786ech
3827 2175
3828 2176 Test quotes in nested expression are evaluated just like a $(command)
3829 2177 substitution in POSIX shells:
3830 2178
3831 2179 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3832 2180 8:95c24699272e
3833 2181 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3834 2182 {8} "95c24699272e"
3835 2183
3836 2184 Test recursive evaluation:
3837 2185
3838 2186 $ hg init r
3839 2187 $ cd r
3840 2188 $ echo a > a
3841 2189 $ hg ci -Am '{rev}'
3842 2190 adding a
3843 2191 $ hg log -r 0 --template '{if(rev, desc)}\n'
3844 2192 {rev}
3845 2193 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3846 2194 test 0
3847 2195
3848 2196 $ hg branch -q 'text.{rev}'
3849 2197 $ echo aa >> aa
3850 2198 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3851 2199
3852 2200 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3853 2201 {node|short}desc to
3854 2202 text.{rev}be wrapped
3855 2203 text.{rev}desc to be
3856 2204 text.{rev}wrapped (no-eol)
3857 2205 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3858 2206 bcc7ff960b8e:desc to
3859 2207 text.1:be wrapped
3860 2208 text.1:desc to be
3861 2209 text.1:wrapped (no-eol)
3862 2210 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3863 2211 hg: parse error: fill expects an integer width
3864 2212 [255]
3865 2213
3866 2214 $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}'
3867 2215 bcc7ff960b8e:desc to be
3868 2216 termwidth.1:wrapped desc
3869 2217 termwidth.1:to be wrapped (no-eol)
3870 2218
3871 2219 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3872 2220 {node|short} (no-eol)
3873 2221 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3874 2222 bcc-ff---b-e (no-eol)
3875 2223
3876 2224 $ cat >> .hg/hgrc <<EOF
3877 2225 > [extensions]
3878 2226 > color=
3879 2227 > [color]
3880 2228 > mode=ansi
3881 2229 > text.{rev} = red
3882 2230 > text.1 = green
3883 2231 > EOF
3884 2232 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3885 2233 \x1b[0;31mtext\x1b[0m (esc)
3886 2234 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3887 2235 \x1b[0;32mtext\x1b[0m (esc)
3888 2236
3889 2237 color effect can be specified without quoting:
3890 2238
3891 2239 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3892 2240 \x1b[0;31mtext\x1b[0m (esc)
3893 2241
3894 2242 color effects can be nested (issue5413)
3895 2243
3896 2244 $ hg debugtemplate --color=always \
3897 2245 > '{label(red, "red{label(magenta, "ma{label(cyan, "cyan")}{label(yellow, "yellow")}genta")}")}\n'
3898 2246 \x1b[0;31mred\x1b[0;35mma\x1b[0;36mcyan\x1b[0m\x1b[0;31m\x1b[0;35m\x1b[0;33myellow\x1b[0m\x1b[0;31m\x1b[0;35mgenta\x1b[0m (esc)
3899 2247
3900 2248 pad() should interact well with color codes (issue5416)
3901 2249
3902 2250 $ hg debugtemplate --color=always \
3903 2251 > '{pad(label(red, "red"), 5, label(cyan, "-"))}\n'
3904 2252 \x1b[0;31mred\x1b[0m\x1b[0;36m-\x1b[0m\x1b[0;36m-\x1b[0m (esc)
3905 2253
3906 2254 label should be no-op if color is disabled:
3907 2255
3908 2256 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3909 2257 text
3910 2258 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3911 2259 text
3912 2260
3913 2261 Test branches inside if statement:
3914 2262
3915 2263 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3916 2264 no
3917 2265
3918 2266 Test dict constructor:
3919 2267
3920 2268 $ hg log -r 0 -T '{dict(y=node|short, x=rev)}\n'
3921 2269 y=f7769ec2ab97 x=0
3922 2270 $ hg log -r 0 -T '{dict(x=rev, y=node|short) % "{key}={value}\n"}'
3923 2271 x=0
3924 2272 y=f7769ec2ab97
3925 2273 $ hg log -r 0 -T '{dict(x=rev, y=node|short)|json}\n'
3926 2274 {"x": 0, "y": "f7769ec2ab97"}
3927 2275 $ hg log -r 0 -T '{dict()|json}\n'
3928 2276 {}
3929 2277
3930 2278 $ hg log -r 0 -T '{dict(rev, node=node|short)}\n'
3931 2279 rev=0 node=f7769ec2ab97
3932 2280 $ hg log -r 0 -T '{dict(rev, node|short)}\n'
3933 2281 rev=0 node=f7769ec2ab97
3934 2282
3935 2283 $ hg log -r 0 -T '{dict(rev, rev=rev)}\n'
3936 2284 hg: parse error: duplicated dict key 'rev' inferred
3937 2285 [255]
3938 2286 $ hg log -r 0 -T '{dict(node, node|short)}\n'
3939 2287 hg: parse error: duplicated dict key 'node' inferred
3940 2288 [255]
3941 2289 $ hg log -r 0 -T '{dict(1 + 2)}'
3942 2290 hg: parse error: dict key cannot be inferred
3943 2291 [255]
3944 2292
3945 2293 $ hg log -r 0 -T '{dict(x=rev, x=node)}'
3946 2294 hg: parse error: dict got multiple values for keyword argument 'x'
3947 2295 [255]
3948 2296
3949 2297 Test get function:
3950 2298
3951 2299 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3952 2300 default
3953 2301 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3954 2302 default
3955 2303 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3956 2304 hg: parse error: not a dictionary
3957 2305 (get() expects a dict as first argument)
3958 2306 [255]
3959 2307
3960 2308 Test json filter applied to wrapped object:
3961 2309
3962 2310 $ hg log -r0 -T '{files|json}\n'
3963 2311 ["a"]
3964 2312 $ hg log -r0 -T '{extras|json}\n'
3965 2313 {"branch": "default"}
3966 2314 $ hg log -r0 -T '{date|json}\n'
3967 2315 [0, 0]
3968 2316
3969 2317 Test json filter applied to map result:
3970 2318
3971 2319 $ hg log -r0 -T '{json(extras % "{key}")}\n'
3972 2320 ["branch"]
3973 2321
3974 2322 Test localdate(date, tz) function:
3975 2323
3976 2324 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3977 2325 1970-01-01 09:00 +0900
3978 2326 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3979 2327 1970-01-01 00:00 +0000
3980 2328 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "blahUTC")|isodate}\n'
3981 2329 hg: parse error: localdate expects a timezone
3982 2330 [255]
3983 2331 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3984 2332 1970-01-01 02:00 +0200
3985 2333 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3986 2334 1970-01-01 00:00 +0000
3987 2335 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3988 2336 1970-01-01 00:00 +0000
3989 2337 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3990 2338 hg: parse error: localdate expects a timezone
3991 2339 [255]
3992 2340 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3993 2341 hg: parse error: localdate expects a timezone
3994 2342 [255]
3995 2343
3996 2344 Test shortest(node) function:
3997 2345
3998 2346 $ echo b > b
3999 2347 $ hg ci -qAm b
4000 2348 $ hg log --template '{shortest(node)}\n'
4001 2349 e777
4002 2350 bcc7
4003 2351 f776
4004 2352 $ hg log --template '{shortest(node, 10)}\n'
4005 2353 e777603221
4006 2354 bcc7ff960b
4007 2355 f7769ec2ab
4008 2356 $ hg log --template '{node|shortest}\n' -l1
4009 2357 e777
4010 2358
4011 2359 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
4012 2360 f7769ec2ab
4013 2361 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
4014 2362 hg: parse error: shortest() expects an integer minlength
4015 2363 [255]
4016 2364
4017 2365 $ hg log -r 'wdir()' -T '{node|shortest}\n'
4018 2366 ffff
4019 2367
4020 2368 $ hg log --template '{shortest("f")}\n' -l1
4021 2369 f
4022 2370
4023 2371 $ hg log --template '{shortest("0123456789012345678901234567890123456789")}\n' -l1
4024 2372 0123456789012345678901234567890123456789
4025 2373
4026 2374 $ hg log --template '{shortest("01234567890123456789012345678901234567890123456789")}\n' -l1
4027 2375 01234567890123456789012345678901234567890123456789
4028 2376
4029 2377 $ hg log --template '{shortest("not a hex string")}\n' -l1
4030 2378 not a hex string
4031 2379
4032 2380 $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1
4033 2381 not a hex string, but it's 40 bytes long
4034 2382
4035 2383 $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1
4036 2384 ffff
4037 2385
4038 2386 $ hg log --template '{shortest("fffffff")}\n' -l1
4039 2387 ffff
4040 2388
4041 2389 $ hg log --template '{shortest("ff")}\n' -l1
4042 2390 ffff
4043 2391
4044 2392 $ cd ..
4045 2393
4046 2394 Test shortest(node) with the repo having short hash collision:
4047 2395
4048 2396 $ hg init hashcollision
4049 2397 $ cd hashcollision
4050 2398 $ cat <<EOF >> .hg/hgrc
4051 2399 > [experimental]
4052 2400 > evolution.createmarkers=True
4053 2401 > EOF
4054 2402 $ echo 0 > a
4055 2403 $ hg ci -qAm 0
4056 2404 $ for i in 17 129 248 242 480 580 617 1057 2857 4025; do
4057 2405 > hg up -q 0
4058 2406 > echo $i > a
4059 2407 > hg ci -qm $i
4060 2408 > done
4061 2409 $ hg up -q null
4062 2410 $ hg log -r0: -T '{rev}:{node}\n'
4063 2411 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
4064 2412 1:11424df6dc1dd4ea255eae2b58eaca7831973bbc
4065 2413 2:11407b3f1b9c3e76a79c1ec5373924df096f0499
4066 2414 3:11dd92fe0f39dfdaacdaa5f3997edc533875cfc4
4067 2415 4:10776689e627b465361ad5c296a20a487e153ca4
4068 2416 5:a00be79088084cb3aff086ab799f8790e01a976b
4069 2417 6:a0b0acd79b4498d0052993d35a6a748dd51d13e6
4070 2418 7:a0457b3450b8e1b778f1163b31a435802987fe5d
4071 2419 8:c56256a09cd28e5764f32e8e2810d0f01e2e357a
4072 2420 9:c5623987d205cd6d9d8389bfc40fff9dbb670b48
4073 2421 10:c562ddd9c94164376c20b86b0b4991636a3bf84f
4074 2422 $ hg debugobsolete a00be79088084cb3aff086ab799f8790e01a976b
4075 2423 obsoleted 1 changesets
4076 2424 $ hg debugobsolete c5623987d205cd6d9d8389bfc40fff9dbb670b48
4077 2425 obsoleted 1 changesets
4078 2426 $ hg debugobsolete c562ddd9c94164376c20b86b0b4991636a3bf84f
4079 2427 obsoleted 1 changesets
4080 2428
4081 2429 nodes starting with '11' (we don't have the revision number '11' though)
4082 2430
4083 2431 $ hg log -r 1:3 -T '{rev}:{shortest(node, 0)}\n'
4084 2432 1:1142
4085 2433 2:1140
4086 2434 3:11d
4087 2435
4088 2436 '5:a00' is hidden, but still we have two nodes starting with 'a0'
4089 2437
4090 2438 $ hg log -r 6:7 -T '{rev}:{shortest(node, 0)}\n'
4091 2439 6:a0b
4092 2440 7:a04
4093 2441
4094 2442 node '10' conflicts with the revision number '10' even if it is hidden
4095 2443 (we could exclude hidden revision numbers, but currently we don't)
4096 2444
4097 2445 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n'
4098 2446 4:107
4099 2447 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
4100 2448 4:107
4101 2449
4102 2450 node 'c562' should be unique if the other 'c562' nodes are hidden
4103 2451 (but we don't try the slow path to filter out hidden nodes for now)
4104 2452
4105 2453 $ hg log -r 8 -T '{rev}:{node|shortest}\n'
4106 2454 8:c5625
4107 2455 $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden
4108 2456 8:c5625
4109 2457 9:c5623
4110 2458 10:c562d
4111 2459
4112 2460 $ cd ..
4113 2461
4114 2462 Test pad function
4115 2463
4116 2464 $ cd r
4117 2465
4118 2466 $ hg log --template '{pad(rev, 20)} {author|user}\n'
4119 2467 2 test
4120 2468 1 {node|short}
4121 2469 0 test
4122 2470
4123 2471 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
4124 2472 2 test
4125 2473 1 {node|short}
4126 2474 0 test
4127 2475
4128 2476 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
4129 2477 2------------------- test
4130 2478 1------------------- {node|short}
4131 2479 0------------------- test
4132 2480
4133 2481 Test template string in pad function
4134 2482
4135 2483 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
4136 2484 {0} test
4137 2485
4138 2486 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
4139 2487 \{rev} test
4140 2488
4141 2489 Test width argument passed to pad function
4142 2490
4143 2491 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
4144 2492 0 test
4145 2493 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
4146 2494 hg: parse error: pad() expects an integer width
4147 2495 [255]
4148 2496
4149 2497 Test invalid fillchar passed to pad function
4150 2498
4151 2499 $ hg log -r 0 -T '{pad(rev, 10, "")}\n'
4152 2500 hg: parse error: pad() expects a single fill character
4153 2501 [255]
4154 2502 $ hg log -r 0 -T '{pad(rev, 10, "--")}\n'
4155 2503 hg: parse error: pad() expects a single fill character
4156 2504 [255]
4157 2505
4158 2506 Test boolean argument passed to pad function
4159 2507
4160 2508 no crash
4161 2509
4162 2510 $ hg log -r 0 -T '{pad(rev, 10, "-", "f{"oo"}")}\n'
4163 2511 ---------0
4164 2512
4165 2513 string/literal
4166 2514
4167 2515 $ hg log -r 0 -T '{pad(rev, 10, "-", "false")}\n'
4168 2516 ---------0
4169 2517 $ hg log -r 0 -T '{pad(rev, 10, "-", false)}\n'
4170 2518 0---------
4171 2519 $ hg log -r 0 -T '{pad(rev, 10, "-", "")}\n'
4172 2520 0---------
4173 2521
4174 2522 unknown keyword is evaluated to ''
4175 2523
4176 2524 $ hg log -r 0 -T '{pad(rev, 10, "-", unknownkeyword)}\n'
4177 2525 0---------
4178 2526
4179 2527 Test separate function
4180 2528
4181 2529 $ hg log -r 0 -T '{separate("-", "", "a", "b", "", "", "c", "")}\n'
4182 2530 a-b-c
4183 2531 $ hg log -r 0 -T '{separate(" ", "{rev}:{node|short}", author|user, branch)}\n'
4184 2532 0:f7769ec2ab97 test default
4185 2533 $ hg log -r 0 --color=always -T '{separate(" ", "a", label(red, "b"), "c", label(red, ""), "d")}\n'
4186 2534 a \x1b[0;31mb\x1b[0m c d (esc)
4187 2535
4188 2536 Test boolean expression/literal passed to if function
4189 2537
4190 2538 $ hg log -r 0 -T '{if(rev, "rev 0 is True")}\n'
4191 2539 rev 0 is True
4192 2540 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n'
4193 2541 literal 0 is True as well
4194 2542 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n'
4195 2543 empty string is False
4196 2544 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n'
4197 2545 empty list is False
4198 2546 $ hg log -r 0 -T '{if(revset(r"0"), "non-empty list is True")}\n'
4199 2547 non-empty list is True
4200 2548 $ hg log -r 0 -T '{if(revset(r"0") % "", "list of empty strings is True")}\n'
4201 2549 list of empty strings is True
4202 2550 $ hg log -r 0 -T '{if(true, "true is True")}\n'
4203 2551 true is True
4204 2552 $ hg log -r 0 -T '{if(false, "", "false is False")}\n'
4205 2553 false is False
4206 2554 $ hg log -r 0 -T '{if("false", "non-empty string is True")}\n'
4207 2555 non-empty string is True
4208 2556
4209 2557 Test ifcontains function
4210 2558
4211 2559 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
4212 2560 2 is in the string
4213 2561 1 is not
4214 2562 0 is in the string
4215 2563
4216 2564 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
4217 2565 2 is in the string
4218 2566 1 is not
4219 2567 0 is in the string
4220 2568
4221 2569 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
4222 2570 2 did not add a
4223 2571 1 did not add a
4224 2572 0 added a
4225 2573
4226 2574 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
4227 2575 2 is parent of 1
4228 2576 1
4229 2577 0
4230 2578
4231 2579 $ hg log -l1 -T '{ifcontains("branch", extras, "t", "f")}\n'
4232 2580 t
4233 2581 $ hg log -l1 -T '{ifcontains("branch", extras % "{key}", "t", "f")}\n'
4234 2582 t
4235 2583 $ hg log -l1 -T '{ifcontains("branc", extras % "{key}", "t", "f")}\n'
4236 2584 f
4237 2585 $ hg log -l1 -T '{ifcontains("branc", stringify(extras % "{key}"), "t", "f")}\n'
4238 2586 t
4239 2587
4240 2588 Test revset function
4241 2589
4242 2590 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
4243 2591 2 current rev
4244 2592 1 not current rev
4245 2593 0 not current rev
4246 2594
4247 2595 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
4248 2596 2 match rev
4249 2597 1 match rev
4250 2598 0 not match rev
4251 2599
4252 2600 $ hg log -T '{ifcontains(desc, revset(":"), "", "type not match")}\n' -l1
4253 2601 type not match
4254 2602
4255 2603 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
4256 2604 2 Parents: 1
4257 2605 1 Parents: 0
4258 2606 0 Parents:
4259 2607
4260 2608 $ cat >> .hg/hgrc <<EOF
4261 2609 > [revsetalias]
4262 2610 > myparents(\$1) = parents(\$1)
4263 2611 > EOF
4264 2612 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
4265 2613 2 Parents: 1
4266 2614 1 Parents: 0
4267 2615 0 Parents:
4268 2616
4269 2617 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
4270 2618 Rev: 2
4271 2619 Ancestor: 0
4272 2620 Ancestor: 1
4273 2621 Ancestor: 2
4274 2622
4275 2623 Rev: 1
4276 2624 Ancestor: 0
4277 2625 Ancestor: 1
4278 2626
4279 2627 Rev: 0
4280 2628 Ancestor: 0
4281 2629
4282 2630 $ hg log --template '{revset("TIP"|lower)}\n' -l1
4283 2631 2
4284 2632
4285 2633 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
4286 2634 2
4287 2635
4288 2636 a list template is evaluated for each item of revset/parents
4289 2637
4290 2638 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
4291 2639 2 p: 1:bcc7ff960b8e
4292 2640 1 p: 0:f7769ec2ab97
4293 2641 0 p:
4294 2642
4295 2643 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
4296 2644 2 p: 1:bcc7ff960b8e -1:000000000000
4297 2645 1 p: 0:f7769ec2ab97 -1:000000000000
4298 2646 0 p: -1:000000000000 -1:000000000000
4299 2647
4300 2648 therefore, 'revcache' should be recreated for each rev
4301 2649
4302 2650 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
4303 2651 2 aa b
4304 2652 p
4305 2653 1
4306 2654 p a
4307 2655 0 a
4308 2656 p
4309 2657
4310 2658 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
4311 2659 2 aa b
4312 2660 p
4313 2661 1
4314 2662 p a
4315 2663 0 a
4316 2664 p
4317 2665
4318 2666 a revset item must be evaluated as an integer revision, not an offset from tip
4319 2667
4320 2668 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
4321 2669 -1:000000000000
4322 2670 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
4323 2671 -1:000000000000
4324 2672
4325 2673 join() should pick '{rev}' from revset items:
4326 2674
4327 2675 $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6
4328 2676 4, 5
4329 2677
4330 2678 on the other hand, parents are formatted as '{rev}:{node|formatnode}' by
4331 2679 default. join() should agree with the default formatting:
4332 2680
4333 2681 $ hg log -R ../a -T '{join(parents, ", ")}\n' -r6
4334 2682 5:13207e5a10d9, 4:bbe44766e73d
4335 2683
4336 2684 $ hg log -R ../a -T '{join(parents, ",\n")}\n' -r6 --debug
4337 2685 5:13207e5a10d9fd28ec424934298e176197f2c67f,
4338 2686 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
4339 2687
4340 2688 Invalid arguments passed to revset()
4341 2689
4342 2690 $ hg log -T '{revset("%whatever", 0)}\n'
4343 2691 hg: parse error: unexpected revspec format character w
4344 2692 [255]
4345 2693 $ hg log -T '{revset("%lwhatever", files)}\n'
4346 2694 hg: parse error: unexpected revspec format character w
4347 2695 [255]
4348 2696 $ hg log -T '{revset("%s %s", 0)}\n'
4349 2697 hg: parse error: missing argument for revspec
4350 2698 [255]
4351 2699 $ hg log -T '{revset("", 0)}\n'
4352 2700 hg: parse error: too many revspec arguments specified
4353 2701 [255]
4354 2702 $ hg log -T '{revset("%s", 0, 1)}\n'
4355 2703 hg: parse error: too many revspec arguments specified
4356 2704 [255]
4357 2705 $ hg log -T '{revset("%", 0)}\n'
4358 2706 hg: parse error: incomplete revspec format character
4359 2707 [255]
4360 2708 $ hg log -T '{revset("%l", 0)}\n'
4361 2709 hg: parse error: incomplete revspec format character
4362 2710 [255]
4363 2711 $ hg log -T '{revset("%d", 'foo')}\n'
4364 2712 hg: parse error: invalid argument for revspec
4365 2713 [255]
4366 2714 $ hg log -T '{revset("%ld", files)}\n'
4367 2715 hg: parse error: invalid argument for revspec
4368 2716 [255]
4369 2717 $ hg log -T '{revset("%ls", 0)}\n'
4370 2718 hg: parse error: invalid argument for revspec
4371 2719 [255]
4372 2720 $ hg log -T '{revset("%b", 'foo')}\n'
4373 2721 hg: parse error: invalid argument for revspec
4374 2722 [255]
4375 2723 $ hg log -T '{revset("%lb", files)}\n'
4376 2724 hg: parse error: invalid argument for revspec
4377 2725 [255]
4378 2726 $ hg log -T '{revset("%r", 0)}\n'
4379 2727 hg: parse error: invalid argument for revspec
4380 2728 [255]
4381 2729
4382 2730 Test 'originalnode'
4383 2731
4384 2732 $ hg log -r 1 -T '{revset("null") % "{node|short} {originalnode|short}"}\n'
4385 2733 000000000000 bcc7ff960b8e
4386 2734 $ hg log -r 0 -T '{manifest % "{node} {originalnode}"}\n'
4387 2735 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 f7769ec2ab975ad19684098ad1ffd9b81ecc71a1
4388 2736
4389 2737 Test files function
4390 2738
4391 2739 $ hg log -T "{rev}\n{join(files('*'), '\n')}\n"
4392 2740 2
4393 2741 a
4394 2742 aa
4395 2743 b
4396 2744 1
4397 2745 a
4398 2746 0
4399 2747 a
4400 2748
4401 2749 $ hg log -T "{rev}\n{join(files('aa'), '\n')}\n"
4402 2750 2
4403 2751 aa
4404 2752 1
4405 2753
4406 2754 0
4407 2755
4408 2756 $ hg rm a
4409 2757 $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n"
4410 2758 2147483647
4411 2759 aa
4412 2760 b
4413 2761 $ hg revert a
4414 2762
4415 2763 Test relpath function
4416 2764
4417 2765 $ hg log -r0 -T '{files % "{file|relpath}\n"}'
4418 2766 a
4419 2767 $ cd ..
4420 2768 $ hg log -R r -r0 -T '{files % "{file|relpath}\n"}'
4421 2769 r/a
4422 2770 $ cd r
4423 2771
4424 2772 Test active bookmark templating
4425 2773
4426 2774 $ hg book foo
4427 2775 $ hg book bar
4428 2776 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
4429 2777 2 bar* foo
4430 2778 1
4431 2779 0
4432 2780 $ hg log --template "{rev} {activebookmark}\n"
4433 2781 2 bar
4434 2782 1
4435 2783 0
4436 2784 $ hg bookmarks --inactive bar
4437 2785 $ hg log --template "{rev} {activebookmark}\n"
4438 2786 2
4439 2787 1
4440 2788 0
4441 2789 $ hg book -r1 baz
4442 2790 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
4443 2791 2 bar foo
4444 2792 1 baz
4445 2793 0
4446 2794 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
4447 2795 2 t
4448 2796 1 f
4449 2797 0 f
4450 2798
4451 2799 Test namespaces dict
4452 2800
4453 2801 $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n'
4454 2802 2
4455 2803 bookmarks color=bookmark builtin=True
4456 2804 bar,foo
4457 2805 tags color=tag builtin=True
4458 2806 tip
4459 2807 branches color=branch builtin=True
4460 2808 text.{rev}
4461 2809 revnames color=revname builtin=False
4462 2810 r2
4463 2811
4464 2812 1
4465 2813 bookmarks color=bookmark builtin=True
4466 2814 baz
4467 2815 tags color=tag builtin=True
4468 2816
4469 2817 branches color=branch builtin=True
4470 2818 text.{rev}
4471 2819 revnames color=revname builtin=False
4472 2820 r1
4473 2821
4474 2822 0
4475 2823 bookmarks color=bookmark builtin=True
4476 2824
4477 2825 tags color=tag builtin=True
4478 2826
4479 2827 branches color=branch builtin=True
4480 2828 default
4481 2829 revnames color=revname builtin=False
4482 2830 r0
4483 2831
4484 2832 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
4485 2833 bookmarks: bar foo
4486 2834 tags: tip
4487 2835 branches: text.{rev}
4488 2836 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
4489 2837 bookmarks:
4490 2838 bar
4491 2839 foo
4492 2840 tags:
4493 2841 tip
4494 2842 branches:
4495 2843 text.{rev}
4496 2844 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
4497 2845 bar
4498 2846 foo
4499 2847 $ hg log -r2 -T '{namespaces.bookmarks % "{bookmark}\n"}'
4500 2848 bar
4501 2849 foo
4502 2850
4503 2851 Test stringify on sub expressions
4504 2852
4505 2853 $ cd ..
4506 2854 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
4507 2855 fourth, second, third
4508 2856 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
4509 2857 abc
4510 2858
4511 2859 Test splitlines
4512 2860
4513 2861 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
4514 2862 @ foo Modify, add, remove, rename
4515 2863 |
4516 2864 o foo future
4517 2865 |
4518 2866 o foo third
4519 2867 |
4520 2868 o foo second
4521 2869
4522 2870 o foo merge
4523 2871 |\
4524 2872 | o foo new head
4525 2873 | |
4526 2874 o | foo new branch
4527 2875 |/
4528 2876 o foo no user, no domain
4529 2877 |
4530 2878 o foo no person
4531 2879 |
4532 2880 o foo other 1
4533 2881 | foo other 2
4534 2882 | foo
4535 2883 | foo other 3
4536 2884 o foo line 1
4537 2885 foo line 2
4538 2886
4539 2887 $ hg log -R a -r0 -T '{desc|splitlines}\n'
4540 2888 line 1 line 2
4541 2889 $ hg log -R a -r0 -T '{join(desc|splitlines, "|")}\n'
4542 2890 line 1|line 2
4543 2891
4544 2892 Test startswith
4545 2893 $ hg log -Gv -R a --template "{startswith(desc)}"
4546 2894 hg: parse error: startswith expects two arguments
4547 2895 [255]
4548 2896
4549 2897 $ hg log -Gv -R a --template "{startswith('line', desc)}"
4550 2898 @
4551 2899 |
4552 2900 o
4553 2901 |
4554 2902 o
4555 2903 |
4556 2904 o
4557 2905
4558 2906 o
4559 2907 |\
4560 2908 | o
4561 2909 | |
4562 2910 o |
4563 2911 |/
4564 2912 o
4565 2913 |
4566 2914 o
4567 2915 |
4568 2916 o
4569 2917 |
4570 2918 o line 1
4571 2919 line 2
4572 2920
4573 2921 Test bad template with better error message
4574 2922
4575 2923 $ hg log -Gv -R a --template '{desc|user()}'
4576 2924 hg: parse error: expected a symbol, got 'func'
4577 2925 [255]
4578 2926
4579 2927 Test word function (including index out of bounds graceful failure)
4580 2928
4581 2929 $ hg log -Gv -R a --template "{word('1', desc)}"
4582 2930 @ add,
4583 2931 |
4584 2932 o
4585 2933 |
4586 2934 o
4587 2935 |
4588 2936 o
4589 2937
4590 2938 o
4591 2939 |\
4592 2940 | o head
4593 2941 | |
4594 2942 o | branch
4595 2943 |/
4596 2944 o user,
4597 2945 |
4598 2946 o person
4599 2947 |
4600 2948 o 1
4601 2949 |
4602 2950 o 1
4603 2951
4604 2952
4605 2953 Test word third parameter used as splitter
4606 2954
4607 2955 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
4608 2956 @ M
4609 2957 |
4610 2958 o future
4611 2959 |
4612 2960 o third
4613 2961 |
4614 2962 o sec
4615 2963
4616 2964 o merge
4617 2965 |\
4618 2966 | o new head
4619 2967 | |
4620 2968 o | new branch
4621 2969 |/
4622 2970 o n
4623 2971 |
4624 2972 o n
4625 2973 |
4626 2974 o
4627 2975 |
4628 2976 o line 1
4629 2977 line 2
4630 2978
4631 2979 Test word error messages for not enough and too many arguments
4632 2980
4633 2981 $ hg log -Gv -R a --template "{word('0')}"
4634 2982 hg: parse error: word expects two or three arguments, got 1
4635 2983 [255]
4636 2984
4637 2985 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
4638 2986 hg: parse error: word expects two or three arguments, got 7
4639 2987 [255]
4640 2988
4641 2989 Test word for integer literal
4642 2990
4643 2991 $ hg log -R a --template "{word(2, desc)}\n" -r0
4644 2992 line
4645 2993
4646 2994 Test word for invalid numbers
4647 2995
4648 2996 $ hg log -Gv -R a --template "{word('a', desc)}"
4649 2997 hg: parse error: word expects an integer index
4650 2998 [255]
4651 2999
4652 3000 Test word for out of range
4653 3001
4654 3002 $ hg log -R a --template "{word(10000, desc)}"
4655 3003 $ hg log -R a --template "{word(-10000, desc)}"
4656 3004
4657 3005 Test indent and not adding to empty lines
4658 3006
4659 3007 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
4660 3008 -----
4661 3009 > line 1
4662 3010 >> line 2
4663 3011 -----
4664 3012 > other 1
4665 3013 >> other 2
4666 3014
4667 3015 >> other 3
4668 3016
4669 3017 Test with non-strings like dates
4670 3018
4671 3019 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
4672 3020 1200000.00
4673 3021 1300000.00
4674 3022
4675 3023 Test broken string escapes:
4676 3024
4677 3025 $ hg log -T "bogus\\" -R a
4678 3026 hg: parse error: trailing \ in string
4679 3027 [255]
4680 3028 $ hg log -T "\\xy" -R a
4681 3029 hg: parse error: invalid \x escape* (glob)
4682 3030 [255]
4683 3031
4684 3032 json filter should escape HTML tags so that the output can be embedded in hgweb:
4685 3033
4686 3034 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
4687 3035 "\u003cfoo@example.org\u003e"
4688 3036
4689 3037 Templater supports aliases of symbol and func() styles:
4690 3038
4691 3039 $ hg clone -q a aliases
4692 3040 $ cd aliases
4693 3041 $ cat <<EOF >> .hg/hgrc
4694 3042 > [templatealias]
4695 3043 > r = rev
4696 3044 > rn = "{r}:{node|short}"
4697 3045 > status(c, files) = files % "{c} {file}\n"
4698 3046 > utcdate(d) = localdate(d, "UTC")
4699 3047 > EOF
4700 3048
4701 3049 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
4702 3050 (template
4703 3051 (symbol 'rn')
4704 3052 (string ' ')
4705 3053 (|
4706 3054 (func
4707 3055 (symbol 'utcdate')
4708 3056 (symbol 'date'))
4709 3057 (symbol 'isodate'))
4710 3058 (string '\n'))
4711 3059 * expanded:
4712 3060 (template
4713 3061 (template
4714 3062 (symbol 'rev')
4715 3063 (string ':')
4716 3064 (|
4717 3065 (symbol 'node')
4718 3066 (symbol 'short')))
4719 3067 (string ' ')
4720 3068 (|
4721 3069 (func
4722 3070 (symbol 'localdate')
4723 3071 (list
4724 3072 (symbol 'date')
4725 3073 (string 'UTC')))
4726 3074 (symbol 'isodate'))
4727 3075 (string '\n'))
4728 3076 * keywords: date, node, rev
4729 3077 * functions: isodate, localdate, short
4730 3078 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4731 3079
4732 3080 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
4733 3081 (template
4734 3082 (func
4735 3083 (symbol 'status')
4736 3084 (list
4737 3085 (string 'A')
4738 3086 (symbol 'file_adds'))))
4739 3087 * expanded:
4740 3088 (template
4741 3089 (%
4742 3090 (symbol 'file_adds')
4743 3091 (template
4744 3092 (string 'A')
4745 3093 (string ' ')
4746 3094 (symbol 'file')
4747 3095 (string '\n'))))
4748 3096 * keywords: file, file_adds
4749 3097 * functions:
4750 3098 A a
4751 3099
4752 3100 A unary function alias can be called as a filter:
4753 3101
4754 3102 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
4755 3103 (template
4756 3104 (|
4757 3105 (|
4758 3106 (symbol 'date')
4759 3107 (symbol 'utcdate'))
4760 3108 (symbol 'isodate'))
4761 3109 (string '\n'))
4762 3110 * expanded:
4763 3111 (template
4764 3112 (|
4765 3113 (func
4766 3114 (symbol 'localdate')
4767 3115 (list
4768 3116 (symbol 'date')
4769 3117 (string 'UTC')))
4770 3118 (symbol 'isodate'))
4771 3119 (string '\n'))
4772 3120 * keywords: date
4773 3121 * functions: isodate, localdate
4774 3122 1970-01-12 13:46 +0000
4775 3123
4776 3124 Aliases should be applied only to command arguments and templates in hgrc.
4777 3125 Otherwise, our stock styles and web templates could be corrupted:
4778 3126
4779 3127 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
4780 3128 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4781 3129
4782 3130 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
4783 3131 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4784 3132
4785 3133 $ cat <<EOF > tmpl
4786 3134 > changeset = 'nothing expanded:{rn}\n'
4787 3135 > EOF
4788 3136 $ hg log -r0 --style ./tmpl
4789 3137 nothing expanded:
4790 3138
4791 3139 Aliases in formatter:
4792 3140
4793 3141 $ hg branches -T '{pad(branch, 7)} {rn}\n'
4794 3142 default 6:d41e714fe50d
4795 3143 foo 4:bbe44766e73d
4796 3144
4797 3145 Aliases should honor HGPLAIN:
4798 3146
4799 3147 $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n'
4800 3148 nothing expanded:
4801 3149 $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n'
4802 3150 0:1e4e1b8f71e0
4803 3151
4804 3152 Unparsable alias:
4805 3153
4806 3154 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
4807 3155 (template
4808 3156 (symbol 'bad'))
4809 3157 abort: bad definition of template alias "bad": at 2: not a prefix: end
4810 3158 [255]
4811 3159 $ hg log --config templatealias.bad='x(' -T '{bad}'
4812 3160 abort: bad definition of template alias "bad": at 2: not a prefix: end
4813 3161 [255]
4814 3162
4815 3163 $ cd ..
4816 3164
4817 3165 Set up repository for non-ascii encoding tests:
4818 3166
4819 3167 $ hg init nonascii
4820 3168 $ cd nonascii
4821 3169 $ $PYTHON <<EOF
4822 3170 > open('latin1', 'wb').write(b'\xe9')
4823 3171 > open('utf-8', 'wb').write(b'\xc3\xa9')
4824 3172 > EOF
4825 3173 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
4826 3174 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
4827 3175
4828 3176 json filter should try round-trip conversion to utf-8:
4829 3177
4830 3178 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
4831 3179 "\u00e9"
4832 3180 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
4833 3181 "non-ascii branch: \u00e9"
4834 3182
4835 3183 json filter should take input as utf-8 if it was converted from utf-8:
4836 3184
4837 3185 $ HGENCODING=latin-1 hg log -T "{branch|json}\n" -r0
4838 3186 "\u00e9"
4839 3187 $ HGENCODING=latin-1 hg log -T "{desc|json}\n" -r0
4840 3188 "non-ascii branch: \u00e9"
4841 3189
4842 3190 json filter takes input as utf-8b:
4843 3191
4844 3192 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
4845 3193 "\u00e9"
4846 3194 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
4847 3195 "\udce9"
4848 3196
4849 3197 utf8 filter:
4850 3198
4851 3199 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
4852 3200 round-trip: c3a9
4853 3201 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
4854 3202 decoded: c3a9
4855 3203 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
4856 3204 abort: decoding near * (glob)
4857 3205 [255]
4858 3206 $ hg log -T "coerced to string: {rev|utf8}\n" -r0
4859 3207 coerced to string: 0
4860 3208
4861 3209 pad width:
4862 3210
4863 3211 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n"
4864 3212 \xc3\xa9- (esc)
4865 3213
4866 3214 $ cd ..
4867 3215
4868 3216 Test that template function in extension is registered as expected
4869 3217
4870 3218 $ cd a
4871 3219
4872 3220 $ cat <<EOF > $TESTTMP/customfunc.py
4873 3221 > from mercurial import registrar
4874 3222 >
4875 3223 > templatefunc = registrar.templatefunc()
4876 3224 >
4877 3225 > @templatefunc(b'custom()')
4878 3226 > def custom(context, mapping, args):
4879 3227 > return b'custom'
4880 3228 > EOF
4881 3229 $ cat <<EOF > .hg/hgrc
4882 3230 > [extensions]
4883 3231 > customfunc = $TESTTMP/customfunc.py
4884 3232 > EOF
4885 3233
4886 3234 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
4887 3235 custom
4888 3236
4889 3237 $ cd ..
4890 3238
4891 3239 Test 'graphwidth' in 'hg log' on various topologies. The key here is that the
4892 3240 printed graphwidths 3, 5, 7, etc. should all line up in their respective
4893 3241 columns. We don't care about other aspects of the graph rendering here.
4894 3242
4895 3243 $ hg init graphwidth
4896 3244 $ cd graphwidth
4897 3245
4898 3246 $ wrappabletext="a a a a a a a a a a a a"
4899 3247
4900 3248 $ printf "first\n" > file
4901 3249 $ hg add file
4902 3250 $ hg commit -m "$wrappabletext"
4903 3251
4904 3252 $ printf "first\nsecond\n" > file
4905 3253 $ hg commit -m "$wrappabletext"
4906 3254
4907 3255 $ hg checkout 0
4908 3256 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4909 3257 $ printf "third\nfirst\n" > file
4910 3258 $ hg commit -m "$wrappabletext"
4911 3259 created new head
4912 3260
4913 3261 $ hg merge
4914 3262 merging file
4915 3263 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
4916 3264 (branch merge, don't forget to commit)
4917 3265
4918 3266 $ hg log --graph -T "{graphwidth}"
4919 3267 @ 3
4920 3268 |
4921 3269 | @ 5
4922 3270 |/
4923 3271 o 3
4924 3272
4925 3273 $ hg commit -m "$wrappabletext"
4926 3274
4927 3275 $ hg log --graph -T "{graphwidth}"
4928 3276 @ 5
4929 3277 |\
4930 3278 | o 5
4931 3279 | |
4932 3280 o | 5
4933 3281 |/
4934 3282 o 3
4935 3283
4936 3284
4937 3285 $ hg checkout 0
4938 3286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4939 3287 $ printf "third\nfirst\nsecond\n" > file
4940 3288 $ hg commit -m "$wrappabletext"
4941 3289 created new head
4942 3290
4943 3291 $ hg log --graph -T "{graphwidth}"
4944 3292 @ 3
4945 3293 |
4946 3294 | o 7
4947 3295 | |\
4948 3296 +---o 7
4949 3297 | |
4950 3298 | o 5
4951 3299 |/
4952 3300 o 3
4953 3301
4954 3302
4955 3303 $ hg log --graph -T "{graphwidth}" -r 3
4956 3304 o 5
4957 3305 |\
4958 3306 ~ ~
4959 3307
4960 3308 $ hg log --graph -T "{graphwidth}" -r 1
4961 3309 o 3
4962 3310 |
4963 3311 ~
4964 3312
4965 3313 $ hg merge
4966 3314 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4967 3315 (branch merge, don't forget to commit)
4968 3316 $ hg commit -m "$wrappabletext"
4969 3317
4970 3318 $ printf "seventh\n" >> file
4971 3319 $ hg commit -m "$wrappabletext"
4972 3320
4973 3321 $ hg log --graph -T "{graphwidth}"
4974 3322 @ 3
4975 3323 |
4976 3324 o 5
4977 3325 |\
4978 3326 | o 5
4979 3327 | |
4980 3328 o | 7
4981 3329 |\ \
4982 3330 | o | 7
4983 3331 | |/
4984 3332 o / 5
4985 3333 |/
4986 3334 o 3
4987 3335
4988 3336
4989 3337 The point of graphwidth is to allow wrapping that accounts for the space taken
4990 3338 by the graph.
4991 3339
4992 3340 $ COLUMNS=10 hg log --graph -T "{fill(desc, termwidth - graphwidth)}"
4993 3341 @ a a a a
4994 3342 | a a a a
4995 3343 | a a a a
4996 3344 o a a a
4997 3345 |\ a a a
4998 3346 | | a a a
4999 3347 | | a a a
5000 3348 | o a a a
5001 3349 | | a a a
5002 3350 | | a a a
5003 3351 | | a a a
5004 3352 o | a a
5005 3353 |\ \ a a
5006 3354 | | | a a
5007 3355 | | | a a
5008 3356 | | | a a
5009 3357 | | | a a
5010 3358 | o | a a
5011 3359 | |/ a a
5012 3360 | | a a
5013 3361 | | a a
5014 3362 | | a a
5015 3363 | | a a
5016 3364 o | a a a
5017 3365 |/ a a a
5018 3366 | a a a
5019 3367 | a a a
5020 3368 o a a a a
5021 3369 a a a a
5022 3370 a a a a
5023 3371
5024 3372 Something tricky happens when there are elided nodes; the next drawn row of
5025 3373 edges can be more than one column wider, but the graph width only increases by
5026 3374 one column. The remaining columns are added in between the nodes.
5027 3375
5028 3376 $ hg log --graph -T "{graphwidth}" -r "0|2|4|5"
5029 3377 o 5
5030 3378 |\
5031 3379 | \
5032 3380 | :\
5033 3381 o : : 7
5034 3382 :/ /
5035 3383 : o 5
5036 3384 :/
5037 3385 o 3
5038 3386
5039 3387
5040 3388 $ cd ..
5041 3389
This diff has been collapsed as it changes many lines, (3289 lines changed) Show them Hide them
@@ -1,5041 +1,1760 b''
1 Test template map files and styles
2 ==================================
3
1 4 $ hg init a
2 5 $ cd a
3 6 $ echo a > a
4 7 $ hg add a
5 8 $ echo line 1 > b
6 9 $ echo line 2 >> b
7 10 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
8 11
9 12 $ hg add b
10 13 $ echo other 1 > c
11 14 $ echo other 2 >> c
12 15 $ echo >> c
13 16 $ echo other 3 >> c
14 17 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
15 18
16 19 $ hg add c
17 20 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 21 $ echo c >> c
19 22 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20 23
21 24 $ echo foo > .hg/branch
22 25 $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
23 26
24 27 $ hg co -q 3
25 28 $ echo other 4 >> d
26 29 $ hg add d
27 30 $ hg commit -m 'new head' -d '1500000 0' -u 'person'
28 31
29 32 $ hg merge -q foo
30 33 $ hg commit -m 'merge' -d '1500001 0' -u 'person'
31 34
32 Test arithmetic operators have the right precedence:
33
34 $ hg log -l 1 -T '{date(date, "%Y") + 5 * 10} {date(date, "%Y") - 2 * 3}\n'
35 2020 1964
36 $ hg log -l 1 -T '{date(date, "%Y") * 5 + 10} {date(date, "%Y") * 3 - 2}\n'
37 9860 5908
38
39 Test division:
40
41 $ hg debugtemplate -r0 -v '{5 / 2} {mod(5, 2)}\n'
42 (template
43 (/
44 (integer '5')
45 (integer '2'))
46 (string ' ')
47 (func
48 (symbol 'mod')
49 (list
50 (integer '5')
51 (integer '2')))
52 (string '\n'))
53 * keywords:
54 * functions: mod
55 2 1
56 $ hg debugtemplate -r0 -v '{5 / -2} {mod(5, -2)}\n'
57 (template
58 (/
59 (integer '5')
60 (negate
61 (integer '2')))
62 (string ' ')
63 (func
64 (symbol 'mod')
65 (list
66 (integer '5')
67 (negate
68 (integer '2'))))
69 (string '\n'))
70 * keywords:
71 * functions: mod
72 -3 -1
73 $ hg debugtemplate -r0 -v '{-5 / 2} {mod(-5, 2)}\n'
74 (template
75 (/
76 (negate
77 (integer '5'))
78 (integer '2'))
79 (string ' ')
80 (func
81 (symbol 'mod')
82 (list
83 (negate
84 (integer '5'))
85 (integer '2')))
86 (string '\n'))
87 * keywords:
88 * functions: mod
89 -3 1
90 $ hg debugtemplate -r0 -v '{-5 / -2} {mod(-5, -2)}\n'
91 (template
92 (/
93 (negate
94 (integer '5'))
95 (negate
96 (integer '2')))
97 (string ' ')
98 (func
99 (symbol 'mod')
100 (list
101 (negate
102 (integer '5'))
103 (negate
104 (integer '2'))))
105 (string '\n'))
106 * keywords:
107 * functions: mod
108 2 -1
109
110 Filters bind closer than arithmetic:
111
112 $ hg debugtemplate -r0 -v '{revset(".")|count - 1}\n'
113 (template
114 (-
115 (|
116 (func
117 (symbol 'revset')
118 (string '.'))
119 (symbol 'count'))
120 (integer '1'))
121 (string '\n'))
122 * keywords:
123 * functions: count, revset
124 0
125
126 But negate binds closer still:
127
128 $ hg debugtemplate -r0 -v '{1-3|stringify}\n'
129 (template
130 (-
131 (integer '1')
132 (|
133 (integer '3')
134 (symbol 'stringify')))
135 (string '\n'))
136 * keywords:
137 * functions: stringify
138 hg: parse error: arithmetic only defined on integers
139 [255]
140 $ hg debugtemplate -r0 -v '{-3|stringify}\n'
141 (template
142 (|
143 (negate
144 (integer '3'))
145 (symbol 'stringify'))
146 (string '\n'))
147 * keywords:
148 * functions: stringify
149 -3
150
151 Filters bind as close as map operator:
152
153 $ hg debugtemplate -r0 -v '{desc|splitlines % "{line}\n"}'
154 (template
155 (%
156 (|
157 (symbol 'desc')
158 (symbol 'splitlines'))
159 (template
160 (symbol 'line')
161 (string '\n'))))
162 * keywords: desc, line
163 * functions: splitlines
164 line 1
165 line 2
166
167 Keyword arguments:
168
169 $ hg debugtemplate -r0 -v '{foo=bar|baz}'
170 (template
171 (keyvalue
172 (symbol 'foo')
173 (|
174 (symbol 'bar')
175 (symbol 'baz'))))
176 * keywords: bar, foo
177 * functions: baz
178 hg: parse error: can't use a key-value pair in this context
179 [255]
180
181 $ hg debugtemplate '{pad("foo", width=10, left=true)}\n'
182 foo
183
184 Call function which takes named arguments by filter syntax:
185
186 $ hg debugtemplate '{" "|separate}'
187 $ hg debugtemplate '{("not", "an", "argument", "list")|separate}'
188 hg: parse error: unknown method 'list'
189 [255]
190
191 35 Second branch starting at nullrev:
192 36
193 37 $ hg update null
194 38 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
195 39 $ echo second > second
196 40 $ hg add second
197 41 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
198 42 created new head
199 43
200 44 $ echo third > third
201 45 $ hg add third
202 46 $ hg mv second fourth
203 47 $ hg commit -m third -d "2020-01-01 10:01"
204 48
205 $ hg log --template '{join(file_copies, ",\n")}\n' -r .
206 fourth (second)
207 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
208 second -> fourth
209 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
210 8 t
211 7 f
212
213 Working-directory revision has special identifiers, though they are still
214 experimental:
215
216 $ hg log -r 'wdir()' -T '{rev}:{node}\n'
217 2147483647:ffffffffffffffffffffffffffffffffffffffff
218
219 Some keywords are invalid for working-directory revision, but they should
220 never cause crash:
221
222 $ hg log -r 'wdir()' -T '{manifest}\n'
223
224
225 Internal resources shouldn't be exposed (issue5699):
226
227 $ hg log -r. -T '{cache}{ctx}{repo}{revcache}{templ}{ui}'
228
229 Never crash on internal resource not available:
230
231 $ hg --cwd .. debugtemplate '{"c0bebeef"|shortest}\n'
232 abort: template resource not available: repo
233 [255]
234
235 $ hg config -T '{author}'
236
237 Quoting for ui.logtemplate
238
239 $ hg tip --config "ui.logtemplate={rev}\n"
240 8
241 $ hg tip --config "ui.logtemplate='{rev}\n'"
242 8
243 $ hg tip --config 'ui.logtemplate="{rev}\n"'
244 8
245 $ hg tip --config 'ui.logtemplate=n{rev}\n'
246 n8
247
248 49 Make sure user/global hgrc does not affect tests
249 50
250 51 $ echo '[ui]' > .hg/hgrc
251 52 $ echo 'logtemplate =' >> .hg/hgrc
252 53 $ echo 'style =' >> .hg/hgrc
253 54
254 55 Add some simple styles to settings
255 56
256 57 $ cat <<'EOF' >> .hg/hgrc
257 58 > [templates]
258 59 > simple = "{rev}\n"
259 60 > simple2 = {rev}\n
260 61 > rev = "should not precede {rev} keyword\n"
261 62 > EOF
262 63
263 64 $ hg log -l1 -Tsimple
264 65 8
265 66 $ hg log -l1 -Tsimple2
266 67 8
267 68 $ hg log -l1 -Trev
268 69 should not precede 8 keyword
269 70 $ hg log -l1 -T '{simple}'
270 71 8
271 72
272 73 Map file shouldn't see user templates:
273 74
274 75 $ cat <<EOF > tmpl
275 76 > changeset = 'nothing expanded:{simple}\n'
276 77 > EOF
277 78 $ hg log -l1 --style ./tmpl
278 79 nothing expanded:
279 80
280 81 Test templates and style maps in files:
281 82
282 83 $ echo "{rev}" > tmpl
283 84 $ hg log -l1 -T./tmpl
284 85 8
285 86 $ hg log -l1 -Tblah/blah
286 87 blah/blah (no-eol)
287 88
288 89 $ printf 'changeset = "{rev}\\n"\n' > map-simple
289 90 $ hg log -l1 -T./map-simple
290 91 8
291 92
292 93 a map file may have [templates] and [templatealias] sections:
293 94
294 95 $ cat <<'EOF' > map-simple
295 96 > [templates]
296 97 > changeset = "{a}\n"
297 98 > [templatealias]
298 99 > a = rev
299 100 > EOF
300 101 $ hg log -l1 -T./map-simple
301 102 8
302 103
303 104 so it can be included in hgrc
304 105
305 106 $ cat <<EOF > myhgrc
306 107 > %include $HGRCPATH
307 108 > %include map-simple
308 109 > [templates]
309 110 > foo = "{changeset}"
310 111 > EOF
311 112 $ HGRCPATH=./myhgrc hg log -l1 -Tfoo
312 113 8
313 114 $ HGRCPATH=./myhgrc hg log -l1 -T'{a}\n'
314 115 8
315 116
316 117 Test template map inheritance
317 118
318 119 $ echo "__base__ = map-cmdline.default" > map-simple
319 120 $ printf 'cset = "changeset: ***{rev}***\\n"\n' >> map-simple
320 121 $ hg log -l1 -T./map-simple
321 122 changeset: ***8***
322 123 tag: tip
323 124 user: test
324 125 date: Wed Jan 01 10:01:00 2020 +0000
325 126 summary: third
326 127
327 128
328 129 Test docheader, docfooter and separator in template map
329 130
330 131 $ cat <<'EOF' > map-myjson
331 132 > docheader = '\{\n'
332 133 > docfooter = '\n}\n'
333 134 > separator = ',\n'
334 135 > changeset = ' {dict(rev, node|short)|json}'
335 136 > EOF
336 137 $ hg log -l2 -T./map-myjson
337 138 {
338 139 {"node": "95c24699272e", "rev": 8},
339 140 {"node": "29114dbae42b", "rev": 7}
340 141 }
341 142
342 143 Test docheader, docfooter and separator in [templates] section
343 144
344 145 $ cat <<'EOF' >> .hg/hgrc
345 146 > [templates]
346 147 > myjson = ' {dict(rev, node|short)|json}'
347 148 > myjson:docheader = '\{\n'
348 149 > myjson:docfooter = '\n}\n'
349 150 > myjson:separator = ',\n'
350 151 > :docheader = 'should not be selected as a docheader for literal templates\n'
351 152 > EOF
352 153 $ hg log -l2 -Tmyjson
353 154 {
354 155 {"node": "95c24699272e", "rev": 8},
355 156 {"node": "29114dbae42b", "rev": 7}
356 157 }
357 158 $ hg log -l1 -T'{rev}\n'
358 159 8
359 160
360 161 Template should precede style option
361 162
362 163 $ hg log -l1 --style default -T '{rev}\n'
363 164 8
364 165
365 166 Add a commit with empty description, to ensure that the templates
366 167 below will omit the description line.
367 168
368 169 $ echo c >> c
369 170 $ hg add c
370 171 $ hg commit -qm ' '
371 172
372 173 Default style is like normal output. Phases style should be the same
373 174 as default style, except for extra phase lines.
374 175
375 176 $ hg log > log.out
376 177 $ hg log --style default > style.out
377 178 $ cmp log.out style.out || diff -u log.out style.out
378 179 $ hg log -T phases > phases.out
379 180 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
380 181 +phase: draft
381 182 +phase: draft
382 183 +phase: draft
383 184 +phase: draft
384 185 +phase: draft
385 186 +phase: draft
386 187 +phase: draft
387 188 +phase: draft
388 189 +phase: draft
389 190 +phase: draft
390 191
391 192 $ hg log -v > log.out
392 193 $ hg log -v --style default > style.out
393 194 $ cmp log.out style.out || diff -u log.out style.out
394 195 $ hg log -v -T phases > phases.out
395 196 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
396 197 +phase: draft
397 198 +phase: draft
398 199 +phase: draft
399 200 +phase: draft
400 201 +phase: draft
401 202 +phase: draft
402 203 +phase: draft
403 204 +phase: draft
404 205 +phase: draft
405 206 +phase: draft
406 207
407 208 $ hg log -q > log.out
408 209 $ hg log -q --style default > style.out
409 210 $ cmp log.out style.out || diff -u log.out style.out
410 211 $ hg log -q -T phases > phases.out
411 212 $ cmp log.out phases.out || diff -u log.out phases.out
412 213
413 214 $ hg log --debug > log.out
414 215 $ hg log --debug --style default > style.out
415 216 $ cmp log.out style.out || diff -u log.out style.out
416 217 $ hg log --debug -T phases > phases.out
417 218 $ cmp log.out phases.out || diff -u log.out phases.out
418 219
419 220 Default style of working-directory revision should also be the same (but
420 221 date may change while running tests):
421 222
422 223 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
423 224 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
424 225 $ cmp log.out style.out || diff -u log.out style.out
425 226
426 227 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
427 228 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
428 229 $ cmp log.out style.out || diff -u log.out style.out
429 230
430 231 $ hg log -r 'wdir()' -q > log.out
431 232 $ hg log -r 'wdir()' -q --style default > style.out
432 233 $ cmp log.out style.out || diff -u log.out style.out
433 234
434 235 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
435 236 $ hg log -r 'wdir()' --debug --style default \
436 237 > | sed 's|^date:.*|date:|' > style.out
437 238 $ cmp log.out style.out || diff -u log.out style.out
438 239
439 240 Default style should also preserve color information (issue2866):
440 241
441 242 $ cp $HGRCPATH $HGRCPATH-bak
442 243 $ cat <<EOF >> $HGRCPATH
443 244 > [extensions]
444 245 > color=
445 246 > EOF
446 247
447 248 $ hg --color=debug log > log.out
448 249 $ hg --color=debug log --style default > style.out
449 250 $ cmp log.out style.out || diff -u log.out style.out
450 251 $ hg --color=debug log -T phases > phases.out
451 252 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
452 253 +[log.phase|phase: draft]
453 254 +[log.phase|phase: draft]
454 255 +[log.phase|phase: draft]
455 256 +[log.phase|phase: draft]
456 257 +[log.phase|phase: draft]
457 258 +[log.phase|phase: draft]
458 259 +[log.phase|phase: draft]
459 260 +[log.phase|phase: draft]
460 261 +[log.phase|phase: draft]
461 262 +[log.phase|phase: draft]
462 263
463 264 $ hg --color=debug -v log > log.out
464 265 $ hg --color=debug -v log --style default > style.out
465 266 $ cmp log.out style.out || diff -u log.out style.out
466 267 $ hg --color=debug -v log -T phases > phases.out
467 268 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
468 269 +[log.phase|phase: draft]
469 270 +[log.phase|phase: draft]
470 271 +[log.phase|phase: draft]
471 272 +[log.phase|phase: draft]
472 273 +[log.phase|phase: draft]
473 274 +[log.phase|phase: draft]
474 275 +[log.phase|phase: draft]
475 276 +[log.phase|phase: draft]
476 277 +[log.phase|phase: draft]
477 278 +[log.phase|phase: draft]
478 279
479 280 $ hg --color=debug -q log > log.out
480 281 $ hg --color=debug -q log --style default > style.out
481 282 $ cmp log.out style.out || diff -u log.out style.out
482 283 $ hg --color=debug -q log -T phases > phases.out
483 284 $ cmp log.out phases.out || diff -u log.out phases.out
484 285
485 286 $ hg --color=debug --debug log > log.out
486 287 $ hg --color=debug --debug log --style default > style.out
487 288 $ cmp log.out style.out || diff -u log.out style.out
488 289 $ hg --color=debug --debug log -T phases > phases.out
489 290 $ cmp log.out phases.out || diff -u log.out phases.out
490 291
491 292 $ mv $HGRCPATH-bak $HGRCPATH
492 293
493 294 Remove commit with empty commit message, so as to not pollute further
494 295 tests.
495 296
496 297 $ hg --config extensions.strip= strip -q .
497 298
498 299 Revision with no copies (used to print a traceback):
499 300
500 301 $ hg tip -v --template '\n'
501 302
502 303
503 304 Compact style works:
504 305
505 306 $ hg log -Tcompact
506 307 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
507 308 third
508 309
509 310 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
510 311 second
511 312
512 313 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
513 314 merge
514 315
515 316 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
516 317 new head
517 318
518 319 4 bbe44766e73d 1970-01-17 04:53 +0000 person
519 320 new branch
520 321
521 322 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
522 323 no user, no domain
523 324
524 325 2 97054abb4ab8 1970-01-14 21:20 +0000 other
525 326 no person
526 327
527 328 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
528 329 other 1
529 330
530 331 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
531 332 line 1
532 333
533 334
534 335 $ hg log -v --style compact
535 336 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
536 337 third
537 338
538 339 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
539 340 second
540 341
541 342 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
542 343 merge
543 344
544 345 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
545 346 new head
546 347
547 348 4 bbe44766e73d 1970-01-17 04:53 +0000 person
548 349 new branch
549 350
550 351 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
551 352 no user, no domain
552 353
553 354 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
554 355 no person
555 356
556 357 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
557 358 other 1
558 359 other 2
559 360
560 361 other 3
561 362
562 363 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
563 364 line 1
564 365 line 2
565 366
566 367
567 368 $ hg log --debug --style compact
568 369 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
569 370 third
570 371
571 372 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
572 373 second
573 374
574 375 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
575 376 merge
576 377
577 378 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
578 379 new head
579 380
580 381 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
581 382 new branch
582 383
583 384 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
584 385 no user, no domain
585 386
586 387 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
587 388 no person
588 389
589 390 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
590 391 other 1
591 392 other 2
592 393
593 394 other 3
594 395
595 396 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
596 397 line 1
597 398 line 2
598 399
599 400
600 401 Test xml styles:
601 402
602 403 $ hg log --style xml -r 'not all()'
603 404 <?xml version="1.0"?>
604 405 <log>
605 406 </log>
606 407
607 408 $ hg log --style xml
608 409 <?xml version="1.0"?>
609 410 <log>
610 411 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
611 412 <tag>tip</tag>
612 413 <author email="test">test</author>
613 414 <date>2020-01-01T10:01:00+00:00</date>
614 415 <msg xml:space="preserve">third</msg>
615 416 </logentry>
616 417 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
617 418 <parent revision="-1" node="0000000000000000000000000000000000000000" />
618 419 <author email="user@hostname">User Name</author>
619 420 <date>1970-01-12T13:46:40+00:00</date>
620 421 <msg xml:space="preserve">second</msg>
621 422 </logentry>
622 423 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
623 424 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
624 425 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
625 426 <author email="person">person</author>
626 427 <date>1970-01-18T08:40:01+00:00</date>
627 428 <msg xml:space="preserve">merge</msg>
628 429 </logentry>
629 430 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
630 431 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
631 432 <author email="person">person</author>
632 433 <date>1970-01-18T08:40:00+00:00</date>
633 434 <msg xml:space="preserve">new head</msg>
634 435 </logentry>
635 436 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
636 437 <branch>foo</branch>
637 438 <author email="person">person</author>
638 439 <date>1970-01-17T04:53:20+00:00</date>
639 440 <msg xml:space="preserve">new branch</msg>
640 441 </logentry>
641 442 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
642 443 <author email="person">person</author>
643 444 <date>1970-01-16T01:06:40+00:00</date>
644 445 <msg xml:space="preserve">no user, no domain</msg>
645 446 </logentry>
646 447 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
647 448 <author email="other@place">other</author>
648 449 <date>1970-01-14T21:20:00+00:00</date>
649 450 <msg xml:space="preserve">no person</msg>
650 451 </logentry>
651 452 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
652 453 <author email="other@place">A. N. Other</author>
653 454 <date>1970-01-13T17:33:20+00:00</date>
654 455 <msg xml:space="preserve">other 1
655 456 other 2
656 457
657 458 other 3</msg>
658 459 </logentry>
659 460 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
660 461 <author email="user@hostname">User Name</author>
661 462 <date>1970-01-12T13:46:40+00:00</date>
662 463 <msg xml:space="preserve">line 1
663 464 line 2</msg>
664 465 </logentry>
665 466 </log>
666 467
667 468 $ hg log -v --style xml
668 469 <?xml version="1.0"?>
669 470 <log>
670 471 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
671 472 <tag>tip</tag>
672 473 <author email="test">test</author>
673 474 <date>2020-01-01T10:01:00+00:00</date>
674 475 <msg xml:space="preserve">third</msg>
675 476 <paths>
676 477 <path action="A">fourth</path>
677 478 <path action="A">third</path>
678 479 <path action="R">second</path>
679 480 </paths>
680 481 <copies>
681 482 <copy source="second">fourth</copy>
682 483 </copies>
683 484 </logentry>
684 485 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
685 486 <parent revision="-1" node="0000000000000000000000000000000000000000" />
686 487 <author email="user@hostname">User Name</author>
687 488 <date>1970-01-12T13:46:40+00:00</date>
688 489 <msg xml:space="preserve">second</msg>
689 490 <paths>
690 491 <path action="A">second</path>
691 492 </paths>
692 493 </logentry>
693 494 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
694 495 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
695 496 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
696 497 <author email="person">person</author>
697 498 <date>1970-01-18T08:40:01+00:00</date>
698 499 <msg xml:space="preserve">merge</msg>
699 500 <paths>
700 501 </paths>
701 502 </logentry>
702 503 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
703 504 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
704 505 <author email="person">person</author>
705 506 <date>1970-01-18T08:40:00+00:00</date>
706 507 <msg xml:space="preserve">new head</msg>
707 508 <paths>
708 509 <path action="A">d</path>
709 510 </paths>
710 511 </logentry>
711 512 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
712 513 <branch>foo</branch>
713 514 <author email="person">person</author>
714 515 <date>1970-01-17T04:53:20+00:00</date>
715 516 <msg xml:space="preserve">new branch</msg>
716 517 <paths>
717 518 </paths>
718 519 </logentry>
719 520 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
720 521 <author email="person">person</author>
721 522 <date>1970-01-16T01:06:40+00:00</date>
722 523 <msg xml:space="preserve">no user, no domain</msg>
723 524 <paths>
724 525 <path action="M">c</path>
725 526 </paths>
726 527 </logentry>
727 528 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
728 529 <author email="other@place">other</author>
729 530 <date>1970-01-14T21:20:00+00:00</date>
730 531 <msg xml:space="preserve">no person</msg>
731 532 <paths>
732 533 <path action="A">c</path>
733 534 </paths>
734 535 </logentry>
735 536 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
736 537 <author email="other@place">A. N. Other</author>
737 538 <date>1970-01-13T17:33:20+00:00</date>
738 539 <msg xml:space="preserve">other 1
739 540 other 2
740 541
741 542 other 3</msg>
742 543 <paths>
743 544 <path action="A">b</path>
744 545 </paths>
745 546 </logentry>
746 547 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
747 548 <author email="user@hostname">User Name</author>
748 549 <date>1970-01-12T13:46:40+00:00</date>
749 550 <msg xml:space="preserve">line 1
750 551 line 2</msg>
751 552 <paths>
752 553 <path action="A">a</path>
753 554 </paths>
754 555 </logentry>
755 556 </log>
756 557
757 558 $ hg log --debug --style xml
758 559 <?xml version="1.0"?>
759 560 <log>
760 561 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
761 562 <tag>tip</tag>
762 563 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
763 564 <parent revision="-1" node="0000000000000000000000000000000000000000" />
764 565 <author email="test">test</author>
765 566 <date>2020-01-01T10:01:00+00:00</date>
766 567 <msg xml:space="preserve">third</msg>
767 568 <paths>
768 569 <path action="A">fourth</path>
769 570 <path action="A">third</path>
770 571 <path action="R">second</path>
771 572 </paths>
772 573 <copies>
773 574 <copy source="second">fourth</copy>
774 575 </copies>
775 576 <extra key="branch">default</extra>
776 577 </logentry>
777 578 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
778 579 <parent revision="-1" node="0000000000000000000000000000000000000000" />
779 580 <parent revision="-1" node="0000000000000000000000000000000000000000" />
780 581 <author email="user@hostname">User Name</author>
781 582 <date>1970-01-12T13:46:40+00:00</date>
782 583 <msg xml:space="preserve">second</msg>
783 584 <paths>
784 585 <path action="A">second</path>
785 586 </paths>
786 587 <extra key="branch">default</extra>
787 588 </logentry>
788 589 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
789 590 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
790 591 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
791 592 <author email="person">person</author>
792 593 <date>1970-01-18T08:40:01+00:00</date>
793 594 <msg xml:space="preserve">merge</msg>
794 595 <paths>
795 596 </paths>
796 597 <extra key="branch">default</extra>
797 598 </logentry>
798 599 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
799 600 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
800 601 <parent revision="-1" node="0000000000000000000000000000000000000000" />
801 602 <author email="person">person</author>
802 603 <date>1970-01-18T08:40:00+00:00</date>
803 604 <msg xml:space="preserve">new head</msg>
804 605 <paths>
805 606 <path action="A">d</path>
806 607 </paths>
807 608 <extra key="branch">default</extra>
808 609 </logentry>
809 610 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
810 611 <branch>foo</branch>
811 612 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
812 613 <parent revision="-1" node="0000000000000000000000000000000000000000" />
813 614 <author email="person">person</author>
814 615 <date>1970-01-17T04:53:20+00:00</date>
815 616 <msg xml:space="preserve">new branch</msg>
816 617 <paths>
817 618 </paths>
818 619 <extra key="branch">foo</extra>
819 620 </logentry>
820 621 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
821 622 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
822 623 <parent revision="-1" node="0000000000000000000000000000000000000000" />
823 624 <author email="person">person</author>
824 625 <date>1970-01-16T01:06:40+00:00</date>
825 626 <msg xml:space="preserve">no user, no domain</msg>
826 627 <paths>
827 628 <path action="M">c</path>
828 629 </paths>
829 630 <extra key="branch">default</extra>
830 631 </logentry>
831 632 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
832 633 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
833 634 <parent revision="-1" node="0000000000000000000000000000000000000000" />
834 635 <author email="other@place">other</author>
835 636 <date>1970-01-14T21:20:00+00:00</date>
836 637 <msg xml:space="preserve">no person</msg>
837 638 <paths>
838 639 <path action="A">c</path>
839 640 </paths>
840 641 <extra key="branch">default</extra>
841 642 </logentry>
842 643 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
843 644 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
844 645 <parent revision="-1" node="0000000000000000000000000000000000000000" />
845 646 <author email="other@place">A. N. Other</author>
846 647 <date>1970-01-13T17:33:20+00:00</date>
847 648 <msg xml:space="preserve">other 1
848 649 other 2
849 650
850 651 other 3</msg>
851 652 <paths>
852 653 <path action="A">b</path>
853 654 </paths>
854 655 <extra key="branch">default</extra>
855 656 </logentry>
856 657 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
857 658 <parent revision="-1" node="0000000000000000000000000000000000000000" />
858 659 <parent revision="-1" node="0000000000000000000000000000000000000000" />
859 660 <author email="user@hostname">User Name</author>
860 661 <date>1970-01-12T13:46:40+00:00</date>
861 662 <msg xml:space="preserve">line 1
862 663 line 2</msg>
863 664 <paths>
864 665 <path action="A">a</path>
865 666 </paths>
866 667 <extra key="branch">default</extra>
867 668 </logentry>
868 669 </log>
869 670
870 671
871 672 Test JSON style:
872 673
873 674 $ hg log -k nosuch -Tjson
874 675 [
875 676 ]
876 677
877 678 $ hg log -qr . -Tjson
878 679 [
879 680 {
880 681 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
881 682 "rev": 8
882 683 }
883 684 ]
884 685
885 686 $ hg log -vpr . -Tjson --stat
886 687 [
887 688 {
888 689 "bookmarks": [],
889 690 "branch": "default",
890 691 "date": [1577872860, 0],
891 692 "desc": "third",
892 693 "diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n",
893 694 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
894 695 "files": ["fourth", "second", "third"],
895 696 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
896 697 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
897 698 "phase": "draft",
898 699 "rev": 8,
899 700 "tags": ["tip"],
900 701 "user": "test"
901 702 }
902 703 ]
903 704
904 705 honor --git but not format-breaking diffopts
905 706 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
906 707 [
907 708 {
908 709 "bookmarks": [],
909 710 "branch": "default",
910 711 "date": [1577872860, 0],
911 712 "desc": "third",
912 713 "diff": "diff --git a/second b/fourth\nrename from second\nrename to fourth\ndiff --git a/third b/third\nnew file mode 100644\n--- /dev/null\n+++ b/third\n@@ -0,0 +1,1 @@\n+third\n",
913 714 "files": ["fourth", "second", "third"],
914 715 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
915 716 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
916 717 "phase": "draft",
917 718 "rev": 8,
918 719 "tags": ["tip"],
919 720 "user": "test"
920 721 }
921 722 ]
922 723
923 724 $ hg log -T json
924 725 [
925 726 {
926 727 "bookmarks": [],
927 728 "branch": "default",
928 729 "date": [1577872860, 0],
929 730 "desc": "third",
930 731 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
931 732 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
932 733 "phase": "draft",
933 734 "rev": 8,
934 735 "tags": ["tip"],
935 736 "user": "test"
936 737 },
937 738 {
938 739 "bookmarks": [],
939 740 "branch": "default",
940 741 "date": [1000000, 0],
941 742 "desc": "second",
942 743 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
943 744 "parents": ["0000000000000000000000000000000000000000"],
944 745 "phase": "draft",
945 746 "rev": 7,
946 747 "tags": [],
947 748 "user": "User Name <user@hostname>"
948 749 },
949 750 {
950 751 "bookmarks": [],
951 752 "branch": "default",
952 753 "date": [1500001, 0],
953 754 "desc": "merge",
954 755 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
955 756 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
956 757 "phase": "draft",
957 758 "rev": 6,
958 759 "tags": [],
959 760 "user": "person"
960 761 },
961 762 {
962 763 "bookmarks": [],
963 764 "branch": "default",
964 765 "date": [1500000, 0],
965 766 "desc": "new head",
966 767 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
967 768 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
968 769 "phase": "draft",
969 770 "rev": 5,
970 771 "tags": [],
971 772 "user": "person"
972 773 },
973 774 {
974 775 "bookmarks": [],
975 776 "branch": "foo",
976 777 "date": [1400000, 0],
977 778 "desc": "new branch",
978 779 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
979 780 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
980 781 "phase": "draft",
981 782 "rev": 4,
982 783 "tags": [],
983 784 "user": "person"
984 785 },
985 786 {
986 787 "bookmarks": [],
987 788 "branch": "default",
988 789 "date": [1300000, 0],
989 790 "desc": "no user, no domain",
990 791 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
991 792 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
992 793 "phase": "draft",
993 794 "rev": 3,
994 795 "tags": [],
995 796 "user": "person"
996 797 },
997 798 {
998 799 "bookmarks": [],
999 800 "branch": "default",
1000 801 "date": [1200000, 0],
1001 802 "desc": "no person",
1002 803 "node": "97054abb4ab824450e9164180baf491ae0078465",
1003 804 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1004 805 "phase": "draft",
1005 806 "rev": 2,
1006 807 "tags": [],
1007 808 "user": "other@place"
1008 809 },
1009 810 {
1010 811 "bookmarks": [],
1011 812 "branch": "default",
1012 813 "date": [1100000, 0],
1013 814 "desc": "other 1\nother 2\n\nother 3",
1014 815 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1015 816 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1016 817 "phase": "draft",
1017 818 "rev": 1,
1018 819 "tags": [],
1019 820 "user": "A. N. Other <other@place>"
1020 821 },
1021 822 {
1022 823 "bookmarks": [],
1023 824 "branch": "default",
1024 825 "date": [1000000, 0],
1025 826 "desc": "line 1\nline 2",
1026 827 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1027 828 "parents": ["0000000000000000000000000000000000000000"],
1028 829 "phase": "draft",
1029 830 "rev": 0,
1030 831 "tags": [],
1031 832 "user": "User Name <user@hostname>"
1032 833 }
1033 834 ]
1034 835
1035 836 $ hg heads -v -Tjson
1036 837 [
1037 838 {
1038 839 "bookmarks": [],
1039 840 "branch": "default",
1040 841 "date": [1577872860, 0],
1041 842 "desc": "third",
1042 843 "files": ["fourth", "second", "third"],
1043 844 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1044 845 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1045 846 "phase": "draft",
1046 847 "rev": 8,
1047 848 "tags": ["tip"],
1048 849 "user": "test"
1049 850 },
1050 851 {
1051 852 "bookmarks": [],
1052 853 "branch": "default",
1053 854 "date": [1500001, 0],
1054 855 "desc": "merge",
1055 856 "files": [],
1056 857 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1057 858 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1058 859 "phase": "draft",
1059 860 "rev": 6,
1060 861 "tags": [],
1061 862 "user": "person"
1062 863 },
1063 864 {
1064 865 "bookmarks": [],
1065 866 "branch": "foo",
1066 867 "date": [1400000, 0],
1067 868 "desc": "new branch",
1068 869 "files": [],
1069 870 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1070 871 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1071 872 "phase": "draft",
1072 873 "rev": 4,
1073 874 "tags": [],
1074 875 "user": "person"
1075 876 }
1076 877 ]
1077 878
1078 879 $ hg log --debug -Tjson
1079 880 [
1080 881 {
1081 882 "added": ["fourth", "third"],
1082 883 "bookmarks": [],
1083 884 "branch": "default",
1084 885 "date": [1577872860, 0],
1085 886 "desc": "third",
1086 887 "extra": {"branch": "default"},
1087 888 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
1088 889 "modified": [],
1089 890 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1090 891 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1091 892 "phase": "draft",
1092 893 "removed": ["second"],
1093 894 "rev": 8,
1094 895 "tags": ["tip"],
1095 896 "user": "test"
1096 897 },
1097 898 {
1098 899 "added": ["second"],
1099 900 "bookmarks": [],
1100 901 "branch": "default",
1101 902 "date": [1000000, 0],
1102 903 "desc": "second",
1103 904 "extra": {"branch": "default"},
1104 905 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
1105 906 "modified": [],
1106 907 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
1107 908 "parents": ["0000000000000000000000000000000000000000"],
1108 909 "phase": "draft",
1109 910 "removed": [],
1110 911 "rev": 7,
1111 912 "tags": [],
1112 913 "user": "User Name <user@hostname>"
1113 914 },
1114 915 {
1115 916 "added": [],
1116 917 "bookmarks": [],
1117 918 "branch": "default",
1118 919 "date": [1500001, 0],
1119 920 "desc": "merge",
1120 921 "extra": {"branch": "default"},
1121 922 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1122 923 "modified": [],
1123 924 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1124 925 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1125 926 "phase": "draft",
1126 927 "removed": [],
1127 928 "rev": 6,
1128 929 "tags": [],
1129 930 "user": "person"
1130 931 },
1131 932 {
1132 933 "added": ["d"],
1133 934 "bookmarks": [],
1134 935 "branch": "default",
1135 936 "date": [1500000, 0],
1136 937 "desc": "new head",
1137 938 "extra": {"branch": "default"},
1138 939 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1139 940 "modified": [],
1140 941 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
1141 942 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1142 943 "phase": "draft",
1143 944 "removed": [],
1144 945 "rev": 5,
1145 946 "tags": [],
1146 947 "user": "person"
1147 948 },
1148 949 {
1149 950 "added": [],
1150 951 "bookmarks": [],
1151 952 "branch": "foo",
1152 953 "date": [1400000, 0],
1153 954 "desc": "new branch",
1154 955 "extra": {"branch": "foo"},
1155 956 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1156 957 "modified": [],
1157 958 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1158 959 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1159 960 "phase": "draft",
1160 961 "removed": [],
1161 962 "rev": 4,
1162 963 "tags": [],
1163 964 "user": "person"
1164 965 },
1165 966 {
1166 967 "added": [],
1167 968 "bookmarks": [],
1168 969 "branch": "default",
1169 970 "date": [1300000, 0],
1170 971 "desc": "no user, no domain",
1171 972 "extra": {"branch": "default"},
1172 973 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1173 974 "modified": ["c"],
1174 975 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
1175 976 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
1176 977 "phase": "draft",
1177 978 "removed": [],
1178 979 "rev": 3,
1179 980 "tags": [],
1180 981 "user": "person"
1181 982 },
1182 983 {
1183 984 "added": ["c"],
1184 985 "bookmarks": [],
1185 986 "branch": "default",
1186 987 "date": [1200000, 0],
1187 988 "desc": "no person",
1188 989 "extra": {"branch": "default"},
1189 990 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
1190 991 "modified": [],
1191 992 "node": "97054abb4ab824450e9164180baf491ae0078465",
1192 993 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1193 994 "phase": "draft",
1194 995 "removed": [],
1195 996 "rev": 2,
1196 997 "tags": [],
1197 998 "user": "other@place"
1198 999 },
1199 1000 {
1200 1001 "added": ["b"],
1201 1002 "bookmarks": [],
1202 1003 "branch": "default",
1203 1004 "date": [1100000, 0],
1204 1005 "desc": "other 1\nother 2\n\nother 3",
1205 1006 "extra": {"branch": "default"},
1206 1007 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
1207 1008 "modified": [],
1208 1009 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1209 1010 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1210 1011 "phase": "draft",
1211 1012 "removed": [],
1212 1013 "rev": 1,
1213 1014 "tags": [],
1214 1015 "user": "A. N. Other <other@place>"
1215 1016 },
1216 1017 {
1217 1018 "added": ["a"],
1218 1019 "bookmarks": [],
1219 1020 "branch": "default",
1220 1021 "date": [1000000, 0],
1221 1022 "desc": "line 1\nline 2",
1222 1023 "extra": {"branch": "default"},
1223 1024 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
1224 1025 "modified": [],
1225 1026 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1226 1027 "parents": ["0000000000000000000000000000000000000000"],
1227 1028 "phase": "draft",
1228 1029 "removed": [],
1229 1030 "rev": 0,
1230 1031 "tags": [],
1231 1032 "user": "User Name <user@hostname>"
1232 1033 }
1233 1034 ]
1234 1035
1235 1036 Error if style not readable:
1236 1037
1237 1038 #if unix-permissions no-root
1238 1039 $ touch q
1239 1040 $ chmod 0 q
1240 1041 $ hg log --style ./q
1241 1042 abort: Permission denied: ./q
1242 1043 [255]
1243 1044 #endif
1244 1045
1245 1046 Error if no style:
1246 1047
1247 1048 $ hg log --style notexist
1248 1049 abort: style 'notexist' not found
1249 1050 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
1250 1051 [255]
1251 1052
1252 1053 $ hg log -T list
1253 1054 available styles: bisect, changelog, compact, default, phases, show, status, xml
1254 1055 abort: specify a template
1255 1056 [255]
1256 1057
1257 1058 Error if style missing key:
1258 1059
1259 1060 $ echo 'q = q' > t
1260 1061 $ hg log --style ./t
1261 1062 abort: "changeset" not in template map
1262 1063 [255]
1263 1064
1264 1065 Error if style missing value:
1265 1066
1266 1067 $ echo 'changeset =' > t
1267 1068 $ hg log --style t
1268 1069 hg: parse error at t:1: missing value
1269 1070 [255]
1270 1071
1271 1072 Error if include fails:
1272 1073
1273 1074 $ echo 'changeset = q' >> t
1274 1075 #if unix-permissions no-root
1275 1076 $ hg log --style ./t
1276 1077 abort: template file ./q: Permission denied
1277 1078 [255]
1278 1079 $ rm -f q
1279 1080 #endif
1280 1081
1281 1082 Include works:
1282 1083
1283 1084 $ echo '{rev}' > q
1284 1085 $ hg log --style ./t
1285 1086 8
1286 1087 7
1287 1088 6
1288 1089 5
1289 1090 4
1290 1091 3
1291 1092 2
1292 1093 1
1293 1094 0
1294 1095
1295 Check that recursive reference does not fall into RuntimeError (issue4758):
1296
1297 common mistake:
1298
1299 $ cat << EOF > issue4758
1300 > changeset = '{changeset}\n'
1301 > EOF
1302 $ hg log --style ./issue4758
1303 abort: recursive reference 'changeset' in template
1304 [255]
1305
1306 circular reference:
1307
1308 $ cat << EOF > issue4758
1309 > changeset = '{foo}'
1310 > foo = '{changeset}'
1311 > EOF
1312 $ hg log --style ./issue4758
1313 abort: recursive reference 'foo' in template
1314 [255]
1315
1316 buildmap() -> gettemplate(), where no thunk was made:
1317
1318 $ cat << EOF > issue4758
1319 > changeset = '{files % changeset}\n'
1320 > EOF
1321 $ hg log --style ./issue4758
1322 abort: recursive reference 'changeset' in template
1323 [255]
1324
1325 not a recursion if a keyword of the same name exists:
1326
1327 $ cat << EOF > issue4758
1328 > changeset = '{tags % rev}'
1329 > rev = '{rev} {tag}\n'
1330 > EOF
1331 $ hg log --style ./issue4758 -r tip
1332 8 tip
1333
1334 Check that {phase} works correctly on parents:
1335
1336 $ cat << EOF > parentphase
1337 > changeset_debug = '{rev} ({phase}):{parents}\n'
1338 > parent = ' {rev} ({phase})'
1339 > EOF
1340 1096 $ hg phase -r 5 --public
1341 1097 $ hg phase -r 7 --secret --force
1342 $ hg log --debug -G --style ./parentphase
1343 @ 8 (secret): 7 (secret) -1 (public)
1344 |
1345 o 7 (secret): -1 (public) -1 (public)
1346
1347 o 6 (draft): 5 (public) 4 (draft)
1348 |\
1349 | o 5 (public): 3 (public) -1 (public)
1350 | |
1351 o | 4 (draft): 3 (public) -1 (public)
1352 |/
1353 o 3 (public): 2 (public) -1 (public)
1354 |
1355 o 2 (public): 1 (public) -1 (public)
1356 |
1357 o 1 (public): 0 (public) -1 (public)
1358 |
1359 o 0 (public): -1 (public) -1 (public)
1360
1361 1098
1362 1099 Missing non-standard names give no error (backward compatibility):
1363 1100
1364 1101 $ echo "changeset = '{c}'" > t
1365 1102 $ hg log --style ./t
1366 1103
1367 1104 Defining non-standard name works:
1368 1105
1369 1106 $ cat <<EOF > t
1370 1107 > changeset = '{c}'
1371 1108 > c = q
1372 1109 > EOF
1373 1110 $ hg log --style ./t
1374 1111 8
1375 1112 7
1376 1113 6
1377 1114 5
1378 1115 4
1379 1116 3
1380 1117 2
1381 1118 1
1382 1119 0
1383 1120
1384 1121 ui.style works:
1385 1122
1386 1123 $ echo '[ui]' > .hg/hgrc
1387 1124 $ echo 'style = t' >> .hg/hgrc
1388 1125 $ hg log
1389 1126 8
1390 1127 7
1391 1128 6
1392 1129 5
1393 1130 4
1394 1131 3
1395 1132 2
1396 1133 1
1397 1134 0
1398 1135
1399
1400 1136 Issue338:
1401 1137
1402 1138 $ hg log --style=changelog > changelog
1403 1139
1404 1140 $ cat changelog
1405 1141 2020-01-01 test <test>
1406 1142
1407 1143 * fourth, second, third:
1408 1144 third
1409 1145 [95c24699272e] [tip]
1410 1146
1411 1147 1970-01-12 User Name <user@hostname>
1412 1148
1413 1149 * second:
1414 1150 second
1415 1151 [29114dbae42b]
1416 1152
1417 1153 1970-01-18 person <person>
1418 1154
1419 1155 * merge
1420 1156 [d41e714fe50d]
1421 1157
1422 1158 * d:
1423 1159 new head
1424 1160 [13207e5a10d9]
1425 1161
1426 1162 1970-01-17 person <person>
1427 1163
1428 1164 * new branch
1429 1165 [bbe44766e73d] <foo>
1430 1166
1431 1167 1970-01-16 person <person>
1432 1168
1433 1169 * c:
1434 1170 no user, no domain
1435 1171 [10e46f2dcbf4]
1436 1172
1437 1173 1970-01-14 other <other@place>
1438 1174
1439 1175 * c:
1440 1176 no person
1441 1177 [97054abb4ab8]
1442 1178
1443 1179 1970-01-13 A. N. Other <other@place>
1444 1180
1445 1181 * b:
1446 1182 other 1 other 2
1447 1183
1448 1184 other 3
1449 1185 [b608e9d1a3f0]
1450 1186
1451 1187 1970-01-12 User Name <user@hostname>
1452 1188
1453 1189 * a:
1454 1190 line 1 line 2
1455 1191 [1e4e1b8f71e0]
1456 1192
1457 1193
1458 1194 Issue2130: xml output for 'hg heads' is malformed
1459 1195
1460 1196 $ hg heads --style changelog
1461 1197 2020-01-01 test <test>
1462 1198
1463 1199 * fourth, second, third:
1464 1200 third
1465 1201 [95c24699272e] [tip]
1466 1202
1467 1203 1970-01-18 person <person>
1468 1204
1469 1205 * merge
1470 1206 [d41e714fe50d]
1471 1207
1472 1208 1970-01-17 person <person>
1473 1209
1474 1210 * new branch
1475 1211 [bbe44766e73d] <foo>
1476 1212
1477 1213
1478 Keys work:
1479
1480 $ for key in author branch branches date desc file_adds file_dels file_mods \
1481 > file_copies file_copies_switch files \
1482 > manifest node parents rev tags diffstat extras \
1483 > p1rev p2rev p1node p2node; do
1484 > for mode in '' --verbose --debug; do
1485 > hg log $mode --template "$key$mode: {$key}\n"
1486 > done
1487 > done
1488 author: test
1489 author: User Name <user@hostname>
1490 author: person
1491 author: person
1492 author: person
1493 author: person
1494 author: other@place
1495 author: A. N. Other <other@place>
1496 author: User Name <user@hostname>
1497 author--verbose: test
1498 author--verbose: User Name <user@hostname>
1499 author--verbose: person
1500 author--verbose: person
1501 author--verbose: person
1502 author--verbose: person
1503 author--verbose: other@place
1504 author--verbose: A. N. Other <other@place>
1505 author--verbose: User Name <user@hostname>
1506 author--debug: test
1507 author--debug: User Name <user@hostname>
1508 author--debug: person
1509 author--debug: person
1510 author--debug: person
1511 author--debug: person
1512 author--debug: other@place
1513 author--debug: A. N. Other <other@place>
1514 author--debug: User Name <user@hostname>
1515 branch: default
1516 branch: default
1517 branch: default
1518 branch: default
1519 branch: foo
1520 branch: default
1521 branch: default
1522 branch: default
1523 branch: default
1524 branch--verbose: default
1525 branch--verbose: default
1526 branch--verbose: default
1527 branch--verbose: default
1528 branch--verbose: foo
1529 branch--verbose: default
1530 branch--verbose: default
1531 branch--verbose: default
1532 branch--verbose: default
1533 branch--debug: default
1534 branch--debug: default
1535 branch--debug: default
1536 branch--debug: default
1537 branch--debug: foo
1538 branch--debug: default
1539 branch--debug: default
1540 branch--debug: default
1541 branch--debug: default
1542 branches:
1543 branches:
1544 branches:
1545 branches:
1546 branches: foo
1547 branches:
1548 branches:
1549 branches:
1550 branches:
1551 branches--verbose:
1552 branches--verbose:
1553 branches--verbose:
1554 branches--verbose:
1555 branches--verbose: foo
1556 branches--verbose:
1557 branches--verbose:
1558 branches--verbose:
1559 branches--verbose:
1560 branches--debug:
1561 branches--debug:
1562 branches--debug:
1563 branches--debug:
1564 branches--debug: foo
1565 branches--debug:
1566 branches--debug:
1567 branches--debug:
1568 branches--debug:
1569 date: 1577872860.00
1570 date: 1000000.00
1571 date: 1500001.00
1572 date: 1500000.00
1573 date: 1400000.00
1574 date: 1300000.00
1575 date: 1200000.00
1576 date: 1100000.00
1577 date: 1000000.00
1578 date--verbose: 1577872860.00
1579 date--verbose: 1000000.00
1580 date--verbose: 1500001.00
1581 date--verbose: 1500000.00
1582 date--verbose: 1400000.00
1583 date--verbose: 1300000.00
1584 date--verbose: 1200000.00
1585 date--verbose: 1100000.00
1586 date--verbose: 1000000.00
1587 date--debug: 1577872860.00
1588 date--debug: 1000000.00
1589 date--debug: 1500001.00
1590 date--debug: 1500000.00
1591 date--debug: 1400000.00
1592 date--debug: 1300000.00
1593 date--debug: 1200000.00
1594 date--debug: 1100000.00
1595 date--debug: 1000000.00
1596 desc: third
1597 desc: second
1598 desc: merge
1599 desc: new head
1600 desc: new branch
1601 desc: no user, no domain
1602 desc: no person
1603 desc: other 1
1604 other 2
1605
1606 other 3
1607 desc: line 1
1608 line 2
1609 desc--verbose: third
1610 desc--verbose: second
1611 desc--verbose: merge
1612 desc--verbose: new head
1613 desc--verbose: new branch
1614 desc--verbose: no user, no domain
1615 desc--verbose: no person
1616 desc--verbose: other 1
1617 other 2
1618
1619 other 3
1620 desc--verbose: line 1
1621 line 2
1622 desc--debug: third
1623 desc--debug: second
1624 desc--debug: merge
1625 desc--debug: new head
1626 desc--debug: new branch
1627 desc--debug: no user, no domain
1628 desc--debug: no person
1629 desc--debug: other 1
1630 other 2
1631
1632 other 3
1633 desc--debug: line 1
1634 line 2
1635 file_adds: fourth third
1636 file_adds: second
1637 file_adds:
1638 file_adds: d
1639 file_adds:
1640 file_adds:
1641 file_adds: c
1642 file_adds: b
1643 file_adds: a
1644 file_adds--verbose: fourth third
1645 file_adds--verbose: second
1646 file_adds--verbose:
1647 file_adds--verbose: d
1648 file_adds--verbose:
1649 file_adds--verbose:
1650 file_adds--verbose: c
1651 file_adds--verbose: b
1652 file_adds--verbose: a
1653 file_adds--debug: fourth third
1654 file_adds--debug: second
1655 file_adds--debug:
1656 file_adds--debug: d
1657 file_adds--debug:
1658 file_adds--debug:
1659 file_adds--debug: c
1660 file_adds--debug: b
1661 file_adds--debug: a
1662 file_dels: second
1663 file_dels:
1664 file_dels:
1665 file_dels:
1666 file_dels:
1667 file_dels:
1668 file_dels:
1669 file_dels:
1670 file_dels:
1671 file_dels--verbose: second
1672 file_dels--verbose:
1673 file_dels--verbose:
1674 file_dels--verbose:
1675 file_dels--verbose:
1676 file_dels--verbose:
1677 file_dels--verbose:
1678 file_dels--verbose:
1679 file_dels--verbose:
1680 file_dels--debug: second
1681 file_dels--debug:
1682 file_dels--debug:
1683 file_dels--debug:
1684 file_dels--debug:
1685 file_dels--debug:
1686 file_dels--debug:
1687 file_dels--debug:
1688 file_dels--debug:
1689 file_mods:
1690 file_mods:
1691 file_mods:
1692 file_mods:
1693 file_mods:
1694 file_mods: c
1695 file_mods:
1696 file_mods:
1697 file_mods:
1698 file_mods--verbose:
1699 file_mods--verbose:
1700 file_mods--verbose:
1701 file_mods--verbose:
1702 file_mods--verbose:
1703 file_mods--verbose: c
1704 file_mods--verbose:
1705 file_mods--verbose:
1706 file_mods--verbose:
1707 file_mods--debug:
1708 file_mods--debug:
1709 file_mods--debug:
1710 file_mods--debug:
1711 file_mods--debug:
1712 file_mods--debug: c
1713 file_mods--debug:
1714 file_mods--debug:
1715 file_mods--debug:
1716 file_copies: fourth (second)
1717 file_copies:
1718 file_copies:
1719 file_copies:
1720 file_copies:
1721 file_copies:
1722 file_copies:
1723 file_copies:
1724 file_copies:
1725 file_copies--verbose: fourth (second)
1726 file_copies--verbose:
1727 file_copies--verbose:
1728 file_copies--verbose:
1729 file_copies--verbose:
1730 file_copies--verbose:
1731 file_copies--verbose:
1732 file_copies--verbose:
1733 file_copies--verbose:
1734 file_copies--debug: fourth (second)
1735 file_copies--debug:
1736 file_copies--debug:
1737 file_copies--debug:
1738 file_copies--debug:
1739 file_copies--debug:
1740 file_copies--debug:
1741 file_copies--debug:
1742 file_copies--debug:
1743 file_copies_switch:
1744 file_copies_switch:
1745 file_copies_switch:
1746 file_copies_switch:
1747 file_copies_switch:
1748 file_copies_switch:
1749 file_copies_switch:
1750 file_copies_switch:
1751 file_copies_switch:
1752 file_copies_switch--verbose:
1753 file_copies_switch--verbose:
1754 file_copies_switch--verbose:
1755 file_copies_switch--verbose:
1756 file_copies_switch--verbose:
1757 file_copies_switch--verbose:
1758 file_copies_switch--verbose:
1759 file_copies_switch--verbose:
1760 file_copies_switch--verbose:
1761 file_copies_switch--debug:
1762 file_copies_switch--debug:
1763 file_copies_switch--debug:
1764 file_copies_switch--debug:
1765 file_copies_switch--debug:
1766 file_copies_switch--debug:
1767 file_copies_switch--debug:
1768 file_copies_switch--debug:
1769 file_copies_switch--debug:
1770 files: fourth second third
1771 files: second
1772 files:
1773 files: d
1774 files:
1775 files: c
1776 files: c
1777 files: b
1778 files: a
1779 files--verbose: fourth second third
1780 files--verbose: second
1781 files--verbose:
1782 files--verbose: d
1783 files--verbose:
1784 files--verbose: c
1785 files--verbose: c
1786 files--verbose: b
1787 files--verbose: a
1788 files--debug: fourth second third
1789 files--debug: second
1790 files--debug:
1791 files--debug: d
1792 files--debug:
1793 files--debug: c
1794 files--debug: c
1795 files--debug: b
1796 files--debug: a
1797 manifest: 6:94961b75a2da
1798 manifest: 5:f2dbc354b94e
1799 manifest: 4:4dc3def4f9b4
1800 manifest: 4:4dc3def4f9b4
1801 manifest: 3:cb5a1327723b
1802 manifest: 3:cb5a1327723b
1803 manifest: 2:6e0e82995c35
1804 manifest: 1:4e8d705b1e53
1805 manifest: 0:a0c8bcbbb45c
1806 manifest--verbose: 6:94961b75a2da
1807 manifest--verbose: 5:f2dbc354b94e
1808 manifest--verbose: 4:4dc3def4f9b4
1809 manifest--verbose: 4:4dc3def4f9b4
1810 manifest--verbose: 3:cb5a1327723b
1811 manifest--verbose: 3:cb5a1327723b
1812 manifest--verbose: 2:6e0e82995c35
1813 manifest--verbose: 1:4e8d705b1e53
1814 manifest--verbose: 0:a0c8bcbbb45c
1815 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1816 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1817 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1818 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1819 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1820 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1821 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1822 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1823 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1824 node: 95c24699272ef57d062b8bccc32c878bf841784a
1825 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1826 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1827 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1828 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1829 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1830 node: 97054abb4ab824450e9164180baf491ae0078465
1831 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1832 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1833 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1834 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1835 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1836 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1837 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1838 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1839 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1840 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1841 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1842 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1843 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1844 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1845 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1846 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1847 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1848 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1849 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1850 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1851 parents:
1852 parents: -1:000000000000
1853 parents: 5:13207e5a10d9 4:bbe44766e73d
1854 parents: 3:10e46f2dcbf4
1855 parents:
1856 parents:
1857 parents:
1858 parents:
1859 parents:
1860 parents--verbose:
1861 parents--verbose: -1:000000000000
1862 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1863 parents--verbose: 3:10e46f2dcbf4
1864 parents--verbose:
1865 parents--verbose:
1866 parents--verbose:
1867 parents--verbose:
1868 parents--verbose:
1869 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1870 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1871 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1872 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1873 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1874 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1875 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1876 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1877 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1878 rev: 8
1879 rev: 7
1880 rev: 6
1881 rev: 5
1882 rev: 4
1883 rev: 3
1884 rev: 2
1885 rev: 1
1886 rev: 0
1887 rev--verbose: 8
1888 rev--verbose: 7
1889 rev--verbose: 6
1890 rev--verbose: 5
1891 rev--verbose: 4
1892 rev--verbose: 3
1893 rev--verbose: 2
1894 rev--verbose: 1
1895 rev--verbose: 0
1896 rev--debug: 8
1897 rev--debug: 7
1898 rev--debug: 6
1899 rev--debug: 5
1900 rev--debug: 4
1901 rev--debug: 3
1902 rev--debug: 2
1903 rev--debug: 1
1904 rev--debug: 0
1905 tags: tip
1906 tags:
1907 tags:
1908 tags:
1909 tags:
1910 tags:
1911 tags:
1912 tags:
1913 tags:
1914 tags--verbose: tip
1915 tags--verbose:
1916 tags--verbose:
1917 tags--verbose:
1918 tags--verbose:
1919 tags--verbose:
1920 tags--verbose:
1921 tags--verbose:
1922 tags--verbose:
1923 tags--debug: tip
1924 tags--debug:
1925 tags--debug:
1926 tags--debug:
1927 tags--debug:
1928 tags--debug:
1929 tags--debug:
1930 tags--debug:
1931 tags--debug:
1932 diffstat: 3: +2/-1
1933 diffstat: 1: +1/-0
1934 diffstat: 0: +0/-0
1935 diffstat: 1: +1/-0
1936 diffstat: 0: +0/-0
1937 diffstat: 1: +1/-0
1938 diffstat: 1: +4/-0
1939 diffstat: 1: +2/-0
1940 diffstat: 1: +1/-0
1941 diffstat--verbose: 3: +2/-1
1942 diffstat--verbose: 1: +1/-0
1943 diffstat--verbose: 0: +0/-0
1944 diffstat--verbose: 1: +1/-0
1945 diffstat--verbose: 0: +0/-0
1946 diffstat--verbose: 1: +1/-0
1947 diffstat--verbose: 1: +4/-0
1948 diffstat--verbose: 1: +2/-0
1949 diffstat--verbose: 1: +1/-0
1950 diffstat--debug: 3: +2/-1
1951 diffstat--debug: 1: +1/-0
1952 diffstat--debug: 0: +0/-0
1953 diffstat--debug: 1: +1/-0
1954 diffstat--debug: 0: +0/-0
1955 diffstat--debug: 1: +1/-0
1956 diffstat--debug: 1: +4/-0
1957 diffstat--debug: 1: +2/-0
1958 diffstat--debug: 1: +1/-0
1959 extras: branch=default
1960 extras: branch=default
1961 extras: branch=default
1962 extras: branch=default
1963 extras: branch=foo
1964 extras: branch=default
1965 extras: branch=default
1966 extras: branch=default
1967 extras: branch=default
1968 extras--verbose: branch=default
1969 extras--verbose: branch=default
1970 extras--verbose: branch=default
1971 extras--verbose: branch=default
1972 extras--verbose: branch=foo
1973 extras--verbose: branch=default
1974 extras--verbose: branch=default
1975 extras--verbose: branch=default
1976 extras--verbose: branch=default
1977 extras--debug: branch=default
1978 extras--debug: branch=default
1979 extras--debug: branch=default
1980 extras--debug: branch=default
1981 extras--debug: branch=foo
1982 extras--debug: branch=default
1983 extras--debug: branch=default
1984 extras--debug: branch=default
1985 extras--debug: branch=default
1986 p1rev: 7
1987 p1rev: -1
1988 p1rev: 5
1989 p1rev: 3
1990 p1rev: 3
1991 p1rev: 2
1992 p1rev: 1
1993 p1rev: 0
1994 p1rev: -1
1995 p1rev--verbose: 7
1996 p1rev--verbose: -1
1997 p1rev--verbose: 5
1998 p1rev--verbose: 3
1999 p1rev--verbose: 3
2000 p1rev--verbose: 2
2001 p1rev--verbose: 1
2002 p1rev--verbose: 0
2003 p1rev--verbose: -1
2004 p1rev--debug: 7
2005 p1rev--debug: -1
2006 p1rev--debug: 5
2007 p1rev--debug: 3
2008 p1rev--debug: 3
2009 p1rev--debug: 2
2010 p1rev--debug: 1
2011 p1rev--debug: 0
2012 p1rev--debug: -1
2013 p2rev: -1
2014 p2rev: -1
2015 p2rev: 4
2016 p2rev: -1
2017 p2rev: -1
2018 p2rev: -1
2019 p2rev: -1
2020 p2rev: -1
2021 p2rev: -1
2022 p2rev--verbose: -1
2023 p2rev--verbose: -1
2024 p2rev--verbose: 4
2025 p2rev--verbose: -1
2026 p2rev--verbose: -1
2027 p2rev--verbose: -1
2028 p2rev--verbose: -1
2029 p2rev--verbose: -1
2030 p2rev--verbose: -1
2031 p2rev--debug: -1
2032 p2rev--debug: -1
2033 p2rev--debug: 4
2034 p2rev--debug: -1
2035 p2rev--debug: -1
2036 p2rev--debug: -1
2037 p2rev--debug: -1
2038 p2rev--debug: -1
2039 p2rev--debug: -1
2040 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2041 p1node: 0000000000000000000000000000000000000000
2042 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
2043 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2044 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2045 p1node: 97054abb4ab824450e9164180baf491ae0078465
2046 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2047 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
2048 p1node: 0000000000000000000000000000000000000000
2049 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2050 p1node--verbose: 0000000000000000000000000000000000000000
2051 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
2052 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2053 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2054 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
2055 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2056 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
2057 p1node--verbose: 0000000000000000000000000000000000000000
2058 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2059 p1node--debug: 0000000000000000000000000000000000000000
2060 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
2061 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2062 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2063 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
2064 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2065 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
2066 p1node--debug: 0000000000000000000000000000000000000000
2067 p2node: 0000000000000000000000000000000000000000
2068 p2node: 0000000000000000000000000000000000000000
2069 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2070 p2node: 0000000000000000000000000000000000000000
2071 p2node: 0000000000000000000000000000000000000000
2072 p2node: 0000000000000000000000000000000000000000
2073 p2node: 0000000000000000000000000000000000000000
2074 p2node: 0000000000000000000000000000000000000000
2075 p2node: 0000000000000000000000000000000000000000
2076 p2node--verbose: 0000000000000000000000000000000000000000
2077 p2node--verbose: 0000000000000000000000000000000000000000
2078 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2079 p2node--verbose: 0000000000000000000000000000000000000000
2080 p2node--verbose: 0000000000000000000000000000000000000000
2081 p2node--verbose: 0000000000000000000000000000000000000000
2082 p2node--verbose: 0000000000000000000000000000000000000000
2083 p2node--verbose: 0000000000000000000000000000000000000000
2084 p2node--verbose: 0000000000000000000000000000000000000000
2085 p2node--debug: 0000000000000000000000000000000000000000
2086 p2node--debug: 0000000000000000000000000000000000000000
2087 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2088 p2node--debug: 0000000000000000000000000000000000000000
2089 p2node--debug: 0000000000000000000000000000000000000000
2090 p2node--debug: 0000000000000000000000000000000000000000
2091 p2node--debug: 0000000000000000000000000000000000000000
2092 p2node--debug: 0000000000000000000000000000000000000000
2093 p2node--debug: 0000000000000000000000000000000000000000
2094
2095 Filters work:
2096
2097 $ hg log --template '{author|domain}\n'
2098
2099 hostname
2100
2101
2102
2103
2104 place
2105 place
2106 hostname
2107
2108 $ hg log --template '{author|person}\n'
2109 test
2110 User Name
2111 person
2112 person
2113 person
2114 person
2115 other
2116 A. N. Other
2117 User Name
2118
2119 $ hg log --template '{author|user}\n'
2120 test
2121 user
2122 person
2123 person
2124 person
2125 person
2126 other
2127 other
2128 user
2129
2130 $ hg log --template '{date|date}\n'
2131 Wed Jan 01 10:01:00 2020 +0000
2132 Mon Jan 12 13:46:40 1970 +0000
2133 Sun Jan 18 08:40:01 1970 +0000
2134 Sun Jan 18 08:40:00 1970 +0000
2135 Sat Jan 17 04:53:20 1970 +0000
2136 Fri Jan 16 01:06:40 1970 +0000
2137 Wed Jan 14 21:20:00 1970 +0000
2138 Tue Jan 13 17:33:20 1970 +0000
2139 Mon Jan 12 13:46:40 1970 +0000
2140
2141 $ hg log --template '{date|isodate}\n'
2142 2020-01-01 10:01 +0000
2143 1970-01-12 13:46 +0000
2144 1970-01-18 08:40 +0000
2145 1970-01-18 08:40 +0000
2146 1970-01-17 04:53 +0000
2147 1970-01-16 01:06 +0000
2148 1970-01-14 21:20 +0000
2149 1970-01-13 17:33 +0000
2150 1970-01-12 13:46 +0000
2151
2152 $ hg log --template '{date|isodatesec}\n'
2153 2020-01-01 10:01:00 +0000
2154 1970-01-12 13:46:40 +0000
2155 1970-01-18 08:40:01 +0000
2156 1970-01-18 08:40:00 +0000
2157 1970-01-17 04:53:20 +0000
2158 1970-01-16 01:06:40 +0000
2159 1970-01-14 21:20:00 +0000
2160 1970-01-13 17:33:20 +0000
2161 1970-01-12 13:46:40 +0000
2162
2163 $ hg log --template '{date|rfc822date}\n'
2164 Wed, 01 Jan 2020 10:01:00 +0000
2165 Mon, 12 Jan 1970 13:46:40 +0000
2166 Sun, 18 Jan 1970 08:40:01 +0000
2167 Sun, 18 Jan 1970 08:40:00 +0000
2168 Sat, 17 Jan 1970 04:53:20 +0000
2169 Fri, 16 Jan 1970 01:06:40 +0000
2170 Wed, 14 Jan 1970 21:20:00 +0000
2171 Tue, 13 Jan 1970 17:33:20 +0000
2172 Mon, 12 Jan 1970 13:46:40 +0000
2173
2174 $ hg log --template '{desc|firstline}\n'
2175 third
2176 second
2177 merge
2178 new head
2179 new branch
2180 no user, no domain
2181 no person
2182 other 1
2183 line 1
2184
2185 $ hg log --template '{node|short}\n'
2186 95c24699272e
2187 29114dbae42b
2188 d41e714fe50d
2189 13207e5a10d9
2190 bbe44766e73d
2191 10e46f2dcbf4
2192 97054abb4ab8
2193 b608e9d1a3f0
2194 1e4e1b8f71e0
2195
2196 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
2197 <changeset author="test"/>
2198 <changeset author="User Name &lt;user@hostname&gt;"/>
2199 <changeset author="person"/>
2200 <changeset author="person"/>
2201 <changeset author="person"/>
2202 <changeset author="person"/>
2203 <changeset author="other@place"/>
2204 <changeset author="A. N. Other &lt;other@place&gt;"/>
2205 <changeset author="User Name &lt;user@hostname&gt;"/>
2206
2207 $ hg log --template '{rev}: {children}\n'
2208 8:
2209 7: 8:95c24699272e
2210 6:
2211 5: 6:d41e714fe50d
2212 4: 6:d41e714fe50d
2213 3: 4:bbe44766e73d 5:13207e5a10d9
2214 2: 3:10e46f2dcbf4
2215 1: 2:97054abb4ab8
2216 0: 1:b608e9d1a3f0
2217
2218 Formatnode filter works:
2219
2220 $ hg -q log -r 0 --template '{node|formatnode}\n'
2221 1e4e1b8f71e0
2222
2223 $ hg log -r 0 --template '{node|formatnode}\n'
2224 1e4e1b8f71e0
2225
2226 $ hg -v log -r 0 --template '{node|formatnode}\n'
2227 1e4e1b8f71e0
2228
2229 $ hg --debug log -r 0 --template '{node|formatnode}\n'
2230 1e4e1b8f71e05681d422154f5421e385fec3454f
2231
2232 Age filter:
2233
2234 $ hg init unstable-hash
2235 $ cd unstable-hash
2236 $ hg log --template '{date|age}\n' > /dev/null || exit 1
2237
2238 >>> from __future__ import absolute_import
2239 >>> import datetime
2240 >>> fp = open('a', 'wb')
2241 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7)
2242 >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) and None
2243 >>> fp.close()
2244 $ hg add a
2245 $ hg commit -m future -d "`cat a`"
2246
2247 $ hg log -l1 --template '{date|age}\n'
2248 7 years from now
2249
2250 $ cd ..
2251 $ rm -rf unstable-hash
2252
2253 Filename filters:
2254
2255 $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n'
2256 bar||foo|
2257 $ hg debugtemplate '{"foo/bar"|dirname}|{"foo/"|dirname}|{"foo"|dirname}|\n'
2258 foo|foo||
2259 $ hg debugtemplate '{"foo/bar"|stripdir}|{"foo/"|stripdir}|{"foo"|stripdir}|\n'
2260 foo|foo|foo|
2261
2262 1214 Add a dummy commit to make up for the instability of the above:
2263 1215
2264 1216 $ echo a > a
2265 1217 $ hg add a
2266 1218 $ hg ci -m future
2267 1219
2268 Count filter:
2269
2270 $ hg log -l1 --template '{node|count} {node|short|count}\n'
2271 40 12
2272
2273 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2274 0 1 4
2275
2276 $ hg log -G --template '{rev}: children: {children|count}, \
2277 > tags: {tags|count}, file_adds: {file_adds|count}, \
2278 > ancestors: {revset("ancestors(%s)", rev)|count}'
2279 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2280 |
2281 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2282 |
2283 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2284
2285 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2286 |\
2287 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2288 | |
2289 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2290 |/
2291 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2292 |
2293 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2294 |
2295 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2296 |
2297 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2298
2299
2300 $ hg log -l1 -T '{termwidth|count}\n'
2301 hg: parse error: not countable
2302 (template filter 'count' is not compatible with keyword 'termwidth')
2303 [255]
2304
2305 Upper/lower filters:
2306
2307 $ hg log -r0 --template '{branch|upper}\n'
2308 DEFAULT
2309 $ hg log -r0 --template '{author|lower}\n'
2310 user name <user@hostname>
2311 $ hg log -r0 --template '{date|upper}\n'
2312 1000000.00
2313
2314 1220 Add a commit that does all possible modifications at once
2315 1221
2316 1222 $ echo modify >> third
2317 1223 $ touch b
2318 1224 $ hg add b
2319 1225 $ hg mv fourth fifth
2320 1226 $ hg rm a
2321 1227 $ hg ci -m "Modify, add, remove, rename"
2322 1228
2323 1229 Check the status template
2324 1230
2325 1231 $ cat <<EOF >> $HGRCPATH
2326 1232 > [extensions]
2327 1233 > color=
2328 1234 > EOF
2329 1235
2330 1236 $ hg log -T status -r 10
2331 1237 changeset: 10:0f9759ec227a
2332 1238 tag: tip
2333 1239 user: test
2334 1240 date: Thu Jan 01 00:00:00 1970 +0000
2335 1241 summary: Modify, add, remove, rename
2336 1242 files:
2337 1243 M third
2338 1244 A b
2339 1245 A fifth
2340 1246 R a
2341 1247 R fourth
2342 1248
2343 1249 $ hg log -T status -C -r 10
2344 1250 changeset: 10:0f9759ec227a
2345 1251 tag: tip
2346 1252 user: test
2347 1253 date: Thu Jan 01 00:00:00 1970 +0000
2348 1254 summary: Modify, add, remove, rename
2349 1255 files:
2350 1256 M third
2351 1257 A b
2352 1258 A fifth
2353 1259 fourth
2354 1260 R a
2355 1261 R fourth
2356 1262
2357 1263 $ hg log -T status -C -r 10 -v
2358 1264 changeset: 10:0f9759ec227a
2359 1265 tag: tip
2360 1266 user: test
2361 1267 date: Thu Jan 01 00:00:00 1970 +0000
2362 1268 description:
2363 1269 Modify, add, remove, rename
2364 1270
2365 1271 files:
2366 1272 M third
2367 1273 A b
2368 1274 A fifth
2369 1275 fourth
2370 1276 R a
2371 1277 R fourth
2372 1278
2373 1279 $ hg log -T status -C -r 10 --debug
2374 1280 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2375 1281 tag: tip
2376 1282 phase: secret
2377 1283 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2378 1284 parent: -1:0000000000000000000000000000000000000000
2379 1285 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2380 1286 user: test
2381 1287 date: Thu Jan 01 00:00:00 1970 +0000
2382 1288 extra: branch=default
2383 1289 description:
2384 1290 Modify, add, remove, rename
2385 1291
2386 1292 files:
2387 1293 M third
2388 1294 A b
2389 1295 A fifth
2390 1296 fourth
2391 1297 R a
2392 1298 R fourth
2393 1299
2394 1300 $ hg log -T status -C -r 10 --quiet
2395 1301 10:0f9759ec227a
2396 1302 $ hg --color=debug log -T status -r 10
2397 1303 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2398 1304 [log.tag|tag: tip]
2399 1305 [log.user|user: test]
2400 1306 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2401 1307 [log.summary|summary: Modify, add, remove, rename]
2402 1308 [ui.note log.files|files:]
2403 1309 [status.modified|M third]
2404 1310 [status.added|A b]
2405 1311 [status.added|A fifth]
2406 1312 [status.removed|R a]
2407 1313 [status.removed|R fourth]
2408 1314
2409 1315 $ hg --color=debug log -T status -C -r 10
2410 1316 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2411 1317 [log.tag|tag: tip]
2412 1318 [log.user|user: test]
2413 1319 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2414 1320 [log.summary|summary: Modify, add, remove, rename]
2415 1321 [ui.note log.files|files:]
2416 1322 [status.modified|M third]
2417 1323 [status.added|A b]
2418 1324 [status.added|A fifth]
2419 1325 [status.copied| fourth]
2420 1326 [status.removed|R a]
2421 1327 [status.removed|R fourth]
2422 1328
2423 1329 $ hg --color=debug log -T status -C -r 10 -v
2424 1330 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2425 1331 [log.tag|tag: tip]
2426 1332 [log.user|user: test]
2427 1333 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2428 1334 [ui.note log.description|description:]
2429 1335 [ui.note log.description|Modify, add, remove, rename]
2430 1336
2431 1337 [ui.note log.files|files:]
2432 1338 [status.modified|M third]
2433 1339 [status.added|A b]
2434 1340 [status.added|A fifth]
2435 1341 [status.copied| fourth]
2436 1342 [status.removed|R a]
2437 1343 [status.removed|R fourth]
2438 1344
2439 1345 $ hg --color=debug log -T status -C -r 10 --debug
2440 1346 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2441 1347 [log.tag|tag: tip]
2442 1348 [log.phase|phase: secret]
2443 1349 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2444 1350 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2445 1351 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2446 1352 [log.user|user: test]
2447 1353 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2448 1354 [ui.debug log.extra|extra: branch=default]
2449 1355 [ui.note log.description|description:]
2450 1356 [ui.note log.description|Modify, add, remove, rename]
2451 1357
2452 1358 [ui.note log.files|files:]
2453 1359 [status.modified|M third]
2454 1360 [status.added|A b]
2455 1361 [status.added|A fifth]
2456 1362 [status.copied| fourth]
2457 1363 [status.removed|R a]
2458 1364 [status.removed|R fourth]
2459 1365
2460 1366 $ hg --color=debug log -T status -C -r 10 --quiet
2461 1367 [log.node|10:0f9759ec227a]
2462 1368
2463 1369 Check the bisect template
2464 1370
2465 1371 $ hg bisect -g 1
2466 1372 $ hg bisect -b 3 --noupdate
2467 1373 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2468 1374 $ hg log -T bisect -r 0:4
2469 1375 changeset: 0:1e4e1b8f71e0
2470 1376 bisect: good (implicit)
2471 1377 user: User Name <user@hostname>
2472 1378 date: Mon Jan 12 13:46:40 1970 +0000
2473 1379 summary: line 1
2474 1380
2475 1381 changeset: 1:b608e9d1a3f0
2476 1382 bisect: good
2477 1383 user: A. N. Other <other@place>
2478 1384 date: Tue Jan 13 17:33:20 1970 +0000
2479 1385 summary: other 1
2480 1386
2481 1387 changeset: 2:97054abb4ab8
2482 1388 bisect: untested
2483 1389 user: other@place
2484 1390 date: Wed Jan 14 21:20:00 1970 +0000
2485 1391 summary: no person
2486 1392
2487 1393 changeset: 3:10e46f2dcbf4
2488 1394 bisect: bad
2489 1395 user: person
2490 1396 date: Fri Jan 16 01:06:40 1970 +0000
2491 1397 summary: no user, no domain
2492 1398
2493 1399 changeset: 4:bbe44766e73d
2494 1400 bisect: bad (implicit)
2495 1401 branch: foo
2496 1402 user: person
2497 1403 date: Sat Jan 17 04:53:20 1970 +0000
2498 1404 summary: new branch
2499 1405
2500 1406 $ hg log --debug -T bisect -r 0:4
2501 1407 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2502 1408 bisect: good (implicit)
2503 1409 phase: public
2504 1410 parent: -1:0000000000000000000000000000000000000000
2505 1411 parent: -1:0000000000000000000000000000000000000000
2506 1412 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2507 1413 user: User Name <user@hostname>
2508 1414 date: Mon Jan 12 13:46:40 1970 +0000
2509 1415 files+: a
2510 1416 extra: branch=default
2511 1417 description:
2512 1418 line 1
2513 1419 line 2
2514 1420
2515 1421
2516 1422 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2517 1423 bisect: good
2518 1424 phase: public
2519 1425 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2520 1426 parent: -1:0000000000000000000000000000000000000000
2521 1427 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2522 1428 user: A. N. Other <other@place>
2523 1429 date: Tue Jan 13 17:33:20 1970 +0000
2524 1430 files+: b
2525 1431 extra: branch=default
2526 1432 description:
2527 1433 other 1
2528 1434 other 2
2529 1435
2530 1436 other 3
2531 1437
2532 1438
2533 1439 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2534 1440 bisect: untested
2535 1441 phase: public
2536 1442 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2537 1443 parent: -1:0000000000000000000000000000000000000000
2538 1444 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2539 1445 user: other@place
2540 1446 date: Wed Jan 14 21:20:00 1970 +0000
2541 1447 files+: c
2542 1448 extra: branch=default
2543 1449 description:
2544 1450 no person
2545 1451
2546 1452
2547 1453 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2548 1454 bisect: bad
2549 1455 phase: public
2550 1456 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2551 1457 parent: -1:0000000000000000000000000000000000000000
2552 1458 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2553 1459 user: person
2554 1460 date: Fri Jan 16 01:06:40 1970 +0000
2555 1461 files: c
2556 1462 extra: branch=default
2557 1463 description:
2558 1464 no user, no domain
2559 1465
2560 1466
2561 1467 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2562 1468 bisect: bad (implicit)
2563 1469 branch: foo
2564 1470 phase: draft
2565 1471 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2566 1472 parent: -1:0000000000000000000000000000000000000000
2567 1473 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2568 1474 user: person
2569 1475 date: Sat Jan 17 04:53:20 1970 +0000
2570 1476 extra: branch=foo
2571 1477 description:
2572 1478 new branch
2573 1479
2574 1480
2575 1481 $ hg log -v -T bisect -r 0:4
2576 1482 changeset: 0:1e4e1b8f71e0
2577 1483 bisect: good (implicit)
2578 1484 user: User Name <user@hostname>
2579 1485 date: Mon Jan 12 13:46:40 1970 +0000
2580 1486 files: a
2581 1487 description:
2582 1488 line 1
2583 1489 line 2
2584 1490
2585 1491
2586 1492 changeset: 1:b608e9d1a3f0
2587 1493 bisect: good
2588 1494 user: A. N. Other <other@place>
2589 1495 date: Tue Jan 13 17:33:20 1970 +0000
2590 1496 files: b
2591 1497 description:
2592 1498 other 1
2593 1499 other 2
2594 1500
2595 1501 other 3
2596 1502
2597 1503
2598 1504 changeset: 2:97054abb4ab8
2599 1505 bisect: untested
2600 1506 user: other@place
2601 1507 date: Wed Jan 14 21:20:00 1970 +0000
2602 1508 files: c
2603 1509 description:
2604 1510 no person
2605 1511
2606 1512
2607 1513 changeset: 3:10e46f2dcbf4
2608 1514 bisect: bad
2609 1515 user: person
2610 1516 date: Fri Jan 16 01:06:40 1970 +0000
2611 1517 files: c
2612 1518 description:
2613 1519 no user, no domain
2614 1520
2615 1521
2616 1522 changeset: 4:bbe44766e73d
2617 1523 bisect: bad (implicit)
2618 1524 branch: foo
2619 1525 user: person
2620 1526 date: Sat Jan 17 04:53:20 1970 +0000
2621 1527 description:
2622 1528 new branch
2623 1529
2624 1530
2625 1531 $ hg --color=debug log -T bisect -r 0:4
2626 1532 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2627 1533 [log.bisect bisect.good|bisect: good (implicit)]
2628 1534 [log.user|user: User Name <user@hostname>]
2629 1535 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2630 1536 [log.summary|summary: line 1]
2631 1537
2632 1538 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2633 1539 [log.bisect bisect.good|bisect: good]
2634 1540 [log.user|user: A. N. Other <other@place>]
2635 1541 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2636 1542 [log.summary|summary: other 1]
2637 1543
2638 1544 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2639 1545 [log.bisect bisect.untested|bisect: untested]
2640 1546 [log.user|user: other@place]
2641 1547 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2642 1548 [log.summary|summary: no person]
2643 1549
2644 1550 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2645 1551 [log.bisect bisect.bad|bisect: bad]
2646 1552 [log.user|user: person]
2647 1553 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2648 1554 [log.summary|summary: no user, no domain]
2649 1555
2650 1556 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2651 1557 [log.bisect bisect.bad|bisect: bad (implicit)]
2652 1558 [log.branch|branch: foo]
2653 1559 [log.user|user: person]
2654 1560 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2655 1561 [log.summary|summary: new branch]
2656 1562
2657 1563 $ hg --color=debug log --debug -T bisect -r 0:4
2658 1564 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2659 1565 [log.bisect bisect.good|bisect: good (implicit)]
2660 1566 [log.phase|phase: public]
2661 1567 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2662 1568 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2663 1569 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2664 1570 [log.user|user: User Name <user@hostname>]
2665 1571 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2666 1572 [ui.debug log.files|files+: a]
2667 1573 [ui.debug log.extra|extra: branch=default]
2668 1574 [ui.note log.description|description:]
2669 1575 [ui.note log.description|line 1
2670 1576 line 2]
2671 1577
2672 1578
2673 1579 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2674 1580 [log.bisect bisect.good|bisect: good]
2675 1581 [log.phase|phase: public]
2676 1582 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2677 1583 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2678 1584 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2679 1585 [log.user|user: A. N. Other <other@place>]
2680 1586 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2681 1587 [ui.debug log.files|files+: b]
2682 1588 [ui.debug log.extra|extra: branch=default]
2683 1589 [ui.note log.description|description:]
2684 1590 [ui.note log.description|other 1
2685 1591 other 2
2686 1592
2687 1593 other 3]
2688 1594
2689 1595
2690 1596 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2691 1597 [log.bisect bisect.untested|bisect: untested]
2692 1598 [log.phase|phase: public]
2693 1599 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2694 1600 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2695 1601 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2696 1602 [log.user|user: other@place]
2697 1603 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2698 1604 [ui.debug log.files|files+: c]
2699 1605 [ui.debug log.extra|extra: branch=default]
2700 1606 [ui.note log.description|description:]
2701 1607 [ui.note log.description|no person]
2702 1608
2703 1609
2704 1610 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2705 1611 [log.bisect bisect.bad|bisect: bad]
2706 1612 [log.phase|phase: public]
2707 1613 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2708 1614 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2709 1615 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2710 1616 [log.user|user: person]
2711 1617 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2712 1618 [ui.debug log.files|files: c]
2713 1619 [ui.debug log.extra|extra: branch=default]
2714 1620 [ui.note log.description|description:]
2715 1621 [ui.note log.description|no user, no domain]
2716 1622
2717 1623
2718 1624 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2719 1625 [log.bisect bisect.bad|bisect: bad (implicit)]
2720 1626 [log.branch|branch: foo]
2721 1627 [log.phase|phase: draft]
2722 1628 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2723 1629 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2724 1630 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2725 1631 [log.user|user: person]
2726 1632 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2727 1633 [ui.debug log.extra|extra: branch=foo]
2728 1634 [ui.note log.description|description:]
2729 1635 [ui.note log.description|new branch]
2730 1636
2731 1637
2732 1638 $ hg --color=debug log -v -T bisect -r 0:4
2733 1639 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2734 1640 [log.bisect bisect.good|bisect: good (implicit)]
2735 1641 [log.user|user: User Name <user@hostname>]
2736 1642 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2737 1643 [ui.note log.files|files: a]
2738 1644 [ui.note log.description|description:]
2739 1645 [ui.note log.description|line 1
2740 1646 line 2]
2741 1647
2742 1648
2743 1649 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2744 1650 [log.bisect bisect.good|bisect: good]
2745 1651 [log.user|user: A. N. Other <other@place>]
2746 1652 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2747 1653 [ui.note log.files|files: b]
2748 1654 [ui.note log.description|description:]
2749 1655 [ui.note log.description|other 1
2750 1656 other 2
2751 1657
2752 1658 other 3]
2753 1659
2754 1660
2755 1661 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2756 1662 [log.bisect bisect.untested|bisect: untested]
2757 1663 [log.user|user: other@place]
2758 1664 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2759 1665 [ui.note log.files|files: c]
2760 1666 [ui.note log.description|description:]
2761 1667 [ui.note log.description|no person]
2762 1668
2763 1669
2764 1670 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2765 1671 [log.bisect bisect.bad|bisect: bad]
2766 1672 [log.user|user: person]
2767 1673 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2768 1674 [ui.note log.files|files: c]
2769 1675 [ui.note log.description|description:]
2770 1676 [ui.note log.description|no user, no domain]
2771 1677
2772 1678
2773 1679 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2774 1680 [log.bisect bisect.bad|bisect: bad (implicit)]
2775 1681 [log.branch|branch: foo]
2776 1682 [log.user|user: person]
2777 1683 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2778 1684 [ui.note log.description|description:]
2779 1685 [ui.note log.description|new branch]
2780 1686
2781 1687
2782 1688 $ hg bisect --reset
2783 1689
2784 Error on syntax:
2785
2786 $ echo 'x = "f' >> t
2787 $ hg log
2788 hg: parse error at t:3: unmatched quotes
2789 [255]
2790
2791 $ hg log -T '{date'
2792 hg: parse error at 1: unterminated template expansion
2793 ({date
2794 ^ here)
2795 [255]
2796 $ hg log -T '{date(}'
2797 hg: parse error at 6: not a prefix: end
2798 ({date(}
2799 ^ here)
2800 [255]
2801 $ hg log -T '{date)}'
2802 hg: parse error at 5: invalid token
2803 ({date)}
2804 ^ here)
2805 [255]
2806 $ hg log -T '{date date}'
2807 hg: parse error at 6: invalid token
2808 ({date date}
2809 ^ here)
2810 [255]
2811
2812 $ hg log -T '{}'
2813 hg: parse error at 1: not a prefix: end
2814 ({}
2815 ^ here)
2816 [255]
2817 $ hg debugtemplate -v '{()}'
2818 (template
2819 (group
2820 None))
2821 * keywords:
2822 * functions:
2823 hg: parse error: missing argument
2824 [255]
2825
2826 Behind the scenes, this would throw TypeError without intype=bytes
2827
2828 $ hg log -l 3 --template '{date|obfuscate}\n'
2829 &#48;&#46;&#48;&#48;
2830 &#48;&#46;&#48;&#48;
2831 &#49;&#53;&#55;&#55;&#56;&#55;&#50;&#56;&#54;&#48;&#46;&#48;&#48;
2832
2833 Behind the scenes, this will throw a ValueError
2834
2835 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2836 hg: parse error: invalid date: 'Modify, add, remove, rename'
2837 (template filter 'shortdate' is not compatible with keyword 'desc')
2838 [255]
2839
2840 Behind the scenes, this would throw AttributeError without intype=bytes
2841
2842 $ hg log -l 3 --template 'line: {date|escape}\n'
2843 line: 0.00
2844 line: 0.00
2845 line: 1577872860.00
2846
2847 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2848 hg: parse error: localdate expects a date information
2849 [255]
2850
2851 Behind the scenes, this will throw ValueError
2852
2853 $ hg tip --template '{author|email|date}\n'
2854 hg: parse error: date expects a date information
2855 [255]
2856
2857 $ hg tip -T '{author|email|shortdate}\n'
2858 hg: parse error: invalid date: 'test'
2859 (template filter 'shortdate' is not compatible with keyword 'author')
2860 [255]
2861
2862 $ hg tip -T '{get(extras, "branch")|shortdate}\n'
2863 hg: parse error: invalid date: 'default'
2864 (incompatible use of template filter 'shortdate')
2865 [255]
2866
2867 Error in nested template:
2868
2869 $ hg log -T '{"date'
2870 hg: parse error at 2: unterminated string
2871 ({"date
2872 ^ here)
2873 [255]
2874
2875 $ hg log -T '{"foo{date|?}"}'
2876 hg: parse error at 11: syntax error
2877 ({"foo{date|?}"}
2878 ^ here)
2879 [255]
2880
2881 Thrown an error if a template function doesn't exist
2882
2883 $ hg tip --template '{foo()}\n'
2884 hg: parse error: unknown function 'foo'
2885 [255]
2886
2887 Pass generator object created by template function to filter
2888
2889 $ hg log -l 1 --template '{if(author, author)|user}\n'
2890 test
2891
2892 Test index keyword:
2893
2894 $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
2895 10 0:a 1:b 2:fifth 3:fourth 4:third
2896 11 0:a
2897
2898 $ hg branches -T '{index} {branch}\n'
2899 0 default
2900 1 foo
2901
2902 Test diff function:
2903
2904 $ hg diff -c 8
2905 diff -r 29114dbae42b -r 95c24699272e fourth
2906 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2907 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2908 @@ -0,0 +1,1 @@
2909 +second
2910 diff -r 29114dbae42b -r 95c24699272e second
2911 --- a/second Mon Jan 12 13:46:40 1970 +0000
2912 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2913 @@ -1,1 +0,0 @@
2914 -second
2915 diff -r 29114dbae42b -r 95c24699272e third
2916 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2917 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2918 @@ -0,0 +1,1 @@
2919 +third
2920
2921 $ hg log -r 8 -T "{diff()}"
2922 diff -r 29114dbae42b -r 95c24699272e fourth
2923 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2924 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2925 @@ -0,0 +1,1 @@
2926 +second
2927 diff -r 29114dbae42b -r 95c24699272e second
2928 --- a/second Mon Jan 12 13:46:40 1970 +0000
2929 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2930 @@ -1,1 +0,0 @@
2931 -second
2932 diff -r 29114dbae42b -r 95c24699272e third
2933 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2934 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2935 @@ -0,0 +1,1 @@
2936 +third
2937
2938 $ hg log -r 8 -T "{diff('glob:f*')}"
2939 diff -r 29114dbae42b -r 95c24699272e fourth
2940 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2941 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2942 @@ -0,0 +1,1 @@
2943 +second
2944
2945 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2946 diff -r 29114dbae42b -r 95c24699272e second
2947 --- a/second Mon Jan 12 13:46:40 1970 +0000
2948 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2949 @@ -1,1 +0,0 @@
2950 -second
2951 diff -r 29114dbae42b -r 95c24699272e third
2952 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2953 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2954 @@ -0,0 +1,1 @@
2955 +third
2956
2957 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2958 diff -r 29114dbae42b -r 95c24699272e fourth
2959 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2960 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2961 @@ -0,0 +1,1 @@
2962 +second
2963
2964 ui verbosity:
2965
2966 $ hg log -l1 -T '{verbosity}\n'
2967
2968 $ hg log -l1 -T '{verbosity}\n' --debug
2969 debug
2970 $ hg log -l1 -T '{verbosity}\n' --quiet
2971 quiet
2972 $ hg log -l1 -T '{verbosity}\n' --verbose
2973 verbose
2974
2975 1690 $ cd ..
2976 1691
2977
2978 latesttag:
1692 Set up latesttag repository:
2979 1693
2980 1694 $ hg init latesttag
2981 1695 $ cd latesttag
2982 1696
2983 1697 $ echo a > file
2984 1698 $ hg ci -Am a -d '0 0'
2985 1699 adding file
2986 1700
2987 1701 $ echo b >> file
2988 1702 $ hg ci -m b -d '1 0'
2989 1703
2990 1704 $ echo c >> head1
2991 1705 $ hg ci -Am h1c -d '2 0'
2992 1706 adding head1
2993 1707
2994 1708 $ hg update -q 1
2995 1709 $ echo d >> head2
2996 1710 $ hg ci -Am h2d -d '3 0'
2997 1711 adding head2
2998 1712 created new head
2999 1713
3000 1714 $ echo e >> head2
3001 1715 $ hg ci -m h2e -d '4 0'
3002 1716
3003 1717 $ hg merge -q
3004 1718 $ hg ci -m merge -d '5 -3600'
3005 1719
3006 No tag set:
3007
3008 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3009 @ 5: null+5
3010 |\
3011 | o 4: null+4
3012 | |
3013 | o 3: null+3
3014 | |
3015 o | 2: null+3
3016 |/
3017 o 1: null+2
3018 |
3019 o 0: null+1
3020
3021
3022 One common tag: longest path wins for {latesttagdistance}:
3023
3024 1720 $ hg tag -r 1 -m t1 -d '6 0' t1
3025 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3026 @ 6: t1+4
3027 |
3028 o 5: t1+3
3029 |\
3030 | o 4: t1+2
3031 | |
3032 | o 3: t1+1
3033 | |
3034 o | 2: t1+1
3035 |/
3036 o 1: t1+0
3037 |
3038 o 0: null+1
3039
3040
3041 One ancestor tag: closest wins:
3042
3043 1721 $ hg tag -r 2 -m t2 -d '7 0' t2
3044 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3045 @ 7: t2+3
3046 |
3047 o 6: t2+2
3048 |
3049 o 5: t2+1
3050 |\
3051 | o 4: t1+2
3052 | |
3053 | o 3: t1+1
3054 | |
3055 o | 2: t2+0
3056 |/
3057 o 1: t1+0
3058 |
3059 o 0: null+1
3060
3061
3062 Two branch tags: more recent wins if same number of changes:
3063
3064 1722 $ hg tag -r 3 -m t3 -d '8 0' t3
3065 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3066 @ 8: t3+5
3067 |
3068 o 7: t3+4
3069 |
3070 o 6: t3+3
3071 |
3072 o 5: t3+2
3073 |\
3074 | o 4: t3+1
3075 | |
3076 | o 3: t3+0
3077 | |
3078 o | 2: t2+0
3079 |/
3080 o 1: t1+0
3081 |
3082 o 0: null+1
3083
3084
3085 Two branch tags: fewest changes wins:
3086
3087 1723 $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
3088 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3089 @ 9: t4+5,6
3090 |
3091 o 8: t4+4,5
3092 |
3093 o 7: t4+3,4
3094 |
3095 o 6: t4+2,3
3096 |
3097 o 5: t4+1,2
3098 |\
3099 | o 4: t4+0,0
3100 | |
3101 | o 3: t3+0,0
3102 | |
3103 o | 2: t2+0,0
3104 |/
3105 o 1: t1+0,0
3106 |
3107 o 0: null+1,1
3108
3109
3110 Merged tag overrides:
3111
3112 1724 $ hg tag -r 5 -m t5 -d '9 0' t5
3113 1725 $ hg tag -r 3 -m at3 -d '10 0' at3
3114 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3115 @ 11: t5+6
3116 |
3117 o 10: t5+5
3118 |
3119 o 9: t5+4
3120 |
3121 o 8: t5+3
3122 |
3123 o 7: t5+2
3124 |
3125 o 6: t5+1
3126 |
3127 o 5: t5+0
3128 |\
3129 | o 4: t4+0
3130 | |
3131 | o 3: at3:t3+0
3132 | |
3133 o | 2: t2+0
3134 |/
3135 o 1: t1+0
3136 |
3137 o 0: null+1
3138
3139
3140 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3141 @ 11: t5+6,6
3142 |
3143 o 10: t5+5,5
3144 |
3145 o 9: t5+4,4
3146 |
3147 o 8: t5+3,3
3148 |
3149 o 7: t5+2,2
3150 |
3151 o 6: t5+1,1
3152 |
3153 o 5: t5+0,0
3154 |\
3155 | o 4: t4+0,0
3156 | |
3157 | o 3: at3+0,0 t3+0,0
3158 | |
3159 o | 2: t2+0,0
3160 |/
3161 o 1: t1+0,0
3162 |
3163 o 0: null+1,1
3164
3165
3166 $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
3167 @ 11: t3, C: 9, D: 8
3168 |
3169 o 10: t3, C: 8, D: 7
3170 |
3171 o 9: t3, C: 7, D: 6
3172 |
3173 o 8: t3, C: 6, D: 5
3174 |
3175 o 7: t3, C: 5, D: 4
3176 |
3177 o 6: t3, C: 4, D: 3
3178 |
3179 o 5: t3, C: 3, D: 2
3180 |\
3181 | o 4: t3, C: 1, D: 1
3182 | |
3183 | o 3: t3, C: 0, D: 0
3184 | |
3185 o | 2: t1, C: 1, D: 1
3186 |/
3187 o 1: t1, C: 0, D: 0
3188 |
3189 o 0: null, C: 1, D: 1
3190
3191 1726
3192 1727 $ cd ..
3193 1728
3194
3195 1729 Style path expansion: issue1948 - ui.style option doesn't work on OSX
3196 1730 if it is a relative path
3197 1731
3198 1732 $ mkdir -p home/styles
3199 1733
3200 1734 $ cat > home/styles/teststyle <<EOF
3201 1735 > changeset = 'test {rev}:{node|short}\n'
3202 1736 > EOF
3203 1737
3204 1738 $ HOME=`pwd`/home; export HOME
3205 1739
3206 1740 $ cat > latesttag/.hg/hgrc <<EOF
3207 1741 > [ui]
3208 1742 > style = ~/styles/teststyle
3209 1743 > EOF
3210 1744
3211 1745 $ hg -R latesttag tip
3212 1746 test 11:97e5943b523a
3213 1747
3214 1748 Test recursive showlist template (issue1989):
3215 1749
3216 1750 $ cat > style1989 <<EOF
3217 1751 > changeset = '{file_mods}{manifest}{extras}'
3218 1752 > file_mod = 'M|{author|person}\n'
3219 1753 > manifest = '{rev},{author}\n'
3220 1754 > extra = '{key}: {author}\n'
3221 1755 > EOF
3222 1756
3223 1757 $ hg -R latesttag log -r tip --style=style1989
3224 1758 M|test
3225 1759 11,test
3226 1760 branch: test
3227
3228 Test new-style inline templating:
3229
3230 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
3231 modified files: .hgtags
3232
3233
3234 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
3235 hg: parse error: 11 is not iterable of mappings
3236 (keyword 'rev' does not support map operation)
3237 [255]
3238 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
3239 hg: parse error: None is not iterable of mappings
3240 [255]
3241 $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}'
3242 hg: parse error: list of strings is not mappable
3243 [255]
3244
3245 Test new-style inline templating of non-list/dict type:
3246
3247 $ hg log -R latesttag -r tip -T '{manifest}\n'
3248 11:2bc6e9006ce2
3249 $ hg log -R latesttag -r tip -T 'string length: {manifest|count}\n'
3250 string length: 15
3251 $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n'
3252 11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc
3253
3254 $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}'
3255 branch: default
3256 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}'
3257 hg: parse error: None is not iterable of mappings
3258 [255]
3259 $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}'
3260 branch: default
3261 $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}'
3262 0:ce3cec86e6c2
3263 $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}'
3264 9:fbc7cd862e9c
3265
3266 Test manifest/get() can be join()-ed as string, though it's silly:
3267
3268 $ hg log -R latesttag -r tip -T '{join(manifest, ".")}\n'
3269 1.1.:.2.b.c.6.e.9.0.0.6.c.e.2
3270 $ hg log -R latesttag -r tip -T '{join(get(extras, "branch"), ".")}\n'
3271 d.e.f.a.u.l.t
3272
3273 Test join() over string
3274
3275 $ hg log -R latesttag -r tip -T '{join(rev|stringify, ".")}\n'
3276 1.1
3277
3278 Test join() over uniterable
3279
3280 $ hg log -R latesttag -r tip -T '{join(rev, "")}\n'
3281 hg: parse error: 11 is not iterable
3282 [255]
3283
3284 Test min/max of integers
3285
3286 $ hg log -R latesttag -l1 -T '{min(revset("9:10"))}\n'
3287 9
3288 $ hg log -R latesttag -l1 -T '{max(revset("9:10"))}\n'
3289 10
3290
3291 Test min/max over map operation:
3292
3293 $ hg log -R latesttag -r3 -T '{min(tags % "{tag}")}\n'
3294 at3
3295 $ hg log -R latesttag -r3 -T '{max(tags % "{tag}")}\n'
3296 t3
3297
3298 Test min/max of strings:
3299
3300 $ hg log -R latesttag -l1 -T '{min(desc)}\n'
3301 3
3302 $ hg log -R latesttag -l1 -T '{max(desc)}\n'
3303 t
3304
3305 Test min/max of non-iterable:
3306
3307 $ hg debugtemplate '{min(1)}'
3308 hg: parse error: 1 is not iterable
3309 (min first argument should be an iterable)
3310 [255]
3311 $ hg debugtemplate '{max(2)}'
3312 hg: parse error: 2 is not iterable
3313 (max first argument should be an iterable)
3314 [255]
3315
3316 $ hg log -R latesttag -l1 -T '{min(date)}'
3317 hg: parse error: date is not iterable
3318 (min first argument should be an iterable)
3319 [255]
3320 $ hg log -R latesttag -l1 -T '{max(date)}'
3321 hg: parse error: date is not iterable
3322 (max first argument should be an iterable)
3323 [255]
3324
3325 Test min/max of empty sequence:
3326
3327 $ hg debugtemplate '{min("")}'
3328 hg: parse error: empty string
3329 (min first argument should be an iterable)
3330 [255]
3331 $ hg debugtemplate '{max("")}'
3332 hg: parse error: empty string
3333 (max first argument should be an iterable)
3334 [255]
3335 $ hg debugtemplate '{min(dict())}'
3336 hg: parse error: empty sequence
3337 (min first argument should be an iterable)
3338 [255]
3339 $ hg debugtemplate '{max(dict())}'
3340 hg: parse error: empty sequence
3341 (max first argument should be an iterable)
3342 [255]
3343 $ hg debugtemplate '{min(dict() % "")}'
3344 hg: parse error: empty sequence
3345 (min first argument should be an iterable)
3346 [255]
3347 $ hg debugtemplate '{max(dict() % "")}'
3348 hg: parse error: empty sequence
3349 (max first argument should be an iterable)
3350 [255]
3351
3352 Test min/max of if() result
3353
3354 $ cd latesttag
3355 $ hg log -l1 -T '{min(if(true, revset("9:10"), ""))}\n'
3356 9
3357 $ hg log -l1 -T '{max(if(false, "", revset("9:10")))}\n'
3358 10
3359 $ hg log -l1 -T '{min(ifcontains("a", "aa", revset("9:10"), ""))}\n'
3360 9
3361 $ hg log -l1 -T '{max(ifcontains("a", "bb", "", revset("9:10")))}\n'
3362 10
3363 $ hg log -l1 -T '{min(ifeq(0, 0, revset("9:10"), ""))}\n'
3364 9
3365 $ hg log -l1 -T '{max(ifeq(0, 1, "", revset("9:10")))}\n'
3366 10
3367 $ cd ..
3368
3369 Test laziness of if() then/else clause
3370
3371 $ hg debugtemplate '{count(0)}'
3372 hg: parse error: not countable
3373 (incompatible use of template filter 'count')
3374 [255]
3375 $ hg debugtemplate '{if(true, "", count(0))}'
3376 $ hg debugtemplate '{if(false, count(0), "")}'
3377 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}'
3378 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}'
3379 $ hg debugtemplate '{ifeq(0, 0, "", count(0))}'
3380 $ hg debugtemplate '{ifeq(0, 1, count(0), "")}'
3381
3382 Test dot operator precedence:
3383
3384 $ hg debugtemplate -R latesttag -r0 -v '{manifest.node|short}\n'
3385 (template
3386 (|
3387 (.
3388 (symbol 'manifest')
3389 (symbol 'node'))
3390 (symbol 'short'))
3391 (string '\n'))
3392 * keywords: manifest, node, rev
3393 * functions: formatnode, short
3394 89f4071fec70
3395
3396 (the following examples are invalid, but seem natural in parsing POV)
3397
3398 $ hg debugtemplate -R latesttag -r0 -v '{foo|bar.baz}\n' 2> /dev/null
3399 (template
3400 (|
3401 (symbol 'foo')
3402 (.
3403 (symbol 'bar')
3404 (symbol 'baz')))
3405 (string '\n'))
3406 [255]
3407 $ hg debugtemplate -R latesttag -r0 -v '{foo.bar()}\n' 2> /dev/null
3408 (template
3409 (.
3410 (symbol 'foo')
3411 (func
3412 (symbol 'bar')
3413 None))
3414 (string '\n'))
3415 * keywords: foo
3416 * functions: bar
3417 [255]
3418
3419 Test evaluation of dot operator:
3420
3421 $ hg log -R latesttag -l1 -T '{min(revset("0:9")).node}\n'
3422 ce3cec86e6c26bd9bdfc590a6b92abc9680f1796
3423 $ hg log -R latesttag -r0 -T '{extras.branch}\n'
3424 default
3425 $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n'
3426 0 -7200
3427
3428 $ hg log -R latesttag -l1 -T '{author.invalid}\n'
3429 hg: parse error: 'test' is not a dictionary
3430 (keyword 'author' does not support member operation)
3431 [255]
3432 $ hg log -R latesttag -l1 -T '{min("abc").invalid}\n'
3433 hg: parse error: 'a' is not a dictionary
3434 [255]
3435
3436 Test the sub function of templating for expansion:
3437
3438 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
3439 xx
3440
3441 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
3442 hg: parse error: sub got an invalid pattern: [
3443 [255]
3444 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
3445 hg: parse error: sub got an invalid replacement: \1
3446 [255]
3447
3448 Test the strip function with chars specified:
3449
3450 $ hg log -R latesttag --template '{desc}\n'
3451 at3
3452 t5
3453 t4
3454 t3
3455 t2
3456 t1
3457 merge
3458 h2e
3459 h2d
3460 h1c
3461 b
3462 a
3463
3464 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
3465 at3
3466 5
3467 4
3468 3
3469 2
3470 1
3471 merg
3472 h2
3473 h2d
3474 h1c
3475 b
3476 a
3477
3478 Test date format:
3479
3480 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
3481 date: 70 01 01 10 +0000
3482 date: 70 01 01 09 +0000
3483 date: 70 01 01 04 +0000
3484 date: 70 01 01 08 +0000
3485 date: 70 01 01 07 +0000
3486 date: 70 01 01 06 +0000
3487 date: 70 01 01 05 +0100
3488 date: 70 01 01 04 +0000
3489 date: 70 01 01 03 +0000
3490 date: 70 01 01 02 +0000
3491 date: 70 01 01 01 +0000
3492 date: 70 01 01 00 +0000
3493
3494 Test invalid date:
3495
3496 $ hg log -R latesttag -T '{date(rev)}\n'
3497 hg: parse error: date expects a date information
3498 [255]
3499
3500 Test integer literal:
3501
3502 $ hg debugtemplate -v '{(0)}\n'
3503 (template
3504 (group
3505 (integer '0'))
3506 (string '\n'))
3507 * keywords:
3508 * functions:
3509 0
3510 $ hg debugtemplate -v '{(123)}\n'
3511 (template
3512 (group
3513 (integer '123'))
3514 (string '\n'))
3515 * keywords:
3516 * functions:
3517 123
3518 $ hg debugtemplate -v '{(-4)}\n'
3519 (template
3520 (group
3521 (negate
3522 (integer '4')))
3523 (string '\n'))
3524 * keywords:
3525 * functions:
3526 -4
3527 $ hg debugtemplate '{(-)}\n'
3528 hg: parse error at 3: not a prefix: )
3529 ({(-)}\n
3530 ^ here)
3531 [255]
3532 $ hg debugtemplate '{(-a)}\n'
3533 hg: parse error: negation needs an integer argument
3534 [255]
3535
3536 top-level integer literal is interpreted as symbol (i.e. variable name):
3537
3538 $ hg debugtemplate -D 1=one -v '{1}\n'
3539 (template
3540 (integer '1')
3541 (string '\n'))
3542 * keywords:
3543 * functions:
3544 one
3545 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
3546 (template
3547 (func
3548 (symbol 'if')
3549 (list
3550 (string 't')
3551 (template
3552 (integer '1'))))
3553 (string '\n'))
3554 * keywords:
3555 * functions: if
3556 one
3557 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
3558 (template
3559 (|
3560 (integer '1')
3561 (symbol 'stringify'))
3562 (string '\n'))
3563 * keywords:
3564 * functions: stringify
3565 one
3566
3567 unless explicit symbol is expected:
3568
3569 $ hg log -Ra -r0 -T '{desc|1}\n'
3570 hg: parse error: expected a symbol, got 'integer'
3571 [255]
3572 $ hg log -Ra -r0 -T '{1()}\n'
3573 hg: parse error: expected a symbol, got 'integer'
3574 [255]
3575
3576 Test string literal:
3577
3578 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
3579 (template
3580 (string 'string with no template fragment')
3581 (string '\n'))
3582 * keywords:
3583 * functions:
3584 string with no template fragment
3585 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
3586 (template
3587 (template
3588 (string 'template: ')
3589 (symbol 'rev'))
3590 (string '\n'))
3591 * keywords: rev
3592 * functions:
3593 template: 0
3594 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
3595 (template
3596 (string 'rawstring: {rev}')
3597 (string '\n'))
3598 * keywords:
3599 * functions:
3600 rawstring: {rev}
3601 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
3602 (template
3603 (%
3604 (symbol 'files')
3605 (string 'rawstring: {file}'))
3606 (string '\n'))
3607 * keywords: files
3608 * functions:
3609 rawstring: {file}
3610
3611 Test string escaping:
3612
3613 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3614 >
3615 <>\n<[>
3616 <>\n<]>
3617 <>\n<
3618
3619 $ hg log -R latesttag -r 0 \
3620 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3621 >
3622 <>\n<[>
3623 <>\n<]>
3624 <>\n<
3625
3626 $ hg log -R latesttag -r 0 -T esc \
3627 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3628 >
3629 <>\n<[>
3630 <>\n<]>
3631 <>\n<
3632
3633 $ cat <<'EOF' > esctmpl
3634 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3635 > EOF
3636 $ hg log -R latesttag -r 0 --style ./esctmpl
3637 >
3638 <>\n<[>
3639 <>\n<]>
3640 <>\n<
3641
3642 Test string escaping of quotes:
3643
3644 $ hg log -Ra -r0 -T '{"\""}\n'
3645 "
3646 $ hg log -Ra -r0 -T '{"\\\""}\n'
3647 \"
3648 $ hg log -Ra -r0 -T '{r"\""}\n'
3649 \"
3650 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3651 \\\"
3652
3653
3654 $ hg log -Ra -r0 -T '{"\""}\n'
3655 "
3656 $ hg log -Ra -r0 -T '{"\\\""}\n'
3657 \"
3658 $ hg log -Ra -r0 -T '{r"\""}\n'
3659 \"
3660 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3661 \\\"
3662
3663 Test exception in quoted template. single backslash before quotation mark is
3664 stripped before parsing:
3665
3666 $ cat <<'EOF' > escquotetmpl
3667 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3668 > EOF
3669 $ cd latesttag
3670 $ hg log -r 2 --style ../escquotetmpl
3671 " \" \" \\" head1
3672
3673 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3674 valid
3675 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3676 valid
3677
3678 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3679 _evalifliteral() templates (issue4733):
3680
3681 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3682 "2
3683 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3684 "2
3685 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3686 "2
3687
3688 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3689 \"
3690 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3691 \"
3692 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3693 \"
3694
3695 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3696 \\\"
3697 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3698 \\\"
3699 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3700 \\\"
3701
3702 escaped single quotes and errors:
3703
3704 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3705 foo
3706 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3707 foo
3708 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3709 hg: parse error at 21: unterminated string
3710 ({if(rev, "{if(rev, \")}")}\n
3711 ^ here)
3712 [255]
3713 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3714 hg: parse error: trailing \ in string
3715 [255]
3716 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3717 hg: parse error: trailing \ in string
3718 [255]
3719
3720 $ cd ..
3721
3722 Test leading backslashes:
3723
3724 $ cd latesttag
3725 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3726 {rev} {file}
3727 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3728 \2 \head1
3729 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3730 \{rev} \{file}
3731 $ cd ..
3732
3733 Test leading backslashes in "if" expression (issue4714):
3734
3735 $ cd latesttag
3736 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3737 {rev} \{rev}
3738 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3739 \2 \\{rev}
3740 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3741 \{rev} \\\{rev}
3742 $ cd ..
3743
3744 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3745
3746 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3747 \x6e
3748 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3749 \x5c\x786e
3750 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3751 \x6e
3752 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3753 \x5c\x786e
3754
3755 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3756 \x6e
3757 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3758 \x5c\x786e
3759 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3760 \x6e
3761 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3762 \x5c\x786e
3763
3764 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3765 fourth
3766 second
3767 third
3768 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3769 fourth\nsecond\nthird
3770
3771 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3772 <p>
3773 1st
3774 </p>
3775 <p>
3776 2nd
3777 </p>
3778 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3779 <p>
3780 1st\n\n2nd
3781 </p>
3782 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3783 1st
3784
3785 2nd
3786
3787 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3788 o perso
3789 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3790 no person
3791 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3792 o perso
3793 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3794 no perso
3795
3796 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3797 -o perso-
3798 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3799 no person
3800 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3801 \x2do perso\x2d
3802 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3803 -o perso-
3804 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3805 \x2do perso\x6e
3806
3807 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3808 fourth
3809 second
3810 third
3811
3812 Test string escaping in nested expression:
3813
3814 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3815 fourth\x6esecond\x6ethird
3816 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3817 fourth\x6esecond\x6ethird
3818
3819 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3820 fourth\x6esecond\x6ethird
3821 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3822 fourth\x5c\x786esecond\x5c\x786ethird
3823
3824 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3825 3:\x6eo user, \x6eo domai\x6e
3826 4:\x5c\x786eew bra\x5c\x786ech
3827
3828 Test quotes in nested expression are evaluated just like a $(command)
3829 substitution in POSIX shells:
3830
3831 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3832 8:95c24699272e
3833 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3834 {8} "95c24699272e"
3835
3836 Test recursive evaluation:
3837
3838 $ hg init r
3839 $ cd r
3840 $ echo a > a
3841 $ hg ci -Am '{rev}'
3842 adding a
3843 $ hg log -r 0 --template '{if(rev, desc)}\n'
3844 {rev}
3845 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3846 test 0
3847
3848 $ hg branch -q 'text.{rev}'
3849 $ echo aa >> aa
3850 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3851
3852 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3853 {node|short}desc to
3854 text.{rev}be wrapped
3855 text.{rev}desc to be
3856 text.{rev}wrapped (no-eol)
3857 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3858 bcc7ff960b8e:desc to
3859 text.1:be wrapped
3860 text.1:desc to be
3861 text.1:wrapped (no-eol)
3862 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3863 hg: parse error: fill expects an integer width
3864 [255]
3865
3866 $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}'
3867 bcc7ff960b8e:desc to be
3868 termwidth.1:wrapped desc
3869 termwidth.1:to be wrapped (no-eol)
3870
3871 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3872 {node|short} (no-eol)
3873 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3874 bcc-ff---b-e (no-eol)
3875
3876 $ cat >> .hg/hgrc <<EOF
3877 > [extensions]
3878 > color=
3879 > [color]
3880 > mode=ansi
3881 > text.{rev} = red
3882 > text.1 = green
3883 > EOF
3884 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3885 \x1b[0;31mtext\x1b[0m (esc)
3886 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3887 \x1b[0;32mtext\x1b[0m (esc)
3888
3889 color effect can be specified without quoting:
3890
3891 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3892 \x1b[0;31mtext\x1b[0m (esc)
3893
3894 color effects can be nested (issue5413)
3895
3896 $ hg debugtemplate --color=always \
3897 > '{label(red, "red{label(magenta, "ma{label(cyan, "cyan")}{label(yellow, "yellow")}genta")}")}\n'
3898 \x1b[0;31mred\x1b[0;35mma\x1b[0;36mcyan\x1b[0m\x1b[0;31m\x1b[0;35m\x1b[0;33myellow\x1b[0m\x1b[0;31m\x1b[0;35mgenta\x1b[0m (esc)
3899
3900 pad() should interact well with color codes (issue5416)
3901
3902 $ hg debugtemplate --color=always \
3903 > '{pad(label(red, "red"), 5, label(cyan, "-"))}\n'
3904 \x1b[0;31mred\x1b[0m\x1b[0;36m-\x1b[0m\x1b[0;36m-\x1b[0m (esc)
3905
3906 label should be no-op if color is disabled:
3907
3908 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3909 text
3910 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3911 text
3912
3913 Test branches inside if statement:
3914
3915 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3916 no
3917
3918 Test dict constructor:
3919
3920 $ hg log -r 0 -T '{dict(y=node|short, x=rev)}\n'
3921 y=f7769ec2ab97 x=0
3922 $ hg log -r 0 -T '{dict(x=rev, y=node|short) % "{key}={value}\n"}'
3923 x=0
3924 y=f7769ec2ab97
3925 $ hg log -r 0 -T '{dict(x=rev, y=node|short)|json}\n'
3926 {"x": 0, "y": "f7769ec2ab97"}
3927 $ hg log -r 0 -T '{dict()|json}\n'
3928 {}
3929
3930 $ hg log -r 0 -T '{dict(rev, node=node|short)}\n'
3931 rev=0 node=f7769ec2ab97
3932 $ hg log -r 0 -T '{dict(rev, node|short)}\n'
3933 rev=0 node=f7769ec2ab97
3934
3935 $ hg log -r 0 -T '{dict(rev, rev=rev)}\n'
3936 hg: parse error: duplicated dict key 'rev' inferred
3937 [255]
3938 $ hg log -r 0 -T '{dict(node, node|short)}\n'
3939 hg: parse error: duplicated dict key 'node' inferred
3940 [255]
3941 $ hg log -r 0 -T '{dict(1 + 2)}'
3942 hg: parse error: dict key cannot be inferred
3943 [255]
3944
3945 $ hg log -r 0 -T '{dict(x=rev, x=node)}'
3946 hg: parse error: dict got multiple values for keyword argument 'x'
3947 [255]
3948
3949 Test get function:
3950
3951 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3952 default
3953 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3954 default
3955 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3956 hg: parse error: not a dictionary
3957 (get() expects a dict as first argument)
3958 [255]
3959
3960 Test json filter applied to wrapped object:
3961
3962 $ hg log -r0 -T '{files|json}\n'
3963 ["a"]
3964 $ hg log -r0 -T '{extras|json}\n'
3965 {"branch": "default"}
3966 $ hg log -r0 -T '{date|json}\n'
3967 [0, 0]
3968
3969 Test json filter applied to map result:
3970
3971 $ hg log -r0 -T '{json(extras % "{key}")}\n'
3972 ["branch"]
3973
3974 Test localdate(date, tz) function:
3975
3976 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3977 1970-01-01 09:00 +0900
3978 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3979 1970-01-01 00:00 +0000
3980 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "blahUTC")|isodate}\n'
3981 hg: parse error: localdate expects a timezone
3982 [255]
3983 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3984 1970-01-01 02:00 +0200
3985 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3986 1970-01-01 00:00 +0000
3987 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3988 1970-01-01 00:00 +0000
3989 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3990 hg: parse error: localdate expects a timezone
3991 [255]
3992 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3993 hg: parse error: localdate expects a timezone
3994 [255]
3995
3996 Test shortest(node) function:
3997
3998 $ echo b > b
3999 $ hg ci -qAm b
4000 $ hg log --template '{shortest(node)}\n'
4001 e777
4002 bcc7
4003 f776
4004 $ hg log --template '{shortest(node, 10)}\n'
4005 e777603221
4006 bcc7ff960b
4007 f7769ec2ab
4008 $ hg log --template '{node|shortest}\n' -l1
4009 e777
4010
4011 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
4012 f7769ec2ab
4013 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
4014 hg: parse error: shortest() expects an integer minlength
4015 [255]
4016
4017 $ hg log -r 'wdir()' -T '{node|shortest}\n'
4018 ffff
4019
4020 $ hg log --template '{shortest("f")}\n' -l1
4021 f
4022
4023 $ hg log --template '{shortest("0123456789012345678901234567890123456789")}\n' -l1
4024 0123456789012345678901234567890123456789
4025
4026 $ hg log --template '{shortest("01234567890123456789012345678901234567890123456789")}\n' -l1
4027 01234567890123456789012345678901234567890123456789
4028
4029 $ hg log --template '{shortest("not a hex string")}\n' -l1
4030 not a hex string
4031
4032 $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1
4033 not a hex string, but it's 40 bytes long
4034
4035 $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1
4036 ffff
4037
4038 $ hg log --template '{shortest("fffffff")}\n' -l1
4039 ffff
4040
4041 $ hg log --template '{shortest("ff")}\n' -l1
4042 ffff
4043
4044 $ cd ..
4045
4046 Test shortest(node) with the repo having short hash collision:
4047
4048 $ hg init hashcollision
4049 $ cd hashcollision
4050 $ cat <<EOF >> .hg/hgrc
4051 > [experimental]
4052 > evolution.createmarkers=True
4053 > EOF
4054 $ echo 0 > a
4055 $ hg ci -qAm 0
4056 $ for i in 17 129 248 242 480 580 617 1057 2857 4025; do
4057 > hg up -q 0
4058 > echo $i > a
4059 > hg ci -qm $i
4060 > done
4061 $ hg up -q null
4062 $ hg log -r0: -T '{rev}:{node}\n'
4063 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
4064 1:11424df6dc1dd4ea255eae2b58eaca7831973bbc
4065 2:11407b3f1b9c3e76a79c1ec5373924df096f0499
4066 3:11dd92fe0f39dfdaacdaa5f3997edc533875cfc4
4067 4:10776689e627b465361ad5c296a20a487e153ca4
4068 5:a00be79088084cb3aff086ab799f8790e01a976b
4069 6:a0b0acd79b4498d0052993d35a6a748dd51d13e6
4070 7:a0457b3450b8e1b778f1163b31a435802987fe5d
4071 8:c56256a09cd28e5764f32e8e2810d0f01e2e357a
4072 9:c5623987d205cd6d9d8389bfc40fff9dbb670b48
4073 10:c562ddd9c94164376c20b86b0b4991636a3bf84f
4074 $ hg debugobsolete a00be79088084cb3aff086ab799f8790e01a976b
4075 obsoleted 1 changesets
4076 $ hg debugobsolete c5623987d205cd6d9d8389bfc40fff9dbb670b48
4077 obsoleted 1 changesets
4078 $ hg debugobsolete c562ddd9c94164376c20b86b0b4991636a3bf84f
4079 obsoleted 1 changesets
4080
4081 nodes starting with '11' (we don't have the revision number '11' though)
4082
4083 $ hg log -r 1:3 -T '{rev}:{shortest(node, 0)}\n'
4084 1:1142
4085 2:1140
4086 3:11d
4087
4088 '5:a00' is hidden, but still we have two nodes starting with 'a0'
4089
4090 $ hg log -r 6:7 -T '{rev}:{shortest(node, 0)}\n'
4091 6:a0b
4092 7:a04
4093
4094 node '10' conflicts with the revision number '10' even if it is hidden
4095 (we could exclude hidden revision numbers, but currently we don't)
4096
4097 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n'
4098 4:107
4099 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
4100 4:107
4101
4102 node 'c562' should be unique if the other 'c562' nodes are hidden
4103 (but we don't try the slow path to filter out hidden nodes for now)
4104
4105 $ hg log -r 8 -T '{rev}:{node|shortest}\n'
4106 8:c5625
4107 $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden
4108 8:c5625
4109 9:c5623
4110 10:c562d
4111
4112 $ cd ..
4113
4114 Test pad function
4115
4116 $ cd r
4117
4118 $ hg log --template '{pad(rev, 20)} {author|user}\n'
4119 2 test
4120 1 {node|short}
4121 0 test
4122
4123 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
4124 2 test
4125 1 {node|short}
4126 0 test
4127
4128 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
4129 2------------------- test
4130 1------------------- {node|short}
4131 0------------------- test
4132
4133 Test template string in pad function
4134
4135 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
4136 {0} test
4137
4138 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
4139 \{rev} test
4140
4141 Test width argument passed to pad function
4142
4143 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
4144 0 test
4145 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
4146 hg: parse error: pad() expects an integer width
4147 [255]
4148
4149 Test invalid fillchar passed to pad function
4150
4151 $ hg log -r 0 -T '{pad(rev, 10, "")}\n'
4152 hg: parse error: pad() expects a single fill character
4153 [255]
4154 $ hg log -r 0 -T '{pad(rev, 10, "--")}\n'
4155 hg: parse error: pad() expects a single fill character
4156 [255]
4157
4158 Test boolean argument passed to pad function
4159
4160 no crash
4161
4162 $ hg log -r 0 -T '{pad(rev, 10, "-", "f{"oo"}")}\n'
4163 ---------0
4164
4165 string/literal
4166
4167 $ hg log -r 0 -T '{pad(rev, 10, "-", "false")}\n'
4168 ---------0
4169 $ hg log -r 0 -T '{pad(rev, 10, "-", false)}\n'
4170 0---------
4171 $ hg log -r 0 -T '{pad(rev, 10, "-", "")}\n'
4172 0---------
4173
4174 unknown keyword is evaluated to ''
4175
4176 $ hg log -r 0 -T '{pad(rev, 10, "-", unknownkeyword)}\n'
4177 0---------
4178
4179 Test separate function
4180
4181 $ hg log -r 0 -T '{separate("-", "", "a", "b", "", "", "c", "")}\n'
4182 a-b-c
4183 $ hg log -r 0 -T '{separate(" ", "{rev}:{node|short}", author|user, branch)}\n'
4184 0:f7769ec2ab97 test default
4185 $ hg log -r 0 --color=always -T '{separate(" ", "a", label(red, "b"), "c", label(red, ""), "d")}\n'
4186 a \x1b[0;31mb\x1b[0m c d (esc)
4187
4188 Test boolean expression/literal passed to if function
4189
4190 $ hg log -r 0 -T '{if(rev, "rev 0 is True")}\n'
4191 rev 0 is True
4192 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n'
4193 literal 0 is True as well
4194 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n'
4195 empty string is False
4196 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n'
4197 empty list is False
4198 $ hg log -r 0 -T '{if(revset(r"0"), "non-empty list is True")}\n'
4199 non-empty list is True
4200 $ hg log -r 0 -T '{if(revset(r"0") % "", "list of empty strings is True")}\n'
4201 list of empty strings is True
4202 $ hg log -r 0 -T '{if(true, "true is True")}\n'
4203 true is True
4204 $ hg log -r 0 -T '{if(false, "", "false is False")}\n'
4205 false is False
4206 $ hg log -r 0 -T '{if("false", "non-empty string is True")}\n'
4207 non-empty string is True
4208
4209 Test ifcontains function
4210
4211 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
4212 2 is in the string
4213 1 is not
4214 0 is in the string
4215
4216 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
4217 2 is in the string
4218 1 is not
4219 0 is in the string
4220
4221 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
4222 2 did not add a
4223 1 did not add a
4224 0 added a
4225
4226 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
4227 2 is parent of 1
4228 1
4229 0
4230
4231 $ hg log -l1 -T '{ifcontains("branch", extras, "t", "f")}\n'
4232 t
4233 $ hg log -l1 -T '{ifcontains("branch", extras % "{key}", "t", "f")}\n'
4234 t
4235 $ hg log -l1 -T '{ifcontains("branc", extras % "{key}", "t", "f")}\n'
4236 f
4237 $ hg log -l1 -T '{ifcontains("branc", stringify(extras % "{key}"), "t", "f")}\n'
4238 t
4239
4240 Test revset function
4241
4242 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
4243 2 current rev
4244 1 not current rev
4245 0 not current rev
4246
4247 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
4248 2 match rev
4249 1 match rev
4250 0 not match rev
4251
4252 $ hg log -T '{ifcontains(desc, revset(":"), "", "type not match")}\n' -l1
4253 type not match
4254
4255 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
4256 2 Parents: 1
4257 1 Parents: 0
4258 0 Parents:
4259
4260 $ cat >> .hg/hgrc <<EOF
4261 > [revsetalias]
4262 > myparents(\$1) = parents(\$1)
4263 > EOF
4264 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
4265 2 Parents: 1
4266 1 Parents: 0
4267 0 Parents:
4268
4269 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
4270 Rev: 2
4271 Ancestor: 0
4272 Ancestor: 1
4273 Ancestor: 2
4274
4275 Rev: 1
4276 Ancestor: 0
4277 Ancestor: 1
4278
4279 Rev: 0
4280 Ancestor: 0
4281
4282 $ hg log --template '{revset("TIP"|lower)}\n' -l1
4283 2
4284
4285 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
4286 2
4287
4288 a list template is evaluated for each item of revset/parents
4289
4290 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
4291 2 p: 1:bcc7ff960b8e
4292 1 p: 0:f7769ec2ab97
4293 0 p:
4294
4295 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
4296 2 p: 1:bcc7ff960b8e -1:000000000000
4297 1 p: 0:f7769ec2ab97 -1:000000000000
4298 0 p: -1:000000000000 -1:000000000000
4299
4300 therefore, 'revcache' should be recreated for each rev
4301
4302 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
4303 2 aa b
4304 p
4305 1
4306 p a
4307 0 a
4308 p
4309
4310 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
4311 2 aa b
4312 p
4313 1
4314 p a
4315 0 a
4316 p
4317
4318 a revset item must be evaluated as an integer revision, not an offset from tip
4319
4320 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
4321 -1:000000000000
4322 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
4323 -1:000000000000
4324
4325 join() should pick '{rev}' from revset items:
4326
4327 $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6
4328 4, 5
4329
4330 on the other hand, parents are formatted as '{rev}:{node|formatnode}' by
4331 default. join() should agree with the default formatting:
4332
4333 $ hg log -R ../a -T '{join(parents, ", ")}\n' -r6
4334 5:13207e5a10d9, 4:bbe44766e73d
4335
4336 $ hg log -R ../a -T '{join(parents, ",\n")}\n' -r6 --debug
4337 5:13207e5a10d9fd28ec424934298e176197f2c67f,
4338 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
4339
4340 Invalid arguments passed to revset()
4341
4342 $ hg log -T '{revset("%whatever", 0)}\n'
4343 hg: parse error: unexpected revspec format character w
4344 [255]
4345 $ hg log -T '{revset("%lwhatever", files)}\n'
4346 hg: parse error: unexpected revspec format character w
4347 [255]
4348 $ hg log -T '{revset("%s %s", 0)}\n'
4349 hg: parse error: missing argument for revspec
4350 [255]
4351 $ hg log -T '{revset("", 0)}\n'
4352 hg: parse error: too many revspec arguments specified
4353 [255]
4354 $ hg log -T '{revset("%s", 0, 1)}\n'
4355 hg: parse error: too many revspec arguments specified
4356 [255]
4357 $ hg log -T '{revset("%", 0)}\n'
4358 hg: parse error: incomplete revspec format character
4359 [255]
4360 $ hg log -T '{revset("%l", 0)}\n'
4361 hg: parse error: incomplete revspec format character
4362 [255]
4363 $ hg log -T '{revset("%d", 'foo')}\n'
4364 hg: parse error: invalid argument for revspec
4365 [255]
4366 $ hg log -T '{revset("%ld", files)}\n'
4367 hg: parse error: invalid argument for revspec
4368 [255]
4369 $ hg log -T '{revset("%ls", 0)}\n'
4370 hg: parse error: invalid argument for revspec
4371 [255]
4372 $ hg log -T '{revset("%b", 'foo')}\n'
4373 hg: parse error: invalid argument for revspec
4374 [255]
4375 $ hg log -T '{revset("%lb", files)}\n'
4376 hg: parse error: invalid argument for revspec
4377 [255]
4378 $ hg log -T '{revset("%r", 0)}\n'
4379 hg: parse error: invalid argument for revspec
4380 [255]
4381
4382 Test 'originalnode'
4383
4384 $ hg log -r 1 -T '{revset("null") % "{node|short} {originalnode|short}"}\n'
4385 000000000000 bcc7ff960b8e
4386 $ hg log -r 0 -T '{manifest % "{node} {originalnode}"}\n'
4387 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 f7769ec2ab975ad19684098ad1ffd9b81ecc71a1
4388
4389 Test files function
4390
4391 $ hg log -T "{rev}\n{join(files('*'), '\n')}\n"
4392 2
4393 a
4394 aa
4395 b
4396 1
4397 a
4398 0
4399 a
4400
4401 $ hg log -T "{rev}\n{join(files('aa'), '\n')}\n"
4402 2
4403 aa
4404 1
4405
4406 0
4407
4408 $ hg rm a
4409 $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n"
4410 2147483647
4411 aa
4412 b
4413 $ hg revert a
4414
4415 Test relpath function
4416
4417 $ hg log -r0 -T '{files % "{file|relpath}\n"}'
4418 a
4419 $ cd ..
4420 $ hg log -R r -r0 -T '{files % "{file|relpath}\n"}'
4421 r/a
4422 $ cd r
4423
4424 Test active bookmark templating
4425
4426 $ hg book foo
4427 $ hg book bar
4428 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
4429 2 bar* foo
4430 1
4431 0
4432 $ hg log --template "{rev} {activebookmark}\n"
4433 2 bar
4434 1
4435 0
4436 $ hg bookmarks --inactive bar
4437 $ hg log --template "{rev} {activebookmark}\n"
4438 2
4439 1
4440 0
4441 $ hg book -r1 baz
4442 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
4443 2 bar foo
4444 1 baz
4445 0
4446 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
4447 2 t
4448 1 f
4449 0 f
4450
4451 Test namespaces dict
4452
4453 $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n'
4454 2
4455 bookmarks color=bookmark builtin=True
4456 bar,foo
4457 tags color=tag builtin=True
4458 tip
4459 branches color=branch builtin=True
4460 text.{rev}
4461 revnames color=revname builtin=False
4462 r2
4463
4464 1
4465 bookmarks color=bookmark builtin=True
4466 baz
4467 tags color=tag builtin=True
4468
4469 branches color=branch builtin=True
4470 text.{rev}
4471 revnames color=revname builtin=False
4472 r1
4473
4474 0
4475 bookmarks color=bookmark builtin=True
4476
4477 tags color=tag builtin=True
4478
4479 branches color=branch builtin=True
4480 default
4481 revnames color=revname builtin=False
4482 r0
4483
4484 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
4485 bookmarks: bar foo
4486 tags: tip
4487 branches: text.{rev}
4488 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
4489 bookmarks:
4490 bar
4491 foo
4492 tags:
4493 tip
4494 branches:
4495 text.{rev}
4496 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
4497 bar
4498 foo
4499 $ hg log -r2 -T '{namespaces.bookmarks % "{bookmark}\n"}'
4500 bar
4501 foo
4502
4503 Test stringify on sub expressions
4504
4505 $ cd ..
4506 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
4507 fourth, second, third
4508 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
4509 abc
4510
4511 Test splitlines
4512
4513 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
4514 @ foo Modify, add, remove, rename
4515 |
4516 o foo future
4517 |
4518 o foo third
4519 |
4520 o foo second
4521
4522 o foo merge
4523 |\
4524 | o foo new head
4525 | |
4526 o | foo new branch
4527 |/
4528 o foo no user, no domain
4529 |
4530 o foo no person
4531 |
4532 o foo other 1
4533 | foo other 2
4534 | foo
4535 | foo other 3
4536 o foo line 1
4537 foo line 2
4538
4539 $ hg log -R a -r0 -T '{desc|splitlines}\n'
4540 line 1 line 2
4541 $ hg log -R a -r0 -T '{join(desc|splitlines, "|")}\n'
4542 line 1|line 2
4543
4544 Test startswith
4545 $ hg log -Gv -R a --template "{startswith(desc)}"
4546 hg: parse error: startswith expects two arguments
4547 [255]
4548
4549 $ hg log -Gv -R a --template "{startswith('line', desc)}"
4550 @
4551 |
4552 o
4553 |
4554 o
4555 |
4556 o
4557
4558 o
4559 |\
4560 | o
4561 | |
4562 o |
4563 |/
4564 o
4565 |
4566 o
4567 |
4568 o
4569 |
4570 o line 1
4571 line 2
4572
4573 Test bad template with better error message
4574
4575 $ hg log -Gv -R a --template '{desc|user()}'
4576 hg: parse error: expected a symbol, got 'func'
4577 [255]
4578
4579 Test word function (including index out of bounds graceful failure)
4580
4581 $ hg log -Gv -R a --template "{word('1', desc)}"
4582 @ add,
4583 |
4584 o
4585 |
4586 o
4587 |
4588 o
4589
4590 o
4591 |\
4592 | o head
4593 | |
4594 o | branch
4595 |/
4596 o user,
4597 |
4598 o person
4599 |
4600 o 1
4601 |
4602 o 1
4603
4604
4605 Test word third parameter used as splitter
4606
4607 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
4608 @ M
4609 |
4610 o future
4611 |
4612 o third
4613 |
4614 o sec
4615
4616 o merge
4617 |\
4618 | o new head
4619 | |
4620 o | new branch
4621 |/
4622 o n
4623 |
4624 o n
4625 |
4626 o
4627 |
4628 o line 1
4629 line 2
4630
4631 Test word error messages for not enough and too many arguments
4632
4633 $ hg log -Gv -R a --template "{word('0')}"
4634 hg: parse error: word expects two or three arguments, got 1
4635 [255]
4636
4637 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
4638 hg: parse error: word expects two or three arguments, got 7
4639 [255]
4640
4641 Test word for integer literal
4642
4643 $ hg log -R a --template "{word(2, desc)}\n" -r0
4644 line
4645
4646 Test word for invalid numbers
4647
4648 $ hg log -Gv -R a --template "{word('a', desc)}"
4649 hg: parse error: word expects an integer index
4650 [255]
4651
4652 Test word for out of range
4653
4654 $ hg log -R a --template "{word(10000, desc)}"
4655 $ hg log -R a --template "{word(-10000, desc)}"
4656
4657 Test indent and not adding to empty lines
4658
4659 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
4660 -----
4661 > line 1
4662 >> line 2
4663 -----
4664 > other 1
4665 >> other 2
4666
4667 >> other 3
4668
4669 Test with non-strings like dates
4670
4671 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
4672 1200000.00
4673 1300000.00
4674
4675 Test broken string escapes:
4676
4677 $ hg log -T "bogus\\" -R a
4678 hg: parse error: trailing \ in string
4679 [255]
4680 $ hg log -T "\\xy" -R a
4681 hg: parse error: invalid \x escape* (glob)
4682 [255]
4683
4684 json filter should escape HTML tags so that the output can be embedded in hgweb:
4685
4686 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
4687 "\u003cfoo@example.org\u003e"
4688
4689 Templater supports aliases of symbol and func() styles:
4690
4691 $ hg clone -q a aliases
4692 $ cd aliases
4693 $ cat <<EOF >> .hg/hgrc
4694 > [templatealias]
4695 > r = rev
4696 > rn = "{r}:{node|short}"
4697 > status(c, files) = files % "{c} {file}\n"
4698 > utcdate(d) = localdate(d, "UTC")
4699 > EOF
4700
4701 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
4702 (template
4703 (symbol 'rn')
4704 (string ' ')
4705 (|
4706 (func
4707 (symbol 'utcdate')
4708 (symbol 'date'))
4709 (symbol 'isodate'))
4710 (string '\n'))
4711 * expanded:
4712 (template
4713 (template
4714 (symbol 'rev')
4715 (string ':')
4716 (|
4717 (symbol 'node')
4718 (symbol 'short')))
4719 (string ' ')
4720 (|
4721 (func
4722 (symbol 'localdate')
4723 (list
4724 (symbol 'date')
4725 (string 'UTC')))
4726 (symbol 'isodate'))
4727 (string '\n'))
4728 * keywords: date, node, rev
4729 * functions: isodate, localdate, short
4730 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4731
4732 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
4733 (template
4734 (func
4735 (symbol 'status')
4736 (list
4737 (string 'A')
4738 (symbol 'file_adds'))))
4739 * expanded:
4740 (template
4741 (%
4742 (symbol 'file_adds')
4743 (template
4744 (string 'A')
4745 (string ' ')
4746 (symbol 'file')
4747 (string '\n'))))
4748 * keywords: file, file_adds
4749 * functions:
4750 A a
4751
4752 A unary function alias can be called as a filter:
4753
4754 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
4755 (template
4756 (|
4757 (|
4758 (symbol 'date')
4759 (symbol 'utcdate'))
4760 (symbol 'isodate'))
4761 (string '\n'))
4762 * expanded:
4763 (template
4764 (|
4765 (func
4766 (symbol 'localdate')
4767 (list
4768 (symbol 'date')
4769 (string 'UTC')))
4770 (symbol 'isodate'))
4771 (string '\n'))
4772 * keywords: date
4773 * functions: isodate, localdate
4774 1970-01-12 13:46 +0000
4775
4776 Aliases should be applied only to command arguments and templates in hgrc.
4777 Otherwise, our stock styles and web templates could be corrupted:
4778
4779 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
4780 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4781
4782 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
4783 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4784
4785 $ cat <<EOF > tmpl
4786 > changeset = 'nothing expanded:{rn}\n'
4787 > EOF
4788 $ hg log -r0 --style ./tmpl
4789 nothing expanded:
4790
4791 Aliases in formatter:
4792
4793 $ hg branches -T '{pad(branch, 7)} {rn}\n'
4794 default 6:d41e714fe50d
4795 foo 4:bbe44766e73d
4796
4797 Aliases should honor HGPLAIN:
4798
4799 $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n'
4800 nothing expanded:
4801 $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n'
4802 0:1e4e1b8f71e0
4803
4804 Unparsable alias:
4805
4806 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
4807 (template
4808 (symbol 'bad'))
4809 abort: bad definition of template alias "bad": at 2: not a prefix: end
4810 [255]
4811 $ hg log --config templatealias.bad='x(' -T '{bad}'
4812 abort: bad definition of template alias "bad": at 2: not a prefix: end
4813 [255]
4814
4815 $ cd ..
4816
4817 Set up repository for non-ascii encoding tests:
4818
4819 $ hg init nonascii
4820 $ cd nonascii
4821 $ $PYTHON <<EOF
4822 > open('latin1', 'wb').write(b'\xe9')
4823 > open('utf-8', 'wb').write(b'\xc3\xa9')
4824 > EOF
4825 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
4826 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
4827
4828 json filter should try round-trip conversion to utf-8:
4829
4830 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
4831 "\u00e9"
4832 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
4833 "non-ascii branch: \u00e9"
4834
4835 json filter should take input as utf-8 if it was converted from utf-8:
4836
4837 $ HGENCODING=latin-1 hg log -T "{branch|json}\n" -r0
4838 "\u00e9"
4839 $ HGENCODING=latin-1 hg log -T "{desc|json}\n" -r0
4840 "non-ascii branch: \u00e9"
4841
4842 json filter takes input as utf-8b:
4843
4844 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
4845 "\u00e9"
4846 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
4847 "\udce9"
4848
4849 utf8 filter:
4850
4851 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
4852 round-trip: c3a9
4853 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
4854 decoded: c3a9
4855 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
4856 abort: decoding near * (glob)
4857 [255]
4858 $ hg log -T "coerced to string: {rev|utf8}\n" -r0
4859 coerced to string: 0
4860
4861 pad width:
4862
4863 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n"
4864 \xc3\xa9- (esc)
4865
4866 $ cd ..
4867
4868 Test that template function in extension is registered as expected
4869
4870 $ cd a
4871
4872 $ cat <<EOF > $TESTTMP/customfunc.py
4873 > from mercurial import registrar
4874 >
4875 > templatefunc = registrar.templatefunc()
4876 >
4877 > @templatefunc(b'custom()')
4878 > def custom(context, mapping, args):
4879 > return b'custom'
4880 > EOF
4881 $ cat <<EOF > .hg/hgrc
4882 > [extensions]
4883 > customfunc = $TESTTMP/customfunc.py
4884 > EOF
4885
4886 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
4887 custom
4888
4889 $ cd ..
4890
4891 Test 'graphwidth' in 'hg log' on various topologies. The key here is that the
4892 printed graphwidths 3, 5, 7, etc. should all line up in their respective
4893 columns. We don't care about other aspects of the graph rendering here.
4894
4895 $ hg init graphwidth
4896 $ cd graphwidth
4897
4898 $ wrappabletext="a a a a a a a a a a a a"
4899
4900 $ printf "first\n" > file
4901 $ hg add file
4902 $ hg commit -m "$wrappabletext"
4903
4904 $ printf "first\nsecond\n" > file
4905 $ hg commit -m "$wrappabletext"
4906
4907 $ hg checkout 0
4908 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4909 $ printf "third\nfirst\n" > file
4910 $ hg commit -m "$wrappabletext"
4911 created new head
4912
4913 $ hg merge
4914 merging file
4915 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
4916 (branch merge, don't forget to commit)
4917
4918 $ hg log --graph -T "{graphwidth}"
4919 @ 3
4920 |
4921 | @ 5
4922 |/
4923 o 3
4924
4925 $ hg commit -m "$wrappabletext"
4926
4927 $ hg log --graph -T "{graphwidth}"
4928 @ 5
4929 |\
4930 | o 5
4931 | |
4932 o | 5
4933 |/
4934 o 3
4935
4936
4937 $ hg checkout 0
4938 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4939 $ printf "third\nfirst\nsecond\n" > file
4940 $ hg commit -m "$wrappabletext"
4941 created new head
4942
4943 $ hg log --graph -T "{graphwidth}"
4944 @ 3
4945 |
4946 | o 7
4947 | |\
4948 +---o 7
4949 | |
4950 | o 5
4951 |/
4952 o 3
4953
4954
4955 $ hg log --graph -T "{graphwidth}" -r 3
4956 o 5
4957 |\
4958 ~ ~
4959
4960 $ hg log --graph -T "{graphwidth}" -r 1
4961 o 3
4962 |
4963 ~
4964
4965 $ hg merge
4966 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4967 (branch merge, don't forget to commit)
4968 $ hg commit -m "$wrappabletext"
4969
4970 $ printf "seventh\n" >> file
4971 $ hg commit -m "$wrappabletext"
4972
4973 $ hg log --graph -T "{graphwidth}"
4974 @ 3
4975 |
4976 o 5
4977 |\
4978 | o 5
4979 | |
4980 o | 7
4981 |\ \
4982 | o | 7
4983 | |/
4984 o / 5
4985 |/
4986 o 3
4987
4988
4989 The point of graphwidth is to allow wrapping that accounts for the space taken
4990 by the graph.
4991
4992 $ COLUMNS=10 hg log --graph -T "{fill(desc, termwidth - graphwidth)}"
4993 @ a a a a
4994 | a a a a
4995 | a a a a
4996 o a a a
4997 |\ a a a
4998 | | a a a
4999 | | a a a
5000 | o a a a
5001 | | a a a
5002 | | a a a
5003 | | a a a
5004 o | a a
5005 |\ \ a a
5006 | | | a a
5007 | | | a a
5008 | | | a a
5009 | | | a a
5010 | o | a a
5011 | |/ a a
5012 | | a a
5013 | | a a
5014 | | a a
5015 | | a a
5016 o | a a a
5017 |/ a a a
5018 | a a a
5019 | a a a
5020 o a a a a
5021 a a a a
5022 a a a a
5023
5024 Something tricky happens when there are elided nodes; the next drawn row of
5025 edges can be more than one column wider, but the graph width only increases by
5026 one column. The remaining columns are added in between the nodes.
5027
5028 $ hg log --graph -T "{graphwidth}" -r "0|2|4|5"
5029 o 5
5030 |\
5031 | \
5032 | :\
5033 o : : 7
5034 :/ /
5035 : o 5
5036 :/
5037 o 3
5038
5039
5040 $ cd ..
5041
General Comments 0
You need to be logged in to leave comments. Login now