##// END OF EJS Templates
template: add successors template...
Boris Feld -
r33276:89796a25 default
parent child Browse files
Show More
@@ -1,724 +1,756
1 1 # templatekw.py - common changeset template keywords
2 2 #
3 3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 11 from .node import (
12 12 hex,
13 13 nullid,
14 14 short,
15 15 )
16 16
17 17 from . import (
18 18 encoding,
19 19 error,
20 20 hbisect,
21 21 obsutil,
22 22 patch,
23 23 pycompat,
24 24 registrar,
25 25 scmutil,
26 26 util,
27 27 )
28 28
29 29 class _hybrid(object):
30 30 """Wrapper for list or dict to support legacy template
31 31
32 32 This class allows us to handle both:
33 33 - "{files}" (legacy command-line-specific list hack) and
34 34 - "{files % '{file}\n'}" (hgweb-style with inlining and function support)
35 35 and to access raw values:
36 36 - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
37 37 - "{get(extras, key)}"
38 38 - "{files|json}"
39 39 """
40 40
41 41 def __init__(self, gen, values, makemap, joinfmt):
42 42 if gen is not None:
43 43 self.gen = gen
44 44 self._values = values
45 45 self._makemap = makemap
46 46 self.joinfmt = joinfmt
47 47 @util.propertycache
48 48 def gen(self):
49 49 return self._defaultgen()
50 50 def _defaultgen(self):
51 51 """Generator to stringify this as {join(self, ' ')}"""
52 52 for i, d in enumerate(self.itermaps()):
53 53 if i > 0:
54 54 yield ' '
55 55 yield self.joinfmt(d)
56 56 def itermaps(self):
57 57 makemap = self._makemap
58 58 for x in self._values:
59 59 yield makemap(x)
60 60 def __contains__(self, x):
61 61 return x in self._values
62 62 def __len__(self):
63 63 return len(self._values)
64 64 def __iter__(self):
65 65 return iter(self._values)
66 66 def __getattr__(self, name):
67 67 if name not in ('get', 'items', 'iteritems', 'iterkeys', 'itervalues',
68 68 'keys', 'values'):
69 69 raise AttributeError(name)
70 70 return getattr(self._values, name)
71 71
72 72 def hybriddict(data, key='key', value='value', fmt='%s=%s', gen=None):
73 73 """Wrap data to support both dict-like and string-like operations"""
74 74 return _hybrid(gen, data, lambda k: {key: k, value: data[k]},
75 75 lambda d: fmt % (d[key], d[value]))
76 76
77 77 def hybridlist(data, name, fmt='%s', gen=None):
78 78 """Wrap data to support both list-like and string-like operations"""
79 79 return _hybrid(gen, data, lambda x: {name: x}, lambda d: fmt % d[name])
80 80
81 81 def unwraphybrid(thing):
82 82 """Return an object which can be stringified possibly by using a legacy
83 83 template"""
84 84 if not util.safehasattr(thing, 'gen'):
85 85 return thing
86 86 return thing.gen
87 87
88 88 def showdict(name, data, mapping, plural=None, key='key', value='value',
89 89 fmt='%s=%s', separator=' '):
90 90 c = [{key: k, value: v} for k, v in data.iteritems()]
91 91 f = _showlist(name, c, mapping, plural, separator)
92 92 return hybriddict(data, key=key, value=value, fmt=fmt, gen=f)
93 93
94 94 def showlist(name, values, mapping, plural=None, element=None, separator=' '):
95 95 if not element:
96 96 element = name
97 97 f = _showlist(name, values, mapping, plural, separator)
98 98 return hybridlist(values, name=element, gen=f)
99 99
100 100 def _showlist(name, values, mapping, plural=None, separator=' '):
101 101 '''expand set of values.
102 102 name is name of key in template map.
103 103 values is list of strings or dicts.
104 104 plural is plural of name, if not simply name + 's'.
105 105 separator is used to join values as a string
106 106
107 107 expansion works like this, given name 'foo'.
108 108
109 109 if values is empty, expand 'no_foos'.
110 110
111 111 if 'foo' not in template map, return values as a string,
112 112 joined by 'separator'.
113 113
114 114 expand 'start_foos'.
115 115
116 116 for each value, expand 'foo'. if 'last_foo' in template
117 117 map, expand it instead of 'foo' for last key.
118 118
119 119 expand 'end_foos'.
120 120 '''
121 121 templ = mapping['templ']
122 122 strmapping = pycompat.strkwargs(mapping)
123 123 if not plural:
124 124 plural = name + 's'
125 125 if not values:
126 126 noname = 'no_' + plural
127 127 if noname in templ:
128 128 yield templ(noname, **strmapping)
129 129 return
130 130 if name not in templ:
131 131 if isinstance(values[0], bytes):
132 132 yield separator.join(values)
133 133 else:
134 134 for v in values:
135 135 yield dict(v, **strmapping)
136 136 return
137 137 startname = 'start_' + plural
138 138 if startname in templ:
139 139 yield templ(startname, **strmapping)
140 140 vmapping = mapping.copy()
141 141 def one(v, tag=name):
142 142 try:
143 143 vmapping.update(v)
144 144 except (AttributeError, ValueError):
145 145 try:
146 146 for a, b in v:
147 147 vmapping[a] = b
148 148 except ValueError:
149 149 vmapping[name] = v
150 150 return templ(tag, **pycompat.strkwargs(vmapping))
151 151 lastname = 'last_' + name
152 152 if lastname in templ:
153 153 last = values.pop()
154 154 else:
155 155 last = None
156 156 for v in values:
157 157 yield one(v)
158 158 if last is not None:
159 159 yield one(last, tag=lastname)
160 160 endname = 'end_' + plural
161 161 if endname in templ:
162 162 yield templ(endname, **strmapping)
163 163
164 164 def _formatrevnode(ctx):
165 165 """Format changeset as '{rev}:{node|formatnode}', which is the default
166 166 template provided by cmdutil.changeset_templater"""
167 167 repo = ctx.repo()
168 168 if repo.ui.debugflag:
169 169 hexfunc = hex
170 170 else:
171 171 hexfunc = short
172 172 return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
173 173
174 174 def getfiles(repo, ctx, revcache):
175 175 if 'files' not in revcache:
176 176 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
177 177 return revcache['files']
178 178
179 179 def getlatesttags(repo, ctx, cache, pattern=None):
180 180 '''return date, distance and name for the latest tag of rev'''
181 181
182 182 cachename = 'latesttags'
183 183 if pattern is not None:
184 184 cachename += '-' + pattern
185 185 match = util.stringmatcher(pattern)[2]
186 186 else:
187 187 match = util.always
188 188
189 189 if cachename not in cache:
190 190 # Cache mapping from rev to a tuple with tag date, tag
191 191 # distance and tag name
192 192 cache[cachename] = {-1: (0, 0, ['null'])}
193 193 latesttags = cache[cachename]
194 194
195 195 rev = ctx.rev()
196 196 todo = [rev]
197 197 while todo:
198 198 rev = todo.pop()
199 199 if rev in latesttags:
200 200 continue
201 201 ctx = repo[rev]
202 202 tags = [t for t in ctx.tags()
203 203 if (repo.tagtype(t) and repo.tagtype(t) != 'local'
204 204 and match(t))]
205 205 if tags:
206 206 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
207 207 continue
208 208 try:
209 209 # The tuples are laid out so the right one can be found by
210 210 # comparison.
211 211 pdate, pdist, ptag = max(
212 212 latesttags[p.rev()] for p in ctx.parents())
213 213 except KeyError:
214 214 # Cache miss - recurse
215 215 todo.append(rev)
216 216 todo.extend(p.rev() for p in ctx.parents())
217 217 continue
218 218 latesttags[rev] = pdate, pdist + 1, ptag
219 219 return latesttags[rev]
220 220
221 221 def getrenamedfn(repo, endrev=None):
222 222 rcache = {}
223 223 if endrev is None:
224 224 endrev = len(repo)
225 225
226 226 def getrenamed(fn, rev):
227 227 '''looks up all renames for a file (up to endrev) the first
228 228 time the file is given. It indexes on the changerev and only
229 229 parses the manifest if linkrev != changerev.
230 230 Returns rename info for fn at changerev rev.'''
231 231 if fn not in rcache:
232 232 rcache[fn] = {}
233 233 fl = repo.file(fn)
234 234 for i in fl:
235 235 lr = fl.linkrev(i)
236 236 renamed = fl.renamed(fl.node(i))
237 237 rcache[fn][lr] = renamed
238 238 if lr >= endrev:
239 239 break
240 240 if rev in rcache[fn]:
241 241 return rcache[fn][rev]
242 242
243 243 # If linkrev != rev (i.e. rev not found in rcache) fallback to
244 244 # filectx logic.
245 245 try:
246 246 return repo[rev][fn].renamed()
247 247 except error.LookupError:
248 248 return None
249 249
250 250 return getrenamed
251 251
252 252 # default templates internally used for rendering of lists
253 253 defaulttempl = {
254 254 'parent': '{rev}:{node|formatnode} ',
255 255 'manifest': '{rev}:{node|formatnode}',
256 256 'file_copy': '{name} ({source})',
257 257 'envvar': '{key}={value}',
258 258 'extra': '{key}={value|stringescape}'
259 259 }
260 260 # filecopy is preserved for compatibility reasons
261 261 defaulttempl['filecopy'] = defaulttempl['file_copy']
262 262
263 263 # keywords are callables like:
264 264 # fn(repo, ctx, templ, cache, revcache, **args)
265 265 # with:
266 266 # repo - current repository instance
267 267 # ctx - the changectx being displayed
268 268 # templ - the templater instance
269 269 # cache - a cache dictionary for the whole templater run
270 270 # revcache - a cache dictionary for the current revision
271 271 keywords = {}
272 272
273 273 templatekeyword = registrar.templatekeyword(keywords)
274 274
275 275 @templatekeyword('author')
276 276 def showauthor(repo, ctx, templ, **args):
277 277 """String. The unmodified author of the changeset."""
278 278 return ctx.user()
279 279
280 280 @templatekeyword('bisect')
281 281 def showbisect(repo, ctx, templ, **args):
282 282 """String. The changeset bisection status."""
283 283 return hbisect.label(repo, ctx.node())
284 284
285 285 @templatekeyword('branch')
286 286 def showbranch(**args):
287 287 """String. The name of the branch on which the changeset was
288 288 committed.
289 289 """
290 290 return args[r'ctx'].branch()
291 291
292 292 @templatekeyword('branches')
293 293 def showbranches(**args):
294 294 """List of strings. The name of the branch on which the
295 295 changeset was committed. Will be empty if the branch name was
296 296 default. (DEPRECATED)
297 297 """
298 298 args = pycompat.byteskwargs(args)
299 299 branch = args['ctx'].branch()
300 300 if branch != 'default':
301 301 return showlist('branch', [branch], args, plural='branches')
302 302 return showlist('branch', [], args, plural='branches')
303 303
304 304 @templatekeyword('bookmarks')
305 305 def showbookmarks(**args):
306 306 """List of strings. Any bookmarks associated with the
307 307 changeset. Also sets 'active', the name of the active bookmark.
308 308 """
309 309 args = pycompat.byteskwargs(args)
310 310 repo = args['ctx']._repo
311 311 bookmarks = args['ctx'].bookmarks()
312 312 active = repo._activebookmark
313 313 makemap = lambda v: {'bookmark': v, 'active': active, 'current': active}
314 314 f = _showlist('bookmark', bookmarks, args)
315 315 return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark'])
316 316
317 317 @templatekeyword('children')
318 318 def showchildren(**args):
319 319 """List of strings. The children of the changeset."""
320 320 args = pycompat.byteskwargs(args)
321 321 ctx = args['ctx']
322 322 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
323 323 return showlist('children', childrevs, args, element='child')
324 324
325 325 # Deprecated, but kept alive for help generation a purpose.
326 326 @templatekeyword('currentbookmark')
327 327 def showcurrentbookmark(**args):
328 328 """String. The active bookmark, if it is
329 329 associated with the changeset (DEPRECATED)"""
330 330 return showactivebookmark(**args)
331 331
332 332 @templatekeyword('activebookmark')
333 333 def showactivebookmark(**args):
334 334 """String. The active bookmark, if it is
335 335 associated with the changeset"""
336 336 active = args[r'repo']._activebookmark
337 337 if active and active in args[r'ctx'].bookmarks():
338 338 return active
339 339 return ''
340 340
341 341 @templatekeyword('date')
342 342 def showdate(repo, ctx, templ, **args):
343 343 """Date information. The date when the changeset was committed."""
344 344 return ctx.date()
345 345
346 346 @templatekeyword('desc')
347 347 def showdescription(repo, ctx, templ, **args):
348 348 """String. The text of the changeset description."""
349 349 s = ctx.description()
350 350 if isinstance(s, encoding.localstr):
351 351 # try hard to preserve utf-8 bytes
352 352 return encoding.tolocal(encoding.fromlocal(s).strip())
353 353 else:
354 354 return s.strip()
355 355
356 356 @templatekeyword('diffstat')
357 357 def showdiffstat(repo, ctx, templ, **args):
358 358 """String. Statistics of changes with the following format:
359 359 "modified files: +added/-removed lines"
360 360 """
361 361 stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
362 362 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
363 363 return '%s: +%s/-%s' % (len(stats), adds, removes)
364 364
365 365 @templatekeyword('envvars')
366 366 def showenvvars(repo, **args):
367 367 """A dictionary of environment variables. (EXPERIMENTAL)"""
368 368 args = pycompat.byteskwargs(args)
369 369 env = repo.ui.exportableenviron()
370 370 env = util.sortdict((k, env[k]) for k in sorted(env))
371 371 return showdict('envvar', env, args, plural='envvars')
372 372
373 373 @templatekeyword('extras')
374 374 def showextras(**args):
375 375 """List of dicts with key, value entries of the 'extras'
376 376 field of this changeset."""
377 377 args = pycompat.byteskwargs(args)
378 378 extras = args['ctx'].extra()
379 379 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
380 380 makemap = lambda k: {'key': k, 'value': extras[k]}
381 381 c = [makemap(k) for k in extras]
382 382 f = _showlist('extra', c, args, plural='extras')
383 383 return _hybrid(f, extras, makemap,
384 384 lambda x: '%s=%s' % (x['key'], util.escapestr(x['value'])))
385 385
386 386 @templatekeyword('file_adds')
387 387 def showfileadds(**args):
388 388 """List of strings. Files added by this changeset."""
389 389 args = pycompat.byteskwargs(args)
390 390 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
391 391 return showlist('file_add', getfiles(repo, ctx, revcache)[1], args,
392 392 element='file')
393 393
394 394 @templatekeyword('file_copies')
395 395 def showfilecopies(**args):
396 396 """List of strings. Files copied in this changeset with
397 397 their sources.
398 398 """
399 399 args = pycompat.byteskwargs(args)
400 400 cache, ctx = args['cache'], args['ctx']
401 401 copies = args['revcache'].get('copies')
402 402 if copies is None:
403 403 if 'getrenamed' not in cache:
404 404 cache['getrenamed'] = getrenamedfn(args['repo'])
405 405 copies = []
406 406 getrenamed = cache['getrenamed']
407 407 for fn in ctx.files():
408 408 rename = getrenamed(fn, ctx.rev())
409 409 if rename:
410 410 copies.append((fn, rename[0]))
411 411
412 412 copies = util.sortdict(copies)
413 413 return showdict('file_copy', copies, args, plural='file_copies',
414 414 key='name', value='source', fmt='%s (%s)')
415 415
416 416 # showfilecopiesswitch() displays file copies only if copy records are
417 417 # provided before calling the templater, usually with a --copies
418 418 # command line switch.
419 419 @templatekeyword('file_copies_switch')
420 420 def showfilecopiesswitch(**args):
421 421 """List of strings. Like "file_copies" but displayed
422 422 only if the --copied switch is set.
423 423 """
424 424 args = pycompat.byteskwargs(args)
425 425 copies = args['revcache'].get('copies') or []
426 426 copies = util.sortdict(copies)
427 427 return showdict('file_copy', copies, args, plural='file_copies',
428 428 key='name', value='source', fmt='%s (%s)')
429 429
430 430 @templatekeyword('file_dels')
431 431 def showfiledels(**args):
432 432 """List of strings. Files removed by this changeset."""
433 433 args = pycompat.byteskwargs(args)
434 434 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
435 435 return showlist('file_del', getfiles(repo, ctx, revcache)[2], args,
436 436 element='file')
437 437
438 438 @templatekeyword('file_mods')
439 439 def showfilemods(**args):
440 440 """List of strings. Files modified by this changeset."""
441 441 args = pycompat.byteskwargs(args)
442 442 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
443 443 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args,
444 444 element='file')
445 445
446 446 @templatekeyword('files')
447 447 def showfiles(**args):
448 448 """List of strings. All files modified, added, or removed by this
449 449 changeset.
450 450 """
451 451 args = pycompat.byteskwargs(args)
452 452 return showlist('file', args['ctx'].files(), args)
453 453
454 454 @templatekeyword('graphnode')
455 455 def showgraphnode(repo, ctx, **args):
456 456 """String. The character representing the changeset node in
457 457 an ASCII revision graph"""
458 458 wpnodes = repo.dirstate.parents()
459 459 if wpnodes[1] == nullid:
460 460 wpnodes = wpnodes[:1]
461 461 if ctx.node() in wpnodes:
462 462 return '@'
463 463 elif ctx.obsolete():
464 464 return 'x'
465 465 elif ctx.closesbranch():
466 466 return '_'
467 467 else:
468 468 return 'o'
469 469
470 470 @templatekeyword('index')
471 471 def showindex(**args):
472 472 """Integer. The current iteration of the loop. (0 indexed)"""
473 473 # just hosts documentation; should be overridden by template mapping
474 474 raise error.Abort(_("can't use index in this context"))
475 475
476 476 @templatekeyword('latesttag')
477 477 def showlatesttag(**args):
478 478 """List of strings. The global tags on the most recent globally
479 479 tagged ancestor of this changeset. If no such tags exist, the list
480 480 consists of the single string "null".
481 481 """
482 482 return showlatesttags(None, **args)
483 483
484 484 def showlatesttags(pattern, **args):
485 485 """helper method for the latesttag keyword and function"""
486 486 args = pycompat.byteskwargs(args)
487 487 repo, ctx = args['repo'], args['ctx']
488 488 cache = args['cache']
489 489 latesttags = getlatesttags(repo, ctx, cache, pattern)
490 490
491 491 # latesttag[0] is an implementation detail for sorting csets on different
492 492 # branches in a stable manner- it is the date the tagged cset was created,
493 493 # not the date the tag was created. Therefore it isn't made visible here.
494 494 makemap = lambda v: {
495 495 'changes': _showchangessincetag,
496 496 'distance': latesttags[1],
497 497 'latesttag': v, # BC with {latesttag % '{latesttag}'}
498 498 'tag': v
499 499 }
500 500
501 501 tags = latesttags[2]
502 502 f = _showlist('latesttag', tags, args, separator=':')
503 503 return _hybrid(f, tags, makemap, lambda x: x['latesttag'])
504 504
505 505 @templatekeyword('latesttagdistance')
506 506 def showlatesttagdistance(repo, ctx, templ, cache, **args):
507 507 """Integer. Longest path to the latest tag."""
508 508 return getlatesttags(repo, ctx, cache)[1]
509 509
510 510 @templatekeyword('changessincelatesttag')
511 511 def showchangessincelatesttag(repo, ctx, templ, cache, **args):
512 512 """Integer. All ancestors not in the latest tag."""
513 513 latesttag = getlatesttags(repo, ctx, cache)[2][0]
514 514
515 515 return _showchangessincetag(repo, ctx, tag=latesttag, **args)
516 516
517 517 def _showchangessincetag(repo, ctx, **args):
518 518 offset = 0
519 519 revs = [ctx.rev()]
520 520 tag = args[r'tag']
521 521
522 522 # The only() revset doesn't currently support wdir()
523 523 if ctx.rev() is None:
524 524 offset = 1
525 525 revs = [p.rev() for p in ctx.parents()]
526 526
527 527 return len(repo.revs('only(%ld, %s)', revs, tag)) + offset
528 528
529 529 @templatekeyword('manifest')
530 530 def showmanifest(**args):
531 531 repo, ctx, templ = args[r'repo'], args[r'ctx'], args[r'templ']
532 532 mnode = ctx.manifestnode()
533 533 if mnode is None:
534 534 # just avoid crash, we might want to use the 'ff...' hash in future
535 535 return
536 536 args = args.copy()
537 537 args.update({r'rev': repo.manifestlog._revlog.rev(mnode),
538 538 r'node': hex(mnode)})
539 539 return templ('manifest', **args)
540 540
541 541 def shownames(namespace, **args):
542 542 """helper method to generate a template keyword for a namespace"""
543 543 args = pycompat.byteskwargs(args)
544 544 ctx = args['ctx']
545 545 repo = ctx.repo()
546 546 ns = repo.names[namespace]
547 547 names = ns.names(repo, ctx.node())
548 548 return showlist(ns.templatename, names, args, plural=namespace)
549 549
550 550 @templatekeyword('namespaces')
551 551 def shownamespaces(**args):
552 552 """Dict of lists. Names attached to this changeset per
553 553 namespace."""
554 554 args = pycompat.byteskwargs(args)
555 555 ctx = args['ctx']
556 556 repo = ctx.repo()
557 557
558 558 namespaces = util.sortdict()
559 559 colornames = {}
560 560 builtins = {}
561 561
562 562 for k, ns in repo.names.iteritems():
563 563 namespaces[k] = showlist('name', ns.names(repo, ctx.node()), args)
564 564 colornames[k] = ns.colorname
565 565 builtins[k] = ns.builtin
566 566
567 567 f = _showlist('namespace', list(namespaces), args)
568 568
569 569 def makemap(ns):
570 570 return {
571 571 'namespace': ns,
572 572 'names': namespaces[ns],
573 573 'builtin': builtins[ns],
574 574 'colorname': colornames[ns],
575 575 }
576 576
577 577 return _hybrid(f, namespaces, makemap, lambda x: x['namespace'])
578 578
579 579 @templatekeyword('node')
580 580 def shownode(repo, ctx, templ, **args):
581 581 """String. The changeset identification hash, as a 40 hexadecimal
582 582 digit string.
583 583 """
584 584 return ctx.hex()
585 585
586 586 @templatekeyword('obsolete')
587 587 def showobsolete(repo, ctx, templ, **args):
588 588 """String. Whether the changeset is obsolete.
589 589 """
590 590 if ctx.obsolete():
591 591 return 'obsolete'
592 592 return ''
593 593
594 594 @templatekeyword("predecessors")
595 595 def showpredecessors(repo, ctx, **args):
596 596 """Returns the list if the closest visible successors
597 597 """
598 598 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
599 599 predecessors = map(hex, predecessors)
600 600
601 601 return _hybrid(None, predecessors,
602 602 lambda x: {'ctx': repo[x], 'revcache': {}},
603 603 lambda d: _formatrevnode(d['ctx']))
604 604
605 @templatekeyword("successorssets")
606 def showsuccessorssets(repo, ctx, **args):
607 """Returns a string of sets of successors for a changectx
608
609 Format used is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and
610 ctx2 while also diverged into ctx3"""
611 if not ctx.obsolete():
612 return ''
613 args = pycompat.byteskwargs(args)
614
615 ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
616 ssets = [[hex(n) for n in ss] for ss in ssets]
617
618 data = []
619 for ss in ssets:
620 h = _hybrid(None, ss, lambda x: {'ctx': repo[x], 'revcache': {}},
621 lambda d: _formatrevnode(d['ctx']))
622 data.append(h)
623
624 # Format the successorssets
625 def render(d):
626 t = []
627 for i in d.gen:
628 t.append(i)
629 return "".join(t)
630
631 def gen(data):
632 yield "; ".join(render(d) for d in data)
633
634 return _hybrid(gen(data), data, lambda x: {'successorset': x},
635 lambda d: d["successorset"])
636
605 637 @templatekeyword('p1rev')
606 638 def showp1rev(repo, ctx, templ, **args):
607 639 """Integer. The repository-local revision number of the changeset's
608 640 first parent, or -1 if the changeset has no parents."""
609 641 return ctx.p1().rev()
610 642
611 643 @templatekeyword('p2rev')
612 644 def showp2rev(repo, ctx, templ, **args):
613 645 """Integer. The repository-local revision number of the changeset's
614 646 second parent, or -1 if the changeset has no second parent."""
615 647 return ctx.p2().rev()
616 648
617 649 @templatekeyword('p1node')
618 650 def showp1node(repo, ctx, templ, **args):
619 651 """String. The identification hash of the changeset's first parent,
620 652 as a 40 digit hexadecimal string. If the changeset has no parents, all
621 653 digits are 0."""
622 654 return ctx.p1().hex()
623 655
624 656 @templatekeyword('p2node')
625 657 def showp2node(repo, ctx, templ, **args):
626 658 """String. The identification hash of the changeset's second
627 659 parent, as a 40 digit hexadecimal string. If the changeset has no second
628 660 parent, all digits are 0."""
629 661 return ctx.p2().hex()
630 662
631 663 @templatekeyword('parents')
632 664 def showparents(**args):
633 665 """List of strings. The parents of the changeset in "rev:node"
634 666 format. If the changeset has only one "natural" parent (the predecessor
635 667 revision) nothing is shown."""
636 668 args = pycompat.byteskwargs(args)
637 669 repo = args['repo']
638 670 ctx = args['ctx']
639 671 pctxs = scmutil.meaningfulparents(repo, ctx)
640 672 # ifcontains() needs a list of str
641 673 prevs = ["%d" % p.rev() for p in pctxs]
642 674 parents = [[('rev', p.rev()),
643 675 ('node', p.hex()),
644 676 ('phase', p.phasestr())]
645 677 for p in pctxs]
646 678 f = _showlist('parent', parents, args)
647 679 return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
648 680 lambda d: _formatrevnode(d['ctx']))
649 681
650 682 @templatekeyword('phase')
651 683 def showphase(repo, ctx, templ, **args):
652 684 """String. The changeset phase name."""
653 685 return ctx.phasestr()
654 686
655 687 @templatekeyword('phaseidx')
656 688 def showphaseidx(repo, ctx, templ, **args):
657 689 """Integer. The changeset phase index."""
658 690 return ctx.phase()
659 691
660 692 @templatekeyword('rev')
661 693 def showrev(repo, ctx, templ, **args):
662 694 """Integer. The repository-local changeset revision number."""
663 695 return scmutil.intrev(ctx)
664 696
665 697 def showrevslist(name, revs, **args):
666 698 """helper to generate a list of revisions in which a mapped template will
667 699 be evaluated"""
668 700 args = pycompat.byteskwargs(args)
669 701 repo = args['ctx'].repo()
670 702 # ifcontains() needs a list of str
671 703 revs = ["%d" % r for r in revs]
672 704 f = _showlist(name, revs, args)
673 705 return _hybrid(f, revs,
674 706 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}},
675 707 lambda d: d[name])
676 708
677 709 @templatekeyword('subrepos')
678 710 def showsubrepos(**args):
679 711 """List of strings. Updated subrepositories in the changeset."""
680 712 args = pycompat.byteskwargs(args)
681 713 ctx = args['ctx']
682 714 substate = ctx.substate
683 715 if not substate:
684 716 return showlist('subrepo', [], args)
685 717 psubstate = ctx.parents()[0].substate or {}
686 718 subrepos = []
687 719 for sub in substate:
688 720 if sub not in psubstate or substate[sub] != psubstate[sub]:
689 721 subrepos.append(sub) # modified or newly added in ctx
690 722 for sub in psubstate:
691 723 if sub not in substate:
692 724 subrepos.append(sub) # removed in ctx
693 725 return showlist('subrepo', sorted(subrepos), args)
694 726
695 727 # don't remove "showtags" definition, even though namespaces will put
696 728 # a helper function for "tags" keyword into "keywords" map automatically,
697 729 # because online help text is built without namespaces initialization
698 730 @templatekeyword('tags')
699 731 def showtags(**args):
700 732 """List of strings. Any tags associated with the changeset."""
701 733 return shownames('tags', **args)
702 734
703 735 def loadkeyword(ui, extname, registrarobj):
704 736 """Load template keyword from specified registrarobj
705 737 """
706 738 for name, func in registrarobj._table.iteritems():
707 739 keywords[name] = func
708 740
709 741 @templatekeyword('termwidth')
710 742 def termwidth(repo, ctx, templ, **args):
711 743 """Integer. The width of the current terminal."""
712 744 return repo.ui.termwidth()
713 745
714 746 @templatekeyword('troubles')
715 747 def showtroubles(**args):
716 748 """List of strings. Evolution troubles affecting the changeset.
717 749
718 750 (EXPERIMENTAL)
719 751 """
720 752 args = pycompat.byteskwargs(args)
721 753 return showlist('trouble', args['ctx'].troubles(), args)
722 754
723 755 # tell hggettext to extract docstrings from these functions:
724 756 i18nfunctions = keywords.values()
@@ -1,1167 +1,1261
1 1 This test file test the various templates related to obsmarkers.
2 2
3 3 Global setup
4 4 ============
5 5
6 6 $ . $TESTDIR/testlib/obsmarker-common.sh
7 7 $ cat >> $HGRCPATH <<EOF
8 8 > [ui]
9 9 > interactive = true
10 10 > [phases]
11 11 > publish=False
12 12 > [experimental]
13 13 > evolution=all
14 14 > [alias]
15 15 > tlog = log -G -T '{node|short}\
16 16 > {if(predecessors, "\n Predecessors: {predecessors}")}\
17 17 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
18 18 > {if(predecessors, "\n json: {predecessors|json}")}\
19 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\n'
19 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\
20 > {if(successorssets, "\n Successors: {successorssets}")}\
21 > {if(successorssets, "\n multi-line: {join(successorssets, "\n multi-line: ")}")}\
22 > {if(successorssets, "\n json: {successorssets|json}")}\n'
20 23 > EOF
21 24
22 25 Test templates on amended commit
23 26 ================================
24 27
25 28 Test setup
26 29 ----------
27 30
28 31 $ hg init $TESTTMP/templates-local-amend
29 32 $ cd $TESTTMP/templates-local-amend
30 33 $ mkcommit ROOT
31 34 $ mkcommit A0
32 35 $ echo 42 >> A0
33 36 $ hg commit --amend -m "A1"
34 37 $ hg commit --amend -m "A2"
35 38
36 39 $ hg log --hidden -G
37 40 @ changeset: 4:d004c8f274b9
38 41 | tag: tip
39 42 | parent: 0:ea207398892e
40 43 | user: test
41 44 | date: Thu Jan 01 00:00:00 1970 +0000
42 45 | summary: A2
43 46 |
44 47 | x changeset: 3:a468dc9b3633
45 48 |/ parent: 0:ea207398892e
46 49 | user: test
47 50 | date: Thu Jan 01 00:00:00 1970 +0000
48 51 | summary: A1
49 52 |
50 53 | x changeset: 2:f137d23bb3e1
51 54 | | user: test
52 55 | | date: Thu Jan 01 00:00:00 1970 +0000
53 56 | | summary: temporary amend commit for 471f378eab4c
54 57 | |
55 58 | x changeset: 1:471f378eab4c
56 59 |/ user: test
57 60 | date: Thu Jan 01 00:00:00 1970 +0000
58 61 | summary: A0
59 62 |
60 63 o changeset: 0:ea207398892e
61 64 user: test
62 65 date: Thu Jan 01 00:00:00 1970 +0000
63 66 summary: ROOT
64 67
65 68 Check templates
66 69 ---------------
67 70 $ hg up 'desc(A0)' --hidden
68 71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 72
70 73 Predecessors template should show current revision as it is the working copy
71 74 $ hg tlog
72 75 o d004c8f274b9
73 76 | Predecessors: 1:471f378eab4c
74 77 | semi-colon: 1:471f378eab4c
75 78 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
76 79 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
77 80 | @ 471f378eab4c
78 |/
81 |/ Successors: 4:d004c8f274b9
82 | multi-line: 4:d004c8f274b9
83 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
79 84 o ea207398892e
80 85
81 86 $ hg up 'desc(A1)' --hidden
82 87 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 88
84 89 Predecessors template should show current revision as it is the working copy
85 90 $ hg tlog
86 91 o d004c8f274b9
87 92 | Predecessors: 3:a468dc9b3633
88 93 | semi-colon: 3:a468dc9b3633
89 94 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
90 95 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
91 96 | @ a468dc9b3633
92 |/
97 |/ Successors: 4:d004c8f274b9
98 | multi-line: 4:d004c8f274b9
99 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
93 100 o ea207398892e
94 101
95 102 Predecessors template should show all the predecessors as we force their display
96 103 with --hidden
97 104 $ hg tlog --hidden
98 105 o d004c8f274b9
99 106 | Predecessors: 3:a468dc9b3633
100 107 | semi-colon: 3:a468dc9b3633
101 108 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
102 109 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
103 110 | @ a468dc9b3633
104 111 |/ Predecessors: 1:471f378eab4c
105 112 | semi-colon: 1:471f378eab4c
106 113 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
107 114 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
115 | Successors: 4:d004c8f274b9
116 | multi-line: 4:d004c8f274b9
117 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
108 118 | x f137d23bb3e1
109 119 | |
110 120 | x 471f378eab4c
111 |/
121 |/ Successors: 3:a468dc9b3633
122 | multi-line: 3:a468dc9b3633
123 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
112 124 o ea207398892e
113 125
114 126
115 127 Predecessors template shouldn't show anything as all obsolete commit are not
116 128 visible.
117 129 $ hg up 'desc(A2)'
118 130 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 131 $ hg tlog
120 132 @ d004c8f274b9
121 133 |
122 134 o ea207398892e
123 135
124 136 $ hg tlog --hidden
125 137 @ d004c8f274b9
126 138 | Predecessors: 3:a468dc9b3633
127 139 | semi-colon: 3:a468dc9b3633
128 140 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
129 141 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
130 142 | x a468dc9b3633
131 143 |/ Predecessors: 1:471f378eab4c
132 144 | semi-colon: 1:471f378eab4c
133 145 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
134 146 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
147 | Successors: 4:d004c8f274b9
148 | multi-line: 4:d004c8f274b9
149 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
135 150 | x f137d23bb3e1
136 151 | |
137 152 | x 471f378eab4c
138 |/
153 |/ Successors: 3:a468dc9b3633
154 | multi-line: 3:a468dc9b3633
155 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
139 156 o ea207398892e
140 157
141 158
142 159 Test templates with splitted commit
143 160 ===================================
144 161
145 162 $ hg init $TESTTMP/templates-local-split
146 163 $ cd $TESTTMP/templates-local-split
147 164 $ mkcommit ROOT
148 165 $ echo 42 >> a
149 166 $ echo 43 >> b
150 167 $ hg commit -A -m "A0"
151 168 adding a
152 169 adding b
153 170 $ hg log --hidden -G
154 171 @ changeset: 1:471597cad322
155 172 | tag: tip
156 173 | user: test
157 174 | date: Thu Jan 01 00:00:00 1970 +0000
158 175 | summary: A0
159 176 |
160 177 o changeset: 0:ea207398892e
161 178 user: test
162 179 date: Thu Jan 01 00:00:00 1970 +0000
163 180 summary: ROOT
164 181
165 182 # Simulate split
166 183 $ hg up -r "desc(ROOT)"
167 184 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
168 185 $ echo 42 >> a
169 186 $ hg commit -A -m "A0"
170 187 adding a
171 188 created new head
172 189 $ echo 43 >> b
173 190 $ hg commit -A -m "A0"
174 191 adding b
175 192 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
176 193
177 194 $ hg log --hidden -G
178 195 @ changeset: 3:f257fde29c7a
179 196 | tag: tip
180 197 | user: test
181 198 | date: Thu Jan 01 00:00:00 1970 +0000
182 199 | summary: A0
183 200 |
184 201 o changeset: 2:337fec4d2edc
185 202 | parent: 0:ea207398892e
186 203 | user: test
187 204 | date: Thu Jan 01 00:00:00 1970 +0000
188 205 | summary: A0
189 206 |
190 207 | x changeset: 1:471597cad322
191 208 |/ user: test
192 209 | date: Thu Jan 01 00:00:00 1970 +0000
193 210 | summary: A0
194 211 |
195 212 o changeset: 0:ea207398892e
196 213 user: test
197 214 date: Thu Jan 01 00:00:00 1970 +0000
198 215 summary: ROOT
199 216
200 217 Check templates
201 218 ---------------
202 219
203 220 $ hg up 'obsolete()' --hidden
204 221 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 222
206 223 Predecessors template should show current revision as it is the working copy
207 224 $ hg tlog
208 225 o f257fde29c7a
209 226 | Predecessors: 1:471597cad322
210 227 | semi-colon: 1:471597cad322
211 228 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
212 229 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
213 230 o 337fec4d2edc
214 231 | Predecessors: 1:471597cad322
215 232 | semi-colon: 1:471597cad322
216 233 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
217 234 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
218 235 | @ 471597cad322
219 |/
236 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
237 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
238 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
220 239 o ea207398892e
221 240
222 241 $ hg up f257fde29c7a
223 242 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 243
225 244 Predecessors template should not show a predecessor as it's not displayed in
226 245 the log
227 246 $ hg tlog
228 247 @ f257fde29c7a
229 248 |
230 249 o 337fec4d2edc
231 250 |
232 251 o ea207398892e
233 252
234 253 Predecessors template should show both predecessors as we force their display
235 254 with --hidden
236 255 $ hg tlog --hidden
237 256 @ f257fde29c7a
238 257 | Predecessors: 1:471597cad322
239 258 | semi-colon: 1:471597cad322
240 259 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
241 260 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
242 261 o 337fec4d2edc
243 262 | Predecessors: 1:471597cad322
244 263 | semi-colon: 1:471597cad322
245 264 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
246 265 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
247 266 | x 471597cad322
248 |/
267 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
268 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
269 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
249 270 o ea207398892e
250 271
251 272 Test templates with folded commit
252 273 =================================
253 274
254 275 Test setup
255 276 ----------
256 277
257 278 $ hg init $TESTTMP/templates-local-fold
258 279 $ cd $TESTTMP/templates-local-fold
259 280 $ mkcommit ROOT
260 281 $ mkcommit A0
261 282 $ mkcommit B0
262 283 $ hg log --hidden -G
263 284 @ changeset: 2:0dec01379d3b
264 285 | tag: tip
265 286 | user: test
266 287 | date: Thu Jan 01 00:00:00 1970 +0000
267 288 | summary: B0
268 289 |
269 290 o changeset: 1:471f378eab4c
270 291 | user: test
271 292 | date: Thu Jan 01 00:00:00 1970 +0000
272 293 | summary: A0
273 294 |
274 295 o changeset: 0:ea207398892e
275 296 user: test
276 297 date: Thu Jan 01 00:00:00 1970 +0000
277 298 summary: ROOT
278 299
279 300 Simulate a fold
280 301 $ hg up -r "desc(ROOT)"
281 302 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
282 303 $ echo "A0" > A0
283 304 $ echo "B0" > B0
284 305 $ hg commit -A -m "C0"
285 306 adding A0
286 307 adding B0
287 308 created new head
288 309 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
289 310 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
290 311
291 312 $ hg log --hidden -G
292 313 @ changeset: 3:eb5a0daa2192
293 314 | tag: tip
294 315 | parent: 0:ea207398892e
295 316 | user: test
296 317 | date: Thu Jan 01 00:00:00 1970 +0000
297 318 | summary: C0
298 319 |
299 320 | x changeset: 2:0dec01379d3b
300 321 | | user: test
301 322 | | date: Thu Jan 01 00:00:00 1970 +0000
302 323 | | summary: B0
303 324 | |
304 325 | x changeset: 1:471f378eab4c
305 326 |/ user: test
306 327 | date: Thu Jan 01 00:00:00 1970 +0000
307 328 | summary: A0
308 329 |
309 330 o changeset: 0:ea207398892e
310 331 user: test
311 332 date: Thu Jan 01 00:00:00 1970 +0000
312 333 summary: ROOT
313 334
314 335 Check templates
315 336 ---------------
316 337
317 338 $ hg up 'desc(A0)' --hidden
318 339 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
319 340
320 341 Predecessors template should show current revision as it is the working copy
321 342 $ hg tlog
322 343 o eb5a0daa2192
323 344 | Predecessors: 1:471f378eab4c
324 345 | semi-colon: 1:471f378eab4c
325 346 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
326 347 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
327 348 | @ 471f378eab4c
328 |/
349 |/ Successors: 3:eb5a0daa2192
350 | multi-line: 3:eb5a0daa2192
351 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
329 352 o ea207398892e
330 353
331 354 $ hg up 'desc(B0)' --hidden
332 355 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 356
334 357 Predecessors template should show both predecessors as they should be both
335 358 displayed
336 359 $ hg tlog
337 360 o eb5a0daa2192
338 361 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
339 362 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
340 363 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
341 364 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
342 365 | @ 0dec01379d3b
343 | |
366 | | Successors: 3:eb5a0daa2192
367 | | multi-line: 3:eb5a0daa2192
368 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
344 369 | x 471f378eab4c
345 |/
370 |/ Successors: 3:eb5a0daa2192
371 | multi-line: 3:eb5a0daa2192
372 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
346 373 o ea207398892e
347 374
348 375 $ hg up 'desc(C0)'
349 376 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
350 377
351 378 Predecessors template should not show predecessors as they are not displayed in
352 379 the log
353 380 $ hg tlog
354 381 @ eb5a0daa2192
355 382 |
356 383 o ea207398892e
357 384
358 385 Predecessors template should show both predecessors as we force their display
359 386 with --hidden
360 387 $ hg tlog --hidden
361 388 @ eb5a0daa2192
362 389 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
363 390 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
364 391 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
365 392 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
366 393 | x 0dec01379d3b
367 | |
394 | | Successors: 3:eb5a0daa2192
395 | | multi-line: 3:eb5a0daa2192
396 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
368 397 | x 471f378eab4c
369 |/
398 |/ Successors: 3:eb5a0daa2192
399 | multi-line: 3:eb5a0daa2192
400 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
370 401 o ea207398892e
371 402
372 403
373 404 Test templates with divergence
374 405 ==============================
375 406
376 407 Test setup
377 408 ----------
378 409
379 410 $ hg init $TESTTMP/templates-local-divergence
380 411 $ cd $TESTTMP/templates-local-divergence
381 412 $ mkcommit ROOT
382 413 $ mkcommit A0
383 414 $ hg commit --amend -m "A1"
384 415 $ hg log --hidden -G
385 416 @ changeset: 2:fdf9bde5129a
386 417 | tag: tip
387 418 | parent: 0:ea207398892e
388 419 | user: test
389 420 | date: Thu Jan 01 00:00:00 1970 +0000
390 421 | summary: A1
391 422 |
392 423 | x changeset: 1:471f378eab4c
393 424 |/ user: test
394 425 | date: Thu Jan 01 00:00:00 1970 +0000
395 426 | summary: A0
396 427 |
397 428 o changeset: 0:ea207398892e
398 429 user: test
399 430 date: Thu Jan 01 00:00:00 1970 +0000
400 431 summary: ROOT
401 432
402 433 $ hg update --hidden 'desc(A0)'
403 434 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
404 435 $ hg commit --amend -m "A2"
405 436 $ hg log --hidden -G
406 437 @ changeset: 3:65b757b745b9
407 438 | tag: tip
408 439 | parent: 0:ea207398892e
409 440 | user: test
410 441 | date: Thu Jan 01 00:00:00 1970 +0000
411 442 | trouble: divergent
412 443 | summary: A2
413 444 |
414 445 | o changeset: 2:fdf9bde5129a
415 446 |/ parent: 0:ea207398892e
416 447 | user: test
417 448 | date: Thu Jan 01 00:00:00 1970 +0000
418 449 | trouble: divergent
419 450 | summary: A1
420 451 |
421 452 | x changeset: 1:471f378eab4c
422 453 |/ user: test
423 454 | date: Thu Jan 01 00:00:00 1970 +0000
424 455 | summary: A0
425 456 |
426 457 o changeset: 0:ea207398892e
427 458 user: test
428 459 date: Thu Jan 01 00:00:00 1970 +0000
429 460 summary: ROOT
430 461
431 462 $ hg commit --amend -m 'A3'
432 463 $ hg log --hidden -G
433 464 @ changeset: 4:019fadeab383
434 465 | tag: tip
435 466 | parent: 0:ea207398892e
436 467 | user: test
437 468 | date: Thu Jan 01 00:00:00 1970 +0000
438 469 | trouble: divergent
439 470 | summary: A3
440 471 |
441 472 | x changeset: 3:65b757b745b9
442 473 |/ parent: 0:ea207398892e
443 474 | user: test
444 475 | date: Thu Jan 01 00:00:00 1970 +0000
445 476 | summary: A2
446 477 |
447 478 | o changeset: 2:fdf9bde5129a
448 479 |/ parent: 0:ea207398892e
449 480 | user: test
450 481 | date: Thu Jan 01 00:00:00 1970 +0000
451 482 | trouble: divergent
452 483 | summary: A1
453 484 |
454 485 | x changeset: 1:471f378eab4c
455 486 |/ user: test
456 487 | date: Thu Jan 01 00:00:00 1970 +0000
457 488 | summary: A0
458 489 |
459 490 o changeset: 0:ea207398892e
460 491 user: test
461 492 date: Thu Jan 01 00:00:00 1970 +0000
462 493 summary: ROOT
463 494
464 495
465 496 Check templates
466 497 ---------------
467 498
468 499 $ hg up 'desc(A0)' --hidden
469 500 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 501
471 502 Predecessors template should show current revision as it is the working copy
472 503 $ hg tlog
473 504 o 019fadeab383
474 505 | Predecessors: 1:471f378eab4c
475 506 | semi-colon: 1:471f378eab4c
476 507 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
477 508 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
478 509 | o fdf9bde5129a
479 510 |/ Predecessors: 1:471f378eab4c
480 511 | semi-colon: 1:471f378eab4c
481 512 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
482 513 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
483 514 | @ 471f378eab4c
484 |/
515 |/ Successors: 2:fdf9bde5129a; 4:019fadeab383
516 | multi-line: 2:fdf9bde5129a
517 | multi-line: 4:019fadeab383
518 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
485 519 o ea207398892e
486 520
487 521 $ hg up 'desc(A1)'
488 522 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 523
490 524 Predecessors template should not show predecessors as they are not displayed in
491 525 the log
492 526 $ hg tlog
493 527 o 019fadeab383
494 528 |
495 529 | @ fdf9bde5129a
496 530 |/
497 531 o ea207398892e
498 532
499 533 Predecessors template should the predecessors as we force their display with
500 534 --hidden
501 535 $ hg tlog --hidden
502 536 o 019fadeab383
503 537 | Predecessors: 3:65b757b745b9
504 538 | semi-colon: 3:65b757b745b9
505 539 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
506 540 | map: 3:65b757b745b935093c87a2bccd877521cccffcbd
507 541 | x 65b757b745b9
508 542 |/ Predecessors: 1:471f378eab4c
509 543 | semi-colon: 1:471f378eab4c
510 544 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
511 545 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
546 | Successors: 4:019fadeab383
547 | multi-line: 4:019fadeab383
548 | json: [["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
512 549 | @ fdf9bde5129a
513 550 |/ Predecessors: 1:471f378eab4c
514 551 | semi-colon: 1:471f378eab4c
515 552 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
516 553 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
517 554 | x 471f378eab4c
518 |/
555 |/ Successors: 2:fdf9bde5129a; 3:65b757b745b9
556 | multi-line: 2:fdf9bde5129a
557 | multi-line: 3:65b757b745b9
558 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["65b757b745b935093c87a2bccd877521cccffcbd"]]
519 559 o ea207398892e
520 560
521 561
522 562 Test templates with amended + folded commit
523 563 ===========================================
524 564
525 565 Test setup
526 566 ----------
527 567
528 568 $ hg init $TESTTMP/templates-local-amend-fold
529 569 $ cd $TESTTMP/templates-local-amend-fold
530 570 $ mkcommit ROOT
531 571 $ mkcommit A0
532 572 $ mkcommit B0
533 573 $ hg commit --amend -m "B1"
534 574 $ hg log --hidden -G
535 575 @ changeset: 3:b7ea6d14e664
536 576 | tag: tip
537 577 | parent: 1:471f378eab4c
538 578 | user: test
539 579 | date: Thu Jan 01 00:00:00 1970 +0000
540 580 | summary: B1
541 581 |
542 582 | x changeset: 2:0dec01379d3b
543 583 |/ user: test
544 584 | date: Thu Jan 01 00:00:00 1970 +0000
545 585 | summary: B0
546 586 |
547 587 o changeset: 1:471f378eab4c
548 588 | user: test
549 589 | date: Thu Jan 01 00:00:00 1970 +0000
550 590 | summary: A0
551 591 |
552 592 o changeset: 0:ea207398892e
553 593 user: test
554 594 date: Thu Jan 01 00:00:00 1970 +0000
555 595 summary: ROOT
556 596
557 597 # Simulate a fold
558 598 $ hg up -r "desc(ROOT)"
559 599 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
560 600 $ echo "A0" > A0
561 601 $ echo "B0" > B0
562 602 $ hg commit -A -m "C0"
563 603 adding A0
564 604 adding B0
565 605 created new head
566 606 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
567 607 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
568 608
569 609 $ hg log --hidden -G
570 610 @ changeset: 4:eb5a0daa2192
571 611 | tag: tip
572 612 | parent: 0:ea207398892e
573 613 | user: test
574 614 | date: Thu Jan 01 00:00:00 1970 +0000
575 615 | summary: C0
576 616 |
577 617 | x changeset: 3:b7ea6d14e664
578 618 | | parent: 1:471f378eab4c
579 619 | | user: test
580 620 | | date: Thu Jan 01 00:00:00 1970 +0000
581 621 | | summary: B1
582 622 | |
583 623 | | x changeset: 2:0dec01379d3b
584 624 | |/ user: test
585 625 | | date: Thu Jan 01 00:00:00 1970 +0000
586 626 | | summary: B0
587 627 | |
588 628 | x changeset: 1:471f378eab4c
589 629 |/ user: test
590 630 | date: Thu Jan 01 00:00:00 1970 +0000
591 631 | summary: A0
592 632 |
593 633 o changeset: 0:ea207398892e
594 634 user: test
595 635 date: Thu Jan 01 00:00:00 1970 +0000
596 636 summary: ROOT
597 637
598 638 Check templates
599 639 ---------------
600 640
601 641 $ hg up 'desc(A0)' --hidden
602 642 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
603 643
604 644 Predecessors template should show current revision as it is the working copy
605 645 $ hg tlog
606 646 o eb5a0daa2192
607 647 | Predecessors: 1:471f378eab4c
608 648 | semi-colon: 1:471f378eab4c
609 649 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
610 650 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
611 651 | @ 471f378eab4c
612 |/
652 |/ Successors: 4:eb5a0daa2192
653 | multi-line: 4:eb5a0daa2192
654 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
613 655 o ea207398892e
614 656
615 657 $ hg up 'desc(B0)' --hidden
616 658 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
617 659
618 660 Predecessors template should both predecessors as they are visible
619 661 $ hg tlog
620 662 o eb5a0daa2192
621 663 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
622 664 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
623 665 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
624 666 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
625 667 | @ 0dec01379d3b
626 | |
668 | | Successors: 4:eb5a0daa2192
669 | | multi-line: 4:eb5a0daa2192
670 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
627 671 | x 471f378eab4c
628 |/
672 |/ Successors: 4:eb5a0daa2192
673 | multi-line: 4:eb5a0daa2192
674 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
629 675 o ea207398892e
630 676
631 677 $ hg up 'desc(B1)' --hidden
632 678 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
633 679
634 680 Predecessors template should both predecessors as they are visible
635 681 $ hg tlog
636 682 o eb5a0daa2192
637 683 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
638 684 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
639 685 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
640 686 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
641 687 | @ b7ea6d14e664
642 | |
688 | | Successors: 4:eb5a0daa2192
689 | | multi-line: 4:eb5a0daa2192
690 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
643 691 | x 471f378eab4c
644 |/
692 |/ Successors: 4:eb5a0daa2192
693 | multi-line: 4:eb5a0daa2192
694 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
645 695 o ea207398892e
646 696
647 697 $ hg up 'desc(C0)'
648 698 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
649 699
650 700 Predecessors template should show no predecessors as they are both non visible
651 701 $ hg tlog
652 702 @ eb5a0daa2192
653 703 |
654 704 o ea207398892e
655 705
656 706 Predecessors template should show all predecessors as we force their display
657 707 with --hidden
658 708 $ hg tlog --hidden
659 709 @ eb5a0daa2192
660 710 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
661 711 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
662 712 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
663 713 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
664 714 | x b7ea6d14e664
665 715 | | Predecessors: 2:0dec01379d3b
666 716 | | semi-colon: 2:0dec01379d3b
667 717 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
668 718 | | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
719 | | Successors: 4:eb5a0daa2192
720 | | multi-line: 4:eb5a0daa2192
721 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
669 722 | | x 0dec01379d3b
670 | |/
723 | |/ Successors: 3:b7ea6d14e664
724 | | multi-line: 3:b7ea6d14e664
725 | | json: [["b7ea6d14e664bdc8922221f7992631b50da3fb07"]]
671 726 | x 471f378eab4c
672 |/
727 |/ Successors: 4:eb5a0daa2192
728 | multi-line: 4:eb5a0daa2192
729 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
673 730 o ea207398892e
674 731
675 732
676 733 Test template with pushed and pulled obs markers
677 734 ================================================
678 735
679 736 Test setup
680 737 ----------
681 738
682 739 $ hg init $TESTTMP/templates-local-remote-markers-1
683 740 $ cd $TESTTMP/templates-local-remote-markers-1
684 741 $ mkcommit ROOT
685 742 $ mkcommit A0
686 743 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
687 744 updating to branch default
688 745 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
689 746 $ cd $TESTTMP/templates-local-remote-markers-2
690 747 $ hg log --hidden -G
691 748 @ changeset: 1:471f378eab4c
692 749 | tag: tip
693 750 | user: test
694 751 | date: Thu Jan 01 00:00:00 1970 +0000
695 752 | summary: A0
696 753 |
697 754 o changeset: 0:ea207398892e
698 755 user: test
699 756 date: Thu Jan 01 00:00:00 1970 +0000
700 757 summary: ROOT
701 758
702 759 $ cd $TESTTMP/templates-local-remote-markers-1
703 760 $ hg commit --amend -m "A1"
704 761 $ hg commit --amend -m "A2"
705 762 $ hg log --hidden -G
706 763 @ changeset: 3:7a230b46bf61
707 764 | tag: tip
708 765 | parent: 0:ea207398892e
709 766 | user: test
710 767 | date: Thu Jan 01 00:00:00 1970 +0000
711 768 | summary: A2
712 769 |
713 770 | x changeset: 2:fdf9bde5129a
714 771 |/ parent: 0:ea207398892e
715 772 | user: test
716 773 | date: Thu Jan 01 00:00:00 1970 +0000
717 774 | summary: A1
718 775 |
719 776 | x changeset: 1:471f378eab4c
720 777 |/ user: test
721 778 | date: Thu Jan 01 00:00:00 1970 +0000
722 779 | summary: A0
723 780 |
724 781 o changeset: 0:ea207398892e
725 782 user: test
726 783 date: Thu Jan 01 00:00:00 1970 +0000
727 784 summary: ROOT
728 785
729 786 $ cd $TESTTMP/templates-local-remote-markers-2
730 787 $ hg pull
731 788 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
732 789 searching for changes
733 790 adding changesets
734 791 adding manifests
735 792 adding file changes
736 793 added 1 changesets with 0 changes to 1 files (+1 heads)
737 794 2 new obsolescence markers
738 795 obsoleted 1 changesets
739 796 (run 'hg heads' to see heads, 'hg merge' to merge)
740 797 $ hg log --hidden -G
741 798 o changeset: 2:7a230b46bf61
742 799 | tag: tip
743 800 | parent: 0:ea207398892e
744 801 | user: test
745 802 | date: Thu Jan 01 00:00:00 1970 +0000
746 803 | summary: A2
747 804 |
748 805 | @ changeset: 1:471f378eab4c
749 806 |/ user: test
750 807 | date: Thu Jan 01 00:00:00 1970 +0000
751 808 | summary: A0
752 809 |
753 810 o changeset: 0:ea207398892e
754 811 user: test
755 812 date: Thu Jan 01 00:00:00 1970 +0000
756 813 summary: ROOT
757 814
758 815
759 816 $ hg debugobsolete
760 817 471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
761 818 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
762 819
763 820 Check templates
764 821 ---------------
765 822
766 823 Predecessors template should show current revision as it is the working copy
767 824 $ hg tlog
768 825 o 7a230b46bf61
769 826 | Predecessors: 1:471f378eab4c
770 827 | semi-colon: 1:471f378eab4c
771 828 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
772 829 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
773 830 | @ 471f378eab4c
774 |/
831 |/ Successors: 2:7a230b46bf61
832 | multi-line: 2:7a230b46bf61
833 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
775 834 o ea207398892e
776 835
777 836 $ hg up 'desc(A2)'
778 837 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 838
780 839 Predecessors template should show no predecessors as they are non visible
781 840 $ hg tlog
782 841 @ 7a230b46bf61
783 842 |
784 843 o ea207398892e
785 844
786 845 Predecessors template should show all predecessors as we force their display
787 846 with --hidden
788 847 $ hg tlog --hidden
789 848 @ 7a230b46bf61
790 849 | Predecessors: 1:471f378eab4c
791 850 | semi-colon: 1:471f378eab4c
792 851 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
793 852 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
794 853 | x 471f378eab4c
795 |/
854 |/ Successors: 2:7a230b46bf61
855 | multi-line: 2:7a230b46bf61
856 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
796 857 o ea207398892e
797 858
798 859
799 860 Test template with obsmarkers cycle
800 861 ===================================
801 862
802 863 Test setup
803 864 ----------
804 865
805 866 $ hg init $TESTTMP/templates-local-cycle
806 867 $ cd $TESTTMP/templates-local-cycle
807 868 $ mkcommit ROOT
808 869 $ mkcommit A0
809 870 $ mkcommit B0
810 871 $ hg up -r 0
811 872 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
812 873 $ mkcommit C0
813 874 created new head
814 875
815 876 Create the cycle
816 877
817 878 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
818 879 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
819 880 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
820 881
821 882 Check templates
822 883 ---------------
823 884
824 885 $ hg tlog
825 886 @ f897c6137566
826 887 |
827 888 o ea207398892e
828 889
829 890
830 891 $ hg up -r "desc(B0)" --hidden
831 892 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
832 893 $ hg tlog
833 894 o f897c6137566
834 895 | Predecessors: 2:0dec01379d3b
835 896 | semi-colon: 2:0dec01379d3b
836 897 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
837 898 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
838 899 | @ 0dec01379d3b
839 900 | | Predecessors: 1:471f378eab4c
840 901 | | semi-colon: 1:471f378eab4c
841 902 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
842 903 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
904 | | Successors: 3:f897c6137566; 1:471f378eab4c
905 | | multi-line: 3:f897c6137566
906 | | multi-line: 1:471f378eab4c
907 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
843 908 | x 471f378eab4c
844 909 |/ Predecessors: 2:0dec01379d3b
845 910 | semi-colon: 2:0dec01379d3b
846 911 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
847 912 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
913 | Successors: 2:0dec01379d3b
914 | multi-line: 2:0dec01379d3b
915 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
848 916 o ea207398892e
849 917
850 918
851 919 $ hg up -r "desc(A0)" --hidden
852 920 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
853 921 $ hg tlog
854 922 o f897c6137566
855 923 | Predecessors: 1:471f378eab4c
856 924 | semi-colon: 1:471f378eab4c
857 925 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
858 926 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
859 927 | @ 471f378eab4c
860 928 |/
861 929 o ea207398892e
862 930
863 931
864 932 $ hg up -r "desc(ROOT)" --hidden
865 933 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
866 934 $ hg tlog
867 935 o f897c6137566
868 936 |
869 937 @ ea207398892e
870 938
871 939
872 940 $ hg tlog --hidden
873 941 o f897c6137566
874 942 | Predecessors: 2:0dec01379d3b
875 943 | semi-colon: 2:0dec01379d3b
876 944 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
877 945 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
878 946 | x 0dec01379d3b
879 947 | | Predecessors: 1:471f378eab4c
880 948 | | semi-colon: 1:471f378eab4c
881 949 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
882 950 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
951 | | Successors: 3:f897c6137566; 1:471f378eab4c
952 | | multi-line: 3:f897c6137566
953 | | multi-line: 1:471f378eab4c
954 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
883 955 | x 471f378eab4c
884 956 |/ Predecessors: 2:0dec01379d3b
885 957 | semi-colon: 2:0dec01379d3b
886 958 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
887 959 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
960 | Successors: 2:0dec01379d3b
961 | multi-line: 2:0dec01379d3b
962 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
888 963 @ ea207398892e
889 964
890 965 Test template with split + divergence with cycles
891 966 =================================================
892 967
893 968 $ hg log -G
894 969 o changeset: 3:f897c6137566
895 970 | tag: tip
896 971 | parent: 0:ea207398892e
897 972 | user: test
898 973 | date: Thu Jan 01 00:00:00 1970 +0000
899 974 | summary: C0
900 975 |
901 976 @ changeset: 0:ea207398892e
902 977 user: test
903 978 date: Thu Jan 01 00:00:00 1970 +0000
904 979 summary: ROOT
905 980
906 981 $ hg up
907 982 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
908 983
909 984 Create a commit with three files
910 985 $ touch A B C
911 986 $ hg commit -A -m "Add A,B,C" A B C
912 987
913 988 Split it
914 989 $ hg up 3
915 990 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
916 991 $ touch A
917 992 $ hg commit -A -m "Add A,B,C" A
918 993 created new head
919 994
920 995 $ touch B
921 996 $ hg commit -A -m "Add A,B,C" B
922 997
923 998 $ touch C
924 999 $ hg commit -A -m "Add A,B,C" C
925 1000
926 1001 $ hg log -G
927 1002 @ changeset: 7:ba2ed02b0c9a
928 1003 | tag: tip
929 1004 | user: test
930 1005 | date: Thu Jan 01 00:00:00 1970 +0000
931 1006 | summary: Add A,B,C
932 1007 |
933 1008 o changeset: 6:4a004186e638
934 1009 | user: test
935 1010 | date: Thu Jan 01 00:00:00 1970 +0000
936 1011 | summary: Add A,B,C
937 1012 |
938 1013 o changeset: 5:dd800401bd8c
939 1014 | parent: 3:f897c6137566
940 1015 | user: test
941 1016 | date: Thu Jan 01 00:00:00 1970 +0000
942 1017 | summary: Add A,B,C
943 1018 |
944 1019 | o changeset: 4:9bd10a0775e4
945 1020 |/ user: test
946 1021 | date: Thu Jan 01 00:00:00 1970 +0000
947 1022 | summary: Add A,B,C
948 1023 |
949 1024 o changeset: 3:f897c6137566
950 1025 | parent: 0:ea207398892e
951 1026 | user: test
952 1027 | date: Thu Jan 01 00:00:00 1970 +0000
953 1028 | summary: C0
954 1029 |
955 1030 o changeset: 0:ea207398892e
956 1031 user: test
957 1032 date: Thu Jan 01 00:00:00 1970 +0000
958 1033 summary: ROOT
959 1034
960 1035 $ hg debugobsolete `getid "4"` `getid "5"` `getid "6"` `getid "7"`
961 1036 $ hg log -G
962 1037 @ changeset: 7:ba2ed02b0c9a
963 1038 | tag: tip
964 1039 | user: test
965 1040 | date: Thu Jan 01 00:00:00 1970 +0000
966 1041 | summary: Add A,B,C
967 1042 |
968 1043 o changeset: 6:4a004186e638
969 1044 | user: test
970 1045 | date: Thu Jan 01 00:00:00 1970 +0000
971 1046 | summary: Add A,B,C
972 1047 |
973 1048 o changeset: 5:dd800401bd8c
974 1049 | parent: 3:f897c6137566
975 1050 | user: test
976 1051 | date: Thu Jan 01 00:00:00 1970 +0000
977 1052 | summary: Add A,B,C
978 1053 |
979 1054 o changeset: 3:f897c6137566
980 1055 | parent: 0:ea207398892e
981 1056 | user: test
982 1057 | date: Thu Jan 01 00:00:00 1970 +0000
983 1058 | summary: C0
984 1059 |
985 1060 o changeset: 0:ea207398892e
986 1061 user: test
987 1062 date: Thu Jan 01 00:00:00 1970 +0000
988 1063 summary: ROOT
989 1064
990 1065 Diverge one of the splitted commit
991 1066
992 1067 $ hg up 6
993 1068 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
994 1069 $ hg commit --amend -m "Add only B"
995 1070
996 1071 $ hg up 6 --hidden
997 1072 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
998 1073 $ hg commit --amend -m "Add B only"
999 1074
1000 1075 $ hg log -G
1001 1076 @ changeset: 9:0b997eb7ceee
1002 1077 | tag: tip
1003 1078 | parent: 5:dd800401bd8c
1004 1079 | user: test
1005 1080 | date: Thu Jan 01 00:00:00 1970 +0000
1006 1081 | trouble: divergent
1007 1082 | summary: Add B only
1008 1083 |
1009 1084 | o changeset: 8:b18bc8331526
1010 1085 |/ parent: 5:dd800401bd8c
1011 1086 | user: test
1012 1087 | date: Thu Jan 01 00:00:00 1970 +0000
1013 1088 | trouble: divergent
1014 1089 | summary: Add only B
1015 1090 |
1016 1091 | o changeset: 7:ba2ed02b0c9a
1017 1092 | | user: test
1018 1093 | | date: Thu Jan 01 00:00:00 1970 +0000
1019 1094 | | trouble: unstable, divergent
1020 1095 | | summary: Add A,B,C
1021 1096 | |
1022 1097 | x changeset: 6:4a004186e638
1023 1098 |/ user: test
1024 1099 | date: Thu Jan 01 00:00:00 1970 +0000
1025 1100 | summary: Add A,B,C
1026 1101 |
1027 1102 o changeset: 5:dd800401bd8c
1028 1103 | parent: 3:f897c6137566
1029 1104 | user: test
1030 1105 | date: Thu Jan 01 00:00:00 1970 +0000
1031 1106 | trouble: divergent
1032 1107 | summary: Add A,B,C
1033 1108 |
1034 1109 o changeset: 3:f897c6137566
1035 1110 | parent: 0:ea207398892e
1036 1111 | user: test
1037 1112 | date: Thu Jan 01 00:00:00 1970 +0000
1038 1113 | summary: C0
1039 1114 |
1040 1115 o changeset: 0:ea207398892e
1041 1116 user: test
1042 1117 date: Thu Jan 01 00:00:00 1970 +0000
1043 1118 summary: ROOT
1044 1119
1045 1120
1046 1121 Check templates
1047 1122 ---------------
1048 1123
1049 1124 $ hg tlog
1050 1125 @ 0b997eb7ceee
1051 1126 | Predecessors: 6:4a004186e638
1052 1127 | semi-colon: 6:4a004186e638
1053 1128 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1054 1129 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1055 1130 | o b18bc8331526
1056 1131 |/ Predecessors: 6:4a004186e638
1057 1132 | semi-colon: 6:4a004186e638
1058 1133 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1059 1134 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1060 1135 | o ba2ed02b0c9a
1061 1136 | |
1062 1137 | x 4a004186e638
1063 |/
1138 |/ Successors: 8:b18bc8331526; 9:0b997eb7ceee
1139 | multi-line: 8:b18bc8331526
1140 | multi-line: 9:0b997eb7ceee
1141 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1064 1142 o dd800401bd8c
1065 1143 |
1066 1144 o f897c6137566
1067 1145 |
1068 1146 o ea207398892e
1069 1147
1070 1148 $ hg tlog --hidden
1071 1149 @ 0b997eb7ceee
1072 1150 | Predecessors: 6:4a004186e638
1073 1151 | semi-colon: 6:4a004186e638
1074 1152 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1075 1153 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1076 1154 | o b18bc8331526
1077 1155 |/ Predecessors: 6:4a004186e638
1078 1156 | semi-colon: 6:4a004186e638
1079 1157 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1080 1158 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1081 1159 | o ba2ed02b0c9a
1082 1160 | | Predecessors: 4:9bd10a0775e4
1083 1161 | | semi-colon: 4:9bd10a0775e4
1084 1162 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1085 1163 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1086 1164 | x 4a004186e638
1087 1165 |/ Predecessors: 4:9bd10a0775e4
1088 1166 | semi-colon: 4:9bd10a0775e4
1089 1167 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1090 1168 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1169 | Successors: 8:b18bc8331526; 9:0b997eb7ceee
1170 | multi-line: 8:b18bc8331526
1171 | multi-line: 9:0b997eb7ceee
1172 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1091 1173 o dd800401bd8c
1092 1174 | Predecessors: 4:9bd10a0775e4
1093 1175 | semi-colon: 4:9bd10a0775e4
1094 1176 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1095 1177 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1096 1178 | x 9bd10a0775e4
1097 |/
1179 |/ Successors: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1180 | multi-line: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1181 | json: [["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]]
1098 1182 o f897c6137566
1099 1183 | Predecessors: 2:0dec01379d3b
1100 1184 | semi-colon: 2:0dec01379d3b
1101 1185 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1102 1186 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1103 1187 | x 0dec01379d3b
1104 1188 | | Predecessors: 1:471f378eab4c
1105 1189 | | semi-colon: 1:471f378eab4c
1106 1190 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1107 1191 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1192 | | Successors: 3:f897c6137566; 1:471f378eab4c
1193 | | multi-line: 3:f897c6137566
1194 | | multi-line: 1:471f378eab4c
1195 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1108 1196 | x 471f378eab4c
1109 1197 |/ Predecessors: 2:0dec01379d3b
1110 1198 | semi-colon: 2:0dec01379d3b
1111 1199 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1112 1200 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1201 | Successors: 2:0dec01379d3b
1202 | multi-line: 2:0dec01379d3b
1203 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1113 1204 o ea207398892e
1114 1205
1115 1206 $ hg up --hidden 4
1116 1207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1117 1208 $ hg rebase -r 7 -d 8 --config extensions.rebase=
1118 1209 rebasing 7:ba2ed02b0c9a "Add A,B,C"
1119 1210 $ hg tlog
1120 1211 o eceed8f98ffc
1121 1212 | Predecessors: 4:9bd10a0775e4
1122 1213 | semi-colon: 4:9bd10a0775e4
1123 1214 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1124 1215 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1125 1216 | o 0b997eb7ceee
1126 1217 | | Predecessors: 4:9bd10a0775e4
1127 1218 | | semi-colon: 4:9bd10a0775e4
1128 1219 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1129 1220 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1130 1221 o | b18bc8331526
1131 1222 |/ Predecessors: 4:9bd10a0775e4
1132 1223 | semi-colon: 4:9bd10a0775e4
1133 1224 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1134 1225 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1135 1226 o dd800401bd8c
1136 1227 | Predecessors: 4:9bd10a0775e4
1137 1228 | semi-colon: 4:9bd10a0775e4
1138 1229 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1139 1230 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1140 1231 | @ 9bd10a0775e4
1141 |/
1232 |/ Successors: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1233 | multi-line: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc
1234 | multi-line: 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1235 | json: [["dd800401bd8c79d815329277739e433e883f784e", "0b997eb7ceeee06200a02f8aab185979092d514e", "eceed8f98ffc4186032e29a6542ab98888ebf68d"], ["dd800401bd8c79d815329277739e433e883f784e", "b18bc8331526a22cbb1801022bd1555bf291c48b", "eceed8f98ffc4186032e29a6542ab98888ebf68d"]]
1142 1236 o f897c6137566
1143 1237 |
1144 1238 o ea207398892e
1145 1239
1146 1240 Test templates with pruned commits
1147 1241 ==================================
1148 1242
1149 1243 Test setup
1150 1244 ----------
1151 1245
1152 1246 $ hg init $TESTTMP/templates-local-prune
1153 1247 $ cd $TESTTMP/templates-local-prune
1154 1248 $ mkcommit ROOT
1155 1249 $ mkcommit A0
1156 1250 $ hg debugobsolete --record-parent `getid "."`
1157 1251
1158 1252 Check output
1159 1253 ------------
1160 1254
1161 1255 $ hg up "desc(A0)" --hidden
1162 1256 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1163 1257 $ hg tlog
1164 1258 @ 471f378eab4c
1165 1259 |
1166 1260 o ea207398892e
1167 1261
General Comments 0
You need to be logged in to leave comments. Login now