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