##// END OF EJS Templates
templatekw: populate all keywords depending on predecessor in map operation...
Yuya Nishihara -
r32910:498e9dcc default
parent child Browse files
Show More
@@ -1,687 +1,688 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 (
11 from .node import (
12 hex,
12 hex,
13 nullid,
13 nullid,
14 short,
14 short,
15 )
15 )
16
16
17 from . import (
17 from . import (
18 encoding,
18 encoding,
19 error,
19 error,
20 hbisect,
20 hbisect,
21 obsutil,
21 obsutil,
22 patch,
22 patch,
23 registrar,
23 registrar,
24 scmutil,
24 scmutil,
25 util,
25 util,
26 )
26 )
27
27
28 class _hybrid(object):
28 class _hybrid(object):
29 """Wrapper for list or dict to support legacy template
29 """Wrapper for list or dict to support legacy template
30
30
31 This class allows us to handle both:
31 This class allows us to handle both:
32 - "{files}" (legacy command-line-specific list hack) and
32 - "{files}" (legacy command-line-specific list hack) and
33 - "{files % '{file}\n'}" (hgweb-style with inlining and function support)
33 - "{files % '{file}\n'}" (hgweb-style with inlining and function support)
34 and to access raw values:
34 and to access raw values:
35 - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
35 - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
36 - "{get(extras, key)}"
36 - "{get(extras, key)}"
37 - "{files|json}"
37 - "{files|json}"
38 """
38 """
39
39
40 def __init__(self, gen, values, makemap, joinfmt):
40 def __init__(self, gen, values, makemap, joinfmt):
41 if gen is not None:
41 if gen is not None:
42 self.gen = gen
42 self.gen = gen
43 self._values = values
43 self._values = values
44 self._makemap = makemap
44 self._makemap = makemap
45 self.joinfmt = joinfmt
45 self.joinfmt = joinfmt
46 @util.propertycache
46 @util.propertycache
47 def gen(self):
47 def gen(self):
48 return self._defaultgen()
48 return self._defaultgen()
49 def _defaultgen(self):
49 def _defaultgen(self):
50 """Generator to stringify this as {join(self, ' ')}"""
50 """Generator to stringify this as {join(self, ' ')}"""
51 for i, d in enumerate(self.itermaps()):
51 for i, d in enumerate(self.itermaps()):
52 if i > 0:
52 if i > 0:
53 yield ' '
53 yield ' '
54 yield self.joinfmt(d)
54 yield self.joinfmt(d)
55 def itermaps(self):
55 def itermaps(self):
56 makemap = self._makemap
56 makemap = self._makemap
57 for x in self._values:
57 for x in self._values:
58 yield makemap(x)
58 yield makemap(x)
59 def __contains__(self, x):
59 def __contains__(self, x):
60 return x in self._values
60 return x in self._values
61 def __len__(self):
61 def __len__(self):
62 return len(self._values)
62 return len(self._values)
63 def __iter__(self):
63 def __iter__(self):
64 return iter(self._values)
64 return iter(self._values)
65 def __getattr__(self, name):
65 def __getattr__(self, name):
66 if name not in ('get', 'items', 'iteritems', 'iterkeys', 'itervalues',
66 if name not in ('get', 'items', 'iteritems', 'iterkeys', 'itervalues',
67 'keys', 'values'):
67 'keys', 'values'):
68 raise AttributeError(name)
68 raise AttributeError(name)
69 return getattr(self._values, name)
69 return getattr(self._values, name)
70
70
71 def hybriddict(data, key='key', value='value', fmt='%s=%s', gen=None):
71 def hybriddict(data, key='key', value='value', fmt='%s=%s', gen=None):
72 """Wrap data to support both dict-like and string-like operations"""
72 """Wrap data to support both dict-like and string-like operations"""
73 return _hybrid(gen, data, lambda k: {key: k, value: data[k]},
73 return _hybrid(gen, data, lambda k: {key: k, value: data[k]},
74 lambda d: fmt % (d[key], d[value]))
74 lambda d: fmt % (d[key], d[value]))
75
75
76 def hybridlist(data, name, fmt='%s', gen=None):
76 def hybridlist(data, name, fmt='%s', gen=None):
77 """Wrap data to support both list-like and string-like operations"""
77 """Wrap data to support both list-like and string-like operations"""
78 return _hybrid(gen, data, lambda x: {name: x}, lambda d: fmt % d[name])
78 return _hybrid(gen, data, lambda x: {name: x}, lambda d: fmt % d[name])
79
79
80 def unwraphybrid(thing):
80 def unwraphybrid(thing):
81 """Return an object which can be stringified possibly by using a legacy
81 """Return an object which can be stringified possibly by using a legacy
82 template"""
82 template"""
83 if not util.safehasattr(thing, 'gen'):
83 if not util.safehasattr(thing, 'gen'):
84 return thing
84 return thing
85 return thing.gen
85 return thing.gen
86
86
87 def showdict(name, data, mapping, plural=None, key='key', value='value',
87 def showdict(name, data, mapping, plural=None, key='key', value='value',
88 fmt='%s=%s', separator=' '):
88 fmt='%s=%s', separator=' '):
89 c = [{key: k, value: v} for k, v in data.iteritems()]
89 c = [{key: k, value: v} for k, v in data.iteritems()]
90 f = _showlist(name, c, mapping, plural, separator)
90 f = _showlist(name, c, mapping, plural, separator)
91 return hybriddict(data, key=key, value=value, fmt=fmt, gen=f)
91 return hybriddict(data, key=key, value=value, fmt=fmt, gen=f)
92
92
93 def showlist(name, values, mapping, plural=None, element=None, separator=' '):
93 def showlist(name, values, mapping, plural=None, element=None, separator=' '):
94 if not element:
94 if not element:
95 element = name
95 element = name
96 f = _showlist(name, values, mapping, plural, separator)
96 f = _showlist(name, values, mapping, plural, separator)
97 return hybridlist(values, name=element, gen=f)
97 return hybridlist(values, name=element, gen=f)
98
98
99 def _showlist(name, values, mapping, plural=None, separator=' '):
99 def _showlist(name, values, mapping, plural=None, separator=' '):
100 '''expand set of values.
100 '''expand set of values.
101 name is name of key in template map.
101 name is name of key in template map.
102 values is list of strings or dicts.
102 values is list of strings or dicts.
103 plural is plural of name, if not simply name + 's'.
103 plural is plural of name, if not simply name + 's'.
104 separator is used to join values as a string
104 separator is used to join values as a string
105
105
106 expansion works like this, given name 'foo'.
106 expansion works like this, given name 'foo'.
107
107
108 if values is empty, expand 'no_foos'.
108 if values is empty, expand 'no_foos'.
109
109
110 if 'foo' not in template map, return values as a string,
110 if 'foo' not in template map, return values as a string,
111 joined by 'separator'.
111 joined by 'separator'.
112
112
113 expand 'start_foos'.
113 expand 'start_foos'.
114
114
115 for each value, expand 'foo'. if 'last_foo' in template
115 for each value, expand 'foo'. if 'last_foo' in template
116 map, expand it instead of 'foo' for last key.
116 map, expand it instead of 'foo' for last key.
117
117
118 expand 'end_foos'.
118 expand 'end_foos'.
119 '''
119 '''
120 templ = mapping['templ']
120 templ = mapping['templ']
121 if not plural:
121 if not plural:
122 plural = name + 's'
122 plural = name + 's'
123 if not values:
123 if not values:
124 noname = 'no_' + plural
124 noname = 'no_' + plural
125 if noname in templ:
125 if noname in templ:
126 yield templ(noname, **mapping)
126 yield templ(noname, **mapping)
127 return
127 return
128 if name not in templ:
128 if name not in templ:
129 if isinstance(values[0], str):
129 if isinstance(values[0], str):
130 yield separator.join(values)
130 yield separator.join(values)
131 else:
131 else:
132 for v in values:
132 for v in values:
133 yield dict(v, **mapping)
133 yield dict(v, **mapping)
134 return
134 return
135 startname = 'start_' + plural
135 startname = 'start_' + plural
136 if startname in templ:
136 if startname in templ:
137 yield templ(startname, **mapping)
137 yield templ(startname, **mapping)
138 vmapping = mapping.copy()
138 vmapping = mapping.copy()
139 def one(v, tag=name):
139 def one(v, tag=name):
140 try:
140 try:
141 vmapping.update(v)
141 vmapping.update(v)
142 except (AttributeError, ValueError):
142 except (AttributeError, ValueError):
143 try:
143 try:
144 for a, b in v:
144 for a, b in v:
145 vmapping[a] = b
145 vmapping[a] = b
146 except ValueError:
146 except ValueError:
147 vmapping[name] = v
147 vmapping[name] = v
148 return templ(tag, **vmapping)
148 return templ(tag, **vmapping)
149 lastname = 'last_' + name
149 lastname = 'last_' + name
150 if lastname in templ:
150 if lastname in templ:
151 last = values.pop()
151 last = values.pop()
152 else:
152 else:
153 last = None
153 last = None
154 for v in values:
154 for v in values:
155 yield one(v)
155 yield one(v)
156 if last is not None:
156 if last is not None:
157 yield one(last, tag=lastname)
157 yield one(last, tag=lastname)
158 endname = 'end_' + plural
158 endname = 'end_' + plural
159 if endname in templ:
159 if endname in templ:
160 yield templ(endname, **mapping)
160 yield templ(endname, **mapping)
161
161
162 def _formatrevnode(ctx):
162 def _formatrevnode(ctx):
163 """Format changeset as '{rev}:{node|formatnode}', which is the default
163 """Format changeset as '{rev}:{node|formatnode}', which is the default
164 template provided by cmdutil.changeset_templater"""
164 template provided by cmdutil.changeset_templater"""
165 repo = ctx.repo()
165 repo = ctx.repo()
166 if repo.ui.debugflag:
166 if repo.ui.debugflag:
167 hexfunc = hex
167 hexfunc = hex
168 else:
168 else:
169 hexfunc = short
169 hexfunc = short
170 return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
170 return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
171
171
172 def getfiles(repo, ctx, revcache):
172 def getfiles(repo, ctx, revcache):
173 if 'files' not in revcache:
173 if 'files' not in revcache:
174 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
174 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
175 return revcache['files']
175 return revcache['files']
176
176
177 def getlatesttags(repo, ctx, cache, pattern=None):
177 def getlatesttags(repo, ctx, cache, pattern=None):
178 '''return date, distance and name for the latest tag of rev'''
178 '''return date, distance and name for the latest tag of rev'''
179
179
180 cachename = 'latesttags'
180 cachename = 'latesttags'
181 if pattern is not None:
181 if pattern is not None:
182 cachename += '-' + pattern
182 cachename += '-' + pattern
183 match = util.stringmatcher(pattern)[2]
183 match = util.stringmatcher(pattern)[2]
184 else:
184 else:
185 match = util.always
185 match = util.always
186
186
187 if cachename not in cache:
187 if cachename not in cache:
188 # Cache mapping from rev to a tuple with tag date, tag
188 # Cache mapping from rev to a tuple with tag date, tag
189 # distance and tag name
189 # distance and tag name
190 cache[cachename] = {-1: (0, 0, ['null'])}
190 cache[cachename] = {-1: (0, 0, ['null'])}
191 latesttags = cache[cachename]
191 latesttags = cache[cachename]
192
192
193 rev = ctx.rev()
193 rev = ctx.rev()
194 todo = [rev]
194 todo = [rev]
195 while todo:
195 while todo:
196 rev = todo.pop()
196 rev = todo.pop()
197 if rev in latesttags:
197 if rev in latesttags:
198 continue
198 continue
199 ctx = repo[rev]
199 ctx = repo[rev]
200 tags = [t for t in ctx.tags()
200 tags = [t for t in ctx.tags()
201 if (repo.tagtype(t) and repo.tagtype(t) != 'local'
201 if (repo.tagtype(t) and repo.tagtype(t) != 'local'
202 and match(t))]
202 and match(t))]
203 if tags:
203 if tags:
204 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
204 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
205 continue
205 continue
206 try:
206 try:
207 # The tuples are laid out so the right one can be found by
207 # The tuples are laid out so the right one can be found by
208 # comparison.
208 # comparison.
209 pdate, pdist, ptag = max(
209 pdate, pdist, ptag = max(
210 latesttags[p.rev()] for p in ctx.parents())
210 latesttags[p.rev()] for p in ctx.parents())
211 except KeyError:
211 except KeyError:
212 # Cache miss - recurse
212 # Cache miss - recurse
213 todo.append(rev)
213 todo.append(rev)
214 todo.extend(p.rev() for p in ctx.parents())
214 todo.extend(p.rev() for p in ctx.parents())
215 continue
215 continue
216 latesttags[rev] = pdate, pdist + 1, ptag
216 latesttags[rev] = pdate, pdist + 1, ptag
217 return latesttags[rev]
217 return latesttags[rev]
218
218
219 def getrenamedfn(repo, endrev=None):
219 def getrenamedfn(repo, endrev=None):
220 rcache = {}
220 rcache = {}
221 if endrev is None:
221 if endrev is None:
222 endrev = len(repo)
222 endrev = len(repo)
223
223
224 def getrenamed(fn, rev):
224 def getrenamed(fn, rev):
225 '''looks up all renames for a file (up to endrev) the first
225 '''looks up all renames for a file (up to endrev) the first
226 time the file is given. It indexes on the changerev and only
226 time the file is given. It indexes on the changerev and only
227 parses the manifest if linkrev != changerev.
227 parses the manifest if linkrev != changerev.
228 Returns rename info for fn at changerev rev.'''
228 Returns rename info for fn at changerev rev.'''
229 if fn not in rcache:
229 if fn not in rcache:
230 rcache[fn] = {}
230 rcache[fn] = {}
231 fl = repo.file(fn)
231 fl = repo.file(fn)
232 for i in fl:
232 for i in fl:
233 lr = fl.linkrev(i)
233 lr = fl.linkrev(i)
234 renamed = fl.renamed(fl.node(i))
234 renamed = fl.renamed(fl.node(i))
235 rcache[fn][lr] = renamed
235 rcache[fn][lr] = renamed
236 if lr >= endrev:
236 if lr >= endrev:
237 break
237 break
238 if rev in rcache[fn]:
238 if rev in rcache[fn]:
239 return rcache[fn][rev]
239 return rcache[fn][rev]
240
240
241 # If linkrev != rev (i.e. rev not found in rcache) fallback to
241 # If linkrev != rev (i.e. rev not found in rcache) fallback to
242 # filectx logic.
242 # filectx logic.
243 try:
243 try:
244 return repo[rev][fn].renamed()
244 return repo[rev][fn].renamed()
245 except error.LookupError:
245 except error.LookupError:
246 return None
246 return None
247
247
248 return getrenamed
248 return getrenamed
249
249
250 # default templates internally used for rendering of lists
250 # default templates internally used for rendering of lists
251 defaulttempl = {
251 defaulttempl = {
252 'parent': '{rev}:{node|formatnode} ',
252 'parent': '{rev}:{node|formatnode} ',
253 'manifest': '{rev}:{node|formatnode}',
253 'manifest': '{rev}:{node|formatnode}',
254 'file_copy': '{name} ({source})',
254 'file_copy': '{name} ({source})',
255 'envvar': '{key}={value}',
255 'envvar': '{key}={value}',
256 'extra': '{key}={value|stringescape}'
256 'extra': '{key}={value|stringescape}'
257 }
257 }
258 # filecopy is preserved for compatibility reasons
258 # filecopy is preserved for compatibility reasons
259 defaulttempl['filecopy'] = defaulttempl['file_copy']
259 defaulttempl['filecopy'] = defaulttempl['file_copy']
260
260
261 # keywords are callables like:
261 # keywords are callables like:
262 # fn(repo, ctx, templ, cache, revcache, **args)
262 # fn(repo, ctx, templ, cache, revcache, **args)
263 # with:
263 # with:
264 # repo - current repository instance
264 # repo - current repository instance
265 # ctx - the changectx being displayed
265 # ctx - the changectx being displayed
266 # templ - the templater instance
266 # templ - the templater instance
267 # cache - a cache dictionary for the whole templater run
267 # cache - a cache dictionary for the whole templater run
268 # revcache - a cache dictionary for the current revision
268 # revcache - a cache dictionary for the current revision
269 keywords = {}
269 keywords = {}
270
270
271 templatekeyword = registrar.templatekeyword(keywords)
271 templatekeyword = registrar.templatekeyword(keywords)
272
272
273 @templatekeyword('author')
273 @templatekeyword('author')
274 def showauthor(repo, ctx, templ, **args):
274 def showauthor(repo, ctx, templ, **args):
275 """String. The unmodified author of the changeset."""
275 """String. The unmodified author of the changeset."""
276 return ctx.user()
276 return ctx.user()
277
277
278 @templatekeyword('bisect')
278 @templatekeyword('bisect')
279 def showbisect(repo, ctx, templ, **args):
279 def showbisect(repo, ctx, templ, **args):
280 """String. The changeset bisection status."""
280 """String. The changeset bisection status."""
281 return hbisect.label(repo, ctx.node())
281 return hbisect.label(repo, ctx.node())
282
282
283 @templatekeyword('branch')
283 @templatekeyword('branch')
284 def showbranch(**args):
284 def showbranch(**args):
285 """String. The name of the branch on which the changeset was
285 """String. The name of the branch on which the changeset was
286 committed.
286 committed.
287 """
287 """
288 return args['ctx'].branch()
288 return args['ctx'].branch()
289
289
290 @templatekeyword('branches')
290 @templatekeyword('branches')
291 def showbranches(**args):
291 def showbranches(**args):
292 """List of strings. The name of the branch on which the
292 """List of strings. The name of the branch on which the
293 changeset was committed. Will be empty if the branch name was
293 changeset was committed. Will be empty if the branch name was
294 default. (DEPRECATED)
294 default. (DEPRECATED)
295 """
295 """
296 branch = args['ctx'].branch()
296 branch = args['ctx'].branch()
297 if branch != 'default':
297 if branch != 'default':
298 return showlist('branch', [branch], args, plural='branches')
298 return showlist('branch', [branch], args, plural='branches')
299 return showlist('branch', [], args, plural='branches')
299 return showlist('branch', [], args, plural='branches')
300
300
301 @templatekeyword('bookmarks')
301 @templatekeyword('bookmarks')
302 def showbookmarks(**args):
302 def showbookmarks(**args):
303 """List of strings. Any bookmarks associated with the
303 """List of strings. Any bookmarks associated with the
304 changeset. Also sets 'active', the name of the active bookmark.
304 changeset. Also sets 'active', the name of the active bookmark.
305 """
305 """
306 repo = args['ctx']._repo
306 repo = args['ctx']._repo
307 bookmarks = args['ctx'].bookmarks()
307 bookmarks = args['ctx'].bookmarks()
308 active = repo._activebookmark
308 active = repo._activebookmark
309 makemap = lambda v: {'bookmark': v, 'active': active, 'current': active}
309 makemap = lambda v: {'bookmark': v, 'active': active, 'current': active}
310 f = _showlist('bookmark', bookmarks, args)
310 f = _showlist('bookmark', bookmarks, args)
311 return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark'])
311 return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark'])
312
312
313 @templatekeyword('children')
313 @templatekeyword('children')
314 def showchildren(**args):
314 def showchildren(**args):
315 """List of strings. The children of the changeset."""
315 """List of strings. The children of the changeset."""
316 ctx = args['ctx']
316 ctx = args['ctx']
317 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
317 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
318 return showlist('children', childrevs, args, element='child')
318 return showlist('children', childrevs, args, element='child')
319
319
320 # Deprecated, but kept alive for help generation a purpose.
320 # Deprecated, but kept alive for help generation a purpose.
321 @templatekeyword('currentbookmark')
321 @templatekeyword('currentbookmark')
322 def showcurrentbookmark(**args):
322 def showcurrentbookmark(**args):
323 """String. The active bookmark, if it is
323 """String. The active bookmark, if it is
324 associated with the changeset (DEPRECATED)"""
324 associated with the changeset (DEPRECATED)"""
325 return showactivebookmark(**args)
325 return showactivebookmark(**args)
326
326
327 @templatekeyword('activebookmark')
327 @templatekeyword('activebookmark')
328 def showactivebookmark(**args):
328 def showactivebookmark(**args):
329 """String. The active bookmark, if it is
329 """String. The active bookmark, if it is
330 associated with the changeset"""
330 associated with the changeset"""
331 active = args['repo']._activebookmark
331 active = args['repo']._activebookmark
332 if active and active in args['ctx'].bookmarks():
332 if active and active in args['ctx'].bookmarks():
333 return active
333 return active
334 return ''
334 return ''
335
335
336 @templatekeyword('date')
336 @templatekeyword('date')
337 def showdate(repo, ctx, templ, **args):
337 def showdate(repo, ctx, templ, **args):
338 """Date information. The date when the changeset was committed."""
338 """Date information. The date when the changeset was committed."""
339 return ctx.date()
339 return ctx.date()
340
340
341 @templatekeyword('desc')
341 @templatekeyword('desc')
342 def showdescription(repo, ctx, templ, **args):
342 def showdescription(repo, ctx, templ, **args):
343 """String. The text of the changeset description."""
343 """String. The text of the changeset description."""
344 s = ctx.description()
344 s = ctx.description()
345 if isinstance(s, encoding.localstr):
345 if isinstance(s, encoding.localstr):
346 # try hard to preserve utf-8 bytes
346 # try hard to preserve utf-8 bytes
347 return encoding.tolocal(encoding.fromlocal(s).strip())
347 return encoding.tolocal(encoding.fromlocal(s).strip())
348 else:
348 else:
349 return s.strip()
349 return s.strip()
350
350
351 @templatekeyword('diffstat')
351 @templatekeyword('diffstat')
352 def showdiffstat(repo, ctx, templ, **args):
352 def showdiffstat(repo, ctx, templ, **args):
353 """String. Statistics of changes with the following format:
353 """String. Statistics of changes with the following format:
354 "modified files: +added/-removed lines"
354 "modified files: +added/-removed lines"
355 """
355 """
356 stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
356 stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
357 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
357 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
358 return '%s: +%s/-%s' % (len(stats), adds, removes)
358 return '%s: +%s/-%s' % (len(stats), adds, removes)
359
359
360 @templatekeyword('envvars')
360 @templatekeyword('envvars')
361 def showenvvars(repo, **args):
361 def showenvvars(repo, **args):
362 """A dictionary of environment variables. (EXPERIMENTAL)"""
362 """A dictionary of environment variables. (EXPERIMENTAL)"""
363 env = repo.ui.exportableenviron()
363 env = repo.ui.exportableenviron()
364 env = util.sortdict((k, env[k]) for k in sorted(env))
364 env = util.sortdict((k, env[k]) for k in sorted(env))
365 return showdict('envvar', env, args, plural='envvars')
365 return showdict('envvar', env, args, plural='envvars')
366
366
367 @templatekeyword('extras')
367 @templatekeyword('extras')
368 def showextras(**args):
368 def showextras(**args):
369 """List of dicts with key, value entries of the 'extras'
369 """List of dicts with key, value entries of the 'extras'
370 field of this changeset."""
370 field of this changeset."""
371 extras = args['ctx'].extra()
371 extras = args['ctx'].extra()
372 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
372 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
373 makemap = lambda k: {'key': k, 'value': extras[k]}
373 makemap = lambda k: {'key': k, 'value': extras[k]}
374 c = [makemap(k) for k in extras]
374 c = [makemap(k) for k in extras]
375 f = _showlist('extra', c, args, plural='extras')
375 f = _showlist('extra', c, args, plural='extras')
376 return _hybrid(f, extras, makemap,
376 return _hybrid(f, extras, makemap,
377 lambda x: '%s=%s' % (x['key'], util.escapestr(x['value'])))
377 lambda x: '%s=%s' % (x['key'], util.escapestr(x['value'])))
378
378
379 @templatekeyword('file_adds')
379 @templatekeyword('file_adds')
380 def showfileadds(**args):
380 def showfileadds(**args):
381 """List of strings. Files added by this changeset."""
381 """List of strings. Files added by this changeset."""
382 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
382 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
383 return showlist('file_add', getfiles(repo, ctx, revcache)[1], args,
383 return showlist('file_add', getfiles(repo, ctx, revcache)[1], args,
384 element='file')
384 element='file')
385
385
386 @templatekeyword('file_copies')
386 @templatekeyword('file_copies')
387 def showfilecopies(**args):
387 def showfilecopies(**args):
388 """List of strings. Files copied in this changeset with
388 """List of strings. Files copied in this changeset with
389 their sources.
389 their sources.
390 """
390 """
391 cache, ctx = args['cache'], args['ctx']
391 cache, ctx = args['cache'], args['ctx']
392 copies = args['revcache'].get('copies')
392 copies = args['revcache'].get('copies')
393 if copies is None:
393 if copies is None:
394 if 'getrenamed' not in cache:
394 if 'getrenamed' not in cache:
395 cache['getrenamed'] = getrenamedfn(args['repo'])
395 cache['getrenamed'] = getrenamedfn(args['repo'])
396 copies = []
396 copies = []
397 getrenamed = cache['getrenamed']
397 getrenamed = cache['getrenamed']
398 for fn in ctx.files():
398 for fn in ctx.files():
399 rename = getrenamed(fn, ctx.rev())
399 rename = getrenamed(fn, ctx.rev())
400 if rename:
400 if rename:
401 copies.append((fn, rename[0]))
401 copies.append((fn, rename[0]))
402
402
403 copies = util.sortdict(copies)
403 copies = util.sortdict(copies)
404 return showdict('file_copy', copies, args, plural='file_copies',
404 return showdict('file_copy', copies, args, plural='file_copies',
405 key='name', value='source', fmt='%s (%s)')
405 key='name', value='source', fmt='%s (%s)')
406
406
407 # showfilecopiesswitch() displays file copies only if copy records are
407 # showfilecopiesswitch() displays file copies only if copy records are
408 # provided before calling the templater, usually with a --copies
408 # provided before calling the templater, usually with a --copies
409 # command line switch.
409 # command line switch.
410 @templatekeyword('file_copies_switch')
410 @templatekeyword('file_copies_switch')
411 def showfilecopiesswitch(**args):
411 def showfilecopiesswitch(**args):
412 """List of strings. Like "file_copies" but displayed
412 """List of strings. Like "file_copies" but displayed
413 only if the --copied switch is set.
413 only if the --copied switch is set.
414 """
414 """
415 copies = args['revcache'].get('copies') or []
415 copies = args['revcache'].get('copies') or []
416 copies = util.sortdict(copies)
416 copies = util.sortdict(copies)
417 return showdict('file_copy', copies, args, plural='file_copies',
417 return showdict('file_copy', copies, args, plural='file_copies',
418 key='name', value='source', fmt='%s (%s)')
418 key='name', value='source', fmt='%s (%s)')
419
419
420 @templatekeyword('file_dels')
420 @templatekeyword('file_dels')
421 def showfiledels(**args):
421 def showfiledels(**args):
422 """List of strings. Files removed by this changeset."""
422 """List of strings. Files removed by this changeset."""
423 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
423 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
424 return showlist('file_del', getfiles(repo, ctx, revcache)[2], args,
424 return showlist('file_del', getfiles(repo, ctx, revcache)[2], args,
425 element='file')
425 element='file')
426
426
427 @templatekeyword('file_mods')
427 @templatekeyword('file_mods')
428 def showfilemods(**args):
428 def showfilemods(**args):
429 """List of strings. Files modified by this changeset."""
429 """List of strings. Files modified by this changeset."""
430 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
430 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
431 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args,
431 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args,
432 element='file')
432 element='file')
433
433
434 @templatekeyword('files')
434 @templatekeyword('files')
435 def showfiles(**args):
435 def showfiles(**args):
436 """List of strings. All files modified, added, or removed by this
436 """List of strings. All files modified, added, or removed by this
437 changeset.
437 changeset.
438 """
438 """
439 return showlist('file', args['ctx'].files(), args)
439 return showlist('file', args['ctx'].files(), args)
440
440
441 @templatekeyword('graphnode')
441 @templatekeyword('graphnode')
442 def showgraphnode(repo, ctx, **args):
442 def showgraphnode(repo, ctx, **args):
443 """String. The character representing the changeset node in
443 """String. The character representing the changeset node in
444 an ASCII revision graph"""
444 an ASCII revision graph"""
445 wpnodes = repo.dirstate.parents()
445 wpnodes = repo.dirstate.parents()
446 if wpnodes[1] == nullid:
446 if wpnodes[1] == nullid:
447 wpnodes = wpnodes[:1]
447 wpnodes = wpnodes[:1]
448 if ctx.node() in wpnodes:
448 if ctx.node() in wpnodes:
449 return '@'
449 return '@'
450 elif ctx.obsolete():
450 elif ctx.obsolete():
451 return 'x'
451 return 'x'
452 elif ctx.closesbranch():
452 elif ctx.closesbranch():
453 return '_'
453 return '_'
454 else:
454 else:
455 return 'o'
455 return 'o'
456
456
457 @templatekeyword('index')
457 @templatekeyword('index')
458 def showindex(**args):
458 def showindex(**args):
459 """Integer. The current iteration of the loop. (0 indexed)"""
459 """Integer. The current iteration of the loop. (0 indexed)"""
460 # just hosts documentation; should be overridden by template mapping
460 # just hosts documentation; should be overridden by template mapping
461 raise error.Abort(_("can't use index in this context"))
461 raise error.Abort(_("can't use index in this context"))
462
462
463 @templatekeyword('latesttag')
463 @templatekeyword('latesttag')
464 def showlatesttag(**args):
464 def showlatesttag(**args):
465 """List of strings. The global tags on the most recent globally
465 """List of strings. The global tags on the most recent globally
466 tagged ancestor of this changeset. If no such tags exist, the list
466 tagged ancestor of this changeset. If no such tags exist, the list
467 consists of the single string "null".
467 consists of the single string "null".
468 """
468 """
469 return showlatesttags(None, **args)
469 return showlatesttags(None, **args)
470
470
471 def showlatesttags(pattern, **args):
471 def showlatesttags(pattern, **args):
472 """helper method for the latesttag keyword and function"""
472 """helper method for the latesttag keyword and function"""
473 repo, ctx = args['repo'], args['ctx']
473 repo, ctx = args['repo'], args['ctx']
474 cache = args['cache']
474 cache = args['cache']
475 latesttags = getlatesttags(repo, ctx, cache, pattern)
475 latesttags = getlatesttags(repo, ctx, cache, pattern)
476
476
477 # latesttag[0] is an implementation detail for sorting csets on different
477 # latesttag[0] is an implementation detail for sorting csets on different
478 # branches in a stable manner- it is the date the tagged cset was created,
478 # branches in a stable manner- it is the date the tagged cset was created,
479 # not the date the tag was created. Therefore it isn't made visible here.
479 # not the date the tag was created. Therefore it isn't made visible here.
480 makemap = lambda v: {
480 makemap = lambda v: {
481 'changes': _showchangessincetag,
481 'changes': _showchangessincetag,
482 'distance': latesttags[1],
482 'distance': latesttags[1],
483 'latesttag': v, # BC with {latesttag % '{latesttag}'}
483 'latesttag': v, # BC with {latesttag % '{latesttag}'}
484 'tag': v
484 'tag': v
485 }
485 }
486
486
487 tags = latesttags[2]
487 tags = latesttags[2]
488 f = _showlist('latesttag', tags, args, separator=':')
488 f = _showlist('latesttag', tags, args, separator=':')
489 return _hybrid(f, tags, makemap, lambda x: x['latesttag'])
489 return _hybrid(f, tags, makemap, lambda x: x['latesttag'])
490
490
491 @templatekeyword('latesttagdistance')
491 @templatekeyword('latesttagdistance')
492 def showlatesttagdistance(repo, ctx, templ, cache, **args):
492 def showlatesttagdistance(repo, ctx, templ, cache, **args):
493 """Integer. Longest path to the latest tag."""
493 """Integer. Longest path to the latest tag."""
494 return getlatesttags(repo, ctx, cache)[1]
494 return getlatesttags(repo, ctx, cache)[1]
495
495
496 @templatekeyword('changessincelatesttag')
496 @templatekeyword('changessincelatesttag')
497 def showchangessincelatesttag(repo, ctx, templ, cache, **args):
497 def showchangessincelatesttag(repo, ctx, templ, cache, **args):
498 """Integer. All ancestors not in the latest tag."""
498 """Integer. All ancestors not in the latest tag."""
499 latesttag = getlatesttags(repo, ctx, cache)[2][0]
499 latesttag = getlatesttags(repo, ctx, cache)[2][0]
500
500
501 return _showchangessincetag(repo, ctx, tag=latesttag, **args)
501 return _showchangessincetag(repo, ctx, tag=latesttag, **args)
502
502
503 def _showchangessincetag(repo, ctx, **args):
503 def _showchangessincetag(repo, ctx, **args):
504 offset = 0
504 offset = 0
505 revs = [ctx.rev()]
505 revs = [ctx.rev()]
506 tag = args['tag']
506 tag = args['tag']
507
507
508 # The only() revset doesn't currently support wdir()
508 # The only() revset doesn't currently support wdir()
509 if ctx.rev() is None:
509 if ctx.rev() is None:
510 offset = 1
510 offset = 1
511 revs = [p.rev() for p in ctx.parents()]
511 revs = [p.rev() for p in ctx.parents()]
512
512
513 return len(repo.revs('only(%ld, %s)', revs, tag)) + offset
513 return len(repo.revs('only(%ld, %s)', revs, tag)) + offset
514
514
515 @templatekeyword('manifest')
515 @templatekeyword('manifest')
516 def showmanifest(**args):
516 def showmanifest(**args):
517 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
517 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
518 mnode = ctx.manifestnode()
518 mnode = ctx.manifestnode()
519 if mnode is None:
519 if mnode is None:
520 # just avoid crash, we might want to use the 'ff...' hash in future
520 # just avoid crash, we might want to use the 'ff...' hash in future
521 return
521 return
522 args = args.copy()
522 args = args.copy()
523 args.update({'rev': repo.manifestlog._revlog.rev(mnode),
523 args.update({'rev': repo.manifestlog._revlog.rev(mnode),
524 'node': hex(mnode)})
524 'node': hex(mnode)})
525 return templ('manifest', **args)
525 return templ('manifest', **args)
526
526
527 def shownames(namespace, **args):
527 def shownames(namespace, **args):
528 """helper method to generate a template keyword for a namespace"""
528 """helper method to generate a template keyword for a namespace"""
529 ctx = args['ctx']
529 ctx = args['ctx']
530 repo = ctx.repo()
530 repo = ctx.repo()
531 ns = repo.names[namespace]
531 ns = repo.names[namespace]
532 names = ns.names(repo, ctx.node())
532 names = ns.names(repo, ctx.node())
533 return showlist(ns.templatename, names, args, plural=namespace)
533 return showlist(ns.templatename, names, args, plural=namespace)
534
534
535 @templatekeyword('namespaces')
535 @templatekeyword('namespaces')
536 def shownamespaces(**args):
536 def shownamespaces(**args):
537 """Dict of lists. Names attached to this changeset per
537 """Dict of lists. Names attached to this changeset per
538 namespace."""
538 namespace."""
539 ctx = args['ctx']
539 ctx = args['ctx']
540 repo = ctx.repo()
540 repo = ctx.repo()
541 namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()),
541 namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()),
542 args))
542 args))
543 for k, ns in repo.names.iteritems())
543 for k, ns in repo.names.iteritems())
544 f = _showlist('namespace', list(namespaces), args)
544 f = _showlist('namespace', list(namespaces), args)
545 return _hybrid(f, namespaces,
545 return _hybrid(f, namespaces,
546 lambda k: {'namespace': k, 'names': namespaces[k]},
546 lambda k: {'namespace': k, 'names': namespaces[k]},
547 lambda x: x['namespace'])
547 lambda x: x['namespace'])
548
548
549 @templatekeyword('node')
549 @templatekeyword('node')
550 def shownode(repo, ctx, templ, **args):
550 def shownode(repo, ctx, templ, **args):
551 """String. The changeset identification hash, as a 40 hexadecimal
551 """String. The changeset identification hash, as a 40 hexadecimal
552 digit string.
552 digit string.
553 """
553 """
554 return ctx.hex()
554 return ctx.hex()
555
555
556 @templatekeyword('obsolete')
556 @templatekeyword('obsolete')
557 def showobsolete(repo, ctx, templ, **args):
557 def showobsolete(repo, ctx, templ, **args):
558 """String. Whether the changeset is obsolete.
558 """String. Whether the changeset is obsolete.
559 """
559 """
560 if ctx.obsolete():
560 if ctx.obsolete():
561 return 'obsolete'
561 return 'obsolete'
562 return ''
562 return ''
563
563
564 @templatekeyword("predecessors")
564 @templatekeyword("predecessors")
565 def showpredecessors(repo, ctx, **args):
565 def showpredecessors(repo, ctx, **args):
566 """Returns the list if the closest visible successors
566 """Returns the list if the closest visible successors
567 """
567 """
568 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
568 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
569 predecessors = map(hex, predecessors)
569 predecessors = map(hex, predecessors)
570
570
571 return _hybrid(None, predecessors, lambda x: {'node': x},
571 return _hybrid(None, predecessors,
572 lambda d: d['node'][:12])
572 lambda x: {'ctx': repo[x], 'revcache': {}},
573 lambda d: short(scmutil.binnode(d['ctx'])))
573
574
574 @templatekeyword('p1rev')
575 @templatekeyword('p1rev')
575 def showp1rev(repo, ctx, templ, **args):
576 def showp1rev(repo, ctx, templ, **args):
576 """Integer. The repository-local revision number of the changeset's
577 """Integer. The repository-local revision number of the changeset's
577 first parent, or -1 if the changeset has no parents."""
578 first parent, or -1 if the changeset has no parents."""
578 return ctx.p1().rev()
579 return ctx.p1().rev()
579
580
580 @templatekeyword('p2rev')
581 @templatekeyword('p2rev')
581 def showp2rev(repo, ctx, templ, **args):
582 def showp2rev(repo, ctx, templ, **args):
582 """Integer. The repository-local revision number of the changeset's
583 """Integer. The repository-local revision number of the changeset's
583 second parent, or -1 if the changeset has no second parent."""
584 second parent, or -1 if the changeset has no second parent."""
584 return ctx.p2().rev()
585 return ctx.p2().rev()
585
586
586 @templatekeyword('p1node')
587 @templatekeyword('p1node')
587 def showp1node(repo, ctx, templ, **args):
588 def showp1node(repo, ctx, templ, **args):
588 """String. The identification hash of the changeset's first parent,
589 """String. The identification hash of the changeset's first parent,
589 as a 40 digit hexadecimal string. If the changeset has no parents, all
590 as a 40 digit hexadecimal string. If the changeset has no parents, all
590 digits are 0."""
591 digits are 0."""
591 return ctx.p1().hex()
592 return ctx.p1().hex()
592
593
593 @templatekeyword('p2node')
594 @templatekeyword('p2node')
594 def showp2node(repo, ctx, templ, **args):
595 def showp2node(repo, ctx, templ, **args):
595 """String. The identification hash of the changeset's second
596 """String. The identification hash of the changeset's second
596 parent, as a 40 digit hexadecimal string. If the changeset has no second
597 parent, as a 40 digit hexadecimal string. If the changeset has no second
597 parent, all digits are 0."""
598 parent, all digits are 0."""
598 return ctx.p2().hex()
599 return ctx.p2().hex()
599
600
600 @templatekeyword('parents')
601 @templatekeyword('parents')
601 def showparents(**args):
602 def showparents(**args):
602 """List of strings. The parents of the changeset in "rev:node"
603 """List of strings. The parents of the changeset in "rev:node"
603 format. If the changeset has only one "natural" parent (the predecessor
604 format. If the changeset has only one "natural" parent (the predecessor
604 revision) nothing is shown."""
605 revision) nothing is shown."""
605 repo = args['repo']
606 repo = args['repo']
606 ctx = args['ctx']
607 ctx = args['ctx']
607 pctxs = scmutil.meaningfulparents(repo, ctx)
608 pctxs = scmutil.meaningfulparents(repo, ctx)
608 prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str
609 prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str
609 parents = [[('rev', p.rev()),
610 parents = [[('rev', p.rev()),
610 ('node', p.hex()),
611 ('node', p.hex()),
611 ('phase', p.phasestr())]
612 ('phase', p.phasestr())]
612 for p in pctxs]
613 for p in pctxs]
613 f = _showlist('parent', parents, args)
614 f = _showlist('parent', parents, args)
614 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
615 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
615 lambda d: _formatrevnode(d['ctx']))
616 lambda d: _formatrevnode(d['ctx']))
616
617
617 @templatekeyword('phase')
618 @templatekeyword('phase')
618 def showphase(repo, ctx, templ, **args):
619 def showphase(repo, ctx, templ, **args):
619 """String. The changeset phase name."""
620 """String. The changeset phase name."""
620 return ctx.phasestr()
621 return ctx.phasestr()
621
622
622 @templatekeyword('phaseidx')
623 @templatekeyword('phaseidx')
623 def showphaseidx(repo, ctx, templ, **args):
624 def showphaseidx(repo, ctx, templ, **args):
624 """Integer. The changeset phase index."""
625 """Integer. The changeset phase index."""
625 return ctx.phase()
626 return ctx.phase()
626
627
627 @templatekeyword('rev')
628 @templatekeyword('rev')
628 def showrev(repo, ctx, templ, **args):
629 def showrev(repo, ctx, templ, **args):
629 """Integer. The repository-local changeset revision number."""
630 """Integer. The repository-local changeset revision number."""
630 return scmutil.intrev(ctx)
631 return scmutil.intrev(ctx)
631
632
632 def showrevslist(name, revs, **args):
633 def showrevslist(name, revs, **args):
633 """helper to generate a list of revisions in which a mapped template will
634 """helper to generate a list of revisions in which a mapped template will
634 be evaluated"""
635 be evaluated"""
635 repo = args['ctx'].repo()
636 repo = args['ctx'].repo()
636 revs = [str(r) for r in revs] # ifcontains() needs a list of str
637 revs = [str(r) for r in revs] # ifcontains() needs a list of str
637 f = _showlist(name, revs, args)
638 f = _showlist(name, revs, args)
638 return _hybrid(f, revs,
639 return _hybrid(f, revs,
639 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
640 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
640 lambda d: d[name])
641 lambda d: d[name])
641
642
642 @templatekeyword('subrepos')
643 @templatekeyword('subrepos')
643 def showsubrepos(**args):
644 def showsubrepos(**args):
644 """List of strings. Updated subrepositories in the changeset."""
645 """List of strings. Updated subrepositories in the changeset."""
645 ctx = args['ctx']
646 ctx = args['ctx']
646 substate = ctx.substate
647 substate = ctx.substate
647 if not substate:
648 if not substate:
648 return showlist('subrepo', [], args)
649 return showlist('subrepo', [], args)
649 psubstate = ctx.parents()[0].substate or {}
650 psubstate = ctx.parents()[0].substate or {}
650 subrepos = []
651 subrepos = []
651 for sub in substate:
652 for sub in substate:
652 if sub not in psubstate or substate[sub] != psubstate[sub]:
653 if sub not in psubstate or substate[sub] != psubstate[sub]:
653 subrepos.append(sub) # modified or newly added in ctx
654 subrepos.append(sub) # modified or newly added in ctx
654 for sub in psubstate:
655 for sub in psubstate:
655 if sub not in substate:
656 if sub not in substate:
656 subrepos.append(sub) # removed in ctx
657 subrepos.append(sub) # removed in ctx
657 return showlist('subrepo', sorted(subrepos), args)
658 return showlist('subrepo', sorted(subrepos), args)
658
659
659 # don't remove "showtags" definition, even though namespaces will put
660 # don't remove "showtags" definition, even though namespaces will put
660 # a helper function for "tags" keyword into "keywords" map automatically,
661 # a helper function for "tags" keyword into "keywords" map automatically,
661 # because online help text is built without namespaces initialization
662 # because online help text is built without namespaces initialization
662 @templatekeyword('tags')
663 @templatekeyword('tags')
663 def showtags(**args):
664 def showtags(**args):
664 """List of strings. Any tags associated with the changeset."""
665 """List of strings. Any tags associated with the changeset."""
665 return shownames('tags', **args)
666 return shownames('tags', **args)
666
667
667 def loadkeyword(ui, extname, registrarobj):
668 def loadkeyword(ui, extname, registrarobj):
668 """Load template keyword from specified registrarobj
669 """Load template keyword from specified registrarobj
669 """
670 """
670 for name, func in registrarobj._table.iteritems():
671 for name, func in registrarobj._table.iteritems():
671 keywords[name] = func
672 keywords[name] = func
672
673
673 @templatekeyword('termwidth')
674 @templatekeyword('termwidth')
674 def termwidth(repo, ctx, templ, **args):
675 def termwidth(repo, ctx, templ, **args):
675 """Integer. The width of the current terminal."""
676 """Integer. The width of the current terminal."""
676 return repo.ui.termwidth()
677 return repo.ui.termwidth()
677
678
678 @templatekeyword('troubles')
679 @templatekeyword('troubles')
679 def showtroubles(**args):
680 def showtroubles(**args):
680 """List of strings. Evolution troubles affecting the changeset.
681 """List of strings. Evolution troubles affecting the changeset.
681
682
682 (EXPERIMENTAL)
683 (EXPERIMENTAL)
683 """
684 """
684 return showlist('trouble', args['ctx'].troubles(), args)
685 return showlist('trouble', args['ctx'].troubles(), args)
685
686
686 # tell hggettext to extract docstrings from these functions:
687 # tell hggettext to extract docstrings from these functions:
687 i18nfunctions = keywords.values()
688 i18nfunctions = keywords.values()
@@ -1,888 +1,888 b''
1 This test file test the various templates related to obsmarkers.
1 This test file test the various templates related to obsmarkers.
2
2
3 Global setup
3 Global setup
4 ============
4 ============
5
5
6 $ . $TESTDIR/testlib/obsmarker-common.sh
6 $ . $TESTDIR/testlib/obsmarker-common.sh
7 $ cat >> $HGRCPATH <<EOF
7 $ cat >> $HGRCPATH <<EOF
8 > [ui]
8 > [ui]
9 > interactive = true
9 > interactive = true
10 > [phases]
10 > [phases]
11 > publish=False
11 > publish=False
12 > [experimental]
12 > [experimental]
13 > evolution=all
13 > evolution=all
14 > [alias]
14 > [alias]
15 > tlog = log -G -T '{node|short}\
15 > tlog = log -G -T '{node|short}\
16 > {if(predecessors, "\n Predecessors: {predecessors}")}\
16 > {if(predecessors, "\n Predecessors: {predecessors}")}\
17 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
17 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
18 > {if(predecessors, "\n json: {predecessors|json}")}\
18 > {if(predecessors, "\n json: {predecessors|json}")}\
19 > {if(predecessors, "\n map: {join(predecessors % "{node}", " ")}")}\n'
19 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\n'
20 > EOF
20 > EOF
21
21
22 Test templates on amended commit
22 Test templates on amended commit
23 ================================
23 ================================
24
24
25 Test setup
25 Test setup
26 ----------
26 ----------
27
27
28 $ hg init $TESTTMP/templates-local-amend
28 $ hg init $TESTTMP/templates-local-amend
29 $ cd $TESTTMP/templates-local-amend
29 $ cd $TESTTMP/templates-local-amend
30 $ mkcommit ROOT
30 $ mkcommit ROOT
31 $ mkcommit A0
31 $ mkcommit A0
32 $ echo 42 >> A0
32 $ echo 42 >> A0
33 $ hg commit --amend -m "A1"
33 $ hg commit --amend -m "A1"
34 $ hg commit --amend -m "A2"
34 $ hg commit --amend -m "A2"
35
35
36 $ hg log --hidden -G
36 $ hg log --hidden -G
37 @ changeset: 4:d004c8f274b9
37 @ changeset: 4:d004c8f274b9
38 | tag: tip
38 | tag: tip
39 | parent: 0:ea207398892e
39 | parent: 0:ea207398892e
40 | user: test
40 | user: test
41 | date: Thu Jan 01 00:00:00 1970 +0000
41 | date: Thu Jan 01 00:00:00 1970 +0000
42 | summary: A2
42 | summary: A2
43 |
43 |
44 | x changeset: 3:a468dc9b3633
44 | x changeset: 3:a468dc9b3633
45 |/ parent: 0:ea207398892e
45 |/ parent: 0:ea207398892e
46 | user: test
46 | user: test
47 | date: Thu Jan 01 00:00:00 1970 +0000
47 | date: Thu Jan 01 00:00:00 1970 +0000
48 | summary: A1
48 | summary: A1
49 |
49 |
50 | x changeset: 2:f137d23bb3e1
50 | x changeset: 2:f137d23bb3e1
51 | | user: test
51 | | user: test
52 | | date: Thu Jan 01 00:00:00 1970 +0000
52 | | date: Thu Jan 01 00:00:00 1970 +0000
53 | | summary: temporary amend commit for 471f378eab4c
53 | | summary: temporary amend commit for 471f378eab4c
54 | |
54 | |
55 | x changeset: 1:471f378eab4c
55 | x changeset: 1:471f378eab4c
56 |/ user: test
56 |/ user: test
57 | date: Thu Jan 01 00:00:00 1970 +0000
57 | date: Thu Jan 01 00:00:00 1970 +0000
58 | summary: A0
58 | summary: A0
59 |
59 |
60 o changeset: 0:ea207398892e
60 o changeset: 0:ea207398892e
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: ROOT
63 summary: ROOT
64
64
65 Check templates
65 Check templates
66 ---------------
66 ---------------
67 $ hg up 'desc(A0)' --hidden
67 $ hg up 'desc(A0)' --hidden
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69
69
70 Predecessors template should show current revision as it is the working copy
70 Predecessors template should show current revision as it is the working copy
71 $ hg tlog
71 $ hg tlog
72 o d004c8f274b9
72 o d004c8f274b9
73 | Predecessors: 471f378eab4c
73 | Predecessors: 471f378eab4c
74 | semi-colon: 471f378eab4c
74 | semi-colon: 471f378eab4c
75 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
75 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
76 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
76 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
77 | @ 471f378eab4c
77 | @ 471f378eab4c
78 |/
78 |/
79 o ea207398892e
79 o ea207398892e
80
80
81 $ hg up 'desc(A1)' --hidden
81 $ hg up 'desc(A1)' --hidden
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83
83
84 Predecessors template should show current revision as it is the working copy
84 Predecessors template should show current revision as it is the working copy
85 $ hg tlog
85 $ hg tlog
86 o d004c8f274b9
86 o d004c8f274b9
87 | Predecessors: a468dc9b3633
87 | Predecessors: a468dc9b3633
88 | semi-colon: a468dc9b3633
88 | semi-colon: a468dc9b3633
89 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
89 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
90 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
90 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
91 | @ a468dc9b3633
91 | @ a468dc9b3633
92 |/
92 |/
93 o ea207398892e
93 o ea207398892e
94
94
95 Predecessors template should show all the predecessors as we force their display
95 Predecessors template should show all the predecessors as we force their display
96 with --hidden
96 with --hidden
97 $ hg tlog --hidden
97 $ hg tlog --hidden
98 o d004c8f274b9
98 o d004c8f274b9
99 | Predecessors: a468dc9b3633
99 | Predecessors: a468dc9b3633
100 | semi-colon: a468dc9b3633
100 | semi-colon: a468dc9b3633
101 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
101 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
102 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
102 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
103 | @ a468dc9b3633
103 | @ a468dc9b3633
104 |/ Predecessors: 471f378eab4c
104 |/ Predecessors: 471f378eab4c
105 | semi-colon: 471f378eab4c
105 | semi-colon: 471f378eab4c
106 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
106 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
107 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
107 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
108 | x f137d23bb3e1
108 | x f137d23bb3e1
109 | |
109 | |
110 | x 471f378eab4c
110 | x 471f378eab4c
111 |/
111 |/
112 o ea207398892e
112 o ea207398892e
113
113
114
114
115 Predecessors template shouldn't show anything as all obsolete commit are not
115 Predecessors template shouldn't show anything as all obsolete commit are not
116 visible.
116 visible.
117 $ hg up 'desc(A2)'
117 $ hg up 'desc(A2)'
118 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 $ hg tlog
119 $ hg tlog
120 @ d004c8f274b9
120 @ d004c8f274b9
121 |
121 |
122 o ea207398892e
122 o ea207398892e
123
123
124 $ hg tlog --hidden
124 $ hg tlog --hidden
125 @ d004c8f274b9
125 @ d004c8f274b9
126 | Predecessors: a468dc9b3633
126 | Predecessors: a468dc9b3633
127 | semi-colon: a468dc9b3633
127 | semi-colon: a468dc9b3633
128 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
128 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
129 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
129 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
130 | x a468dc9b3633
130 | x a468dc9b3633
131 |/ Predecessors: 471f378eab4c
131 |/ Predecessors: 471f378eab4c
132 | semi-colon: 471f378eab4c
132 | semi-colon: 471f378eab4c
133 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
133 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
134 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
134 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
135 | x f137d23bb3e1
135 | x f137d23bb3e1
136 | |
136 | |
137 | x 471f378eab4c
137 | x 471f378eab4c
138 |/
138 |/
139 o ea207398892e
139 o ea207398892e
140
140
141
141
142 Test templates with splitted commit
142 Test templates with splitted commit
143 ===================================
143 ===================================
144
144
145 $ hg init $TESTTMP/templates-local-split
145 $ hg init $TESTTMP/templates-local-split
146 $ cd $TESTTMP/templates-local-split
146 $ cd $TESTTMP/templates-local-split
147 $ mkcommit ROOT
147 $ mkcommit ROOT
148 $ echo 42 >> a
148 $ echo 42 >> a
149 $ echo 43 >> b
149 $ echo 43 >> b
150 $ hg commit -A -m "A0"
150 $ hg commit -A -m "A0"
151 adding a
151 adding a
152 adding b
152 adding b
153 $ hg log --hidden -G
153 $ hg log --hidden -G
154 @ changeset: 1:471597cad322
154 @ changeset: 1:471597cad322
155 | tag: tip
155 | tag: tip
156 | user: test
156 | user: test
157 | date: Thu Jan 01 00:00:00 1970 +0000
157 | date: Thu Jan 01 00:00:00 1970 +0000
158 | summary: A0
158 | summary: A0
159 |
159 |
160 o changeset: 0:ea207398892e
160 o changeset: 0:ea207398892e
161 user: test
161 user: test
162 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
163 summary: ROOT
163 summary: ROOT
164
164
165 # Simulate split
165 # Simulate split
166 $ hg up -r "desc(ROOT)"
166 $ hg up -r "desc(ROOT)"
167 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
167 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
168 $ echo 42 >> a
168 $ echo 42 >> a
169 $ hg commit -A -m "A0"
169 $ hg commit -A -m "A0"
170 adding a
170 adding a
171 created new head
171 created new head
172 $ echo 43 >> b
172 $ echo 43 >> b
173 $ hg commit -A -m "A0"
173 $ hg commit -A -m "A0"
174 adding b
174 adding b
175 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
175 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
176
176
177 $ hg log --hidden -G
177 $ hg log --hidden -G
178 @ changeset: 3:f257fde29c7a
178 @ changeset: 3:f257fde29c7a
179 | tag: tip
179 | tag: tip
180 | user: test
180 | user: test
181 | date: Thu Jan 01 00:00:00 1970 +0000
181 | date: Thu Jan 01 00:00:00 1970 +0000
182 | summary: A0
182 | summary: A0
183 |
183 |
184 o changeset: 2:337fec4d2edc
184 o changeset: 2:337fec4d2edc
185 | parent: 0:ea207398892e
185 | parent: 0:ea207398892e
186 | user: test
186 | user: test
187 | date: Thu Jan 01 00:00:00 1970 +0000
187 | date: Thu Jan 01 00:00:00 1970 +0000
188 | summary: A0
188 | summary: A0
189 |
189 |
190 | x changeset: 1:471597cad322
190 | x changeset: 1:471597cad322
191 |/ user: test
191 |/ user: test
192 | date: Thu Jan 01 00:00:00 1970 +0000
192 | date: Thu Jan 01 00:00:00 1970 +0000
193 | summary: A0
193 | summary: A0
194 |
194 |
195 o changeset: 0:ea207398892e
195 o changeset: 0:ea207398892e
196 user: test
196 user: test
197 date: Thu Jan 01 00:00:00 1970 +0000
197 date: Thu Jan 01 00:00:00 1970 +0000
198 summary: ROOT
198 summary: ROOT
199
199
200 Check templates
200 Check templates
201 ---------------
201 ---------------
202
202
203 $ hg up 'obsolete()' --hidden
203 $ hg up 'obsolete()' --hidden
204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
205
205
206 Predecessors template should show current revision as it is the working copy
206 Predecessors template should show current revision as it is the working copy
207 $ hg tlog
207 $ hg tlog
208 o f257fde29c7a
208 o f257fde29c7a
209 | Predecessors: 471597cad322
209 | Predecessors: 471597cad322
210 | semi-colon: 471597cad322
210 | semi-colon: 471597cad322
211 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
211 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
212 | map: 471597cad322d1f659bb169751be9133dad92ef3
212 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
213 o 337fec4d2edc
213 o 337fec4d2edc
214 | Predecessors: 471597cad322
214 | Predecessors: 471597cad322
215 | semi-colon: 471597cad322
215 | semi-colon: 471597cad322
216 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
216 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
217 | map: 471597cad322d1f659bb169751be9133dad92ef3
217 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
218 | @ 471597cad322
218 | @ 471597cad322
219 |/
219 |/
220 o ea207398892e
220 o ea207398892e
221
221
222 $ hg up f257fde29c7a
222 $ hg up f257fde29c7a
223 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
224
224
225 Predecessors template should not show a predecessor as it's not displayed in
225 Predecessors template should not show a predecessor as it's not displayed in
226 the log
226 the log
227 $ hg tlog
227 $ hg tlog
228 @ f257fde29c7a
228 @ f257fde29c7a
229 |
229 |
230 o 337fec4d2edc
230 o 337fec4d2edc
231 |
231 |
232 o ea207398892e
232 o ea207398892e
233
233
234 Predecessors template should show both predecessors as we force their display
234 Predecessors template should show both predecessors as we force their display
235 with --hidden
235 with --hidden
236 $ hg tlog --hidden
236 $ hg tlog --hidden
237 @ f257fde29c7a
237 @ f257fde29c7a
238 | Predecessors: 471597cad322
238 | Predecessors: 471597cad322
239 | semi-colon: 471597cad322
239 | semi-colon: 471597cad322
240 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
240 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
241 | map: 471597cad322d1f659bb169751be9133dad92ef3
241 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
242 o 337fec4d2edc
242 o 337fec4d2edc
243 | Predecessors: 471597cad322
243 | Predecessors: 471597cad322
244 | semi-colon: 471597cad322
244 | semi-colon: 471597cad322
245 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
245 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
246 | map: 471597cad322d1f659bb169751be9133dad92ef3
246 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
247 | x 471597cad322
247 | x 471597cad322
248 |/
248 |/
249 o ea207398892e
249 o ea207398892e
250
250
251 Test templates with folded commit
251 Test templates with folded commit
252 =================================
252 =================================
253
253
254 Test setup
254 Test setup
255 ----------
255 ----------
256
256
257 $ hg init $TESTTMP/templates-local-fold
257 $ hg init $TESTTMP/templates-local-fold
258 $ cd $TESTTMP/templates-local-fold
258 $ cd $TESTTMP/templates-local-fold
259 $ mkcommit ROOT
259 $ mkcommit ROOT
260 $ mkcommit A0
260 $ mkcommit A0
261 $ mkcommit B0
261 $ mkcommit B0
262 $ hg log --hidden -G
262 $ hg log --hidden -G
263 @ changeset: 2:0dec01379d3b
263 @ changeset: 2:0dec01379d3b
264 | tag: tip
264 | tag: tip
265 | user: test
265 | user: test
266 | date: Thu Jan 01 00:00:00 1970 +0000
266 | date: Thu Jan 01 00:00:00 1970 +0000
267 | summary: B0
267 | summary: B0
268 |
268 |
269 o changeset: 1:471f378eab4c
269 o changeset: 1:471f378eab4c
270 | user: test
270 | user: test
271 | date: Thu Jan 01 00:00:00 1970 +0000
271 | date: Thu Jan 01 00:00:00 1970 +0000
272 | summary: A0
272 | summary: A0
273 |
273 |
274 o changeset: 0:ea207398892e
274 o changeset: 0:ea207398892e
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: ROOT
277 summary: ROOT
278
278
279 Simulate a fold
279 Simulate a fold
280 $ hg up -r "desc(ROOT)"
280 $ hg up -r "desc(ROOT)"
281 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
281 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
282 $ echo "A0" > A0
282 $ echo "A0" > A0
283 $ echo "B0" > B0
283 $ echo "B0" > B0
284 $ hg commit -A -m "C0"
284 $ hg commit -A -m "C0"
285 adding A0
285 adding A0
286 adding B0
286 adding B0
287 created new head
287 created new head
288 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
288 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
289 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
289 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
290
290
291 $ hg log --hidden -G
291 $ hg log --hidden -G
292 @ changeset: 3:eb5a0daa2192
292 @ changeset: 3:eb5a0daa2192
293 | tag: tip
293 | tag: tip
294 | parent: 0:ea207398892e
294 | parent: 0:ea207398892e
295 | user: test
295 | user: test
296 | date: Thu Jan 01 00:00:00 1970 +0000
296 | date: Thu Jan 01 00:00:00 1970 +0000
297 | summary: C0
297 | summary: C0
298 |
298 |
299 | x changeset: 2:0dec01379d3b
299 | x changeset: 2:0dec01379d3b
300 | | user: test
300 | | user: test
301 | | date: Thu Jan 01 00:00:00 1970 +0000
301 | | date: Thu Jan 01 00:00:00 1970 +0000
302 | | summary: B0
302 | | summary: B0
303 | |
303 | |
304 | x changeset: 1:471f378eab4c
304 | x changeset: 1:471f378eab4c
305 |/ user: test
305 |/ user: test
306 | date: Thu Jan 01 00:00:00 1970 +0000
306 | date: Thu Jan 01 00:00:00 1970 +0000
307 | summary: A0
307 | summary: A0
308 |
308 |
309 o changeset: 0:ea207398892e
309 o changeset: 0:ea207398892e
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: ROOT
312 summary: ROOT
313
313
314 Check templates
314 Check templates
315 ---------------
315 ---------------
316
316
317 $ hg up 'desc(A0)' --hidden
317 $ hg up 'desc(A0)' --hidden
318 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
318 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
319
319
320 Predecessors template should show current revision as it is the working copy
320 Predecessors template should show current revision as it is the working copy
321 $ hg tlog
321 $ hg tlog
322 o eb5a0daa2192
322 o eb5a0daa2192
323 | Predecessors: 471f378eab4c
323 | Predecessors: 471f378eab4c
324 | semi-colon: 471f378eab4c
324 | semi-colon: 471f378eab4c
325 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
325 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
326 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
326 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
327 | @ 471f378eab4c
327 | @ 471f378eab4c
328 |/
328 |/
329 o ea207398892e
329 o ea207398892e
330
330
331 $ hg up 'desc(B0)' --hidden
331 $ hg up 'desc(B0)' --hidden
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333
333
334 Predecessors template should show both predecessors as they should be both
334 Predecessors template should show both predecessors as they should be both
335 displayed
335 displayed
336 $ hg tlog
336 $ hg tlog
337 o eb5a0daa2192
337 o eb5a0daa2192
338 | Predecessors: 0dec01379d3b 471f378eab4c
338 | Predecessors: 0dec01379d3b 471f378eab4c
339 | semi-colon: 0dec01379d3b; 471f378eab4c
339 | semi-colon: 0dec01379d3b; 471f378eab4c
340 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
340 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
341 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
341 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
342 | @ 0dec01379d3b
342 | @ 0dec01379d3b
343 | |
343 | |
344 | x 471f378eab4c
344 | x 471f378eab4c
345 |/
345 |/
346 o ea207398892e
346 o ea207398892e
347
347
348 $ hg up 'desc(C0)'
348 $ hg up 'desc(C0)'
349 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
349 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
350
350
351 Predecessors template should not show predecessors as they are not displayed in
351 Predecessors template should not show predecessors as they are not displayed in
352 the log
352 the log
353 $ hg tlog
353 $ hg tlog
354 @ eb5a0daa2192
354 @ eb5a0daa2192
355 |
355 |
356 o ea207398892e
356 o ea207398892e
357
357
358 Predecessors template should show both predecessors as we force their display
358 Predecessors template should show both predecessors as we force their display
359 with --hidden
359 with --hidden
360 $ hg tlog --hidden
360 $ hg tlog --hidden
361 @ eb5a0daa2192
361 @ eb5a0daa2192
362 | Predecessors: 0dec01379d3b 471f378eab4c
362 | Predecessors: 0dec01379d3b 471f378eab4c
363 | semi-colon: 0dec01379d3b; 471f378eab4c
363 | semi-colon: 0dec01379d3b; 471f378eab4c
364 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
364 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
365 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
365 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
366 | x 0dec01379d3b
366 | x 0dec01379d3b
367 | |
367 | |
368 | x 471f378eab4c
368 | x 471f378eab4c
369 |/
369 |/
370 o ea207398892e
370 o ea207398892e
371
371
372
372
373 Test templates with divergence
373 Test templates with divergence
374 ==============================
374 ==============================
375
375
376 Test setup
376 Test setup
377 ----------
377 ----------
378
378
379 $ hg init $TESTTMP/templates-local-divergence
379 $ hg init $TESTTMP/templates-local-divergence
380 $ cd $TESTTMP/templates-local-divergence
380 $ cd $TESTTMP/templates-local-divergence
381 $ mkcommit ROOT
381 $ mkcommit ROOT
382 $ mkcommit A0
382 $ mkcommit A0
383 $ hg commit --amend -m "A1"
383 $ hg commit --amend -m "A1"
384 $ hg log --hidden -G
384 $ hg log --hidden -G
385 @ changeset: 2:fdf9bde5129a
385 @ changeset: 2:fdf9bde5129a
386 | tag: tip
386 | tag: tip
387 | parent: 0:ea207398892e
387 | parent: 0:ea207398892e
388 | user: test
388 | user: test
389 | date: Thu Jan 01 00:00:00 1970 +0000
389 | date: Thu Jan 01 00:00:00 1970 +0000
390 | summary: A1
390 | summary: A1
391 |
391 |
392 | x changeset: 1:471f378eab4c
392 | x changeset: 1:471f378eab4c
393 |/ user: test
393 |/ user: test
394 | date: Thu Jan 01 00:00:00 1970 +0000
394 | date: Thu Jan 01 00:00:00 1970 +0000
395 | summary: A0
395 | summary: A0
396 |
396 |
397 o changeset: 0:ea207398892e
397 o changeset: 0:ea207398892e
398 user: test
398 user: test
399 date: Thu Jan 01 00:00:00 1970 +0000
399 date: Thu Jan 01 00:00:00 1970 +0000
400 summary: ROOT
400 summary: ROOT
401
401
402 $ hg update --hidden 'desc(A0)'
402 $ hg update --hidden 'desc(A0)'
403 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
404 $ hg commit --amend -m "A2"
404 $ hg commit --amend -m "A2"
405 $ hg log --hidden -G
405 $ hg log --hidden -G
406 @ changeset: 3:65b757b745b9
406 @ changeset: 3:65b757b745b9
407 | tag: tip
407 | tag: tip
408 | parent: 0:ea207398892e
408 | parent: 0:ea207398892e
409 | user: test
409 | user: test
410 | date: Thu Jan 01 00:00:00 1970 +0000
410 | date: Thu Jan 01 00:00:00 1970 +0000
411 | trouble: divergent
411 | trouble: divergent
412 | summary: A2
412 | summary: A2
413 |
413 |
414 | o changeset: 2:fdf9bde5129a
414 | o changeset: 2:fdf9bde5129a
415 |/ parent: 0:ea207398892e
415 |/ parent: 0:ea207398892e
416 | user: test
416 | user: test
417 | date: Thu Jan 01 00:00:00 1970 +0000
417 | date: Thu Jan 01 00:00:00 1970 +0000
418 | trouble: divergent
418 | trouble: divergent
419 | summary: A1
419 | summary: A1
420 |
420 |
421 | x changeset: 1:471f378eab4c
421 | x changeset: 1:471f378eab4c
422 |/ user: test
422 |/ user: test
423 | date: Thu Jan 01 00:00:00 1970 +0000
423 | date: Thu Jan 01 00:00:00 1970 +0000
424 | summary: A0
424 | summary: A0
425 |
425 |
426 o changeset: 0:ea207398892e
426 o changeset: 0:ea207398892e
427 user: test
427 user: test
428 date: Thu Jan 01 00:00:00 1970 +0000
428 date: Thu Jan 01 00:00:00 1970 +0000
429 summary: ROOT
429 summary: ROOT
430
430
431 $ hg commit --amend -m 'A3'
431 $ hg commit --amend -m 'A3'
432 $ hg log --hidden -G
432 $ hg log --hidden -G
433 @ changeset: 4:019fadeab383
433 @ changeset: 4:019fadeab383
434 | tag: tip
434 | tag: tip
435 | parent: 0:ea207398892e
435 | parent: 0:ea207398892e
436 | user: test
436 | user: test
437 | date: Thu Jan 01 00:00:00 1970 +0000
437 | date: Thu Jan 01 00:00:00 1970 +0000
438 | trouble: divergent
438 | trouble: divergent
439 | summary: A3
439 | summary: A3
440 |
440 |
441 | x changeset: 3:65b757b745b9
441 | x changeset: 3:65b757b745b9
442 |/ parent: 0:ea207398892e
442 |/ parent: 0:ea207398892e
443 | user: test
443 | user: test
444 | date: Thu Jan 01 00:00:00 1970 +0000
444 | date: Thu Jan 01 00:00:00 1970 +0000
445 | summary: A2
445 | summary: A2
446 |
446 |
447 | o changeset: 2:fdf9bde5129a
447 | o changeset: 2:fdf9bde5129a
448 |/ parent: 0:ea207398892e
448 |/ parent: 0:ea207398892e
449 | user: test
449 | user: test
450 | date: Thu Jan 01 00:00:00 1970 +0000
450 | date: Thu Jan 01 00:00:00 1970 +0000
451 | trouble: divergent
451 | trouble: divergent
452 | summary: A1
452 | summary: A1
453 |
453 |
454 | x changeset: 1:471f378eab4c
454 | x changeset: 1:471f378eab4c
455 |/ user: test
455 |/ user: test
456 | date: Thu Jan 01 00:00:00 1970 +0000
456 | date: Thu Jan 01 00:00:00 1970 +0000
457 | summary: A0
457 | summary: A0
458 |
458 |
459 o changeset: 0:ea207398892e
459 o changeset: 0:ea207398892e
460 user: test
460 user: test
461 date: Thu Jan 01 00:00:00 1970 +0000
461 date: Thu Jan 01 00:00:00 1970 +0000
462 summary: ROOT
462 summary: ROOT
463
463
464
464
465 Check templates
465 Check templates
466 ---------------
466 ---------------
467
467
468 $ hg up 'desc(A0)' --hidden
468 $ hg up 'desc(A0)' --hidden
469 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
469 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
470
470
471 Predecessors template should show current revision as it is the working copy
471 Predecessors template should show current revision as it is the working copy
472 $ hg tlog
472 $ hg tlog
473 o 019fadeab383
473 o 019fadeab383
474 | Predecessors: 471f378eab4c
474 | Predecessors: 471f378eab4c
475 | semi-colon: 471f378eab4c
475 | semi-colon: 471f378eab4c
476 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
476 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
477 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
477 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
478 | o fdf9bde5129a
478 | o fdf9bde5129a
479 |/ Predecessors: 471f378eab4c
479 |/ Predecessors: 471f378eab4c
480 | semi-colon: 471f378eab4c
480 | semi-colon: 471f378eab4c
481 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
481 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
482 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
482 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
483 | @ 471f378eab4c
483 | @ 471f378eab4c
484 |/
484 |/
485 o ea207398892e
485 o ea207398892e
486
486
487 $ hg up 'desc(A1)'
487 $ hg up 'desc(A1)'
488 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
488 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
489
489
490 Predecessors template should not show predecessors as they are not displayed in
490 Predecessors template should not show predecessors as they are not displayed in
491 the log
491 the log
492 $ hg tlog
492 $ hg tlog
493 o 019fadeab383
493 o 019fadeab383
494 |
494 |
495 | @ fdf9bde5129a
495 | @ fdf9bde5129a
496 |/
496 |/
497 o ea207398892e
497 o ea207398892e
498
498
499 Predecessors template should the predecessors as we force their display with
499 Predecessors template should the predecessors as we force their display with
500 --hidden
500 --hidden
501 $ hg tlog --hidden
501 $ hg tlog --hidden
502 o 019fadeab383
502 o 019fadeab383
503 | Predecessors: 65b757b745b9
503 | Predecessors: 65b757b745b9
504 | semi-colon: 65b757b745b9
504 | semi-colon: 65b757b745b9
505 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
505 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
506 | map: 65b757b745b935093c87a2bccd877521cccffcbd
506 | map: 3:65b757b745b935093c87a2bccd877521cccffcbd
507 | x 65b757b745b9
507 | x 65b757b745b9
508 |/ Predecessors: 471f378eab4c
508 |/ Predecessors: 471f378eab4c
509 | semi-colon: 471f378eab4c
509 | semi-colon: 471f378eab4c
510 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
510 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
511 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
511 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
512 | @ fdf9bde5129a
512 | @ fdf9bde5129a
513 |/ Predecessors: 471f378eab4c
513 |/ Predecessors: 471f378eab4c
514 | semi-colon: 471f378eab4c
514 | semi-colon: 471f378eab4c
515 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
515 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
516 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
516 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
517 | x 471f378eab4c
517 | x 471f378eab4c
518 |/
518 |/
519 o ea207398892e
519 o ea207398892e
520
520
521
521
522 Test templates with amended + folded commit
522 Test templates with amended + folded commit
523 ===========================================
523 ===========================================
524
524
525 Test setup
525 Test setup
526 ----------
526 ----------
527
527
528 $ hg init $TESTTMP/templates-local-amend-fold
528 $ hg init $TESTTMP/templates-local-amend-fold
529 $ cd $TESTTMP/templates-local-amend-fold
529 $ cd $TESTTMP/templates-local-amend-fold
530 $ mkcommit ROOT
530 $ mkcommit ROOT
531 $ mkcommit A0
531 $ mkcommit A0
532 $ mkcommit B0
532 $ mkcommit B0
533 $ hg commit --amend -m "B1"
533 $ hg commit --amend -m "B1"
534 $ hg log --hidden -G
534 $ hg log --hidden -G
535 @ changeset: 3:b7ea6d14e664
535 @ changeset: 3:b7ea6d14e664
536 | tag: tip
536 | tag: tip
537 | parent: 1:471f378eab4c
537 | parent: 1:471f378eab4c
538 | user: test
538 | user: test
539 | date: Thu Jan 01 00:00:00 1970 +0000
539 | date: Thu Jan 01 00:00:00 1970 +0000
540 | summary: B1
540 | summary: B1
541 |
541 |
542 | x changeset: 2:0dec01379d3b
542 | x changeset: 2:0dec01379d3b
543 |/ user: test
543 |/ user: test
544 | date: Thu Jan 01 00:00:00 1970 +0000
544 | date: Thu Jan 01 00:00:00 1970 +0000
545 | summary: B0
545 | summary: B0
546 |
546 |
547 o changeset: 1:471f378eab4c
547 o changeset: 1:471f378eab4c
548 | user: test
548 | user: test
549 | date: Thu Jan 01 00:00:00 1970 +0000
549 | date: Thu Jan 01 00:00:00 1970 +0000
550 | summary: A0
550 | summary: A0
551 |
551 |
552 o changeset: 0:ea207398892e
552 o changeset: 0:ea207398892e
553 user: test
553 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: ROOT
555 summary: ROOT
556
556
557 # Simulate a fold
557 # Simulate a fold
558 $ hg up -r "desc(ROOT)"
558 $ hg up -r "desc(ROOT)"
559 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
559 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
560 $ echo "A0" > A0
560 $ echo "A0" > A0
561 $ echo "B0" > B0
561 $ echo "B0" > B0
562 $ hg commit -A -m "C0"
562 $ hg commit -A -m "C0"
563 adding A0
563 adding A0
564 adding B0
564 adding B0
565 created new head
565 created new head
566 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
566 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
567 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
567 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
568
568
569 $ hg log --hidden -G
569 $ hg log --hidden -G
570 @ changeset: 4:eb5a0daa2192
570 @ changeset: 4:eb5a0daa2192
571 | tag: tip
571 | tag: tip
572 | parent: 0:ea207398892e
572 | parent: 0:ea207398892e
573 | user: test
573 | user: test
574 | date: Thu Jan 01 00:00:00 1970 +0000
574 | date: Thu Jan 01 00:00:00 1970 +0000
575 | summary: C0
575 | summary: C0
576 |
576 |
577 | x changeset: 3:b7ea6d14e664
577 | x changeset: 3:b7ea6d14e664
578 | | parent: 1:471f378eab4c
578 | | parent: 1:471f378eab4c
579 | | user: test
579 | | user: test
580 | | date: Thu Jan 01 00:00:00 1970 +0000
580 | | date: Thu Jan 01 00:00:00 1970 +0000
581 | | summary: B1
581 | | summary: B1
582 | |
582 | |
583 | | x changeset: 2:0dec01379d3b
583 | | x changeset: 2:0dec01379d3b
584 | |/ user: test
584 | |/ user: test
585 | | date: Thu Jan 01 00:00:00 1970 +0000
585 | | date: Thu Jan 01 00:00:00 1970 +0000
586 | | summary: B0
586 | | summary: B0
587 | |
587 | |
588 | x changeset: 1:471f378eab4c
588 | x changeset: 1:471f378eab4c
589 |/ user: test
589 |/ user: test
590 | date: Thu Jan 01 00:00:00 1970 +0000
590 | date: Thu Jan 01 00:00:00 1970 +0000
591 | summary: A0
591 | summary: A0
592 |
592 |
593 o changeset: 0:ea207398892e
593 o changeset: 0:ea207398892e
594 user: test
594 user: test
595 date: Thu Jan 01 00:00:00 1970 +0000
595 date: Thu Jan 01 00:00:00 1970 +0000
596 summary: ROOT
596 summary: ROOT
597
597
598 Check templates
598 Check templates
599 ---------------
599 ---------------
600
600
601 $ hg up 'desc(A0)' --hidden
601 $ hg up 'desc(A0)' --hidden
602 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
602 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
603
603
604 Predecessors template should show current revision as it is the working copy
604 Predecessors template should show current revision as it is the working copy
605 $ hg tlog
605 $ hg tlog
606 o eb5a0daa2192
606 o eb5a0daa2192
607 | Predecessors: 471f378eab4c
607 | Predecessors: 471f378eab4c
608 | semi-colon: 471f378eab4c
608 | semi-colon: 471f378eab4c
609 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
609 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
610 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
610 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
611 | @ 471f378eab4c
611 | @ 471f378eab4c
612 |/
612 |/
613 o ea207398892e
613 o ea207398892e
614
614
615 $ hg up 'desc(B0)' --hidden
615 $ hg up 'desc(B0)' --hidden
616 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
616 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
617
617
618 Predecessors template should both predecessors as they are visible
618 Predecessors template should both predecessors as they are visible
619 $ hg tlog
619 $ hg tlog
620 o eb5a0daa2192
620 o eb5a0daa2192
621 | Predecessors: 0dec01379d3b 471f378eab4c
621 | Predecessors: 0dec01379d3b 471f378eab4c
622 | semi-colon: 0dec01379d3b; 471f378eab4c
622 | semi-colon: 0dec01379d3b; 471f378eab4c
623 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
623 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
624 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
624 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
625 | @ 0dec01379d3b
625 | @ 0dec01379d3b
626 | |
626 | |
627 | x 471f378eab4c
627 | x 471f378eab4c
628 |/
628 |/
629 o ea207398892e
629 o ea207398892e
630
630
631 $ hg up 'desc(B1)' --hidden
631 $ hg up 'desc(B1)' --hidden
632 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
632 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
633
633
634 Predecessors template should both predecessors as they are visible
634 Predecessors template should both predecessors as they are visible
635 $ hg tlog
635 $ hg tlog
636 o eb5a0daa2192
636 o eb5a0daa2192
637 | Predecessors: 471f378eab4c b7ea6d14e664
637 | Predecessors: 471f378eab4c b7ea6d14e664
638 | semi-colon: 471f378eab4c; b7ea6d14e664
638 | semi-colon: 471f378eab4c; b7ea6d14e664
639 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
639 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
640 | map: 471f378eab4c5e25f6c77f785b27c936efb22874 b7ea6d14e664bdc8922221f7992631b50da3fb07
640 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
641 | @ b7ea6d14e664
641 | @ b7ea6d14e664
642 | |
642 | |
643 | x 471f378eab4c
643 | x 471f378eab4c
644 |/
644 |/
645 o ea207398892e
645 o ea207398892e
646
646
647 $ hg up 'desc(C0)'
647 $ hg up 'desc(C0)'
648 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
648 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
649
649
650 Predecessors template should show no predecessors as they are both non visible
650 Predecessors template should show no predecessors as they are both non visible
651 $ hg tlog
651 $ hg tlog
652 @ eb5a0daa2192
652 @ eb5a0daa2192
653 |
653 |
654 o ea207398892e
654 o ea207398892e
655
655
656 Predecessors template should show all predecessors as we force their display
656 Predecessors template should show all predecessors as we force their display
657 with --hidden
657 with --hidden
658 $ hg tlog --hidden
658 $ hg tlog --hidden
659 @ eb5a0daa2192
659 @ eb5a0daa2192
660 | Predecessors: 471f378eab4c b7ea6d14e664
660 | Predecessors: 471f378eab4c b7ea6d14e664
661 | semi-colon: 471f378eab4c; b7ea6d14e664
661 | semi-colon: 471f378eab4c; b7ea6d14e664
662 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
662 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
663 | map: 471f378eab4c5e25f6c77f785b27c936efb22874 b7ea6d14e664bdc8922221f7992631b50da3fb07
663 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
664 | x b7ea6d14e664
664 | x b7ea6d14e664
665 | | Predecessors: 0dec01379d3b
665 | | Predecessors: 0dec01379d3b
666 | | semi-colon: 0dec01379d3b
666 | | semi-colon: 0dec01379d3b
667 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
667 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
668 | | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
668 | | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
669 | | x 0dec01379d3b
669 | | x 0dec01379d3b
670 | |/
670 | |/
671 | x 471f378eab4c
671 | x 471f378eab4c
672 |/
672 |/
673 o ea207398892e
673 o ea207398892e
674
674
675
675
676 Test template with pushed and pulled obs markers
676 Test template with pushed and pulled obs markers
677 ================================================
677 ================================================
678
678
679 Test setup
679 Test setup
680 ----------
680 ----------
681
681
682 $ hg init $TESTTMP/templates-local-remote-markers-1
682 $ hg init $TESTTMP/templates-local-remote-markers-1
683 $ cd $TESTTMP/templates-local-remote-markers-1
683 $ cd $TESTTMP/templates-local-remote-markers-1
684 $ mkcommit ROOT
684 $ mkcommit ROOT
685 $ mkcommit A0
685 $ mkcommit A0
686 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
686 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
687 updating to branch default
687 updating to branch default
688 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
688 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
689 $ cd $TESTTMP/templates-local-remote-markers-2
689 $ cd $TESTTMP/templates-local-remote-markers-2
690 $ hg log --hidden -G
690 $ hg log --hidden -G
691 @ changeset: 1:471f378eab4c
691 @ changeset: 1:471f378eab4c
692 | tag: tip
692 | tag: tip
693 | user: test
693 | user: test
694 | date: Thu Jan 01 00:00:00 1970 +0000
694 | date: Thu Jan 01 00:00:00 1970 +0000
695 | summary: A0
695 | summary: A0
696 |
696 |
697 o changeset: 0:ea207398892e
697 o changeset: 0:ea207398892e
698 user: test
698 user: test
699 date: Thu Jan 01 00:00:00 1970 +0000
699 date: Thu Jan 01 00:00:00 1970 +0000
700 summary: ROOT
700 summary: ROOT
701
701
702 $ cd $TESTTMP/templates-local-remote-markers-1
702 $ cd $TESTTMP/templates-local-remote-markers-1
703 $ hg commit --amend -m "A1"
703 $ hg commit --amend -m "A1"
704 $ hg commit --amend -m "A2"
704 $ hg commit --amend -m "A2"
705 $ hg log --hidden -G
705 $ hg log --hidden -G
706 @ changeset: 3:7a230b46bf61
706 @ changeset: 3:7a230b46bf61
707 | tag: tip
707 | tag: tip
708 | parent: 0:ea207398892e
708 | parent: 0:ea207398892e
709 | user: test
709 | user: test
710 | date: Thu Jan 01 00:00:00 1970 +0000
710 | date: Thu Jan 01 00:00:00 1970 +0000
711 | summary: A2
711 | summary: A2
712 |
712 |
713 | x changeset: 2:fdf9bde5129a
713 | x changeset: 2:fdf9bde5129a
714 |/ parent: 0:ea207398892e
714 |/ parent: 0:ea207398892e
715 | user: test
715 | user: test
716 | date: Thu Jan 01 00:00:00 1970 +0000
716 | date: Thu Jan 01 00:00:00 1970 +0000
717 | summary: A1
717 | summary: A1
718 |
718 |
719 | x changeset: 1:471f378eab4c
719 | x changeset: 1:471f378eab4c
720 |/ user: test
720 |/ user: test
721 | date: Thu Jan 01 00:00:00 1970 +0000
721 | date: Thu Jan 01 00:00:00 1970 +0000
722 | summary: A0
722 | summary: A0
723 |
723 |
724 o changeset: 0:ea207398892e
724 o changeset: 0:ea207398892e
725 user: test
725 user: test
726 date: Thu Jan 01 00:00:00 1970 +0000
726 date: Thu Jan 01 00:00:00 1970 +0000
727 summary: ROOT
727 summary: ROOT
728
728
729 $ cd $TESTTMP/templates-local-remote-markers-2
729 $ cd $TESTTMP/templates-local-remote-markers-2
730 $ hg pull
730 $ hg pull
731 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
731 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
732 searching for changes
732 searching for changes
733 adding changesets
733 adding changesets
734 adding manifests
734 adding manifests
735 adding file changes
735 adding file changes
736 added 1 changesets with 0 changes to 1 files (+1 heads)
736 added 1 changesets with 0 changes to 1 files (+1 heads)
737 2 new obsolescence markers
737 2 new obsolescence markers
738 (run 'hg heads' to see heads, 'hg merge' to merge)
738 (run 'hg heads' to see heads, 'hg merge' to merge)
739 $ hg log --hidden -G
739 $ hg log --hidden -G
740 o changeset: 2:7a230b46bf61
740 o changeset: 2:7a230b46bf61
741 | tag: tip
741 | tag: tip
742 | parent: 0:ea207398892e
742 | parent: 0:ea207398892e
743 | user: test
743 | user: test
744 | date: Thu Jan 01 00:00:00 1970 +0000
744 | date: Thu Jan 01 00:00:00 1970 +0000
745 | summary: A2
745 | summary: A2
746 |
746 |
747 | @ changeset: 1:471f378eab4c
747 | @ changeset: 1:471f378eab4c
748 |/ user: test
748 |/ user: test
749 | date: Thu Jan 01 00:00:00 1970 +0000
749 | date: Thu Jan 01 00:00:00 1970 +0000
750 | summary: A0
750 | summary: A0
751 |
751 |
752 o changeset: 0:ea207398892e
752 o changeset: 0:ea207398892e
753 user: test
753 user: test
754 date: Thu Jan 01 00:00:00 1970 +0000
754 date: Thu Jan 01 00:00:00 1970 +0000
755 summary: ROOT
755 summary: ROOT
756
756
757
757
758 $ hg debugobsolete
758 $ hg debugobsolete
759 471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
759 471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
760 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
760 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
761
761
762 Check templates
762 Check templates
763 ---------------
763 ---------------
764
764
765 Predecessors template should show current revision as it is the working copy
765 Predecessors template should show current revision as it is the working copy
766 $ hg tlog
766 $ hg tlog
767 o 7a230b46bf61
767 o 7a230b46bf61
768 | Predecessors: 471f378eab4c
768 | Predecessors: 471f378eab4c
769 | semi-colon: 471f378eab4c
769 | semi-colon: 471f378eab4c
770 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
770 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
771 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
771 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
772 | @ 471f378eab4c
772 | @ 471f378eab4c
773 |/
773 |/
774 o ea207398892e
774 o ea207398892e
775
775
776 $ hg up 'desc(A2)'
776 $ hg up 'desc(A2)'
777 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
777 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
778
778
779 Predecessors template should show no predecessors as they are non visible
779 Predecessors template should show no predecessors as they are non visible
780 $ hg tlog
780 $ hg tlog
781 @ 7a230b46bf61
781 @ 7a230b46bf61
782 |
782 |
783 o ea207398892e
783 o ea207398892e
784
784
785 Predecessors template should show all predecessors as we force their display
785 Predecessors template should show all predecessors as we force their display
786 with --hidden
786 with --hidden
787 $ hg tlog --hidden
787 $ hg tlog --hidden
788 @ 7a230b46bf61
788 @ 7a230b46bf61
789 | Predecessors: 471f378eab4c
789 | Predecessors: 471f378eab4c
790 | semi-colon: 471f378eab4c
790 | semi-colon: 471f378eab4c
791 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
791 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
792 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
792 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
793 | x 471f378eab4c
793 | x 471f378eab4c
794 |/
794 |/
795 o ea207398892e
795 o ea207398892e
796
796
797
797
798 Test template with obsmarkers cycle
798 Test template with obsmarkers cycle
799 ===================================
799 ===================================
800
800
801 Test setup
801 Test setup
802 ----------
802 ----------
803
803
804 $ hg init $TESTTMP/templates-local-cycle
804 $ hg init $TESTTMP/templates-local-cycle
805 $ cd $TESTTMP/templates-local-cycle
805 $ cd $TESTTMP/templates-local-cycle
806 $ mkcommit ROOT
806 $ mkcommit ROOT
807 $ mkcommit A0
807 $ mkcommit A0
808 $ mkcommit B0
808 $ mkcommit B0
809 $ hg up -r 0
809 $ hg up -r 0
810 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
810 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
811 $ mkcommit C0
811 $ mkcommit C0
812 created new head
812 created new head
813
813
814 Create the cycle
814 Create the cycle
815
815
816 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
816 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
817 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
817 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
818 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
818 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
819
819
820 Check templates
820 Check templates
821 ---------------
821 ---------------
822
822
823 $ hg tlog
823 $ hg tlog
824 @ f897c6137566
824 @ f897c6137566
825 |
825 |
826 o ea207398892e
826 o ea207398892e
827
827
828
828
829 $ hg up -r "desc(B0)" --hidden
829 $ hg up -r "desc(B0)" --hidden
830 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
830 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
831 $ hg tlog
831 $ hg tlog
832 o f897c6137566
832 o f897c6137566
833 | Predecessors: 0dec01379d3b
833 | Predecessors: 0dec01379d3b
834 | semi-colon: 0dec01379d3b
834 | semi-colon: 0dec01379d3b
835 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
835 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
836 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
836 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
837 | @ 0dec01379d3b
837 | @ 0dec01379d3b
838 | | Predecessors: 471f378eab4c
838 | | Predecessors: 471f378eab4c
839 | | semi-colon: 471f378eab4c
839 | | semi-colon: 471f378eab4c
840 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
840 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
841 | | map: 471f378eab4c5e25f6c77f785b27c936efb22874
841 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
842 | x 471f378eab4c
842 | x 471f378eab4c
843 |/ Predecessors: 0dec01379d3b
843 |/ Predecessors: 0dec01379d3b
844 | semi-colon: 0dec01379d3b
844 | semi-colon: 0dec01379d3b
845 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
845 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
846 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
846 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
847 o ea207398892e
847 o ea207398892e
848
848
849
849
850 $ hg up -r "desc(A0)" --hidden
850 $ hg up -r "desc(A0)" --hidden
851 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
851 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
852 $ hg tlog
852 $ hg tlog
853 o f897c6137566
853 o f897c6137566
854 | Predecessors: 471f378eab4c
854 | Predecessors: 471f378eab4c
855 | semi-colon: 471f378eab4c
855 | semi-colon: 471f378eab4c
856 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
856 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
857 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
857 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
858 | @ 471f378eab4c
858 | @ 471f378eab4c
859 |/
859 |/
860 o ea207398892e
860 o ea207398892e
861
861
862
862
863 $ hg up -r "desc(ROOT)" --hidden
863 $ hg up -r "desc(ROOT)" --hidden
864 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
864 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
865 $ hg tlog
865 $ hg tlog
866 o f897c6137566
866 o f897c6137566
867 |
867 |
868 @ ea207398892e
868 @ ea207398892e
869
869
870
870
871 $ hg tlog --hidden
871 $ hg tlog --hidden
872 o f897c6137566
872 o f897c6137566
873 | Predecessors: 0dec01379d3b
873 | Predecessors: 0dec01379d3b
874 | semi-colon: 0dec01379d3b
874 | semi-colon: 0dec01379d3b
875 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
875 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
876 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
876 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
877 | x 0dec01379d3b
877 | x 0dec01379d3b
878 | | Predecessors: 471f378eab4c
878 | | Predecessors: 471f378eab4c
879 | | semi-colon: 471f378eab4c
879 | | semi-colon: 471f378eab4c
880 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
880 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
881 | | map: 471f378eab4c5e25f6c77f785b27c936efb22874
881 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
882 | x 471f378eab4c
882 | x 471f378eab4c
883 |/ Predecessors: 0dec01379d3b
883 |/ Predecessors: 0dec01379d3b
884 | semi-colon: 0dec01379d3b
884 | semi-colon: 0dec01379d3b
885 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
885 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
886 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
886 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
887 @ ea207398892e
887 @ ea207398892e
888
888
General Comments 0
You need to be logged in to leave comments. Login now