##// END OF EJS Templates
templatekw: fix join format of parents keyword (issue5292)...
Yuya Nishihara -
r29624:1a129dd0 stable
parent child Browse files
Show More
@@ -1,585 +1,596
1 1 # templatekw.py - common changeset template keywords
2 2 #
3 3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from .node import hex, nullid
11 11 from . import (
12 12 encoding,
13 13 error,
14 14 hbisect,
15 15 patch,
16 16 registrar,
17 17 scmutil,
18 18 util,
19 19 )
20 20
21 21 # This helper class allows us to handle both:
22 22 # "{files}" (legacy command-line-specific list hack) and
23 23 # "{files % '{file}\n'}" (hgweb-style with inlining and function support)
24 24 # and to access raw values:
25 25 # "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
26 26 # "{get(extras, key)}"
27 27
28 28 class _hybrid(object):
29 29 def __init__(self, gen, values, makemap, joinfmt=None):
30 30 self.gen = gen
31 31 self.values = values
32 32 self._makemap = makemap
33 33 if joinfmt:
34 34 self.joinfmt = joinfmt
35 35 else:
36 36 self.joinfmt = lambda x: x.values()[0]
37 37 def __iter__(self):
38 38 return self.gen
39 39 def itermaps(self):
40 40 makemap = self._makemap
41 41 for x in self.values:
42 42 yield makemap(x)
43 43 def __contains__(self, x):
44 44 return x in self.values
45 45 def __len__(self):
46 46 return len(self.values)
47 47 def __getattr__(self, name):
48 48 if name != 'get':
49 49 raise AttributeError(name)
50 50 return getattr(self.values, name)
51 51
52 52 def showlist(name, values, plural=None, element=None, separator=' ', **args):
53 53 if not element:
54 54 element = name
55 55 f = _showlist(name, values, plural, separator, **args)
56 56 return _hybrid(f, values, lambda x: {element: x})
57 57
58 58 def _showlist(name, values, plural=None, separator=' ', **args):
59 59 '''expand set of values.
60 60 name is name of key in template map.
61 61 values is list of strings or dicts.
62 62 plural is plural of name, if not simply name + 's'.
63 63 separator is used to join values as a string
64 64
65 65 expansion works like this, given name 'foo'.
66 66
67 67 if values is empty, expand 'no_foos'.
68 68
69 69 if 'foo' not in template map, return values as a string,
70 70 joined by 'separator'.
71 71
72 72 expand 'start_foos'.
73 73
74 74 for each value, expand 'foo'. if 'last_foo' in template
75 75 map, expand it instead of 'foo' for last key.
76 76
77 77 expand 'end_foos'.
78 78 '''
79 79 templ = args['templ']
80 80 if plural:
81 81 names = plural
82 82 else: names = name + 's'
83 83 if not values:
84 84 noname = 'no_' + names
85 85 if noname in templ:
86 86 yield templ(noname, **args)
87 87 return
88 88 if name not in templ:
89 89 if isinstance(values[0], str):
90 90 yield separator.join(values)
91 91 else:
92 92 for v in values:
93 93 yield dict(v, **args)
94 94 return
95 95 startname = 'start_' + names
96 96 if startname in templ:
97 97 yield templ(startname, **args)
98 98 vargs = args.copy()
99 99 def one(v, tag=name):
100 100 try:
101 101 vargs.update(v)
102 102 except (AttributeError, ValueError):
103 103 try:
104 104 for a, b in v:
105 105 vargs[a] = b
106 106 except ValueError:
107 107 vargs[name] = v
108 108 return templ(tag, **vargs)
109 109 lastname = 'last_' + name
110 110 if lastname in templ:
111 111 last = values.pop()
112 112 else:
113 113 last = None
114 114 for v in values:
115 115 yield one(v)
116 116 if last is not None:
117 117 yield one(last, tag=lastname)
118 118 endname = 'end_' + names
119 119 if endname in templ:
120 120 yield templ(endname, **args)
121 121
122 def _formatrevnode(ctx):
123 """Format changeset as '{rev}:{node|formatnode}', which is the default
124 template provided by cmdutil.changeset_templater"""
125 repo = ctx.repo()
126 if repo.ui.debugflag:
127 hexnode = ctx.hex()
128 else:
129 hexnode = ctx.hex()[:12]
130 return '%d:%s' % (scmutil.intrev(ctx.rev()), hexnode)
131
122 132 def getfiles(repo, ctx, revcache):
123 133 if 'files' not in revcache:
124 134 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
125 135 return revcache['files']
126 136
127 137 def getlatesttags(repo, ctx, cache, pattern=None):
128 138 '''return date, distance and name for the latest tag of rev'''
129 139
130 140 cachename = 'latesttags'
131 141 if pattern is not None:
132 142 cachename += '-' + pattern
133 143 match = util.stringmatcher(pattern)[2]
134 144 else:
135 145 match = util.always
136 146
137 147 if cachename not in cache:
138 148 # Cache mapping from rev to a tuple with tag date, tag
139 149 # distance and tag name
140 150 cache[cachename] = {-1: (0, 0, ['null'])}
141 151 latesttags = cache[cachename]
142 152
143 153 rev = ctx.rev()
144 154 todo = [rev]
145 155 while todo:
146 156 rev = todo.pop()
147 157 if rev in latesttags:
148 158 continue
149 159 ctx = repo[rev]
150 160 tags = [t for t in ctx.tags()
151 161 if (repo.tagtype(t) and repo.tagtype(t) != 'local'
152 162 and match(t))]
153 163 if tags:
154 164 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
155 165 continue
156 166 try:
157 167 # The tuples are laid out so the right one can be found by
158 168 # comparison.
159 169 pdate, pdist, ptag = max(
160 170 latesttags[p.rev()] for p in ctx.parents())
161 171 except KeyError:
162 172 # Cache miss - recurse
163 173 todo.append(rev)
164 174 todo.extend(p.rev() for p in ctx.parents())
165 175 continue
166 176 latesttags[rev] = pdate, pdist + 1, ptag
167 177 return latesttags[rev]
168 178
169 179 def getrenamedfn(repo, endrev=None):
170 180 rcache = {}
171 181 if endrev is None:
172 182 endrev = len(repo)
173 183
174 184 def getrenamed(fn, rev):
175 185 '''looks up all renames for a file (up to endrev) the first
176 186 time the file is given. It indexes on the changerev and only
177 187 parses the manifest if linkrev != changerev.
178 188 Returns rename info for fn at changerev rev.'''
179 189 if fn not in rcache:
180 190 rcache[fn] = {}
181 191 fl = repo.file(fn)
182 192 for i in fl:
183 193 lr = fl.linkrev(i)
184 194 renamed = fl.renamed(fl.node(i))
185 195 rcache[fn][lr] = renamed
186 196 if lr >= endrev:
187 197 break
188 198 if rev in rcache[fn]:
189 199 return rcache[fn][rev]
190 200
191 201 # If linkrev != rev (i.e. rev not found in rcache) fallback to
192 202 # filectx logic.
193 203 try:
194 204 return repo[rev][fn].renamed()
195 205 except error.LookupError:
196 206 return None
197 207
198 208 return getrenamed
199 209
200 210 # keywords are callables like:
201 211 # fn(repo, ctx, templ, cache, revcache, **args)
202 212 # with:
203 213 # repo - current repository instance
204 214 # ctx - the changectx being displayed
205 215 # templ - the templater instance
206 216 # cache - a cache dictionary for the whole templater run
207 217 # revcache - a cache dictionary for the current revision
208 218 keywords = {}
209 219
210 220 templatekeyword = registrar.templatekeyword(keywords)
211 221
212 222 @templatekeyword('author')
213 223 def showauthor(repo, ctx, templ, **args):
214 224 """String. The unmodified author of the changeset."""
215 225 return ctx.user()
216 226
217 227 @templatekeyword('bisect')
218 228 def showbisect(repo, ctx, templ, **args):
219 229 """String. The changeset bisection status."""
220 230 return hbisect.label(repo, ctx.node())
221 231
222 232 @templatekeyword('branch')
223 233 def showbranch(**args):
224 234 """String. The name of the branch on which the changeset was
225 235 committed.
226 236 """
227 237 return args['ctx'].branch()
228 238
229 239 @templatekeyword('branches')
230 240 def showbranches(**args):
231 241 """List of strings. The name of the branch on which the
232 242 changeset was committed. Will be empty if the branch name was
233 243 default. (DEPRECATED)
234 244 """
235 245 branch = args['ctx'].branch()
236 246 if branch != 'default':
237 247 return showlist('branch', [branch], plural='branches', **args)
238 248 return showlist('branch', [], plural='branches', **args)
239 249
240 250 @templatekeyword('bookmarks')
241 251 def showbookmarks(**args):
242 252 """List of strings. Any bookmarks associated with the
243 253 changeset. Also sets 'active', the name of the active bookmark.
244 254 """
245 255 repo = args['ctx']._repo
246 256 bookmarks = args['ctx'].bookmarks()
247 257 active = repo._activebookmark
248 258 makemap = lambda v: {'bookmark': v, 'active': active, 'current': active}
249 259 f = _showlist('bookmark', bookmarks, **args)
250 260 return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark'])
251 261
252 262 @templatekeyword('children')
253 263 def showchildren(**args):
254 264 """List of strings. The children of the changeset."""
255 265 ctx = args['ctx']
256 266 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
257 267 return showlist('children', childrevs, element='child', **args)
258 268
259 269 # Deprecated, but kept alive for help generation a purpose.
260 270 @templatekeyword('currentbookmark')
261 271 def showcurrentbookmark(**args):
262 272 """String. The active bookmark, if it is
263 273 associated with the changeset (DEPRECATED)"""
264 274 return showactivebookmark(**args)
265 275
266 276 @templatekeyword('activebookmark')
267 277 def showactivebookmark(**args):
268 278 """String. The active bookmark, if it is
269 279 associated with the changeset"""
270 280 active = args['repo']._activebookmark
271 281 if active and active in args['ctx'].bookmarks():
272 282 return active
273 283 return ''
274 284
275 285 @templatekeyword('date')
276 286 def showdate(repo, ctx, templ, **args):
277 287 """Date information. The date when the changeset was committed."""
278 288 return ctx.date()
279 289
280 290 @templatekeyword('desc')
281 291 def showdescription(repo, ctx, templ, **args):
282 292 """String. The text of the changeset description."""
283 293 s = ctx.description()
284 294 if isinstance(s, encoding.localstr):
285 295 # try hard to preserve utf-8 bytes
286 296 return encoding.tolocal(encoding.fromlocal(s).strip())
287 297 else:
288 298 return s.strip()
289 299
290 300 @templatekeyword('diffstat')
291 301 def showdiffstat(repo, ctx, templ, **args):
292 302 """String. Statistics of changes with the following format:
293 303 "modified files: +added/-removed lines"
294 304 """
295 305 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
296 306 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
297 307 return '%s: +%s/-%s' % (len(stats), adds, removes)
298 308
299 309 @templatekeyword('extras')
300 310 def showextras(**args):
301 311 """List of dicts with key, value entries of the 'extras'
302 312 field of this changeset."""
303 313 extras = args['ctx'].extra()
304 314 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
305 315 makemap = lambda k: {'key': k, 'value': extras[k]}
306 316 c = [makemap(k) for k in extras]
307 317 f = _showlist('extra', c, plural='extras', **args)
308 318 return _hybrid(f, extras, makemap,
309 319 lambda x: '%s=%s' % (x['key'], x['value']))
310 320
311 321 @templatekeyword('file_adds')
312 322 def showfileadds(**args):
313 323 """List of strings. Files added by this changeset."""
314 324 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
315 325 return showlist('file_add', getfiles(repo, ctx, revcache)[1],
316 326 element='file', **args)
317 327
318 328 @templatekeyword('file_copies')
319 329 def showfilecopies(**args):
320 330 """List of strings. Files copied in this changeset with
321 331 their sources.
322 332 """
323 333 cache, ctx = args['cache'], args['ctx']
324 334 copies = args['revcache'].get('copies')
325 335 if copies is None:
326 336 if 'getrenamed' not in cache:
327 337 cache['getrenamed'] = getrenamedfn(args['repo'])
328 338 copies = []
329 339 getrenamed = cache['getrenamed']
330 340 for fn in ctx.files():
331 341 rename = getrenamed(fn, ctx.rev())
332 342 if rename:
333 343 copies.append((fn, rename[0]))
334 344
335 345 copies = util.sortdict(copies)
336 346 makemap = lambda k: {'name': k, 'source': copies[k]}
337 347 c = [makemap(k) for k in copies]
338 348 f = _showlist('file_copy', c, plural='file_copies', **args)
339 349 return _hybrid(f, copies, makemap,
340 350 lambda x: '%s (%s)' % (x['name'], x['source']))
341 351
342 352 # showfilecopiesswitch() displays file copies only if copy records are
343 353 # provided before calling the templater, usually with a --copies
344 354 # command line switch.
345 355 @templatekeyword('file_copies_switch')
346 356 def showfilecopiesswitch(**args):
347 357 """List of strings. Like "file_copies" but displayed
348 358 only if the --copied switch is set.
349 359 """
350 360 copies = args['revcache'].get('copies') or []
351 361 copies = util.sortdict(copies)
352 362 makemap = lambda k: {'name': k, 'source': copies[k]}
353 363 c = [makemap(k) for k in copies]
354 364 f = _showlist('file_copy', c, plural='file_copies', **args)
355 365 return _hybrid(f, copies, makemap,
356 366 lambda x: '%s (%s)' % (x['name'], x['source']))
357 367
358 368 @templatekeyword('file_dels')
359 369 def showfiledels(**args):
360 370 """List of strings. Files removed by this changeset."""
361 371 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
362 372 return showlist('file_del', getfiles(repo, ctx, revcache)[2],
363 373 element='file', **args)
364 374
365 375 @templatekeyword('file_mods')
366 376 def showfilemods(**args):
367 377 """List of strings. Files modified by this changeset."""
368 378 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
369 379 return showlist('file_mod', getfiles(repo, ctx, revcache)[0],
370 380 element='file', **args)
371 381
372 382 @templatekeyword('files')
373 383 def showfiles(**args):
374 384 """List of strings. All files modified, added, or removed by this
375 385 changeset.
376 386 """
377 387 return showlist('file', args['ctx'].files(), **args)
378 388
379 389 @templatekeyword('graphnode')
380 390 def showgraphnode(repo, ctx, **args):
381 391 """String. The character representing the changeset node in
382 392 an ASCII revision graph"""
383 393 wpnodes = repo.dirstate.parents()
384 394 if wpnodes[1] == nullid:
385 395 wpnodes = wpnodes[:1]
386 396 if ctx.node() in wpnodes:
387 397 return '@'
388 398 elif ctx.obsolete():
389 399 return 'x'
390 400 elif ctx.closesbranch():
391 401 return '_'
392 402 else:
393 403 return 'o'
394 404
395 405 @templatekeyword('latesttag')
396 406 def showlatesttag(**args):
397 407 """List of strings. The global tags on the most recent globally
398 408 tagged ancestor of this changeset.
399 409 """
400 410 return showlatesttags(None, **args)
401 411
402 412 def showlatesttags(pattern, **args):
403 413 """helper method for the latesttag keyword and function"""
404 414 repo, ctx = args['repo'], args['ctx']
405 415 cache = args['cache']
406 416 latesttags = getlatesttags(repo, ctx, cache, pattern)
407 417
408 418 # latesttag[0] is an implementation detail for sorting csets on different
409 419 # branches in a stable manner- it is the date the tagged cset was created,
410 420 # not the date the tag was created. Therefore it isn't made visible here.
411 421 makemap = lambda v: {
412 422 'changes': _showchangessincetag,
413 423 'distance': latesttags[1],
414 424 'latesttag': v, # BC with {latesttag % '{latesttag}'}
415 425 'tag': v
416 426 }
417 427
418 428 tags = latesttags[2]
419 429 f = _showlist('latesttag', tags, separator=':', **args)
420 430 return _hybrid(f, tags, makemap, lambda x: x['latesttag'])
421 431
422 432 @templatekeyword('latesttagdistance')
423 433 def showlatesttagdistance(repo, ctx, templ, cache, **args):
424 434 """Integer. Longest path to the latest tag."""
425 435 return getlatesttags(repo, ctx, cache)[1]
426 436
427 437 @templatekeyword('changessincelatesttag')
428 438 def showchangessincelatesttag(repo, ctx, templ, cache, **args):
429 439 """Integer. All ancestors not in the latest tag."""
430 440 latesttag = getlatesttags(repo, ctx, cache)[2][0]
431 441
432 442 return _showchangessincetag(repo, ctx, tag=latesttag, **args)
433 443
434 444 def _showchangessincetag(repo, ctx, **args):
435 445 offset = 0
436 446 revs = [ctx.rev()]
437 447 tag = args['tag']
438 448
439 449 # The only() revset doesn't currently support wdir()
440 450 if ctx.rev() is None:
441 451 offset = 1
442 452 revs = [p.rev() for p in ctx.parents()]
443 453
444 454 return len(repo.revs('only(%ld, %s)', revs, tag)) + offset
445 455
446 456 @templatekeyword('manifest')
447 457 def showmanifest(**args):
448 458 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
449 459 mnode = ctx.manifestnode()
450 460 if mnode is None:
451 461 # just avoid crash, we might want to use the 'ff...' hash in future
452 462 return
453 463 args = args.copy()
454 464 args.update({'rev': repo.manifest.rev(mnode), 'node': hex(mnode)})
455 465 return templ('manifest', **args)
456 466
457 467 def shownames(namespace, **args):
458 468 """helper method to generate a template keyword for a namespace"""
459 469 ctx = args['ctx']
460 470 repo = ctx.repo()
461 471 ns = repo.names[namespace]
462 472 names = ns.names(repo, ctx.node())
463 473 return showlist(ns.templatename, names, plural=namespace, **args)
464 474
465 475 @templatekeyword('namespaces')
466 476 def shownamespaces(**args):
467 477 """Dict of lists. Names attached to this changeset per
468 478 namespace."""
469 479 ctx = args['ctx']
470 480 repo = ctx.repo()
471 481 namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()),
472 482 **args))
473 483 for k, ns in repo.names.iteritems())
474 484 f = _showlist('namespace', list(namespaces), **args)
475 485 return _hybrid(f, namespaces,
476 486 lambda k: {'namespace': k, 'names': namespaces[k]},
477 487 lambda x: x['namespace'])
478 488
479 489 @templatekeyword('node')
480 490 def shownode(repo, ctx, templ, **args):
481 491 """String. The changeset identification hash, as a 40 hexadecimal
482 492 digit string.
483 493 """
484 494 return ctx.hex()
485 495
486 496 @templatekeyword('p1rev')
487 497 def showp1rev(repo, ctx, templ, **args):
488 498 """Integer. The repository-local revision number of the changeset's
489 499 first parent, or -1 if the changeset has no parents."""
490 500 return ctx.p1().rev()
491 501
492 502 @templatekeyword('p2rev')
493 503 def showp2rev(repo, ctx, templ, **args):
494 504 """Integer. The repository-local revision number of the changeset's
495 505 second parent, or -1 if the changeset has no second parent."""
496 506 return ctx.p2().rev()
497 507
498 508 @templatekeyword('p1node')
499 509 def showp1node(repo, ctx, templ, **args):
500 510 """String. The identification hash of the changeset's first parent,
501 511 as a 40 digit hexadecimal string. If the changeset has no parents, all
502 512 digits are 0."""
503 513 return ctx.p1().hex()
504 514
505 515 @templatekeyword('p2node')
506 516 def showp2node(repo, ctx, templ, **args):
507 517 """String. The identification hash of the changeset's second
508 518 parent, as a 40 digit hexadecimal string. If the changeset has no second
509 519 parent, all digits are 0."""
510 520 return ctx.p2().hex()
511 521
512 522 @templatekeyword('parents')
513 523 def showparents(**args):
514 524 """List of strings. The parents of the changeset in "rev:node"
515 525 format. If the changeset has only one "natural" parent (the predecessor
516 526 revision) nothing is shown."""
517 527 repo = args['repo']
518 528 ctx = args['ctx']
519 529 pctxs = scmutil.meaningfulparents(repo, ctx)
520 530 prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str
521 531 parents = [[('rev', p.rev()),
522 532 ('node', p.hex()),
523 533 ('phase', p.phasestr())]
524 534 for p in pctxs]
525 535 f = _showlist('parent', parents, **args)
526 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}})
536 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
537 lambda d: _formatrevnode(d['ctx']))
527 538
528 539 @templatekeyword('phase')
529 540 def showphase(repo, ctx, templ, **args):
530 541 """String. The changeset phase name."""
531 542 return ctx.phasestr()
532 543
533 544 @templatekeyword('phaseidx')
534 545 def showphaseidx(repo, ctx, templ, **args):
535 546 """Integer. The changeset phase index."""
536 547 return ctx.phase()
537 548
538 549 @templatekeyword('rev')
539 550 def showrev(repo, ctx, templ, **args):
540 551 """Integer. The repository-local changeset revision number."""
541 552 return scmutil.intrev(ctx.rev())
542 553
543 554 def showrevslist(name, revs, **args):
544 555 """helper to generate a list of revisions in which a mapped template will
545 556 be evaluated"""
546 557 repo = args['ctx'].repo()
547 558 revs = [str(r) for r in revs] # ifcontains() needs a list of str
548 559 f = _showlist(name, revs, **args)
549 560 return _hybrid(f, revs,
550 561 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
551 562 lambda d: d[name])
552 563
553 564 @templatekeyword('subrepos')
554 565 def showsubrepos(**args):
555 566 """List of strings. Updated subrepositories in the changeset."""
556 567 ctx = args['ctx']
557 568 substate = ctx.substate
558 569 if not substate:
559 570 return showlist('subrepo', [], **args)
560 571 psubstate = ctx.parents()[0].substate or {}
561 572 subrepos = []
562 573 for sub in substate:
563 574 if sub not in psubstate or substate[sub] != psubstate[sub]:
564 575 subrepos.append(sub) # modified or newly added in ctx
565 576 for sub in psubstate:
566 577 if sub not in substate:
567 578 subrepos.append(sub) # removed in ctx
568 579 return showlist('subrepo', sorted(subrepos), **args)
569 580
570 581 # don't remove "showtags" definition, even though namespaces will put
571 582 # a helper function for "tags" keyword into "keywords" map automatically,
572 583 # because online help text is built without namespaces initialization
573 584 @templatekeyword('tags')
574 585 def showtags(**args):
575 586 """List of strings. Any tags associated with the changeset."""
576 587 return shownames('tags', **args)
577 588
578 589 def loadkeyword(ui, extname, registrarobj):
579 590 """Load template keyword from specified registrarobj
580 591 """
581 592 for name, func in registrarobj._table.iteritems():
582 593 keywords[name] = func
583 594
584 595 # tell hggettext to extract docstrings from these functions:
585 596 i18nfunctions = keywords.values()
@@ -1,3854 +1,3864
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 Second branch starting at nullrev:
33 33
34 34 $ hg update null
35 35 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
36 36 $ echo second > second
37 37 $ hg add second
38 38 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
39 39 created new head
40 40
41 41 $ echo third > third
42 42 $ hg add third
43 43 $ hg mv second fourth
44 44 $ hg commit -m third -d "2020-01-01 10:01"
45 45
46 46 $ hg log --template '{join(file_copies, ",\n")}\n' -r .
47 47 fourth (second)
48 48 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
49 49 second -> fourth
50 50 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
51 51 8 t
52 52 7 f
53 53
54 54 Working-directory revision has special identifiers, though they are still
55 55 experimental:
56 56
57 57 $ hg log -r 'wdir()' -T '{rev}:{node}\n'
58 58 2147483647:ffffffffffffffffffffffffffffffffffffffff
59 59
60 60 Some keywords are invalid for working-directory revision, but they should
61 61 never cause crash:
62 62
63 63 $ hg log -r 'wdir()' -T '{manifest}\n'
64 64
65 65
66 66 Quoting for ui.logtemplate
67 67
68 68 $ hg tip --config "ui.logtemplate={rev}\n"
69 69 8
70 70 $ hg tip --config "ui.logtemplate='{rev}\n'"
71 71 8
72 72 $ hg tip --config 'ui.logtemplate="{rev}\n"'
73 73 8
74 74 $ hg tip --config 'ui.logtemplate=n{rev}\n'
75 75 n8
76 76
77 77 Make sure user/global hgrc does not affect tests
78 78
79 79 $ echo '[ui]' > .hg/hgrc
80 80 $ echo 'logtemplate =' >> .hg/hgrc
81 81 $ echo 'style =' >> .hg/hgrc
82 82
83 83 Add some simple styles to settings
84 84
85 85 $ echo '[templates]' >> .hg/hgrc
86 86 $ printf 'simple = "{rev}\\n"\n' >> .hg/hgrc
87 87 $ printf 'simple2 = {rev}\\n\n' >> .hg/hgrc
88 88
89 89 $ hg log -l1 -Tsimple
90 90 8
91 91 $ hg log -l1 -Tsimple2
92 92 8
93 93
94 94 Test templates and style maps in files:
95 95
96 96 $ echo "{rev}" > tmpl
97 97 $ hg log -l1 -T./tmpl
98 98 8
99 99 $ hg log -l1 -Tblah/blah
100 100 blah/blah (no-eol)
101 101
102 102 $ printf 'changeset = "{rev}\\n"\n' > map-simple
103 103 $ hg log -l1 -T./map-simple
104 104 8
105 105
106 106 Template should precede style option
107 107
108 108 $ hg log -l1 --style default -T '{rev}\n'
109 109 8
110 110
111 111 Add a commit with empty description, to ensure that the templates
112 112 below will omit the description line.
113 113
114 114 $ echo c >> c
115 115 $ hg add c
116 116 $ hg commit -qm ' '
117 117
118 118 Default style is like normal output. Phases style should be the same
119 119 as default style, except for extra phase lines.
120 120
121 121 $ hg log > log.out
122 122 $ hg log --style default > style.out
123 123 $ cmp log.out style.out || diff -u log.out style.out
124 124 $ hg log -T phases > phases.out
125 125 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
126 126 +phase: draft
127 127 +phase: draft
128 128 +phase: draft
129 129 +phase: draft
130 130 +phase: draft
131 131 +phase: draft
132 132 +phase: draft
133 133 +phase: draft
134 134 +phase: draft
135 135 +phase: draft
136 136
137 137 $ hg log -v > log.out
138 138 $ hg log -v --style default > style.out
139 139 $ cmp log.out style.out || diff -u log.out style.out
140 140 $ hg log -v -T phases > phases.out
141 141 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
142 142 +phase: draft
143 143 +phase: draft
144 144 +phase: draft
145 145 +phase: draft
146 146 +phase: draft
147 147 +phase: draft
148 148 +phase: draft
149 149 +phase: draft
150 150 +phase: draft
151 151 +phase: draft
152 152
153 153 $ hg log -q > log.out
154 154 $ hg log -q --style default > style.out
155 155 $ cmp log.out style.out || diff -u log.out style.out
156 156 $ hg log -q -T phases > phases.out
157 157 $ cmp log.out phases.out || diff -u log.out phases.out
158 158
159 159 $ hg log --debug > log.out
160 160 $ hg log --debug --style default > style.out
161 161 $ cmp log.out style.out || diff -u log.out style.out
162 162 $ hg log --debug -T phases > phases.out
163 163 $ cmp log.out phases.out || diff -u log.out phases.out
164 164
165 165 Default style of working-directory revision should also be the same (but
166 166 date may change while running tests):
167 167
168 168 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
169 169 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
170 170 $ cmp log.out style.out || diff -u log.out style.out
171 171
172 172 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
173 173 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
174 174 $ cmp log.out style.out || diff -u log.out style.out
175 175
176 176 $ hg log -r 'wdir()' -q > log.out
177 177 $ hg log -r 'wdir()' -q --style default > style.out
178 178 $ cmp log.out style.out || diff -u log.out style.out
179 179
180 180 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
181 181 $ hg log -r 'wdir()' --debug --style default \
182 182 > | sed 's|^date:.*|date:|' > style.out
183 183 $ cmp log.out style.out || diff -u log.out style.out
184 184
185 185 Default style should also preserve color information (issue2866):
186 186
187 187 $ cp $HGRCPATH $HGRCPATH-bak
188 188 $ cat <<EOF >> $HGRCPATH
189 189 > [extensions]
190 190 > color=
191 191 > EOF
192 192
193 193 $ hg --color=debug log > log.out
194 194 $ hg --color=debug log --style default > style.out
195 195 $ cmp log.out style.out || diff -u log.out style.out
196 196 $ hg --color=debug log -T phases > phases.out
197 197 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
198 198 +[log.phase|phase: draft]
199 199 +[log.phase|phase: draft]
200 200 +[log.phase|phase: draft]
201 201 +[log.phase|phase: draft]
202 202 +[log.phase|phase: draft]
203 203 +[log.phase|phase: draft]
204 204 +[log.phase|phase: draft]
205 205 +[log.phase|phase: draft]
206 206 +[log.phase|phase: draft]
207 207 +[log.phase|phase: draft]
208 208
209 209 $ hg --color=debug -v log > log.out
210 210 $ hg --color=debug -v log --style default > style.out
211 211 $ cmp log.out style.out || diff -u log.out style.out
212 212 $ hg --color=debug -v log -T phases > phases.out
213 213 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
214 214 +[log.phase|phase: draft]
215 215 +[log.phase|phase: draft]
216 216 +[log.phase|phase: draft]
217 217 +[log.phase|phase: draft]
218 218 +[log.phase|phase: draft]
219 219 +[log.phase|phase: draft]
220 220 +[log.phase|phase: draft]
221 221 +[log.phase|phase: draft]
222 222 +[log.phase|phase: draft]
223 223 +[log.phase|phase: draft]
224 224
225 225 $ hg --color=debug -q log > log.out
226 226 $ hg --color=debug -q log --style default > style.out
227 227 $ cmp log.out style.out || diff -u log.out style.out
228 228 $ hg --color=debug -q log -T phases > phases.out
229 229 $ cmp log.out phases.out || diff -u log.out phases.out
230 230
231 231 $ hg --color=debug --debug log > log.out
232 232 $ hg --color=debug --debug log --style default > style.out
233 233 $ cmp log.out style.out || diff -u log.out style.out
234 234 $ hg --color=debug --debug log -T phases > phases.out
235 235 $ cmp log.out phases.out || diff -u log.out phases.out
236 236
237 237 $ mv $HGRCPATH-bak $HGRCPATH
238 238
239 239 Remove commit with empty commit message, so as to not pollute further
240 240 tests.
241 241
242 242 $ hg --config extensions.strip= strip -q .
243 243
244 244 Revision with no copies (used to print a traceback):
245 245
246 246 $ hg tip -v --template '\n'
247 247
248 248
249 249 Compact style works:
250 250
251 251 $ hg log -Tcompact
252 252 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
253 253 third
254 254
255 255 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
256 256 second
257 257
258 258 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
259 259 merge
260 260
261 261 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
262 262 new head
263 263
264 264 4 bbe44766e73d 1970-01-17 04:53 +0000 person
265 265 new branch
266 266
267 267 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
268 268 no user, no domain
269 269
270 270 2 97054abb4ab8 1970-01-14 21:20 +0000 other
271 271 no person
272 272
273 273 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
274 274 other 1
275 275
276 276 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
277 277 line 1
278 278
279 279
280 280 $ hg log -v --style compact
281 281 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
282 282 third
283 283
284 284 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
285 285 second
286 286
287 287 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
288 288 merge
289 289
290 290 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
291 291 new head
292 292
293 293 4 bbe44766e73d 1970-01-17 04:53 +0000 person
294 294 new branch
295 295
296 296 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
297 297 no user, no domain
298 298
299 299 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
300 300 no person
301 301
302 302 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
303 303 other 1
304 304 other 2
305 305
306 306 other 3
307 307
308 308 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
309 309 line 1
310 310 line 2
311 311
312 312
313 313 $ hg log --debug --style compact
314 314 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
315 315 third
316 316
317 317 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
318 318 second
319 319
320 320 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
321 321 merge
322 322
323 323 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
324 324 new head
325 325
326 326 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
327 327 new branch
328 328
329 329 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
330 330 no user, no domain
331 331
332 332 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
333 333 no person
334 334
335 335 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
336 336 other 1
337 337 other 2
338 338
339 339 other 3
340 340
341 341 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
342 342 line 1
343 343 line 2
344 344
345 345
346 346 Test xml styles:
347 347
348 348 $ hg log --style xml -r 'not all()'
349 349 <?xml version="1.0"?>
350 350 <log>
351 351 </log>
352 352
353 353 $ hg log --style xml
354 354 <?xml version="1.0"?>
355 355 <log>
356 356 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
357 357 <tag>tip</tag>
358 358 <author email="test">test</author>
359 359 <date>2020-01-01T10:01:00+00:00</date>
360 360 <msg xml:space="preserve">third</msg>
361 361 </logentry>
362 362 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
363 363 <parent revision="-1" node="0000000000000000000000000000000000000000" />
364 364 <author email="user@hostname">User Name</author>
365 365 <date>1970-01-12T13:46:40+00:00</date>
366 366 <msg xml:space="preserve">second</msg>
367 367 </logentry>
368 368 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
369 369 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
370 370 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
371 371 <author email="person">person</author>
372 372 <date>1970-01-18T08:40:01+00:00</date>
373 373 <msg xml:space="preserve">merge</msg>
374 374 </logentry>
375 375 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
376 376 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
377 377 <author email="person">person</author>
378 378 <date>1970-01-18T08:40:00+00:00</date>
379 379 <msg xml:space="preserve">new head</msg>
380 380 </logentry>
381 381 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
382 382 <branch>foo</branch>
383 383 <author email="person">person</author>
384 384 <date>1970-01-17T04:53:20+00:00</date>
385 385 <msg xml:space="preserve">new branch</msg>
386 386 </logentry>
387 387 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
388 388 <author email="person">person</author>
389 389 <date>1970-01-16T01:06:40+00:00</date>
390 390 <msg xml:space="preserve">no user, no domain</msg>
391 391 </logentry>
392 392 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
393 393 <author email="other@place">other</author>
394 394 <date>1970-01-14T21:20:00+00:00</date>
395 395 <msg xml:space="preserve">no person</msg>
396 396 </logentry>
397 397 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
398 398 <author email="other@place">A. N. Other</author>
399 399 <date>1970-01-13T17:33:20+00:00</date>
400 400 <msg xml:space="preserve">other 1
401 401 other 2
402 402
403 403 other 3</msg>
404 404 </logentry>
405 405 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
406 406 <author email="user@hostname">User Name</author>
407 407 <date>1970-01-12T13:46:40+00:00</date>
408 408 <msg xml:space="preserve">line 1
409 409 line 2</msg>
410 410 </logentry>
411 411 </log>
412 412
413 413 $ hg log -v --style xml
414 414 <?xml version="1.0"?>
415 415 <log>
416 416 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
417 417 <tag>tip</tag>
418 418 <author email="test">test</author>
419 419 <date>2020-01-01T10:01:00+00:00</date>
420 420 <msg xml:space="preserve">third</msg>
421 421 <paths>
422 422 <path action="A">fourth</path>
423 423 <path action="A">third</path>
424 424 <path action="R">second</path>
425 425 </paths>
426 426 <copies>
427 427 <copy source="second">fourth</copy>
428 428 </copies>
429 429 </logentry>
430 430 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
431 431 <parent revision="-1" node="0000000000000000000000000000000000000000" />
432 432 <author email="user@hostname">User Name</author>
433 433 <date>1970-01-12T13:46:40+00:00</date>
434 434 <msg xml:space="preserve">second</msg>
435 435 <paths>
436 436 <path action="A">second</path>
437 437 </paths>
438 438 </logentry>
439 439 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
440 440 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
441 441 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
442 442 <author email="person">person</author>
443 443 <date>1970-01-18T08:40:01+00:00</date>
444 444 <msg xml:space="preserve">merge</msg>
445 445 <paths>
446 446 </paths>
447 447 </logentry>
448 448 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
449 449 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
450 450 <author email="person">person</author>
451 451 <date>1970-01-18T08:40:00+00:00</date>
452 452 <msg xml:space="preserve">new head</msg>
453 453 <paths>
454 454 <path action="A">d</path>
455 455 </paths>
456 456 </logentry>
457 457 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
458 458 <branch>foo</branch>
459 459 <author email="person">person</author>
460 460 <date>1970-01-17T04:53:20+00:00</date>
461 461 <msg xml:space="preserve">new branch</msg>
462 462 <paths>
463 463 </paths>
464 464 </logentry>
465 465 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
466 466 <author email="person">person</author>
467 467 <date>1970-01-16T01:06:40+00:00</date>
468 468 <msg xml:space="preserve">no user, no domain</msg>
469 469 <paths>
470 470 <path action="M">c</path>
471 471 </paths>
472 472 </logentry>
473 473 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
474 474 <author email="other@place">other</author>
475 475 <date>1970-01-14T21:20:00+00:00</date>
476 476 <msg xml:space="preserve">no person</msg>
477 477 <paths>
478 478 <path action="A">c</path>
479 479 </paths>
480 480 </logentry>
481 481 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
482 482 <author email="other@place">A. N. Other</author>
483 483 <date>1970-01-13T17:33:20+00:00</date>
484 484 <msg xml:space="preserve">other 1
485 485 other 2
486 486
487 487 other 3</msg>
488 488 <paths>
489 489 <path action="A">b</path>
490 490 </paths>
491 491 </logentry>
492 492 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
493 493 <author email="user@hostname">User Name</author>
494 494 <date>1970-01-12T13:46:40+00:00</date>
495 495 <msg xml:space="preserve">line 1
496 496 line 2</msg>
497 497 <paths>
498 498 <path action="A">a</path>
499 499 </paths>
500 500 </logentry>
501 501 </log>
502 502
503 503 $ hg log --debug --style xml
504 504 <?xml version="1.0"?>
505 505 <log>
506 506 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
507 507 <tag>tip</tag>
508 508 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
509 509 <parent revision="-1" node="0000000000000000000000000000000000000000" />
510 510 <author email="test">test</author>
511 511 <date>2020-01-01T10:01:00+00:00</date>
512 512 <msg xml:space="preserve">third</msg>
513 513 <paths>
514 514 <path action="A">fourth</path>
515 515 <path action="A">third</path>
516 516 <path action="R">second</path>
517 517 </paths>
518 518 <copies>
519 519 <copy source="second">fourth</copy>
520 520 </copies>
521 521 <extra key="branch">default</extra>
522 522 </logentry>
523 523 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
524 524 <parent revision="-1" node="0000000000000000000000000000000000000000" />
525 525 <parent revision="-1" node="0000000000000000000000000000000000000000" />
526 526 <author email="user@hostname">User Name</author>
527 527 <date>1970-01-12T13:46:40+00:00</date>
528 528 <msg xml:space="preserve">second</msg>
529 529 <paths>
530 530 <path action="A">second</path>
531 531 </paths>
532 532 <extra key="branch">default</extra>
533 533 </logentry>
534 534 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
535 535 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
536 536 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
537 537 <author email="person">person</author>
538 538 <date>1970-01-18T08:40:01+00:00</date>
539 539 <msg xml:space="preserve">merge</msg>
540 540 <paths>
541 541 </paths>
542 542 <extra key="branch">default</extra>
543 543 </logentry>
544 544 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
545 545 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
546 546 <parent revision="-1" node="0000000000000000000000000000000000000000" />
547 547 <author email="person">person</author>
548 548 <date>1970-01-18T08:40:00+00:00</date>
549 549 <msg xml:space="preserve">new head</msg>
550 550 <paths>
551 551 <path action="A">d</path>
552 552 </paths>
553 553 <extra key="branch">default</extra>
554 554 </logentry>
555 555 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
556 556 <branch>foo</branch>
557 557 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
558 558 <parent revision="-1" node="0000000000000000000000000000000000000000" />
559 559 <author email="person">person</author>
560 560 <date>1970-01-17T04:53:20+00:00</date>
561 561 <msg xml:space="preserve">new branch</msg>
562 562 <paths>
563 563 </paths>
564 564 <extra key="branch">foo</extra>
565 565 </logentry>
566 566 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
567 567 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
568 568 <parent revision="-1" node="0000000000000000000000000000000000000000" />
569 569 <author email="person">person</author>
570 570 <date>1970-01-16T01:06:40+00:00</date>
571 571 <msg xml:space="preserve">no user, no domain</msg>
572 572 <paths>
573 573 <path action="M">c</path>
574 574 </paths>
575 575 <extra key="branch">default</extra>
576 576 </logentry>
577 577 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
578 578 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
579 579 <parent revision="-1" node="0000000000000000000000000000000000000000" />
580 580 <author email="other@place">other</author>
581 581 <date>1970-01-14T21:20:00+00:00</date>
582 582 <msg xml:space="preserve">no person</msg>
583 583 <paths>
584 584 <path action="A">c</path>
585 585 </paths>
586 586 <extra key="branch">default</extra>
587 587 </logentry>
588 588 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
589 589 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
590 590 <parent revision="-1" node="0000000000000000000000000000000000000000" />
591 591 <author email="other@place">A. N. Other</author>
592 592 <date>1970-01-13T17:33:20+00:00</date>
593 593 <msg xml:space="preserve">other 1
594 594 other 2
595 595
596 596 other 3</msg>
597 597 <paths>
598 598 <path action="A">b</path>
599 599 </paths>
600 600 <extra key="branch">default</extra>
601 601 </logentry>
602 602 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
603 603 <parent revision="-1" node="0000000000000000000000000000000000000000" />
604 604 <parent revision="-1" node="0000000000000000000000000000000000000000" />
605 605 <author email="user@hostname">User Name</author>
606 606 <date>1970-01-12T13:46:40+00:00</date>
607 607 <msg xml:space="preserve">line 1
608 608 line 2</msg>
609 609 <paths>
610 610 <path action="A">a</path>
611 611 </paths>
612 612 <extra key="branch">default</extra>
613 613 </logentry>
614 614 </log>
615 615
616 616
617 617 Test JSON style:
618 618
619 619 $ hg log -k nosuch -Tjson
620 620 []
621 621
622 622 $ hg log -qr . -Tjson
623 623 [
624 624 {
625 625 "rev": 8,
626 626 "node": "95c24699272ef57d062b8bccc32c878bf841784a"
627 627 }
628 628 ]
629 629
630 630 $ hg log -vpr . -Tjson --stat
631 631 [
632 632 {
633 633 "rev": 8,
634 634 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
635 635 "branch": "default",
636 636 "phase": "draft",
637 637 "user": "test",
638 638 "date": [1577872860, 0],
639 639 "desc": "third",
640 640 "bookmarks": [],
641 641 "tags": ["tip"],
642 642 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
643 643 "files": ["fourth", "second", "third"],
644 644 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
645 645 "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"
646 646 }
647 647 ]
648 648
649 649 honor --git but not format-breaking diffopts
650 650 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
651 651 [
652 652 {
653 653 "rev": 8,
654 654 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
655 655 "branch": "default",
656 656 "phase": "draft",
657 657 "user": "test",
658 658 "date": [1577872860, 0],
659 659 "desc": "third",
660 660 "bookmarks": [],
661 661 "tags": ["tip"],
662 662 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
663 663 "files": ["fourth", "second", "third"],
664 664 "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"
665 665 }
666 666 ]
667 667
668 668 $ hg log -T json
669 669 [
670 670 {
671 671 "rev": 8,
672 672 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
673 673 "branch": "default",
674 674 "phase": "draft",
675 675 "user": "test",
676 676 "date": [1577872860, 0],
677 677 "desc": "third",
678 678 "bookmarks": [],
679 679 "tags": ["tip"],
680 680 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"]
681 681 },
682 682 {
683 683 "rev": 7,
684 684 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
685 685 "branch": "default",
686 686 "phase": "draft",
687 687 "user": "User Name <user@hostname>",
688 688 "date": [1000000, 0],
689 689 "desc": "second",
690 690 "bookmarks": [],
691 691 "tags": [],
692 692 "parents": ["0000000000000000000000000000000000000000"]
693 693 },
694 694 {
695 695 "rev": 6,
696 696 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
697 697 "branch": "default",
698 698 "phase": "draft",
699 699 "user": "person",
700 700 "date": [1500001, 0],
701 701 "desc": "merge",
702 702 "bookmarks": [],
703 703 "tags": [],
704 704 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"]
705 705 },
706 706 {
707 707 "rev": 5,
708 708 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
709 709 "branch": "default",
710 710 "phase": "draft",
711 711 "user": "person",
712 712 "date": [1500000, 0],
713 713 "desc": "new head",
714 714 "bookmarks": [],
715 715 "tags": [],
716 716 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
717 717 },
718 718 {
719 719 "rev": 4,
720 720 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
721 721 "branch": "foo",
722 722 "phase": "draft",
723 723 "user": "person",
724 724 "date": [1400000, 0],
725 725 "desc": "new branch",
726 726 "bookmarks": [],
727 727 "tags": [],
728 728 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
729 729 },
730 730 {
731 731 "rev": 3,
732 732 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
733 733 "branch": "default",
734 734 "phase": "draft",
735 735 "user": "person",
736 736 "date": [1300000, 0],
737 737 "desc": "no user, no domain",
738 738 "bookmarks": [],
739 739 "tags": [],
740 740 "parents": ["97054abb4ab824450e9164180baf491ae0078465"]
741 741 },
742 742 {
743 743 "rev": 2,
744 744 "node": "97054abb4ab824450e9164180baf491ae0078465",
745 745 "branch": "default",
746 746 "phase": "draft",
747 747 "user": "other@place",
748 748 "date": [1200000, 0],
749 749 "desc": "no person",
750 750 "bookmarks": [],
751 751 "tags": [],
752 752 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"]
753 753 },
754 754 {
755 755 "rev": 1,
756 756 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
757 757 "branch": "default",
758 758 "phase": "draft",
759 759 "user": "A. N. Other <other@place>",
760 760 "date": [1100000, 0],
761 761 "desc": "other 1\nother 2\n\nother 3",
762 762 "bookmarks": [],
763 763 "tags": [],
764 764 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"]
765 765 },
766 766 {
767 767 "rev": 0,
768 768 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
769 769 "branch": "default",
770 770 "phase": "draft",
771 771 "user": "User Name <user@hostname>",
772 772 "date": [1000000, 0],
773 773 "desc": "line 1\nline 2",
774 774 "bookmarks": [],
775 775 "tags": [],
776 776 "parents": ["0000000000000000000000000000000000000000"]
777 777 }
778 778 ]
779 779
780 780 $ hg heads -v -Tjson
781 781 [
782 782 {
783 783 "rev": 8,
784 784 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
785 785 "branch": "default",
786 786 "phase": "draft",
787 787 "user": "test",
788 788 "date": [1577872860, 0],
789 789 "desc": "third",
790 790 "bookmarks": [],
791 791 "tags": ["tip"],
792 792 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
793 793 "files": ["fourth", "second", "third"]
794 794 },
795 795 {
796 796 "rev": 6,
797 797 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
798 798 "branch": "default",
799 799 "phase": "draft",
800 800 "user": "person",
801 801 "date": [1500001, 0],
802 802 "desc": "merge",
803 803 "bookmarks": [],
804 804 "tags": [],
805 805 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
806 806 "files": []
807 807 },
808 808 {
809 809 "rev": 4,
810 810 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
811 811 "branch": "foo",
812 812 "phase": "draft",
813 813 "user": "person",
814 814 "date": [1400000, 0],
815 815 "desc": "new branch",
816 816 "bookmarks": [],
817 817 "tags": [],
818 818 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
819 819 "files": []
820 820 }
821 821 ]
822 822
823 823 $ hg log --debug -Tjson
824 824 [
825 825 {
826 826 "rev": 8,
827 827 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
828 828 "branch": "default",
829 829 "phase": "draft",
830 830 "user": "test",
831 831 "date": [1577872860, 0],
832 832 "desc": "third",
833 833 "bookmarks": [],
834 834 "tags": ["tip"],
835 835 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
836 836 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
837 837 "extra": {"branch": "default"},
838 838 "modified": [],
839 839 "added": ["fourth", "third"],
840 840 "removed": ["second"]
841 841 },
842 842 {
843 843 "rev": 7,
844 844 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
845 845 "branch": "default",
846 846 "phase": "draft",
847 847 "user": "User Name <user@hostname>",
848 848 "date": [1000000, 0],
849 849 "desc": "second",
850 850 "bookmarks": [],
851 851 "tags": [],
852 852 "parents": ["0000000000000000000000000000000000000000"],
853 853 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
854 854 "extra": {"branch": "default"},
855 855 "modified": [],
856 856 "added": ["second"],
857 857 "removed": []
858 858 },
859 859 {
860 860 "rev": 6,
861 861 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
862 862 "branch": "default",
863 863 "phase": "draft",
864 864 "user": "person",
865 865 "date": [1500001, 0],
866 866 "desc": "merge",
867 867 "bookmarks": [],
868 868 "tags": [],
869 869 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
870 870 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
871 871 "extra": {"branch": "default"},
872 872 "modified": [],
873 873 "added": [],
874 874 "removed": []
875 875 },
876 876 {
877 877 "rev": 5,
878 878 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
879 879 "branch": "default",
880 880 "phase": "draft",
881 881 "user": "person",
882 882 "date": [1500000, 0],
883 883 "desc": "new head",
884 884 "bookmarks": [],
885 885 "tags": [],
886 886 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
887 887 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
888 888 "extra": {"branch": "default"},
889 889 "modified": [],
890 890 "added": ["d"],
891 891 "removed": []
892 892 },
893 893 {
894 894 "rev": 4,
895 895 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
896 896 "branch": "foo",
897 897 "phase": "draft",
898 898 "user": "person",
899 899 "date": [1400000, 0],
900 900 "desc": "new branch",
901 901 "bookmarks": [],
902 902 "tags": [],
903 903 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
904 904 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
905 905 "extra": {"branch": "foo"},
906 906 "modified": [],
907 907 "added": [],
908 908 "removed": []
909 909 },
910 910 {
911 911 "rev": 3,
912 912 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
913 913 "branch": "default",
914 914 "phase": "draft",
915 915 "user": "person",
916 916 "date": [1300000, 0],
917 917 "desc": "no user, no domain",
918 918 "bookmarks": [],
919 919 "tags": [],
920 920 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
921 921 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
922 922 "extra": {"branch": "default"},
923 923 "modified": ["c"],
924 924 "added": [],
925 925 "removed": []
926 926 },
927 927 {
928 928 "rev": 2,
929 929 "node": "97054abb4ab824450e9164180baf491ae0078465",
930 930 "branch": "default",
931 931 "phase": "draft",
932 932 "user": "other@place",
933 933 "date": [1200000, 0],
934 934 "desc": "no person",
935 935 "bookmarks": [],
936 936 "tags": [],
937 937 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
938 938 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
939 939 "extra": {"branch": "default"},
940 940 "modified": [],
941 941 "added": ["c"],
942 942 "removed": []
943 943 },
944 944 {
945 945 "rev": 1,
946 946 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
947 947 "branch": "default",
948 948 "phase": "draft",
949 949 "user": "A. N. Other <other@place>",
950 950 "date": [1100000, 0],
951 951 "desc": "other 1\nother 2\n\nother 3",
952 952 "bookmarks": [],
953 953 "tags": [],
954 954 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
955 955 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
956 956 "extra": {"branch": "default"},
957 957 "modified": [],
958 958 "added": ["b"],
959 959 "removed": []
960 960 },
961 961 {
962 962 "rev": 0,
963 963 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
964 964 "branch": "default",
965 965 "phase": "draft",
966 966 "user": "User Name <user@hostname>",
967 967 "date": [1000000, 0],
968 968 "desc": "line 1\nline 2",
969 969 "bookmarks": [],
970 970 "tags": [],
971 971 "parents": ["0000000000000000000000000000000000000000"],
972 972 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
973 973 "extra": {"branch": "default"},
974 974 "modified": [],
975 975 "added": ["a"],
976 976 "removed": []
977 977 }
978 978 ]
979 979
980 980 Error if style not readable:
981 981
982 982 #if unix-permissions no-root
983 983 $ touch q
984 984 $ chmod 0 q
985 985 $ hg log --style ./q
986 986 abort: Permission denied: ./q
987 987 [255]
988 988 #endif
989 989
990 990 Error if no style:
991 991
992 992 $ hg log --style notexist
993 993 abort: style 'notexist' not found
994 994 (available styles: bisect, changelog, compact, default, phases, status, xml)
995 995 [255]
996 996
997 997 $ hg log -T list
998 998 available styles: bisect, changelog, compact, default, phases, status, xml
999 999 abort: specify a template
1000 1000 [255]
1001 1001
1002 1002 Error if style missing key:
1003 1003
1004 1004 $ echo 'q = q' > t
1005 1005 $ hg log --style ./t
1006 1006 abort: "changeset" not in template map
1007 1007 [255]
1008 1008
1009 1009 Error if style missing value:
1010 1010
1011 1011 $ echo 'changeset =' > t
1012 1012 $ hg log --style t
1013 1013 hg: parse error at t:1: missing value
1014 1014 [255]
1015 1015
1016 1016 Error if include fails:
1017 1017
1018 1018 $ echo 'changeset = q' >> t
1019 1019 #if unix-permissions no-root
1020 1020 $ hg log --style ./t
1021 1021 abort: template file ./q: Permission denied
1022 1022 [255]
1023 1023 $ rm -f q
1024 1024 #endif
1025 1025
1026 1026 Include works:
1027 1027
1028 1028 $ echo '{rev}' > q
1029 1029 $ hg log --style ./t
1030 1030 8
1031 1031 7
1032 1032 6
1033 1033 5
1034 1034 4
1035 1035 3
1036 1036 2
1037 1037 1
1038 1038 0
1039 1039
1040 1040 Check that recursive reference does not fall into RuntimeError (issue4758):
1041 1041
1042 1042 common mistake:
1043 1043
1044 1044 $ hg log -T '{changeset}\n'
1045 1045 abort: recursive reference 'changeset' in template
1046 1046 [255]
1047 1047
1048 1048 circular reference:
1049 1049
1050 1050 $ cat << EOF > issue4758
1051 1051 > changeset = '{foo}'
1052 1052 > foo = '{changeset}'
1053 1053 > EOF
1054 1054 $ hg log --style ./issue4758
1055 1055 abort: recursive reference 'foo' in template
1056 1056 [255]
1057 1057
1058 1058 buildmap() -> gettemplate(), where no thunk was made:
1059 1059
1060 1060 $ hg log -T '{files % changeset}\n'
1061 1061 abort: recursive reference 'changeset' in template
1062 1062 [255]
1063 1063
1064 1064 not a recursion if a keyword of the same name exists:
1065 1065
1066 1066 $ cat << EOF > issue4758
1067 1067 > changeset = '{tags % rev}'
1068 1068 > rev = '{rev} {tag}\n'
1069 1069 > EOF
1070 1070 $ hg log --style ./issue4758 -r tip
1071 1071 8 tip
1072 1072
1073 1073 Check that {phase} works correctly on parents:
1074 1074
1075 1075 $ cat << EOF > parentphase
1076 1076 > changeset_debug = '{rev} ({phase}):{parents}\n'
1077 1077 > parent = ' {rev} ({phase})'
1078 1078 > EOF
1079 1079 $ hg phase -r 5 --public
1080 1080 $ hg phase -r 7 --secret --force
1081 1081 $ hg log --debug -G --style ./parentphase
1082 1082 @ 8 (secret): 7 (secret) -1 (public)
1083 1083 |
1084 1084 o 7 (secret): -1 (public) -1 (public)
1085 1085
1086 1086 o 6 (draft): 5 (public) 4 (draft)
1087 1087 |\
1088 1088 | o 5 (public): 3 (public) -1 (public)
1089 1089 | |
1090 1090 o | 4 (draft): 3 (public) -1 (public)
1091 1091 |/
1092 1092 o 3 (public): 2 (public) -1 (public)
1093 1093 |
1094 1094 o 2 (public): 1 (public) -1 (public)
1095 1095 |
1096 1096 o 1 (public): 0 (public) -1 (public)
1097 1097 |
1098 1098 o 0 (public): -1 (public) -1 (public)
1099 1099
1100 1100
1101 1101 Missing non-standard names give no error (backward compatibility):
1102 1102
1103 1103 $ echo "changeset = '{c}'" > t
1104 1104 $ hg log --style ./t
1105 1105
1106 1106 Defining non-standard name works:
1107 1107
1108 1108 $ cat <<EOF > t
1109 1109 > changeset = '{c}'
1110 1110 > c = q
1111 1111 > EOF
1112 1112 $ hg log --style ./t
1113 1113 8
1114 1114 7
1115 1115 6
1116 1116 5
1117 1117 4
1118 1118 3
1119 1119 2
1120 1120 1
1121 1121 0
1122 1122
1123 1123 ui.style works:
1124 1124
1125 1125 $ echo '[ui]' > .hg/hgrc
1126 1126 $ echo 'style = t' >> .hg/hgrc
1127 1127 $ hg log
1128 1128 8
1129 1129 7
1130 1130 6
1131 1131 5
1132 1132 4
1133 1133 3
1134 1134 2
1135 1135 1
1136 1136 0
1137 1137
1138 1138
1139 1139 Issue338:
1140 1140
1141 1141 $ hg log --style=changelog > changelog
1142 1142
1143 1143 $ cat changelog
1144 1144 2020-01-01 test <test>
1145 1145
1146 1146 * fourth, second, third:
1147 1147 third
1148 1148 [95c24699272e] [tip]
1149 1149
1150 1150 1970-01-12 User Name <user@hostname>
1151 1151
1152 1152 * second:
1153 1153 second
1154 1154 [29114dbae42b]
1155 1155
1156 1156 1970-01-18 person <person>
1157 1157
1158 1158 * merge
1159 1159 [d41e714fe50d]
1160 1160
1161 1161 * d:
1162 1162 new head
1163 1163 [13207e5a10d9]
1164 1164
1165 1165 1970-01-17 person <person>
1166 1166
1167 1167 * new branch
1168 1168 [bbe44766e73d] <foo>
1169 1169
1170 1170 1970-01-16 person <person>
1171 1171
1172 1172 * c:
1173 1173 no user, no domain
1174 1174 [10e46f2dcbf4]
1175 1175
1176 1176 1970-01-14 other <other@place>
1177 1177
1178 1178 * c:
1179 1179 no person
1180 1180 [97054abb4ab8]
1181 1181
1182 1182 1970-01-13 A. N. Other <other@place>
1183 1183
1184 1184 * b:
1185 1185 other 1 other 2
1186 1186
1187 1187 other 3
1188 1188 [b608e9d1a3f0]
1189 1189
1190 1190 1970-01-12 User Name <user@hostname>
1191 1191
1192 1192 * a:
1193 1193 line 1 line 2
1194 1194 [1e4e1b8f71e0]
1195 1195
1196 1196
1197 1197 Issue2130: xml output for 'hg heads' is malformed
1198 1198
1199 1199 $ hg heads --style changelog
1200 1200 2020-01-01 test <test>
1201 1201
1202 1202 * fourth, second, third:
1203 1203 third
1204 1204 [95c24699272e] [tip]
1205 1205
1206 1206 1970-01-18 person <person>
1207 1207
1208 1208 * merge
1209 1209 [d41e714fe50d]
1210 1210
1211 1211 1970-01-17 person <person>
1212 1212
1213 1213 * new branch
1214 1214 [bbe44766e73d] <foo>
1215 1215
1216 1216
1217 1217 Keys work:
1218 1218
1219 1219 $ for key in author branch branches date desc file_adds file_dels file_mods \
1220 1220 > file_copies file_copies_switch files \
1221 1221 > manifest node parents rev tags diffstat extras \
1222 1222 > p1rev p2rev p1node p2node; do
1223 1223 > for mode in '' --verbose --debug; do
1224 1224 > hg log $mode --template "$key$mode: {$key}\n"
1225 1225 > done
1226 1226 > done
1227 1227 author: test
1228 1228 author: User Name <user@hostname>
1229 1229 author: person
1230 1230 author: person
1231 1231 author: person
1232 1232 author: person
1233 1233 author: other@place
1234 1234 author: A. N. Other <other@place>
1235 1235 author: User Name <user@hostname>
1236 1236 author--verbose: test
1237 1237 author--verbose: User Name <user@hostname>
1238 1238 author--verbose: person
1239 1239 author--verbose: person
1240 1240 author--verbose: person
1241 1241 author--verbose: person
1242 1242 author--verbose: other@place
1243 1243 author--verbose: A. N. Other <other@place>
1244 1244 author--verbose: User Name <user@hostname>
1245 1245 author--debug: test
1246 1246 author--debug: User Name <user@hostname>
1247 1247 author--debug: person
1248 1248 author--debug: person
1249 1249 author--debug: person
1250 1250 author--debug: person
1251 1251 author--debug: other@place
1252 1252 author--debug: A. N. Other <other@place>
1253 1253 author--debug: User Name <user@hostname>
1254 1254 branch: default
1255 1255 branch: default
1256 1256 branch: default
1257 1257 branch: default
1258 1258 branch: foo
1259 1259 branch: default
1260 1260 branch: default
1261 1261 branch: default
1262 1262 branch: default
1263 1263 branch--verbose: default
1264 1264 branch--verbose: default
1265 1265 branch--verbose: default
1266 1266 branch--verbose: default
1267 1267 branch--verbose: foo
1268 1268 branch--verbose: default
1269 1269 branch--verbose: default
1270 1270 branch--verbose: default
1271 1271 branch--verbose: default
1272 1272 branch--debug: default
1273 1273 branch--debug: default
1274 1274 branch--debug: default
1275 1275 branch--debug: default
1276 1276 branch--debug: foo
1277 1277 branch--debug: default
1278 1278 branch--debug: default
1279 1279 branch--debug: default
1280 1280 branch--debug: default
1281 1281 branches:
1282 1282 branches:
1283 1283 branches:
1284 1284 branches:
1285 1285 branches: foo
1286 1286 branches:
1287 1287 branches:
1288 1288 branches:
1289 1289 branches:
1290 1290 branches--verbose:
1291 1291 branches--verbose:
1292 1292 branches--verbose:
1293 1293 branches--verbose:
1294 1294 branches--verbose: foo
1295 1295 branches--verbose:
1296 1296 branches--verbose:
1297 1297 branches--verbose:
1298 1298 branches--verbose:
1299 1299 branches--debug:
1300 1300 branches--debug:
1301 1301 branches--debug:
1302 1302 branches--debug:
1303 1303 branches--debug: foo
1304 1304 branches--debug:
1305 1305 branches--debug:
1306 1306 branches--debug:
1307 1307 branches--debug:
1308 1308 date: 1577872860.00
1309 1309 date: 1000000.00
1310 1310 date: 1500001.00
1311 1311 date: 1500000.00
1312 1312 date: 1400000.00
1313 1313 date: 1300000.00
1314 1314 date: 1200000.00
1315 1315 date: 1100000.00
1316 1316 date: 1000000.00
1317 1317 date--verbose: 1577872860.00
1318 1318 date--verbose: 1000000.00
1319 1319 date--verbose: 1500001.00
1320 1320 date--verbose: 1500000.00
1321 1321 date--verbose: 1400000.00
1322 1322 date--verbose: 1300000.00
1323 1323 date--verbose: 1200000.00
1324 1324 date--verbose: 1100000.00
1325 1325 date--verbose: 1000000.00
1326 1326 date--debug: 1577872860.00
1327 1327 date--debug: 1000000.00
1328 1328 date--debug: 1500001.00
1329 1329 date--debug: 1500000.00
1330 1330 date--debug: 1400000.00
1331 1331 date--debug: 1300000.00
1332 1332 date--debug: 1200000.00
1333 1333 date--debug: 1100000.00
1334 1334 date--debug: 1000000.00
1335 1335 desc: third
1336 1336 desc: second
1337 1337 desc: merge
1338 1338 desc: new head
1339 1339 desc: new branch
1340 1340 desc: no user, no domain
1341 1341 desc: no person
1342 1342 desc: other 1
1343 1343 other 2
1344 1344
1345 1345 other 3
1346 1346 desc: line 1
1347 1347 line 2
1348 1348 desc--verbose: third
1349 1349 desc--verbose: second
1350 1350 desc--verbose: merge
1351 1351 desc--verbose: new head
1352 1352 desc--verbose: new branch
1353 1353 desc--verbose: no user, no domain
1354 1354 desc--verbose: no person
1355 1355 desc--verbose: other 1
1356 1356 other 2
1357 1357
1358 1358 other 3
1359 1359 desc--verbose: line 1
1360 1360 line 2
1361 1361 desc--debug: third
1362 1362 desc--debug: second
1363 1363 desc--debug: merge
1364 1364 desc--debug: new head
1365 1365 desc--debug: new branch
1366 1366 desc--debug: no user, no domain
1367 1367 desc--debug: no person
1368 1368 desc--debug: other 1
1369 1369 other 2
1370 1370
1371 1371 other 3
1372 1372 desc--debug: line 1
1373 1373 line 2
1374 1374 file_adds: fourth third
1375 1375 file_adds: second
1376 1376 file_adds:
1377 1377 file_adds: d
1378 1378 file_adds:
1379 1379 file_adds:
1380 1380 file_adds: c
1381 1381 file_adds: b
1382 1382 file_adds: a
1383 1383 file_adds--verbose: fourth third
1384 1384 file_adds--verbose: second
1385 1385 file_adds--verbose:
1386 1386 file_adds--verbose: d
1387 1387 file_adds--verbose:
1388 1388 file_adds--verbose:
1389 1389 file_adds--verbose: c
1390 1390 file_adds--verbose: b
1391 1391 file_adds--verbose: a
1392 1392 file_adds--debug: fourth third
1393 1393 file_adds--debug: second
1394 1394 file_adds--debug:
1395 1395 file_adds--debug: d
1396 1396 file_adds--debug:
1397 1397 file_adds--debug:
1398 1398 file_adds--debug: c
1399 1399 file_adds--debug: b
1400 1400 file_adds--debug: a
1401 1401 file_dels: second
1402 1402 file_dels:
1403 1403 file_dels:
1404 1404 file_dels:
1405 1405 file_dels:
1406 1406 file_dels:
1407 1407 file_dels:
1408 1408 file_dels:
1409 1409 file_dels:
1410 1410 file_dels--verbose: second
1411 1411 file_dels--verbose:
1412 1412 file_dels--verbose:
1413 1413 file_dels--verbose:
1414 1414 file_dels--verbose:
1415 1415 file_dels--verbose:
1416 1416 file_dels--verbose:
1417 1417 file_dels--verbose:
1418 1418 file_dels--verbose:
1419 1419 file_dels--debug: second
1420 1420 file_dels--debug:
1421 1421 file_dels--debug:
1422 1422 file_dels--debug:
1423 1423 file_dels--debug:
1424 1424 file_dels--debug:
1425 1425 file_dels--debug:
1426 1426 file_dels--debug:
1427 1427 file_dels--debug:
1428 1428 file_mods:
1429 1429 file_mods:
1430 1430 file_mods:
1431 1431 file_mods:
1432 1432 file_mods:
1433 1433 file_mods: c
1434 1434 file_mods:
1435 1435 file_mods:
1436 1436 file_mods:
1437 1437 file_mods--verbose:
1438 1438 file_mods--verbose:
1439 1439 file_mods--verbose:
1440 1440 file_mods--verbose:
1441 1441 file_mods--verbose:
1442 1442 file_mods--verbose: c
1443 1443 file_mods--verbose:
1444 1444 file_mods--verbose:
1445 1445 file_mods--verbose:
1446 1446 file_mods--debug:
1447 1447 file_mods--debug:
1448 1448 file_mods--debug:
1449 1449 file_mods--debug:
1450 1450 file_mods--debug:
1451 1451 file_mods--debug: c
1452 1452 file_mods--debug:
1453 1453 file_mods--debug:
1454 1454 file_mods--debug:
1455 1455 file_copies: fourth (second)
1456 1456 file_copies:
1457 1457 file_copies:
1458 1458 file_copies:
1459 1459 file_copies:
1460 1460 file_copies:
1461 1461 file_copies:
1462 1462 file_copies:
1463 1463 file_copies:
1464 1464 file_copies--verbose: fourth (second)
1465 1465 file_copies--verbose:
1466 1466 file_copies--verbose:
1467 1467 file_copies--verbose:
1468 1468 file_copies--verbose:
1469 1469 file_copies--verbose:
1470 1470 file_copies--verbose:
1471 1471 file_copies--verbose:
1472 1472 file_copies--verbose:
1473 1473 file_copies--debug: fourth (second)
1474 1474 file_copies--debug:
1475 1475 file_copies--debug:
1476 1476 file_copies--debug:
1477 1477 file_copies--debug:
1478 1478 file_copies--debug:
1479 1479 file_copies--debug:
1480 1480 file_copies--debug:
1481 1481 file_copies--debug:
1482 1482 file_copies_switch:
1483 1483 file_copies_switch:
1484 1484 file_copies_switch:
1485 1485 file_copies_switch:
1486 1486 file_copies_switch:
1487 1487 file_copies_switch:
1488 1488 file_copies_switch:
1489 1489 file_copies_switch:
1490 1490 file_copies_switch:
1491 1491 file_copies_switch--verbose:
1492 1492 file_copies_switch--verbose:
1493 1493 file_copies_switch--verbose:
1494 1494 file_copies_switch--verbose:
1495 1495 file_copies_switch--verbose:
1496 1496 file_copies_switch--verbose:
1497 1497 file_copies_switch--verbose:
1498 1498 file_copies_switch--verbose:
1499 1499 file_copies_switch--verbose:
1500 1500 file_copies_switch--debug:
1501 1501 file_copies_switch--debug:
1502 1502 file_copies_switch--debug:
1503 1503 file_copies_switch--debug:
1504 1504 file_copies_switch--debug:
1505 1505 file_copies_switch--debug:
1506 1506 file_copies_switch--debug:
1507 1507 file_copies_switch--debug:
1508 1508 file_copies_switch--debug:
1509 1509 files: fourth second third
1510 1510 files: second
1511 1511 files:
1512 1512 files: d
1513 1513 files:
1514 1514 files: c
1515 1515 files: c
1516 1516 files: b
1517 1517 files: a
1518 1518 files--verbose: fourth second third
1519 1519 files--verbose: second
1520 1520 files--verbose:
1521 1521 files--verbose: d
1522 1522 files--verbose:
1523 1523 files--verbose: c
1524 1524 files--verbose: c
1525 1525 files--verbose: b
1526 1526 files--verbose: a
1527 1527 files--debug: fourth second third
1528 1528 files--debug: second
1529 1529 files--debug:
1530 1530 files--debug: d
1531 1531 files--debug:
1532 1532 files--debug: c
1533 1533 files--debug: c
1534 1534 files--debug: b
1535 1535 files--debug: a
1536 1536 manifest: 6:94961b75a2da
1537 1537 manifest: 5:f2dbc354b94e
1538 1538 manifest: 4:4dc3def4f9b4
1539 1539 manifest: 4:4dc3def4f9b4
1540 1540 manifest: 3:cb5a1327723b
1541 1541 manifest: 3:cb5a1327723b
1542 1542 manifest: 2:6e0e82995c35
1543 1543 manifest: 1:4e8d705b1e53
1544 1544 manifest: 0:a0c8bcbbb45c
1545 1545 manifest--verbose: 6:94961b75a2da
1546 1546 manifest--verbose: 5:f2dbc354b94e
1547 1547 manifest--verbose: 4:4dc3def4f9b4
1548 1548 manifest--verbose: 4:4dc3def4f9b4
1549 1549 manifest--verbose: 3:cb5a1327723b
1550 1550 manifest--verbose: 3:cb5a1327723b
1551 1551 manifest--verbose: 2:6e0e82995c35
1552 1552 manifest--verbose: 1:4e8d705b1e53
1553 1553 manifest--verbose: 0:a0c8bcbbb45c
1554 1554 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1555 1555 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1556 1556 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1557 1557 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1558 1558 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1559 1559 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1560 1560 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1561 1561 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1562 1562 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1563 1563 node: 95c24699272ef57d062b8bccc32c878bf841784a
1564 1564 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1565 1565 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1566 1566 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1567 1567 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1568 1568 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1569 1569 node: 97054abb4ab824450e9164180baf491ae0078465
1570 1570 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1571 1571 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1572 1572 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1573 1573 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1574 1574 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1575 1575 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1576 1576 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1577 1577 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1578 1578 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1579 1579 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1580 1580 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1581 1581 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1582 1582 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1583 1583 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1584 1584 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1585 1585 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1586 1586 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1587 1587 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1588 1588 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1589 1589 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1590 1590 parents:
1591 1591 parents: -1:000000000000
1592 1592 parents: 5:13207e5a10d9 4:bbe44766e73d
1593 1593 parents: 3:10e46f2dcbf4
1594 1594 parents:
1595 1595 parents:
1596 1596 parents:
1597 1597 parents:
1598 1598 parents:
1599 1599 parents--verbose:
1600 1600 parents--verbose: -1:000000000000
1601 1601 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1602 1602 parents--verbose: 3:10e46f2dcbf4
1603 1603 parents--verbose:
1604 1604 parents--verbose:
1605 1605 parents--verbose:
1606 1606 parents--verbose:
1607 1607 parents--verbose:
1608 1608 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1609 1609 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1610 1610 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1611 1611 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1612 1612 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1613 1613 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1614 1614 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1615 1615 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1616 1616 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1617 1617 rev: 8
1618 1618 rev: 7
1619 1619 rev: 6
1620 1620 rev: 5
1621 1621 rev: 4
1622 1622 rev: 3
1623 1623 rev: 2
1624 1624 rev: 1
1625 1625 rev: 0
1626 1626 rev--verbose: 8
1627 1627 rev--verbose: 7
1628 1628 rev--verbose: 6
1629 1629 rev--verbose: 5
1630 1630 rev--verbose: 4
1631 1631 rev--verbose: 3
1632 1632 rev--verbose: 2
1633 1633 rev--verbose: 1
1634 1634 rev--verbose: 0
1635 1635 rev--debug: 8
1636 1636 rev--debug: 7
1637 1637 rev--debug: 6
1638 1638 rev--debug: 5
1639 1639 rev--debug: 4
1640 1640 rev--debug: 3
1641 1641 rev--debug: 2
1642 1642 rev--debug: 1
1643 1643 rev--debug: 0
1644 1644 tags: tip
1645 1645 tags:
1646 1646 tags:
1647 1647 tags:
1648 1648 tags:
1649 1649 tags:
1650 1650 tags:
1651 1651 tags:
1652 1652 tags:
1653 1653 tags--verbose: tip
1654 1654 tags--verbose:
1655 1655 tags--verbose:
1656 1656 tags--verbose:
1657 1657 tags--verbose:
1658 1658 tags--verbose:
1659 1659 tags--verbose:
1660 1660 tags--verbose:
1661 1661 tags--verbose:
1662 1662 tags--debug: tip
1663 1663 tags--debug:
1664 1664 tags--debug:
1665 1665 tags--debug:
1666 1666 tags--debug:
1667 1667 tags--debug:
1668 1668 tags--debug:
1669 1669 tags--debug:
1670 1670 tags--debug:
1671 1671 diffstat: 3: +2/-1
1672 1672 diffstat: 1: +1/-0
1673 1673 diffstat: 0: +0/-0
1674 1674 diffstat: 1: +1/-0
1675 1675 diffstat: 0: +0/-0
1676 1676 diffstat: 1: +1/-0
1677 1677 diffstat: 1: +4/-0
1678 1678 diffstat: 1: +2/-0
1679 1679 diffstat: 1: +1/-0
1680 1680 diffstat--verbose: 3: +2/-1
1681 1681 diffstat--verbose: 1: +1/-0
1682 1682 diffstat--verbose: 0: +0/-0
1683 1683 diffstat--verbose: 1: +1/-0
1684 1684 diffstat--verbose: 0: +0/-0
1685 1685 diffstat--verbose: 1: +1/-0
1686 1686 diffstat--verbose: 1: +4/-0
1687 1687 diffstat--verbose: 1: +2/-0
1688 1688 diffstat--verbose: 1: +1/-0
1689 1689 diffstat--debug: 3: +2/-1
1690 1690 diffstat--debug: 1: +1/-0
1691 1691 diffstat--debug: 0: +0/-0
1692 1692 diffstat--debug: 1: +1/-0
1693 1693 diffstat--debug: 0: +0/-0
1694 1694 diffstat--debug: 1: +1/-0
1695 1695 diffstat--debug: 1: +4/-0
1696 1696 diffstat--debug: 1: +2/-0
1697 1697 diffstat--debug: 1: +1/-0
1698 1698 extras: branch=default
1699 1699 extras: branch=default
1700 1700 extras: branch=default
1701 1701 extras: branch=default
1702 1702 extras: branch=foo
1703 1703 extras: branch=default
1704 1704 extras: branch=default
1705 1705 extras: branch=default
1706 1706 extras: branch=default
1707 1707 extras--verbose: branch=default
1708 1708 extras--verbose: branch=default
1709 1709 extras--verbose: branch=default
1710 1710 extras--verbose: branch=default
1711 1711 extras--verbose: branch=foo
1712 1712 extras--verbose: branch=default
1713 1713 extras--verbose: branch=default
1714 1714 extras--verbose: branch=default
1715 1715 extras--verbose: branch=default
1716 1716 extras--debug: branch=default
1717 1717 extras--debug: branch=default
1718 1718 extras--debug: branch=default
1719 1719 extras--debug: branch=default
1720 1720 extras--debug: branch=foo
1721 1721 extras--debug: branch=default
1722 1722 extras--debug: branch=default
1723 1723 extras--debug: branch=default
1724 1724 extras--debug: branch=default
1725 1725 p1rev: 7
1726 1726 p1rev: -1
1727 1727 p1rev: 5
1728 1728 p1rev: 3
1729 1729 p1rev: 3
1730 1730 p1rev: 2
1731 1731 p1rev: 1
1732 1732 p1rev: 0
1733 1733 p1rev: -1
1734 1734 p1rev--verbose: 7
1735 1735 p1rev--verbose: -1
1736 1736 p1rev--verbose: 5
1737 1737 p1rev--verbose: 3
1738 1738 p1rev--verbose: 3
1739 1739 p1rev--verbose: 2
1740 1740 p1rev--verbose: 1
1741 1741 p1rev--verbose: 0
1742 1742 p1rev--verbose: -1
1743 1743 p1rev--debug: 7
1744 1744 p1rev--debug: -1
1745 1745 p1rev--debug: 5
1746 1746 p1rev--debug: 3
1747 1747 p1rev--debug: 3
1748 1748 p1rev--debug: 2
1749 1749 p1rev--debug: 1
1750 1750 p1rev--debug: 0
1751 1751 p1rev--debug: -1
1752 1752 p2rev: -1
1753 1753 p2rev: -1
1754 1754 p2rev: 4
1755 1755 p2rev: -1
1756 1756 p2rev: -1
1757 1757 p2rev: -1
1758 1758 p2rev: -1
1759 1759 p2rev: -1
1760 1760 p2rev: -1
1761 1761 p2rev--verbose: -1
1762 1762 p2rev--verbose: -1
1763 1763 p2rev--verbose: 4
1764 1764 p2rev--verbose: -1
1765 1765 p2rev--verbose: -1
1766 1766 p2rev--verbose: -1
1767 1767 p2rev--verbose: -1
1768 1768 p2rev--verbose: -1
1769 1769 p2rev--verbose: -1
1770 1770 p2rev--debug: -1
1771 1771 p2rev--debug: -1
1772 1772 p2rev--debug: 4
1773 1773 p2rev--debug: -1
1774 1774 p2rev--debug: -1
1775 1775 p2rev--debug: -1
1776 1776 p2rev--debug: -1
1777 1777 p2rev--debug: -1
1778 1778 p2rev--debug: -1
1779 1779 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1780 1780 p1node: 0000000000000000000000000000000000000000
1781 1781 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
1782 1782 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1783 1783 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1784 1784 p1node: 97054abb4ab824450e9164180baf491ae0078465
1785 1785 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1786 1786 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1787 1787 p1node: 0000000000000000000000000000000000000000
1788 1788 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1789 1789 p1node--verbose: 0000000000000000000000000000000000000000
1790 1790 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1791 1791 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1792 1792 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1793 1793 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1794 1794 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1795 1795 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1796 1796 p1node--verbose: 0000000000000000000000000000000000000000
1797 1797 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1798 1798 p1node--debug: 0000000000000000000000000000000000000000
1799 1799 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1800 1800 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1801 1801 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1802 1802 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
1803 1803 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1804 1804 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1805 1805 p1node--debug: 0000000000000000000000000000000000000000
1806 1806 p2node: 0000000000000000000000000000000000000000
1807 1807 p2node: 0000000000000000000000000000000000000000
1808 1808 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1809 1809 p2node: 0000000000000000000000000000000000000000
1810 1810 p2node: 0000000000000000000000000000000000000000
1811 1811 p2node: 0000000000000000000000000000000000000000
1812 1812 p2node: 0000000000000000000000000000000000000000
1813 1813 p2node: 0000000000000000000000000000000000000000
1814 1814 p2node: 0000000000000000000000000000000000000000
1815 1815 p2node--verbose: 0000000000000000000000000000000000000000
1816 1816 p2node--verbose: 0000000000000000000000000000000000000000
1817 1817 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1818 1818 p2node--verbose: 0000000000000000000000000000000000000000
1819 1819 p2node--verbose: 0000000000000000000000000000000000000000
1820 1820 p2node--verbose: 0000000000000000000000000000000000000000
1821 1821 p2node--verbose: 0000000000000000000000000000000000000000
1822 1822 p2node--verbose: 0000000000000000000000000000000000000000
1823 1823 p2node--verbose: 0000000000000000000000000000000000000000
1824 1824 p2node--debug: 0000000000000000000000000000000000000000
1825 1825 p2node--debug: 0000000000000000000000000000000000000000
1826 1826 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1827 1827 p2node--debug: 0000000000000000000000000000000000000000
1828 1828 p2node--debug: 0000000000000000000000000000000000000000
1829 1829 p2node--debug: 0000000000000000000000000000000000000000
1830 1830 p2node--debug: 0000000000000000000000000000000000000000
1831 1831 p2node--debug: 0000000000000000000000000000000000000000
1832 1832 p2node--debug: 0000000000000000000000000000000000000000
1833 1833
1834 1834 Filters work:
1835 1835
1836 1836 $ hg log --template '{author|domain}\n'
1837 1837
1838 1838 hostname
1839 1839
1840 1840
1841 1841
1842 1842
1843 1843 place
1844 1844 place
1845 1845 hostname
1846 1846
1847 1847 $ hg log --template '{author|person}\n'
1848 1848 test
1849 1849 User Name
1850 1850 person
1851 1851 person
1852 1852 person
1853 1853 person
1854 1854 other
1855 1855 A. N. Other
1856 1856 User Name
1857 1857
1858 1858 $ hg log --template '{author|user}\n'
1859 1859 test
1860 1860 user
1861 1861 person
1862 1862 person
1863 1863 person
1864 1864 person
1865 1865 other
1866 1866 other
1867 1867 user
1868 1868
1869 1869 $ hg log --template '{date|date}\n'
1870 1870 Wed Jan 01 10:01:00 2020 +0000
1871 1871 Mon Jan 12 13:46:40 1970 +0000
1872 1872 Sun Jan 18 08:40:01 1970 +0000
1873 1873 Sun Jan 18 08:40:00 1970 +0000
1874 1874 Sat Jan 17 04:53:20 1970 +0000
1875 1875 Fri Jan 16 01:06:40 1970 +0000
1876 1876 Wed Jan 14 21:20:00 1970 +0000
1877 1877 Tue Jan 13 17:33:20 1970 +0000
1878 1878 Mon Jan 12 13:46:40 1970 +0000
1879 1879
1880 1880 $ hg log --template '{date|isodate}\n'
1881 1881 2020-01-01 10:01 +0000
1882 1882 1970-01-12 13:46 +0000
1883 1883 1970-01-18 08:40 +0000
1884 1884 1970-01-18 08:40 +0000
1885 1885 1970-01-17 04:53 +0000
1886 1886 1970-01-16 01:06 +0000
1887 1887 1970-01-14 21:20 +0000
1888 1888 1970-01-13 17:33 +0000
1889 1889 1970-01-12 13:46 +0000
1890 1890
1891 1891 $ hg log --template '{date|isodatesec}\n'
1892 1892 2020-01-01 10:01:00 +0000
1893 1893 1970-01-12 13:46:40 +0000
1894 1894 1970-01-18 08:40:01 +0000
1895 1895 1970-01-18 08:40:00 +0000
1896 1896 1970-01-17 04:53:20 +0000
1897 1897 1970-01-16 01:06:40 +0000
1898 1898 1970-01-14 21:20:00 +0000
1899 1899 1970-01-13 17:33:20 +0000
1900 1900 1970-01-12 13:46:40 +0000
1901 1901
1902 1902 $ hg log --template '{date|rfc822date}\n'
1903 1903 Wed, 01 Jan 2020 10:01:00 +0000
1904 1904 Mon, 12 Jan 1970 13:46:40 +0000
1905 1905 Sun, 18 Jan 1970 08:40:01 +0000
1906 1906 Sun, 18 Jan 1970 08:40:00 +0000
1907 1907 Sat, 17 Jan 1970 04:53:20 +0000
1908 1908 Fri, 16 Jan 1970 01:06:40 +0000
1909 1909 Wed, 14 Jan 1970 21:20:00 +0000
1910 1910 Tue, 13 Jan 1970 17:33:20 +0000
1911 1911 Mon, 12 Jan 1970 13:46:40 +0000
1912 1912
1913 1913 $ hg log --template '{desc|firstline}\n'
1914 1914 third
1915 1915 second
1916 1916 merge
1917 1917 new head
1918 1918 new branch
1919 1919 no user, no domain
1920 1920 no person
1921 1921 other 1
1922 1922 line 1
1923 1923
1924 1924 $ hg log --template '{node|short}\n'
1925 1925 95c24699272e
1926 1926 29114dbae42b
1927 1927 d41e714fe50d
1928 1928 13207e5a10d9
1929 1929 bbe44766e73d
1930 1930 10e46f2dcbf4
1931 1931 97054abb4ab8
1932 1932 b608e9d1a3f0
1933 1933 1e4e1b8f71e0
1934 1934
1935 1935 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
1936 1936 <changeset author="test"/>
1937 1937 <changeset author="User Name &lt;user@hostname&gt;"/>
1938 1938 <changeset author="person"/>
1939 1939 <changeset author="person"/>
1940 1940 <changeset author="person"/>
1941 1941 <changeset author="person"/>
1942 1942 <changeset author="other@place"/>
1943 1943 <changeset author="A. N. Other &lt;other@place&gt;"/>
1944 1944 <changeset author="User Name &lt;user@hostname&gt;"/>
1945 1945
1946 1946 $ hg log --template '{rev}: {children}\n'
1947 1947 8:
1948 1948 7: 8:95c24699272e
1949 1949 6:
1950 1950 5: 6:d41e714fe50d
1951 1951 4: 6:d41e714fe50d
1952 1952 3: 4:bbe44766e73d 5:13207e5a10d9
1953 1953 2: 3:10e46f2dcbf4
1954 1954 1: 2:97054abb4ab8
1955 1955 0: 1:b608e9d1a3f0
1956 1956
1957 1957 Formatnode filter works:
1958 1958
1959 1959 $ hg -q log -r 0 --template '{node|formatnode}\n'
1960 1960 1e4e1b8f71e0
1961 1961
1962 1962 $ hg log -r 0 --template '{node|formatnode}\n'
1963 1963 1e4e1b8f71e0
1964 1964
1965 1965 $ hg -v log -r 0 --template '{node|formatnode}\n'
1966 1966 1e4e1b8f71e0
1967 1967
1968 1968 $ hg --debug log -r 0 --template '{node|formatnode}\n'
1969 1969 1e4e1b8f71e05681d422154f5421e385fec3454f
1970 1970
1971 1971 Age filter:
1972 1972
1973 1973 $ hg init unstable-hash
1974 1974 $ cd unstable-hash
1975 1975 $ hg log --template '{date|age}\n' > /dev/null || exit 1
1976 1976
1977 1977 >>> from datetime import datetime, timedelta
1978 1978 >>> fp = open('a', 'w')
1979 1979 >>> n = datetime.now() + timedelta(366 * 7)
1980 1980 >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
1981 1981 >>> fp.close()
1982 1982 $ hg add a
1983 1983 $ hg commit -m future -d "`cat a`"
1984 1984
1985 1985 $ hg log -l1 --template '{date|age}\n'
1986 1986 7 years from now
1987 1987
1988 1988 $ cd ..
1989 1989 $ rm -rf unstable-hash
1990 1990
1991 1991 Add a dummy commit to make up for the instability of the above:
1992 1992
1993 1993 $ echo a > a
1994 1994 $ hg add a
1995 1995 $ hg ci -m future
1996 1996
1997 1997 Count filter:
1998 1998
1999 1999 $ hg log -l1 --template '{node|count} {node|short|count}\n'
2000 2000 40 12
2001 2001
2002 2002 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2003 2003 0 1 4
2004 2004
2005 2005 $ hg log -G --template '{rev}: children: {children|count}, \
2006 2006 > tags: {tags|count}, file_adds: {file_adds|count}, \
2007 2007 > ancestors: {revset("ancestors(%s)", rev)|count}'
2008 2008 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2009 2009 |
2010 2010 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2011 2011 |
2012 2012 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2013 2013
2014 2014 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2015 2015 |\
2016 2016 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2017 2017 | |
2018 2018 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2019 2019 |/
2020 2020 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2021 2021 |
2022 2022 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2023 2023 |
2024 2024 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2025 2025 |
2026 2026 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2027 2027
2028 2028
2029 2029 Upper/lower filters:
2030 2030
2031 2031 $ hg log -r0 --template '{branch|upper}\n'
2032 2032 DEFAULT
2033 2033 $ hg log -r0 --template '{author|lower}\n'
2034 2034 user name <user@hostname>
2035 2035 $ hg log -r0 --template '{date|upper}\n'
2036 2036 abort: template filter 'upper' is not compatible with keyword 'date'
2037 2037 [255]
2038 2038
2039 2039 Add a commit that does all possible modifications at once
2040 2040
2041 2041 $ echo modify >> third
2042 2042 $ touch b
2043 2043 $ hg add b
2044 2044 $ hg mv fourth fifth
2045 2045 $ hg rm a
2046 2046 $ hg ci -m "Modify, add, remove, rename"
2047 2047
2048 2048 Check the status template
2049 2049
2050 2050 $ cat <<EOF >> $HGRCPATH
2051 2051 > [extensions]
2052 2052 > color=
2053 2053 > EOF
2054 2054
2055 2055 $ hg log -T status -r 10
2056 2056 changeset: 10:0f9759ec227a
2057 2057 tag: tip
2058 2058 user: test
2059 2059 date: Thu Jan 01 00:00:00 1970 +0000
2060 2060 summary: Modify, add, remove, rename
2061 2061 files:
2062 2062 M third
2063 2063 A b
2064 2064 A fifth
2065 2065 R a
2066 2066 R fourth
2067 2067
2068 2068 $ hg log -T status -C -r 10
2069 2069 changeset: 10:0f9759ec227a
2070 2070 tag: tip
2071 2071 user: test
2072 2072 date: Thu Jan 01 00:00:00 1970 +0000
2073 2073 summary: Modify, add, remove, rename
2074 2074 files:
2075 2075 M third
2076 2076 A b
2077 2077 A fifth
2078 2078 fourth
2079 2079 R a
2080 2080 R fourth
2081 2081
2082 2082 $ hg log -T status -C -r 10 -v
2083 2083 changeset: 10:0f9759ec227a
2084 2084 tag: tip
2085 2085 user: test
2086 2086 date: Thu Jan 01 00:00:00 1970 +0000
2087 2087 description:
2088 2088 Modify, add, remove, rename
2089 2089
2090 2090 files:
2091 2091 M third
2092 2092 A b
2093 2093 A fifth
2094 2094 fourth
2095 2095 R a
2096 2096 R fourth
2097 2097
2098 2098 $ hg log -T status -C -r 10 --debug
2099 2099 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2100 2100 tag: tip
2101 2101 phase: secret
2102 2102 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2103 2103 parent: -1:0000000000000000000000000000000000000000
2104 2104 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2105 2105 user: test
2106 2106 date: Thu Jan 01 00:00:00 1970 +0000
2107 2107 extra: branch=default
2108 2108 description:
2109 2109 Modify, add, remove, rename
2110 2110
2111 2111 files:
2112 2112 M third
2113 2113 A b
2114 2114 A fifth
2115 2115 fourth
2116 2116 R a
2117 2117 R fourth
2118 2118
2119 2119 $ hg log -T status -C -r 10 --quiet
2120 2120 10:0f9759ec227a
2121 2121 $ hg --color=debug log -T status -r 10
2122 2122 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2123 2123 [log.tag|tag: tip]
2124 2124 [log.user|user: test]
2125 2125 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2126 2126 [log.summary|summary: Modify, add, remove, rename]
2127 2127 [ui.note log.files|files:]
2128 2128 [status.modified|M third]
2129 2129 [status.added|A b]
2130 2130 [status.added|A fifth]
2131 2131 [status.removed|R a]
2132 2132 [status.removed|R fourth]
2133 2133
2134 2134 $ hg --color=debug log -T status -C -r 10
2135 2135 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2136 2136 [log.tag|tag: tip]
2137 2137 [log.user|user: test]
2138 2138 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2139 2139 [log.summary|summary: Modify, add, remove, rename]
2140 2140 [ui.note log.files|files:]
2141 2141 [status.modified|M third]
2142 2142 [status.added|A b]
2143 2143 [status.added|A fifth]
2144 2144 [status.copied| fourth]
2145 2145 [status.removed|R a]
2146 2146 [status.removed|R fourth]
2147 2147
2148 2148 $ hg --color=debug log -T status -C -r 10 -v
2149 2149 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2150 2150 [log.tag|tag: tip]
2151 2151 [log.user|user: test]
2152 2152 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2153 2153 [ui.note log.description|description:]
2154 2154 [ui.note log.description|Modify, add, remove, rename]
2155 2155
2156 2156 [ui.note log.files|files:]
2157 2157 [status.modified|M third]
2158 2158 [status.added|A b]
2159 2159 [status.added|A fifth]
2160 2160 [status.copied| fourth]
2161 2161 [status.removed|R a]
2162 2162 [status.removed|R fourth]
2163 2163
2164 2164 $ hg --color=debug log -T status -C -r 10 --debug
2165 2165 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2166 2166 [log.tag|tag: tip]
2167 2167 [log.phase|phase: secret]
2168 2168 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2169 2169 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2170 2170 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2171 2171 [log.user|user: test]
2172 2172 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2173 2173 [ui.debug log.extra|extra: branch=default]
2174 2174 [ui.note log.description|description:]
2175 2175 [ui.note log.description|Modify, add, remove, rename]
2176 2176
2177 2177 [ui.note log.files|files:]
2178 2178 [status.modified|M third]
2179 2179 [status.added|A b]
2180 2180 [status.added|A fifth]
2181 2181 [status.copied| fourth]
2182 2182 [status.removed|R a]
2183 2183 [status.removed|R fourth]
2184 2184
2185 2185 $ hg --color=debug log -T status -C -r 10 --quiet
2186 2186 [log.node|10:0f9759ec227a]
2187 2187
2188 2188 Check the bisect template
2189 2189
2190 2190 $ hg bisect -g 1
2191 2191 $ hg bisect -b 3 --noupdate
2192 2192 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2193 2193 $ hg log -T bisect -r 0:4
2194 2194 changeset: 0:1e4e1b8f71e0
2195 2195 bisect: good (implicit)
2196 2196 user: User Name <user@hostname>
2197 2197 date: Mon Jan 12 13:46:40 1970 +0000
2198 2198 summary: line 1
2199 2199
2200 2200 changeset: 1:b608e9d1a3f0
2201 2201 bisect: good
2202 2202 user: A. N. Other <other@place>
2203 2203 date: Tue Jan 13 17:33:20 1970 +0000
2204 2204 summary: other 1
2205 2205
2206 2206 changeset: 2:97054abb4ab8
2207 2207 bisect: untested
2208 2208 user: other@place
2209 2209 date: Wed Jan 14 21:20:00 1970 +0000
2210 2210 summary: no person
2211 2211
2212 2212 changeset: 3:10e46f2dcbf4
2213 2213 bisect: bad
2214 2214 user: person
2215 2215 date: Fri Jan 16 01:06:40 1970 +0000
2216 2216 summary: no user, no domain
2217 2217
2218 2218 changeset: 4:bbe44766e73d
2219 2219 bisect: bad (implicit)
2220 2220 branch: foo
2221 2221 user: person
2222 2222 date: Sat Jan 17 04:53:20 1970 +0000
2223 2223 summary: new branch
2224 2224
2225 2225 $ hg log --debug -T bisect -r 0:4
2226 2226 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2227 2227 bisect: good (implicit)
2228 2228 phase: public
2229 2229 parent: -1:0000000000000000000000000000000000000000
2230 2230 parent: -1:0000000000000000000000000000000000000000
2231 2231 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2232 2232 user: User Name <user@hostname>
2233 2233 date: Mon Jan 12 13:46:40 1970 +0000
2234 2234 files+: a
2235 2235 extra: branch=default
2236 2236 description:
2237 2237 line 1
2238 2238 line 2
2239 2239
2240 2240
2241 2241 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2242 2242 bisect: good
2243 2243 phase: public
2244 2244 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2245 2245 parent: -1:0000000000000000000000000000000000000000
2246 2246 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2247 2247 user: A. N. Other <other@place>
2248 2248 date: Tue Jan 13 17:33:20 1970 +0000
2249 2249 files+: b
2250 2250 extra: branch=default
2251 2251 description:
2252 2252 other 1
2253 2253 other 2
2254 2254
2255 2255 other 3
2256 2256
2257 2257
2258 2258 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2259 2259 bisect: untested
2260 2260 phase: public
2261 2261 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2262 2262 parent: -1:0000000000000000000000000000000000000000
2263 2263 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2264 2264 user: other@place
2265 2265 date: Wed Jan 14 21:20:00 1970 +0000
2266 2266 files+: c
2267 2267 extra: branch=default
2268 2268 description:
2269 2269 no person
2270 2270
2271 2271
2272 2272 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2273 2273 bisect: bad
2274 2274 phase: public
2275 2275 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2276 2276 parent: -1:0000000000000000000000000000000000000000
2277 2277 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2278 2278 user: person
2279 2279 date: Fri Jan 16 01:06:40 1970 +0000
2280 2280 files: c
2281 2281 extra: branch=default
2282 2282 description:
2283 2283 no user, no domain
2284 2284
2285 2285
2286 2286 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2287 2287 bisect: bad (implicit)
2288 2288 branch: foo
2289 2289 phase: draft
2290 2290 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2291 2291 parent: -1:0000000000000000000000000000000000000000
2292 2292 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2293 2293 user: person
2294 2294 date: Sat Jan 17 04:53:20 1970 +0000
2295 2295 extra: branch=foo
2296 2296 description:
2297 2297 new branch
2298 2298
2299 2299
2300 2300 $ hg log -v -T bisect -r 0:4
2301 2301 changeset: 0:1e4e1b8f71e0
2302 2302 bisect: good (implicit)
2303 2303 user: User Name <user@hostname>
2304 2304 date: Mon Jan 12 13:46:40 1970 +0000
2305 2305 files: a
2306 2306 description:
2307 2307 line 1
2308 2308 line 2
2309 2309
2310 2310
2311 2311 changeset: 1:b608e9d1a3f0
2312 2312 bisect: good
2313 2313 user: A. N. Other <other@place>
2314 2314 date: Tue Jan 13 17:33:20 1970 +0000
2315 2315 files: b
2316 2316 description:
2317 2317 other 1
2318 2318 other 2
2319 2319
2320 2320 other 3
2321 2321
2322 2322
2323 2323 changeset: 2:97054abb4ab8
2324 2324 bisect: untested
2325 2325 user: other@place
2326 2326 date: Wed Jan 14 21:20:00 1970 +0000
2327 2327 files: c
2328 2328 description:
2329 2329 no person
2330 2330
2331 2331
2332 2332 changeset: 3:10e46f2dcbf4
2333 2333 bisect: bad
2334 2334 user: person
2335 2335 date: Fri Jan 16 01:06:40 1970 +0000
2336 2336 files: c
2337 2337 description:
2338 2338 no user, no domain
2339 2339
2340 2340
2341 2341 changeset: 4:bbe44766e73d
2342 2342 bisect: bad (implicit)
2343 2343 branch: foo
2344 2344 user: person
2345 2345 date: Sat Jan 17 04:53:20 1970 +0000
2346 2346 description:
2347 2347 new branch
2348 2348
2349 2349
2350 2350 $ hg --color=debug log -T bisect -r 0:4
2351 2351 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2352 2352 [log.bisect bisect.good|bisect: good (implicit)]
2353 2353 [log.user|user: User Name <user@hostname>]
2354 2354 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2355 2355 [log.summary|summary: line 1]
2356 2356
2357 2357 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2358 2358 [log.bisect bisect.good|bisect: good]
2359 2359 [log.user|user: A. N. Other <other@place>]
2360 2360 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2361 2361 [log.summary|summary: other 1]
2362 2362
2363 2363 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2364 2364 [log.bisect bisect.untested|bisect: untested]
2365 2365 [log.user|user: other@place]
2366 2366 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2367 2367 [log.summary|summary: no person]
2368 2368
2369 2369 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2370 2370 [log.bisect bisect.bad|bisect: bad]
2371 2371 [log.user|user: person]
2372 2372 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2373 2373 [log.summary|summary: no user, no domain]
2374 2374
2375 2375 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2376 2376 [log.bisect bisect.bad|bisect: bad (implicit)]
2377 2377 [log.branch|branch: foo]
2378 2378 [log.user|user: person]
2379 2379 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2380 2380 [log.summary|summary: new branch]
2381 2381
2382 2382 $ hg --color=debug log --debug -T bisect -r 0:4
2383 2383 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2384 2384 [log.bisect bisect.good|bisect: good (implicit)]
2385 2385 [log.phase|phase: public]
2386 2386 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2387 2387 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2388 2388 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2389 2389 [log.user|user: User Name <user@hostname>]
2390 2390 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2391 2391 [ui.debug log.files|files+: a]
2392 2392 [ui.debug log.extra|extra: branch=default]
2393 2393 [ui.note log.description|description:]
2394 2394 [ui.note log.description|line 1
2395 2395 line 2]
2396 2396
2397 2397
2398 2398 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2399 2399 [log.bisect bisect.good|bisect: good]
2400 2400 [log.phase|phase: public]
2401 2401 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2402 2402 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2403 2403 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2404 2404 [log.user|user: A. N. Other <other@place>]
2405 2405 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2406 2406 [ui.debug log.files|files+: b]
2407 2407 [ui.debug log.extra|extra: branch=default]
2408 2408 [ui.note log.description|description:]
2409 2409 [ui.note log.description|other 1
2410 2410 other 2
2411 2411
2412 2412 other 3]
2413 2413
2414 2414
2415 2415 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2416 2416 [log.bisect bisect.untested|bisect: untested]
2417 2417 [log.phase|phase: public]
2418 2418 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2419 2419 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2420 2420 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2421 2421 [log.user|user: other@place]
2422 2422 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2423 2423 [ui.debug log.files|files+: c]
2424 2424 [ui.debug log.extra|extra: branch=default]
2425 2425 [ui.note log.description|description:]
2426 2426 [ui.note log.description|no person]
2427 2427
2428 2428
2429 2429 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2430 2430 [log.bisect bisect.bad|bisect: bad]
2431 2431 [log.phase|phase: public]
2432 2432 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2433 2433 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2434 2434 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2435 2435 [log.user|user: person]
2436 2436 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2437 2437 [ui.debug log.files|files: c]
2438 2438 [ui.debug log.extra|extra: branch=default]
2439 2439 [ui.note log.description|description:]
2440 2440 [ui.note log.description|no user, no domain]
2441 2441
2442 2442
2443 2443 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2444 2444 [log.bisect bisect.bad|bisect: bad (implicit)]
2445 2445 [log.branch|branch: foo]
2446 2446 [log.phase|phase: draft]
2447 2447 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2448 2448 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2449 2449 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2450 2450 [log.user|user: person]
2451 2451 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2452 2452 [ui.debug log.extra|extra: branch=foo]
2453 2453 [ui.note log.description|description:]
2454 2454 [ui.note log.description|new branch]
2455 2455
2456 2456
2457 2457 $ hg --color=debug log -v -T bisect -r 0:4
2458 2458 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2459 2459 [log.bisect bisect.good|bisect: good (implicit)]
2460 2460 [log.user|user: User Name <user@hostname>]
2461 2461 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2462 2462 [ui.note log.files|files: a]
2463 2463 [ui.note log.description|description:]
2464 2464 [ui.note log.description|line 1
2465 2465 line 2]
2466 2466
2467 2467
2468 2468 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2469 2469 [log.bisect bisect.good|bisect: good]
2470 2470 [log.user|user: A. N. Other <other@place>]
2471 2471 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2472 2472 [ui.note log.files|files: b]
2473 2473 [ui.note log.description|description:]
2474 2474 [ui.note log.description|other 1
2475 2475 other 2
2476 2476
2477 2477 other 3]
2478 2478
2479 2479
2480 2480 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2481 2481 [log.bisect bisect.untested|bisect: untested]
2482 2482 [log.user|user: other@place]
2483 2483 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2484 2484 [ui.note log.files|files: c]
2485 2485 [ui.note log.description|description:]
2486 2486 [ui.note log.description|no person]
2487 2487
2488 2488
2489 2489 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2490 2490 [log.bisect bisect.bad|bisect: bad]
2491 2491 [log.user|user: person]
2492 2492 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2493 2493 [ui.note log.files|files: c]
2494 2494 [ui.note log.description|description:]
2495 2495 [ui.note log.description|no user, no domain]
2496 2496
2497 2497
2498 2498 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2499 2499 [log.bisect bisect.bad|bisect: bad (implicit)]
2500 2500 [log.branch|branch: foo]
2501 2501 [log.user|user: person]
2502 2502 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2503 2503 [ui.note log.description|description:]
2504 2504 [ui.note log.description|new branch]
2505 2505
2506 2506
2507 2507 $ hg bisect --reset
2508 2508
2509 2509 Error on syntax:
2510 2510
2511 2511 $ echo 'x = "f' >> t
2512 2512 $ hg log
2513 2513 hg: parse error at t:3: unmatched quotes
2514 2514 [255]
2515 2515
2516 2516 $ hg log -T '{date'
2517 2517 hg: parse error at 1: unterminated template expansion
2518 2518 [255]
2519 2519
2520 2520 Behind the scenes, this will throw TypeError
2521 2521
2522 2522 $ hg log -l 3 --template '{date|obfuscate}\n'
2523 2523 abort: template filter 'obfuscate' is not compatible with keyword 'date'
2524 2524 [255]
2525 2525
2526 2526 Behind the scenes, this will throw a ValueError
2527 2527
2528 2528 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2529 2529 abort: template filter 'shortdate' is not compatible with keyword 'desc'
2530 2530 [255]
2531 2531
2532 2532 Behind the scenes, this will throw AttributeError
2533 2533
2534 2534 $ hg log -l 3 --template 'line: {date|escape}\n'
2535 2535 abort: template filter 'escape' is not compatible with keyword 'date'
2536 2536 [255]
2537 2537
2538 2538 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2539 2539 hg: parse error: localdate expects a date information
2540 2540 [255]
2541 2541
2542 2542 Behind the scenes, this will throw ValueError
2543 2543
2544 2544 $ hg tip --template '{author|email|date}\n'
2545 2545 hg: parse error: date expects a date information
2546 2546 [255]
2547 2547
2548 2548 Error in nested template:
2549 2549
2550 2550 $ hg log -T '{"date'
2551 2551 hg: parse error at 2: unterminated string
2552 2552 [255]
2553 2553
2554 2554 $ hg log -T '{"foo{date|=}"}'
2555 2555 hg: parse error at 11: syntax error
2556 2556 [255]
2557 2557
2558 2558 Thrown an error if a template function doesn't exist
2559 2559
2560 2560 $ hg tip --template '{foo()}\n'
2561 2561 hg: parse error: unknown function 'foo'
2562 2562 [255]
2563 2563
2564 2564 Pass generator object created by template function to filter
2565 2565
2566 2566 $ hg log -l 1 --template '{if(author, author)|user}\n'
2567 2567 test
2568 2568
2569 2569 Test diff function:
2570 2570
2571 2571 $ hg diff -c 8
2572 2572 diff -r 29114dbae42b -r 95c24699272e fourth
2573 2573 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2574 2574 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2575 2575 @@ -0,0 +1,1 @@
2576 2576 +second
2577 2577 diff -r 29114dbae42b -r 95c24699272e second
2578 2578 --- a/second Mon Jan 12 13:46:40 1970 +0000
2579 2579 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2580 2580 @@ -1,1 +0,0 @@
2581 2581 -second
2582 2582 diff -r 29114dbae42b -r 95c24699272e third
2583 2583 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2584 2584 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2585 2585 @@ -0,0 +1,1 @@
2586 2586 +third
2587 2587
2588 2588 $ hg log -r 8 -T "{diff()}"
2589 2589 diff -r 29114dbae42b -r 95c24699272e fourth
2590 2590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2591 2591 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2592 2592 @@ -0,0 +1,1 @@
2593 2593 +second
2594 2594 diff -r 29114dbae42b -r 95c24699272e second
2595 2595 --- a/second Mon Jan 12 13:46:40 1970 +0000
2596 2596 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2597 2597 @@ -1,1 +0,0 @@
2598 2598 -second
2599 2599 diff -r 29114dbae42b -r 95c24699272e third
2600 2600 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2601 2601 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2602 2602 @@ -0,0 +1,1 @@
2603 2603 +third
2604 2604
2605 2605 $ hg log -r 8 -T "{diff('glob:f*')}"
2606 2606 diff -r 29114dbae42b -r 95c24699272e fourth
2607 2607 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2608 2608 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2609 2609 @@ -0,0 +1,1 @@
2610 2610 +second
2611 2611
2612 2612 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2613 2613 diff -r 29114dbae42b -r 95c24699272e second
2614 2614 --- a/second Mon Jan 12 13:46:40 1970 +0000
2615 2615 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2616 2616 @@ -1,1 +0,0 @@
2617 2617 -second
2618 2618 diff -r 29114dbae42b -r 95c24699272e third
2619 2619 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2620 2620 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2621 2621 @@ -0,0 +1,1 @@
2622 2622 +third
2623 2623
2624 2624 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2625 2625 diff -r 29114dbae42b -r 95c24699272e fourth
2626 2626 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2627 2627 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2628 2628 @@ -0,0 +1,1 @@
2629 2629 +second
2630 2630
2631 2631 $ cd ..
2632 2632
2633 2633
2634 2634 latesttag:
2635 2635
2636 2636 $ hg init latesttag
2637 2637 $ cd latesttag
2638 2638
2639 2639 $ echo a > file
2640 2640 $ hg ci -Am a -d '0 0'
2641 2641 adding file
2642 2642
2643 2643 $ echo b >> file
2644 2644 $ hg ci -m b -d '1 0'
2645 2645
2646 2646 $ echo c >> head1
2647 2647 $ hg ci -Am h1c -d '2 0'
2648 2648 adding head1
2649 2649
2650 2650 $ hg update -q 1
2651 2651 $ echo d >> head2
2652 2652 $ hg ci -Am h2d -d '3 0'
2653 2653 adding head2
2654 2654 created new head
2655 2655
2656 2656 $ echo e >> head2
2657 2657 $ hg ci -m h2e -d '4 0'
2658 2658
2659 2659 $ hg merge -q
2660 2660 $ hg ci -m merge -d '5 -3600'
2661 2661
2662 2662 No tag set:
2663 2663
2664 2664 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2665 2665 5: null+5
2666 2666 4: null+4
2667 2667 3: null+3
2668 2668 2: null+3
2669 2669 1: null+2
2670 2670 0: null+1
2671 2671
2672 2672 One common tag: longest path wins:
2673 2673
2674 2674 $ hg tag -r 1 -m t1 -d '6 0' t1
2675 2675 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2676 2676 6: t1+4
2677 2677 5: t1+3
2678 2678 4: t1+2
2679 2679 3: t1+1
2680 2680 2: t1+1
2681 2681 1: t1+0
2682 2682 0: null+1
2683 2683
2684 2684 One ancestor tag: more recent wins:
2685 2685
2686 2686 $ hg tag -r 2 -m t2 -d '7 0' t2
2687 2687 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2688 2688 7: t2+3
2689 2689 6: t2+2
2690 2690 5: t2+1
2691 2691 4: t1+2
2692 2692 3: t1+1
2693 2693 2: t2+0
2694 2694 1: t1+0
2695 2695 0: null+1
2696 2696
2697 2697 Two branch tags: more recent wins:
2698 2698
2699 2699 $ hg tag -r 3 -m t3 -d '8 0' t3
2700 2700 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2701 2701 8: t3+5
2702 2702 7: t3+4
2703 2703 6: t3+3
2704 2704 5: t3+2
2705 2705 4: t3+1
2706 2706 3: t3+0
2707 2707 2: t2+0
2708 2708 1: t1+0
2709 2709 0: null+1
2710 2710
2711 2711 Merged tag overrides:
2712 2712
2713 2713 $ hg tag -r 5 -m t5 -d '9 0' t5
2714 2714 $ hg tag -r 3 -m at3 -d '10 0' at3
2715 2715 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2716 2716 10: t5+5
2717 2717 9: t5+4
2718 2718 8: t5+3
2719 2719 7: t5+2
2720 2720 6: t5+1
2721 2721 5: t5+0
2722 2722 4: at3:t3+1
2723 2723 3: at3:t3+0
2724 2724 2: t2+0
2725 2725 1: t1+0
2726 2726 0: null+1
2727 2727
2728 2728 $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
2729 2729 10: t5+5,5
2730 2730 9: t5+4,4
2731 2731 8: t5+3,3
2732 2732 7: t5+2,2
2733 2733 6: t5+1,1
2734 2734 5: t5+0,0
2735 2735 4: at3+1,1 t3+1,1
2736 2736 3: at3+0,0 t3+0,0
2737 2737 2: t2+0,0
2738 2738 1: t1+0,0
2739 2739 0: null+1,1
2740 2740
2741 2741 $ hg log --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
2742 2742 10: t3, C: 8, D: 7
2743 2743 9: t3, C: 7, D: 6
2744 2744 8: t3, C: 6, D: 5
2745 2745 7: t3, C: 5, D: 4
2746 2746 6: t3, C: 4, D: 3
2747 2747 5: t3, C: 3, D: 2
2748 2748 4: t3, C: 1, D: 1
2749 2749 3: t3, C: 0, D: 0
2750 2750 2: t1, C: 1, D: 1
2751 2751 1: t1, C: 0, D: 0
2752 2752 0: null, C: 1, D: 1
2753 2753
2754 2754 $ cd ..
2755 2755
2756 2756
2757 2757 Style path expansion: issue1948 - ui.style option doesn't work on OSX
2758 2758 if it is a relative path
2759 2759
2760 2760 $ mkdir -p home/styles
2761 2761
2762 2762 $ cat > home/styles/teststyle <<EOF
2763 2763 > changeset = 'test {rev}:{node|short}\n'
2764 2764 > EOF
2765 2765
2766 2766 $ HOME=`pwd`/home; export HOME
2767 2767
2768 2768 $ cat > latesttag/.hg/hgrc <<EOF
2769 2769 > [ui]
2770 2770 > style = ~/styles/teststyle
2771 2771 > EOF
2772 2772
2773 2773 $ hg -R latesttag tip
2774 2774 test 10:9b4a630e5f5f
2775 2775
2776 2776 Test recursive showlist template (issue1989):
2777 2777
2778 2778 $ cat > style1989 <<EOF
2779 2779 > changeset = '{file_mods}{manifest}{extras}'
2780 2780 > file_mod = 'M|{author|person}\n'
2781 2781 > manifest = '{rev},{author}\n'
2782 2782 > extra = '{key}: {author}\n'
2783 2783 > EOF
2784 2784
2785 2785 $ hg -R latesttag log -r tip --style=style1989
2786 2786 M|test
2787 2787 10,test
2788 2788 branch: test
2789 2789
2790 2790 Test new-style inline templating:
2791 2791
2792 2792 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
2793 2793 modified files: .hgtags
2794 2794
2795 2795
2796 2796 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
2797 2797 hg: parse error: keyword 'rev' is not iterable
2798 2798 [255]
2799 2799 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
2800 2800 hg: parse error: None is not iterable
2801 2801 [255]
2802 2802
2803 2803 Test the sub function of templating for expansion:
2804 2804
2805 2805 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
2806 2806 xx
2807 2807
2808 2808 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
2809 2809 hg: parse error: sub got an invalid pattern: [
2810 2810 [255]
2811 2811 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
2812 2812 hg: parse error: sub got an invalid replacement: \1
2813 2813 [255]
2814 2814
2815 2815 Test the strip function with chars specified:
2816 2816
2817 2817 $ hg log -R latesttag --template '{desc}\n'
2818 2818 at3
2819 2819 t5
2820 2820 t3
2821 2821 t2
2822 2822 t1
2823 2823 merge
2824 2824 h2e
2825 2825 h2d
2826 2826 h1c
2827 2827 b
2828 2828 a
2829 2829
2830 2830 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
2831 2831 at3
2832 2832 5
2833 2833 3
2834 2834 2
2835 2835 1
2836 2836 merg
2837 2837 h2
2838 2838 h2d
2839 2839 h1c
2840 2840 b
2841 2841 a
2842 2842
2843 2843 Test date format:
2844 2844
2845 2845 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
2846 2846 date: 70 01 01 10 +0000
2847 2847 date: 70 01 01 09 +0000
2848 2848 date: 70 01 01 08 +0000
2849 2849 date: 70 01 01 07 +0000
2850 2850 date: 70 01 01 06 +0000
2851 2851 date: 70 01 01 05 +0100
2852 2852 date: 70 01 01 04 +0000
2853 2853 date: 70 01 01 03 +0000
2854 2854 date: 70 01 01 02 +0000
2855 2855 date: 70 01 01 01 +0000
2856 2856 date: 70 01 01 00 +0000
2857 2857
2858 2858 Test invalid date:
2859 2859
2860 2860 $ hg log -R latesttag -T '{date(rev)}\n'
2861 2861 hg: parse error: date expects a date information
2862 2862 [255]
2863 2863
2864 2864 Test integer literal:
2865 2865
2866 2866 $ hg debugtemplate -v '{(0)}\n'
2867 2867 (template
2868 2868 (group
2869 2869 ('integer', '0'))
2870 2870 ('string', '\n'))
2871 2871 0
2872 2872 $ hg debugtemplate -v '{(123)}\n'
2873 2873 (template
2874 2874 (group
2875 2875 ('integer', '123'))
2876 2876 ('string', '\n'))
2877 2877 123
2878 2878 $ hg debugtemplate -v '{(-4)}\n'
2879 2879 (template
2880 2880 (group
2881 2881 ('integer', '-4'))
2882 2882 ('string', '\n'))
2883 2883 -4
2884 2884 $ hg debugtemplate '{(-)}\n'
2885 2885 hg: parse error at 2: integer literal without digits
2886 2886 [255]
2887 2887 $ hg debugtemplate '{(-a)}\n'
2888 2888 hg: parse error at 2: integer literal without digits
2889 2889 [255]
2890 2890
2891 2891 top-level integer literal is interpreted as symbol (i.e. variable name):
2892 2892
2893 2893 $ hg debugtemplate -D 1=one -v '{1}\n'
2894 2894 (template
2895 2895 ('integer', '1')
2896 2896 ('string', '\n'))
2897 2897 one
2898 2898 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
2899 2899 (template
2900 2900 (func
2901 2901 ('symbol', 'if')
2902 2902 (list
2903 2903 ('string', 't')
2904 2904 (template
2905 2905 ('integer', '1'))))
2906 2906 ('string', '\n'))
2907 2907 one
2908 2908 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
2909 2909 (template
2910 2910 (|
2911 2911 ('integer', '1')
2912 2912 ('symbol', 'stringify'))
2913 2913 ('string', '\n'))
2914 2914 one
2915 2915
2916 2916 unless explicit symbol is expected:
2917 2917
2918 2918 $ hg log -Ra -r0 -T '{desc|1}\n'
2919 2919 hg: parse error: expected a symbol, got 'integer'
2920 2920 [255]
2921 2921 $ hg log -Ra -r0 -T '{1()}\n'
2922 2922 hg: parse error: expected a symbol, got 'integer'
2923 2923 [255]
2924 2924
2925 2925 Test string literal:
2926 2926
2927 2927 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
2928 2928 (template
2929 2929 ('string', 'string with no template fragment')
2930 2930 ('string', '\n'))
2931 2931 string with no template fragment
2932 2932 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
2933 2933 (template
2934 2934 (template
2935 2935 ('string', 'template: ')
2936 2936 ('symbol', 'rev'))
2937 2937 ('string', '\n'))
2938 2938 template: 0
2939 2939 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
2940 2940 (template
2941 2941 ('string', 'rawstring: {rev}')
2942 2942 ('string', '\n'))
2943 2943 rawstring: {rev}
2944 2944 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
2945 2945 (template
2946 2946 (%
2947 2947 ('symbol', 'files')
2948 2948 ('string', 'rawstring: {file}'))
2949 2949 ('string', '\n'))
2950 2950 rawstring: {file}
2951 2951
2952 2952 Test string escaping:
2953 2953
2954 2954 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2955 2955 >
2956 2956 <>\n<[>
2957 2957 <>\n<]>
2958 2958 <>\n<
2959 2959
2960 2960 $ hg log -R latesttag -r 0 \
2961 2961 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2962 2962 >
2963 2963 <>\n<[>
2964 2964 <>\n<]>
2965 2965 <>\n<
2966 2966
2967 2967 $ hg log -R latesttag -r 0 -T esc \
2968 2968 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2969 2969 >
2970 2970 <>\n<[>
2971 2971 <>\n<]>
2972 2972 <>\n<
2973 2973
2974 2974 $ cat <<'EOF' > esctmpl
2975 2975 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2976 2976 > EOF
2977 2977 $ hg log -R latesttag -r 0 --style ./esctmpl
2978 2978 >
2979 2979 <>\n<[>
2980 2980 <>\n<]>
2981 2981 <>\n<
2982 2982
2983 2983 Test string escaping of quotes:
2984 2984
2985 2985 $ hg log -Ra -r0 -T '{"\""}\n'
2986 2986 "
2987 2987 $ hg log -Ra -r0 -T '{"\\\""}\n'
2988 2988 \"
2989 2989 $ hg log -Ra -r0 -T '{r"\""}\n'
2990 2990 \"
2991 2991 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2992 2992 \\\"
2993 2993
2994 2994
2995 2995 $ hg log -Ra -r0 -T '{"\""}\n'
2996 2996 "
2997 2997 $ hg log -Ra -r0 -T '{"\\\""}\n'
2998 2998 \"
2999 2999 $ hg log -Ra -r0 -T '{r"\""}\n'
3000 3000 \"
3001 3001 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3002 3002 \\\"
3003 3003
3004 3004 Test exception in quoted template. single backslash before quotation mark is
3005 3005 stripped before parsing:
3006 3006
3007 3007 $ cat <<'EOF' > escquotetmpl
3008 3008 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3009 3009 > EOF
3010 3010 $ cd latesttag
3011 3011 $ hg log -r 2 --style ../escquotetmpl
3012 3012 " \" \" \\" head1
3013 3013
3014 3014 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3015 3015 valid
3016 3016 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3017 3017 valid
3018 3018
3019 3019 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3020 3020 _evalifliteral() templates (issue4733):
3021 3021
3022 3022 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3023 3023 "2
3024 3024 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3025 3025 "2
3026 3026 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3027 3027 "2
3028 3028
3029 3029 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3030 3030 \"
3031 3031 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3032 3032 \"
3033 3033 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3034 3034 \"
3035 3035
3036 3036 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3037 3037 \\\"
3038 3038 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3039 3039 \\\"
3040 3040 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3041 3041 \\\"
3042 3042
3043 3043 escaped single quotes and errors:
3044 3044
3045 3045 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3046 3046 foo
3047 3047 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3048 3048 foo
3049 3049 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3050 3050 hg: parse error at 21: unterminated string
3051 3051 [255]
3052 3052 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3053 3053 hg: parse error: trailing \ in string
3054 3054 [255]
3055 3055 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3056 3056 hg: parse error: trailing \ in string
3057 3057 [255]
3058 3058
3059 3059 $ cd ..
3060 3060
3061 3061 Test leading backslashes:
3062 3062
3063 3063 $ cd latesttag
3064 3064 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3065 3065 {rev} {file}
3066 3066 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3067 3067 \2 \head1
3068 3068 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3069 3069 \{rev} \{file}
3070 3070 $ cd ..
3071 3071
3072 3072 Test leading backslashes in "if" expression (issue4714):
3073 3073
3074 3074 $ cd latesttag
3075 3075 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3076 3076 {rev} \{rev}
3077 3077 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3078 3078 \2 \\{rev}
3079 3079 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3080 3080 \{rev} \\\{rev}
3081 3081 $ cd ..
3082 3082
3083 3083 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3084 3084
3085 3085 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3086 3086 \x6e
3087 3087 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3088 3088 \x5c\x786e
3089 3089 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3090 3090 \x6e
3091 3091 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3092 3092 \x5c\x786e
3093 3093
3094 3094 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3095 3095 \x6e
3096 3096 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3097 3097 \x5c\x786e
3098 3098 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3099 3099 \x6e
3100 3100 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3101 3101 \x5c\x786e
3102 3102
3103 3103 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3104 3104 fourth
3105 3105 second
3106 3106 third
3107 3107 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3108 3108 fourth\nsecond\nthird
3109 3109
3110 3110 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3111 3111 <p>
3112 3112 1st
3113 3113 </p>
3114 3114 <p>
3115 3115 2nd
3116 3116 </p>
3117 3117 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3118 3118 <p>
3119 3119 1st\n\n2nd
3120 3120 </p>
3121 3121 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3122 3122 1st
3123 3123
3124 3124 2nd
3125 3125
3126 3126 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3127 3127 o perso
3128 3128 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3129 3129 no person
3130 3130 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3131 3131 o perso
3132 3132 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3133 3133 no perso
3134 3134
3135 3135 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3136 3136 -o perso-
3137 3137 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3138 3138 no person
3139 3139 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3140 3140 \x2do perso\x2d
3141 3141 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3142 3142 -o perso-
3143 3143 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3144 3144 \x2do perso\x6e
3145 3145
3146 3146 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3147 3147 fourth
3148 3148 second
3149 3149 third
3150 3150
3151 3151 Test string escaping in nested expression:
3152 3152
3153 3153 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3154 3154 fourth\x6esecond\x6ethird
3155 3155 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3156 3156 fourth\x6esecond\x6ethird
3157 3157
3158 3158 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3159 3159 fourth\x6esecond\x6ethird
3160 3160 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3161 3161 fourth\x5c\x786esecond\x5c\x786ethird
3162 3162
3163 3163 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3164 3164 3:\x6eo user, \x6eo domai\x6e
3165 3165 4:\x5c\x786eew bra\x5c\x786ech
3166 3166
3167 3167 Test quotes in nested expression are evaluated just like a $(command)
3168 3168 substitution in POSIX shells:
3169 3169
3170 3170 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3171 3171 8:95c24699272e
3172 3172 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3173 3173 {8} "95c24699272e"
3174 3174
3175 3175 Test recursive evaluation:
3176 3176
3177 3177 $ hg init r
3178 3178 $ cd r
3179 3179 $ echo a > a
3180 3180 $ hg ci -Am '{rev}'
3181 3181 adding a
3182 3182 $ hg log -r 0 --template '{if(rev, desc)}\n'
3183 3183 {rev}
3184 3184 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3185 3185 test 0
3186 3186
3187 3187 $ hg branch -q 'text.{rev}'
3188 3188 $ echo aa >> aa
3189 3189 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3190 3190
3191 3191 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3192 3192 {node|short}desc to
3193 3193 text.{rev}be wrapped
3194 3194 text.{rev}desc to be
3195 3195 text.{rev}wrapped (no-eol)
3196 3196 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3197 3197 bcc7ff960b8e:desc to
3198 3198 text.1:be wrapped
3199 3199 text.1:desc to be
3200 3200 text.1:wrapped (no-eol)
3201 3201 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3202 3202 hg: parse error: fill expects an integer width
3203 3203 [255]
3204 3204
3205 3205 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3206 3206 {node|short} (no-eol)
3207 3207 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3208 3208 bcc-ff---b-e (no-eol)
3209 3209
3210 3210 $ cat >> .hg/hgrc <<EOF
3211 3211 > [extensions]
3212 3212 > color=
3213 3213 > [color]
3214 3214 > mode=ansi
3215 3215 > text.{rev} = red
3216 3216 > text.1 = green
3217 3217 > EOF
3218 3218 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3219 3219 \x1b[0;31mtext\x1b[0m (esc)
3220 3220 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3221 3221 \x1b[0;32mtext\x1b[0m (esc)
3222 3222
3223 3223 color effect can be specified without quoting:
3224 3224
3225 3225 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3226 3226 \x1b[0;31mtext\x1b[0m (esc)
3227 3227
3228 3228 label should be no-op if color is disabled:
3229 3229
3230 3230 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3231 3231 text
3232 3232 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3233 3233 text
3234 3234
3235 3235 Test branches inside if statement:
3236 3236
3237 3237 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3238 3238 no
3239 3239
3240 3240 Test get function:
3241 3241
3242 3242 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3243 3243 default
3244 3244 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3245 3245 default
3246 3246 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3247 3247 hg: parse error: get() expects a dict as first argument
3248 3248 [255]
3249 3249
3250 3250 Test localdate(date, tz) function:
3251 3251
3252 3252 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3253 3253 1970-01-01 09:00 +0900
3254 3254 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3255 3255 1970-01-01 00:00 +0000
3256 3256 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3257 3257 1970-01-01 02:00 +0200
3258 3258 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3259 3259 1970-01-01 00:00 +0000
3260 3260 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3261 3261 1970-01-01 00:00 +0000
3262 3262 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3263 3263 hg: parse error: localdate expects a timezone
3264 3264 [255]
3265 3265 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3266 3266 hg: parse error: localdate expects a timezone
3267 3267 [255]
3268 3268
3269 3269 Test shortest(node) function:
3270 3270
3271 3271 $ echo b > b
3272 3272 $ hg ci -qAm b
3273 3273 $ hg log --template '{shortest(node)}\n'
3274 3274 e777
3275 3275 bcc7
3276 3276 f776
3277 3277 $ hg log --template '{shortest(node, 10)}\n'
3278 3278 e777603221
3279 3279 bcc7ff960b
3280 3280 f7769ec2ab
3281 3281 $ hg log --template '{node|shortest}\n' -l1
3282 3282 e777
3283 3283
3284 3284 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
3285 3285 f7769ec2ab
3286 3286 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
3287 3287 hg: parse error: shortest() expects an integer minlength
3288 3288 [255]
3289 3289
3290 3290 Test pad function
3291 3291
3292 3292 $ hg log --template '{pad(rev, 20)} {author|user}\n'
3293 3293 2 test
3294 3294 1 {node|short}
3295 3295 0 test
3296 3296
3297 3297 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
3298 3298 2 test
3299 3299 1 {node|short}
3300 3300 0 test
3301 3301
3302 3302 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
3303 3303 2------------------- test
3304 3304 1------------------- {node|short}
3305 3305 0------------------- test
3306 3306
3307 3307 Test template string in pad function
3308 3308
3309 3309 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
3310 3310 {0} test
3311 3311
3312 3312 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
3313 3313 \{rev} test
3314 3314
3315 3315 Test width argument passed to pad function
3316 3316
3317 3317 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
3318 3318 0 test
3319 3319 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
3320 3320 hg: parse error: pad() expects an integer width
3321 3321 [255]
3322 3322
3323 3323 Test separate function
3324 3324
3325 3325 $ hg log -r 0 -T '{separate("-", "", "a", "b", "", "", "c", "")}\n'
3326 3326 a-b-c
3327 3327 $ hg log -r 0 -T '{separate(" ", "{rev}:{node|short}", author|user, branch)}\n'
3328 3328 0:f7769ec2ab97 test default
3329 3329 $ hg log -r 0 --color=always -T '{separate(" ", "a", label(red, "b"), "c", label(red, ""), "d")}\n'
3330 3330 a \x1b[0;31mb\x1b[0m c d (esc)
3331 3331
3332 3332 Test ifcontains function
3333 3333
3334 3334 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
3335 3335 2 is in the string
3336 3336 1 is not
3337 3337 0 is in the string
3338 3338
3339 3339 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
3340 3340 2 is in the string
3341 3341 1 is not
3342 3342 0 is in the string
3343 3343
3344 3344 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
3345 3345 2 did not add a
3346 3346 1 did not add a
3347 3347 0 added a
3348 3348
3349 3349 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
3350 3350 2 is parent of 1
3351 3351 1
3352 3352 0
3353 3353
3354 3354 Test revset function
3355 3355
3356 3356 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
3357 3357 2 current rev
3358 3358 1 not current rev
3359 3359 0 not current rev
3360 3360
3361 3361 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
3362 3362 2 match rev
3363 3363 1 match rev
3364 3364 0 not match rev
3365 3365
3366 3366 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
3367 3367 2 Parents: 1
3368 3368 1 Parents: 0
3369 3369 0 Parents:
3370 3370
3371 3371 $ cat >> .hg/hgrc <<EOF
3372 3372 > [revsetalias]
3373 3373 > myparents(\$1) = parents(\$1)
3374 3374 > EOF
3375 3375 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
3376 3376 2 Parents: 1
3377 3377 1 Parents: 0
3378 3378 0 Parents:
3379 3379
3380 3380 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
3381 3381 Rev: 2
3382 3382 Ancestor: 0
3383 3383 Ancestor: 1
3384 3384 Ancestor: 2
3385 3385
3386 3386 Rev: 1
3387 3387 Ancestor: 0
3388 3388 Ancestor: 1
3389 3389
3390 3390 Rev: 0
3391 3391 Ancestor: 0
3392 3392
3393 3393 $ hg log --template '{revset("TIP"|lower)}\n' -l1
3394 3394 2
3395 3395
3396 3396 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
3397 3397 2
3398 3398
3399 3399 a list template is evaluated for each item of revset/parents
3400 3400
3401 3401 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
3402 3402 2 p: 1:bcc7ff960b8e
3403 3403 1 p: 0:f7769ec2ab97
3404 3404 0 p:
3405 3405
3406 3406 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
3407 3407 2 p: 1:bcc7ff960b8e -1:000000000000
3408 3408 1 p: 0:f7769ec2ab97 -1:000000000000
3409 3409 0 p: -1:000000000000 -1:000000000000
3410 3410
3411 3411 therefore, 'revcache' should be recreated for each rev
3412 3412
3413 3413 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
3414 3414 2 aa b
3415 3415 p
3416 3416 1
3417 3417 p a
3418 3418 0 a
3419 3419 p
3420 3420
3421 3421 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
3422 3422 2 aa b
3423 3423 p
3424 3424 1
3425 3425 p a
3426 3426 0 a
3427 3427 p
3428 3428
3429 3429 a revset item must be evaluated as an integer revision, not an offset from tip
3430 3430
3431 3431 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
3432 3432 -1:000000000000
3433 3433 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
3434 3434 -1:000000000000
3435 3435
3436 3436 join() should pick '{rev}' from revset items:
3437 3437
3438 3438 $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6
3439 3439 4, 5
3440 3440
3441 on the other hand, parents are formatted as '{rev}:{node|formatnode}' by
3442 default. join() should agree with the default formatting:
3443
3444 $ hg log -R ../a -T '{join(parents, ", ")}\n' -r6
3445 5:13207e5a10d9, 4:bbe44766e73d
3446
3447 $ hg log -R ../a -T '{join(parents, ",\n")}\n' -r6 --debug
3448 5:13207e5a10d9fd28ec424934298e176197f2c67f,
3449 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
3450
3441 3451 Test active bookmark templating
3442 3452
3443 3453 $ hg book foo
3444 3454 $ hg book bar
3445 3455 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
3446 3456 2 bar* foo
3447 3457 1
3448 3458 0
3449 3459 $ hg log --template "{rev} {activebookmark}\n"
3450 3460 2 bar
3451 3461 1
3452 3462 0
3453 3463 $ hg bookmarks --inactive bar
3454 3464 $ hg log --template "{rev} {activebookmark}\n"
3455 3465 2
3456 3466 1
3457 3467 0
3458 3468 $ hg book -r1 baz
3459 3469 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
3460 3470 2 bar foo
3461 3471 1 baz
3462 3472 0
3463 3473 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
3464 3474 2 t
3465 3475 1 f
3466 3476 0 f
3467 3477
3468 3478 Test namespaces dict
3469 3479
3470 3480 $ hg log -T '{rev}{namespaces % " {namespace}={join(names, ",")}"}\n'
3471 3481 2 bookmarks=bar,foo tags=tip branches=text.{rev}
3472 3482 1 bookmarks=baz tags= branches=text.{rev}
3473 3483 0 bookmarks= tags= branches=default
3474 3484 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
3475 3485 bookmarks: bar foo
3476 3486 tags: tip
3477 3487 branches: text.{rev}
3478 3488 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
3479 3489 bookmarks:
3480 3490 bar
3481 3491 foo
3482 3492 tags:
3483 3493 tip
3484 3494 branches:
3485 3495 text.{rev}
3486 3496 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
3487 3497 bar
3488 3498 foo
3489 3499
3490 3500 Test stringify on sub expressions
3491 3501
3492 3502 $ cd ..
3493 3503 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
3494 3504 fourth, second, third
3495 3505 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
3496 3506 abc
3497 3507
3498 3508 Test splitlines
3499 3509
3500 3510 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
3501 3511 @ foo Modify, add, remove, rename
3502 3512 |
3503 3513 o foo future
3504 3514 |
3505 3515 o foo third
3506 3516 |
3507 3517 o foo second
3508 3518
3509 3519 o foo merge
3510 3520 |\
3511 3521 | o foo new head
3512 3522 | |
3513 3523 o | foo new branch
3514 3524 |/
3515 3525 o foo no user, no domain
3516 3526 |
3517 3527 o foo no person
3518 3528 |
3519 3529 o foo other 1
3520 3530 | foo other 2
3521 3531 | foo
3522 3532 | foo other 3
3523 3533 o foo line 1
3524 3534 foo line 2
3525 3535
3526 3536 Test startswith
3527 3537 $ hg log -Gv -R a --template "{startswith(desc)}"
3528 3538 hg: parse error: startswith expects two arguments
3529 3539 [255]
3530 3540
3531 3541 $ hg log -Gv -R a --template "{startswith('line', desc)}"
3532 3542 @
3533 3543 |
3534 3544 o
3535 3545 |
3536 3546 o
3537 3547 |
3538 3548 o
3539 3549
3540 3550 o
3541 3551 |\
3542 3552 | o
3543 3553 | |
3544 3554 o |
3545 3555 |/
3546 3556 o
3547 3557 |
3548 3558 o
3549 3559 |
3550 3560 o
3551 3561 |
3552 3562 o line 1
3553 3563 line 2
3554 3564
3555 3565 Test bad template with better error message
3556 3566
3557 3567 $ hg log -Gv -R a --template '{desc|user()}'
3558 3568 hg: parse error: expected a symbol, got 'func'
3559 3569 [255]
3560 3570
3561 3571 Test word function (including index out of bounds graceful failure)
3562 3572
3563 3573 $ hg log -Gv -R a --template "{word('1', desc)}"
3564 3574 @ add,
3565 3575 |
3566 3576 o
3567 3577 |
3568 3578 o
3569 3579 |
3570 3580 o
3571 3581
3572 3582 o
3573 3583 |\
3574 3584 | o head
3575 3585 | |
3576 3586 o | branch
3577 3587 |/
3578 3588 o user,
3579 3589 |
3580 3590 o person
3581 3591 |
3582 3592 o 1
3583 3593 |
3584 3594 o 1
3585 3595
3586 3596
3587 3597 Test word third parameter used as splitter
3588 3598
3589 3599 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
3590 3600 @ M
3591 3601 |
3592 3602 o future
3593 3603 |
3594 3604 o third
3595 3605 |
3596 3606 o sec
3597 3607
3598 3608 o merge
3599 3609 |\
3600 3610 | o new head
3601 3611 | |
3602 3612 o | new branch
3603 3613 |/
3604 3614 o n
3605 3615 |
3606 3616 o n
3607 3617 |
3608 3618 o
3609 3619 |
3610 3620 o line 1
3611 3621 line 2
3612 3622
3613 3623 Test word error messages for not enough and too many arguments
3614 3624
3615 3625 $ hg log -Gv -R a --template "{word('0')}"
3616 3626 hg: parse error: word expects two or three arguments, got 1
3617 3627 [255]
3618 3628
3619 3629 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
3620 3630 hg: parse error: word expects two or three arguments, got 7
3621 3631 [255]
3622 3632
3623 3633 Test word for integer literal
3624 3634
3625 3635 $ hg log -R a --template "{word(2, desc)}\n" -r0
3626 3636 line
3627 3637
3628 3638 Test word for invalid numbers
3629 3639
3630 3640 $ hg log -Gv -R a --template "{word('a', desc)}"
3631 3641 hg: parse error: word expects an integer index
3632 3642 [255]
3633 3643
3634 3644 Test word for out of range
3635 3645
3636 3646 $ hg log -R a --template "{word(10000, desc)}"
3637 3647 $ hg log -R a --template "{word(-10000, desc)}"
3638 3648
3639 3649 Test indent and not adding to empty lines
3640 3650
3641 3651 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
3642 3652 -----
3643 3653 > line 1
3644 3654 >> line 2
3645 3655 -----
3646 3656 > other 1
3647 3657 >> other 2
3648 3658
3649 3659 >> other 3
3650 3660
3651 3661 Test with non-strings like dates
3652 3662
3653 3663 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
3654 3664 1200000.00
3655 3665 1300000.00
3656 3666
3657 3667 Test broken string escapes:
3658 3668
3659 3669 $ hg log -T "bogus\\" -R a
3660 3670 hg: parse error: trailing \ in string
3661 3671 [255]
3662 3672 $ hg log -T "\\xy" -R a
3663 3673 hg: parse error: invalid \x escape
3664 3674 [255]
3665 3675
3666 3676 json filter should escape HTML tags so that the output can be embedded in hgweb:
3667 3677
3668 3678 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
3669 3679 "\u003cfoo@example.org\u003e"
3670 3680
3671 3681 Templater supports aliases of symbol and func() styles:
3672 3682
3673 3683 $ hg clone -q a aliases
3674 3684 $ cd aliases
3675 3685 $ cat <<EOF >> .hg/hgrc
3676 3686 > [templatealias]
3677 3687 > r = rev
3678 3688 > rn = "{r}:{node|short}"
3679 3689 > status(c, files) = files % "{c} {file}\n"
3680 3690 > utcdate(d) = localdate(d, "UTC")
3681 3691 > EOF
3682 3692
3683 3693 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
3684 3694 (template
3685 3695 ('symbol', 'rn')
3686 3696 ('string', ' ')
3687 3697 (|
3688 3698 (func
3689 3699 ('symbol', 'utcdate')
3690 3700 ('symbol', 'date'))
3691 3701 ('symbol', 'isodate'))
3692 3702 ('string', '\n'))
3693 3703 * expanded:
3694 3704 (template
3695 3705 (template
3696 3706 ('symbol', 'rev')
3697 3707 ('string', ':')
3698 3708 (|
3699 3709 ('symbol', 'node')
3700 3710 ('symbol', 'short')))
3701 3711 ('string', ' ')
3702 3712 (|
3703 3713 (func
3704 3714 ('symbol', 'localdate')
3705 3715 (list
3706 3716 ('symbol', 'date')
3707 3717 ('string', 'UTC')))
3708 3718 ('symbol', 'isodate'))
3709 3719 ('string', '\n'))
3710 3720 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3711 3721
3712 3722 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
3713 3723 (template
3714 3724 (func
3715 3725 ('symbol', 'status')
3716 3726 (list
3717 3727 ('string', 'A')
3718 3728 ('symbol', 'file_adds'))))
3719 3729 * expanded:
3720 3730 (template
3721 3731 (%
3722 3732 ('symbol', 'file_adds')
3723 3733 (template
3724 3734 ('string', 'A')
3725 3735 ('string', ' ')
3726 3736 ('symbol', 'file')
3727 3737 ('string', '\n'))))
3728 3738 A a
3729 3739
3730 3740 A unary function alias can be called as a filter:
3731 3741
3732 3742 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
3733 3743 (template
3734 3744 (|
3735 3745 (|
3736 3746 ('symbol', 'date')
3737 3747 ('symbol', 'utcdate'))
3738 3748 ('symbol', 'isodate'))
3739 3749 ('string', '\n'))
3740 3750 * expanded:
3741 3751 (template
3742 3752 (|
3743 3753 (func
3744 3754 ('symbol', 'localdate')
3745 3755 (list
3746 3756 ('symbol', 'date')
3747 3757 ('string', 'UTC')))
3748 3758 ('symbol', 'isodate'))
3749 3759 ('string', '\n'))
3750 3760 1970-01-12 13:46 +0000
3751 3761
3752 3762 Aliases should be applied only to command arguments and templates in hgrc.
3753 3763 Otherwise, our stock styles and web templates could be corrupted:
3754 3764
3755 3765 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
3756 3766 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3757 3767
3758 3768 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
3759 3769 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3760 3770
3761 3771 $ cat <<EOF > tmpl
3762 3772 > changeset = 'nothing expanded:{rn}\n'
3763 3773 > EOF
3764 3774 $ hg log -r0 --style ./tmpl
3765 3775 nothing expanded:
3766 3776
3767 3777 Aliases in formatter:
3768 3778
3769 3779 $ hg branches -T '{pad(branch, 7)} {rn}\n'
3770 3780 default 6:d41e714fe50d
3771 3781 foo 4:bbe44766e73d
3772 3782
3773 3783 Aliases should honor HGPLAIN:
3774 3784
3775 3785 $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n'
3776 3786 nothing expanded:
3777 3787 $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n'
3778 3788 0:1e4e1b8f71e0
3779 3789
3780 3790 Unparsable alias:
3781 3791
3782 3792 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
3783 3793 (template
3784 3794 ('symbol', 'bad'))
3785 3795 abort: bad definition of template alias "bad": at 2: not a prefix: end
3786 3796 [255]
3787 3797 $ hg log --config templatealias.bad='x(' -T '{bad}'
3788 3798 abort: bad definition of template alias "bad": at 2: not a prefix: end
3789 3799 [255]
3790 3800
3791 3801 $ cd ..
3792 3802
3793 3803 Set up repository for non-ascii encoding tests:
3794 3804
3795 3805 $ hg init nonascii
3796 3806 $ cd nonascii
3797 3807 $ python <<EOF
3798 3808 > open('latin1', 'w').write('\xe9')
3799 3809 > open('utf-8', 'w').write('\xc3\xa9')
3800 3810 > EOF
3801 3811 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
3802 3812 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
3803 3813
3804 3814 json filter should try round-trip conversion to utf-8:
3805 3815
3806 3816 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
3807 3817 "\u00e9"
3808 3818 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
3809 3819 "non-ascii branch: \u00e9"
3810 3820
3811 3821 json filter takes input as utf-8b:
3812 3822
3813 3823 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
3814 3824 "\u00e9"
3815 3825 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
3816 3826 "\udce9"
3817 3827
3818 3828 utf8 filter:
3819 3829
3820 3830 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
3821 3831 round-trip: c3a9
3822 3832 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
3823 3833 decoded: c3a9
3824 3834 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
3825 3835 abort: decoding near * (glob)
3826 3836 [255]
3827 3837 $ hg log -T "invalid type: {rev|utf8}\n" -r0
3828 3838 abort: template filter 'utf8' is not compatible with keyword 'rev'
3829 3839 [255]
3830 3840
3831 3841 $ cd ..
3832 3842
3833 3843 Test that template function in extension is registered as expected
3834 3844
3835 3845 $ cd a
3836 3846
3837 3847 $ cat <<EOF > $TESTTMP/customfunc.py
3838 3848 > from mercurial import registrar
3839 3849 >
3840 3850 > templatefunc = registrar.templatefunc()
3841 3851 >
3842 3852 > @templatefunc('custom()')
3843 3853 > def custom(context, mapping, args):
3844 3854 > return 'custom'
3845 3855 > EOF
3846 3856 $ cat <<EOF > .hg/hgrc
3847 3857 > [extensions]
3848 3858 > customfunc = $TESTTMP/customfunc.py
3849 3859 > EOF
3850 3860
3851 3861 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
3852 3862 custom
3853 3863
3854 3864 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now