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