##// END OF EJS Templates
templatekw: fix inconsistency of diffstat with diff.merge...
pacien -
r52037:9ff3d539 default
parent child Browse files
Show More
@@ -1,1031 +1,1031 b''
1 1 # templatekw.py - common changeset template keywords
2 2 #
3 3 # Copyright 2005-2009 Olivia Mackall <olivia@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
9 9 from .i18n import _
10 10 from .node import (
11 11 hex,
12 12 wdirrev,
13 13 )
14 14
15 15 from . import (
16 16 diffutil,
17 17 encoding,
18 18 error,
19 19 hbisect,
20 20 i18n,
21 21 obsutil,
22 22 patch,
23 23 pycompat,
24 24 registrar,
25 25 scmutil,
26 26 templateutil,
27 27 util,
28 28 )
29 29 from .utils import (
30 30 stringutil,
31 31 urlutil,
32 32 )
33 33
34 34 _hybrid = templateutil.hybrid
35 35 hybriddict = templateutil.hybriddict
36 36 hybridlist = templateutil.hybridlist
37 37 compatdict = templateutil.compatdict
38 38 compatlist = templateutil.compatlist
39 39 _showcompatlist = templateutil._showcompatlist
40 40
41 41
42 42 def getlatesttags(context, mapping, pattern=None):
43 43 '''return date, distance and name for the latest tag of rev'''
44 44 repo = context.resource(mapping, b'repo')
45 45 ctx = context.resource(mapping, b'ctx')
46 46 cache = context.resource(mapping, b'cache')
47 47
48 48 cachename = b'latesttags'
49 49 if pattern is not None:
50 50 cachename += b'-' + pattern
51 51 match = stringutil.stringmatcher(pattern)[2]
52 52 else:
53 53 match = util.always
54 54
55 55 if cachename not in cache:
56 56 # Cache mapping from rev to a tuple with tag date, tag
57 57 # distance and tag name
58 58 cache[cachename] = {-1: (0, 0, [b'null'])}
59 59 latesttags = cache[cachename]
60 60
61 61 rev = ctx.rev()
62 62 todo = [rev]
63 63 while todo:
64 64 rev = todo.pop()
65 65 if rev in latesttags:
66 66 continue
67 67 ctx = repo[rev]
68 68 tags = [
69 69 t
70 70 for t in ctx.tags()
71 71 if (repo.tagtype(t) and repo.tagtype(t) != b'local' and match(t))
72 72 ]
73 73 if tags:
74 74 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
75 75 continue
76 76 try:
77 77 ptags = [latesttags[p.rev()] for p in ctx.parents()]
78 78 if len(ptags) > 1:
79 79 if ptags[0][2] == ptags[1][2]:
80 80 # The tuples are laid out so the right one can be found by
81 81 # comparison in this case.
82 82 pdate, pdist, ptag = max(ptags)
83 83 else:
84 84
85 85 def key(x):
86 86 tag = x[2][0]
87 87 if ctx.rev() is None:
88 88 # only() doesn't support wdir
89 89 prevs = [c.rev() for c in ctx.parents()]
90 90 changes = repo.revs(b'only(%ld, %s)', prevs, tag)
91 91 changessincetag = len(changes) + 1
92 92 else:
93 93 changes = repo.revs(b'only(%d, %s)', ctx.rev(), tag)
94 94 changessincetag = len(changes)
95 95 # Smallest number of changes since tag wins. Date is
96 96 # used as tiebreaker.
97 97 return [-changessincetag, x[0]]
98 98
99 99 pdate, pdist, ptag = max(ptags, key=key)
100 100 else:
101 101 pdate, pdist, ptag = ptags[0]
102 102 except KeyError:
103 103 # Cache miss - recurse
104 104 todo.append(rev)
105 105 todo.extend(p.rev() for p in ctx.parents())
106 106 continue
107 107 latesttags[rev] = pdate, pdist + 1, ptag
108 108 return latesttags[rev]
109 109
110 110
111 111 def getlogcolumns():
112 112 """Return a dict of log column labels"""
113 113 _ = pycompat.identity # temporarily disable gettext
114 114 # i18n: column positioning for "hg log"
115 115 columns = _(
116 116 b'bookmark: %s\n'
117 117 b'branch: %s\n'
118 118 b'changeset: %s\n'
119 119 b'copies: %s\n'
120 120 b'date: %s\n'
121 121 b'extra: %s=%s\n'
122 122 b'files+: %s\n'
123 123 b'files-: %s\n'
124 124 b'files: %s\n'
125 125 b'instability: %s\n'
126 126 b'manifest: %s\n'
127 127 b'obsolete: %s\n'
128 128 b'parent: %s\n'
129 129 b'phase: %s\n'
130 130 b'summary: %s\n'
131 131 b'tag: %s\n'
132 132 b'user: %s\n'
133 133 )
134 134 return dict(
135 135 zip(
136 136 [s.split(b':', 1)[0] for s in columns.splitlines()],
137 137 i18n._(columns).splitlines(True),
138 138 )
139 139 )
140 140
141 141
142 142 # basic internal templates
143 143 _changeidtmpl = b'{rev}:{node|formatnode}'
144 144
145 145 # default templates internally used for rendering of lists
146 146 defaulttempl = {
147 147 b'parent': _changeidtmpl + b' ',
148 148 b'manifest': _changeidtmpl,
149 149 b'file_copy': b'{name} ({source})',
150 150 b'envvar': b'{key}={value}',
151 151 b'extra': b'{key}={value|stringescape}',
152 152 }
153 153 # filecopy is preserved for compatibility reasons
154 154 defaulttempl[b'filecopy'] = defaulttempl[b'file_copy']
155 155
156 156 # keywords are callables (see registrar.templatekeyword for details)
157 157 keywords = {}
158 158 templatekeyword = registrar.templatekeyword(keywords)
159 159
160 160
161 161 @templatekeyword(b'author', requires={b'ctx'})
162 162 def showauthor(context, mapping):
163 163 """Alias for ``{user}``"""
164 164 return showuser(context, mapping)
165 165
166 166
167 167 @templatekeyword(b'bisect', requires={b'repo', b'ctx'})
168 168 def showbisect(context, mapping):
169 169 """String. The changeset bisection status."""
170 170 repo = context.resource(mapping, b'repo')
171 171 ctx = context.resource(mapping, b'ctx')
172 172 return hbisect.label(repo, ctx.node())
173 173
174 174
175 175 @templatekeyword(b'branch', requires={b'ctx'})
176 176 def showbranch(context, mapping):
177 177 """String. The name of the branch on which the changeset was
178 178 committed.
179 179 """
180 180 ctx = context.resource(mapping, b'ctx')
181 181 return ctx.branch()
182 182
183 183
184 184 @templatekeyword(b'branches', requires={b'ctx'})
185 185 def showbranches(context, mapping):
186 186 """List of strings. The name of the branch on which the
187 187 changeset was committed. Will be empty if the branch name was
188 188 default. (DEPRECATED)
189 189 """
190 190 ctx = context.resource(mapping, b'ctx')
191 191 branch = ctx.branch()
192 192 if branch != b'default':
193 193 return compatlist(
194 194 context, mapping, b'branch', [branch], plural=b'branches'
195 195 )
196 196 return compatlist(context, mapping, b'branch', [], plural=b'branches')
197 197
198 198
199 199 @templatekeyword(b'bookmarks', requires={b'repo', b'ctx'})
200 200 def showbookmarks(context, mapping):
201 201 """List of strings. Any bookmarks associated with the
202 202 changeset. Also sets 'active', the name of the active bookmark.
203 203 """
204 204 repo = context.resource(mapping, b'repo')
205 205 ctx = context.resource(mapping, b'ctx')
206 206 bookmarks = ctx.bookmarks()
207 207 active = repo._activebookmark
208 208 makemap = lambda v: {b'bookmark': v, b'active': active, b'current': active}
209 209 f = _showcompatlist(context, mapping, b'bookmark', bookmarks)
210 210 return _hybrid(f, bookmarks, makemap, pycompat.identity)
211 211
212 212
213 213 @templatekeyword(b'children', requires={b'ctx'})
214 214 def showchildren(context, mapping):
215 215 """List of strings. The children of the changeset."""
216 216 ctx = context.resource(mapping, b'ctx')
217 217 childrevs = [b'%d:%s' % (cctx.rev(), cctx) for cctx in ctx.children()]
218 218 return compatlist(
219 219 context, mapping, b'children', childrevs, element=b'child'
220 220 )
221 221
222 222
223 223 # Deprecated, but kept alive for help generation a purpose.
224 224 @templatekeyword(b'currentbookmark', requires={b'repo', b'ctx'})
225 225 def showcurrentbookmark(context, mapping):
226 226 """String. The active bookmark, if it is associated with the changeset.
227 227 (DEPRECATED)"""
228 228 return showactivebookmark(context, mapping)
229 229
230 230
231 231 @templatekeyword(b'activebookmark', requires={b'repo', b'ctx'})
232 232 def showactivebookmark(context, mapping):
233 233 """String. The active bookmark, if it is associated with the changeset."""
234 234 repo = context.resource(mapping, b'repo')
235 235 ctx = context.resource(mapping, b'ctx')
236 236 active = repo._activebookmark
237 237 if active and active in ctx.bookmarks():
238 238 return active
239 239 return b''
240 240
241 241
242 242 @templatekeyword(b'date', requires={b'ctx'})
243 243 def showdate(context, mapping):
244 244 """Date information. The date when the changeset was committed."""
245 245 ctx = context.resource(mapping, b'ctx')
246 246 # the default string format is '<float(unixtime)><tzoffset>' because
247 247 # python-hglib splits date at decimal separator.
248 248 return templateutil.date(ctx.date(), showfmt=b'%d.0%d')
249 249
250 250
251 251 @templatekeyword(b'desc', requires={b'ctx'})
252 252 def showdescription(context, mapping):
253 253 """String. The text of the changeset description."""
254 254 ctx = context.resource(mapping, b'ctx')
255 255 s = ctx.description()
256 256 if isinstance(s, encoding.localstr):
257 257 # try hard to preserve utf-8 bytes
258 258 return encoding.tolocal(encoding.fromlocal(s).strip())
259 259 elif isinstance(s, encoding.safelocalstr):
260 260 return encoding.safelocalstr(s.strip())
261 261 else:
262 262 return s.strip()
263 263
264 264
265 265 @templatekeyword(b'diffstat', requires={b'ui', b'ctx'})
266 266 def showdiffstat(context, mapping):
267 267 """String. Statistics of changes with the following format:
268 268 "modified files: +added/-removed lines"
269 269 """
270 270 ui = context.resource(mapping, b'ui')
271 271 ctx = context.resource(mapping, b'ctx')
272 272 diffopts = diffutil.diffallopts(ui, {b'noprefix': False})
273 diff = ctx.diff(opts=diffopts)
273 diff = ctx.diff(diffutil.diff_parent(ctx), opts=diffopts)
274 274 stats = patch.diffstatdata(util.iterlines(diff))
275 275 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
276 276 return b'%d: +%d/-%d' % (len(stats), adds, removes)
277 277
278 278
279 279 @templatekeyword(b'envvars', requires={b'ui'})
280 280 def showenvvars(context, mapping):
281 281 """A dictionary of environment variables. (EXPERIMENTAL)"""
282 282 ui = context.resource(mapping, b'ui')
283 283 env = ui.exportableenviron()
284 284 env = util.sortdict((k, env[k]) for k in sorted(env))
285 285 return compatdict(context, mapping, b'envvar', env, plural=b'envvars')
286 286
287 287
288 288 @templatekeyword(b'extras', requires={b'ctx'})
289 289 def showextras(context, mapping):
290 290 """List of dicts with key, value entries of the 'extras'
291 291 field of this changeset."""
292 292 ctx = context.resource(mapping, b'ctx')
293 293 extras = ctx.extra()
294 294 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
295 295 makemap = lambda k: {b'key': k, b'value': extras[k]}
296 296 c = [makemap(k) for k in extras]
297 297 f = _showcompatlist(context, mapping, b'extra', c, plural=b'extras')
298 298 return _hybrid(
299 299 f,
300 300 extras,
301 301 makemap,
302 302 lambda k: b'%s=%s' % (k, stringutil.escapestr(extras[k])),
303 303 )
304 304
305 305
306 306 @templatekeyword(b'_fast_rank', requires={b'ctx'})
307 307 def fast_rank(context, mapping):
308 308 """the rank of a changeset if cached
309 309
310 310 The rank of a revision is the size of the sub-graph it defines as a head.
311 311 Equivalently, the rank of a revision `r` is the size of the set
312 312 `ancestors(r)`, `r` included.
313 313 """
314 314 ctx = context.resource(mapping, b'ctx')
315 315 rank = ctx.fast_rank()
316 316 if rank is None:
317 317 return None
318 318 return b"%d" % rank
319 319
320 320
321 321 def _getfilestatus(context, mapping, listall=False):
322 322 ctx = context.resource(mapping, b'ctx')
323 323 revcache = context.resource(mapping, b'revcache')
324 324 if b'filestatus' not in revcache or revcache[b'filestatusall'] < listall:
325 325 stat = ctx.p1().status(
326 326 ctx, listignored=listall, listclean=listall, listunknown=listall
327 327 )
328 328 revcache[b'filestatus'] = stat
329 329 revcache[b'filestatusall'] = listall
330 330 return revcache[b'filestatus']
331 331
332 332
333 333 def _getfilestatusmap(context, mapping, listall=False):
334 334 revcache = context.resource(mapping, b'revcache')
335 335 if b'filestatusmap' not in revcache or revcache[b'filestatusall'] < listall:
336 336 stat = _getfilestatus(context, mapping, listall=listall)
337 337 revcache[b'filestatusmap'] = statmap = {}
338 338 for char, files in zip(pycompat.iterbytestr(b'MAR!?IC'), stat):
339 339 statmap.update((f, char) for f in files)
340 340 return revcache[b'filestatusmap'] # {path: statchar}
341 341
342 342
343 343 @templatekeyword(
344 344 b'file_copies', requires={b'repo', b'ctx', b'cache', b'revcache'}
345 345 )
346 346 def showfilecopies(context, mapping):
347 347 """List of strings. Files copied in this changeset with
348 348 their sources.
349 349 """
350 350 repo = context.resource(mapping, b'repo')
351 351 ctx = context.resource(mapping, b'ctx')
352 352 cache = context.resource(mapping, b'cache')
353 353 copies = context.resource(mapping, b'revcache').get(b'copies')
354 354 if copies is None:
355 355 if b'getcopies' not in cache:
356 356 cache[b'getcopies'] = scmutil.getcopiesfn(repo)
357 357 getcopies = cache[b'getcopies']
358 358 copies = getcopies(ctx)
359 359 return templateutil.compatfilecopiesdict(
360 360 context, mapping, b'file_copy', copies
361 361 )
362 362
363 363
364 364 # showfilecopiesswitch() displays file copies only if copy records are
365 365 # provided before calling the templater, usually with a --copies
366 366 # command line switch.
367 367 @templatekeyword(b'file_copies_switch', requires={b'revcache'})
368 368 def showfilecopiesswitch(context, mapping):
369 369 """List of strings. Like "file_copies" but displayed
370 370 only if the --copied switch is set.
371 371 """
372 372 copies = context.resource(mapping, b'revcache').get(b'copies') or []
373 373 return templateutil.compatfilecopiesdict(
374 374 context, mapping, b'file_copy', copies
375 375 )
376 376
377 377
378 378 @templatekeyword(b'file_adds', requires={b'ctx', b'revcache'})
379 379 def showfileadds(context, mapping):
380 380 """List of strings. Files added by this changeset."""
381 381 ctx = context.resource(mapping, b'ctx')
382 382 return templateutil.compatfileslist(
383 383 context, mapping, b'file_add', ctx.filesadded()
384 384 )
385 385
386 386
387 387 @templatekeyword(b'file_dels', requires={b'ctx', b'revcache'})
388 388 def showfiledels(context, mapping):
389 389 """List of strings. Files removed by this changeset."""
390 390 ctx = context.resource(mapping, b'ctx')
391 391 return templateutil.compatfileslist(
392 392 context, mapping, b'file_del', ctx.filesremoved()
393 393 )
394 394
395 395
396 396 @templatekeyword(b'file_mods', requires={b'ctx', b'revcache'})
397 397 def showfilemods(context, mapping):
398 398 """List of strings. Files modified by this changeset."""
399 399 ctx = context.resource(mapping, b'ctx')
400 400 return templateutil.compatfileslist(
401 401 context, mapping, b'file_mod', ctx.filesmodified()
402 402 )
403 403
404 404
405 405 @templatekeyword(b'files', requires={b'ctx'})
406 406 def showfiles(context, mapping):
407 407 """List of strings. All files modified, added, or removed by this
408 408 changeset.
409 409 """
410 410 ctx = context.resource(mapping, b'ctx')
411 411 return templateutil.compatfileslist(context, mapping, b'file', ctx.files())
412 412
413 413
414 414 @templatekeyword(b'graphnode', requires={b'repo', b'ctx', b'cache'})
415 415 def showgraphnode(context, mapping):
416 416 """String. The character representing the changeset node in an ASCII
417 417 revision graph."""
418 418 repo = context.resource(mapping, b'repo')
419 419 ctx = context.resource(mapping, b'ctx')
420 420 cache = context.resource(mapping, b'cache')
421 421 return getgraphnode(repo, ctx, cache)
422 422
423 423
424 424 def getgraphnode(repo, ctx, cache):
425 425 return getgraphnodecurrent(repo, ctx, cache) or getgraphnodesymbol(ctx)
426 426
427 427
428 428 def getgraphnodecurrent(repo, ctx, cache):
429 429 wpnodes = repo.dirstate.parents()
430 430 if wpnodes[1] == repo.nullid:
431 431 wpnodes = wpnodes[:1]
432 432 if ctx.node() in wpnodes:
433 433 return b'@'
434 434 else:
435 435 merge_nodes = cache.get(b'merge_nodes')
436 436 if merge_nodes is None:
437 437 from . import mergestate as mergestatemod
438 438
439 439 mergestate = mergestatemod.mergestate.read(repo)
440 440 if mergestate.unresolvedcount():
441 441 merge_nodes = (mergestate.local, mergestate.other)
442 442 else:
443 443 merge_nodes = ()
444 444 cache[b'merge_nodes'] = merge_nodes
445 445
446 446 if ctx.node() in merge_nodes:
447 447 return b'%'
448 448 return b''
449 449
450 450
451 451 def getgraphnodesymbol(ctx):
452 452 if ctx.obsolete():
453 453 return b'x'
454 454 elif ctx.isunstable():
455 455 return b'*'
456 456 elif ctx.closesbranch():
457 457 return b'_'
458 458 else:
459 459 return b'o'
460 460
461 461
462 462 @templatekeyword(b'graphwidth', requires=())
463 463 def showgraphwidth(context, mapping):
464 464 """Integer. The width of the graph drawn by 'log --graph' or zero."""
465 465 # just hosts documentation; should be overridden by template mapping
466 466 return 0
467 467
468 468
469 469 @templatekeyword(b'index', requires=())
470 470 def showindex(context, mapping):
471 471 """Integer. The current iteration of the loop. (0 indexed)"""
472 472 # just hosts documentation; should be overridden by template mapping
473 473 raise error.Abort(_(b"can't use index in this context"))
474 474
475 475
476 476 @templatekeyword(b'latesttag', requires={b'repo', b'ctx', b'cache'})
477 477 def showlatesttag(context, mapping):
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(context, mapping, None)
483 483
484 484
485 485 def showlatesttags(context, mapping, pattern):
486 486 """helper method for the latesttag keyword and function"""
487 487 latesttags = getlatesttags(context, mapping, pattern)
488 488
489 489 # latesttag[0] is an implementation detail for sorting csets on different
490 490 # branches in a stable manner- it is the date the tagged cset was created,
491 491 # not the date the tag was created. Therefore it isn't made visible here.
492 492 makemap = lambda v: {
493 493 b'changes': _showchangessincetag,
494 494 b'distance': latesttags[1],
495 495 b'latesttag': v, # BC with {latesttag % '{latesttag}'}
496 496 b'tag': v,
497 497 }
498 498
499 499 tags = latesttags[2]
500 500 f = _showcompatlist(context, mapping, b'latesttag', tags, separator=b':')
501 501 return _hybrid(f, tags, makemap, pycompat.identity)
502 502
503 503
504 504 @templatekeyword(b'latesttagdistance', requires={b'repo', b'ctx', b'cache'})
505 505 def showlatesttagdistance(context, mapping):
506 506 """Integer. Longest path to the latest tag."""
507 507 return getlatesttags(context, mapping)[1]
508 508
509 509
510 510 @templatekeyword(b'changessincelatesttag', requires={b'repo', b'ctx', b'cache'})
511 511 def showchangessincelatesttag(context, mapping):
512 512 """Integer. All ancestors not in the latest tag."""
513 513 tag = getlatesttags(context, mapping)[2][0]
514 514 mapping = context.overlaymap(mapping, {b'tag': tag})
515 515 return _showchangessincetag(context, mapping)
516 516
517 517
518 518 def _showchangessincetag(context, mapping):
519 519 repo = context.resource(mapping, b'repo')
520 520 ctx = context.resource(mapping, b'ctx')
521 521 offset = 0
522 522 revs = [ctx.rev()]
523 523 tag = context.symbol(mapping, b'tag')
524 524
525 525 # The only() revset doesn't currently support wdir()
526 526 if ctx.rev() is None:
527 527 offset = 1
528 528 revs = [p.rev() for p in ctx.parents()]
529 529
530 530 return len(repo.revs(b'only(%ld, %s)', revs, tag)) + offset
531 531
532 532
533 533 # teach templater latesttags.changes is switched to (context, mapping) API
534 534 _showchangessincetag._requires = {b'repo', b'ctx'}
535 535
536 536
537 537 @templatekeyword(b'manifest', requires={b'repo', b'ctx'})
538 538 def showmanifest(context, mapping):
539 539 repo = context.resource(mapping, b'repo')
540 540 ctx = context.resource(mapping, b'ctx')
541 541 mnode = ctx.manifestnode()
542 542 if mnode is None:
543 543 mnode = repo.nodeconstants.wdirid
544 544 mrev = wdirrev
545 545 mhex = repo.nodeconstants.wdirhex
546 546 else:
547 547 mrev = repo.manifestlog.rev(mnode)
548 548 mhex = hex(mnode)
549 549 mapping = context.overlaymap(mapping, {b'rev': mrev, b'node': mhex})
550 550 f = context.process(b'manifest', mapping)
551 551 return templateutil.hybriditem(
552 552 f, None, f, lambda x: {b'rev': mrev, b'node': mhex}
553 553 )
554 554
555 555
556 556 @templatekeyword(b'obsfate', requires={b'ui', b'repo', b'ctx'})
557 557 def showobsfate(context, mapping):
558 558 # this function returns a list containing pre-formatted obsfate strings.
559 559 #
560 560 # This function will be replaced by templates fragments when we will have
561 561 # the verbosity templatekw available.
562 562 succsandmarkers = showsuccsandmarkers(context, mapping)
563 563
564 564 ui = context.resource(mapping, b'ui')
565 565 repo = context.resource(mapping, b'repo')
566 566 values = []
567 567
568 568 for x in succsandmarkers.tovalue(context, mapping):
569 569 v = obsutil.obsfateprinter(
570 570 ui, repo, x[b'successors'], x[b'markers'], scmutil.formatchangeid
571 571 )
572 572 values.append(v)
573 573
574 574 return compatlist(context, mapping, b"fate", values)
575 575
576 576
577 577 def shownames(context, mapping, namespace):
578 578 """helper method to generate a template keyword for a namespace"""
579 579 repo = context.resource(mapping, b'repo')
580 580 ctx = context.resource(mapping, b'ctx')
581 581 ns = repo.names.get(namespace)
582 582 if ns is None:
583 583 # namespaces.addnamespace() registers new template keyword, but
584 584 # the registered namespace might not exist in the current repo.
585 585 return
586 586 names = ns.names(repo, ctx.node())
587 587 return compatlist(
588 588 context, mapping, ns.templatename, names, plural=namespace
589 589 )
590 590
591 591
592 592 @templatekeyword(b'namespaces', requires={b'repo', b'ctx'})
593 593 def shownamespaces(context, mapping):
594 594 """Dict of lists. Names attached to this changeset per
595 595 namespace."""
596 596 repo = context.resource(mapping, b'repo')
597 597 ctx = context.resource(mapping, b'ctx')
598 598
599 599 namespaces = util.sortdict()
600 600
601 601 def makensmapfn(ns):
602 602 # 'name' for iterating over namespaces, templatename for local reference
603 603 return lambda v: {b'name': v, ns.templatename: v}
604 604
605 605 for k, ns in repo.names.items():
606 606 names = ns.names(repo, ctx.node())
607 607 f = _showcompatlist(context, mapping, b'name', names)
608 608 namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity)
609 609
610 610 f = _showcompatlist(context, mapping, b'namespace', list(namespaces))
611 611
612 612 def makemap(ns):
613 613 return {
614 614 b'namespace': ns,
615 615 b'names': namespaces[ns],
616 616 b'builtin': repo.names[ns].builtin,
617 617 b'colorname': repo.names[ns].colorname,
618 618 }
619 619
620 620 return _hybrid(f, namespaces, makemap, pycompat.identity)
621 621
622 622
623 623 @templatekeyword(b'negrev', requires={b'repo', b'ctx'})
624 624 def shownegrev(context, mapping):
625 625 """Integer. The repository-local changeset negative revision number,
626 626 which counts in the opposite direction."""
627 627 ctx = context.resource(mapping, b'ctx')
628 628 rev = ctx.rev()
629 629 if rev is None or rev < 0: # wdir() or nullrev?
630 630 return None
631 631 repo = context.resource(mapping, b'repo')
632 632 return rev - len(repo)
633 633
634 634
635 635 @templatekeyword(b'node', requires={b'ctx'})
636 636 def shownode(context, mapping):
637 637 """String. The changeset identification hash, as a 40 hexadecimal
638 638 digit string.
639 639 """
640 640 ctx = context.resource(mapping, b'ctx')
641 641 return ctx.hex()
642 642
643 643
644 644 @templatekeyword(b'obsolete', requires={b'ctx'})
645 645 def showobsolete(context, mapping):
646 646 """String. Whether the changeset is obsolete. (EXPERIMENTAL)"""
647 647 ctx = context.resource(mapping, b'ctx')
648 648 if ctx.obsolete():
649 649 return b'obsolete'
650 650 return b''
651 651
652 652
653 653 @templatekeyword(b'onelinesummary', requires={b'ui', b'ctx'})
654 654 def showonelinesummary(context, mapping):
655 655 """String. A one-line summary for the ctx (not including trailing newline).
656 656 The default template be overridden in command-templates.oneline-summary."""
657 657 # Avoid cycle:
658 658 # mercurial.cmdutil -> mercurial.templatekw -> mercurial.cmdutil
659 659 from . import cmdutil
660 660
661 661 ui = context.resource(mapping, b'ui')
662 662 ctx = context.resource(mapping, b'ctx')
663 663 return cmdutil.format_changeset_summary(ui, ctx)
664 664
665 665
666 666 @templatekeyword(b'path', requires={b'fctx'})
667 667 def showpath(context, mapping):
668 668 """String. Repository-absolute path of the current file. (EXPERIMENTAL)"""
669 669 fctx = context.resource(mapping, b'fctx')
670 670 return fctx.path()
671 671
672 672
673 673 @templatekeyword(b'peerurls', requires={b'repo'})
674 674 def showpeerurls(context, mapping):
675 675 """A dictionary of repository locations defined in the [paths] section
676 676 of your configuration file."""
677 677 repo = context.resource(mapping, b'repo')
678 678 # see commands.paths() for naming of dictionary keys
679 679 paths = repo.ui.paths
680 680 all_paths = urlutil.list_paths(repo.ui)
681 681 urls = util.sortdict((k, p.rawloc) for k, p in all_paths)
682 682
683 683 def makemap(k):
684 684 ps = paths[k]
685 685 d = {b'name': k}
686 686 if len(ps) == 1:
687 687 d[b'url'] = ps[0].rawloc
688 688 sub_opts = ps[0].suboptions.items()
689 689 sub_opts = util.sortdict(sorted(sub_opts))
690 690 d.update(sub_opts)
691 691 path_dict = util.sortdict()
692 692 for p in ps:
693 693 sub_opts = util.sortdict(sorted(p.suboptions.items()))
694 694 path_dict[b'url'] = p.rawloc
695 695 path_dict.update(sub_opts)
696 696 d[b'urls'] = [path_dict]
697 697 return d
698 698
699 699 def format_one(k):
700 700 return b'%s=%s' % (k, urls[k])
701 701
702 702 return _hybrid(None, urls, makemap, format_one)
703 703
704 704
705 705 @templatekeyword(b"predecessors", requires={b'repo', b'ctx'})
706 706 def showpredecessors(context, mapping):
707 707 """Returns the list of the closest visible predecessors. (EXPERIMENTAL)"""
708 708 repo = context.resource(mapping, b'repo')
709 709 ctx = context.resource(mapping, b'ctx')
710 710 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
711 711 predecessors = pycompat.maplist(hex, predecessors)
712 712
713 713 return _hybrid(
714 714 None,
715 715 predecessors,
716 716 lambda x: {b'ctx': repo[x]},
717 717 lambda x: scmutil.formatchangeid(repo[x]),
718 718 )
719 719
720 720
721 721 @templatekeyword(b'reporoot', requires={b'repo'})
722 722 def showreporoot(context, mapping):
723 723 """String. The root directory of the current repository."""
724 724 repo = context.resource(mapping, b'repo')
725 725 return repo.root
726 726
727 727
728 728 @templatekeyword(b'size', requires={b'fctx'})
729 729 def showsize(context, mapping):
730 730 """Integer. Size of the current file in bytes. (EXPERIMENTAL)"""
731 731 fctx = context.resource(mapping, b'fctx')
732 732 return fctx.size()
733 733
734 734
735 735 # requires 'fctx' to denote {status} depends on (ctx, path) pair
736 736 @templatekeyword(b'status', requires={b'ctx', b'fctx', b'revcache'})
737 737 def showstatus(context, mapping):
738 738 """String. Status code of the current file. (EXPERIMENTAL)"""
739 739 path = templateutil.runsymbol(context, mapping, b'path')
740 740 path = templateutil.stringify(context, mapping, path)
741 741 if not path:
742 742 return
743 743 statmap = _getfilestatusmap(context, mapping)
744 744 if path not in statmap:
745 745 statmap = _getfilestatusmap(context, mapping, listall=True)
746 746 return statmap.get(path)
747 747
748 748
749 749 @templatekeyword(b"successorssets", requires={b'repo', b'ctx'})
750 750 def showsuccessorssets(context, mapping):
751 751 """Returns a string of sets of successors for a changectx. Format used
752 752 is: [ctx1, ctx2], [ctx3] if ctx has been split into ctx1 and ctx2
753 753 while also diverged into ctx3. (EXPERIMENTAL)"""
754 754 repo = context.resource(mapping, b'repo')
755 755 ctx = context.resource(mapping, b'ctx')
756 756 data = []
757 757
758 758 if ctx.obsolete():
759 759 ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
760 760 ssets = [[hex(n) for n in ss] for ss in ssets]
761 761
762 762 for ss in ssets:
763 763 h = _hybrid(
764 764 None,
765 765 ss,
766 766 lambda x: {b'ctx': repo[x]},
767 767 lambda x: scmutil.formatchangeid(repo[x]),
768 768 )
769 769 data.append(h)
770 770
771 771 # Format the successorssets
772 772 def render(d):
773 773 return templateutil.stringify(context, mapping, d)
774 774
775 775 def gen(data):
776 776 yield b"; ".join(render(d) for d in data)
777 777
778 778 return _hybrid(
779 779 gen(data), data, lambda x: {b'successorset': x}, pycompat.identity
780 780 )
781 781
782 782
783 783 @templatekeyword(b"succsandmarkers", requires={b'repo', b'ctx'})
784 784 def showsuccsandmarkers(context, mapping):
785 785 """Returns a list of dict for each final successor of ctx. The dict
786 786 contains successors node id in "successors" keys and the list of
787 787 obs-markers from ctx to the set of successors in "markers".
788 788 (EXPERIMENTAL)
789 789 """
790 790 repo = context.resource(mapping, b'repo')
791 791 ctx = context.resource(mapping, b'ctx')
792 792
793 793 values = obsutil.successorsandmarkers(repo, ctx)
794 794
795 795 if values is None:
796 796 values = []
797 797
798 798 # Format successors and markers to avoid exposing binary to templates
799 799 data = []
800 800 for i in values:
801 801 # Format successors
802 802 successors = i[b'successors']
803 803
804 804 successors = [hex(n) for n in successors]
805 805 successors = _hybrid(
806 806 None,
807 807 successors,
808 808 lambda x: {b'ctx': repo[x]},
809 809 lambda x: scmutil.formatchangeid(repo[x]),
810 810 )
811 811
812 812 # Format markers
813 813 finalmarkers = []
814 814 for m in i[b'markers']:
815 815 hexprec = hex(m[0])
816 816 hexsucs = tuple(hex(n) for n in m[1])
817 817 hexparents = None
818 818 if m[5] is not None:
819 819 hexparents = tuple(hex(n) for n in m[5])
820 820 newmarker = (hexprec, hexsucs) + m[2:5] + (hexparents,) + m[6:]
821 821 finalmarkers.append(newmarker)
822 822
823 823 data.append({b'successors': successors, b'markers': finalmarkers})
824 824
825 825 return templateutil.mappinglist(data)
826 826
827 827
828 828 @templatekeyword(b'p1', requires={b'ctx'})
829 829 def showp1(context, mapping):
830 830 """Changeset. The changeset's first parent. ``{p1.rev}`` for the revision
831 831 number, and ``{p1.node}`` for the identification hash."""
832 832 ctx = context.resource(mapping, b'ctx')
833 833 return templateutil.mappingdict({b'ctx': ctx.p1()}, tmpl=_changeidtmpl)
834 834
835 835
836 836 @templatekeyword(b'p2', requires={b'ctx'})
837 837 def showp2(context, mapping):
838 838 """Changeset. The changeset's second parent. ``{p2.rev}`` for the revision
839 839 number, and ``{p2.node}`` for the identification hash."""
840 840 ctx = context.resource(mapping, b'ctx')
841 841 return templateutil.mappingdict({b'ctx': ctx.p2()}, tmpl=_changeidtmpl)
842 842
843 843
844 844 @templatekeyword(b'p1rev', requires={b'ctx'})
845 845 def showp1rev(context, mapping):
846 846 """Integer. The repository-local revision number of the changeset's
847 847 first parent, or -1 if the changeset has no parents. (DEPRECATED)"""
848 848 ctx = context.resource(mapping, b'ctx')
849 849 return ctx.p1().rev()
850 850
851 851
852 852 @templatekeyword(b'p2rev', requires={b'ctx'})
853 853 def showp2rev(context, mapping):
854 854 """Integer. The repository-local revision number of the changeset's
855 855 second parent, or -1 if the changeset has no second parent. (DEPRECATED)"""
856 856 ctx = context.resource(mapping, b'ctx')
857 857 return ctx.p2().rev()
858 858
859 859
860 860 @templatekeyword(b'p1node', requires={b'ctx'})
861 861 def showp1node(context, mapping):
862 862 """String. The identification hash of the changeset's first parent,
863 863 as a 40 digit hexadecimal string. If the changeset has no parents, all
864 864 digits are 0. (DEPRECATED)"""
865 865 ctx = context.resource(mapping, b'ctx')
866 866 return ctx.p1().hex()
867 867
868 868
869 869 @templatekeyword(b'p2node', requires={b'ctx'})
870 870 def showp2node(context, mapping):
871 871 """String. The identification hash of the changeset's second
872 872 parent, as a 40 digit hexadecimal string. If the changeset has no second
873 873 parent, all digits are 0. (DEPRECATED)"""
874 874 ctx = context.resource(mapping, b'ctx')
875 875 return ctx.p2().hex()
876 876
877 877
878 878 @templatekeyword(b'parents', requires={b'repo', b'ctx'})
879 879 def showparents(context, mapping):
880 880 """List of strings. The parents of the changeset in "rev:node"
881 881 format. If the changeset has only one "natural" parent (the predecessor
882 882 revision) nothing is shown."""
883 883 repo = context.resource(mapping, b'repo')
884 884 ctx = context.resource(mapping, b'ctx')
885 885 pctxs = scmutil.meaningfulparents(repo, ctx)
886 886 prevs = [p.rev() for p in pctxs]
887 887 parents = [
888 888 [(b'rev', p.rev()), (b'node', p.hex()), (b'phase', p.phasestr())]
889 889 for p in pctxs
890 890 ]
891 891 f = _showcompatlist(context, mapping, b'parent', parents)
892 892 return _hybrid(
893 893 f,
894 894 prevs,
895 895 lambda x: {b'ctx': repo[x]},
896 896 lambda x: scmutil.formatchangeid(repo[x]),
897 897 keytype=int,
898 898 )
899 899
900 900
901 901 @templatekeyword(b'phase', requires={b'ctx'})
902 902 def showphase(context, mapping):
903 903 """String. The changeset phase name."""
904 904 ctx = context.resource(mapping, b'ctx')
905 905 return ctx.phasestr()
906 906
907 907
908 908 @templatekeyword(b'phaseidx', requires={b'ctx'})
909 909 def showphaseidx(context, mapping):
910 910 """Integer. The changeset phase index. (ADVANCED)"""
911 911 ctx = context.resource(mapping, b'ctx')
912 912 return ctx.phase()
913 913
914 914
915 915 @templatekeyword(b'rev', requires={b'ctx'})
916 916 def showrev(context, mapping):
917 917 """Integer. The repository-local changeset revision number."""
918 918 ctx = context.resource(mapping, b'ctx')
919 919 return scmutil.intrev(ctx)
920 920
921 921
922 922 @templatekeyword(b'subrepos', requires={b'ctx'})
923 923 def showsubrepos(context, mapping):
924 924 """List of strings. Updated subrepositories in the changeset."""
925 925 ctx = context.resource(mapping, b'ctx')
926 926 substate = ctx.substate
927 927 if not substate:
928 928 return compatlist(context, mapping, b'subrepo', [])
929 929 psubstate = ctx.p1().substate or {}
930 930 subrepos = []
931 931 for sub in substate:
932 932 if sub not in psubstate or substate[sub] != psubstate[sub]:
933 933 subrepos.append(sub) # modified or newly added in ctx
934 934 for sub in psubstate:
935 935 if sub not in substate:
936 936 subrepos.append(sub) # removed in ctx
937 937 return compatlist(context, mapping, b'subrepo', sorted(subrepos))
938 938
939 939
940 940 # don't remove "showtags" definition, even though namespaces will put
941 941 # a helper function for "tags" keyword into "keywords" map automatically,
942 942 # because online help text is built without namespaces initialization
943 943 @templatekeyword(b'tags', requires={b'repo', b'ctx'})
944 944 def showtags(context, mapping):
945 945 """List of strings. Any tags associated with the changeset."""
946 946 return shownames(context, mapping, b'tags')
947 947
948 948
949 949 @templatekeyword(b'termwidth', requires={b'ui'})
950 950 def showtermwidth(context, mapping):
951 951 """Integer. The width of the current terminal."""
952 952 ui = context.resource(mapping, b'ui')
953 953 return ui.termwidth()
954 954
955 955
956 956 @templatekeyword(b'user', requires={b'ctx'})
957 957 def showuser(context, mapping):
958 958 """String. The unmodified author of the changeset."""
959 959 ctx = context.resource(mapping, b'ctx')
960 960 return ctx.user()
961 961
962 962
963 963 @templatekeyword(b'instabilities', requires={b'ctx'})
964 964 def showinstabilities(context, mapping):
965 965 """List of strings. Evolution instabilities affecting the changeset.
966 966 (EXPERIMENTAL)
967 967 """
968 968 ctx = context.resource(mapping, b'ctx')
969 969 return compatlist(
970 970 context,
971 971 mapping,
972 972 b'instability',
973 973 ctx.instabilities(),
974 974 plural=b'instabilities',
975 975 )
976 976
977 977
978 978 @templatekeyword(b'verbosity', requires={b'ui'})
979 979 def showverbosity(context, mapping):
980 980 """String. The current output verbosity in 'debug', 'quiet', 'verbose',
981 981 or ''."""
982 982 ui = context.resource(mapping, b'ui')
983 983 # see logcmdutil.changesettemplater for priority of these flags
984 984 if ui.debugflag:
985 985 return b'debug'
986 986 elif ui.quiet:
987 987 return b'quiet'
988 988 elif ui.verbose:
989 989 return b'verbose'
990 990 return b''
991 991
992 992
993 993 @templatekeyword(b'whyunstable', requires={b'repo', b'ctx'})
994 994 def showwhyunstable(context, mapping):
995 995 """List of dicts explaining all instabilities of a changeset.
996 996 (EXPERIMENTAL)
997 997 """
998 998 repo = context.resource(mapping, b'repo')
999 999 ctx = context.resource(mapping, b'ctx')
1000 1000
1001 1001 def formatnode(ctx):
1002 1002 return b'%s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr())
1003 1003
1004 1004 entries = obsutil.whyunstable(repo, ctx)
1005 1005
1006 1006 for entry in entries:
1007 1007 if entry.get(b'divergentnodes'):
1008 1008 dnodes = entry[b'divergentnodes']
1009 1009 dnhybrid = _hybrid(
1010 1010 None,
1011 1011 [dnode.hex() for dnode in dnodes],
1012 1012 lambda x: {b'ctx': repo[x]},
1013 1013 lambda x: formatnode(repo[x]),
1014 1014 )
1015 1015 entry[b'divergentnodes'] = dnhybrid
1016 1016
1017 1017 tmpl = (
1018 1018 b'{instability}:{if(divergentnodes, " ")}{divergentnodes} '
1019 1019 b'{reason} {node|short}'
1020 1020 )
1021 1021 return templateutil.mappinglist(entries, tmpl=tmpl, sep=b'\n')
1022 1022
1023 1023
1024 1024 def loadkeyword(ui, extname, registrarobj):
1025 1025 """Load template keyword from specified registrarobj"""
1026 1026 for name, func in registrarobj._table.items():
1027 1027 keywords[name] = func
1028 1028
1029 1029
1030 1030 # tell hggettext to extract docstrings from these functions:
1031 1031 i18nfunctions = keywords.values()
@@ -1,2974 +1,2979 b''
1 1 Log on empty repository: checking consistency
2 2
3 3 $ hg init empty
4 4 $ cd empty
5 5 $ hg log
6 6 $ hg log -r 1
7 7 abort: unknown revision '1'
8 8 [10]
9 9 $ hg log -r -1:0
10 10 abort: unknown revision '-1'
11 11 [10]
12 12 $ hg log -r 'branch(name)'
13 13 abort: unknown revision 'name'
14 14 [10]
15 15 $ hg log -r null -q
16 16 -1:000000000000
17 17
18 18 $ cd ..
19 19
20 20 The g is crafted to have 2 filelog topological heads in a linear
21 21 changeset graph
22 22
23 23 $ hg init a
24 24 $ cd a
25 25 $ echo a > a
26 26 $ echo f > f
27 27 $ hg ci -Ama -d '1 0'
28 28 adding a
29 29 adding f
30 30
31 31 $ hg cp a b
32 32 $ hg cp f g
33 33 $ hg ci -mb -d '2 0'
34 34
35 35 $ mkdir dir
36 36 $ hg mv b dir
37 37 $ echo g >> g
38 38 $ echo f >> f
39 39 $ hg ci -mc -d '3 0'
40 40
41 41 $ hg mv a b
42 42 $ hg cp -f f g
43 43 $ echo a > d
44 44 $ hg add d
45 45 $ hg ci -md -d '4 0'
46 46
47 47 $ hg mv dir/b e
48 48 $ hg ci -me -d '5 0'
49 49
50 50 Make sure largefiles doesn't interfere with logging a regular file
51 51 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
52 52 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
53 53 updated patterns: .hglf/a, a
54 54 0: a
55 55 $ hg log a
56 56 changeset: 0:9161b9aeaf16
57 57 user: test
58 58 date: Thu Jan 01 00:00:01 1970 +0000
59 59 summary: a
60 60
61 61 $ hg log glob:a*
62 62 changeset: 3:2ca5ba701980
63 63 user: test
64 64 date: Thu Jan 01 00:00:04 1970 +0000
65 65 summary: d
66 66
67 67 changeset: 0:9161b9aeaf16
68 68 user: test
69 69 date: Thu Jan 01 00:00:01 1970 +0000
70 70 summary: a
71 71
72 72 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
73 73 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
74 74 updated patterns: glob:.hglf/a*, glob:a*
75 75 3: d
76 76 0: a
77 77
78 78 log on directory
79 79
80 80 $ hg log dir
81 81 changeset: 4:7e4639b4691b
82 82 tag: tip
83 83 user: test
84 84 date: Thu Jan 01 00:00:05 1970 +0000
85 85 summary: e
86 86
87 87 changeset: 2:f8954cd4dc1f
88 88 user: test
89 89 date: Thu Jan 01 00:00:03 1970 +0000
90 90 summary: c
91 91
92 92 $ hg log somethingthatdoesntexist dir
93 93 changeset: 4:7e4639b4691b
94 94 tag: tip
95 95 user: test
96 96 date: Thu Jan 01 00:00:05 1970 +0000
97 97 summary: e
98 98
99 99 changeset: 2:f8954cd4dc1f
100 100 user: test
101 101 date: Thu Jan 01 00:00:03 1970 +0000
102 102 summary: c
103 103
104 104
105 105 log empty path (or repo root) of slow path shouldn't crash (issue6478)
106 106
107 107 $ hg log -ql1 '' inexistent
108 108 4:7e4639b4691b
109 109 $ hg log -ql1 . inexistent
110 110 4:7e4639b4691b
111 111 $ hg log -ql1 "`pwd`" inexistent
112 112 4:7e4639b4691b
113 113
114 114 $ hg log -ql1 '' e
115 115 4:7e4639b4691b
116 116 $ hg log -ql1 . e
117 117 4:7e4639b4691b
118 118 $ hg log -ql1 "`pwd`" e
119 119 4:7e4639b4691b
120 120
121 121 log -f empty path (or repo root) shouldn't crash
122 122
123 123 $ hg log -qfl1 '' inexistent
124 124 abort: cannot follow file not in parent revision: "inexistent"
125 125 [20]
126 126 $ hg log -qfl1 . inexistent
127 127 abort: cannot follow file not in parent revision: "inexistent"
128 128 [20]
129 129 $ hg log -qfl1 "`pwd`" inexistent
130 130 abort: cannot follow file not in parent revision: "inexistent"
131 131 [20]
132 132
133 133 $ hg log -qfl1 '' e
134 134 4:7e4639b4691b
135 135 $ hg log -qfl1 . e
136 136 4:7e4639b4691b
137 137 $ hg log -qfl1 "`pwd`" e
138 138 4:7e4639b4691b
139 139
140 140 -X, with explicit path
141 141
142 142 $ hg log a -X a
143 143
144 144 -f, non-existent directory
145 145
146 146 $ hg log -f dir
147 147 abort: cannot follow file not in parent revision: "dir"
148 148 [20]
149 149
150 150 -f, directory
151 151
152 152 $ hg up -q 3
153 153 $ hg log -f dir
154 154 changeset: 2:f8954cd4dc1f
155 155 user: test
156 156 date: Thu Jan 01 00:00:03 1970 +0000
157 157 summary: c
158 158
159 159 -f, directory with --patch
160 160
161 161 $ hg log -f dir -p
162 162 changeset: 2:f8954cd4dc1f
163 163 user: test
164 164 date: Thu Jan 01 00:00:03 1970 +0000
165 165 summary: c
166 166
167 167 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
168 168 --- /dev/null* (glob)
169 169 +++ b/dir/b* (glob)
170 170 @@ -0,0 +1,1 @@
171 171 +a
172 172
173 173
174 174 -f, pattern
175 175
176 176 $ hg log -f -I 'dir**' -p
177 177 changeset: 2:f8954cd4dc1f
178 178 user: test
179 179 date: Thu Jan 01 00:00:03 1970 +0000
180 180 summary: c
181 181
182 182 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
183 183 --- /dev/null* (glob)
184 184 +++ b/dir/b* (glob)
185 185 @@ -0,0 +1,1 @@
186 186 +a
187 187
188 188 $ hg up -q 4
189 189
190 190 -f, a wrong style
191 191
192 192 $ hg log -f -l1 --style something
193 193 abort: style 'something' not found
194 194 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
195 195 [255]
196 196
197 197 -f, phases style
198 198
199 199
200 200 $ hg log -f -l1 --style phases
201 201 changeset: 4:7e4639b4691b
202 202 tag: tip
203 203 phase: draft
204 204 user: test
205 205 date: Thu Jan 01 00:00:05 1970 +0000
206 206 summary: e
207 207
208 208
209 209 $ hg log -f -l1 --style phases -q
210 210 4:7e4639b4691b
211 211
212 212 -f, but no args
213 213
214 214 $ hg log -f
215 215 changeset: 4:7e4639b4691b
216 216 tag: tip
217 217 user: test
218 218 date: Thu Jan 01 00:00:05 1970 +0000
219 219 summary: e
220 220
221 221 changeset: 3:2ca5ba701980
222 222 user: test
223 223 date: Thu Jan 01 00:00:04 1970 +0000
224 224 summary: d
225 225
226 226 changeset: 2:f8954cd4dc1f
227 227 user: test
228 228 date: Thu Jan 01 00:00:03 1970 +0000
229 229 summary: c
230 230
231 231 changeset: 1:d89b0a12d229
232 232 user: test
233 233 date: Thu Jan 01 00:00:02 1970 +0000
234 234 summary: b
235 235
236 236 changeset: 0:9161b9aeaf16
237 237 user: test
238 238 date: Thu Jan 01 00:00:01 1970 +0000
239 239 summary: a
240 240
241 241
242 242 one rename
243 243
244 244 $ hg up -q 2
245 245 $ hg log -vf a
246 246 changeset: 0:9161b9aeaf16
247 247 user: test
248 248 date: Thu Jan 01 00:00:01 1970 +0000
249 249 files: a f
250 250 description:
251 251 a
252 252
253 253
254 254
255 255 many renames
256 256
257 257 $ hg up -q tip
258 258 $ hg log -vf e
259 259 changeset: 4:7e4639b4691b
260 260 tag: tip
261 261 user: test
262 262 date: Thu Jan 01 00:00:05 1970 +0000
263 263 files: dir/b e
264 264 description:
265 265 e
266 266
267 267
268 268 changeset: 2:f8954cd4dc1f
269 269 user: test
270 270 date: Thu Jan 01 00:00:03 1970 +0000
271 271 files: b dir/b f g
272 272 description:
273 273 c
274 274
275 275
276 276 changeset: 1:d89b0a12d229
277 277 user: test
278 278 date: Thu Jan 01 00:00:02 1970 +0000
279 279 files: b g
280 280 description:
281 281 b
282 282
283 283
284 284 changeset: 0:9161b9aeaf16
285 285 user: test
286 286 date: Thu Jan 01 00:00:01 1970 +0000
287 287 files: a f
288 288 description:
289 289 a
290 290
291 291
292 292
293 293
294 294 log -pf dir/b
295 295
296 296 $ hg up -q 3
297 297 $ hg log -pf dir/b
298 298 changeset: 2:f8954cd4dc1f
299 299 user: test
300 300 date: Thu Jan 01 00:00:03 1970 +0000
301 301 summary: c
302 302
303 303 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
304 304 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
305 305 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
306 306 @@ -0,0 +1,1 @@
307 307 +a
308 308
309 309 changeset: 1:d89b0a12d229
310 310 user: test
311 311 date: Thu Jan 01 00:00:02 1970 +0000
312 312 summary: b
313 313
314 314 diff -r 9161b9aeaf16 -r d89b0a12d229 b
315 315 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
316 316 +++ b/b Thu Jan 01 00:00:02 1970 +0000
317 317 @@ -0,0 +1,1 @@
318 318 +a
319 319
320 320 changeset: 0:9161b9aeaf16
321 321 user: test
322 322 date: Thu Jan 01 00:00:01 1970 +0000
323 323 summary: a
324 324
325 325 diff -r 000000000000 -r 9161b9aeaf16 a
326 326 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
327 327 +++ b/a Thu Jan 01 00:00:01 1970 +0000
328 328 @@ -0,0 +1,1 @@
329 329 +a
330 330
331 331
332 332 log -pf b inside dir
333 333
334 334 $ hg --cwd=dir log -pf b
335 335 changeset: 2:f8954cd4dc1f
336 336 user: test
337 337 date: Thu Jan 01 00:00:03 1970 +0000
338 338 summary: c
339 339
340 340 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
341 341 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
342 342 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
343 343 @@ -0,0 +1,1 @@
344 344 +a
345 345
346 346 changeset: 1:d89b0a12d229
347 347 user: test
348 348 date: Thu Jan 01 00:00:02 1970 +0000
349 349 summary: b
350 350
351 351 diff -r 9161b9aeaf16 -r d89b0a12d229 b
352 352 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
353 353 +++ b/b Thu Jan 01 00:00:02 1970 +0000
354 354 @@ -0,0 +1,1 @@
355 355 +a
356 356
357 357 changeset: 0:9161b9aeaf16
358 358 user: test
359 359 date: Thu Jan 01 00:00:01 1970 +0000
360 360 summary: a
361 361
362 362 diff -r 000000000000 -r 9161b9aeaf16 a
363 363 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
364 364 +++ b/a Thu Jan 01 00:00:01 1970 +0000
365 365 @@ -0,0 +1,1 @@
366 366 +a
367 367
368 368
369 369 log -pf, but no args
370 370
371 371 $ hg log -pf
372 372 changeset: 3:2ca5ba701980
373 373 user: test
374 374 date: Thu Jan 01 00:00:04 1970 +0000
375 375 summary: d
376 376
377 377 diff -r f8954cd4dc1f -r 2ca5ba701980 a
378 378 --- a/a Thu Jan 01 00:00:03 1970 +0000
379 379 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
380 380 @@ -1,1 +0,0 @@
381 381 -a
382 382 diff -r f8954cd4dc1f -r 2ca5ba701980 b
383 383 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
384 384 +++ b/b Thu Jan 01 00:00:04 1970 +0000
385 385 @@ -0,0 +1,1 @@
386 386 +a
387 387 diff -r f8954cd4dc1f -r 2ca5ba701980 d
388 388 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
389 389 +++ b/d Thu Jan 01 00:00:04 1970 +0000
390 390 @@ -0,0 +1,1 @@
391 391 +a
392 392 diff -r f8954cd4dc1f -r 2ca5ba701980 g
393 393 --- a/g Thu Jan 01 00:00:03 1970 +0000
394 394 +++ b/g Thu Jan 01 00:00:04 1970 +0000
395 395 @@ -1,2 +1,2 @@
396 396 f
397 397 -g
398 398 +f
399 399
400 400 changeset: 2:f8954cd4dc1f
401 401 user: test
402 402 date: Thu Jan 01 00:00:03 1970 +0000
403 403 summary: c
404 404
405 405 diff -r d89b0a12d229 -r f8954cd4dc1f b
406 406 --- a/b Thu Jan 01 00:00:02 1970 +0000
407 407 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
408 408 @@ -1,1 +0,0 @@
409 409 -a
410 410 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
411 411 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
412 412 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
413 413 @@ -0,0 +1,1 @@
414 414 +a
415 415 diff -r d89b0a12d229 -r f8954cd4dc1f f
416 416 --- a/f Thu Jan 01 00:00:02 1970 +0000
417 417 +++ b/f Thu Jan 01 00:00:03 1970 +0000
418 418 @@ -1,1 +1,2 @@
419 419 f
420 420 +f
421 421 diff -r d89b0a12d229 -r f8954cd4dc1f g
422 422 --- a/g Thu Jan 01 00:00:02 1970 +0000
423 423 +++ b/g Thu Jan 01 00:00:03 1970 +0000
424 424 @@ -1,1 +1,2 @@
425 425 f
426 426 +g
427 427
428 428 changeset: 1:d89b0a12d229
429 429 user: test
430 430 date: Thu Jan 01 00:00:02 1970 +0000
431 431 summary: b
432 432
433 433 diff -r 9161b9aeaf16 -r d89b0a12d229 b
434 434 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
435 435 +++ b/b Thu Jan 01 00:00:02 1970 +0000
436 436 @@ -0,0 +1,1 @@
437 437 +a
438 438 diff -r 9161b9aeaf16 -r d89b0a12d229 g
439 439 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
440 440 +++ b/g Thu Jan 01 00:00:02 1970 +0000
441 441 @@ -0,0 +1,1 @@
442 442 +f
443 443
444 444 changeset: 0:9161b9aeaf16
445 445 user: test
446 446 date: Thu Jan 01 00:00:01 1970 +0000
447 447 summary: a
448 448
449 449 diff -r 000000000000 -r 9161b9aeaf16 a
450 450 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
451 451 +++ b/a Thu Jan 01 00:00:01 1970 +0000
452 452 @@ -0,0 +1,1 @@
453 453 +a
454 454 diff -r 000000000000 -r 9161b9aeaf16 f
455 455 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
456 456 +++ b/f Thu Jan 01 00:00:01 1970 +0000
457 457 @@ -0,0 +1,1 @@
458 458 +f
459 459
460 460
461 461 log -vf dir/b
462 462
463 463 $ hg log -vf dir/b
464 464 changeset: 2:f8954cd4dc1f
465 465 user: test
466 466 date: Thu Jan 01 00:00:03 1970 +0000
467 467 files: b dir/b f g
468 468 description:
469 469 c
470 470
471 471
472 472 changeset: 1:d89b0a12d229
473 473 user: test
474 474 date: Thu Jan 01 00:00:02 1970 +0000
475 475 files: b g
476 476 description:
477 477 b
478 478
479 479
480 480 changeset: 0:9161b9aeaf16
481 481 user: test
482 482 date: Thu Jan 01 00:00:01 1970 +0000
483 483 files: a f
484 484 description:
485 485 a
486 486
487 487
488 488 Respects ui.logtemplate and command-templates.log configs (the latter takes
489 489 precedence)
490 490
491 491 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n"
492 492 foo 0
493 493 $ hg log -r 0 --config command-templates.log="bar {rev}\n"
494 494 bar 0
495 495 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n" \
496 496 > --config command-templates.log="bar {rev}\n"
497 497 bar 0
498 498
499 499
500 500 -f and multiple filelog heads
501 501
502 502 $ hg up -q 2
503 503 $ hg log -f g --template '{rev}\n'
504 504 2
505 505 1
506 506 0
507 507 $ hg up -q tip
508 508 $ hg log -f g --template '{rev}\n'
509 509 3
510 510 2
511 511 0
512 512
513 513 follow files from the specified revisions (issue4959)
514 514
515 515 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
516 516 @ 4 dir/b e, dir/b->e
517 517 |
518 518 o 3 a b d g, a->b f->g
519 519 |
520 520 o 2 b dir/b f g, b->dir/b
521 521 |
522 522 o 1 b g, a->b f->g
523 523 |
524 524 o 0 a f,
525 525
526 526
527 527 $ hg log -T '{rev}\n' -fr 4 e
528 528 4
529 529 2
530 530 1
531 531 0
532 532 $ hg log -T '{rev}\n' -fr 2 g
533 533 2
534 534 1
535 535 0
536 536 $ hg log -T '{rev}\n' -fr '2+3' g
537 537 3
538 538 2
539 539 1
540 540 0
541 541
542 542 follow files from the specified revisions with glob patterns (issue5053)
543 543 (BROKEN: should follow copies from e@4)
544 544
545 545 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
546 546 4
547 547 2 (false !)
548 548 1 (false !)
549 549 0 (false !)
550 550
551 551 follow files from the specified revisions with missing patterns
552 552
553 553 $ hg log -T '{rev}\n' -fr4 e x
554 554 abort: cannot follow file not in any of the specified revisions: "x"
555 555 [20]
556 556
557 557 follow files from the specified revisions with directory patterns
558 558 (BROKEN: should follow copies from dir/b@2)
559 559
560 560 $ hg log -T '{rev}\n' -fr2 dir/b dir
561 561 2
562 562 1 (false !)
563 563 0 (false !)
564 564
565 565 follow files from multiple revisions, but the pattern is missing in
566 566 one of the specified revisions
567 567
568 568 $ hg log -T '{rev}\n' -fr'2+4' dir/b e
569 569 e: no such file in rev f8954cd4dc1f
570 570 dir/b: no such file in rev 7e4639b4691b
571 571 4
572 572 2
573 573 1
574 574 0
575 575
576 576 follow files from multiple revisions, and the pattern matches a file in
577 577 one revision but matches a directory in another:
578 578 (BROKEN: should follow copies from dir/b@2 and dir/b/g@5)
579 579 (BROKEN: the revision 4 should not be included since dir/b/g@5 is unchanged)
580 580
581 581 $ mkdir -p dir/b
582 582 $ hg mv g dir/b
583 583 $ hg ci -m 'make dir/b a directory'
584 584
585 585 $ hg log -T '{rev}\n' -fr'2+5' dir/b
586 586 5
587 587 4
588 588 3 (false !)
589 589 2
590 590 1 (false !)
591 591 0 (false !)
592 592
593 593 $ hg --config extensions.strip= strip -r. --no-backup
594 594 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
595 595
596 596 follow files from the specified revisions across copies with -p/--patch
597 597
598 598 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
599 599 == rev: 4, dir/b->e ==
600 600 diff -r 2ca5ba701980 -r 7e4639b4691b e
601 601 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
602 602 +++ b/e Thu Jan 01 00:00:05 1970 +0000
603 603 @@ -0,0 +1,1 @@
604 604 +a
605 605
606 606 == rev: 3, a->b f->g ==
607 607 diff -r f8954cd4dc1f -r 2ca5ba701980 g
608 608 --- a/g Thu Jan 01 00:00:03 1970 +0000
609 609 +++ b/g Thu Jan 01 00:00:04 1970 +0000
610 610 @@ -1,2 +1,2 @@
611 611 f
612 612 -g
613 613 +f
614 614
615 615 == rev: 2, b->dir/b ==
616 616 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
617 617 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
618 618 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
619 619 @@ -0,0 +1,1 @@
620 620 +a
621 621 diff -r d89b0a12d229 -r f8954cd4dc1f f
622 622 --- a/f Thu Jan 01 00:00:02 1970 +0000
623 623 +++ b/f Thu Jan 01 00:00:03 1970 +0000
624 624 @@ -1,1 +1,2 @@
625 625 f
626 626 +f
627 627
628 628 == rev: 1, a->b f->g ==
629 629 diff -r 9161b9aeaf16 -r d89b0a12d229 b
630 630 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
631 631 +++ b/b Thu Jan 01 00:00:02 1970 +0000
632 632 @@ -0,0 +1,1 @@
633 633 +a
634 634
635 635 == rev: 0, ==
636 636 diff -r 000000000000 -r 9161b9aeaf16 a
637 637 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
638 638 +++ b/a Thu Jan 01 00:00:01 1970 +0000
639 639 @@ -0,0 +1,1 @@
640 640 +a
641 641 diff -r 000000000000 -r 9161b9aeaf16 f
642 642 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
643 643 +++ b/f Thu Jan 01 00:00:01 1970 +0000
644 644 @@ -0,0 +1,1 @@
645 645 +f
646 646
647 647
648 648 log copies with --copies
649 649
650 650 $ hg log -vC --template '{rev} {file_copies}\n'
651 651 4 e (dir/b)
652 652 3 b (a)g (f)
653 653 2 dir/b (b)
654 654 1 b (a)g (f)
655 655 0
656 656
657 657 log copies switch without --copies, with old filecopy template
658 658
659 659 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
660 660 4
661 661 3
662 662 2
663 663 1
664 664 0
665 665
666 666 log copies switch with --copies
667 667
668 668 $ hg log -vC --template '{rev} {file_copies_switch}\n'
669 669 4 e (dir/b)
670 670 3 b (a)g (f)
671 671 2 dir/b (b)
672 672 1 b (a)g (f)
673 673 0
674 674
675 675
676 676 log copies with hardcoded style and with --style=default
677 677
678 678 $ hg log -vC -r4
679 679 changeset: 4:7e4639b4691b
680 680 tag: tip
681 681 user: test
682 682 date: Thu Jan 01 00:00:05 1970 +0000
683 683 files: dir/b e
684 684 copies: e (dir/b)
685 685 description:
686 686 e
687 687
688 688
689 689 $ hg log -vC -r4 --style=default
690 690 changeset: 4:7e4639b4691b
691 691 tag: tip
692 692 user: test
693 693 date: Thu Jan 01 00:00:05 1970 +0000
694 694 files: dir/b e
695 695 copies: e (dir/b)
696 696 description:
697 697 e
698 698
699 699
700 700 $ hg log -vC -r4 -Tjson
701 701 [
702 702 {
703 703 "bookmarks": [],
704 704 "branch": "default",
705 705 "copies": {"e": "dir/b"},
706 706 "date": [5, 0],
707 707 "desc": "e",
708 708 "files": ["dir/b", "e"],
709 709 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
710 710 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
711 711 "phase": "draft",
712 712 "rev": 4,
713 713 "tags": ["tip"],
714 714 "user": "test"
715 715 }
716 716 ]
717 717
718 718 log copies, non-linear manifest
719 719
720 720 $ hg up -C 3
721 721 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
722 722 $ hg mv dir/b e
723 723 $ echo foo > foo
724 724 $ hg ci -Ame2 -d '6 0'
725 725 adding foo
726 726 created new head
727 727 $ hg log -v --template '{rev} {file_copies}\n' -r 5
728 728 5 e (dir/b)
729 729
730 730
731 731 log copies, execute bit set
732 732
733 733 #if execbit
734 734 $ chmod +x e
735 735 $ hg ci -me3 -d '7 0'
736 736 $ hg log -v --template '{rev} {file_copies}\n' -r 6
737 737 6
738 738 #endif
739 739
740 740 log copies, empty set
741 741
742 742 $ hg log --copies -r '0 and not 0'
743 743
744 744 log -p d
745 745
746 746 $ hg log -pv d
747 747 changeset: 3:2ca5ba701980
748 748 user: test
749 749 date: Thu Jan 01 00:00:04 1970 +0000
750 750 files: a b d g
751 751 description:
752 752 d
753 753
754 754
755 755 diff -r f8954cd4dc1f -r 2ca5ba701980 d
756 756 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
757 757 +++ b/d Thu Jan 01 00:00:04 1970 +0000
758 758 @@ -0,0 +1,1 @@
759 759 +a
760 760
761 761
762 762
763 763 log --removed file
764 764
765 765 $ hg log --removed -v a
766 766 changeset: 3:2ca5ba701980
767 767 user: test
768 768 date: Thu Jan 01 00:00:04 1970 +0000
769 769 files: a b d g
770 770 description:
771 771 d
772 772
773 773
774 774 changeset: 0:9161b9aeaf16
775 775 user: test
776 776 date: Thu Jan 01 00:00:01 1970 +0000
777 777 files: a f
778 778 description:
779 779 a
780 780
781 781
782 782
783 783 log --removed revrange file
784 784
785 785 $ hg log --removed -v -r0:2 a
786 786 changeset: 0:9161b9aeaf16
787 787 user: test
788 788 date: Thu Jan 01 00:00:01 1970 +0000
789 789 files: a f
790 790 description:
791 791 a
792 792
793 793
794 794 $ cd ..
795 795
796 796 log --follow tests
797 797
798 798 $ hg init follow
799 799 $ cd follow
800 800
801 801 $ echo base > base
802 802 $ hg ci -Ambase -d '1 0'
803 803 adding base
804 804
805 805 $ echo r1 >> base
806 806 $ hg ci -Amr1 -d '1 0'
807 807 $ echo r2 >> base
808 808 $ hg ci -Amr2 -d '1 0'
809 809
810 810 $ hg up -C 1
811 811 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
812 812 $ echo b1 > b1
813 813
814 814 log -r "follow('set:clean()')"
815 815
816 816 $ hg log -r "follow('set:clean()')"
817 817 changeset: 0:67e992f2c4f3
818 818 user: test
819 819 date: Thu Jan 01 00:00:01 1970 +0000
820 820 summary: base
821 821
822 822 changeset: 1:3d5bf5654eda
823 823 user: test
824 824 date: Thu Jan 01 00:00:01 1970 +0000
825 825 summary: r1
826 826
827 827
828 828 $ hg ci -Amb1 -d '1 0'
829 829 adding b1
830 830 created new head
831 831
832 832
833 833 log -f
834 834
835 835 $ hg log -f
836 836 changeset: 3:e62f78d544b4
837 837 tag: tip
838 838 parent: 1:3d5bf5654eda
839 839 user: test
840 840 date: Thu Jan 01 00:00:01 1970 +0000
841 841 summary: b1
842 842
843 843 changeset: 1:3d5bf5654eda
844 844 user: test
845 845 date: Thu Jan 01 00:00:01 1970 +0000
846 846 summary: r1
847 847
848 848 changeset: 0:67e992f2c4f3
849 849 user: test
850 850 date: Thu Jan 01 00:00:01 1970 +0000
851 851 summary: base
852 852
853 853
854 854 log -r follow('glob:b*')
855 855
856 856 $ hg log -r "follow('glob:b*')"
857 857 changeset: 0:67e992f2c4f3
858 858 user: test
859 859 date: Thu Jan 01 00:00:01 1970 +0000
860 860 summary: base
861 861
862 862 changeset: 1:3d5bf5654eda
863 863 user: test
864 864 date: Thu Jan 01 00:00:01 1970 +0000
865 865 summary: r1
866 866
867 867 changeset: 3:e62f78d544b4
868 868 tag: tip
869 869 parent: 1:3d5bf5654eda
870 870 user: test
871 871 date: Thu Jan 01 00:00:01 1970 +0000
872 872 summary: b1
873 873
874 874 log -f -r '1 + 4'
875 875
876 876 $ hg up -C 0
877 877 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
878 878 $ echo b2 > b2
879 879 $ hg ci -Amb2 -d '1 0'
880 880 adding b2
881 881 created new head
882 882 $ hg log -f -r '1 + 4'
883 883 changeset: 4:ddb82e70d1a1
884 884 tag: tip
885 885 parent: 0:67e992f2c4f3
886 886 user: test
887 887 date: Thu Jan 01 00:00:01 1970 +0000
888 888 summary: b2
889 889
890 890 changeset: 1:3d5bf5654eda
891 891 user: test
892 892 date: Thu Jan 01 00:00:01 1970 +0000
893 893 summary: r1
894 894
895 895 changeset: 0:67e992f2c4f3
896 896 user: test
897 897 date: Thu Jan 01 00:00:01 1970 +0000
898 898 summary: base
899 899
900 900
901 901 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
902 902 effect
903 903
904 904 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
905 905 4:ddb82e70d1a1
906 906 1:3d5bf5654eda
907 907 0:67e992f2c4f3
908 908
909 909 log -r "follow('set:grep(b2)')"
910 910
911 911 $ hg log -r "follow('set:grep(b2)')"
912 912 changeset: 4:ddb82e70d1a1
913 913 tag: tip
914 914 parent: 0:67e992f2c4f3
915 915 user: test
916 916 date: Thu Jan 01 00:00:01 1970 +0000
917 917 summary: b2
918 918
919 919 log -r "follow('set:grep(b2)', 4)"
920 920
921 921 $ hg up -qC 0
922 922 $ hg log -r "follow('set:grep(b2)', 4)"
923 923 changeset: 4:ddb82e70d1a1
924 924 tag: tip
925 925 parent: 0:67e992f2c4f3
926 926 user: test
927 927 date: Thu Jan 01 00:00:01 1970 +0000
928 928 summary: b2
929 929
930 930
931 931 follow files starting from multiple revisions:
932 932
933 933 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
934 934 3: b1
935 935 4: b2
936 936
937 937 follow files starting from empty revision:
938 938
939 939 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
940 940
941 941 follow starting from revisions:
942 942
943 943 $ hg log -Gq -r "follow(startrev=2+4)"
944 944 o 4:ddb82e70d1a1
945 945 |
946 946 | o 2:60c670bf5b30
947 947 | |
948 948 | o 1:3d5bf5654eda
949 949 |/
950 950 @ 0:67e992f2c4f3
951 951
952 952
953 953 follow the current revision:
954 954
955 955 $ hg log -Gq -r "follow()"
956 956 @ 0:67e992f2c4f3
957 957
958 958
959 959 $ hg up -qC 4
960 960
961 961 log -f -r null
962 962
963 963 $ hg log -f -r null
964 964 changeset: -1:000000000000
965 965 user:
966 966 date: Thu Jan 01 00:00:00 1970 +0000
967 967
968 968 $ hg log -f -r null -G
969 969 o changeset: -1:000000000000
970 970 user:
971 971 date: Thu Jan 01 00:00:00 1970 +0000
972 972
973 973
974 974
975 975 log -f with null parent
976 976
977 977 $ hg up -C null
978 978 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
979 979 $ hg log -f
980 980
981 981
982 982 log -r . with two parents
983 983
984 984 $ hg up -C 3
985 985 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
986 986 $ hg merge tip
987 987 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
988 988 (branch merge, don't forget to commit)
989 989 $ hg log -r .
990 990 changeset: 3:e62f78d544b4
991 991 parent: 1:3d5bf5654eda
992 992 user: test
993 993 date: Thu Jan 01 00:00:01 1970 +0000
994 994 summary: b1
995 995
996 996
997 997
998 998 log -r . with one parent
999 999
1000 1000 $ hg ci -mm12 -d '1 0'
1001 1001 $ hg log -r .
1002 1002 changeset: 5:302e9dd6890d
1003 1003 tag: tip
1004 1004 parent: 3:e62f78d544b4
1005 1005 parent: 4:ddb82e70d1a1
1006 1006 user: test
1007 1007 date: Thu Jan 01 00:00:01 1970 +0000
1008 1008 summary: m12
1009 1009
1010 1010
1011 1011 $ echo postm >> b1
1012 1012 $ hg ci -Amb1.1 -d'1 0'
1013 1013
1014 1014
1015 1015 log --follow-first
1016 1016
1017 1017 $ hg log --follow-first
1018 1018 changeset: 6:2404bbcab562
1019 1019 tag: tip
1020 1020 user: test
1021 1021 date: Thu Jan 01 00:00:01 1970 +0000
1022 1022 summary: b1.1
1023 1023
1024 1024 changeset: 5:302e9dd6890d
1025 1025 parent: 3:e62f78d544b4
1026 1026 parent: 4:ddb82e70d1a1
1027 1027 user: test
1028 1028 date: Thu Jan 01 00:00:01 1970 +0000
1029 1029 summary: m12
1030 1030
1031 1031 changeset: 3:e62f78d544b4
1032 1032 parent: 1:3d5bf5654eda
1033 1033 user: test
1034 1034 date: Thu Jan 01 00:00:01 1970 +0000
1035 1035 summary: b1
1036 1036
1037 1037 changeset: 1:3d5bf5654eda
1038 1038 user: test
1039 1039 date: Thu Jan 01 00:00:01 1970 +0000
1040 1040 summary: r1
1041 1041
1042 1042 changeset: 0:67e992f2c4f3
1043 1043 user: test
1044 1044 date: Thu Jan 01 00:00:01 1970 +0000
1045 1045 summary: base
1046 1046
1047 1047
1048 1048
1049 1049 log -P 2
1050 1050
1051 1051 $ hg log -P 2
1052 1052 changeset: 6:2404bbcab562
1053 1053 tag: tip
1054 1054 user: test
1055 1055 date: Thu Jan 01 00:00:01 1970 +0000
1056 1056 summary: b1.1
1057 1057
1058 1058 changeset: 5:302e9dd6890d
1059 1059 parent: 3:e62f78d544b4
1060 1060 parent: 4:ddb82e70d1a1
1061 1061 user: test
1062 1062 date: Thu Jan 01 00:00:01 1970 +0000
1063 1063 summary: m12
1064 1064
1065 1065 changeset: 4:ddb82e70d1a1
1066 1066 parent: 0:67e992f2c4f3
1067 1067 user: test
1068 1068 date: Thu Jan 01 00:00:01 1970 +0000
1069 1069 summary: b2
1070 1070
1071 1071 changeset: 3:e62f78d544b4
1072 1072 parent: 1:3d5bf5654eda
1073 1073 user: test
1074 1074 date: Thu Jan 01 00:00:01 1970 +0000
1075 1075 summary: b1
1076 1076
1077 1077
1078 1078
1079 1079 log -r tip -p --git
1080 1080
1081 1081 $ hg log -r tip -p --git
1082 1082 changeset: 6:2404bbcab562
1083 1083 tag: tip
1084 1084 user: test
1085 1085 date: Thu Jan 01 00:00:01 1970 +0000
1086 1086 summary: b1.1
1087 1087
1088 1088 diff --git a/b1 b/b1
1089 1089 --- a/b1
1090 1090 +++ b/b1
1091 1091 @@ -1,1 +1,2 @@
1092 1092 b1
1093 1093 +postm
1094 1094
1095 1095
1096 1096
1097 1097 log -r ""
1098 1098
1099 1099 $ hg log -r ''
1100 1100 hg: parse error: empty query
1101 1101 [10]
1102 1102
1103 1103 log -r <some unknown node id>
1104 1104
1105 1105 $ hg log -r 1000000000000000000000000000000000000000
1106 1106 abort: unknown revision '1000000000000000000000000000000000000000'
1107 1107 [10]
1108 1108
1109 1109 log -k r1
1110 1110
1111 1111 $ hg log -k r1
1112 1112 changeset: 1:3d5bf5654eda
1113 1113 user: test
1114 1114 date: Thu Jan 01 00:00:01 1970 +0000
1115 1115 summary: r1
1116 1116
1117 1117 log -p -l2 --color=always
1118 1118
1119 1119 $ hg --config extensions.color= --config color.mode=ansi \
1120 1120 > log -p -l2 --color=always
1121 1121 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1122 1122 tag: tip
1123 1123 user: test
1124 1124 date: Thu Jan 01 00:00:01 1970 +0000
1125 1125 summary: b1.1
1126 1126
1127 1127 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1128 1128 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1129 1129 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1130 1130 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1131 1131 b1
1132 1132 \x1b[0;32m+postm\x1b[0m (esc)
1133 1133
1134 1134 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1135 1135 parent: 3:e62f78d544b4
1136 1136 parent: 4:ddb82e70d1a1
1137 1137 user: test
1138 1138 date: Thu Jan 01 00:00:01 1970 +0000
1139 1139 summary: m12
1140 1140
1141 1141 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1142 1142 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1143 1143 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1144 1144 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1145 1145 \x1b[0;32m+b2\x1b[0m (esc)
1146 1146
1147 1147
1148 1148
1149 1149 log -r tip --stat
1150 1150
1151 1151 $ hg log -r tip --stat
1152 1152 changeset: 6:2404bbcab562
1153 1153 tag: tip
1154 1154 user: test
1155 1155 date: Thu Jan 01 00:00:01 1970 +0000
1156 1156 summary: b1.1
1157 1157
1158 1158 b1 | 1 +
1159 1159 1 files changed, 1 insertions(+), 0 deletions(-)
1160 1160
1161 1161
1162 1162 $ cd ..
1163 1163
1164 1164 log --follow --patch FILE in repository where linkrev isn't trustworthy
1165 1165 (issue5376, issue6124)
1166 1166
1167 1167 $ hg init follow-dup
1168 1168 $ cd follow-dup
1169 1169 $ cat <<EOF >> .hg/hgrc
1170 1170 > [command-templates]
1171 1171 > log = '=== {rev}: {desc}\n'
1172 1172 > [diff]
1173 1173 > nodates = True
1174 1174 > EOF
1175 1175 $ echo 0 >> a
1176 1176 $ hg ci -qAm 'a0'
1177 1177 $ echo 1 >> a
1178 1178 $ hg ci -m 'a1'
1179 1179 $ hg up -q 0
1180 1180 $ echo 1 >> a
1181 1181 $ touch b
1182 1182 $ hg ci -qAm 'a1 with b'
1183 1183 $ echo 3 >> a
1184 1184 $ hg ci -m 'a3'
1185 1185
1186 1186 fctx.rev() == 2, but fctx.linkrev() == 1
1187 1187
1188 1188 $ hg log -pf a
1189 1189 === 3: a3
1190 1190 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1191 1191 --- a/a
1192 1192 +++ b/a
1193 1193 @@ -1,2 +1,3 @@
1194 1194 0
1195 1195 1
1196 1196 +3
1197 1197
1198 1198 === 2: a1 with b
1199 1199 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1200 1200 --- a/a
1201 1201 +++ b/a
1202 1202 @@ -1,1 +1,2 @@
1203 1203 0
1204 1204 +1
1205 1205
1206 1206 === 0: a0
1207 1207 diff -r 000000000000 -r 49b5e81287e2 a
1208 1208 --- /dev/null
1209 1209 +++ b/a
1210 1210 @@ -0,0 +1,1 @@
1211 1211 +0
1212 1212
1213 1213 $ hg log -pr . a
1214 1214 === 3: a3
1215 1215 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1216 1216 --- a/a
1217 1217 +++ b/a
1218 1218 @@ -1,2 +1,3 @@
1219 1219 0
1220 1220 1
1221 1221 +3
1222 1222
1223 1223
1224 1224 fctx.introrev() == 2, but fctx.linkrev() == 1
1225 1225
1226 1226 $ hg up -q 2
1227 1227 $ hg log -pf a
1228 1228 === 2: a1 with b
1229 1229 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1230 1230 --- a/a
1231 1231 +++ b/a
1232 1232 @@ -1,1 +1,2 @@
1233 1233 0
1234 1234 +1
1235 1235
1236 1236 === 0: a0
1237 1237 diff -r 000000000000 -r 49b5e81287e2 a
1238 1238 --- /dev/null
1239 1239 +++ b/a
1240 1240 @@ -0,0 +1,1 @@
1241 1241 +0
1242 1242
1243 1243
1244 1244 BROKEN: should show the same diff as for rev 2 above
1245 1245 $ hg log -pr . a
1246 1246
1247 1247 $ cd ..
1248 1248
1249 1249 Multiple copy sources of a file:
1250 1250
1251 1251 $ hg init follow-multi
1252 1252 $ cd follow-multi
1253 1253 $ echo 0 >> a
1254 1254 $ hg ci -qAm 'a'
1255 1255 $ hg cp a b
1256 1256 $ hg ci -m 'a->b'
1257 1257 $ echo 2 >> a
1258 1258 $ hg ci -m 'a'
1259 1259 $ echo 3 >> b
1260 1260 $ hg ci -m 'b'
1261 1261 $ echo 4 >> a
1262 1262 $ echo 4 >> b
1263 1263 $ hg ci -m 'a,b'
1264 1264 $ echo 5 >> a
1265 1265 $ hg ci -m 'a0'
1266 1266 $ echo 6 >> b
1267 1267 $ hg ci -m 'b0'
1268 1268 $ hg up -q 4
1269 1269 $ echo 7 >> b
1270 1270 $ hg ci -m 'b1'
1271 1271 created new head
1272 1272 $ echo 8 >> a
1273 1273 $ hg ci -m 'a1'
1274 1274 $ hg rm a
1275 1275 $ hg mv b a
1276 1276 $ hg ci -m 'b1->a1'
1277 1277 $ hg merge -qt :local
1278 1278 $ hg ci -m '(a0,b1->a1)->a'
1279 1279
1280 1280 $ hg log -GT '{rev}: {desc}\n'
1281 1281 @ 10: (a0,b1->a1)->a
1282 1282 |\
1283 1283 | o 9: b1->a1
1284 1284 | |
1285 1285 | o 8: a1
1286 1286 | |
1287 1287 | o 7: b1
1288 1288 | |
1289 1289 o | 6: b0
1290 1290 | |
1291 1291 o | 5: a0
1292 1292 |/
1293 1293 o 4: a,b
1294 1294 |
1295 1295 o 3: b
1296 1296 |
1297 1297 o 2: a
1298 1298 |
1299 1299 o 1: a->b
1300 1300 |
1301 1301 o 0: a
1302 1302
1303 1303
1304 1304 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1305 1305 be indexed solely by fctx.linkrev().
1306 1306
1307 1307 $ hg log -T '{rev}: {desc}\n' -f a
1308 1308 10: (a0,b1->a1)->a
1309 1309 9: b1->a1
1310 1310 7: b1
1311 1311 5: a0
1312 1312 4: a,b
1313 1313 3: b
1314 1314 2: a
1315 1315 1: a->b
1316 1316 0: a
1317 1317
1318 1318 $ cd ..
1319 1319
1320 1320 Test that log should respect the order of -rREV even if multiple OR conditions
1321 1321 are specified (issue5100):
1322 1322
1323 1323 $ hg init revorder
1324 1324 $ cd revorder
1325 1325
1326 1326 $ hg branch -q b0
1327 1327 $ echo 0 >> f0
1328 1328 $ hg ci -qAm k0 -u u0
1329 1329 $ hg branch -q b1
1330 1330 $ echo 1 >> f1
1331 1331 $ hg ci -qAm k1 -u u1
1332 1332 $ hg branch -q b2
1333 1333 $ echo 2 >> f2
1334 1334 $ hg ci -qAm k2 -u u2
1335 1335
1336 1336 $ hg update -q b2
1337 1337 $ echo 3 >> f2
1338 1338 $ hg ci -qAm k2 -u u2
1339 1339 $ hg update -q b1
1340 1340 $ echo 4 >> f1
1341 1341 $ hg ci -qAm k1 -u u1
1342 1342 $ hg update -q b0
1343 1343 $ echo 5 >> f0
1344 1344 $ hg ci -qAm k0 -u u0
1345 1345
1346 1346 summary of revisions:
1347 1347
1348 1348 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1349 1349 @ 5 b0 u0 k0 f0
1350 1350 |
1351 1351 | o 4 b1 u1 k1 f1
1352 1352 | |
1353 1353 | | o 3 b2 u2 k2 f2
1354 1354 | | |
1355 1355 | | o 2 b2 u2 k2 f2
1356 1356 | |/
1357 1357 | o 1 b1 u1 k1 f1
1358 1358 |/
1359 1359 o 0 b0 u0 k0 f0
1360 1360
1361 1361
1362 1362 log -b BRANCH in ascending order:
1363 1363
1364 1364 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1365 1365 0 b0
1366 1366 1 b1
1367 1367 4 b1
1368 1368 5 b0
1369 1369 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1370 1370 0 b0
1371 1371 1 b1
1372 1372 4 b1
1373 1373 5 b0
1374 1374
1375 1375 log --only-branch BRANCH in descending order:
1376 1376
1377 1377 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1378 1378 4 b1
1379 1379 3 b2
1380 1380 2 b2
1381 1381 1 b1
1382 1382 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1383 1383 4 b1
1384 1384 3 b2
1385 1385 2 b2
1386 1386 1 b1
1387 1387
1388 1388 log -u USER in ascending order, against compound set:
1389 1389
1390 1390 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1391 1391 0 u0
1392 1392 2 u2
1393 1393 3 u2
1394 1394 5 u0
1395 1395 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1396 1396 0 u0
1397 1397 2 u2
1398 1398 3 u2
1399 1399 5 u0
1400 1400
1401 1401 log -k TEXT in descending order, against compound set:
1402 1402
1403 1403 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1404 1404 5 k0
1405 1405 3 k2
1406 1406 2 k2
1407 1407 1 k1
1408 1408 0 k0
1409 1409 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1410 1410 5 k0
1411 1411 3 k2
1412 1412 2 k2
1413 1413 1 k1
1414 1414 0 k0
1415 1415
1416 1416 log -b/-u/-k shouldn't accept string-matcher syntax:
1417 1417
1418 1418 $ hg log -b 're:.*'
1419 1419 abort: unknown revision 're:.*'
1420 1420 [10]
1421 1421 $ hg log -k 're:.*'
1422 1422 $ hg log -u 're:.*'
1423 1423
1424 1424 log FILE in ascending order, against dagrange:
1425 1425
1426 1426 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1427 1427 1 f1
1428 1428 2 f2
1429 1429 3 f2
1430 1430 4 f1
1431 1431 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1432 1432 1 f1
1433 1433 2 f2
1434 1434 3 f2
1435 1435 4 f1
1436 1436
1437 1437 $ cd ..
1438 1438
1439 1439 User
1440 1440
1441 1441 $ hg init usertest
1442 1442 $ cd usertest
1443 1443
1444 1444 $ echo a > a
1445 1445 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1446 1446 adding a
1447 1447 $ echo b > b
1448 1448 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1449 1449 adding b
1450 1450
1451 1451 $ hg log -u "User One <user1@example.org>"
1452 1452 changeset: 0:29a4c94f1924
1453 1453 user: User One <user1@example.org>
1454 1454 date: Thu Jan 01 00:00:00 1970 +0000
1455 1455 summary: a
1456 1456
1457 1457 $ hg log -u "user1" -u "user2"
1458 1458 changeset: 1:e834b5e69c0e
1459 1459 tag: tip
1460 1460 user: User Two <user2@example.org>
1461 1461 date: Thu Jan 01 00:00:00 1970 +0000
1462 1462 summary: b
1463 1463
1464 1464 changeset: 0:29a4c94f1924
1465 1465 user: User One <user1@example.org>
1466 1466 date: Thu Jan 01 00:00:00 1970 +0000
1467 1467 summary: a
1468 1468
1469 1469 $ hg log -u "user3"
1470 1470
1471 1471 "-u USER" shouldn't be overridden by "user(USER)" alias
1472 1472
1473 1473 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1474 1474 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1475 1475 changeset: 0:29a4c94f1924
1476 1476 user: User One <user1@example.org>
1477 1477 date: Thu Jan 01 00:00:00 1970 +0000
1478 1478 summary: a
1479 1479
1480 1480
1481 1481 $ cd ..
1482 1482
1483 1483 $ hg init branches
1484 1484 $ cd branches
1485 1485
1486 1486 $ echo a > a
1487 1487 $ hg ci -A -m "commit on default"
1488 1488 adding a
1489 1489 $ hg branch test
1490 1490 marked working directory as branch test
1491 1491 (branches are permanent and global, did you want a bookmark?)
1492 1492 $ echo b > b
1493 1493 $ hg ci -A -m "commit on test"
1494 1494 adding b
1495 1495
1496 1496 $ hg up default
1497 1497 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1498 1498 $ echo c > c
1499 1499 $ hg ci -A -m "commit on default"
1500 1500 adding c
1501 1501 $ hg up test
1502 1502 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1503 1503 $ echo c > c
1504 1504 $ hg ci -A -m "commit on test"
1505 1505 adding c
1506 1506
1507 1507
1508 1508 log -b default
1509 1509
1510 1510 $ hg log -b default
1511 1511 changeset: 2:c3a4f03cc9a7
1512 1512 parent: 0:24427303d56f
1513 1513 user: test
1514 1514 date: Thu Jan 01 00:00:00 1970 +0000
1515 1515 summary: commit on default
1516 1516
1517 1517 changeset: 0:24427303d56f
1518 1518 user: test
1519 1519 date: Thu Jan 01 00:00:00 1970 +0000
1520 1520 summary: commit on default
1521 1521
1522 1522
1523 1523
1524 1524 log -b test
1525 1525
1526 1526 $ hg log -b test
1527 1527 changeset: 3:f5d8de11c2e2
1528 1528 branch: test
1529 1529 tag: tip
1530 1530 parent: 1:d32277701ccb
1531 1531 user: test
1532 1532 date: Thu Jan 01 00:00:00 1970 +0000
1533 1533 summary: commit on test
1534 1534
1535 1535 changeset: 1:d32277701ccb
1536 1536 branch: test
1537 1537 user: test
1538 1538 date: Thu Jan 01 00:00:00 1970 +0000
1539 1539 summary: commit on test
1540 1540
1541 1541
1542 1542
1543 1543 log -b dummy
1544 1544
1545 1545 $ hg log -b dummy
1546 1546 abort: unknown revision 'dummy'
1547 1547 [10]
1548 1548
1549 1549
1550 1550 log -b .
1551 1551
1552 1552 $ hg log -b .
1553 1553 changeset: 3:f5d8de11c2e2
1554 1554 branch: test
1555 1555 tag: tip
1556 1556 parent: 1:d32277701ccb
1557 1557 user: test
1558 1558 date: Thu Jan 01 00:00:00 1970 +0000
1559 1559 summary: commit on test
1560 1560
1561 1561 changeset: 1:d32277701ccb
1562 1562 branch: test
1563 1563 user: test
1564 1564 date: Thu Jan 01 00:00:00 1970 +0000
1565 1565 summary: commit on test
1566 1566
1567 1567
1568 1568
1569 1569 log -b default -b test
1570 1570
1571 1571 $ hg log -b default -b test
1572 1572 changeset: 3:f5d8de11c2e2
1573 1573 branch: test
1574 1574 tag: tip
1575 1575 parent: 1:d32277701ccb
1576 1576 user: test
1577 1577 date: Thu Jan 01 00:00:00 1970 +0000
1578 1578 summary: commit on test
1579 1579
1580 1580 changeset: 2:c3a4f03cc9a7
1581 1581 parent: 0:24427303d56f
1582 1582 user: test
1583 1583 date: Thu Jan 01 00:00:00 1970 +0000
1584 1584 summary: commit on default
1585 1585
1586 1586 changeset: 1:d32277701ccb
1587 1587 branch: test
1588 1588 user: test
1589 1589 date: Thu Jan 01 00:00:00 1970 +0000
1590 1590 summary: commit on test
1591 1591
1592 1592 changeset: 0:24427303d56f
1593 1593 user: test
1594 1594 date: Thu Jan 01 00:00:00 1970 +0000
1595 1595 summary: commit on default
1596 1596
1597 1597
1598 1598
1599 1599 log -b default -b .
1600 1600
1601 1601 $ hg log -b default -b .
1602 1602 changeset: 3:f5d8de11c2e2
1603 1603 branch: test
1604 1604 tag: tip
1605 1605 parent: 1:d32277701ccb
1606 1606 user: test
1607 1607 date: Thu Jan 01 00:00:00 1970 +0000
1608 1608 summary: commit on test
1609 1609
1610 1610 changeset: 2:c3a4f03cc9a7
1611 1611 parent: 0:24427303d56f
1612 1612 user: test
1613 1613 date: Thu Jan 01 00:00:00 1970 +0000
1614 1614 summary: commit on default
1615 1615
1616 1616 changeset: 1:d32277701ccb
1617 1617 branch: test
1618 1618 user: test
1619 1619 date: Thu Jan 01 00:00:00 1970 +0000
1620 1620 summary: commit on test
1621 1621
1622 1622 changeset: 0:24427303d56f
1623 1623 user: test
1624 1624 date: Thu Jan 01 00:00:00 1970 +0000
1625 1625 summary: commit on default
1626 1626
1627 1627
1628 1628
1629 1629 log -b . -b test
1630 1630
1631 1631 $ hg log -b . -b test
1632 1632 changeset: 3:f5d8de11c2e2
1633 1633 branch: test
1634 1634 tag: tip
1635 1635 parent: 1:d32277701ccb
1636 1636 user: test
1637 1637 date: Thu Jan 01 00:00:00 1970 +0000
1638 1638 summary: commit on test
1639 1639
1640 1640 changeset: 1:d32277701ccb
1641 1641 branch: test
1642 1642 user: test
1643 1643 date: Thu Jan 01 00:00:00 1970 +0000
1644 1644 summary: commit on test
1645 1645
1646 1646
1647 1647
1648 1648 log -b 2
1649 1649
1650 1650 $ hg log -b 2
1651 1651 changeset: 2:c3a4f03cc9a7
1652 1652 parent: 0:24427303d56f
1653 1653 user: test
1654 1654 date: Thu Jan 01 00:00:00 1970 +0000
1655 1655 summary: commit on default
1656 1656
1657 1657 changeset: 0:24427303d56f
1658 1658 user: test
1659 1659 date: Thu Jan 01 00:00:00 1970 +0000
1660 1660 summary: commit on default
1661 1661
1662 1662 #if gettext
1663 1663
1664 1664 Test that all log names are translated (e.g. branches, bookmarks, tags):
1665 1665
1666 1666 $ hg bookmark babar -r tip
1667 1667
1668 1668 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1669 1669 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1670 1670 Zweig: test
1671 1671 Lesezeichen: babar
1672 1672 Marke: tip
1673 1673 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1674 1674 Nutzer: test
1675 1675 Datum: Thu Jan 01 00:00:00 1970 +0000
1676 1676 Zusammenfassung: commit on test
1677 1677
1678 1678 $ hg bookmark -d babar
1679 1679
1680 1680 #endif
1681 1681
1682 1682 log -p --cwd dir (in subdir)
1683 1683
1684 1684 $ mkdir dir
1685 1685 $ hg log -p --cwd dir
1686 1686 changeset: 3:f5d8de11c2e2
1687 1687 branch: test
1688 1688 tag: tip
1689 1689 parent: 1:d32277701ccb
1690 1690 user: test
1691 1691 date: Thu Jan 01 00:00:00 1970 +0000
1692 1692 summary: commit on test
1693 1693
1694 1694 diff -r d32277701ccb -r f5d8de11c2e2 c
1695 1695 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1696 1696 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1697 1697 @@ -0,0 +1,1 @@
1698 1698 +c
1699 1699
1700 1700 changeset: 2:c3a4f03cc9a7
1701 1701 parent: 0:24427303d56f
1702 1702 user: test
1703 1703 date: Thu Jan 01 00:00:00 1970 +0000
1704 1704 summary: commit on default
1705 1705
1706 1706 diff -r 24427303d56f -r c3a4f03cc9a7 c
1707 1707 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1708 1708 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1709 1709 @@ -0,0 +1,1 @@
1710 1710 +c
1711 1711
1712 1712 changeset: 1:d32277701ccb
1713 1713 branch: test
1714 1714 user: test
1715 1715 date: Thu Jan 01 00:00:00 1970 +0000
1716 1716 summary: commit on test
1717 1717
1718 1718 diff -r 24427303d56f -r d32277701ccb b
1719 1719 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1720 1720 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1721 1721 @@ -0,0 +1,1 @@
1722 1722 +b
1723 1723
1724 1724 changeset: 0:24427303d56f
1725 1725 user: test
1726 1726 date: Thu Jan 01 00:00:00 1970 +0000
1727 1727 summary: commit on default
1728 1728
1729 1729 diff -r 000000000000 -r 24427303d56f a
1730 1730 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1731 1731 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1732 1732 @@ -0,0 +1,1 @@
1733 1733 +a
1734 1734
1735 1735
1736 1736
1737 1737 log -p -R repo
1738 1738
1739 1739 $ cd dir
1740 1740 $ hg log -p -R .. ../a
1741 1741 changeset: 0:24427303d56f
1742 1742 user: test
1743 1743 date: Thu Jan 01 00:00:00 1970 +0000
1744 1744 summary: commit on default
1745 1745
1746 1746 diff -r 000000000000 -r 24427303d56f a
1747 1747 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1748 1748 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1749 1749 @@ -0,0 +1,1 @@
1750 1750 +a
1751 1751
1752 1752
1753 1753 $ cd ../..
1754 1754
1755 1755 $ hg init follow2
1756 1756 $ cd follow2
1757 1757
1758 1758 # Build the following history:
1759 1759 # tip - o - x - o - x - x
1760 1760 # \ /
1761 1761 # o - o - o - x
1762 1762 # \ /
1763 1763 # o
1764 1764 #
1765 1765 # Where "o" is a revision containing "foo" and
1766 1766 # "x" is a revision without "foo"
1767 1767
1768 1768 $ touch init
1769 1769 $ hg ci -A -m "init, unrelated"
1770 1770 adding init
1771 1771 $ echo 'foo' > init
1772 1772 $ hg ci -m "change, unrelated"
1773 1773 $ echo 'foo' > foo
1774 1774 $ hg ci -A -m "add unrelated old foo"
1775 1775 adding foo
1776 1776 $ hg rm foo
1777 1777 $ hg ci -m "delete foo, unrelated"
1778 1778 $ echo 'related' > foo
1779 1779 $ hg ci -A -m "add foo, related"
1780 1780 adding foo
1781 1781
1782 1782 $ hg up 0
1783 1783 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1784 1784 $ touch branch
1785 1785 $ hg ci -A -m "first branch, unrelated"
1786 1786 adding branch
1787 1787 created new head
1788 1788 $ touch foo
1789 1789 $ hg ci -A -m "create foo, related"
1790 1790 adding foo
1791 1791 $ echo 'change' > foo
1792 1792 $ hg ci -m "change foo, related"
1793 1793
1794 1794 $ hg up 6
1795 1795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1796 1796 $ echo 'change foo in branch' > foo
1797 1797 $ hg ci -m "change foo in branch, related"
1798 1798 created new head
1799 1799 $ hg merge 7
1800 1800 merging foo
1801 1801 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1802 1802 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1803 1803 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1804 1804 [1]
1805 1805 $ echo 'merge 1' > foo
1806 1806 $ hg resolve -m foo
1807 1807 (no more unresolved files)
1808 1808 $ hg ci -m "First merge, related"
1809 1809
1810 1810 $ hg merge 4
1811 1811 merging foo
1812 1812 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1813 1813 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1814 1814 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1815 1815 [1]
1816 1816 $ echo 'merge 2' > foo
1817 1817 $ hg resolve -m foo
1818 1818 (no more unresolved files)
1819 1819 $ hg ci -m "Last merge, related"
1820 1820
1821 1821 $ hg log --graph
1822 1822 @ changeset: 10:4dae8563d2c5
1823 1823 |\ tag: tip
1824 1824 | | parent: 9:7b35701b003e
1825 1825 | | parent: 4:88176d361b69
1826 1826 | | user: test
1827 1827 | | date: Thu Jan 01 00:00:00 1970 +0000
1828 1828 | | summary: Last merge, related
1829 1829 | |
1830 1830 | o changeset: 9:7b35701b003e
1831 1831 | |\ parent: 8:e5416ad8a855
1832 1832 | | | parent: 7:87fe3144dcfa
1833 1833 | | | user: test
1834 1834 | | | date: Thu Jan 01 00:00:00 1970 +0000
1835 1835 | | | summary: First merge, related
1836 1836 | | |
1837 1837 | | o changeset: 8:e5416ad8a855
1838 1838 | | | parent: 6:dc6c325fe5ee
1839 1839 | | | user: test
1840 1840 | | | date: Thu Jan 01 00:00:00 1970 +0000
1841 1841 | | | summary: change foo in branch, related
1842 1842 | | |
1843 1843 | o | changeset: 7:87fe3144dcfa
1844 1844 | |/ user: test
1845 1845 | | date: Thu Jan 01 00:00:00 1970 +0000
1846 1846 | | summary: change foo, related
1847 1847 | |
1848 1848 | o changeset: 6:dc6c325fe5ee
1849 1849 | | user: test
1850 1850 | | date: Thu Jan 01 00:00:00 1970 +0000
1851 1851 | | summary: create foo, related
1852 1852 | |
1853 1853 | o changeset: 5:73db34516eb9
1854 1854 | | parent: 0:e87515fd044a
1855 1855 | | user: test
1856 1856 | | date: Thu Jan 01 00:00:00 1970 +0000
1857 1857 | | summary: first branch, unrelated
1858 1858 | |
1859 1859 o | changeset: 4:88176d361b69
1860 1860 | | user: test
1861 1861 | | date: Thu Jan 01 00:00:00 1970 +0000
1862 1862 | | summary: add foo, related
1863 1863 | |
1864 1864 o | changeset: 3:dd78ae4afb56
1865 1865 | | user: test
1866 1866 | | date: Thu Jan 01 00:00:00 1970 +0000
1867 1867 | | summary: delete foo, unrelated
1868 1868 | |
1869 1869 o | changeset: 2:c4c64aedf0f7
1870 1870 | | user: test
1871 1871 | | date: Thu Jan 01 00:00:00 1970 +0000
1872 1872 | | summary: add unrelated old foo
1873 1873 | |
1874 1874 o | changeset: 1:e5faa7440653
1875 1875 |/ user: test
1876 1876 | date: Thu Jan 01 00:00:00 1970 +0000
1877 1877 | summary: change, unrelated
1878 1878 |
1879 1879 o changeset: 0:e87515fd044a
1880 1880 user: test
1881 1881 date: Thu Jan 01 00:00:00 1970 +0000
1882 1882 summary: init, unrelated
1883 1883
1884 1884
1885 1885 $ hg --traceback log -f foo
1886 1886 changeset: 10:4dae8563d2c5
1887 1887 tag: tip
1888 1888 parent: 9:7b35701b003e
1889 1889 parent: 4:88176d361b69
1890 1890 user: test
1891 1891 date: Thu Jan 01 00:00:00 1970 +0000
1892 1892 summary: Last merge, related
1893 1893
1894 1894 changeset: 9:7b35701b003e
1895 1895 parent: 8:e5416ad8a855
1896 1896 parent: 7:87fe3144dcfa
1897 1897 user: test
1898 1898 date: Thu Jan 01 00:00:00 1970 +0000
1899 1899 summary: First merge, related
1900 1900
1901 1901 changeset: 8:e5416ad8a855
1902 1902 parent: 6:dc6c325fe5ee
1903 1903 user: test
1904 1904 date: Thu Jan 01 00:00:00 1970 +0000
1905 1905 summary: change foo in branch, related
1906 1906
1907 1907 changeset: 7:87fe3144dcfa
1908 1908 user: test
1909 1909 date: Thu Jan 01 00:00:00 1970 +0000
1910 1910 summary: change foo, related
1911 1911
1912 1912 changeset: 6:dc6c325fe5ee
1913 1913 user: test
1914 1914 date: Thu Jan 01 00:00:00 1970 +0000
1915 1915 summary: create foo, related
1916 1916
1917 1917 changeset: 4:88176d361b69
1918 1918 user: test
1919 1919 date: Thu Jan 01 00:00:00 1970 +0000
1920 1920 summary: add foo, related
1921 1921
1922 1922
1923 1923 Also check when maxrev < lastrevfilelog
1924 1924
1925 1925 $ hg --traceback log -f -r4 foo
1926 1926 changeset: 4:88176d361b69
1927 1927 user: test
1928 1928 date: Thu Jan 01 00:00:00 1970 +0000
1929 1929 summary: add foo, related
1930 1930
1931 1931 $ cd ..
1932 1932
1933 1933 Issue2383: hg log showing _less_ differences than hg diff
1934 1934
1935 1935 $ hg init issue2383
1936 1936 $ cd issue2383
1937 1937
1938 1938 Create a test repo:
1939 1939
1940 1940 $ echo a > a
1941 1941 $ hg ci -Am0
1942 1942 adding a
1943 1943 $ echo b > b
1944 1944 $ hg ci -Am1
1945 1945 adding b
1946 1946 $ hg co 0
1947 1947 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1948 1948 $ echo b > a
1949 1949 $ hg ci -m2
1950 1950 created new head
1951 1951
1952 1952 Merge:
1953 1953
1954 1954 $ hg merge
1955 1955 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1956 1956 (branch merge, don't forget to commit)
1957 1957
1958 1958 Make sure there's a file listed in the merge to trigger the bug:
1959 1959
1960 1960 $ echo c > a
1961 1961 $ hg ci -m3
1962 1962
1963 1963 Two files shown here in diff:
1964 1964
1965 1965 $ hg diff --rev 2:3
1966 1966 diff -r b09be438c43a -r 8e07aafe1edc a
1967 1967 --- a/a Thu Jan 01 00:00:00 1970 +0000
1968 1968 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1969 1969 @@ -1,1 +1,1 @@
1970 1970 -b
1971 1971 +c
1972 1972 diff -r b09be438c43a -r 8e07aafe1edc b
1973 1973 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1974 1974 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1975 1975 @@ -0,0 +1,1 @@
1976 1976 +b
1977 1977
1978 1978 Diff here should be the same:
1979 1979
1980 1980 $ hg log -vpr 3
1981 1981 changeset: 3:8e07aafe1edc
1982 1982 tag: tip
1983 1983 parent: 2:b09be438c43a
1984 1984 parent: 1:925d80f479bb
1985 1985 user: test
1986 1986 date: Thu Jan 01 00:00:00 1970 +0000
1987 1987 files: a
1988 1988 description:
1989 1989 3
1990 1990
1991 1991
1992 1992 diff -r b09be438c43a -r 8e07aafe1edc a
1993 1993 --- a/a Thu Jan 01 00:00:00 1970 +0000
1994 1994 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1995 1995 @@ -1,1 +1,1 @@
1996 1996 -b
1997 1997 +c
1998 1998 diff -r b09be438c43a -r 8e07aafe1edc b
1999 1999 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2000 2000 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2001 2001 @@ -0,0 +1,1 @@
2002 2002 +b
2003 2003
2004 $ hg log -r 3 -T'{diffstat}\n'
2005 2: +2/-1
2004 2006
2005 2007 Test that diff.merge is respected (file b was added on one side and
2006 2008 and therefore merged cleanly)
2007 2009
2008 2010 $ hg log -pr 3 --config diff.merge=yes
2009 2011 changeset: 3:8e07aafe1edc
2010 2012 tag: tip
2011 2013 parent: 2:b09be438c43a
2012 2014 parent: 1:925d80f479bb
2013 2015 user: test
2014 2016 date: Thu Jan 01 00:00:00 1970 +0000
2015 2017 summary: 3
2016 2018
2017 2019 diff -r 8e07aafe1edc a
2018 2020 --- a/a Thu Jan 01 00:00:00 1970 +0000
2019 2021 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2020 2022 @@ -1,1 +1,1 @@
2021 2023 -b
2022 2024 +c
2023 2025
2026 $ hg log -r 3 -T'{diffstat}\n' --config diff.merge=yes
2027 1: +1/-1
2028
2024 2029 $ cd ..
2025 2030
2026 2031 'hg log -r rev fn' when last(filelog(fn)) != rev
2027 2032
2028 2033 $ hg init simplelog
2029 2034 $ cd simplelog
2030 2035 $ echo f > a
2031 2036 $ hg ci -Am'a' -d '0 0'
2032 2037 adding a
2033 2038 $ echo f >> a
2034 2039 $ hg ci -Am'a bis' -d '1 0'
2035 2040
2036 2041 $ hg log -r0 a
2037 2042 changeset: 0:9f758d63dcde
2038 2043 user: test
2039 2044 date: Thu Jan 01 00:00:00 1970 +0000
2040 2045 summary: a
2041 2046
2042 2047 enable obsolete to test hidden feature
2043 2048
2044 2049 $ cat >> $HGRCPATH << EOF
2045 2050 > [experimental]
2046 2051 > evolution.createmarkers=True
2047 2052 > EOF
2048 2053
2049 2054 $ hg log --template='{rev}:{node}\n'
2050 2055 1:a765632148dc55d38c35c4f247c618701886cb2f
2051 2056 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2052 2057 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
2053 2058 1 new obsolescence markers
2054 2059 obsoleted 1 changesets
2055 2060 $ hg up null -q
2056 2061 $ hg log --template='{rev}:{node}\n'
2057 2062 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2058 2063 $ hg log --template='{rev}:{node}\n' --hidden
2059 2064 1:a765632148dc55d38c35c4f247c618701886cb2f
2060 2065 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2061 2066 $ hg log -r a
2062 2067 abort: hidden revision 'a' is pruned
2063 2068 (use --hidden to access hidden revisions)
2064 2069 [10]
2065 2070
2066 2071 test that parent prevent a changeset to be hidden
2067 2072
2068 2073 $ hg up 1 -q --hidden
2069 2074 updated to hidden changeset a765632148dc
2070 2075 (hidden revision 'a765632148dc' is pruned)
2071 2076 $ hg log --template='{rev}:{node}\n'
2072 2077 1:a765632148dc55d38c35c4f247c618701886cb2f
2073 2078 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2074 2079
2075 2080 test that second parent prevent a changeset to be hidden too
2076 2081
2077 2082 $ hg debugsetparents 0 1 # nothing suitable to merge here
2078 2083 $ hg log --template='{rev}:{node}\n'
2079 2084 1:a765632148dc55d38c35c4f247c618701886cb2f
2080 2085 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2081 2086 $ hg debugsetparents 1
2082 2087 $ hg up -q null
2083 2088
2084 2089 bookmarks prevent a changeset being hidden
2085 2090
2086 2091 $ hg bookmark --hidden -r 1 X
2087 2092 bookmarking hidden changeset a765632148dc
2088 2093 (hidden revision 'a765632148dc' is pruned)
2089 2094 $ hg log --template '{rev}:{node}\n'
2090 2095 1:a765632148dc55d38c35c4f247c618701886cb2f
2091 2096 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2092 2097 $ hg bookmark -d X
2093 2098
2094 2099 divergent bookmarks are not hidden
2095 2100
2096 2101 $ hg bookmark --hidden -r 1 X@foo
2097 2102 bookmarking hidden changeset a765632148dc
2098 2103 (hidden revision 'a765632148dc' is pruned)
2099 2104 $ hg log --template '{rev}:{node}\n'
2100 2105 1:a765632148dc55d38c35c4f247c618701886cb2f
2101 2106 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2102 2107
2103 2108 test hidden revision 0 (issue5385)
2104 2109
2105 2110 $ hg bookmark -d X@foo
2106 2111 $ hg up null -q
2107 2112 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2108 2113 1 new obsolescence markers
2109 2114 obsoleted 1 changesets
2110 2115 $ echo f > b
2111 2116 $ hg ci -Am'b' -d '2 0'
2112 2117 adding b
2113 2118 $ echo f >> b
2114 2119 $ hg ci -m'b bis' -d '3 0'
2115 2120 $ hg log -T'{rev}:{node}\n'
2116 2121 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2117 2122 2:94375ec45bddd2a824535fc04855bd058c926ec0
2118 2123
2119 2124 $ hg log -T'{rev}:{node}\n' -r:
2120 2125 2:94375ec45bddd2a824535fc04855bd058c926ec0
2121 2126 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2122 2127 $ hg log -T'{rev}:{node}\n' -r:tip
2123 2128 2:94375ec45bddd2a824535fc04855bd058c926ec0
2124 2129 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2125 2130 $ hg log -T'{rev}:{node}\n' -r:0
2126 2131 abort: hidden revision '0' is pruned
2127 2132 (use --hidden to access hidden revisions)
2128 2133 [10]
2129 2134 $ hg log -T'{rev}:{node}\n' -f
2130 2135 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2131 2136 2:94375ec45bddd2a824535fc04855bd058c926ec0
2132 2137
2133 2138 clear extensions configuration
2134 2139 $ echo '[extensions]' >> $HGRCPATH
2135 2140 $ echo "obs=!" >> $HGRCPATH
2136 2141 $ cd ..
2137 2142
2138 2143 test -u/-k for problematic encoding
2139 2144 # unicode: cp932:
2140 2145 # u30A2 0x83 0x41(= 'A')
2141 2146 # u30C2 0x83 0x61(= 'a')
2142 2147
2143 2148 $ hg init problematicencoding
2144 2149 $ cd problematicencoding
2145 2150
2146 2151 >>> with open('setup.sh', 'wb') as f:
2147 2152 ... f.write(u'''
2148 2153 ... echo a > text
2149 2154 ... hg add text
2150 2155 ... hg --encoding utf-8 commit -u '\u30A2' -m none
2151 2156 ... echo b > text
2152 2157 ... hg --encoding utf-8 commit -u '\u30C2' -m none
2153 2158 ... echo c > text
2154 2159 ... hg --encoding utf-8 commit -u none -m '\u30A2'
2155 2160 ... echo d > text
2156 2161 ... hg --encoding utf-8 commit -u none -m '\u30C2'
2157 2162 ... '''.encode('utf-8')) and None
2158 2163 $ sh < setup.sh
2159 2164
2160 2165 #if no-rhg
2161 2166
2162 2167 test in problematic encoding
2163 2168 >>> with open('test.sh', 'wb') as f:
2164 2169 ... f.write(u'''
2165 2170 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2166 2171 ... echo ====
2167 2172 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2168 2173 ... echo ====
2169 2174 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2170 2175 ... echo ====
2171 2176 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2172 2177 ... '''.encode('cp932')) and None
2173 2178 $ sh < test.sh
2174 2179 0
2175 2180 ====
2176 2181 1
2177 2182 ====
2178 2183 2
2179 2184 0
2180 2185 ====
2181 2186 3
2182 2187 1
2183 2188
2184 2189 #endif
2185 2190
2186 2191 $ cd ..
2187 2192
2188 2193 test hg log on non-existent files and on directories
2189 2194 $ hg init issue1340
2190 2195 $ cd issue1340
2191 2196 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2192 2197 $ echo 1 > d1/f1
2193 2198 $ echo 1 > D2/f1
2194 2199 $ echo 1 > D3.i/f1
2195 2200 $ echo 1 > d4.hg/f1
2196 2201 $ echo 1 > d5.d/f1
2197 2202 $ echo 1 > .d6/f1
2198 2203 $ hg -q add .
2199 2204 $ hg commit -m "a bunch of weird directories"
2200 2205 $ hg log -l1 d1/f1 | grep changeset
2201 2206 changeset: 0:65624cd9070a
2202 2207 $ hg log -l1 f1
2203 2208 $ hg log -l1 . | grep changeset
2204 2209 changeset: 0:65624cd9070a
2205 2210 $ hg log -l1 ./ | grep changeset
2206 2211 changeset: 0:65624cd9070a
2207 2212 $ hg log -l1 d1 | grep changeset
2208 2213 changeset: 0:65624cd9070a
2209 2214 $ hg log -l1 D2 | grep changeset
2210 2215 changeset: 0:65624cd9070a
2211 2216 $ hg log -l1 D2/f1 | grep changeset
2212 2217 changeset: 0:65624cd9070a
2213 2218 $ hg log -l1 D3.i | grep changeset
2214 2219 changeset: 0:65624cd9070a
2215 2220 $ hg log -l1 D3.i/f1 | grep changeset
2216 2221 changeset: 0:65624cd9070a
2217 2222 $ hg log -l1 d4.hg | grep changeset
2218 2223 changeset: 0:65624cd9070a
2219 2224 $ hg log -l1 d4.hg/f1 | grep changeset
2220 2225 changeset: 0:65624cd9070a
2221 2226 $ hg log -l1 d5.d | grep changeset
2222 2227 changeset: 0:65624cd9070a
2223 2228 $ hg log -l1 d5.d/f1 | grep changeset
2224 2229 changeset: 0:65624cd9070a
2225 2230 $ hg log -l1 .d6 | grep changeset
2226 2231 changeset: 0:65624cd9070a
2227 2232 $ hg log -l1 .d6/f1 | grep changeset
2228 2233 changeset: 0:65624cd9070a
2229 2234
2230 2235 issue3772: hg log -r :null showing revision 0 as well
2231 2236
2232 2237 $ hg log -r :null
2233 2238 changeset: 0:65624cd9070a
2234 2239 tag: tip
2235 2240 user: test
2236 2241 date: Thu Jan 01 00:00:00 1970 +0000
2237 2242 summary: a bunch of weird directories
2238 2243
2239 2244 changeset: -1:000000000000
2240 2245 user:
2241 2246 date: Thu Jan 01 00:00:00 1970 +0000
2242 2247
2243 2248 $ hg log -r null:null
2244 2249 changeset: -1:000000000000
2245 2250 user:
2246 2251 date: Thu Jan 01 00:00:00 1970 +0000
2247 2252
2248 2253 working-directory revision requires special treatment
2249 2254
2250 2255 clean:
2251 2256
2252 2257 $ hg log -r 'wdir()' --debug
2253 2258 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2254 2259 phase: draft
2255 2260 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2256 2261 parent: -1:0000000000000000000000000000000000000000
2257 2262 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2258 2263 user: test
2259 2264 date: [A-Za-z0-9:+ ]+ (re)
2260 2265 extra: branch=default
2261 2266
2262 2267 $ hg log -r 'wdir()' -p --stat
2263 2268 changeset: 2147483647:ffffffffffff
2264 2269 parent: 0:65624cd9070a
2265 2270 user: test
2266 2271 date: [A-Za-z0-9:+ ]+ (re)
2267 2272
2268 2273
2269 2274
2270 2275
2271 2276 dirty:
2272 2277
2273 2278 $ echo 2 >> d1/f1
2274 2279 $ echo 2 > d1/f2
2275 2280 $ hg add d1/f2
2276 2281 $ hg remove .d6/f1
2277 2282 $ hg status
2278 2283 M d1/f1
2279 2284 A d1/f2
2280 2285 R .d6/f1
2281 2286
2282 2287 $ hg log -r 'wdir()'
2283 2288 changeset: 2147483647:ffffffffffff
2284 2289 parent: 0:65624cd9070a
2285 2290 user: test
2286 2291 date: [A-Za-z0-9:+ ]+ (re)
2287 2292
2288 2293 $ hg log -r 'wdir()' -q
2289 2294 2147483647:ffffffffffff
2290 2295
2291 2296 $ hg log -r 'wdir()' --debug
2292 2297 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2293 2298 phase: draft
2294 2299 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2295 2300 parent: -1:0000000000000000000000000000000000000000
2296 2301 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2297 2302 user: test
2298 2303 date: [A-Za-z0-9:+ ]+ (re)
2299 2304 files: d1/f1
2300 2305 files+: d1/f2
2301 2306 files-: .d6/f1
2302 2307 extra: branch=default
2303 2308
2304 2309 $ hg log -r 'wdir()' -p --stat --git
2305 2310 changeset: 2147483647:ffffffffffff
2306 2311 parent: 0:65624cd9070a
2307 2312 user: test
2308 2313 date: [A-Za-z0-9:+ ]+ (re)
2309 2314
2310 2315 .d6/f1 | 1 -
2311 2316 d1/f1 | 1 +
2312 2317 d1/f2 | 1 +
2313 2318 3 files changed, 2 insertions(+), 1 deletions(-)
2314 2319
2315 2320 diff --git a/.d6/f1 b/.d6/f1
2316 2321 deleted file mode 100644
2317 2322 --- a/.d6/f1
2318 2323 +++ /dev/null
2319 2324 @@ -1,1 +0,0 @@
2320 2325 -1
2321 2326 diff --git a/d1/f1 b/d1/f1
2322 2327 --- a/d1/f1
2323 2328 +++ b/d1/f1
2324 2329 @@ -1,1 +1,2 @@
2325 2330 1
2326 2331 +2
2327 2332 diff --git a/d1/f2 b/d1/f2
2328 2333 new file mode 100644
2329 2334 --- /dev/null
2330 2335 +++ b/d1/f2
2331 2336 @@ -0,0 +1,1 @@
2332 2337 +2
2333 2338
2334 2339 $ hg log -r 'wdir()' -Tjson
2335 2340 [
2336 2341 {
2337 2342 "bookmarks": [],
2338 2343 "branch": "default",
2339 2344 "date": [*, 0], (glob)
2340 2345 "desc": "",
2341 2346 "node": "ffffffffffffffffffffffffffffffffffffffff",
2342 2347 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2343 2348 "phase": "draft",
2344 2349 "rev": 2147483647,
2345 2350 "tags": [],
2346 2351 "user": "test"
2347 2352 }
2348 2353 ]
2349 2354
2350 2355 $ hg log -r 'wdir()' -Tjson -q
2351 2356 [
2352 2357 {
2353 2358 "node": "ffffffffffffffffffffffffffffffffffffffff",
2354 2359 "rev": 2147483647
2355 2360 }
2356 2361 ]
2357 2362
2358 2363 $ hg log -r 'wdir()' -Tjson --debug
2359 2364 [
2360 2365 {
2361 2366 "added": ["d1/f2"],
2362 2367 "bookmarks": [],
2363 2368 "branch": "default",
2364 2369 "date": [*, 0], (glob)
2365 2370 "desc": "",
2366 2371 "extra": {"branch": "default"},
2367 2372 "manifest": "ffffffffffffffffffffffffffffffffffffffff",
2368 2373 "modified": ["d1/f1"],
2369 2374 "node": "ffffffffffffffffffffffffffffffffffffffff",
2370 2375 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2371 2376 "phase": "draft",
2372 2377 "removed": [".d6/f1"],
2373 2378 "rev": 2147483647,
2374 2379 "tags": [],
2375 2380 "user": "test"
2376 2381 }
2377 2382 ]
2378 2383
2379 2384 follow files from wdir
2380 2385
2381 2386 $ hg cp d1/f1 f1-copy
2382 2387 $ hg stat --all
2383 2388 M d1/f1
2384 2389 A d1/f2
2385 2390 A f1-copy
2386 2391 d1/f1
2387 2392 R .d6/f1
2388 2393 C D2/f1
2389 2394 C D3.i/f1
2390 2395 C d4.hg/f1
2391 2396 C d5.d/f1
2392 2397
2393 2398 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d5.d/f1
2394 2399 == 2147483647 ==
2395 2400
2396 2401 == 0 ==
2397 2402 d5.d/f1 | 1 +
2398 2403 1 files changed, 1 insertions(+), 0 deletions(-)
2399 2404
2400 2405
2401 2406 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f1
2402 2407 == 2147483647 ==
2403 2408 d1/f1 | 1 +
2404 2409 1 files changed, 1 insertions(+), 0 deletions(-)
2405 2410
2406 2411 == 0 ==
2407 2412 d1/f1 | 1 +
2408 2413 1 files changed, 1 insertions(+), 0 deletions(-)
2409 2414
2410 2415
2411 2416 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f2
2412 2417 == 2147483647 ==
2413 2418 d1/f2 | 1 +
2414 2419 1 files changed, 1 insertions(+), 0 deletions(-)
2415 2420
2416 2421
2417 2422 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat f1-copy
2418 2423 == 2147483647 ==
2419 2424 f1-copy | 1 +
2420 2425 1 files changed, 1 insertions(+), 0 deletions(-)
2421 2426
2422 2427 == 0 ==
2423 2428 d1/f1 | 1 +
2424 2429 1 files changed, 1 insertions(+), 0 deletions(-)
2425 2430
2426 2431
2427 2432 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound
2428 2433 abort: cannot follow file not in any of the specified revisions: "notfound"
2429 2434 [20]
2430 2435
2431 2436 follow files from wdir and non-wdir revision:
2432 2437
2433 2438 $ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy
2434 2439 f1-copy: no such file in rev 65624cd9070a
2435 2440 2147483647
2436 2441 0
2437 2442
2438 2443 follow added/removed files from wdir parent
2439 2444
2440 2445 $ hg log -T '{rev}\n' -f d1/f2
2441 2446 abort: cannot follow nonexistent file: "d1/f2"
2442 2447 [20]
2443 2448
2444 2449 $ hg log -T '{rev}\n' -f f1-copy
2445 2450 abort: cannot follow nonexistent file: "f1-copy"
2446 2451 [20]
2447 2452
2448 2453 $ hg log -T '{rev}\n' -f .d6/f1
2449 2454 abort: cannot follow file not in parent revision: ".d6/f1"
2450 2455 [20]
2451 2456
2452 2457 $ hg revert -aqC
2453 2458
2454 2459 Check that adding an arbitrary name shows up in log automatically
2455 2460
2456 2461 $ cat > ../names.py <<EOF
2457 2462 > """A small extension to test adding arbitrary names to a repo"""
2458 2463 > from mercurial import namespaces
2459 2464 >
2460 2465 > def reposetup(ui, repo):
2461 2466 > if not repo.local():
2462 2467 > return
2463 2468 > foo = {b'foo': repo[0].node()}
2464 2469 > names = lambda r: foo.keys()
2465 2470 > namemap = lambda r, name: foo.get(name)
2466 2471 > nodemap = lambda r, node: [name for name, n in foo.items()
2467 2472 > if n == node]
2468 2473 > ns = namespaces.namespace(
2469 2474 > b"bars", templatename=b"bar", logname=b"barlog",
2470 2475 > colorname=b"barcolor", listnames=names, namemap=namemap,
2471 2476 > nodemap=nodemap)
2472 2477 >
2473 2478 > repo.names.addnamespace(ns)
2474 2479 > EOF
2475 2480
2476 2481 $ hg --config extensions.names=../names.py log -r 0
2477 2482 changeset: 0:65624cd9070a
2478 2483 tag: tip
2479 2484 barlog: foo
2480 2485 user: test
2481 2486 date: Thu Jan 01 00:00:00 1970 +0000
2482 2487 summary: a bunch of weird directories
2483 2488
2484 2489 $ hg --config extensions.names=../names.py \
2485 2490 > --config extensions.color= --config color.log.barcolor=red \
2486 2491 > --color=always log -r 0
2487 2492 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2488 2493 tag: tip
2489 2494 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2490 2495 user: test
2491 2496 date: Thu Jan 01 00:00:00 1970 +0000
2492 2497 summary: a bunch of weird directories
2493 2498
2494 2499 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2495 2500 foo
2496 2501
2497 2502 Templater parse errors:
2498 2503
2499 2504 simple error
2500 2505 $ hg log -r . -T '{shortest(node}'
2501 2506 hg: parse error at 14: unexpected token: end
2502 2507 ({shortest(node}
2503 2508 ^ here)
2504 2509 [10]
2505 2510
2506 2511 multi-line template with error
2507 2512 $ hg log -r . -T 'line 1
2508 2513 > line2
2509 2514 > {shortest(node}
2510 2515 > line4\nline5'
2511 2516 hg: parse error at 27: unexpected token: end
2512 2517 (line 1\nline2\n{shortest(node}\nline4\nline5
2513 2518 ^ here)
2514 2519 [10]
2515 2520
2516 2521 $ cd ..
2517 2522
2518 2523 New namespace is registered per repo instance, but the template keyword
2519 2524 is global. So we shouldn't expect the namespace always exists. Using
2520 2525 ssh:// makes sure a bundle repository is created from scratch. (issue6301)
2521 2526
2522 2527 $ hg clone -qr0 "ssh://user@dummy/`pwd`/a" a-clone
2523 2528 $ hg incoming --config extensions.names=names.py -R a-clone \
2524 2529 > -T '{bars}\n' -l1
2525 2530 comparing with ssh://user@dummy/$TESTTMP/a
2526 2531 searching for changes
2527 2532
2528 2533
2529 2534 hg log -f dir across branches
2530 2535
2531 2536 $ hg init acrossbranches
2532 2537 $ cd acrossbranches
2533 2538 $ mkdir d
2534 2539 $ echo a > d/a && hg ci -Aqm a
2535 2540 $ echo b > d/a && hg ci -Aqm b
2536 2541 $ hg up -q 0
2537 2542 $ echo b > d/a && hg ci -Aqm c
2538 2543 $ hg log -f d -T '{desc}' -G
2539 2544 @ c
2540 2545 |
2541 2546 o a
2542 2547
2543 2548 Ensure that largefiles doesn't interfere with following a normal file
2544 2549 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2545 2550 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2546 2551 @ c
2547 2552 |
2548 2553 o a
2549 2554
2550 2555 $ hg log -f d/a -T '{desc}' -G
2551 2556 @ c
2552 2557 |
2553 2558 o a
2554 2559
2555 2560 $ cd ..
2556 2561
2557 2562 hg log -f with linkrev pointing to another branch
2558 2563 -------------------------------------------------
2559 2564
2560 2565 create history with a filerev whose linkrev points to another branch
2561 2566
2562 2567 $ hg init branchedlinkrev
2563 2568 $ cd branchedlinkrev
2564 2569 $ echo 1 > a
2565 2570 $ hg commit -Am 'content1'
2566 2571 adding a
2567 2572 $ echo 2 > a
2568 2573 $ hg commit -m 'content2'
2569 2574 $ hg up --rev 'desc(content1)'
2570 2575 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2571 2576 $ echo unrelated > unrelated
2572 2577 $ hg commit -Am 'unrelated'
2573 2578 adding unrelated
2574 2579 created new head
2575 2580 $ hg graft -r 'desc(content2)'
2576 2581 grafting 1:2294ae80ad84 "content2"
2577 2582 $ echo 3 > a
2578 2583 $ hg commit -m 'content3'
2579 2584 $ hg log -G
2580 2585 @ changeset: 4:50b9b36e9c5d
2581 2586 | tag: tip
2582 2587 | user: test
2583 2588 | date: Thu Jan 01 00:00:00 1970 +0000
2584 2589 | summary: content3
2585 2590 |
2586 2591 o changeset: 3:15b2327059e5
2587 2592 | user: test
2588 2593 | date: Thu Jan 01 00:00:00 1970 +0000
2589 2594 | summary: content2
2590 2595 |
2591 2596 o changeset: 2:2029acd1168c
2592 2597 | parent: 0:ae0a3c9f9e95
2593 2598 | user: test
2594 2599 | date: Thu Jan 01 00:00:00 1970 +0000
2595 2600 | summary: unrelated
2596 2601 |
2597 2602 | o changeset: 1:2294ae80ad84
2598 2603 |/ user: test
2599 2604 | date: Thu Jan 01 00:00:00 1970 +0000
2600 2605 | summary: content2
2601 2606 |
2602 2607 o changeset: 0:ae0a3c9f9e95
2603 2608 user: test
2604 2609 date: Thu Jan 01 00:00:00 1970 +0000
2605 2610 summary: content1
2606 2611
2607 2612
2608 2613 log -f on the file should list the graft result.
2609 2614
2610 2615 $ hg log -Gf a
2611 2616 @ changeset: 4:50b9b36e9c5d
2612 2617 | tag: tip
2613 2618 | user: test
2614 2619 | date: Thu Jan 01 00:00:00 1970 +0000
2615 2620 | summary: content3
2616 2621 |
2617 2622 o changeset: 3:15b2327059e5
2618 2623 : user: test
2619 2624 : date: Thu Jan 01 00:00:00 1970 +0000
2620 2625 : summary: content2
2621 2626 :
2622 2627 o changeset: 0:ae0a3c9f9e95
2623 2628 user: test
2624 2629 date: Thu Jan 01 00:00:00 1970 +0000
2625 2630 summary: content1
2626 2631
2627 2632
2628 2633 plain log lists the original version
2629 2634 (XXX we should probably list both)
2630 2635
2631 2636 $ hg log -G a
2632 2637 @ changeset: 4:50b9b36e9c5d
2633 2638 : tag: tip
2634 2639 : user: test
2635 2640 : date: Thu Jan 01 00:00:00 1970 +0000
2636 2641 : summary: content3
2637 2642 :
2638 2643 : o changeset: 1:2294ae80ad84
2639 2644 :/ user: test
2640 2645 : date: Thu Jan 01 00:00:00 1970 +0000
2641 2646 : summary: content2
2642 2647 :
2643 2648 o changeset: 0:ae0a3c9f9e95
2644 2649 user: test
2645 2650 date: Thu Jan 01 00:00:00 1970 +0000
2646 2651 summary: content1
2647 2652
2648 2653
2649 2654 hg log -f from the grafted changeset
2650 2655 (The bootstrap should properly take the topology in account)
2651 2656
2652 2657 $ hg up 'desc(content3)^'
2653 2658 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2654 2659 $ hg log -Gf a
2655 2660 @ changeset: 3:15b2327059e5
2656 2661 : user: test
2657 2662 : date: Thu Jan 01 00:00:00 1970 +0000
2658 2663 : summary: content2
2659 2664 :
2660 2665 o changeset: 0:ae0a3c9f9e95
2661 2666 user: test
2662 2667 date: Thu Jan 01 00:00:00 1970 +0000
2663 2668 summary: content1
2664 2669
2665 2670
2666 2671 Test that we use the first non-hidden changeset in that case.
2667 2672
2668 2673 (hide the changeset)
2669 2674
2670 2675 $ hg log -T '{node}\n' -r 1
2671 2676 2294ae80ad8447bc78383182eeac50cb049df623
2672 2677 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2673 2678 1 new obsolescence markers
2674 2679 obsoleted 1 changesets
2675 2680 $ hg log -G
2676 2681 o changeset: 4:50b9b36e9c5d
2677 2682 | tag: tip
2678 2683 | user: test
2679 2684 | date: Thu Jan 01 00:00:00 1970 +0000
2680 2685 | summary: content3
2681 2686 |
2682 2687 @ changeset: 3:15b2327059e5
2683 2688 | user: test
2684 2689 | date: Thu Jan 01 00:00:00 1970 +0000
2685 2690 | summary: content2
2686 2691 |
2687 2692 o changeset: 2:2029acd1168c
2688 2693 | parent: 0:ae0a3c9f9e95
2689 2694 | user: test
2690 2695 | date: Thu Jan 01 00:00:00 1970 +0000
2691 2696 | summary: unrelated
2692 2697 |
2693 2698 o changeset: 0:ae0a3c9f9e95
2694 2699 user: test
2695 2700 date: Thu Jan 01 00:00:00 1970 +0000
2696 2701 summary: content1
2697 2702
2698 2703
2699 2704 Check that log on the file does not drop the file revision.
2700 2705
2701 2706 $ hg log -G a
2702 2707 o changeset: 4:50b9b36e9c5d
2703 2708 | tag: tip
2704 2709 | user: test
2705 2710 | date: Thu Jan 01 00:00:00 1970 +0000
2706 2711 | summary: content3
2707 2712 |
2708 2713 @ changeset: 3:15b2327059e5
2709 2714 : user: test
2710 2715 : date: Thu Jan 01 00:00:00 1970 +0000
2711 2716 : summary: content2
2712 2717 :
2713 2718 o changeset: 0:ae0a3c9f9e95
2714 2719 user: test
2715 2720 date: Thu Jan 01 00:00:00 1970 +0000
2716 2721 summary: content1
2717 2722
2718 2723
2719 2724 Even when a head revision is linkrev-shadowed.
2720 2725
2721 2726 $ hg log -T '{node}\n' -r 4
2722 2727 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2723 2728 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2724 2729 1 new obsolescence markers
2725 2730 obsoleted 1 changesets
2726 2731 $ hg log -G a
2727 2732 @ changeset: 3:15b2327059e5
2728 2733 : tag: tip
2729 2734 : user: test
2730 2735 : date: Thu Jan 01 00:00:00 1970 +0000
2731 2736 : summary: content2
2732 2737 :
2733 2738 o changeset: 0:ae0a3c9f9e95
2734 2739 user: test
2735 2740 date: Thu Jan 01 00:00:00 1970 +0000
2736 2741 summary: content1
2737 2742
2738 2743
2739 2744 $ cd ..
2740 2745
2741 2746 Even when the file revision is missing from some head:
2742 2747
2743 2748 $ hg init issue4490
2744 2749 $ cd issue4490
2745 2750 $ echo '[experimental]' >> .hg/hgrc
2746 2751 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2747 2752 $ echo a > a
2748 2753 $ hg ci -Am0
2749 2754 adding a
2750 2755 $ echo b > b
2751 2756 $ hg ci -Am1
2752 2757 adding b
2753 2758 $ echo B > b
2754 2759 $ hg ci --amend -m 1
2755 2760 $ hg up 0
2756 2761 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2757 2762 $ echo c > c
2758 2763 $ hg ci -Am2
2759 2764 adding c
2760 2765 created new head
2761 2766 $ hg up 'head() and not .'
2762 2767 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2763 2768 $ hg log -G
2764 2769 o changeset: 3:db815d6d32e6
2765 2770 | tag: tip
2766 2771 | parent: 0:f7b1eb17ad24
2767 2772 | user: test
2768 2773 | date: Thu Jan 01 00:00:00 1970 +0000
2769 2774 | summary: 2
2770 2775 |
2771 2776 | @ changeset: 2:9bc8ce7f9356
2772 2777 |/ parent: 0:f7b1eb17ad24
2773 2778 | user: test
2774 2779 | date: Thu Jan 01 00:00:00 1970 +0000
2775 2780 | summary: 1
2776 2781 |
2777 2782 o changeset: 0:f7b1eb17ad24
2778 2783 user: test
2779 2784 date: Thu Jan 01 00:00:00 1970 +0000
2780 2785 summary: 0
2781 2786
2782 2787 $ hg log -f -G b
2783 2788 @ changeset: 2:9bc8ce7f9356
2784 2789 | parent: 0:f7b1eb17ad24
2785 2790 ~ user: test
2786 2791 date: Thu Jan 01 00:00:00 1970 +0000
2787 2792 summary: 1
2788 2793
2789 2794 $ hg log -G b
2790 2795 @ changeset: 2:9bc8ce7f9356
2791 2796 | parent: 0:f7b1eb17ad24
2792 2797 ~ user: test
2793 2798 date: Thu Jan 01 00:00:00 1970 +0000
2794 2799 summary: 1
2795 2800
2796 2801 $ cd ..
2797 2802
2798 2803 Check proper report when the manifest changes but not the file issue4499
2799 2804 ------------------------------------------------------------------------
2800 2805
2801 2806 $ hg init issue4499
2802 2807 $ cd issue4499
2803 2808 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2804 2809 > echo 1 > $f;
2805 2810 > hg add $f;
2806 2811 > done
2807 2812 $ hg commit -m 'A1B1C1'
2808 2813 $ echo 2 > A
2809 2814 $ echo 2 > B
2810 2815 $ echo 2 > C
2811 2816 $ hg commit -m 'A2B2C2'
2812 2817 $ hg up 0
2813 2818 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2814 2819 $ echo 3 > A
2815 2820 $ echo 2 > B
2816 2821 $ echo 2 > C
2817 2822 $ hg commit -m 'A3B2C2'
2818 2823 created new head
2819 2824
2820 2825 $ hg log -G
2821 2826 @ changeset: 2:fe5fc3d0eb17
2822 2827 | tag: tip
2823 2828 | parent: 0:abf4f0e38563
2824 2829 | user: test
2825 2830 | date: Thu Jan 01 00:00:00 1970 +0000
2826 2831 | summary: A3B2C2
2827 2832 |
2828 2833 | o changeset: 1:07dcc6b312c0
2829 2834 |/ user: test
2830 2835 | date: Thu Jan 01 00:00:00 1970 +0000
2831 2836 | summary: A2B2C2
2832 2837 |
2833 2838 o changeset: 0:abf4f0e38563
2834 2839 user: test
2835 2840 date: Thu Jan 01 00:00:00 1970 +0000
2836 2841 summary: A1B1C1
2837 2842
2838 2843
2839 2844 Log -f on B should reports current changesets
2840 2845
2841 2846 $ hg log -fG B
2842 2847 @ changeset: 2:fe5fc3d0eb17
2843 2848 | tag: tip
2844 2849 | parent: 0:abf4f0e38563
2845 2850 | user: test
2846 2851 | date: Thu Jan 01 00:00:00 1970 +0000
2847 2852 | summary: A3B2C2
2848 2853 |
2849 2854 o changeset: 0:abf4f0e38563
2850 2855 user: test
2851 2856 date: Thu Jan 01 00:00:00 1970 +0000
2852 2857 summary: A1B1C1
2853 2858
2854 2859 $ cd ..
2855 2860
2856 2861 --- going to test line wrap fix on using both --stat and -G (issue5800)
2857 2862 $ hg init issue5800
2858 2863 $ cd issue5800
2859 2864 $ touch a
2860 2865 $ hg ci -Am 'add a'
2861 2866 adding a
2862 2867 ---- now we are going to add 300 lines to a
2863 2868 $ for i in `$TESTDIR/seq.py 1 300`; do echo $i >> a; done
2864 2869 $ hg ci -m 'modify a'
2865 2870 $ hg log
2866 2871 changeset: 1:a98683e6a834
2867 2872 tag: tip
2868 2873 user: test
2869 2874 date: Thu Jan 01 00:00:00 1970 +0000
2870 2875 summary: modify a
2871 2876
2872 2877 changeset: 0:ac82d8b1f7c4
2873 2878 user: test
2874 2879 date: Thu Jan 01 00:00:00 1970 +0000
2875 2880 summary: add a
2876 2881
2877 2882 ---- now visualise the changes we made without template
2878 2883 $ hg log -l1 -r a98683e6a834 --stat -G
2879 2884 @ changeset: 1:a98683e6a834
2880 2885 | tag: tip
2881 2886 ~ user: test
2882 2887 date: Thu Jan 01 00:00:00 1970 +0000
2883 2888 summary: modify a
2884 2889
2885 2890 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2886 2891 1 files changed, 300 insertions(+), 0 deletions(-)
2887 2892
2888 2893 ---- with template
2889 2894 $ hg log -l1 -r a98683e6a834 --stat -G -T bisect
2890 2895 @ changeset: 1:a98683e6a834
2891 2896 | bisect:
2892 2897 ~ tag: tip
2893 2898 user: test
2894 2899 date: Thu Jan 01 00:00:00 1970 +0000
2895 2900 summary: modify a
2896 2901
2897 2902 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2898 2903 1 files changed, 300 insertions(+), 0 deletions(-)
2899 2904
2900 2905 $ hg log -l1 -r a98683e6a834 --stat -G -T changelog
2901 2906 1970-01-01 test <test>
2902 2907
2903 2908 @ * a:
2904 2909 | modify a
2905 2910 ~ [a98683e6a834] [tip]
2906 2911
2907 2912 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2908 2913 1 files changed, 300 insertions(+), 0 deletions(-)
2909 2914
2910 2915 $ hg log -l1 -r a98683e6a834 --stat -G -T compact
2911 2916 @ 1[tip] a98683e6a834 1970-01-01 00:00 +0000 test
2912 2917 | modify a
2913 2918 ~
2914 2919 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2915 2920 1 files changed, 300 insertions(+), 0 deletions(-)
2916 2921
2917 2922 $ hg log -l1 -r a98683e6a834 --stat -G -T default
2918 2923 @ changeset: 1:a98683e6a834
2919 2924 | tag: tip
2920 2925 ~ user: test
2921 2926 date: Thu Jan 01 00:00:00 1970 +0000
2922 2927 summary: modify a
2923 2928
2924 2929 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2925 2930 1 files changed, 300 insertions(+), 0 deletions(-)
2926 2931
2927 2932 $ hg log -l1 -r a98683e6a834 --stat -G -T phases
2928 2933 @ changeset: 1:a98683e6a834
2929 2934 | tag: tip
2930 2935 ~ phase: draft
2931 2936 user: test
2932 2937 date: Thu Jan 01 00:00:00 1970 +0000
2933 2938 summary: modify a
2934 2939
2935 2940 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2936 2941 1 files changed, 300 insertions(+), 0 deletions(-)
2937 2942
2938 2943 $ hg log -l1 -r a98683e6a834 --stat -G -T show
2939 2944 @ changeset: 1:a98683e6a834
2940 2945 | tag: tip
2941 2946 ~ user: test
2942 2947 date: Thu Jan 01 00:00:00 1970 +0000
2943 2948 summary: modify a
2944 2949
2945 2950 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2946 2951 1 files changed, 300 insertions(+), 0 deletions(-)
2947 2952
2948 2953 $ hg log -l1 -r a98683e6a834 --stat -G -T status
2949 2954 @ changeset: 1:a98683e6a834
2950 2955 | tag: tip
2951 2956 ~ user: test
2952 2957 date: Thu Jan 01 00:00:00 1970 +0000
2953 2958 summary: modify a
2954 2959 files:
2955 2960 M a
2956 2961
2957 2962 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2958 2963 1 files changed, 300 insertions(+), 0 deletions(-)
2959 2964
2960 2965 $ hg log -l1 -r a98683e6a834 --stat -G -T xml
2961 2966 <?xml version="1.0"?>
2962 2967 <log>
2963 2968 @ <logentry revision="1" node="a98683e6a8340830a7683909768b62871e84bc9d">
2964 2969 | <tag>tip</tag>
2965 2970 ~ <author email="test">test</author>
2966 2971 <date>1970-01-01T00:00:00+00:00</date>
2967 2972 <msg xml:space="preserve">modify a</msg>
2968 2973 </logentry>
2969 2974 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2970 2975 1 files changed, 300 insertions(+), 0 deletions(-)
2971 2976
2972 2977 </log>
2973 2978
2974 2979 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now