##// END OF EJS Templates
templatekw: reference predecessor node id as {node} in map operation...
Yuya Nishihara -
r32909:89610c58 default
parent child Browse files
Show More
@@ -1,687 +1,687 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: {'predecessor': x},
571 return _hybrid(None, predecessors, lambda x: {'node': x},
572 lambda d: d['predecessor'][:12])
572 lambda d: d['node'][:12])
573
573
574 @templatekeyword('p1rev')
574 @templatekeyword('p1rev')
575 def showp1rev(repo, ctx, templ, **args):
575 def showp1rev(repo, ctx, templ, **args):
576 """Integer. The repository-local revision number of the changeset's
576 """Integer. The repository-local revision number of the changeset's
577 first parent, or -1 if the changeset has no parents."""
577 first parent, or -1 if the changeset has no parents."""
578 return ctx.p1().rev()
578 return ctx.p1().rev()
579
579
580 @templatekeyword('p2rev')
580 @templatekeyword('p2rev')
581 def showp2rev(repo, ctx, templ, **args):
581 def showp2rev(repo, ctx, templ, **args):
582 """Integer. The repository-local revision number of the changeset's
582 """Integer. The repository-local revision number of the changeset's
583 second parent, or -1 if the changeset has no second parent."""
583 second parent, or -1 if the changeset has no second parent."""
584 return ctx.p2().rev()
584 return ctx.p2().rev()
585
585
586 @templatekeyword('p1node')
586 @templatekeyword('p1node')
587 def showp1node(repo, ctx, templ, **args):
587 def showp1node(repo, ctx, templ, **args):
588 """String. The identification hash of the changeset's first parent,
588 """String. The identification hash of the changeset's first parent,
589 as a 40 digit hexadecimal string. If the changeset has no parents, all
589 as a 40 digit hexadecimal string. If the changeset has no parents, all
590 digits are 0."""
590 digits are 0."""
591 return ctx.p1().hex()
591 return ctx.p1().hex()
592
592
593 @templatekeyword('p2node')
593 @templatekeyword('p2node')
594 def showp2node(repo, ctx, templ, **args):
594 def showp2node(repo, ctx, templ, **args):
595 """String. The identification hash of the changeset's second
595 """String. The identification hash of the changeset's second
596 parent, as a 40 digit hexadecimal string. If the changeset has no second
596 parent, as a 40 digit hexadecimal string. If the changeset has no second
597 parent, all digits are 0."""
597 parent, all digits are 0."""
598 return ctx.p2().hex()
598 return ctx.p2().hex()
599
599
600 @templatekeyword('parents')
600 @templatekeyword('parents')
601 def showparents(**args):
601 def showparents(**args):
602 """List of strings. The parents of the changeset in "rev:node"
602 """List of strings. The parents of the changeset in "rev:node"
603 format. If the changeset has only one "natural" parent (the predecessor
603 format. If the changeset has only one "natural" parent (the predecessor
604 revision) nothing is shown."""
604 revision) nothing is shown."""
605 repo = args['repo']
605 repo = args['repo']
606 ctx = args['ctx']
606 ctx = args['ctx']
607 pctxs = scmutil.meaningfulparents(repo, ctx)
607 pctxs = scmutil.meaningfulparents(repo, ctx)
608 prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str
608 prevs = [str(p.rev()) for p in pctxs] # ifcontains() needs a list of str
609 parents = [[('rev', p.rev()),
609 parents = [[('rev', p.rev()),
610 ('node', p.hex()),
610 ('node', p.hex()),
611 ('phase', p.phasestr())]
611 ('phase', p.phasestr())]
612 for p in pctxs]
612 for p in pctxs]
613 f = _showlist('parent', parents, args)
613 f = _showlist('parent', parents, args)
614 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
614 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
615 lambda d: _formatrevnode(d['ctx']))
615 lambda d: _formatrevnode(d['ctx']))
616
616
617 @templatekeyword('phase')
617 @templatekeyword('phase')
618 def showphase(repo, ctx, templ, **args):
618 def showphase(repo, ctx, templ, **args):
619 """String. The changeset phase name."""
619 """String. The changeset phase name."""
620 return ctx.phasestr()
620 return ctx.phasestr()
621
621
622 @templatekeyword('phaseidx')
622 @templatekeyword('phaseidx')
623 def showphaseidx(repo, ctx, templ, **args):
623 def showphaseidx(repo, ctx, templ, **args):
624 """Integer. The changeset phase index."""
624 """Integer. The changeset phase index."""
625 return ctx.phase()
625 return ctx.phase()
626
626
627 @templatekeyword('rev')
627 @templatekeyword('rev')
628 def showrev(repo, ctx, templ, **args):
628 def showrev(repo, ctx, templ, **args):
629 """Integer. The repository-local changeset revision number."""
629 """Integer. The repository-local changeset revision number."""
630 return scmutil.intrev(ctx)
630 return scmutil.intrev(ctx)
631
631
632 def showrevslist(name, revs, **args):
632 def showrevslist(name, revs, **args):
633 """helper to generate a list of revisions in which a mapped template will
633 """helper to generate a list of revisions in which a mapped template will
634 be evaluated"""
634 be evaluated"""
635 repo = args['ctx'].repo()
635 repo = args['ctx'].repo()
636 revs = [str(r) for r in revs] # ifcontains() needs a list of str
636 revs = [str(r) for r in revs] # ifcontains() needs a list of str
637 f = _showlist(name, revs, args)
637 f = _showlist(name, revs, args)
638 return _hybrid(f, revs,
638 return _hybrid(f, revs,
639 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
639 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
640 lambda d: d[name])
640 lambda d: d[name])
641
641
642 @templatekeyword('subrepos')
642 @templatekeyword('subrepos')
643 def showsubrepos(**args):
643 def showsubrepos(**args):
644 """List of strings. Updated subrepositories in the changeset."""
644 """List of strings. Updated subrepositories in the changeset."""
645 ctx = args['ctx']
645 ctx = args['ctx']
646 substate = ctx.substate
646 substate = ctx.substate
647 if not substate:
647 if not substate:
648 return showlist('subrepo', [], args)
648 return showlist('subrepo', [], args)
649 psubstate = ctx.parents()[0].substate or {}
649 psubstate = ctx.parents()[0].substate or {}
650 subrepos = []
650 subrepos = []
651 for sub in substate:
651 for sub in substate:
652 if sub not in psubstate or substate[sub] != psubstate[sub]:
652 if sub not in psubstate or substate[sub] != psubstate[sub]:
653 subrepos.append(sub) # modified or newly added in ctx
653 subrepos.append(sub) # modified or newly added in ctx
654 for sub in psubstate:
654 for sub in psubstate:
655 if sub not in substate:
655 if sub not in substate:
656 subrepos.append(sub) # removed in ctx
656 subrepos.append(sub) # removed in ctx
657 return showlist('subrepo', sorted(subrepos), args)
657 return showlist('subrepo', sorted(subrepos), args)
658
658
659 # don't remove "showtags" definition, even though namespaces will put
659 # don't remove "showtags" definition, even though namespaces will put
660 # a helper function for "tags" keyword into "keywords" map automatically,
660 # a helper function for "tags" keyword into "keywords" map automatically,
661 # because online help text is built without namespaces initialization
661 # because online help text is built without namespaces initialization
662 @templatekeyword('tags')
662 @templatekeyword('tags')
663 def showtags(**args):
663 def showtags(**args):
664 """List of strings. Any tags associated with the changeset."""
664 """List of strings. Any tags associated with the changeset."""
665 return shownames('tags', **args)
665 return shownames('tags', **args)
666
666
667 def loadkeyword(ui, extname, registrarobj):
667 def loadkeyword(ui, extname, registrarobj):
668 """Load template keyword from specified registrarobj
668 """Load template keyword from specified registrarobj
669 """
669 """
670 for name, func in registrarobj._table.iteritems():
670 for name, func in registrarobj._table.iteritems():
671 keywords[name] = func
671 keywords[name] = func
672
672
673 @templatekeyword('termwidth')
673 @templatekeyword('termwidth')
674 def termwidth(repo, ctx, templ, **args):
674 def termwidth(repo, ctx, templ, **args):
675 """Integer. The width of the current terminal."""
675 """Integer. The width of the current terminal."""
676 return repo.ui.termwidth()
676 return repo.ui.termwidth()
677
677
678 @templatekeyword('troubles')
678 @templatekeyword('troubles')
679 def showtroubles(**args):
679 def showtroubles(**args):
680 """List of strings. Evolution troubles affecting the changeset.
680 """List of strings. Evolution troubles affecting the changeset.
681
681
682 (EXPERIMENTAL)
682 (EXPERIMENTAL)
683 """
683 """
684 return showlist('trouble', args['ctx'].troubles(), args)
684 return showlist('trouble', args['ctx'].troubles(), args)
685
685
686 # tell hggettext to extract docstrings from these functions:
686 # tell hggettext to extract docstrings from these functions:
687 i18nfunctions = keywords.values()
687 i18nfunctions = keywords.values()
@@ -1,855 +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}")}\n'
18 > {if(predecessors, "\n json: {predecessors|json}")}\
19 > {if(predecessors, "\n map: {join(predecessors % "{node}", " ")}")}\n'
19 > EOF
20 > EOF
20
21
21 Test templates on amended commit
22 Test templates on amended commit
22 ================================
23 ================================
23
24
24 Test setup
25 Test setup
25 ----------
26 ----------
26
27
27 $ hg init $TESTTMP/templates-local-amend
28 $ hg init $TESTTMP/templates-local-amend
28 $ cd $TESTTMP/templates-local-amend
29 $ cd $TESTTMP/templates-local-amend
29 $ mkcommit ROOT
30 $ mkcommit ROOT
30 $ mkcommit A0
31 $ mkcommit A0
31 $ echo 42 >> A0
32 $ echo 42 >> A0
32 $ hg commit --amend -m "A1"
33 $ hg commit --amend -m "A1"
33 $ hg commit --amend -m "A2"
34 $ hg commit --amend -m "A2"
34
35
35 $ hg log --hidden -G
36 $ hg log --hidden -G
36 @ changeset: 4:d004c8f274b9
37 @ changeset: 4:d004c8f274b9
37 | tag: tip
38 | tag: tip
38 | parent: 0:ea207398892e
39 | parent: 0:ea207398892e
39 | user: test
40 | user: test
40 | date: Thu Jan 01 00:00:00 1970 +0000
41 | date: Thu Jan 01 00:00:00 1970 +0000
41 | summary: A2
42 | summary: A2
42 |
43 |
43 | x changeset: 3:a468dc9b3633
44 | x changeset: 3:a468dc9b3633
44 |/ parent: 0:ea207398892e
45 |/ parent: 0:ea207398892e
45 | user: test
46 | user: test
46 | date: Thu Jan 01 00:00:00 1970 +0000
47 | date: Thu Jan 01 00:00:00 1970 +0000
47 | summary: A1
48 | summary: A1
48 |
49 |
49 | x changeset: 2:f137d23bb3e1
50 | x changeset: 2:f137d23bb3e1
50 | | user: test
51 | | user: test
51 | | date: Thu Jan 01 00:00:00 1970 +0000
52 | | date: Thu Jan 01 00:00:00 1970 +0000
52 | | summary: temporary amend commit for 471f378eab4c
53 | | summary: temporary amend commit for 471f378eab4c
53 | |
54 | |
54 | x changeset: 1:471f378eab4c
55 | x changeset: 1:471f378eab4c
55 |/ user: test
56 |/ user: test
56 | date: Thu Jan 01 00:00:00 1970 +0000
57 | date: Thu Jan 01 00:00:00 1970 +0000
57 | summary: A0
58 | summary: A0
58 |
59 |
59 o changeset: 0:ea207398892e
60 o changeset: 0:ea207398892e
60 user: test
61 user: test
61 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
62 summary: ROOT
63 summary: ROOT
63
64
64 Check templates
65 Check templates
65 ---------------
66 ---------------
66 $ hg up 'desc(A0)' --hidden
67 $ hg up 'desc(A0)' --hidden
67 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
68
69
69 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
70 $ hg tlog
71 $ hg tlog
71 o d004c8f274b9
72 o d004c8f274b9
72 | Predecessors: 471f378eab4c
73 | Predecessors: 471f378eab4c
73 | semi-colon: 471f378eab4c
74 | semi-colon: 471f378eab4c
74 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
75 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
76 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
75 | @ 471f378eab4c
77 | @ 471f378eab4c
76 |/
78 |/
77 o ea207398892e
79 o ea207398892e
78
80
79 $ hg up 'desc(A1)' --hidden
81 $ hg up 'desc(A1)' --hidden
80 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
81
83
82 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
83 $ hg tlog
85 $ hg tlog
84 o d004c8f274b9
86 o d004c8f274b9
85 | Predecessors: a468dc9b3633
87 | Predecessors: a468dc9b3633
86 | semi-colon: a468dc9b3633
88 | semi-colon: a468dc9b3633
87 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
89 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
90 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
88 | @ a468dc9b3633
91 | @ a468dc9b3633
89 |/
92 |/
90 o ea207398892e
93 o ea207398892e
91
94
92 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
93 with --hidden
96 with --hidden
94 $ hg tlog --hidden
97 $ hg tlog --hidden
95 o d004c8f274b9
98 o d004c8f274b9
96 | Predecessors: a468dc9b3633
99 | Predecessors: a468dc9b3633
97 | semi-colon: a468dc9b3633
100 | semi-colon: a468dc9b3633
98 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
101 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
102 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
99 | @ a468dc9b3633
103 | @ a468dc9b3633
100 |/ Predecessors: 471f378eab4c
104 |/ Predecessors: 471f378eab4c
101 | semi-colon: 471f378eab4c
105 | semi-colon: 471f378eab4c
102 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
106 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
107 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
103 | x f137d23bb3e1
108 | x f137d23bb3e1
104 | |
109 | |
105 | x 471f378eab4c
110 | x 471f378eab4c
106 |/
111 |/
107 o ea207398892e
112 o ea207398892e
108
113
109
114
110 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
111 visible.
116 visible.
112 $ hg up 'desc(A2)'
117 $ hg up 'desc(A2)'
113 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
114 $ hg tlog
119 $ hg tlog
115 @ d004c8f274b9
120 @ d004c8f274b9
116 |
121 |
117 o ea207398892e
122 o ea207398892e
118
123
119 $ hg tlog --hidden
124 $ hg tlog --hidden
120 @ d004c8f274b9
125 @ d004c8f274b9
121 | Predecessors: a468dc9b3633
126 | Predecessors: a468dc9b3633
122 | semi-colon: a468dc9b3633
127 | semi-colon: a468dc9b3633
123 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
128 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
129 | map: a468dc9b36338b14fdb7825f55ce3df4e71517ad
124 | x a468dc9b3633
130 | x a468dc9b3633
125 |/ Predecessors: 471f378eab4c
131 |/ Predecessors: 471f378eab4c
126 | semi-colon: 471f378eab4c
132 | semi-colon: 471f378eab4c
127 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
133 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
134 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
128 | x f137d23bb3e1
135 | x f137d23bb3e1
129 | |
136 | |
130 | x 471f378eab4c
137 | x 471f378eab4c
131 |/
138 |/
132 o ea207398892e
139 o ea207398892e
133
140
134
141
135 Test templates with splitted commit
142 Test templates with splitted commit
136 ===================================
143 ===================================
137
144
138 $ hg init $TESTTMP/templates-local-split
145 $ hg init $TESTTMP/templates-local-split
139 $ cd $TESTTMP/templates-local-split
146 $ cd $TESTTMP/templates-local-split
140 $ mkcommit ROOT
147 $ mkcommit ROOT
141 $ echo 42 >> a
148 $ echo 42 >> a
142 $ echo 43 >> b
149 $ echo 43 >> b
143 $ hg commit -A -m "A0"
150 $ hg commit -A -m "A0"
144 adding a
151 adding a
145 adding b
152 adding b
146 $ hg log --hidden -G
153 $ hg log --hidden -G
147 @ changeset: 1:471597cad322
154 @ changeset: 1:471597cad322
148 | tag: tip
155 | tag: tip
149 | user: test
156 | user: test
150 | date: Thu Jan 01 00:00:00 1970 +0000
157 | date: Thu Jan 01 00:00:00 1970 +0000
151 | summary: A0
158 | summary: A0
152 |
159 |
153 o changeset: 0:ea207398892e
160 o changeset: 0:ea207398892e
154 user: test
161 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: ROOT
163 summary: ROOT
157
164
158 # Simulate split
165 # Simulate split
159 $ hg up -r "desc(ROOT)"
166 $ hg up -r "desc(ROOT)"
160 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
161 $ echo 42 >> a
168 $ echo 42 >> a
162 $ hg commit -A -m "A0"
169 $ hg commit -A -m "A0"
163 adding a
170 adding a
164 created new head
171 created new head
165 $ echo 43 >> b
172 $ echo 43 >> b
166 $ hg commit -A -m "A0"
173 $ hg commit -A -m "A0"
167 adding b
174 adding b
168 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
175 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
169
176
170 $ hg log --hidden -G
177 $ hg log --hidden -G
171 @ changeset: 3:f257fde29c7a
178 @ changeset: 3:f257fde29c7a
172 | tag: tip
179 | tag: tip
173 | user: test
180 | user: test
174 | date: Thu Jan 01 00:00:00 1970 +0000
181 | date: Thu Jan 01 00:00:00 1970 +0000
175 | summary: A0
182 | summary: A0
176 |
183 |
177 o changeset: 2:337fec4d2edc
184 o changeset: 2:337fec4d2edc
178 | parent: 0:ea207398892e
185 | parent: 0:ea207398892e
179 | user: test
186 | user: test
180 | date: Thu Jan 01 00:00:00 1970 +0000
187 | date: Thu Jan 01 00:00:00 1970 +0000
181 | summary: A0
188 | summary: A0
182 |
189 |
183 | x changeset: 1:471597cad322
190 | x changeset: 1:471597cad322
184 |/ user: test
191 |/ user: test
185 | date: Thu Jan 01 00:00:00 1970 +0000
192 | date: Thu Jan 01 00:00:00 1970 +0000
186 | summary: A0
193 | summary: A0
187 |
194 |
188 o changeset: 0:ea207398892e
195 o changeset: 0:ea207398892e
189 user: test
196 user: test
190 date: Thu Jan 01 00:00:00 1970 +0000
197 date: Thu Jan 01 00:00:00 1970 +0000
191 summary: ROOT
198 summary: ROOT
192
199
193 Check templates
200 Check templates
194 ---------------
201 ---------------
195
202
196 $ hg up 'obsolete()' --hidden
203 $ hg up 'obsolete()' --hidden
197 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
198
205
199 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
200 $ hg tlog
207 $ hg tlog
201 o f257fde29c7a
208 o f257fde29c7a
202 | Predecessors: 471597cad322
209 | Predecessors: 471597cad322
203 | semi-colon: 471597cad322
210 | semi-colon: 471597cad322
204 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
211 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
212 | map: 471597cad322d1f659bb169751be9133dad92ef3
205 o 337fec4d2edc
213 o 337fec4d2edc
206 | Predecessors: 471597cad322
214 | Predecessors: 471597cad322
207 | semi-colon: 471597cad322
215 | semi-colon: 471597cad322
208 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
216 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
217 | map: 471597cad322d1f659bb169751be9133dad92ef3
209 | @ 471597cad322
218 | @ 471597cad322
210 |/
219 |/
211 o ea207398892e
220 o ea207398892e
212
221
213 $ hg up f257fde29c7a
222 $ hg up f257fde29c7a
214 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
215
224
216 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
217 the log
226 the log
218 $ hg tlog
227 $ hg tlog
219 @ f257fde29c7a
228 @ f257fde29c7a
220 |
229 |
221 o 337fec4d2edc
230 o 337fec4d2edc
222 |
231 |
223 o ea207398892e
232 o ea207398892e
224
233
225 Predecessors template should show both predecessors as we force their display
234 Predecessors template should show both predecessors as we force their display
226 with --hidden
235 with --hidden
227 $ hg tlog --hidden
236 $ hg tlog --hidden
228 @ f257fde29c7a
237 @ f257fde29c7a
229 | Predecessors: 471597cad322
238 | Predecessors: 471597cad322
230 | semi-colon: 471597cad322
239 | semi-colon: 471597cad322
231 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
240 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
241 | map: 471597cad322d1f659bb169751be9133dad92ef3
232 o 337fec4d2edc
242 o 337fec4d2edc
233 | Predecessors: 471597cad322
243 | Predecessors: 471597cad322
234 | semi-colon: 471597cad322
244 | semi-colon: 471597cad322
235 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
245 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
246 | map: 471597cad322d1f659bb169751be9133dad92ef3
236 | x 471597cad322
247 | x 471597cad322
237 |/
248 |/
238 o ea207398892e
249 o ea207398892e
239
250
240 Test templates with folded commit
251 Test templates with folded commit
241 =================================
252 =================================
242
253
243 Test setup
254 Test setup
244 ----------
255 ----------
245
256
246 $ hg init $TESTTMP/templates-local-fold
257 $ hg init $TESTTMP/templates-local-fold
247 $ cd $TESTTMP/templates-local-fold
258 $ cd $TESTTMP/templates-local-fold
248 $ mkcommit ROOT
259 $ mkcommit ROOT
249 $ mkcommit A0
260 $ mkcommit A0
250 $ mkcommit B0
261 $ mkcommit B0
251 $ hg log --hidden -G
262 $ hg log --hidden -G
252 @ changeset: 2:0dec01379d3b
263 @ changeset: 2:0dec01379d3b
253 | tag: tip
264 | tag: tip
254 | user: test
265 | user: test
255 | date: Thu Jan 01 00:00:00 1970 +0000
266 | date: Thu Jan 01 00:00:00 1970 +0000
256 | summary: B0
267 | summary: B0
257 |
268 |
258 o changeset: 1:471f378eab4c
269 o changeset: 1:471f378eab4c
259 | user: test
270 | user: test
260 | date: Thu Jan 01 00:00:00 1970 +0000
271 | date: Thu Jan 01 00:00:00 1970 +0000
261 | summary: A0
272 | summary: A0
262 |
273 |
263 o changeset: 0:ea207398892e
274 o changeset: 0:ea207398892e
264 user: test
275 user: test
265 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
266 summary: ROOT
277 summary: ROOT
267
278
268 Simulate a fold
279 Simulate a fold
269 $ hg up -r "desc(ROOT)"
280 $ hg up -r "desc(ROOT)"
270 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
271 $ echo "A0" > A0
282 $ echo "A0" > A0
272 $ echo "B0" > B0
283 $ echo "B0" > B0
273 $ hg commit -A -m "C0"
284 $ hg commit -A -m "C0"
274 adding A0
285 adding A0
275 adding B0
286 adding B0
276 created new head
287 created new head
277 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
288 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
278 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
289 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
279
290
280 $ hg log --hidden -G
291 $ hg log --hidden -G
281 @ changeset: 3:eb5a0daa2192
292 @ changeset: 3:eb5a0daa2192
282 | tag: tip
293 | tag: tip
283 | parent: 0:ea207398892e
294 | parent: 0:ea207398892e
284 | user: test
295 | user: test
285 | date: Thu Jan 01 00:00:00 1970 +0000
296 | date: Thu Jan 01 00:00:00 1970 +0000
286 | summary: C0
297 | summary: C0
287 |
298 |
288 | x changeset: 2:0dec01379d3b
299 | x changeset: 2:0dec01379d3b
289 | | user: test
300 | | user: test
290 | | date: Thu Jan 01 00:00:00 1970 +0000
301 | | date: Thu Jan 01 00:00:00 1970 +0000
291 | | summary: B0
302 | | summary: B0
292 | |
303 | |
293 | x changeset: 1:471f378eab4c
304 | x changeset: 1:471f378eab4c
294 |/ user: test
305 |/ user: test
295 | date: Thu Jan 01 00:00:00 1970 +0000
306 | date: Thu Jan 01 00:00:00 1970 +0000
296 | summary: A0
307 | summary: A0
297 |
308 |
298 o changeset: 0:ea207398892e
309 o changeset: 0:ea207398892e
299 user: test
310 user: test
300 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
301 summary: ROOT
312 summary: ROOT
302
313
303 Check templates
314 Check templates
304 ---------------
315 ---------------
305
316
306 $ hg up 'desc(A0)' --hidden
317 $ hg up 'desc(A0)' --hidden
307 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
308
319
309 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
310 $ hg tlog
321 $ hg tlog
311 o eb5a0daa2192
322 o eb5a0daa2192
312 | Predecessors: 471f378eab4c
323 | Predecessors: 471f378eab4c
313 | semi-colon: 471f378eab4c
324 | semi-colon: 471f378eab4c
314 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
325 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
326 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
315 | @ 471f378eab4c
327 | @ 471f378eab4c
316 |/
328 |/
317 o ea207398892e
329 o ea207398892e
318
330
319 $ hg up 'desc(B0)' --hidden
331 $ hg up 'desc(B0)' --hidden
320 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
321
333
322 Predecessors template should show both predecessors as they should be both
334 Predecessors template should show both predecessors as they should be both
323 displayed
335 displayed
324 $ hg tlog
336 $ hg tlog
325 o eb5a0daa2192
337 o eb5a0daa2192
326 | Predecessors: 0dec01379d3b 471f378eab4c
338 | Predecessors: 0dec01379d3b 471f378eab4c
327 | semi-colon: 0dec01379d3b; 471f378eab4c
339 | semi-colon: 0dec01379d3b; 471f378eab4c
328 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
340 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
341 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
329 | @ 0dec01379d3b
342 | @ 0dec01379d3b
330 | |
343 | |
331 | x 471f378eab4c
344 | x 471f378eab4c
332 |/
345 |/
333 o ea207398892e
346 o ea207398892e
334
347
335 $ hg up 'desc(C0)'
348 $ hg up 'desc(C0)'
336 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
337
350
338 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
339 the log
352 the log
340 $ hg tlog
353 $ hg tlog
341 @ eb5a0daa2192
354 @ eb5a0daa2192
342 |
355 |
343 o ea207398892e
356 o ea207398892e
344
357
345 Predecessors template should show both predecessors as we force their display
358 Predecessors template should show both predecessors as we force their display
346 with --hidden
359 with --hidden
347 $ hg tlog --hidden
360 $ hg tlog --hidden
348 @ eb5a0daa2192
361 @ eb5a0daa2192
349 | Predecessors: 0dec01379d3b 471f378eab4c
362 | Predecessors: 0dec01379d3b 471f378eab4c
350 | semi-colon: 0dec01379d3b; 471f378eab4c
363 | semi-colon: 0dec01379d3b; 471f378eab4c
351 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
364 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
365 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
352 | x 0dec01379d3b
366 | x 0dec01379d3b
353 | |
367 | |
354 | x 471f378eab4c
368 | x 471f378eab4c
355 |/
369 |/
356 o ea207398892e
370 o ea207398892e
357
371
358
372
359 Test templates with divergence
373 Test templates with divergence
360 ==============================
374 ==============================
361
375
362 Test setup
376 Test setup
363 ----------
377 ----------
364
378
365 $ hg init $TESTTMP/templates-local-divergence
379 $ hg init $TESTTMP/templates-local-divergence
366 $ cd $TESTTMP/templates-local-divergence
380 $ cd $TESTTMP/templates-local-divergence
367 $ mkcommit ROOT
381 $ mkcommit ROOT
368 $ mkcommit A0
382 $ mkcommit A0
369 $ hg commit --amend -m "A1"
383 $ hg commit --amend -m "A1"
370 $ hg log --hidden -G
384 $ hg log --hidden -G
371 @ changeset: 2:fdf9bde5129a
385 @ changeset: 2:fdf9bde5129a
372 | tag: tip
386 | tag: tip
373 | parent: 0:ea207398892e
387 | parent: 0:ea207398892e
374 | user: test
388 | user: test
375 | date: Thu Jan 01 00:00:00 1970 +0000
389 | date: Thu Jan 01 00:00:00 1970 +0000
376 | summary: A1
390 | summary: A1
377 |
391 |
378 | x changeset: 1:471f378eab4c
392 | x changeset: 1:471f378eab4c
379 |/ user: test
393 |/ user: test
380 | date: Thu Jan 01 00:00:00 1970 +0000
394 | date: Thu Jan 01 00:00:00 1970 +0000
381 | summary: A0
395 | summary: A0
382 |
396 |
383 o changeset: 0:ea207398892e
397 o changeset: 0:ea207398892e
384 user: test
398 user: test
385 date: Thu Jan 01 00:00:00 1970 +0000
399 date: Thu Jan 01 00:00:00 1970 +0000
386 summary: ROOT
400 summary: ROOT
387
401
388 $ hg update --hidden 'desc(A0)'
402 $ hg update --hidden 'desc(A0)'
389 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
390 $ hg commit --amend -m "A2"
404 $ hg commit --amend -m "A2"
391 $ hg log --hidden -G
405 $ hg log --hidden -G
392 @ changeset: 3:65b757b745b9
406 @ changeset: 3:65b757b745b9
393 | tag: tip
407 | tag: tip
394 | parent: 0:ea207398892e
408 | parent: 0:ea207398892e
395 | user: test
409 | user: test
396 | date: Thu Jan 01 00:00:00 1970 +0000
410 | date: Thu Jan 01 00:00:00 1970 +0000
397 | trouble: divergent
411 | trouble: divergent
398 | summary: A2
412 | summary: A2
399 |
413 |
400 | o changeset: 2:fdf9bde5129a
414 | o changeset: 2:fdf9bde5129a
401 |/ parent: 0:ea207398892e
415 |/ parent: 0:ea207398892e
402 | user: test
416 | user: test
403 | date: Thu Jan 01 00:00:00 1970 +0000
417 | date: Thu Jan 01 00:00:00 1970 +0000
404 | trouble: divergent
418 | trouble: divergent
405 | summary: A1
419 | summary: A1
406 |
420 |
407 | x changeset: 1:471f378eab4c
421 | x changeset: 1:471f378eab4c
408 |/ user: test
422 |/ user: test
409 | date: Thu Jan 01 00:00:00 1970 +0000
423 | date: Thu Jan 01 00:00:00 1970 +0000
410 | summary: A0
424 | summary: A0
411 |
425 |
412 o changeset: 0:ea207398892e
426 o changeset: 0:ea207398892e
413 user: test
427 user: test
414 date: Thu Jan 01 00:00:00 1970 +0000
428 date: Thu Jan 01 00:00:00 1970 +0000
415 summary: ROOT
429 summary: ROOT
416
430
417 $ hg commit --amend -m 'A3'
431 $ hg commit --amend -m 'A3'
418 $ hg log --hidden -G
432 $ hg log --hidden -G
419 @ changeset: 4:019fadeab383
433 @ changeset: 4:019fadeab383
420 | tag: tip
434 | tag: tip
421 | parent: 0:ea207398892e
435 | parent: 0:ea207398892e
422 | user: test
436 | user: test
423 | date: Thu Jan 01 00:00:00 1970 +0000
437 | date: Thu Jan 01 00:00:00 1970 +0000
424 | trouble: divergent
438 | trouble: divergent
425 | summary: A3
439 | summary: A3
426 |
440 |
427 | x changeset: 3:65b757b745b9
441 | x changeset: 3:65b757b745b9
428 |/ parent: 0:ea207398892e
442 |/ parent: 0:ea207398892e
429 | user: test
443 | user: test
430 | date: Thu Jan 01 00:00:00 1970 +0000
444 | date: Thu Jan 01 00:00:00 1970 +0000
431 | summary: A2
445 | summary: A2
432 |
446 |
433 | o changeset: 2:fdf9bde5129a
447 | o changeset: 2:fdf9bde5129a
434 |/ parent: 0:ea207398892e
448 |/ parent: 0:ea207398892e
435 | user: test
449 | user: test
436 | date: Thu Jan 01 00:00:00 1970 +0000
450 | date: Thu Jan 01 00:00:00 1970 +0000
437 | trouble: divergent
451 | trouble: divergent
438 | summary: A1
452 | summary: A1
439 |
453 |
440 | x changeset: 1:471f378eab4c
454 | x changeset: 1:471f378eab4c
441 |/ user: test
455 |/ user: test
442 | date: Thu Jan 01 00:00:00 1970 +0000
456 | date: Thu Jan 01 00:00:00 1970 +0000
443 | summary: A0
457 | summary: A0
444 |
458 |
445 o changeset: 0:ea207398892e
459 o changeset: 0:ea207398892e
446 user: test
460 user: test
447 date: Thu Jan 01 00:00:00 1970 +0000
461 date: Thu Jan 01 00:00:00 1970 +0000
448 summary: ROOT
462 summary: ROOT
449
463
450
464
451 Check templates
465 Check templates
452 ---------------
466 ---------------
453
467
454 $ hg up 'desc(A0)' --hidden
468 $ hg up 'desc(A0)' --hidden
455 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
456
470
457 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
458 $ hg tlog
472 $ hg tlog
459 o 019fadeab383
473 o 019fadeab383
460 | Predecessors: 471f378eab4c
474 | Predecessors: 471f378eab4c
461 | semi-colon: 471f378eab4c
475 | semi-colon: 471f378eab4c
462 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
476 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
477 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
463 | o fdf9bde5129a
478 | o fdf9bde5129a
464 |/ Predecessors: 471f378eab4c
479 |/ Predecessors: 471f378eab4c
465 | semi-colon: 471f378eab4c
480 | semi-colon: 471f378eab4c
466 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
481 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
482 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
467 | @ 471f378eab4c
483 | @ 471f378eab4c
468 |/
484 |/
469 o ea207398892e
485 o ea207398892e
470
486
471 $ hg up 'desc(A1)'
487 $ hg up 'desc(A1)'
472 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
473
489
474 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
475 the log
491 the log
476 $ hg tlog
492 $ hg tlog
477 o 019fadeab383
493 o 019fadeab383
478 |
494 |
479 | @ fdf9bde5129a
495 | @ fdf9bde5129a
480 |/
496 |/
481 o ea207398892e
497 o ea207398892e
482
498
483 Predecessors template should the predecessors as we force their display with
499 Predecessors template should the predecessors as we force their display with
484 --hidden
500 --hidden
485 $ hg tlog --hidden
501 $ hg tlog --hidden
486 o 019fadeab383
502 o 019fadeab383
487 | Predecessors: 65b757b745b9
503 | Predecessors: 65b757b745b9
488 | semi-colon: 65b757b745b9
504 | semi-colon: 65b757b745b9
489 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
505 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
506 | map: 65b757b745b935093c87a2bccd877521cccffcbd
490 | x 65b757b745b9
507 | x 65b757b745b9
491 |/ Predecessors: 471f378eab4c
508 |/ Predecessors: 471f378eab4c
492 | semi-colon: 471f378eab4c
509 | semi-colon: 471f378eab4c
493 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
510 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
511 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
494 | @ fdf9bde5129a
512 | @ fdf9bde5129a
495 |/ Predecessors: 471f378eab4c
513 |/ Predecessors: 471f378eab4c
496 | semi-colon: 471f378eab4c
514 | semi-colon: 471f378eab4c
497 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
515 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
516 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
498 | x 471f378eab4c
517 | x 471f378eab4c
499 |/
518 |/
500 o ea207398892e
519 o ea207398892e
501
520
502
521
503 Test templates with amended + folded commit
522 Test templates with amended + folded commit
504 ===========================================
523 ===========================================
505
524
506 Test setup
525 Test setup
507 ----------
526 ----------
508
527
509 $ hg init $TESTTMP/templates-local-amend-fold
528 $ hg init $TESTTMP/templates-local-amend-fold
510 $ cd $TESTTMP/templates-local-amend-fold
529 $ cd $TESTTMP/templates-local-amend-fold
511 $ mkcommit ROOT
530 $ mkcommit ROOT
512 $ mkcommit A0
531 $ mkcommit A0
513 $ mkcommit B0
532 $ mkcommit B0
514 $ hg commit --amend -m "B1"
533 $ hg commit --amend -m "B1"
515 $ hg log --hidden -G
534 $ hg log --hidden -G
516 @ changeset: 3:b7ea6d14e664
535 @ changeset: 3:b7ea6d14e664
517 | tag: tip
536 | tag: tip
518 | parent: 1:471f378eab4c
537 | parent: 1:471f378eab4c
519 | user: test
538 | user: test
520 | date: Thu Jan 01 00:00:00 1970 +0000
539 | date: Thu Jan 01 00:00:00 1970 +0000
521 | summary: B1
540 | summary: B1
522 |
541 |
523 | x changeset: 2:0dec01379d3b
542 | x changeset: 2:0dec01379d3b
524 |/ user: test
543 |/ user: test
525 | date: Thu Jan 01 00:00:00 1970 +0000
544 | date: Thu Jan 01 00:00:00 1970 +0000
526 | summary: B0
545 | summary: B0
527 |
546 |
528 o changeset: 1:471f378eab4c
547 o changeset: 1:471f378eab4c
529 | user: test
548 | user: test
530 | date: Thu Jan 01 00:00:00 1970 +0000
549 | date: Thu Jan 01 00:00:00 1970 +0000
531 | summary: A0
550 | summary: A0
532 |
551 |
533 o changeset: 0:ea207398892e
552 o changeset: 0:ea207398892e
534 user: test
553 user: test
535 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
536 summary: ROOT
555 summary: ROOT
537
556
538 # Simulate a fold
557 # Simulate a fold
539 $ hg up -r "desc(ROOT)"
558 $ hg up -r "desc(ROOT)"
540 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
541 $ echo "A0" > A0
560 $ echo "A0" > A0
542 $ echo "B0" > B0
561 $ echo "B0" > B0
543 $ hg commit -A -m "C0"
562 $ hg commit -A -m "C0"
544 adding A0
563 adding A0
545 adding B0
564 adding B0
546 created new head
565 created new head
547 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
566 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
548 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
567 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
549
568
550 $ hg log --hidden -G
569 $ hg log --hidden -G
551 @ changeset: 4:eb5a0daa2192
570 @ changeset: 4:eb5a0daa2192
552 | tag: tip
571 | tag: tip
553 | parent: 0:ea207398892e
572 | parent: 0:ea207398892e
554 | user: test
573 | user: test
555 | date: Thu Jan 01 00:00:00 1970 +0000
574 | date: Thu Jan 01 00:00:00 1970 +0000
556 | summary: C0
575 | summary: C0
557 |
576 |
558 | x changeset: 3:b7ea6d14e664
577 | x changeset: 3:b7ea6d14e664
559 | | parent: 1:471f378eab4c
578 | | parent: 1:471f378eab4c
560 | | user: test
579 | | user: test
561 | | date: Thu Jan 01 00:00:00 1970 +0000
580 | | date: Thu Jan 01 00:00:00 1970 +0000
562 | | summary: B1
581 | | summary: B1
563 | |
582 | |
564 | | x changeset: 2:0dec01379d3b
583 | | x changeset: 2:0dec01379d3b
565 | |/ user: test
584 | |/ user: test
566 | | date: Thu Jan 01 00:00:00 1970 +0000
585 | | date: Thu Jan 01 00:00:00 1970 +0000
567 | | summary: B0
586 | | summary: B0
568 | |
587 | |
569 | x changeset: 1:471f378eab4c
588 | x changeset: 1:471f378eab4c
570 |/ user: test
589 |/ user: test
571 | date: Thu Jan 01 00:00:00 1970 +0000
590 | date: Thu Jan 01 00:00:00 1970 +0000
572 | summary: A0
591 | summary: A0
573 |
592 |
574 o changeset: 0:ea207398892e
593 o changeset: 0:ea207398892e
575 user: test
594 user: test
576 date: Thu Jan 01 00:00:00 1970 +0000
595 date: Thu Jan 01 00:00:00 1970 +0000
577 summary: ROOT
596 summary: ROOT
578
597
579 Check templates
598 Check templates
580 ---------------
599 ---------------
581
600
582 $ hg up 'desc(A0)' --hidden
601 $ hg up 'desc(A0)' --hidden
583 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
584
603
585 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
586 $ hg tlog
605 $ hg tlog
587 o eb5a0daa2192
606 o eb5a0daa2192
588 | Predecessors: 471f378eab4c
607 | Predecessors: 471f378eab4c
589 | semi-colon: 471f378eab4c
608 | semi-colon: 471f378eab4c
590 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
609 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
610 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
591 | @ 471f378eab4c
611 | @ 471f378eab4c
592 |/
612 |/
593 o ea207398892e
613 o ea207398892e
594
614
595 $ hg up 'desc(B0)' --hidden
615 $ hg up 'desc(B0)' --hidden
596 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
597
617
598 Predecessors template should both predecessors as they are visible
618 Predecessors template should both predecessors as they are visible
599 $ hg tlog
619 $ hg tlog
600 o eb5a0daa2192
620 o eb5a0daa2192
601 | Predecessors: 0dec01379d3b 471f378eab4c
621 | Predecessors: 0dec01379d3b 471f378eab4c
602 | semi-colon: 0dec01379d3b; 471f378eab4c
622 | semi-colon: 0dec01379d3b; 471f378eab4c
603 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
623 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
624 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5 471f378eab4c5e25f6c77f785b27c936efb22874
604 | @ 0dec01379d3b
625 | @ 0dec01379d3b
605 | |
626 | |
606 | x 471f378eab4c
627 | x 471f378eab4c
607 |/
628 |/
608 o ea207398892e
629 o ea207398892e
609
630
610 $ hg up 'desc(B1)' --hidden
631 $ hg up 'desc(B1)' --hidden
611 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
612
633
613 Predecessors template should both predecessors as they are visible
634 Predecessors template should both predecessors as they are visible
614 $ hg tlog
635 $ hg tlog
615 o eb5a0daa2192
636 o eb5a0daa2192
616 | Predecessors: 471f378eab4c b7ea6d14e664
637 | Predecessors: 471f378eab4c b7ea6d14e664
617 | semi-colon: 471f378eab4c; b7ea6d14e664
638 | semi-colon: 471f378eab4c; b7ea6d14e664
618 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
639 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
640 | map: 471f378eab4c5e25f6c77f785b27c936efb22874 b7ea6d14e664bdc8922221f7992631b50da3fb07
619 | @ b7ea6d14e664
641 | @ b7ea6d14e664
620 | |
642 | |
621 | x 471f378eab4c
643 | x 471f378eab4c
622 |/
644 |/
623 o ea207398892e
645 o ea207398892e
624
646
625 $ hg up 'desc(C0)'
647 $ hg up 'desc(C0)'
626 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
627
649
628 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
629 $ hg tlog
651 $ hg tlog
630 @ eb5a0daa2192
652 @ eb5a0daa2192
631 |
653 |
632 o ea207398892e
654 o ea207398892e
633
655
634 Predecessors template should show all predecessors as we force their display
656 Predecessors template should show all predecessors as we force their display
635 with --hidden
657 with --hidden
636 $ hg tlog --hidden
658 $ hg tlog --hidden
637 @ eb5a0daa2192
659 @ eb5a0daa2192
638 | Predecessors: 471f378eab4c b7ea6d14e664
660 | Predecessors: 471f378eab4c b7ea6d14e664
639 | semi-colon: 471f378eab4c; b7ea6d14e664
661 | semi-colon: 471f378eab4c; b7ea6d14e664
640 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
662 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
663 | map: 471f378eab4c5e25f6c77f785b27c936efb22874 b7ea6d14e664bdc8922221f7992631b50da3fb07
641 | x b7ea6d14e664
664 | x b7ea6d14e664
642 | | Predecessors: 0dec01379d3b
665 | | Predecessors: 0dec01379d3b
643 | | semi-colon: 0dec01379d3b
666 | | semi-colon: 0dec01379d3b
644 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
667 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
668 | | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
645 | | x 0dec01379d3b
669 | | x 0dec01379d3b
646 | |/
670 | |/
647 | x 471f378eab4c
671 | x 471f378eab4c
648 |/
672 |/
649 o ea207398892e
673 o ea207398892e
650
674
651
675
652 Test template with pushed and pulled obs markers
676 Test template with pushed and pulled obs markers
653 ================================================
677 ================================================
654
678
655 Test setup
679 Test setup
656 ----------
680 ----------
657
681
658 $ hg init $TESTTMP/templates-local-remote-markers-1
682 $ hg init $TESTTMP/templates-local-remote-markers-1
659 $ cd $TESTTMP/templates-local-remote-markers-1
683 $ cd $TESTTMP/templates-local-remote-markers-1
660 $ mkcommit ROOT
684 $ mkcommit ROOT
661 $ mkcommit A0
685 $ mkcommit A0
662 $ 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
663 updating to branch default
687 updating to branch default
664 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
665 $ cd $TESTTMP/templates-local-remote-markers-2
689 $ cd $TESTTMP/templates-local-remote-markers-2
666 $ hg log --hidden -G
690 $ hg log --hidden -G
667 @ changeset: 1:471f378eab4c
691 @ changeset: 1:471f378eab4c
668 | tag: tip
692 | tag: tip
669 | user: test
693 | user: test
670 | date: Thu Jan 01 00:00:00 1970 +0000
694 | date: Thu Jan 01 00:00:00 1970 +0000
671 | summary: A0
695 | summary: A0
672 |
696 |
673 o changeset: 0:ea207398892e
697 o changeset: 0:ea207398892e
674 user: test
698 user: test
675 date: Thu Jan 01 00:00:00 1970 +0000
699 date: Thu Jan 01 00:00:00 1970 +0000
676 summary: ROOT
700 summary: ROOT
677
701
678 $ cd $TESTTMP/templates-local-remote-markers-1
702 $ cd $TESTTMP/templates-local-remote-markers-1
679 $ hg commit --amend -m "A1"
703 $ hg commit --amend -m "A1"
680 $ hg commit --amend -m "A2"
704 $ hg commit --amend -m "A2"
681 $ hg log --hidden -G
705 $ hg log --hidden -G
682 @ changeset: 3:7a230b46bf61
706 @ changeset: 3:7a230b46bf61
683 | tag: tip
707 | tag: tip
684 | parent: 0:ea207398892e
708 | parent: 0:ea207398892e
685 | user: test
709 | user: test
686 | date: Thu Jan 01 00:00:00 1970 +0000
710 | date: Thu Jan 01 00:00:00 1970 +0000
687 | summary: A2
711 | summary: A2
688 |
712 |
689 | x changeset: 2:fdf9bde5129a
713 | x changeset: 2:fdf9bde5129a
690 |/ parent: 0:ea207398892e
714 |/ parent: 0:ea207398892e
691 | user: test
715 | user: test
692 | date: Thu Jan 01 00:00:00 1970 +0000
716 | date: Thu Jan 01 00:00:00 1970 +0000
693 | summary: A1
717 | summary: A1
694 |
718 |
695 | x changeset: 1:471f378eab4c
719 | x changeset: 1:471f378eab4c
696 |/ user: test
720 |/ user: test
697 | date: Thu Jan 01 00:00:00 1970 +0000
721 | date: Thu Jan 01 00:00:00 1970 +0000
698 | summary: A0
722 | summary: A0
699 |
723 |
700 o changeset: 0:ea207398892e
724 o changeset: 0:ea207398892e
701 user: test
725 user: test
702 date: Thu Jan 01 00:00:00 1970 +0000
726 date: Thu Jan 01 00:00:00 1970 +0000
703 summary: ROOT
727 summary: ROOT
704
728
705 $ cd $TESTTMP/templates-local-remote-markers-2
729 $ cd $TESTTMP/templates-local-remote-markers-2
706 $ hg pull
730 $ hg pull
707 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
731 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
708 searching for changes
732 searching for changes
709 adding changesets
733 adding changesets
710 adding manifests
734 adding manifests
711 adding file changes
735 adding file changes
712 added 1 changesets with 0 changes to 1 files (+1 heads)
736 added 1 changesets with 0 changes to 1 files (+1 heads)
713 2 new obsolescence markers
737 2 new obsolescence markers
714 (run 'hg heads' to see heads, 'hg merge' to merge)
738 (run 'hg heads' to see heads, 'hg merge' to merge)
715 $ hg log --hidden -G
739 $ hg log --hidden -G
716 o changeset: 2:7a230b46bf61
740 o changeset: 2:7a230b46bf61
717 | tag: tip
741 | tag: tip
718 | parent: 0:ea207398892e
742 | parent: 0:ea207398892e
719 | user: test
743 | user: test
720 | date: Thu Jan 01 00:00:00 1970 +0000
744 | date: Thu Jan 01 00:00:00 1970 +0000
721 | summary: A2
745 | summary: A2
722 |
746 |
723 | @ changeset: 1:471f378eab4c
747 | @ changeset: 1:471f378eab4c
724 |/ user: test
748 |/ user: test
725 | date: Thu Jan 01 00:00:00 1970 +0000
749 | date: Thu Jan 01 00:00:00 1970 +0000
726 | summary: A0
750 | summary: A0
727 |
751 |
728 o changeset: 0:ea207398892e
752 o changeset: 0:ea207398892e
729 user: test
753 user: test
730 date: Thu Jan 01 00:00:00 1970 +0000
754 date: Thu Jan 01 00:00:00 1970 +0000
731 summary: ROOT
755 summary: ROOT
732
756
733
757
734 $ hg debugobsolete
758 $ hg debugobsolete
735 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'}
736 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'}
737
761
738 Check templates
762 Check templates
739 ---------------
763 ---------------
740
764
741 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
742 $ hg tlog
766 $ hg tlog
743 o 7a230b46bf61
767 o 7a230b46bf61
744 | Predecessors: 471f378eab4c
768 | Predecessors: 471f378eab4c
745 | semi-colon: 471f378eab4c
769 | semi-colon: 471f378eab4c
746 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
770 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
771 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
747 | @ 471f378eab4c
772 | @ 471f378eab4c
748 |/
773 |/
749 o ea207398892e
774 o ea207398892e
750
775
751 $ hg up 'desc(A2)'
776 $ hg up 'desc(A2)'
752 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
753
778
754 Predecessors template should show no predecessors as they are non visible
779 Predecessors template should show no predecessors as they are non visible
755 $ hg tlog
780 $ hg tlog
756 @ 7a230b46bf61
781 @ 7a230b46bf61
757 |
782 |
758 o ea207398892e
783 o ea207398892e
759
784
760 Predecessors template should show all predecessors as we force their display
785 Predecessors template should show all predecessors as we force their display
761 with --hidden
786 with --hidden
762 $ hg tlog --hidden
787 $ hg tlog --hidden
763 @ 7a230b46bf61
788 @ 7a230b46bf61
764 | Predecessors: 471f378eab4c
789 | Predecessors: 471f378eab4c
765 | semi-colon: 471f378eab4c
790 | semi-colon: 471f378eab4c
766 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
791 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
792 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
767 | x 471f378eab4c
793 | x 471f378eab4c
768 |/
794 |/
769 o ea207398892e
795 o ea207398892e
770
796
771
797
772 Test template with obsmarkers cycle
798 Test template with obsmarkers cycle
773 ===================================
799 ===================================
774
800
775 Test setup
801 Test setup
776 ----------
802 ----------
777
803
778 $ hg init $TESTTMP/templates-local-cycle
804 $ hg init $TESTTMP/templates-local-cycle
779 $ cd $TESTTMP/templates-local-cycle
805 $ cd $TESTTMP/templates-local-cycle
780 $ mkcommit ROOT
806 $ mkcommit ROOT
781 $ mkcommit A0
807 $ mkcommit A0
782 $ mkcommit B0
808 $ mkcommit B0
783 $ hg up -r 0
809 $ hg up -r 0
784 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
785 $ mkcommit C0
811 $ mkcommit C0
786 created new head
812 created new head
787
813
788 Create the cycle
814 Create the cycle
789
815
790 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
816 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
791 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
817 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
792 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
818 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
793
819
794 Check templates
820 Check templates
795 ---------------
821 ---------------
796
822
797 $ hg tlog
823 $ hg tlog
798 @ f897c6137566
824 @ f897c6137566
799 |
825 |
800 o ea207398892e
826 o ea207398892e
801
827
802
828
803 $ hg up -r "desc(B0)" --hidden
829 $ hg up -r "desc(B0)" --hidden
804 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
805 $ hg tlog
831 $ hg tlog
806 o f897c6137566
832 o f897c6137566
807 | Predecessors: 0dec01379d3b
833 | Predecessors: 0dec01379d3b
808 | semi-colon: 0dec01379d3b
834 | semi-colon: 0dec01379d3b
809 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
835 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
836 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
810 | @ 0dec01379d3b
837 | @ 0dec01379d3b
811 | | Predecessors: 471f378eab4c
838 | | Predecessors: 471f378eab4c
812 | | semi-colon: 471f378eab4c
839 | | semi-colon: 471f378eab4c
813 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
840 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
841 | | map: 471f378eab4c5e25f6c77f785b27c936efb22874
814 | x 471f378eab4c
842 | x 471f378eab4c
815 |/ Predecessors: 0dec01379d3b
843 |/ Predecessors: 0dec01379d3b
816 | semi-colon: 0dec01379d3b
844 | semi-colon: 0dec01379d3b
817 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
845 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
846 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
818 o ea207398892e
847 o ea207398892e
819
848
820
849
821 $ hg up -r "desc(A0)" --hidden
850 $ hg up -r "desc(A0)" --hidden
822 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
823 $ hg tlog
852 $ hg tlog
824 o f897c6137566
853 o f897c6137566
825 | Predecessors: 471f378eab4c
854 | Predecessors: 471f378eab4c
826 | semi-colon: 471f378eab4c
855 | semi-colon: 471f378eab4c
827 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
856 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
857 | map: 471f378eab4c5e25f6c77f785b27c936efb22874
828 | @ 471f378eab4c
858 | @ 471f378eab4c
829 |/
859 |/
830 o ea207398892e
860 o ea207398892e
831
861
832
862
833 $ hg up -r "desc(ROOT)" --hidden
863 $ hg up -r "desc(ROOT)" --hidden
834 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
835 $ hg tlog
865 $ hg tlog
836 o f897c6137566
866 o f897c6137566
837 |
867 |
838 @ ea207398892e
868 @ ea207398892e
839
869
840
870
841 $ hg tlog --hidden
871 $ hg tlog --hidden
842 o f897c6137566
872 o f897c6137566
843 | Predecessors: 0dec01379d3b
873 | Predecessors: 0dec01379d3b
844 | semi-colon: 0dec01379d3b
874 | semi-colon: 0dec01379d3b
845 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
875 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
876 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
846 | x 0dec01379d3b
877 | x 0dec01379d3b
847 | | Predecessors: 471f378eab4c
878 | | Predecessors: 471f378eab4c
848 | | semi-colon: 471f378eab4c
879 | | semi-colon: 471f378eab4c
849 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
880 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
881 | | map: 471f378eab4c5e25f6c77f785b27c936efb22874
850 | x 471f378eab4c
882 | x 471f378eab4c
851 |/ Predecessors: 0dec01379d3b
883 |/ Predecessors: 0dec01379d3b
852 | semi-colon: 0dec01379d3b
884 | semi-colon: 0dec01379d3b
853 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
885 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
886 | map: 0dec01379d3be6318c470ead31b1fe7ae7cb53d5
854 @ ea207398892e
887 @ ea207398892e
855
888
General Comments 0
You need to be logged in to leave comments. Login now