##// END OF EJS Templates
log: fix -fr'wdir()' PATH to follow newly added file...
Yuya Nishihara -
r46044:07324227 default
parent child Browse files
Show More
@@ -1,1093 +1,1090 b''
1 1 # logcmdutil.py - utility for log-like commands
2 2 #
3 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import itertools
11 11 import os
12 12 import posixpath
13 13
14 14 from .i18n import _
15 15 from .node import (
16 16 nullid,
17 17 wdirid,
18 18 wdirrev,
19 19 )
20 20
21 21 from . import (
22 22 dagop,
23 23 error,
24 24 formatter,
25 25 graphmod,
26 26 match as matchmod,
27 27 mdiff,
28 28 patch,
29 29 pathutil,
30 30 pycompat,
31 31 revset,
32 32 revsetlang,
33 33 scmutil,
34 34 smartset,
35 35 templatekw,
36 36 templater,
37 37 util,
38 38 )
39 39 from .utils import (
40 40 dateutil,
41 41 stringutil,
42 42 )
43 43
44 44
45 45 if pycompat.TYPE_CHECKING:
46 46 from typing import (
47 47 Any,
48 48 Optional,
49 49 Tuple,
50 50 )
51 51
52 52 for t in (Any, Optional, Tuple):
53 53 assert t
54 54
55 55
56 56 def getlimit(opts):
57 57 """get the log limit according to option -l/--limit"""
58 58 limit = opts.get(b'limit')
59 59 if limit:
60 60 try:
61 61 limit = int(limit)
62 62 except ValueError:
63 63 raise error.Abort(_(b'limit must be a positive integer'))
64 64 if limit <= 0:
65 65 raise error.Abort(_(b'limit must be positive'))
66 66 else:
67 67 limit = None
68 68 return limit
69 69
70 70
71 71 def diffordiffstat(
72 72 ui,
73 73 repo,
74 74 diffopts,
75 75 ctx1,
76 76 ctx2,
77 77 match,
78 78 changes=None,
79 79 stat=False,
80 80 fp=None,
81 81 graphwidth=0,
82 82 prefix=b'',
83 83 root=b'',
84 84 listsubrepos=False,
85 85 hunksfilterfn=None,
86 86 ):
87 87 '''show diff or diffstat.'''
88 88 if root:
89 89 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
90 90 else:
91 91 relroot = b''
92 92 copysourcematch = None
93 93
94 94 def compose(f, g):
95 95 return lambda x: f(g(x))
96 96
97 97 def pathfn(f):
98 98 return posixpath.join(prefix, f)
99 99
100 100 if relroot != b'':
101 101 # XXX relative roots currently don't work if the root is within a
102 102 # subrepo
103 103 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
104 104 uirelroot = uipathfn(pathfn(relroot))
105 105 relroot += b'/'
106 106 for matchroot in match.files():
107 107 if not matchroot.startswith(relroot):
108 108 ui.warn(
109 109 _(b'warning: %s not inside relative root %s\n')
110 110 % (uipathfn(pathfn(matchroot)), uirelroot)
111 111 )
112 112
113 113 relrootmatch = scmutil.match(ctx2, pats=[relroot], default=b'path')
114 114 match = matchmod.intersectmatchers(match, relrootmatch)
115 115 copysourcematch = relrootmatch
116 116
117 117 checkroot = repo.ui.configbool(
118 118 b'devel', b'all-warnings'
119 119 ) or repo.ui.configbool(b'devel', b'check-relroot')
120 120
121 121 def relrootpathfn(f):
122 122 if checkroot and not f.startswith(relroot):
123 123 raise AssertionError(
124 124 b"file %s doesn't start with relroot %s" % (f, relroot)
125 125 )
126 126 return f[len(relroot) :]
127 127
128 128 pathfn = compose(relrootpathfn, pathfn)
129 129
130 130 if stat:
131 131 diffopts = diffopts.copy(context=0, noprefix=False)
132 132 width = 80
133 133 if not ui.plain():
134 134 width = ui.termwidth() - graphwidth
135 135 # If an explicit --root was given, don't respect ui.relative-paths
136 136 if not relroot:
137 137 pathfn = compose(scmutil.getuipathfn(repo), pathfn)
138 138
139 139 chunks = ctx2.diff(
140 140 ctx1,
141 141 match,
142 142 changes,
143 143 opts=diffopts,
144 144 pathfn=pathfn,
145 145 copysourcematch=copysourcematch,
146 146 hunksfilterfn=hunksfilterfn,
147 147 )
148 148
149 149 if fp is not None or ui.canwritewithoutlabels():
150 150 out = fp or ui
151 151 if stat:
152 152 chunks = [patch.diffstat(util.iterlines(chunks), width=width)]
153 153 for chunk in util.filechunkiter(util.chunkbuffer(chunks)):
154 154 out.write(chunk)
155 155 else:
156 156 if stat:
157 157 chunks = patch.diffstatui(util.iterlines(chunks), width=width)
158 158 else:
159 159 chunks = patch.difflabel(
160 160 lambda chunks, **kwargs: chunks, chunks, opts=diffopts
161 161 )
162 162 if ui.canbatchlabeledwrites():
163 163
164 164 def gen():
165 165 for chunk, label in chunks:
166 166 yield ui.label(chunk, label=label)
167 167
168 168 for chunk in util.filechunkiter(util.chunkbuffer(gen())):
169 169 ui.write(chunk)
170 170 else:
171 171 for chunk, label in chunks:
172 172 ui.write(chunk, label=label)
173 173
174 174 node2 = ctx2.node()
175 175 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
176 176 tempnode2 = node2
177 177 try:
178 178 if node2 is not None:
179 179 tempnode2 = ctx2.substate[subpath][1]
180 180 except KeyError:
181 181 # A subrepo that existed in node1 was deleted between node1 and
182 182 # node2 (inclusive). Thus, ctx2's substate won't contain that
183 183 # subpath. The best we can do is to ignore it.
184 184 tempnode2 = None
185 185 submatch = matchmod.subdirmatcher(subpath, match)
186 186 subprefix = repo.wvfs.reljoin(prefix, subpath)
187 187 if listsubrepos or match.exact(subpath) or any(submatch.files()):
188 188 sub.diff(
189 189 ui,
190 190 diffopts,
191 191 tempnode2,
192 192 submatch,
193 193 changes=changes,
194 194 stat=stat,
195 195 fp=fp,
196 196 prefix=subprefix,
197 197 )
198 198
199 199
200 200 class changesetdiffer(object):
201 201 """Generate diff of changeset with pre-configured filtering functions"""
202 202
203 203 def _makefilematcher(self, ctx):
204 204 return scmutil.matchall(ctx.repo())
205 205
206 206 def _makehunksfilter(self, ctx):
207 207 return None
208 208
209 209 def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False):
210 210 diffordiffstat(
211 211 ui,
212 212 ctx.repo(),
213 213 diffopts,
214 214 ctx.p1(),
215 215 ctx,
216 216 match=self._makefilematcher(ctx),
217 217 stat=stat,
218 218 graphwidth=graphwidth,
219 219 hunksfilterfn=self._makehunksfilter(ctx),
220 220 )
221 221
222 222
223 223 def changesetlabels(ctx):
224 224 labels = [b'log.changeset', b'changeset.%s' % ctx.phasestr()]
225 225 if ctx.obsolete():
226 226 labels.append(b'changeset.obsolete')
227 227 if ctx.isunstable():
228 228 labels.append(b'changeset.unstable')
229 229 for instability in ctx.instabilities():
230 230 labels.append(b'instability.%s' % instability)
231 231 return b' '.join(labels)
232 232
233 233
234 234 class changesetprinter(object):
235 235 '''show changeset information when templating not requested.'''
236 236
237 237 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
238 238 self.ui = ui
239 239 self.repo = repo
240 240 self.buffered = buffered
241 241 self._differ = differ or changesetdiffer()
242 242 self._diffopts = patch.diffallopts(ui, diffopts)
243 243 self._includestat = diffopts and diffopts.get(b'stat')
244 244 self._includediff = diffopts and diffopts.get(b'patch')
245 245 self.header = {}
246 246 self.hunk = {}
247 247 self.lastheader = None
248 248 self.footer = None
249 249 self._columns = templatekw.getlogcolumns()
250 250
251 251 def flush(self, ctx):
252 252 rev = ctx.rev()
253 253 if rev in self.header:
254 254 h = self.header[rev]
255 255 if h != self.lastheader:
256 256 self.lastheader = h
257 257 self.ui.write(h)
258 258 del self.header[rev]
259 259 if rev in self.hunk:
260 260 self.ui.write(self.hunk[rev])
261 261 del self.hunk[rev]
262 262
263 263 def close(self):
264 264 if self.footer:
265 265 self.ui.write(self.footer)
266 266
267 267 def show(self, ctx, copies=None, **props):
268 268 props = pycompat.byteskwargs(props)
269 269 if self.buffered:
270 270 self.ui.pushbuffer(labeled=True)
271 271 self._show(ctx, copies, props)
272 272 self.hunk[ctx.rev()] = self.ui.popbuffer()
273 273 else:
274 274 self._show(ctx, copies, props)
275 275
276 276 def _show(self, ctx, copies, props):
277 277 '''show a single changeset or file revision'''
278 278 changenode = ctx.node()
279 279 graphwidth = props.get(b'graphwidth', 0)
280 280
281 281 if self.ui.quiet:
282 282 self.ui.write(
283 283 b"%s\n" % scmutil.formatchangeid(ctx), label=b'log.node'
284 284 )
285 285 return
286 286
287 287 columns = self._columns
288 288 self.ui.write(
289 289 columns[b'changeset'] % scmutil.formatchangeid(ctx),
290 290 label=changesetlabels(ctx),
291 291 )
292 292
293 293 # branches are shown first before any other names due to backwards
294 294 # compatibility
295 295 branch = ctx.branch()
296 296 # don't show the default branch name
297 297 if branch != b'default':
298 298 self.ui.write(columns[b'branch'] % branch, label=b'log.branch')
299 299
300 300 for nsname, ns in pycompat.iteritems(self.repo.names):
301 301 # branches has special logic already handled above, so here we just
302 302 # skip it
303 303 if nsname == b'branches':
304 304 continue
305 305 # we will use the templatename as the color name since those two
306 306 # should be the same
307 307 for name in ns.names(self.repo, changenode):
308 308 self.ui.write(ns.logfmt % name, label=b'log.%s' % ns.colorname)
309 309 if self.ui.debugflag:
310 310 self.ui.write(
311 311 columns[b'phase'] % ctx.phasestr(), label=b'log.phase'
312 312 )
313 313 for pctx in scmutil.meaningfulparents(self.repo, ctx):
314 314 label = b'log.parent changeset.%s' % pctx.phasestr()
315 315 self.ui.write(
316 316 columns[b'parent'] % scmutil.formatchangeid(pctx), label=label
317 317 )
318 318
319 319 if self.ui.debugflag:
320 320 mnode = ctx.manifestnode()
321 321 if mnode is None:
322 322 mnode = wdirid
323 323 mrev = wdirrev
324 324 else:
325 325 mrev = self.repo.manifestlog.rev(mnode)
326 326 self.ui.write(
327 327 columns[b'manifest']
328 328 % scmutil.formatrevnode(self.ui, mrev, mnode),
329 329 label=b'ui.debug log.manifest',
330 330 )
331 331 self.ui.write(columns[b'user'] % ctx.user(), label=b'log.user')
332 332 self.ui.write(
333 333 columns[b'date'] % dateutil.datestr(ctx.date()), label=b'log.date'
334 334 )
335 335
336 336 if ctx.isunstable():
337 337 instabilities = ctx.instabilities()
338 338 self.ui.write(
339 339 columns[b'instability'] % b', '.join(instabilities),
340 340 label=b'log.instability',
341 341 )
342 342
343 343 elif ctx.obsolete():
344 344 self._showobsfate(ctx)
345 345
346 346 self._exthook(ctx)
347 347
348 348 if self.ui.debugflag:
349 349 files = ctx.p1().status(ctx)
350 350 for key, value in zip(
351 351 [b'files', b'files+', b'files-'],
352 352 [files.modified, files.added, files.removed],
353 353 ):
354 354 if value:
355 355 self.ui.write(
356 356 columns[key] % b" ".join(value),
357 357 label=b'ui.debug log.files',
358 358 )
359 359 elif ctx.files() and self.ui.verbose:
360 360 self.ui.write(
361 361 columns[b'files'] % b" ".join(ctx.files()),
362 362 label=b'ui.note log.files',
363 363 )
364 364 if copies and self.ui.verbose:
365 365 copies = [b'%s (%s)' % c for c in copies]
366 366 self.ui.write(
367 367 columns[b'copies'] % b' '.join(copies),
368 368 label=b'ui.note log.copies',
369 369 )
370 370
371 371 extra = ctx.extra()
372 372 if extra and self.ui.debugflag:
373 373 for key, value in sorted(extra.items()):
374 374 self.ui.write(
375 375 columns[b'extra'] % (key, stringutil.escapestr(value)),
376 376 label=b'ui.debug log.extra',
377 377 )
378 378
379 379 description = ctx.description().strip()
380 380 if description:
381 381 if self.ui.verbose:
382 382 self.ui.write(
383 383 _(b"description:\n"), label=b'ui.note log.description'
384 384 )
385 385 self.ui.write(description, label=b'ui.note log.description')
386 386 self.ui.write(b"\n\n")
387 387 else:
388 388 self.ui.write(
389 389 columns[b'summary'] % description.splitlines()[0],
390 390 label=b'log.summary',
391 391 )
392 392 self.ui.write(b"\n")
393 393
394 394 self._showpatch(ctx, graphwidth)
395 395
396 396 def _showobsfate(self, ctx):
397 397 # TODO: do not depend on templater
398 398 tres = formatter.templateresources(self.repo.ui, self.repo)
399 399 t = formatter.maketemplater(
400 400 self.repo.ui,
401 401 b'{join(obsfate, "\n")}',
402 402 defaults=templatekw.keywords,
403 403 resources=tres,
404 404 )
405 405 obsfate = t.renderdefault({b'ctx': ctx}).splitlines()
406 406
407 407 if obsfate:
408 408 for obsfateline in obsfate:
409 409 self.ui.write(
410 410 self._columns[b'obsolete'] % obsfateline,
411 411 label=b'log.obsfate',
412 412 )
413 413
414 414 def _exthook(self, ctx):
415 415 '''empty method used by extension as a hook point
416 416 '''
417 417
418 418 def _showpatch(self, ctx, graphwidth=0):
419 419 if self._includestat:
420 420 self._differ.showdiff(
421 421 self.ui, ctx, self._diffopts, graphwidth, stat=True
422 422 )
423 423 if self._includestat and self._includediff:
424 424 self.ui.write(b"\n")
425 425 if self._includediff:
426 426 self._differ.showdiff(
427 427 self.ui, ctx, self._diffopts, graphwidth, stat=False
428 428 )
429 429 if self._includestat or self._includediff:
430 430 self.ui.write(b"\n")
431 431
432 432
433 433 class changesetformatter(changesetprinter):
434 434 """Format changeset information by generic formatter"""
435 435
436 436 def __init__(
437 437 self, ui, repo, fm, differ=None, diffopts=None, buffered=False
438 438 ):
439 439 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
440 440 self._diffopts = patch.difffeatureopts(ui, diffopts, git=True)
441 441 self._fm = fm
442 442
443 443 def close(self):
444 444 self._fm.end()
445 445
446 446 def _show(self, ctx, copies, props):
447 447 '''show a single changeset or file revision'''
448 448 fm = self._fm
449 449 fm.startitem()
450 450 fm.context(ctx=ctx)
451 451 fm.data(rev=scmutil.intrev(ctx), node=fm.hexfunc(scmutil.binnode(ctx)))
452 452
453 453 datahint = fm.datahint()
454 454 if self.ui.quiet and not datahint:
455 455 return
456 456
457 457 fm.data(
458 458 branch=ctx.branch(),
459 459 phase=ctx.phasestr(),
460 460 user=ctx.user(),
461 461 date=fm.formatdate(ctx.date()),
462 462 desc=ctx.description(),
463 463 bookmarks=fm.formatlist(ctx.bookmarks(), name=b'bookmark'),
464 464 tags=fm.formatlist(ctx.tags(), name=b'tag'),
465 465 parents=fm.formatlist(
466 466 [fm.hexfunc(c.node()) for c in ctx.parents()], name=b'node'
467 467 ),
468 468 )
469 469
470 470 if self.ui.debugflag or b'manifest' in datahint:
471 471 fm.data(manifest=fm.hexfunc(ctx.manifestnode() or wdirid))
472 472 if self.ui.debugflag or b'extra' in datahint:
473 473 fm.data(extra=fm.formatdict(ctx.extra()))
474 474
475 475 if (
476 476 self.ui.debugflag
477 477 or b'modified' in datahint
478 478 or b'added' in datahint
479 479 or b'removed' in datahint
480 480 ):
481 481 files = ctx.p1().status(ctx)
482 482 fm.data(
483 483 modified=fm.formatlist(files.modified, name=b'file'),
484 484 added=fm.formatlist(files.added, name=b'file'),
485 485 removed=fm.formatlist(files.removed, name=b'file'),
486 486 )
487 487
488 488 verbose = not self.ui.debugflag and self.ui.verbose
489 489 if verbose or b'files' in datahint:
490 490 fm.data(files=fm.formatlist(ctx.files(), name=b'file'))
491 491 if verbose and copies or b'copies' in datahint:
492 492 fm.data(
493 493 copies=fm.formatdict(copies or {}, key=b'name', value=b'source')
494 494 )
495 495
496 496 if self._includestat or b'diffstat' in datahint:
497 497 self.ui.pushbuffer()
498 498 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
499 499 fm.data(diffstat=self.ui.popbuffer())
500 500 if self._includediff or b'diff' in datahint:
501 501 self.ui.pushbuffer()
502 502 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
503 503 fm.data(diff=self.ui.popbuffer())
504 504
505 505
506 506 class changesettemplater(changesetprinter):
507 507 '''format changeset information.
508 508
509 509 Note: there are a variety of convenience functions to build a
510 510 changesettemplater for common cases. See functions such as:
511 511 maketemplater, changesetdisplayer, buildcommittemplate, or other
512 512 functions that use changesest_templater.
513 513 '''
514 514
515 515 # Arguments before "buffered" used to be positional. Consider not
516 516 # adding/removing arguments before "buffered" to not break callers.
517 517 def __init__(
518 518 self, ui, repo, tmplspec, differ=None, diffopts=None, buffered=False
519 519 ):
520 520 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
521 521 # tres is shared with _graphnodeformatter()
522 522 self._tresources = tres = formatter.templateresources(ui, repo)
523 523 self.t = formatter.loadtemplater(
524 524 ui,
525 525 tmplspec,
526 526 defaults=templatekw.keywords,
527 527 resources=tres,
528 528 cache=templatekw.defaulttempl,
529 529 )
530 530 self._counter = itertools.count()
531 531
532 532 self._tref = tmplspec.ref
533 533 self._parts = {
534 534 b'header': b'',
535 535 b'footer': b'',
536 536 tmplspec.ref: tmplspec.ref,
537 537 b'docheader': b'',
538 538 b'docfooter': b'',
539 539 b'separator': b'',
540 540 }
541 541 if tmplspec.mapfile:
542 542 # find correct templates for current mode, for backward
543 543 # compatibility with 'log -v/-q/--debug' using a mapfile
544 544 tmplmodes = [
545 545 (True, b''),
546 546 (self.ui.verbose, b'_verbose'),
547 547 (self.ui.quiet, b'_quiet'),
548 548 (self.ui.debugflag, b'_debug'),
549 549 ]
550 550 for mode, postfix in tmplmodes:
551 551 for t in self._parts:
552 552 cur = t + postfix
553 553 if mode and cur in self.t:
554 554 self._parts[t] = cur
555 555 else:
556 556 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
557 557 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
558 558 self._parts.update(m)
559 559
560 560 if self._parts[b'docheader']:
561 561 self.ui.write(self.t.render(self._parts[b'docheader'], {}))
562 562
563 563 def close(self):
564 564 if self._parts[b'docfooter']:
565 565 if not self.footer:
566 566 self.footer = b""
567 567 self.footer += self.t.render(self._parts[b'docfooter'], {})
568 568 return super(changesettemplater, self).close()
569 569
570 570 def _show(self, ctx, copies, props):
571 571 '''show a single changeset or file revision'''
572 572 props = props.copy()
573 573 props[b'ctx'] = ctx
574 574 props[b'index'] = index = next(self._counter)
575 575 props[b'revcache'] = {b'copies': copies}
576 576 graphwidth = props.get(b'graphwidth', 0)
577 577
578 578 # write separator, which wouldn't work well with the header part below
579 579 # since there's inherently a conflict between header (across items) and
580 580 # separator (per item)
581 581 if self._parts[b'separator'] and index > 0:
582 582 self.ui.write(self.t.render(self._parts[b'separator'], {}))
583 583
584 584 # write header
585 585 if self._parts[b'header']:
586 586 h = self.t.render(self._parts[b'header'], props)
587 587 if self.buffered:
588 588 self.header[ctx.rev()] = h
589 589 else:
590 590 if self.lastheader != h:
591 591 self.lastheader = h
592 592 self.ui.write(h)
593 593
594 594 # write changeset metadata, then patch if requested
595 595 key = self._parts[self._tref]
596 596 self.ui.write(self.t.render(key, props))
597 597 self._exthook(ctx)
598 598 self._showpatch(ctx, graphwidth)
599 599
600 600 if self._parts[b'footer']:
601 601 if not self.footer:
602 602 self.footer = self.t.render(self._parts[b'footer'], props)
603 603
604 604
605 605 def templatespec(tmpl, mapfile):
606 606 assert not (tmpl and mapfile)
607 607 if mapfile:
608 608 return formatter.mapfile_templatespec(b'changeset', mapfile)
609 609 else:
610 610 return formatter.literal_templatespec(tmpl)
611 611
612 612
613 613 def _lookuptemplate(ui, tmpl, style):
614 614 """Find the template matching the given template spec or style
615 615
616 616 See formatter.lookuptemplate() for details.
617 617 """
618 618
619 619 # ui settings
620 620 if not tmpl and not style: # template are stronger than style
621 621 tmpl = ui.config(b'ui', b'logtemplate')
622 622 if tmpl:
623 623 return formatter.literal_templatespec(templater.unquotestring(tmpl))
624 624 else:
625 625 style = util.expandpath(ui.config(b'ui', b'style'))
626 626
627 627 if not tmpl and style:
628 628 mapfile = style
629 629 fp = None
630 630 if not os.path.split(mapfile)[0]:
631 631 (mapname, fp) = templater.try_open_template(
632 632 b'map-cmdline.' + mapfile
633 633 ) or templater.try_open_template(mapfile)
634 634 if mapname:
635 635 mapfile = mapname
636 636 return formatter.mapfile_templatespec(b'changeset', mapfile, fp)
637 637
638 638 return formatter.lookuptemplate(ui, b'changeset', tmpl)
639 639
640 640
641 641 def maketemplater(ui, repo, tmpl, buffered=False):
642 642 """Create a changesettemplater from a literal template 'tmpl'
643 643 byte-string."""
644 644 spec = formatter.literal_templatespec(tmpl)
645 645 return changesettemplater(ui, repo, spec, buffered=buffered)
646 646
647 647
648 648 def changesetdisplayer(ui, repo, opts, differ=None, buffered=False):
649 649 """show one changeset using template or regular display.
650 650
651 651 Display format will be the first non-empty hit of:
652 652 1. option 'template'
653 653 2. option 'style'
654 654 3. [ui] setting 'logtemplate'
655 655 4. [ui] setting 'style'
656 656 If all of these values are either the unset or the empty string,
657 657 regular display via changesetprinter() is done.
658 658 """
659 659 postargs = (differ, opts, buffered)
660 660 spec = _lookuptemplate(ui, opts.get(b'template'), opts.get(b'style'))
661 661
662 662 # machine-readable formats have slightly different keyword set than
663 663 # plain templates, which are handled by changesetformatter.
664 664 # note that {b'pickle', b'debug'} can also be added to the list if needed.
665 665 if spec.ref in {b'cbor', b'json'}:
666 666 fm = ui.formatter(b'log', opts)
667 667 return changesetformatter(ui, repo, fm, *postargs)
668 668
669 669 if not spec.ref and not spec.tmpl and not spec.mapfile:
670 670 return changesetprinter(ui, repo, *postargs)
671 671
672 672 return changesettemplater(ui, repo, spec, *postargs)
673 673
674 674
675 675 def _makematcher(repo, revs, pats, opts):
676 676 """Build matcher and expanded patterns from log options
677 677
678 678 If --follow, revs are the revisions to follow from.
679 679
680 680 Returns (match, pats, slowpath) where
681 681 - match: a matcher built from the given pats and -I/-X opts
682 682 - pats: patterns used (globs are expanded on Windows)
683 683 - slowpath: True if patterns aren't as simple as scanning filelogs
684 684 """
685 685 # pats/include/exclude are passed to match.match() directly in
686 686 # _matchfiles() revset but walkchangerevs() builds its matcher with
687 687 # scmutil.match(). The difference is input pats are globbed on
688 688 # platforms without shell expansion (windows).
689 689 wctx = repo[None]
690 690 match, pats = scmutil.matchandpats(wctx, pats, opts)
691 691 slowpath = match.anypats() or (not match.always() and opts.get(b'removed'))
692 692 if not slowpath:
693 693 follow = opts.get(b'follow') or opts.get(b'follow_first')
694 694 if follow and opts.get(b'rev'):
695 695 startctxs = [repo[r] for r in revs]
696 696 for f in match.files():
697 697 # No idea if the path was a directory at that revision, so
698 698 # take the slow path.
699 699 if any(f not in c for c in startctxs):
700 700 slowpath = True
701 continue
702 filelog = repo.file(f)
703 if not filelog:
704 raise error.Abort(
705 _(b'cannot follow nonexistent file: "%s"') % f
706 )
701 break
707 702 elif follow:
708 703 for f in match.files():
709 704 if f not in wctx:
710 705 # If the file exists, it may be a directory, so let it
711 706 # take the slow path.
712 707 if os.path.exists(repo.wjoin(f)):
713 708 slowpath = True
714 709 continue
715 710 else:
716 711 raise error.Abort(
717 712 _(
718 713 b'cannot follow file not in parent '
719 714 b'revision: "%s"'
720 715 )
721 716 % f
722 717 )
723 718 filelog = repo.file(f)
724 719 if not filelog:
720 # A file exists in wdir but not in history, which means
721 # the file isn't committed yet.
725 722 raise error.Abort(
726 723 _(b'cannot follow nonexistent file: "%s"') % f
727 724 )
728 725 else:
729 726 for f in match.files():
730 727 filelog = repo.file(f)
731 728 if not filelog:
732 729 # A zero count may be a directory or deleted file, so
733 730 # try to find matching entries on the slow path.
734 731 slowpath = True
735 732
736 733 # We decided to fall back to the slowpath because at least one
737 734 # of the paths was not a file. Check to see if at least one of them
738 735 # existed in history - in that case, we'll continue down the
739 736 # slowpath; otherwise, we can turn off the slowpath
740 737 if slowpath:
741 738 for path in match.files():
742 739 if path == b'.' or path in repo.store:
743 740 break
744 741 else:
745 742 slowpath = False
746 743
747 744 return match, pats, slowpath
748 745
749 746
750 747 def _fileancestors(repo, revs, match, followfirst):
751 748 fctxs = []
752 749 for r in revs:
753 750 ctx = repo[r]
754 751 fctxs.extend(ctx[f].introfilectx() for f in ctx.walk(match))
755 752
756 753 # When displaying a revision with --patch --follow FILE, we have
757 754 # to know which file of the revision must be diffed. With
758 755 # --follow, we want the names of the ancestors of FILE in the
759 756 # revision, stored in "fcache". "fcache" is populated as a side effect
760 757 # of the graph traversal.
761 758 fcache = {}
762 759
763 760 def filematcher(ctx):
764 761 return scmutil.matchfiles(repo, fcache.get(scmutil.intrev(ctx), []))
765 762
766 763 def revgen():
767 764 for rev, cs in dagop.filectxancestors(fctxs, followfirst=followfirst):
768 765 fcache[rev] = [c.path() for c in cs]
769 766 yield rev
770 767
771 768 return smartset.generatorset(revgen(), iterasc=False), filematcher
772 769
773 770
774 771 def _makenofollowfilematcher(repo, pats, opts):
775 772 '''hook for extensions to override the filematcher for non-follow cases'''
776 773 return None
777 774
778 775
779 776 _opt2logrevset = {
780 777 b'no_merges': (b'not merge()', None),
781 778 b'only_merges': (b'merge()', None),
782 779 b'_matchfiles': (None, b'_matchfiles(%ps)'),
783 780 b'date': (b'date(%s)', None),
784 781 b'branch': (b'branch(%s)', b'%lr'),
785 782 b'_patslog': (b'filelog(%s)', b'%lr'),
786 783 b'keyword': (b'keyword(%s)', b'%lr'),
787 784 b'prune': (b'ancestors(%s)', b'not %lr'),
788 785 b'user': (b'user(%s)', b'%lr'),
789 786 }
790 787
791 788
792 789 def _makerevset(repo, match, pats, slowpath, opts):
793 790 """Return a revset string built from log options and file patterns"""
794 791 opts = dict(opts)
795 792 # follow or not follow?
796 793 follow = opts.get(b'follow') or opts.get(b'follow_first')
797 794
798 795 # branch and only_branch are really aliases and must be handled at
799 796 # the same time
800 797 opts[b'branch'] = opts.get(b'branch', []) + opts.get(b'only_branch', [])
801 798 opts[b'branch'] = [repo.lookupbranch(b) for b in opts[b'branch']]
802 799
803 800 if slowpath:
804 801 # See walkchangerevs() slow path.
805 802 #
806 803 # pats/include/exclude cannot be represented as separate
807 804 # revset expressions as their filtering logic applies at file
808 805 # level. For instance "-I a -X b" matches a revision touching
809 806 # "a" and "b" while "file(a) and not file(b)" does
810 807 # not. Besides, filesets are evaluated against the working
811 808 # directory.
812 809 matchargs = [b'r:', b'd:relpath']
813 810 for p in pats:
814 811 matchargs.append(b'p:' + p)
815 812 for p in opts.get(b'include', []):
816 813 matchargs.append(b'i:' + p)
817 814 for p in opts.get(b'exclude', []):
818 815 matchargs.append(b'x:' + p)
819 816 opts[b'_matchfiles'] = matchargs
820 817 elif not follow:
821 818 opts[b'_patslog'] = list(pats)
822 819
823 820 expr = []
824 821 for op, val in sorted(pycompat.iteritems(opts)):
825 822 if not val:
826 823 continue
827 824 if op not in _opt2logrevset:
828 825 continue
829 826 revop, listop = _opt2logrevset[op]
830 827 if revop and b'%' not in revop:
831 828 expr.append(revop)
832 829 elif not listop:
833 830 expr.append(revsetlang.formatspec(revop, val))
834 831 else:
835 832 if revop:
836 833 val = [revsetlang.formatspec(revop, v) for v in val]
837 834 expr.append(revsetlang.formatspec(listop, val))
838 835
839 836 if expr:
840 837 expr = b'(' + b' and '.join(expr) + b')'
841 838 else:
842 839 expr = None
843 840 return expr
844 841
845 842
846 843 def _initialrevs(repo, opts):
847 844 """Return the initial set of revisions to be filtered or followed"""
848 845 follow = opts.get(b'follow') or opts.get(b'follow_first')
849 846 if opts.get(b'rev'):
850 847 revs = scmutil.revrange(repo, opts[b'rev'])
851 848 elif follow and repo.dirstate.p1() == nullid:
852 849 revs = smartset.baseset()
853 850 elif follow:
854 851 revs = repo.revs(b'.')
855 852 else:
856 853 revs = smartset.spanset(repo)
857 854 revs.reverse()
858 855 return revs
859 856
860 857
861 858 def getrevs(repo, pats, opts):
862 859 # type: (Any, Any, Any) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]
863 860 """Return (revs, differ) where revs is a smartset
864 861
865 862 differ is a changesetdiffer with pre-configured file matcher.
866 863 """
867 864 follow = opts.get(b'follow') or opts.get(b'follow_first')
868 865 followfirst = opts.get(b'follow_first')
869 866 limit = getlimit(opts)
870 867 revs = _initialrevs(repo, opts)
871 868 if not revs:
872 869 return smartset.baseset(), None
873 870 match, pats, slowpath = _makematcher(repo, revs, pats, opts)
874 871 filematcher = None
875 872 if follow:
876 873 if slowpath or match.always():
877 874 revs = dagop.revancestors(repo, revs, followfirst=followfirst)
878 875 else:
879 876 revs, filematcher = _fileancestors(repo, revs, match, followfirst)
880 877 revs.reverse()
881 878 if filematcher is None:
882 879 filematcher = _makenofollowfilematcher(repo, pats, opts)
883 880 if filematcher is None:
884 881
885 882 def filematcher(ctx):
886 883 return match
887 884
888 885 expr = _makerevset(repo, match, pats, slowpath, opts)
889 886 if opts.get(b'graph'):
890 887 # User-specified revs might be unsorted, but don't sort before
891 888 # _makerevset because it might depend on the order of revs
892 889 if repo.ui.configbool(b'experimental', b'log.topo'):
893 890 if not revs.istopo():
894 891 revs = dagop.toposort(revs, repo.changelog.parentrevs)
895 892 # TODO: try to iterate the set lazily
896 893 revs = revset.baseset(list(revs), istopo=True)
897 894 elif not (revs.isdescending() or revs.istopo()):
898 895 revs.sort(reverse=True)
899 896 if expr:
900 897 matcher = revset.match(None, expr)
901 898 revs = matcher(repo, revs)
902 899 if limit is not None:
903 900 revs = revs.slice(0, limit)
904 901
905 902 differ = changesetdiffer()
906 903 differ._makefilematcher = filematcher
907 904 return revs, differ
908 905
909 906
910 907 def _parselinerangeopt(repo, opts):
911 908 """Parse --line-range log option and return a list of tuples (filename,
912 909 (fromline, toline)).
913 910 """
914 911 linerangebyfname = []
915 912 for pat in opts.get(b'line_range', []):
916 913 try:
917 914 pat, linerange = pat.rsplit(b',', 1)
918 915 except ValueError:
919 916 raise error.Abort(_(b'malformatted line-range pattern %s') % pat)
920 917 try:
921 918 fromline, toline = map(int, linerange.split(b':'))
922 919 except ValueError:
923 920 raise error.Abort(_(b"invalid line range for %s") % pat)
924 921 msg = _(b"line range pattern '%s' must match exactly one file") % pat
925 922 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
926 923 linerangebyfname.append(
927 924 (fname, util.processlinerange(fromline, toline))
928 925 )
929 926 return linerangebyfname
930 927
931 928
932 929 def getlinerangerevs(repo, userrevs, opts):
933 930 """Return (revs, differ).
934 931
935 932 "revs" are revisions obtained by processing "line-range" log options and
936 933 walking block ancestors of each specified file/line-range.
937 934
938 935 "differ" is a changesetdiffer with pre-configured file matcher and hunks
939 936 filter.
940 937 """
941 938 wctx = repo[None]
942 939
943 940 # Two-levels map of "rev -> file ctx -> [line range]".
944 941 linerangesbyrev = {}
945 942 for fname, (fromline, toline) in _parselinerangeopt(repo, opts):
946 943 if fname not in wctx:
947 944 raise error.Abort(
948 945 _(b'cannot follow file not in parent revision: "%s"') % fname
949 946 )
950 947 fctx = wctx.filectx(fname)
951 948 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
952 949 rev = fctx.introrev()
953 950 if rev is None:
954 951 rev = wdirrev
955 952 if rev not in userrevs:
956 953 continue
957 954 linerangesbyrev.setdefault(rev, {}).setdefault(
958 955 fctx.path(), []
959 956 ).append(linerange)
960 957
961 958 def nofilterhunksfn(fctx, hunks):
962 959 return hunks
963 960
964 961 def hunksfilter(ctx):
965 962 fctxlineranges = linerangesbyrev.get(scmutil.intrev(ctx))
966 963 if fctxlineranges is None:
967 964 return nofilterhunksfn
968 965
969 966 def filterfn(fctx, hunks):
970 967 lineranges = fctxlineranges.get(fctx.path())
971 968 if lineranges is not None:
972 969 for hr, lines in hunks:
973 970 if hr is None: # binary
974 971 yield hr, lines
975 972 continue
976 973 if any(mdiff.hunkinrange(hr[2:], lr) for lr in lineranges):
977 974 yield hr, lines
978 975 else:
979 976 for hunk in hunks:
980 977 yield hunk
981 978
982 979 return filterfn
983 980
984 981 def filematcher(ctx):
985 982 files = list(linerangesbyrev.get(scmutil.intrev(ctx), []))
986 983 return scmutil.matchfiles(repo, files)
987 984
988 985 revs = sorted(linerangesbyrev, reverse=True)
989 986
990 987 differ = changesetdiffer()
991 988 differ._makefilematcher = filematcher
992 989 differ._makehunksfilter = hunksfilter
993 990 return smartset.baseset(revs), differ
994 991
995 992
996 993 def _graphnodeformatter(ui, displayer):
997 994 spec = ui.config(b'ui', b'graphnodetemplate')
998 995 if not spec:
999 996 return templatekw.getgraphnode # fast path for "{graphnode}"
1000 997
1001 998 spec = templater.unquotestring(spec)
1002 999 if isinstance(displayer, changesettemplater):
1003 1000 # reuse cache of slow templates
1004 1001 tres = displayer._tresources
1005 1002 else:
1006 1003 tres = formatter.templateresources(ui)
1007 1004 templ = formatter.maketemplater(
1008 1005 ui, spec, defaults=templatekw.keywords, resources=tres
1009 1006 )
1010 1007
1011 1008 def formatnode(repo, ctx, cache):
1012 1009 props = {b'ctx': ctx, b'repo': repo}
1013 1010 return templ.renderdefault(props)
1014 1011
1015 1012 return formatnode
1016 1013
1017 1014
1018 1015 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None):
1019 1016 props = props or {}
1020 1017 formatnode = _graphnodeformatter(ui, displayer)
1021 1018 state = graphmod.asciistate()
1022 1019 styles = state.styles
1023 1020
1024 1021 # only set graph styling if HGPLAIN is not set.
1025 1022 if ui.plain(b'graph'):
1026 1023 # set all edge styles to |, the default pre-3.8 behaviour
1027 1024 styles.update(dict.fromkeys(styles, b'|'))
1028 1025 else:
1029 1026 edgetypes = {
1030 1027 b'parent': graphmod.PARENT,
1031 1028 b'grandparent': graphmod.GRANDPARENT,
1032 1029 b'missing': graphmod.MISSINGPARENT,
1033 1030 }
1034 1031 for name, key in edgetypes.items():
1035 1032 # experimental config: experimental.graphstyle.*
1036 1033 styles[key] = ui.config(
1037 1034 b'experimental', b'graphstyle.%s' % name, styles[key]
1038 1035 )
1039 1036 if not styles[key]:
1040 1037 styles[key] = None
1041 1038
1042 1039 # experimental config: experimental.graphshorten
1043 1040 state.graphshorten = ui.configbool(b'experimental', b'graphshorten')
1044 1041
1045 1042 formatnode_cache = {}
1046 1043 for rev, type, ctx, parents in dag:
1047 1044 char = formatnode(repo, ctx, formatnode_cache)
1048 1045 copies = getcopies(ctx) if getcopies else None
1049 1046 edges = edgefn(type, char, state, rev, parents)
1050 1047 firstedge = next(edges)
1051 1048 width = firstedge[2]
1052 1049 displayer.show(
1053 1050 ctx, copies=copies, graphwidth=width, **pycompat.strkwargs(props)
1054 1051 )
1055 1052 lines = displayer.hunk.pop(rev).split(b'\n')
1056 1053 if not lines[-1]:
1057 1054 del lines[-1]
1058 1055 displayer.flush(ctx)
1059 1056 for type, char, width, coldata in itertools.chain([firstedge], edges):
1060 1057 graphmod.ascii(ui, state, type, char, lines, coldata)
1061 1058 lines = []
1062 1059 displayer.close()
1063 1060
1064 1061
1065 1062 def displaygraphrevs(ui, repo, revs, displayer, getrenamed):
1066 1063 revdag = graphmod.dagwalker(repo, revs)
1067 1064 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed)
1068 1065
1069 1066
1070 1067 def displayrevs(ui, repo, revs, displayer, getcopies):
1071 1068 for rev in revs:
1072 1069 ctx = repo[rev]
1073 1070 copies = getcopies(ctx) if getcopies else None
1074 1071 displayer.show(ctx, copies=copies)
1075 1072 displayer.flush(ctx)
1076 1073 displayer.close()
1077 1074
1078 1075
1079 1076 def checkunsupportedgraphflags(pats, opts):
1080 1077 for op in [b"newest_first"]:
1081 1078 if op in opts and opts[op]:
1082 1079 raise error.Abort(
1083 1080 _(b"-G/--graph option is incompatible with --%s")
1084 1081 % op.replace(b"_", b"-")
1085 1082 )
1086 1083
1087 1084
1088 1085 def graphrevs(repo, nodes, opts):
1089 1086 limit = getlimit(opts)
1090 1087 nodes.reverse()
1091 1088 if limit is not None:
1092 1089 nodes = nodes[:limit]
1093 1090 return graphmod.nodes(repo, nodes)
@@ -1,2849 +1,2855 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 [255]
9 9 $ hg log -r -1:0
10 10 abort: unknown revision '-1'!
11 11 [255]
12 12 $ hg log -r 'branch(name)'
13 13 abort: unknown revision 'name'!
14 14 [255]
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 -X, with explicit path
106 106
107 107 $ hg log a -X a
108 108
109 109 -f, non-existent directory
110 110
111 111 $ hg log -f dir
112 112 abort: cannot follow file not in parent revision: "dir"
113 113 [255]
114 114
115 115 -f, directory
116 116
117 117 $ hg up -q 3
118 118 $ hg log -f dir
119 119 changeset: 2:f8954cd4dc1f
120 120 user: test
121 121 date: Thu Jan 01 00:00:03 1970 +0000
122 122 summary: c
123 123
124 124 -f, directory with --patch
125 125
126 126 $ hg log -f dir -p
127 127 changeset: 2:f8954cd4dc1f
128 128 user: test
129 129 date: Thu Jan 01 00:00:03 1970 +0000
130 130 summary: c
131 131
132 132 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
133 133 --- /dev/null* (glob)
134 134 +++ b/dir/b* (glob)
135 135 @@ -0,0 +1,1 @@
136 136 +a
137 137
138 138
139 139 -f, pattern
140 140
141 141 $ hg log -f -I 'dir**' -p
142 142 changeset: 2:f8954cd4dc1f
143 143 user: test
144 144 date: Thu Jan 01 00:00:03 1970 +0000
145 145 summary: c
146 146
147 147 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
148 148 --- /dev/null* (glob)
149 149 +++ b/dir/b* (glob)
150 150 @@ -0,0 +1,1 @@
151 151 +a
152 152
153 153 $ hg up -q 4
154 154
155 155 -f, a wrong style
156 156
157 157 $ hg log -f -l1 --style something
158 158 abort: style 'something' not found
159 159 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
160 160 [255]
161 161
162 162 -f, phases style
163 163
164 164
165 165 $ hg log -f -l1 --style phases
166 166 changeset: 4:7e4639b4691b
167 167 tag: tip
168 168 phase: draft
169 169 user: test
170 170 date: Thu Jan 01 00:00:05 1970 +0000
171 171 summary: e
172 172
173 173
174 174 $ hg log -f -l1 --style phases -q
175 175 4:7e4639b4691b
176 176
177 177 -f, but no args
178 178
179 179 $ hg log -f
180 180 changeset: 4:7e4639b4691b
181 181 tag: tip
182 182 user: test
183 183 date: Thu Jan 01 00:00:05 1970 +0000
184 184 summary: e
185 185
186 186 changeset: 3:2ca5ba701980
187 187 user: test
188 188 date: Thu Jan 01 00:00:04 1970 +0000
189 189 summary: d
190 190
191 191 changeset: 2:f8954cd4dc1f
192 192 user: test
193 193 date: Thu Jan 01 00:00:03 1970 +0000
194 194 summary: c
195 195
196 196 changeset: 1:d89b0a12d229
197 197 user: test
198 198 date: Thu Jan 01 00:00:02 1970 +0000
199 199 summary: b
200 200
201 201 changeset: 0:9161b9aeaf16
202 202 user: test
203 203 date: Thu Jan 01 00:00:01 1970 +0000
204 204 summary: a
205 205
206 206
207 207 one rename
208 208
209 209 $ hg up -q 2
210 210 $ hg log -vf a
211 211 changeset: 0:9161b9aeaf16
212 212 user: test
213 213 date: Thu Jan 01 00:00:01 1970 +0000
214 214 files: a f
215 215 description:
216 216 a
217 217
218 218
219 219
220 220 many renames
221 221
222 222 $ hg up -q tip
223 223 $ hg log -vf e
224 224 changeset: 4:7e4639b4691b
225 225 tag: tip
226 226 user: test
227 227 date: Thu Jan 01 00:00:05 1970 +0000
228 228 files: dir/b e
229 229 description:
230 230 e
231 231
232 232
233 233 changeset: 2:f8954cd4dc1f
234 234 user: test
235 235 date: Thu Jan 01 00:00:03 1970 +0000
236 236 files: b dir/b f g
237 237 description:
238 238 c
239 239
240 240
241 241 changeset: 1:d89b0a12d229
242 242 user: test
243 243 date: Thu Jan 01 00:00:02 1970 +0000
244 244 files: b g
245 245 description:
246 246 b
247 247
248 248
249 249 changeset: 0:9161b9aeaf16
250 250 user: test
251 251 date: Thu Jan 01 00:00:01 1970 +0000
252 252 files: a f
253 253 description:
254 254 a
255 255
256 256
257 257
258 258
259 259 log -pf dir/b
260 260
261 261 $ hg up -q 3
262 262 $ hg log -pf dir/b
263 263 changeset: 2:f8954cd4dc1f
264 264 user: test
265 265 date: Thu Jan 01 00:00:03 1970 +0000
266 266 summary: c
267 267
268 268 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
269 269 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
270 270 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
271 271 @@ -0,0 +1,1 @@
272 272 +a
273 273
274 274 changeset: 1:d89b0a12d229
275 275 user: test
276 276 date: Thu Jan 01 00:00:02 1970 +0000
277 277 summary: b
278 278
279 279 diff -r 9161b9aeaf16 -r d89b0a12d229 b
280 280 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
281 281 +++ b/b Thu Jan 01 00:00:02 1970 +0000
282 282 @@ -0,0 +1,1 @@
283 283 +a
284 284
285 285 changeset: 0:9161b9aeaf16
286 286 user: test
287 287 date: Thu Jan 01 00:00:01 1970 +0000
288 288 summary: a
289 289
290 290 diff -r 000000000000 -r 9161b9aeaf16 a
291 291 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
292 292 +++ b/a Thu Jan 01 00:00:01 1970 +0000
293 293 @@ -0,0 +1,1 @@
294 294 +a
295 295
296 296
297 297 log -pf b inside dir
298 298
299 299 $ hg --cwd=dir log -pf b
300 300 changeset: 2:f8954cd4dc1f
301 301 user: test
302 302 date: Thu Jan 01 00:00:03 1970 +0000
303 303 summary: c
304 304
305 305 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
306 306 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
307 307 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
308 308 @@ -0,0 +1,1 @@
309 309 +a
310 310
311 311 changeset: 1:d89b0a12d229
312 312 user: test
313 313 date: Thu Jan 01 00:00:02 1970 +0000
314 314 summary: b
315 315
316 316 diff -r 9161b9aeaf16 -r d89b0a12d229 b
317 317 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
318 318 +++ b/b Thu Jan 01 00:00:02 1970 +0000
319 319 @@ -0,0 +1,1 @@
320 320 +a
321 321
322 322 changeset: 0:9161b9aeaf16
323 323 user: test
324 324 date: Thu Jan 01 00:00:01 1970 +0000
325 325 summary: a
326 326
327 327 diff -r 000000000000 -r 9161b9aeaf16 a
328 328 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
329 329 +++ b/a Thu Jan 01 00:00:01 1970 +0000
330 330 @@ -0,0 +1,1 @@
331 331 +a
332 332
333 333
334 334 log -pf, but no args
335 335
336 336 $ hg log -pf
337 337 changeset: 3:2ca5ba701980
338 338 user: test
339 339 date: Thu Jan 01 00:00:04 1970 +0000
340 340 summary: d
341 341
342 342 diff -r f8954cd4dc1f -r 2ca5ba701980 a
343 343 --- a/a Thu Jan 01 00:00:03 1970 +0000
344 344 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
345 345 @@ -1,1 +0,0 @@
346 346 -a
347 347 diff -r f8954cd4dc1f -r 2ca5ba701980 b
348 348 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
349 349 +++ b/b Thu Jan 01 00:00:04 1970 +0000
350 350 @@ -0,0 +1,1 @@
351 351 +a
352 352 diff -r f8954cd4dc1f -r 2ca5ba701980 d
353 353 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
354 354 +++ b/d Thu Jan 01 00:00:04 1970 +0000
355 355 @@ -0,0 +1,1 @@
356 356 +a
357 357 diff -r f8954cd4dc1f -r 2ca5ba701980 g
358 358 --- a/g Thu Jan 01 00:00:03 1970 +0000
359 359 +++ b/g Thu Jan 01 00:00:04 1970 +0000
360 360 @@ -1,2 +1,2 @@
361 361 f
362 362 -g
363 363 +f
364 364
365 365 changeset: 2:f8954cd4dc1f
366 366 user: test
367 367 date: Thu Jan 01 00:00:03 1970 +0000
368 368 summary: c
369 369
370 370 diff -r d89b0a12d229 -r f8954cd4dc1f b
371 371 --- a/b Thu Jan 01 00:00:02 1970 +0000
372 372 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
373 373 @@ -1,1 +0,0 @@
374 374 -a
375 375 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
376 376 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
377 377 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
378 378 @@ -0,0 +1,1 @@
379 379 +a
380 380 diff -r d89b0a12d229 -r f8954cd4dc1f f
381 381 --- a/f Thu Jan 01 00:00:02 1970 +0000
382 382 +++ b/f Thu Jan 01 00:00:03 1970 +0000
383 383 @@ -1,1 +1,2 @@
384 384 f
385 385 +f
386 386 diff -r d89b0a12d229 -r f8954cd4dc1f g
387 387 --- a/g Thu Jan 01 00:00:02 1970 +0000
388 388 +++ b/g Thu Jan 01 00:00:03 1970 +0000
389 389 @@ -1,1 +1,2 @@
390 390 f
391 391 +g
392 392
393 393 changeset: 1:d89b0a12d229
394 394 user: test
395 395 date: Thu Jan 01 00:00:02 1970 +0000
396 396 summary: b
397 397
398 398 diff -r 9161b9aeaf16 -r d89b0a12d229 b
399 399 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
400 400 +++ b/b Thu Jan 01 00:00:02 1970 +0000
401 401 @@ -0,0 +1,1 @@
402 402 +a
403 403 diff -r 9161b9aeaf16 -r d89b0a12d229 g
404 404 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
405 405 +++ b/g Thu Jan 01 00:00:02 1970 +0000
406 406 @@ -0,0 +1,1 @@
407 407 +f
408 408
409 409 changeset: 0:9161b9aeaf16
410 410 user: test
411 411 date: Thu Jan 01 00:00:01 1970 +0000
412 412 summary: a
413 413
414 414 diff -r 000000000000 -r 9161b9aeaf16 a
415 415 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
416 416 +++ b/a Thu Jan 01 00:00:01 1970 +0000
417 417 @@ -0,0 +1,1 @@
418 418 +a
419 419 diff -r 000000000000 -r 9161b9aeaf16 f
420 420 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
421 421 +++ b/f Thu Jan 01 00:00:01 1970 +0000
422 422 @@ -0,0 +1,1 @@
423 423 +f
424 424
425 425
426 426 log -vf dir/b
427 427
428 428 $ hg log -vf dir/b
429 429 changeset: 2:f8954cd4dc1f
430 430 user: test
431 431 date: Thu Jan 01 00:00:03 1970 +0000
432 432 files: b dir/b f g
433 433 description:
434 434 c
435 435
436 436
437 437 changeset: 1:d89b0a12d229
438 438 user: test
439 439 date: Thu Jan 01 00:00:02 1970 +0000
440 440 files: b g
441 441 description:
442 442 b
443 443
444 444
445 445 changeset: 0:9161b9aeaf16
446 446 user: test
447 447 date: Thu Jan 01 00:00:01 1970 +0000
448 448 files: a f
449 449 description:
450 450 a
451 451
452 452
453 453
454 454
455 455 -f and multiple filelog heads
456 456
457 457 $ hg up -q 2
458 458 $ hg log -f g --template '{rev}\n'
459 459 2
460 460 1
461 461 0
462 462 $ hg up -q tip
463 463 $ hg log -f g --template '{rev}\n'
464 464 3
465 465 2
466 466 0
467 467
468 468 follow files from the specified revisions (issue4959)
469 469
470 470 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
471 471 @ 4 dir/b e, dir/b->e
472 472 |
473 473 o 3 a b d g, a->b f->g
474 474 |
475 475 o 2 b dir/b f g, b->dir/b
476 476 |
477 477 o 1 b g, a->b f->g
478 478 |
479 479 o 0 a f,
480 480
481 481
482 482 $ hg log -T '{rev}\n' -fr 4 e
483 483 4
484 484 2
485 485 1
486 486 0
487 487 $ hg log -T '{rev}\n' -fr 2 g
488 488 2
489 489 1
490 490 0
491 491 $ hg log -T '{rev}\n' -fr '2+3' g
492 492 3
493 493 2
494 494 1
495 495 0
496 496
497 497 follow files from the specified revisions with glob patterns (issue5053)
498 498 (BROKEN: should follow copies from e@4)
499 499
500 500 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
501 501 4
502 502 2 (false !)
503 503 1 (false !)
504 504 0 (false !)
505 505
506 506 follow files from the specified revisions with missing patterns
507 507 (BROKEN: should follow copies from e@4)
508 508
509 509 $ hg log -T '{rev}\n' -fr4 e x
510 510 4
511 511 2 (false !)
512 512 1 (false !)
513 513 0 (false !)
514 514
515 515 follow files from the specified revisions across copies with -p/--patch
516 516
517 517 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
518 518 == rev: 4, dir/b->e ==
519 519 diff -r 2ca5ba701980 -r 7e4639b4691b e
520 520 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
521 521 +++ b/e Thu Jan 01 00:00:05 1970 +0000
522 522 @@ -0,0 +1,1 @@
523 523 +a
524 524
525 525 == rev: 3, a->b f->g ==
526 526 diff -r f8954cd4dc1f -r 2ca5ba701980 g
527 527 --- a/g Thu Jan 01 00:00:03 1970 +0000
528 528 +++ b/g Thu Jan 01 00:00:04 1970 +0000
529 529 @@ -1,2 +1,2 @@
530 530 f
531 531 -g
532 532 +f
533 533
534 534 == rev: 2, b->dir/b ==
535 535 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
536 536 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
537 537 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
538 538 @@ -0,0 +1,1 @@
539 539 +a
540 540 diff -r d89b0a12d229 -r f8954cd4dc1f f
541 541 --- a/f Thu Jan 01 00:00:02 1970 +0000
542 542 +++ b/f Thu Jan 01 00:00:03 1970 +0000
543 543 @@ -1,1 +1,2 @@
544 544 f
545 545 +f
546 546
547 547 == rev: 1, a->b f->g ==
548 548 diff -r 9161b9aeaf16 -r d89b0a12d229 b
549 549 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
550 550 +++ b/b Thu Jan 01 00:00:02 1970 +0000
551 551 @@ -0,0 +1,1 @@
552 552 +a
553 553
554 554 == rev: 0, ==
555 555 diff -r 000000000000 -r 9161b9aeaf16 a
556 556 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
557 557 +++ b/a Thu Jan 01 00:00:01 1970 +0000
558 558 @@ -0,0 +1,1 @@
559 559 +a
560 560 diff -r 000000000000 -r 9161b9aeaf16 f
561 561 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
562 562 +++ b/f Thu Jan 01 00:00:01 1970 +0000
563 563 @@ -0,0 +1,1 @@
564 564 +f
565 565
566 566
567 567 log copies with --copies
568 568
569 569 $ hg log -vC --template '{rev} {file_copies}\n'
570 570 4 e (dir/b)
571 571 3 b (a)g (f)
572 572 2 dir/b (b)
573 573 1 b (a)g (f)
574 574 0
575 575
576 576 log copies switch without --copies, with old filecopy template
577 577
578 578 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
579 579 4
580 580 3
581 581 2
582 582 1
583 583 0
584 584
585 585 log copies switch with --copies
586 586
587 587 $ hg log -vC --template '{rev} {file_copies_switch}\n'
588 588 4 e (dir/b)
589 589 3 b (a)g (f)
590 590 2 dir/b (b)
591 591 1 b (a)g (f)
592 592 0
593 593
594 594
595 595 log copies with hardcoded style and with --style=default
596 596
597 597 $ hg log -vC -r4
598 598 changeset: 4:7e4639b4691b
599 599 tag: tip
600 600 user: test
601 601 date: Thu Jan 01 00:00:05 1970 +0000
602 602 files: dir/b e
603 603 copies: e (dir/b)
604 604 description:
605 605 e
606 606
607 607
608 608 $ hg log -vC -r4 --style=default
609 609 changeset: 4:7e4639b4691b
610 610 tag: tip
611 611 user: test
612 612 date: Thu Jan 01 00:00:05 1970 +0000
613 613 files: dir/b e
614 614 copies: e (dir/b)
615 615 description:
616 616 e
617 617
618 618
619 619 $ hg log -vC -r4 -Tjson
620 620 [
621 621 {
622 622 "bookmarks": [],
623 623 "branch": "default",
624 624 "copies": {"e": "dir/b"},
625 625 "date": [5, 0],
626 626 "desc": "e",
627 627 "files": ["dir/b", "e"],
628 628 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
629 629 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
630 630 "phase": "draft",
631 631 "rev": 4,
632 632 "tags": ["tip"],
633 633 "user": "test"
634 634 }
635 635 ]
636 636
637 637 log copies, non-linear manifest
638 638
639 639 $ hg up -C 3
640 640 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
641 641 $ hg mv dir/b e
642 642 $ echo foo > foo
643 643 $ hg ci -Ame2 -d '6 0'
644 644 adding foo
645 645 created new head
646 646 $ hg log -v --template '{rev} {file_copies}\n' -r 5
647 647 5 e (dir/b)
648 648
649 649
650 650 log copies, execute bit set
651 651
652 652 #if execbit
653 653 $ chmod +x e
654 654 $ hg ci -me3 -d '7 0'
655 655 $ hg log -v --template '{rev} {file_copies}\n' -r 6
656 656 6
657 657 #endif
658 658
659 659 log copies, empty set
660 660
661 661 $ hg log --copies -r '0 and not 0'
662 662
663 663 log -p d
664 664
665 665 $ hg log -pv d
666 666 changeset: 3:2ca5ba701980
667 667 user: test
668 668 date: Thu Jan 01 00:00:04 1970 +0000
669 669 files: a b d g
670 670 description:
671 671 d
672 672
673 673
674 674 diff -r f8954cd4dc1f -r 2ca5ba701980 d
675 675 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
676 676 +++ b/d Thu Jan 01 00:00:04 1970 +0000
677 677 @@ -0,0 +1,1 @@
678 678 +a
679 679
680 680
681 681
682 682 log --removed file
683 683
684 684 $ hg log --removed -v a
685 685 changeset: 3:2ca5ba701980
686 686 user: test
687 687 date: Thu Jan 01 00:00:04 1970 +0000
688 688 files: a b d g
689 689 description:
690 690 d
691 691
692 692
693 693 changeset: 0:9161b9aeaf16
694 694 user: test
695 695 date: Thu Jan 01 00:00:01 1970 +0000
696 696 files: a f
697 697 description:
698 698 a
699 699
700 700
701 701
702 702 log --removed revrange file
703 703
704 704 $ hg log --removed -v -r0:2 a
705 705 changeset: 0:9161b9aeaf16
706 706 user: test
707 707 date: Thu Jan 01 00:00:01 1970 +0000
708 708 files: a f
709 709 description:
710 710 a
711 711
712 712
713 713 $ cd ..
714 714
715 715 log --follow tests
716 716
717 717 $ hg init follow
718 718 $ cd follow
719 719
720 720 $ echo base > base
721 721 $ hg ci -Ambase -d '1 0'
722 722 adding base
723 723
724 724 $ echo r1 >> base
725 725 $ hg ci -Amr1 -d '1 0'
726 726 $ echo r2 >> base
727 727 $ hg ci -Amr2 -d '1 0'
728 728
729 729 $ hg up -C 1
730 730 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 731 $ echo b1 > b1
732 732
733 733 log -r "follow('set:clean()')"
734 734
735 735 $ hg log -r "follow('set:clean()')"
736 736 changeset: 0:67e992f2c4f3
737 737 user: test
738 738 date: Thu Jan 01 00:00:01 1970 +0000
739 739 summary: base
740 740
741 741 changeset: 1:3d5bf5654eda
742 742 user: test
743 743 date: Thu Jan 01 00:00:01 1970 +0000
744 744 summary: r1
745 745
746 746
747 747 $ hg ci -Amb1 -d '1 0'
748 748 adding b1
749 749 created new head
750 750
751 751
752 752 log -f
753 753
754 754 $ hg log -f
755 755 changeset: 3:e62f78d544b4
756 756 tag: tip
757 757 parent: 1:3d5bf5654eda
758 758 user: test
759 759 date: Thu Jan 01 00:00:01 1970 +0000
760 760 summary: b1
761 761
762 762 changeset: 1:3d5bf5654eda
763 763 user: test
764 764 date: Thu Jan 01 00:00:01 1970 +0000
765 765 summary: r1
766 766
767 767 changeset: 0:67e992f2c4f3
768 768 user: test
769 769 date: Thu Jan 01 00:00:01 1970 +0000
770 770 summary: base
771 771
772 772
773 773 log -r follow('glob:b*')
774 774
775 775 $ hg log -r "follow('glob:b*')"
776 776 changeset: 0:67e992f2c4f3
777 777 user: test
778 778 date: Thu Jan 01 00:00:01 1970 +0000
779 779 summary: base
780 780
781 781 changeset: 1:3d5bf5654eda
782 782 user: test
783 783 date: Thu Jan 01 00:00:01 1970 +0000
784 784 summary: r1
785 785
786 786 changeset: 3:e62f78d544b4
787 787 tag: tip
788 788 parent: 1:3d5bf5654eda
789 789 user: test
790 790 date: Thu Jan 01 00:00:01 1970 +0000
791 791 summary: b1
792 792
793 793 log -f -r '1 + 4'
794 794
795 795 $ hg up -C 0
796 796 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
797 797 $ echo b2 > b2
798 798 $ hg ci -Amb2 -d '1 0'
799 799 adding b2
800 800 created new head
801 801 $ hg log -f -r '1 + 4'
802 802 changeset: 4:ddb82e70d1a1
803 803 tag: tip
804 804 parent: 0:67e992f2c4f3
805 805 user: test
806 806 date: Thu Jan 01 00:00:01 1970 +0000
807 807 summary: b2
808 808
809 809 changeset: 1:3d5bf5654eda
810 810 user: test
811 811 date: Thu Jan 01 00:00:01 1970 +0000
812 812 summary: r1
813 813
814 814 changeset: 0:67e992f2c4f3
815 815 user: test
816 816 date: Thu Jan 01 00:00:01 1970 +0000
817 817 summary: base
818 818
819 819
820 820 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
821 821 effect
822 822
823 823 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
824 824 4:ddb82e70d1a1
825 825 1:3d5bf5654eda
826 826 0:67e992f2c4f3
827 827
828 828 log -r "follow('set:grep(b2)')"
829 829
830 830 $ hg log -r "follow('set:grep(b2)')"
831 831 changeset: 4:ddb82e70d1a1
832 832 tag: tip
833 833 parent: 0:67e992f2c4f3
834 834 user: test
835 835 date: Thu Jan 01 00:00:01 1970 +0000
836 836 summary: b2
837 837
838 838 log -r "follow('set:grep(b2)', 4)"
839 839
840 840 $ hg up -qC 0
841 841 $ hg log -r "follow('set:grep(b2)', 4)"
842 842 changeset: 4:ddb82e70d1a1
843 843 tag: tip
844 844 parent: 0:67e992f2c4f3
845 845 user: test
846 846 date: Thu Jan 01 00:00:01 1970 +0000
847 847 summary: b2
848 848
849 849
850 850 follow files starting from multiple revisions:
851 851
852 852 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
853 853 3: b1
854 854 4: b2
855 855
856 856 follow files starting from empty revision:
857 857
858 858 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
859 859
860 860 follow starting from revisions:
861 861
862 862 $ hg log -Gq -r "follow(startrev=2+4)"
863 863 o 4:ddb82e70d1a1
864 864 |
865 865 | o 2:60c670bf5b30
866 866 | |
867 867 | o 1:3d5bf5654eda
868 868 |/
869 869 @ 0:67e992f2c4f3
870 870
871 871
872 872 follow the current revision:
873 873
874 874 $ hg log -Gq -r "follow()"
875 875 @ 0:67e992f2c4f3
876 876
877 877
878 878 $ hg up -qC 4
879 879
880 880 log -f -r null
881 881
882 882 $ hg log -f -r null
883 883 changeset: -1:000000000000
884 884 user:
885 885 date: Thu Jan 01 00:00:00 1970 +0000
886 886
887 887 $ hg log -f -r null -G
888 888 o changeset: -1:000000000000
889 889 user:
890 890 date: Thu Jan 01 00:00:00 1970 +0000
891 891
892 892
893 893
894 894 log -f with null parent
895 895
896 896 $ hg up -C null
897 897 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
898 898 $ hg log -f
899 899
900 900
901 901 log -r . with two parents
902 902
903 903 $ hg up -C 3
904 904 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
905 905 $ hg merge tip
906 906 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
907 907 (branch merge, don't forget to commit)
908 908 $ hg log -r .
909 909 changeset: 3:e62f78d544b4
910 910 parent: 1:3d5bf5654eda
911 911 user: test
912 912 date: Thu Jan 01 00:00:01 1970 +0000
913 913 summary: b1
914 914
915 915
916 916
917 917 log -r . with one parent
918 918
919 919 $ hg ci -mm12 -d '1 0'
920 920 $ hg log -r .
921 921 changeset: 5:302e9dd6890d
922 922 tag: tip
923 923 parent: 3:e62f78d544b4
924 924 parent: 4:ddb82e70d1a1
925 925 user: test
926 926 date: Thu Jan 01 00:00:01 1970 +0000
927 927 summary: m12
928 928
929 929
930 930 $ echo postm >> b1
931 931 $ hg ci -Amb1.1 -d'1 0'
932 932
933 933
934 934 log --follow-first
935 935
936 936 $ hg log --follow-first
937 937 changeset: 6:2404bbcab562
938 938 tag: tip
939 939 user: test
940 940 date: Thu Jan 01 00:00:01 1970 +0000
941 941 summary: b1.1
942 942
943 943 changeset: 5:302e9dd6890d
944 944 parent: 3:e62f78d544b4
945 945 parent: 4:ddb82e70d1a1
946 946 user: test
947 947 date: Thu Jan 01 00:00:01 1970 +0000
948 948 summary: m12
949 949
950 950 changeset: 3:e62f78d544b4
951 951 parent: 1:3d5bf5654eda
952 952 user: test
953 953 date: Thu Jan 01 00:00:01 1970 +0000
954 954 summary: b1
955 955
956 956 changeset: 1:3d5bf5654eda
957 957 user: test
958 958 date: Thu Jan 01 00:00:01 1970 +0000
959 959 summary: r1
960 960
961 961 changeset: 0:67e992f2c4f3
962 962 user: test
963 963 date: Thu Jan 01 00:00:01 1970 +0000
964 964 summary: base
965 965
966 966
967 967
968 968 log -P 2
969 969
970 970 $ hg log -P 2
971 971 changeset: 6:2404bbcab562
972 972 tag: tip
973 973 user: test
974 974 date: Thu Jan 01 00:00:01 1970 +0000
975 975 summary: b1.1
976 976
977 977 changeset: 5:302e9dd6890d
978 978 parent: 3:e62f78d544b4
979 979 parent: 4:ddb82e70d1a1
980 980 user: test
981 981 date: Thu Jan 01 00:00:01 1970 +0000
982 982 summary: m12
983 983
984 984 changeset: 4:ddb82e70d1a1
985 985 parent: 0:67e992f2c4f3
986 986 user: test
987 987 date: Thu Jan 01 00:00:01 1970 +0000
988 988 summary: b2
989 989
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 tip -p --git
999 999
1000 1000 $ hg log -r tip -p --git
1001 1001 changeset: 6:2404bbcab562
1002 1002 tag: tip
1003 1003 user: test
1004 1004 date: Thu Jan 01 00:00:01 1970 +0000
1005 1005 summary: b1.1
1006 1006
1007 1007 diff --git a/b1 b/b1
1008 1008 --- a/b1
1009 1009 +++ b/b1
1010 1010 @@ -1,1 +1,2 @@
1011 1011 b1
1012 1012 +postm
1013 1013
1014 1014
1015 1015
1016 1016 log -r ""
1017 1017
1018 1018 $ hg log -r ''
1019 1019 hg: parse error: empty query
1020 1020 [255]
1021 1021
1022 1022 log -r <some unknown node id>
1023 1023
1024 1024 $ hg log -r 1000000000000000000000000000000000000000
1025 1025 abort: unknown revision '1000000000000000000000000000000000000000'!
1026 1026 [255]
1027 1027
1028 1028 log -k r1
1029 1029
1030 1030 $ hg log -k r1
1031 1031 changeset: 1:3d5bf5654eda
1032 1032 user: test
1033 1033 date: Thu Jan 01 00:00:01 1970 +0000
1034 1034 summary: r1
1035 1035
1036 1036 log -p -l2 --color=always
1037 1037
1038 1038 $ hg --config extensions.color= --config color.mode=ansi \
1039 1039 > log -p -l2 --color=always
1040 1040 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1041 1041 tag: tip
1042 1042 user: test
1043 1043 date: Thu Jan 01 00:00:01 1970 +0000
1044 1044 summary: b1.1
1045 1045
1046 1046 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1047 1047 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1048 1048 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1049 1049 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1050 1050 b1
1051 1051 \x1b[0;32m+postm\x1b[0m (esc)
1052 1052
1053 1053 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1054 1054 parent: 3:e62f78d544b4
1055 1055 parent: 4:ddb82e70d1a1
1056 1056 user: test
1057 1057 date: Thu Jan 01 00:00:01 1970 +0000
1058 1058 summary: m12
1059 1059
1060 1060 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1061 1061 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1062 1062 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1063 1063 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1064 1064 \x1b[0;32m+b2\x1b[0m (esc)
1065 1065
1066 1066
1067 1067
1068 1068 log -r tip --stat
1069 1069
1070 1070 $ hg log -r tip --stat
1071 1071 changeset: 6:2404bbcab562
1072 1072 tag: tip
1073 1073 user: test
1074 1074 date: Thu Jan 01 00:00:01 1970 +0000
1075 1075 summary: b1.1
1076 1076
1077 1077 b1 | 1 +
1078 1078 1 files changed, 1 insertions(+), 0 deletions(-)
1079 1079
1080 1080
1081 1081 $ cd ..
1082 1082
1083 1083 log --follow --patch FILE in repository where linkrev isn't trustworthy
1084 1084 (issue5376, issue6124)
1085 1085
1086 1086 $ hg init follow-dup
1087 1087 $ cd follow-dup
1088 1088 $ cat <<EOF >> .hg/hgrc
1089 1089 > [ui]
1090 1090 > logtemplate = '=== {rev}: {desc}\n'
1091 1091 > [diff]
1092 1092 > nodates = True
1093 1093 > EOF
1094 1094 $ echo 0 >> a
1095 1095 $ hg ci -qAm 'a0'
1096 1096 $ echo 1 >> a
1097 1097 $ hg ci -m 'a1'
1098 1098 $ hg up -q 0
1099 1099 $ echo 1 >> a
1100 1100 $ touch b
1101 1101 $ hg ci -qAm 'a1 with b'
1102 1102 $ echo 3 >> a
1103 1103 $ hg ci -m 'a3'
1104 1104
1105 1105 fctx.rev() == 2, but fctx.linkrev() == 1
1106 1106
1107 1107 $ hg log -pf a
1108 1108 === 3: a3
1109 1109 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1110 1110 --- a/a
1111 1111 +++ b/a
1112 1112 @@ -1,2 +1,3 @@
1113 1113 0
1114 1114 1
1115 1115 +3
1116 1116
1117 1117 === 2: a1 with b
1118 1118 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1119 1119 --- a/a
1120 1120 +++ b/a
1121 1121 @@ -1,1 +1,2 @@
1122 1122 0
1123 1123 +1
1124 1124
1125 1125 === 0: a0
1126 1126 diff -r 000000000000 -r 49b5e81287e2 a
1127 1127 --- /dev/null
1128 1128 +++ b/a
1129 1129 @@ -0,0 +1,1 @@
1130 1130 +0
1131 1131
1132 1132 $ hg log -pr . a
1133 1133 === 3: a3
1134 1134 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1135 1135 --- a/a
1136 1136 +++ b/a
1137 1137 @@ -1,2 +1,3 @@
1138 1138 0
1139 1139 1
1140 1140 +3
1141 1141
1142 1142
1143 1143 fctx.introrev() == 2, but fctx.linkrev() == 1
1144 1144
1145 1145 $ hg up -q 2
1146 1146 $ hg log -pf a
1147 1147 === 2: a1 with b
1148 1148 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1149 1149 --- a/a
1150 1150 +++ b/a
1151 1151 @@ -1,1 +1,2 @@
1152 1152 0
1153 1153 +1
1154 1154
1155 1155 === 0: a0
1156 1156 diff -r 000000000000 -r 49b5e81287e2 a
1157 1157 --- /dev/null
1158 1158 +++ b/a
1159 1159 @@ -0,0 +1,1 @@
1160 1160 +0
1161 1161
1162 1162
1163 1163 BROKEN: should show the same diff as for rev 2 above
1164 1164 $ hg log -pr . a
1165 1165
1166 1166 $ cd ..
1167 1167
1168 1168 Multiple copy sources of a file:
1169 1169
1170 1170 $ hg init follow-multi
1171 1171 $ cd follow-multi
1172 1172 $ echo 0 >> a
1173 1173 $ hg ci -qAm 'a'
1174 1174 $ hg cp a b
1175 1175 $ hg ci -m 'a->b'
1176 1176 $ echo 2 >> a
1177 1177 $ hg ci -m 'a'
1178 1178 $ echo 3 >> b
1179 1179 $ hg ci -m 'b'
1180 1180 $ echo 4 >> a
1181 1181 $ echo 4 >> b
1182 1182 $ hg ci -m 'a,b'
1183 1183 $ echo 5 >> a
1184 1184 $ hg ci -m 'a0'
1185 1185 $ echo 6 >> b
1186 1186 $ hg ci -m 'b0'
1187 1187 $ hg up -q 4
1188 1188 $ echo 7 >> b
1189 1189 $ hg ci -m 'b1'
1190 1190 created new head
1191 1191 $ echo 8 >> a
1192 1192 $ hg ci -m 'a1'
1193 1193 $ hg rm a
1194 1194 $ hg mv b a
1195 1195 $ hg ci -m 'b1->a1'
1196 1196 $ hg merge -qt :local
1197 1197 $ hg ci -m '(a0,b1->a1)->a'
1198 1198
1199 1199 $ hg log -GT '{rev}: {desc}\n'
1200 1200 @ 10: (a0,b1->a1)->a
1201 1201 |\
1202 1202 | o 9: b1->a1
1203 1203 | |
1204 1204 | o 8: a1
1205 1205 | |
1206 1206 | o 7: b1
1207 1207 | |
1208 1208 o | 6: b0
1209 1209 | |
1210 1210 o | 5: a0
1211 1211 |/
1212 1212 o 4: a,b
1213 1213 |
1214 1214 o 3: b
1215 1215 |
1216 1216 o 2: a
1217 1217 |
1218 1218 o 1: a->b
1219 1219 |
1220 1220 o 0: a
1221 1221
1222 1222
1223 1223 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1224 1224 be indexed solely by fctx.linkrev().
1225 1225
1226 1226 $ hg log -T '{rev}: {desc}\n' -f a
1227 1227 10: (a0,b1->a1)->a
1228 1228 9: b1->a1
1229 1229 7: b1
1230 1230 5: a0
1231 1231 4: a,b
1232 1232 3: b
1233 1233 2: a
1234 1234 1: a->b
1235 1235 0: a
1236 1236
1237 1237 $ cd ..
1238 1238
1239 1239 Test that log should respect the order of -rREV even if multiple OR conditions
1240 1240 are specified (issue5100):
1241 1241
1242 1242 $ hg init revorder
1243 1243 $ cd revorder
1244 1244
1245 1245 $ hg branch -q b0
1246 1246 $ echo 0 >> f0
1247 1247 $ hg ci -qAm k0 -u u0
1248 1248 $ hg branch -q b1
1249 1249 $ echo 1 >> f1
1250 1250 $ hg ci -qAm k1 -u u1
1251 1251 $ hg branch -q b2
1252 1252 $ echo 2 >> f2
1253 1253 $ hg ci -qAm k2 -u u2
1254 1254
1255 1255 $ hg update -q b2
1256 1256 $ echo 3 >> f2
1257 1257 $ hg ci -qAm k2 -u u2
1258 1258 $ hg update -q b1
1259 1259 $ echo 4 >> f1
1260 1260 $ hg ci -qAm k1 -u u1
1261 1261 $ hg update -q b0
1262 1262 $ echo 5 >> f0
1263 1263 $ hg ci -qAm k0 -u u0
1264 1264
1265 1265 summary of revisions:
1266 1266
1267 1267 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1268 1268 @ 5 b0 u0 k0 f0
1269 1269 |
1270 1270 | o 4 b1 u1 k1 f1
1271 1271 | |
1272 1272 | | o 3 b2 u2 k2 f2
1273 1273 | | |
1274 1274 | | o 2 b2 u2 k2 f2
1275 1275 | |/
1276 1276 | o 1 b1 u1 k1 f1
1277 1277 |/
1278 1278 o 0 b0 u0 k0 f0
1279 1279
1280 1280
1281 1281 log -b BRANCH in ascending order:
1282 1282
1283 1283 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1284 1284 0 b0
1285 1285 1 b1
1286 1286 4 b1
1287 1287 5 b0
1288 1288 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1289 1289 0 b0
1290 1290 1 b1
1291 1291 4 b1
1292 1292 5 b0
1293 1293
1294 1294 log --only-branch BRANCH in descending order:
1295 1295
1296 1296 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1297 1297 4 b1
1298 1298 3 b2
1299 1299 2 b2
1300 1300 1 b1
1301 1301 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1302 1302 4 b1
1303 1303 3 b2
1304 1304 2 b2
1305 1305 1 b1
1306 1306
1307 1307 log -u USER in ascending order, against compound set:
1308 1308
1309 1309 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1310 1310 0 u0
1311 1311 2 u2
1312 1312 3 u2
1313 1313 5 u0
1314 1314 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1315 1315 0 u0
1316 1316 2 u2
1317 1317 3 u2
1318 1318 5 u0
1319 1319
1320 1320 log -k TEXT in descending order, against compound set:
1321 1321
1322 1322 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1323 1323 5 k0
1324 1324 3 k2
1325 1325 2 k2
1326 1326 1 k1
1327 1327 0 k0
1328 1328 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1329 1329 5 k0
1330 1330 3 k2
1331 1331 2 k2
1332 1332 1 k1
1333 1333 0 k0
1334 1334
1335 1335 log FILE in ascending order, against dagrange:
1336 1336
1337 1337 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1338 1338 1 f1
1339 1339 2 f2
1340 1340 3 f2
1341 1341 4 f1
1342 1342 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1343 1343 1 f1
1344 1344 2 f2
1345 1345 3 f2
1346 1346 4 f1
1347 1347
1348 1348 $ cd ..
1349 1349
1350 1350 User
1351 1351
1352 1352 $ hg init usertest
1353 1353 $ cd usertest
1354 1354
1355 1355 $ echo a > a
1356 1356 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1357 1357 adding a
1358 1358 $ echo b > b
1359 1359 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1360 1360 adding b
1361 1361
1362 1362 $ hg log -u "User One <user1@example.org>"
1363 1363 changeset: 0:29a4c94f1924
1364 1364 user: User One <user1@example.org>
1365 1365 date: Thu Jan 01 00:00:00 1970 +0000
1366 1366 summary: a
1367 1367
1368 1368 $ hg log -u "user1" -u "user2"
1369 1369 changeset: 1:e834b5e69c0e
1370 1370 tag: tip
1371 1371 user: User Two <user2@example.org>
1372 1372 date: Thu Jan 01 00:00:00 1970 +0000
1373 1373 summary: b
1374 1374
1375 1375 changeset: 0:29a4c94f1924
1376 1376 user: User One <user1@example.org>
1377 1377 date: Thu Jan 01 00:00:00 1970 +0000
1378 1378 summary: a
1379 1379
1380 1380 $ hg log -u "user3"
1381 1381
1382 1382 "-u USER" shouldn't be overridden by "user(USER)" alias
1383 1383
1384 1384 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1385 1385 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1386 1386 changeset: 0:29a4c94f1924
1387 1387 user: User One <user1@example.org>
1388 1388 date: Thu Jan 01 00:00:00 1970 +0000
1389 1389 summary: a
1390 1390
1391 1391
1392 1392 $ cd ..
1393 1393
1394 1394 $ hg init branches
1395 1395 $ cd branches
1396 1396
1397 1397 $ echo a > a
1398 1398 $ hg ci -A -m "commit on default"
1399 1399 adding a
1400 1400 $ hg branch test
1401 1401 marked working directory as branch test
1402 1402 (branches are permanent and global, did you want a bookmark?)
1403 1403 $ echo b > b
1404 1404 $ hg ci -A -m "commit on test"
1405 1405 adding b
1406 1406
1407 1407 $ hg up default
1408 1408 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1409 1409 $ echo c > c
1410 1410 $ hg ci -A -m "commit on default"
1411 1411 adding c
1412 1412 $ hg up test
1413 1413 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1414 1414 $ echo c > c
1415 1415 $ hg ci -A -m "commit on test"
1416 1416 adding c
1417 1417
1418 1418
1419 1419 log -b default
1420 1420
1421 1421 $ hg log -b default
1422 1422 changeset: 2:c3a4f03cc9a7
1423 1423 parent: 0:24427303d56f
1424 1424 user: test
1425 1425 date: Thu Jan 01 00:00:00 1970 +0000
1426 1426 summary: commit on default
1427 1427
1428 1428 changeset: 0:24427303d56f
1429 1429 user: test
1430 1430 date: Thu Jan 01 00:00:00 1970 +0000
1431 1431 summary: commit on default
1432 1432
1433 1433
1434 1434
1435 1435 log -b test
1436 1436
1437 1437 $ hg log -b test
1438 1438 changeset: 3:f5d8de11c2e2
1439 1439 branch: test
1440 1440 tag: tip
1441 1441 parent: 1:d32277701ccb
1442 1442 user: test
1443 1443 date: Thu Jan 01 00:00:00 1970 +0000
1444 1444 summary: commit on test
1445 1445
1446 1446 changeset: 1:d32277701ccb
1447 1447 branch: test
1448 1448 user: test
1449 1449 date: Thu Jan 01 00:00:00 1970 +0000
1450 1450 summary: commit on test
1451 1451
1452 1452
1453 1453
1454 1454 log -b dummy
1455 1455
1456 1456 $ hg log -b dummy
1457 1457 abort: unknown revision 'dummy'!
1458 1458 [255]
1459 1459
1460 1460
1461 1461 log -b .
1462 1462
1463 1463 $ hg log -b .
1464 1464 changeset: 3:f5d8de11c2e2
1465 1465 branch: test
1466 1466 tag: tip
1467 1467 parent: 1:d32277701ccb
1468 1468 user: test
1469 1469 date: Thu Jan 01 00:00:00 1970 +0000
1470 1470 summary: commit on test
1471 1471
1472 1472 changeset: 1:d32277701ccb
1473 1473 branch: test
1474 1474 user: test
1475 1475 date: Thu Jan 01 00:00:00 1970 +0000
1476 1476 summary: commit on test
1477 1477
1478 1478
1479 1479
1480 1480 log -b default -b test
1481 1481
1482 1482 $ hg log -b default -b test
1483 1483 changeset: 3:f5d8de11c2e2
1484 1484 branch: test
1485 1485 tag: tip
1486 1486 parent: 1:d32277701ccb
1487 1487 user: test
1488 1488 date: Thu Jan 01 00:00:00 1970 +0000
1489 1489 summary: commit on test
1490 1490
1491 1491 changeset: 2:c3a4f03cc9a7
1492 1492 parent: 0:24427303d56f
1493 1493 user: test
1494 1494 date: Thu Jan 01 00:00:00 1970 +0000
1495 1495 summary: commit on default
1496 1496
1497 1497 changeset: 1:d32277701ccb
1498 1498 branch: test
1499 1499 user: test
1500 1500 date: Thu Jan 01 00:00:00 1970 +0000
1501 1501 summary: commit on test
1502 1502
1503 1503 changeset: 0:24427303d56f
1504 1504 user: test
1505 1505 date: Thu Jan 01 00:00:00 1970 +0000
1506 1506 summary: commit on default
1507 1507
1508 1508
1509 1509
1510 1510 log -b default -b .
1511 1511
1512 1512 $ hg log -b default -b .
1513 1513 changeset: 3:f5d8de11c2e2
1514 1514 branch: test
1515 1515 tag: tip
1516 1516 parent: 1:d32277701ccb
1517 1517 user: test
1518 1518 date: Thu Jan 01 00:00:00 1970 +0000
1519 1519 summary: commit on test
1520 1520
1521 1521 changeset: 2:c3a4f03cc9a7
1522 1522 parent: 0:24427303d56f
1523 1523 user: test
1524 1524 date: Thu Jan 01 00:00:00 1970 +0000
1525 1525 summary: commit on default
1526 1526
1527 1527 changeset: 1:d32277701ccb
1528 1528 branch: test
1529 1529 user: test
1530 1530 date: Thu Jan 01 00:00:00 1970 +0000
1531 1531 summary: commit on test
1532 1532
1533 1533 changeset: 0:24427303d56f
1534 1534 user: test
1535 1535 date: Thu Jan 01 00:00:00 1970 +0000
1536 1536 summary: commit on default
1537 1537
1538 1538
1539 1539
1540 1540 log -b . -b test
1541 1541
1542 1542 $ hg log -b . -b test
1543 1543 changeset: 3:f5d8de11c2e2
1544 1544 branch: test
1545 1545 tag: tip
1546 1546 parent: 1:d32277701ccb
1547 1547 user: test
1548 1548 date: Thu Jan 01 00:00:00 1970 +0000
1549 1549 summary: commit on test
1550 1550
1551 1551 changeset: 1:d32277701ccb
1552 1552 branch: test
1553 1553 user: test
1554 1554 date: Thu Jan 01 00:00:00 1970 +0000
1555 1555 summary: commit on test
1556 1556
1557 1557
1558 1558
1559 1559 log -b 2
1560 1560
1561 1561 $ hg log -b 2
1562 1562 changeset: 2:c3a4f03cc9a7
1563 1563 parent: 0:24427303d56f
1564 1564 user: test
1565 1565 date: Thu Jan 01 00:00:00 1970 +0000
1566 1566 summary: commit on default
1567 1567
1568 1568 changeset: 0:24427303d56f
1569 1569 user: test
1570 1570 date: Thu Jan 01 00:00:00 1970 +0000
1571 1571 summary: commit on default
1572 1572
1573 1573 #if gettext
1574 1574
1575 1575 Test that all log names are translated (e.g. branches, bookmarks, tags):
1576 1576
1577 1577 $ hg bookmark babar -r tip
1578 1578
1579 1579 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1580 1580 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1581 1581 Zweig: test
1582 1582 Lesezeichen: babar
1583 1583 Marke: tip
1584 1584 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1585 1585 Nutzer: test
1586 1586 Datum: Thu Jan 01 00:00:00 1970 +0000
1587 1587 Zusammenfassung: commit on test
1588 1588
1589 1589 $ hg bookmark -d babar
1590 1590
1591 1591 #endif
1592 1592
1593 1593 log -p --cwd dir (in subdir)
1594 1594
1595 1595 $ mkdir dir
1596 1596 $ hg log -p --cwd dir
1597 1597 changeset: 3:f5d8de11c2e2
1598 1598 branch: test
1599 1599 tag: tip
1600 1600 parent: 1:d32277701ccb
1601 1601 user: test
1602 1602 date: Thu Jan 01 00:00:00 1970 +0000
1603 1603 summary: commit on test
1604 1604
1605 1605 diff -r d32277701ccb -r f5d8de11c2e2 c
1606 1606 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1607 1607 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1608 1608 @@ -0,0 +1,1 @@
1609 1609 +c
1610 1610
1611 1611 changeset: 2:c3a4f03cc9a7
1612 1612 parent: 0:24427303d56f
1613 1613 user: test
1614 1614 date: Thu Jan 01 00:00:00 1970 +0000
1615 1615 summary: commit on default
1616 1616
1617 1617 diff -r 24427303d56f -r c3a4f03cc9a7 c
1618 1618 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1619 1619 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1620 1620 @@ -0,0 +1,1 @@
1621 1621 +c
1622 1622
1623 1623 changeset: 1:d32277701ccb
1624 1624 branch: test
1625 1625 user: test
1626 1626 date: Thu Jan 01 00:00:00 1970 +0000
1627 1627 summary: commit on test
1628 1628
1629 1629 diff -r 24427303d56f -r d32277701ccb b
1630 1630 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1631 1631 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1632 1632 @@ -0,0 +1,1 @@
1633 1633 +b
1634 1634
1635 1635 changeset: 0:24427303d56f
1636 1636 user: test
1637 1637 date: Thu Jan 01 00:00:00 1970 +0000
1638 1638 summary: commit on default
1639 1639
1640 1640 diff -r 000000000000 -r 24427303d56f a
1641 1641 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1642 1642 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1643 1643 @@ -0,0 +1,1 @@
1644 1644 +a
1645 1645
1646 1646
1647 1647
1648 1648 log -p -R repo
1649 1649
1650 1650 $ cd dir
1651 1651 $ hg log -p -R .. ../a
1652 1652 changeset: 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 diff -r 000000000000 -r 24427303d56f a
1658 1658 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1659 1659 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1660 1660 @@ -0,0 +1,1 @@
1661 1661 +a
1662 1662
1663 1663
1664 1664 $ cd ../..
1665 1665
1666 1666 $ hg init follow2
1667 1667 $ cd follow2
1668 1668
1669 1669 # Build the following history:
1670 1670 # tip - o - x - o - x - x
1671 1671 # \ /
1672 1672 # o - o - o - x
1673 1673 # \ /
1674 1674 # o
1675 1675 #
1676 1676 # Where "o" is a revision containing "foo" and
1677 1677 # "x" is a revision without "foo"
1678 1678
1679 1679 $ touch init
1680 1680 $ hg ci -A -m "init, unrelated"
1681 1681 adding init
1682 1682 $ echo 'foo' > init
1683 1683 $ hg ci -m "change, unrelated"
1684 1684 $ echo 'foo' > foo
1685 1685 $ hg ci -A -m "add unrelated old foo"
1686 1686 adding foo
1687 1687 $ hg rm foo
1688 1688 $ hg ci -m "delete foo, unrelated"
1689 1689 $ echo 'related' > foo
1690 1690 $ hg ci -A -m "add foo, related"
1691 1691 adding foo
1692 1692
1693 1693 $ hg up 0
1694 1694 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1695 1695 $ touch branch
1696 1696 $ hg ci -A -m "first branch, unrelated"
1697 1697 adding branch
1698 1698 created new head
1699 1699 $ touch foo
1700 1700 $ hg ci -A -m "create foo, related"
1701 1701 adding foo
1702 1702 $ echo 'change' > foo
1703 1703 $ hg ci -m "change foo, related"
1704 1704
1705 1705 $ hg up 6
1706 1706 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1707 1707 $ echo 'change foo in branch' > foo
1708 1708 $ hg ci -m "change foo in branch, related"
1709 1709 created new head
1710 1710 $ hg merge 7
1711 1711 merging foo
1712 1712 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1713 1713 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1714 1714 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1715 1715 [1]
1716 1716 $ echo 'merge 1' > foo
1717 1717 $ hg resolve -m foo
1718 1718 (no more unresolved files)
1719 1719 $ hg ci -m "First merge, related"
1720 1720
1721 1721 $ hg merge 4
1722 1722 merging foo
1723 1723 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1724 1724 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1725 1725 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1726 1726 [1]
1727 1727 $ echo 'merge 2' > foo
1728 1728 $ hg resolve -m foo
1729 1729 (no more unresolved files)
1730 1730 $ hg ci -m "Last merge, related"
1731 1731
1732 1732 $ hg log --graph
1733 1733 @ changeset: 10:4dae8563d2c5
1734 1734 |\ tag: tip
1735 1735 | | parent: 9:7b35701b003e
1736 1736 | | parent: 4:88176d361b69
1737 1737 | | user: test
1738 1738 | | date: Thu Jan 01 00:00:00 1970 +0000
1739 1739 | | summary: Last merge, related
1740 1740 | |
1741 1741 | o changeset: 9:7b35701b003e
1742 1742 | |\ parent: 8:e5416ad8a855
1743 1743 | | | parent: 7:87fe3144dcfa
1744 1744 | | | user: test
1745 1745 | | | date: Thu Jan 01 00:00:00 1970 +0000
1746 1746 | | | summary: First merge, related
1747 1747 | | |
1748 1748 | | o changeset: 8:e5416ad8a855
1749 1749 | | | parent: 6:dc6c325fe5ee
1750 1750 | | | user: test
1751 1751 | | | date: Thu Jan 01 00:00:00 1970 +0000
1752 1752 | | | summary: change foo in branch, related
1753 1753 | | |
1754 1754 | o | changeset: 7:87fe3144dcfa
1755 1755 | |/ user: test
1756 1756 | | date: Thu Jan 01 00:00:00 1970 +0000
1757 1757 | | summary: change foo, related
1758 1758 | |
1759 1759 | o changeset: 6:dc6c325fe5ee
1760 1760 | | user: test
1761 1761 | | date: Thu Jan 01 00:00:00 1970 +0000
1762 1762 | | summary: create foo, related
1763 1763 | |
1764 1764 | o changeset: 5:73db34516eb9
1765 1765 | | parent: 0:e87515fd044a
1766 1766 | | user: test
1767 1767 | | date: Thu Jan 01 00:00:00 1970 +0000
1768 1768 | | summary: first branch, unrelated
1769 1769 | |
1770 1770 o | changeset: 4:88176d361b69
1771 1771 | | user: test
1772 1772 | | date: Thu Jan 01 00:00:00 1970 +0000
1773 1773 | | summary: add foo, related
1774 1774 | |
1775 1775 o | changeset: 3:dd78ae4afb56
1776 1776 | | user: test
1777 1777 | | date: Thu Jan 01 00:00:00 1970 +0000
1778 1778 | | summary: delete foo, unrelated
1779 1779 | |
1780 1780 o | changeset: 2:c4c64aedf0f7
1781 1781 | | user: test
1782 1782 | | date: Thu Jan 01 00:00:00 1970 +0000
1783 1783 | | summary: add unrelated old foo
1784 1784 | |
1785 1785 o | changeset: 1:e5faa7440653
1786 1786 |/ user: test
1787 1787 | date: Thu Jan 01 00:00:00 1970 +0000
1788 1788 | summary: change, unrelated
1789 1789 |
1790 1790 o changeset: 0:e87515fd044a
1791 1791 user: test
1792 1792 date: Thu Jan 01 00:00:00 1970 +0000
1793 1793 summary: init, unrelated
1794 1794
1795 1795
1796 1796 $ hg --traceback log -f foo
1797 1797 changeset: 10:4dae8563d2c5
1798 1798 tag: tip
1799 1799 parent: 9:7b35701b003e
1800 1800 parent: 4:88176d361b69
1801 1801 user: test
1802 1802 date: Thu Jan 01 00:00:00 1970 +0000
1803 1803 summary: Last merge, related
1804 1804
1805 1805 changeset: 9:7b35701b003e
1806 1806 parent: 8:e5416ad8a855
1807 1807 parent: 7:87fe3144dcfa
1808 1808 user: test
1809 1809 date: Thu Jan 01 00:00:00 1970 +0000
1810 1810 summary: First merge, related
1811 1811
1812 1812 changeset: 8:e5416ad8a855
1813 1813 parent: 6:dc6c325fe5ee
1814 1814 user: test
1815 1815 date: Thu Jan 01 00:00:00 1970 +0000
1816 1816 summary: change foo in branch, related
1817 1817
1818 1818 changeset: 7:87fe3144dcfa
1819 1819 user: test
1820 1820 date: Thu Jan 01 00:00:00 1970 +0000
1821 1821 summary: change foo, related
1822 1822
1823 1823 changeset: 6:dc6c325fe5ee
1824 1824 user: test
1825 1825 date: Thu Jan 01 00:00:00 1970 +0000
1826 1826 summary: create foo, related
1827 1827
1828 1828 changeset: 4:88176d361b69
1829 1829 user: test
1830 1830 date: Thu Jan 01 00:00:00 1970 +0000
1831 1831 summary: add foo, related
1832 1832
1833 1833
1834 1834 Also check when maxrev < lastrevfilelog
1835 1835
1836 1836 $ hg --traceback log -f -r4 foo
1837 1837 changeset: 4:88176d361b69
1838 1838 user: test
1839 1839 date: Thu Jan 01 00:00:00 1970 +0000
1840 1840 summary: add foo, related
1841 1841
1842 1842 $ cd ..
1843 1843
1844 1844 Issue2383: hg log showing _less_ differences than hg diff
1845 1845
1846 1846 $ hg init issue2383
1847 1847 $ cd issue2383
1848 1848
1849 1849 Create a test repo:
1850 1850
1851 1851 $ echo a > a
1852 1852 $ hg ci -Am0
1853 1853 adding a
1854 1854 $ echo b > b
1855 1855 $ hg ci -Am1
1856 1856 adding b
1857 1857 $ hg co 0
1858 1858 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1859 1859 $ echo b > a
1860 1860 $ hg ci -m2
1861 1861 created new head
1862 1862
1863 1863 Merge:
1864 1864
1865 1865 $ hg merge
1866 1866 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1867 1867 (branch merge, don't forget to commit)
1868 1868
1869 1869 Make sure there's a file listed in the merge to trigger the bug:
1870 1870
1871 1871 $ echo c > a
1872 1872 $ hg ci -m3
1873 1873
1874 1874 Two files shown here in diff:
1875 1875
1876 1876 $ hg diff --rev 2:3
1877 1877 diff -r b09be438c43a -r 8e07aafe1edc a
1878 1878 --- a/a Thu Jan 01 00:00:00 1970 +0000
1879 1879 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1880 1880 @@ -1,1 +1,1 @@
1881 1881 -b
1882 1882 +c
1883 1883 diff -r b09be438c43a -r 8e07aafe1edc b
1884 1884 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1885 1885 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1886 1886 @@ -0,0 +1,1 @@
1887 1887 +b
1888 1888
1889 1889 Diff here should be the same:
1890 1890
1891 1891 $ hg log -vpr 3
1892 1892 changeset: 3:8e07aafe1edc
1893 1893 tag: tip
1894 1894 parent: 2:b09be438c43a
1895 1895 parent: 1:925d80f479bb
1896 1896 user: test
1897 1897 date: Thu Jan 01 00:00:00 1970 +0000
1898 1898 files: a
1899 1899 description:
1900 1900 3
1901 1901
1902 1902
1903 1903 diff -r b09be438c43a -r 8e07aafe1edc a
1904 1904 --- a/a Thu Jan 01 00:00:00 1970 +0000
1905 1905 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1906 1906 @@ -1,1 +1,1 @@
1907 1907 -b
1908 1908 +c
1909 1909 diff -r b09be438c43a -r 8e07aafe1edc b
1910 1910 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1911 1911 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1912 1912 @@ -0,0 +1,1 @@
1913 1913 +b
1914 1914
1915 1915 $ cd ..
1916 1916
1917 1917 'hg log -r rev fn' when last(filelog(fn)) != rev
1918 1918
1919 1919 $ hg init simplelog
1920 1920 $ cd simplelog
1921 1921 $ echo f > a
1922 1922 $ hg ci -Am'a' -d '0 0'
1923 1923 adding a
1924 1924 $ echo f >> a
1925 1925 $ hg ci -Am'a bis' -d '1 0'
1926 1926
1927 1927 $ hg log -r0 a
1928 1928 changeset: 0:9f758d63dcde
1929 1929 user: test
1930 1930 date: Thu Jan 01 00:00:00 1970 +0000
1931 1931 summary: a
1932 1932
1933 1933 enable obsolete to test hidden feature
1934 1934
1935 1935 $ cat >> $HGRCPATH << EOF
1936 1936 > [experimental]
1937 1937 > evolution.createmarkers=True
1938 1938 > EOF
1939 1939
1940 1940 $ hg log --template='{rev}:{node}\n'
1941 1941 1:a765632148dc55d38c35c4f247c618701886cb2f
1942 1942 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1943 1943 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1944 1944 1 new obsolescence markers
1945 1945 obsoleted 1 changesets
1946 1946 $ hg up null -q
1947 1947 $ hg log --template='{rev}:{node}\n'
1948 1948 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1949 1949 $ hg log --template='{rev}:{node}\n' --hidden
1950 1950 1:a765632148dc55d38c35c4f247c618701886cb2f
1951 1951 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1952 1952 $ hg log -r a
1953 1953 abort: hidden revision 'a' is pruned!
1954 1954 (use --hidden to access hidden revisions)
1955 1955 [255]
1956 1956
1957 1957 test that parent prevent a changeset to be hidden
1958 1958
1959 1959 $ hg up 1 -q --hidden
1960 1960 updated to hidden changeset a765632148dc
1961 1961 (hidden revision 'a765632148dc' is pruned)
1962 1962 $ hg log --template='{rev}:{node}\n'
1963 1963 1:a765632148dc55d38c35c4f247c618701886cb2f
1964 1964 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1965 1965
1966 1966 test that second parent prevent a changeset to be hidden too
1967 1967
1968 1968 $ hg debugsetparents 0 1 # nothing suitable to merge here
1969 1969 $ hg log --template='{rev}:{node}\n'
1970 1970 1:a765632148dc55d38c35c4f247c618701886cb2f
1971 1971 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1972 1972 $ hg debugsetparents 1
1973 1973 $ hg up -q null
1974 1974
1975 1975 bookmarks prevent a changeset being hidden
1976 1976
1977 1977 $ hg bookmark --hidden -r 1 X
1978 1978 bookmarking hidden changeset a765632148dc
1979 1979 (hidden revision 'a765632148dc' is pruned)
1980 1980 $ hg log --template '{rev}:{node}\n'
1981 1981 1:a765632148dc55d38c35c4f247c618701886cb2f
1982 1982 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1983 1983 $ hg bookmark -d X
1984 1984
1985 1985 divergent bookmarks are not hidden
1986 1986
1987 1987 $ hg bookmark --hidden -r 1 X@foo
1988 1988 bookmarking hidden changeset a765632148dc
1989 1989 (hidden revision 'a765632148dc' is pruned)
1990 1990 $ hg log --template '{rev}:{node}\n'
1991 1991 1:a765632148dc55d38c35c4f247c618701886cb2f
1992 1992 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1993 1993
1994 1994 test hidden revision 0 (issue5385)
1995 1995
1996 1996 $ hg bookmark -d X@foo
1997 1997 $ hg up null -q
1998 1998 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1999 1999 1 new obsolescence markers
2000 2000 obsoleted 1 changesets
2001 2001 $ echo f > b
2002 2002 $ hg ci -Am'b' -d '2 0'
2003 2003 adding b
2004 2004 $ echo f >> b
2005 2005 $ hg ci -m'b bis' -d '3 0'
2006 2006 $ hg log -T'{rev}:{node}\n'
2007 2007 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2008 2008 2:94375ec45bddd2a824535fc04855bd058c926ec0
2009 2009
2010 2010 $ hg log -T'{rev}:{node}\n' -r:
2011 2011 2:94375ec45bddd2a824535fc04855bd058c926ec0
2012 2012 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2013 2013 $ hg log -T'{rev}:{node}\n' -r:tip
2014 2014 2:94375ec45bddd2a824535fc04855bd058c926ec0
2015 2015 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2016 2016 $ hg log -T'{rev}:{node}\n' -r:0
2017 2017 abort: hidden revision '0' is pruned!
2018 2018 (use --hidden to access hidden revisions)
2019 2019 [255]
2020 2020 $ hg log -T'{rev}:{node}\n' -f
2021 2021 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2022 2022 2:94375ec45bddd2a824535fc04855bd058c926ec0
2023 2023
2024 2024 clear extensions configuration
2025 2025 $ echo '[extensions]' >> $HGRCPATH
2026 2026 $ echo "obs=!" >> $HGRCPATH
2027 2027 $ cd ..
2028 2028
2029 2029 test -u/-k for problematic encoding
2030 2030 # unicode: cp932:
2031 2031 # u30A2 0x83 0x41(= 'A')
2032 2032 # u30C2 0x83 0x61(= 'a')
2033 2033
2034 2034 $ hg init problematicencoding
2035 2035 $ cd problematicencoding
2036 2036
2037 2037 >>> with open('setup.sh', 'wb') as f:
2038 2038 ... f.write(u'''
2039 2039 ... echo a > text
2040 2040 ... hg add text
2041 2041 ... hg --encoding utf-8 commit -u '\u30A2' -m none
2042 2042 ... echo b > text
2043 2043 ... hg --encoding utf-8 commit -u '\u30C2' -m none
2044 2044 ... echo c > text
2045 2045 ... hg --encoding utf-8 commit -u none -m '\u30A2'
2046 2046 ... echo d > text
2047 2047 ... hg --encoding utf-8 commit -u none -m '\u30C2'
2048 2048 ... '''.encode('utf-8')) and None
2049 2049 $ sh < setup.sh
2050 2050
2051 2051 test in problematic encoding
2052 2052 >>> with open('test.sh', 'wb') as f:
2053 2053 ... f.write(u'''
2054 2054 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2055 2055 ... echo ====
2056 2056 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2057 2057 ... echo ====
2058 2058 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2059 2059 ... echo ====
2060 2060 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2061 2061 ... '''.encode('cp932')) and None
2062 2062 $ sh < test.sh
2063 2063 0
2064 2064 ====
2065 2065 1
2066 2066 ====
2067 2067 2
2068 2068 0
2069 2069 ====
2070 2070 3
2071 2071 1
2072 2072
2073 2073 $ cd ..
2074 2074
2075 2075 test hg log on non-existent files and on directories
2076 2076 $ hg init issue1340
2077 2077 $ cd issue1340
2078 2078 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2079 2079 $ echo 1 > d1/f1
2080 2080 $ echo 1 > D2/f1
2081 2081 $ echo 1 > D3.i/f1
2082 2082 $ echo 1 > d4.hg/f1
2083 2083 $ echo 1 > d5.d/f1
2084 2084 $ echo 1 > .d6/f1
2085 2085 $ hg -q add .
2086 2086 $ hg commit -m "a bunch of weird directories"
2087 2087 $ hg log -l1 d1/f1 | grep changeset
2088 2088 changeset: 0:65624cd9070a
2089 2089 $ hg log -l1 f1
2090 2090 $ hg log -l1 . | grep changeset
2091 2091 changeset: 0:65624cd9070a
2092 2092 $ hg log -l1 ./ | grep changeset
2093 2093 changeset: 0:65624cd9070a
2094 2094 $ hg log -l1 d1 | grep changeset
2095 2095 changeset: 0:65624cd9070a
2096 2096 $ hg log -l1 D2 | grep changeset
2097 2097 changeset: 0:65624cd9070a
2098 2098 $ hg log -l1 D2/f1 | grep changeset
2099 2099 changeset: 0:65624cd9070a
2100 2100 $ hg log -l1 D3.i | grep changeset
2101 2101 changeset: 0:65624cd9070a
2102 2102 $ hg log -l1 D3.i/f1 | grep changeset
2103 2103 changeset: 0:65624cd9070a
2104 2104 $ hg log -l1 d4.hg | grep changeset
2105 2105 changeset: 0:65624cd9070a
2106 2106 $ hg log -l1 d4.hg/f1 | grep changeset
2107 2107 changeset: 0:65624cd9070a
2108 2108 $ hg log -l1 d5.d | grep changeset
2109 2109 changeset: 0:65624cd9070a
2110 2110 $ hg log -l1 d5.d/f1 | grep changeset
2111 2111 changeset: 0:65624cd9070a
2112 2112 $ hg log -l1 .d6 | grep changeset
2113 2113 changeset: 0:65624cd9070a
2114 2114 $ hg log -l1 .d6/f1 | grep changeset
2115 2115 changeset: 0:65624cd9070a
2116 2116
2117 2117 issue3772: hg log -r :null showing revision 0 as well
2118 2118
2119 2119 $ hg log -r :null
2120 2120 changeset: 0:65624cd9070a
2121 2121 tag: tip
2122 2122 user: test
2123 2123 date: Thu Jan 01 00:00:00 1970 +0000
2124 2124 summary: a bunch of weird directories
2125 2125
2126 2126 changeset: -1:000000000000
2127 2127 user:
2128 2128 date: Thu Jan 01 00:00:00 1970 +0000
2129 2129
2130 2130 $ hg log -r null:null
2131 2131 changeset: -1:000000000000
2132 2132 user:
2133 2133 date: Thu Jan 01 00:00:00 1970 +0000
2134 2134
2135 2135 working-directory revision requires special treatment
2136 2136
2137 2137 clean:
2138 2138
2139 2139 $ hg log -r 'wdir()' --debug
2140 2140 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2141 2141 phase: draft
2142 2142 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2143 2143 parent: -1:0000000000000000000000000000000000000000
2144 2144 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2145 2145 user: test
2146 2146 date: [A-Za-z0-9:+ ]+ (re)
2147 2147 extra: branch=default
2148 2148
2149 2149 $ hg log -r 'wdir()' -p --stat
2150 2150 changeset: 2147483647:ffffffffffff
2151 2151 parent: 0:65624cd9070a
2152 2152 user: test
2153 2153 date: [A-Za-z0-9:+ ]+ (re)
2154 2154
2155 2155
2156 2156
2157 2157
2158 2158 dirty:
2159 2159
2160 2160 $ echo 2 >> d1/f1
2161 2161 $ echo 2 > d1/f2
2162 2162 $ hg add d1/f2
2163 2163 $ hg remove .d6/f1
2164 2164 $ hg status
2165 2165 M d1/f1
2166 2166 A d1/f2
2167 2167 R .d6/f1
2168 2168
2169 2169 $ hg log -r 'wdir()'
2170 2170 changeset: 2147483647:ffffffffffff
2171 2171 parent: 0:65624cd9070a
2172 2172 user: test
2173 2173 date: [A-Za-z0-9:+ ]+ (re)
2174 2174
2175 2175 $ hg log -r 'wdir()' -q
2176 2176 2147483647:ffffffffffff
2177 2177
2178 2178 $ hg log -r 'wdir()' --debug
2179 2179 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2180 2180 phase: draft
2181 2181 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2182 2182 parent: -1:0000000000000000000000000000000000000000
2183 2183 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2184 2184 user: test
2185 2185 date: [A-Za-z0-9:+ ]+ (re)
2186 2186 files: d1/f1
2187 2187 files+: d1/f2
2188 2188 files-: .d6/f1
2189 2189 extra: branch=default
2190 2190
2191 2191 $ hg log -r 'wdir()' -p --stat --git
2192 2192 changeset: 2147483647:ffffffffffff
2193 2193 parent: 0:65624cd9070a
2194 2194 user: test
2195 2195 date: [A-Za-z0-9:+ ]+ (re)
2196 2196
2197 2197 .d6/f1 | 1 -
2198 2198 d1/f1 | 1 +
2199 2199 d1/f2 | 1 +
2200 2200 3 files changed, 2 insertions(+), 1 deletions(-)
2201 2201
2202 2202 diff --git a/.d6/f1 b/.d6/f1
2203 2203 deleted file mode 100644
2204 2204 --- a/.d6/f1
2205 2205 +++ /dev/null
2206 2206 @@ -1,1 +0,0 @@
2207 2207 -1
2208 2208 diff --git a/d1/f1 b/d1/f1
2209 2209 --- a/d1/f1
2210 2210 +++ b/d1/f1
2211 2211 @@ -1,1 +1,2 @@
2212 2212 1
2213 2213 +2
2214 2214 diff --git a/d1/f2 b/d1/f2
2215 2215 new file mode 100644
2216 2216 --- /dev/null
2217 2217 +++ b/d1/f2
2218 2218 @@ -0,0 +1,1 @@
2219 2219 +2
2220 2220
2221 2221 $ hg log -r 'wdir()' -Tjson
2222 2222 [
2223 2223 {
2224 2224 "bookmarks": [],
2225 2225 "branch": "default",
2226 2226 "date": [*, 0], (glob)
2227 2227 "desc": "",
2228 2228 "node": "ffffffffffffffffffffffffffffffffffffffff",
2229 2229 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2230 2230 "phase": "draft",
2231 2231 "rev": 2147483647,
2232 2232 "tags": [],
2233 2233 "user": "test"
2234 2234 }
2235 2235 ]
2236 2236
2237 2237 $ hg log -r 'wdir()' -Tjson -q
2238 2238 [
2239 2239 {
2240 2240 "node": "ffffffffffffffffffffffffffffffffffffffff",
2241 2241 "rev": 2147483647
2242 2242 }
2243 2243 ]
2244 2244
2245 2245 $ hg log -r 'wdir()' -Tjson --debug
2246 2246 [
2247 2247 {
2248 2248 "added": ["d1/f2"],
2249 2249 "bookmarks": [],
2250 2250 "branch": "default",
2251 2251 "date": [*, 0], (glob)
2252 2252 "desc": "",
2253 2253 "extra": {"branch": "default"},
2254 2254 "manifest": "ffffffffffffffffffffffffffffffffffffffff",
2255 2255 "modified": ["d1/f1"],
2256 2256 "node": "ffffffffffffffffffffffffffffffffffffffff",
2257 2257 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2258 2258 "phase": "draft",
2259 2259 "removed": [".d6/f1"],
2260 2260 "rev": 2147483647,
2261 2261 "tags": [],
2262 2262 "user": "test"
2263 2263 }
2264 2264 ]
2265 2265
2266 2266 follow files from wdir
2267 2267
2268 2268 $ hg cp d1/f1 f1-copy
2269 2269 $ hg stat --all
2270 2270 M d1/f1
2271 2271 A d1/f2
2272 2272 A f1-copy
2273 2273 d1/f1
2274 2274 R .d6/f1
2275 2275 C D2/f1
2276 2276 C D3.i/f1
2277 2277 C d4.hg/f1
2278 2278 C d5.d/f1
2279 2279
2280 2280 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d5.d/f1
2281 2281 == 2147483647 ==
2282 2282
2283 2283 == 0 ==
2284 2284 d5.d/f1 | 1 +
2285 2285 1 files changed, 1 insertions(+), 0 deletions(-)
2286 2286
2287 2287
2288 2288 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f1
2289 2289 == 2147483647 ==
2290 2290 d1/f1 | 1 +
2291 2291 1 files changed, 1 insertions(+), 0 deletions(-)
2292 2292
2293 2293 == 0 ==
2294 2294 d1/f1 | 1 +
2295 2295 1 files changed, 1 insertions(+), 0 deletions(-)
2296 2296
2297 2297
2298 BROKEN: added file should exist in wdir
2299 2298 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f2
2300 abort: cannot follow nonexistent file: "d1/f2"
2301 [255]
2302
2303 BROKEN: copied file should exist in wdir
2299 == 2147483647 ==
2300 d1/f2 | 1 +
2301 1 files changed, 1 insertions(+), 0 deletions(-)
2302
2303
2304 2304 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat f1-copy
2305 abort: cannot follow nonexistent file: "f1-copy"
2306 [255]
2305 == 2147483647 ==
2306 f1-copy | 1 +
2307 1 files changed, 1 insertions(+), 0 deletions(-)
2308
2309 == 0 ==
2310 d1/f1 | 1 +
2311 1 files changed, 1 insertions(+), 0 deletions(-)
2312
2307 2313
2308 2314 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound
2309 2315 notfound: $ENOENT$
2310 2316
2311 2317 follow added/removed files from wdir parent
2312 2318
2313 2319 $ hg log -T '{rev}\n' -f d1/f2
2314 2320 abort: cannot follow nonexistent file: "d1/f2"
2315 2321 [255]
2316 2322
2317 2323 $ hg log -T '{rev}\n' -f f1-copy
2318 2324 abort: cannot follow nonexistent file: "f1-copy"
2319 2325 [255]
2320 2326
2321 2327 $ hg log -T '{rev}\n' -f .d6/f1
2322 2328 abort: cannot follow file not in parent revision: ".d6/f1"
2323 2329 [255]
2324 2330
2325 2331 $ hg revert -aqC
2326 2332
2327 2333 Check that adding an arbitrary name shows up in log automatically
2328 2334
2329 2335 $ cat > ../names.py <<EOF
2330 2336 > """A small extension to test adding arbitrary names to a repo"""
2331 2337 > from __future__ import absolute_import
2332 2338 > from mercurial import namespaces
2333 2339 >
2334 2340 > def reposetup(ui, repo):
2335 2341 > if not repo.local():
2336 2342 > return
2337 2343 > foo = {b'foo': repo[0].node()}
2338 2344 > names = lambda r: foo.keys()
2339 2345 > namemap = lambda r, name: foo.get(name)
2340 2346 > nodemap = lambda r, node: [name for name, n in foo.items()
2341 2347 > if n == node]
2342 2348 > ns = namespaces.namespace(
2343 2349 > b"bars", templatename=b"bar", logname=b"barlog",
2344 2350 > colorname=b"barcolor", listnames=names, namemap=namemap,
2345 2351 > nodemap=nodemap)
2346 2352 >
2347 2353 > repo.names.addnamespace(ns)
2348 2354 > EOF
2349 2355
2350 2356 $ hg --config extensions.names=../names.py log -r 0
2351 2357 changeset: 0:65624cd9070a
2352 2358 tag: tip
2353 2359 barlog: foo
2354 2360 user: test
2355 2361 date: Thu Jan 01 00:00:00 1970 +0000
2356 2362 summary: a bunch of weird directories
2357 2363
2358 2364 $ hg --config extensions.names=../names.py \
2359 2365 > --config extensions.color= --config color.log.barcolor=red \
2360 2366 > --color=always log -r 0
2361 2367 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2362 2368 tag: tip
2363 2369 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2364 2370 user: test
2365 2371 date: Thu Jan 01 00:00:00 1970 +0000
2366 2372 summary: a bunch of weird directories
2367 2373
2368 2374 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2369 2375 foo
2370 2376
2371 2377 Templater parse errors:
2372 2378
2373 2379 simple error
2374 2380 $ hg log -r . -T '{shortest(node}'
2375 2381 hg: parse error at 14: unexpected token: end
2376 2382 ({shortest(node}
2377 2383 ^ here)
2378 2384 [255]
2379 2385
2380 2386 multi-line template with error
2381 2387 $ hg log -r . -T 'line 1
2382 2388 > line2
2383 2389 > {shortest(node}
2384 2390 > line4\nline5'
2385 2391 hg: parse error at 27: unexpected token: end
2386 2392 (line 1\nline2\n{shortest(node}\nline4\nline5
2387 2393 ^ here)
2388 2394 [255]
2389 2395
2390 2396 $ cd ..
2391 2397
2392 2398 New namespace is registered per repo instance, but the template keyword
2393 2399 is global. So we shouldn't expect the namespace always exists. Using
2394 2400 ssh:// makes sure a bundle repository is created from scratch. (issue6301)
2395 2401
2396 2402 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
2397 2403 > -qr0 "ssh://user@dummy/`pwd`/a" a-clone
2398 2404 $ hg incoming --config extensions.names=names.py -R a-clone \
2399 2405 > -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -T '{bars}\n' -l1
2400 2406 comparing with ssh://user@dummy/$TESTTMP/a
2401 2407 searching for changes
2402 2408
2403 2409
2404 2410 hg log -f dir across branches
2405 2411
2406 2412 $ hg init acrossbranches
2407 2413 $ cd acrossbranches
2408 2414 $ mkdir d
2409 2415 $ echo a > d/a && hg ci -Aqm a
2410 2416 $ echo b > d/a && hg ci -Aqm b
2411 2417 $ hg up -q 0
2412 2418 $ echo b > d/a && hg ci -Aqm c
2413 2419 $ hg log -f d -T '{desc}' -G
2414 2420 @ c
2415 2421 |
2416 2422 o a
2417 2423
2418 2424 Ensure that largefiles doesn't interfere with following a normal file
2419 2425 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2420 2426 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2421 2427 @ c
2422 2428 |
2423 2429 o a
2424 2430
2425 2431 $ hg log -f d/a -T '{desc}' -G
2426 2432 @ c
2427 2433 |
2428 2434 o a
2429 2435
2430 2436 $ cd ..
2431 2437
2432 2438 hg log -f with linkrev pointing to another branch
2433 2439 -------------------------------------------------
2434 2440
2435 2441 create history with a filerev whose linkrev points to another branch
2436 2442
2437 2443 $ hg init branchedlinkrev
2438 2444 $ cd branchedlinkrev
2439 2445 $ echo 1 > a
2440 2446 $ hg commit -Am 'content1'
2441 2447 adding a
2442 2448 $ echo 2 > a
2443 2449 $ hg commit -m 'content2'
2444 2450 $ hg up --rev 'desc(content1)'
2445 2451 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2446 2452 $ echo unrelated > unrelated
2447 2453 $ hg commit -Am 'unrelated'
2448 2454 adding unrelated
2449 2455 created new head
2450 2456 $ hg graft -r 'desc(content2)'
2451 2457 grafting 1:2294ae80ad84 "content2"
2452 2458 $ echo 3 > a
2453 2459 $ hg commit -m 'content3'
2454 2460 $ hg log -G
2455 2461 @ changeset: 4:50b9b36e9c5d
2456 2462 | tag: tip
2457 2463 | user: test
2458 2464 | date: Thu Jan 01 00:00:00 1970 +0000
2459 2465 | summary: content3
2460 2466 |
2461 2467 o changeset: 3:15b2327059e5
2462 2468 | user: test
2463 2469 | date: Thu Jan 01 00:00:00 1970 +0000
2464 2470 | summary: content2
2465 2471 |
2466 2472 o changeset: 2:2029acd1168c
2467 2473 | parent: 0:ae0a3c9f9e95
2468 2474 | user: test
2469 2475 | date: Thu Jan 01 00:00:00 1970 +0000
2470 2476 | summary: unrelated
2471 2477 |
2472 2478 | o changeset: 1:2294ae80ad84
2473 2479 |/ user: test
2474 2480 | date: Thu Jan 01 00:00:00 1970 +0000
2475 2481 | summary: content2
2476 2482 |
2477 2483 o changeset: 0:ae0a3c9f9e95
2478 2484 user: test
2479 2485 date: Thu Jan 01 00:00:00 1970 +0000
2480 2486 summary: content1
2481 2487
2482 2488
2483 2489 log -f on the file should list the graft result.
2484 2490
2485 2491 $ hg log -Gf a
2486 2492 @ changeset: 4:50b9b36e9c5d
2487 2493 | tag: tip
2488 2494 | user: test
2489 2495 | date: Thu Jan 01 00:00:00 1970 +0000
2490 2496 | summary: content3
2491 2497 |
2492 2498 o changeset: 3:15b2327059e5
2493 2499 : user: test
2494 2500 : date: Thu Jan 01 00:00:00 1970 +0000
2495 2501 : summary: content2
2496 2502 :
2497 2503 o changeset: 0:ae0a3c9f9e95
2498 2504 user: test
2499 2505 date: Thu Jan 01 00:00:00 1970 +0000
2500 2506 summary: content1
2501 2507
2502 2508
2503 2509 plain log lists the original version
2504 2510 (XXX we should probably list both)
2505 2511
2506 2512 $ hg log -G a
2507 2513 @ changeset: 4:50b9b36e9c5d
2508 2514 : tag: tip
2509 2515 : user: test
2510 2516 : date: Thu Jan 01 00:00:00 1970 +0000
2511 2517 : summary: content3
2512 2518 :
2513 2519 : o changeset: 1:2294ae80ad84
2514 2520 :/ user: test
2515 2521 : date: Thu Jan 01 00:00:00 1970 +0000
2516 2522 : summary: content2
2517 2523 :
2518 2524 o changeset: 0:ae0a3c9f9e95
2519 2525 user: test
2520 2526 date: Thu Jan 01 00:00:00 1970 +0000
2521 2527 summary: content1
2522 2528
2523 2529
2524 2530 hg log -f from the grafted changeset
2525 2531 (The bootstrap should properly take the topology in account)
2526 2532
2527 2533 $ hg up 'desc(content3)^'
2528 2534 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2529 2535 $ hg log -Gf a
2530 2536 @ changeset: 3:15b2327059e5
2531 2537 : user: test
2532 2538 : date: Thu Jan 01 00:00:00 1970 +0000
2533 2539 : summary: content2
2534 2540 :
2535 2541 o changeset: 0:ae0a3c9f9e95
2536 2542 user: test
2537 2543 date: Thu Jan 01 00:00:00 1970 +0000
2538 2544 summary: content1
2539 2545
2540 2546
2541 2547 Test that we use the first non-hidden changeset in that case.
2542 2548
2543 2549 (hide the changeset)
2544 2550
2545 2551 $ hg log -T '{node}\n' -r 1
2546 2552 2294ae80ad8447bc78383182eeac50cb049df623
2547 2553 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2548 2554 1 new obsolescence markers
2549 2555 obsoleted 1 changesets
2550 2556 $ hg log -G
2551 2557 o changeset: 4:50b9b36e9c5d
2552 2558 | tag: tip
2553 2559 | user: test
2554 2560 | date: Thu Jan 01 00:00:00 1970 +0000
2555 2561 | summary: content3
2556 2562 |
2557 2563 @ changeset: 3:15b2327059e5
2558 2564 | user: test
2559 2565 | date: Thu Jan 01 00:00:00 1970 +0000
2560 2566 | summary: content2
2561 2567 |
2562 2568 o changeset: 2:2029acd1168c
2563 2569 | parent: 0:ae0a3c9f9e95
2564 2570 | user: test
2565 2571 | date: Thu Jan 01 00:00:00 1970 +0000
2566 2572 | summary: unrelated
2567 2573 |
2568 2574 o changeset: 0:ae0a3c9f9e95
2569 2575 user: test
2570 2576 date: Thu Jan 01 00:00:00 1970 +0000
2571 2577 summary: content1
2572 2578
2573 2579
2574 2580 Check that log on the file does not drop the file revision.
2575 2581
2576 2582 $ hg log -G a
2577 2583 o changeset: 4:50b9b36e9c5d
2578 2584 | tag: tip
2579 2585 | user: test
2580 2586 | date: Thu Jan 01 00:00:00 1970 +0000
2581 2587 | summary: content3
2582 2588 |
2583 2589 @ changeset: 3:15b2327059e5
2584 2590 : user: test
2585 2591 : date: Thu Jan 01 00:00:00 1970 +0000
2586 2592 : summary: content2
2587 2593 :
2588 2594 o changeset: 0:ae0a3c9f9e95
2589 2595 user: test
2590 2596 date: Thu Jan 01 00:00:00 1970 +0000
2591 2597 summary: content1
2592 2598
2593 2599
2594 2600 Even when a head revision is linkrev-shadowed.
2595 2601
2596 2602 $ hg log -T '{node}\n' -r 4
2597 2603 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2598 2604 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2599 2605 1 new obsolescence markers
2600 2606 obsoleted 1 changesets
2601 2607 $ hg log -G a
2602 2608 @ changeset: 3:15b2327059e5
2603 2609 : tag: tip
2604 2610 : user: test
2605 2611 : date: Thu Jan 01 00:00:00 1970 +0000
2606 2612 : summary: content2
2607 2613 :
2608 2614 o changeset: 0:ae0a3c9f9e95
2609 2615 user: test
2610 2616 date: Thu Jan 01 00:00:00 1970 +0000
2611 2617 summary: content1
2612 2618
2613 2619
2614 2620 $ cd ..
2615 2621
2616 2622 Even when the file revision is missing from some head:
2617 2623
2618 2624 $ hg init issue4490
2619 2625 $ cd issue4490
2620 2626 $ echo '[experimental]' >> .hg/hgrc
2621 2627 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2622 2628 $ echo a > a
2623 2629 $ hg ci -Am0
2624 2630 adding a
2625 2631 $ echo b > b
2626 2632 $ hg ci -Am1
2627 2633 adding b
2628 2634 $ echo B > b
2629 2635 $ hg ci --amend -m 1
2630 2636 $ hg up 0
2631 2637 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2632 2638 $ echo c > c
2633 2639 $ hg ci -Am2
2634 2640 adding c
2635 2641 created new head
2636 2642 $ hg up 'head() and not .'
2637 2643 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2638 2644 $ hg log -G
2639 2645 o changeset: 3:db815d6d32e6
2640 2646 | tag: tip
2641 2647 | parent: 0:f7b1eb17ad24
2642 2648 | user: test
2643 2649 | date: Thu Jan 01 00:00:00 1970 +0000
2644 2650 | summary: 2
2645 2651 |
2646 2652 | @ changeset: 2:9bc8ce7f9356
2647 2653 |/ parent: 0:f7b1eb17ad24
2648 2654 | user: test
2649 2655 | date: Thu Jan 01 00:00:00 1970 +0000
2650 2656 | summary: 1
2651 2657 |
2652 2658 o changeset: 0:f7b1eb17ad24
2653 2659 user: test
2654 2660 date: Thu Jan 01 00:00:00 1970 +0000
2655 2661 summary: 0
2656 2662
2657 2663 $ hg log -f -G b
2658 2664 @ changeset: 2:9bc8ce7f9356
2659 2665 | parent: 0:f7b1eb17ad24
2660 2666 ~ user: test
2661 2667 date: Thu Jan 01 00:00:00 1970 +0000
2662 2668 summary: 1
2663 2669
2664 2670 $ hg log -G b
2665 2671 @ changeset: 2:9bc8ce7f9356
2666 2672 | parent: 0:f7b1eb17ad24
2667 2673 ~ user: test
2668 2674 date: Thu Jan 01 00:00:00 1970 +0000
2669 2675 summary: 1
2670 2676
2671 2677 $ cd ..
2672 2678
2673 2679 Check proper report when the manifest changes but not the file issue4499
2674 2680 ------------------------------------------------------------------------
2675 2681
2676 2682 $ hg init issue4499
2677 2683 $ cd issue4499
2678 2684 $ 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
2679 2685 > echo 1 > $f;
2680 2686 > hg add $f;
2681 2687 > done
2682 2688 $ hg commit -m 'A1B1C1'
2683 2689 $ echo 2 > A
2684 2690 $ echo 2 > B
2685 2691 $ echo 2 > C
2686 2692 $ hg commit -m 'A2B2C2'
2687 2693 $ hg up 0
2688 2694 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2689 2695 $ echo 3 > A
2690 2696 $ echo 2 > B
2691 2697 $ echo 2 > C
2692 2698 $ hg commit -m 'A3B2C2'
2693 2699 created new head
2694 2700
2695 2701 $ hg log -G
2696 2702 @ changeset: 2:fe5fc3d0eb17
2697 2703 | tag: tip
2698 2704 | parent: 0:abf4f0e38563
2699 2705 | user: test
2700 2706 | date: Thu Jan 01 00:00:00 1970 +0000
2701 2707 | summary: A3B2C2
2702 2708 |
2703 2709 | o changeset: 1:07dcc6b312c0
2704 2710 |/ user: test
2705 2711 | date: Thu Jan 01 00:00:00 1970 +0000
2706 2712 | summary: A2B2C2
2707 2713 |
2708 2714 o changeset: 0:abf4f0e38563
2709 2715 user: test
2710 2716 date: Thu Jan 01 00:00:00 1970 +0000
2711 2717 summary: A1B1C1
2712 2718
2713 2719
2714 2720 Log -f on B should reports current changesets
2715 2721
2716 2722 $ hg log -fG B
2717 2723 @ changeset: 2:fe5fc3d0eb17
2718 2724 | tag: tip
2719 2725 | parent: 0:abf4f0e38563
2720 2726 | user: test
2721 2727 | date: Thu Jan 01 00:00:00 1970 +0000
2722 2728 | summary: A3B2C2
2723 2729 |
2724 2730 o changeset: 0:abf4f0e38563
2725 2731 user: test
2726 2732 date: Thu Jan 01 00:00:00 1970 +0000
2727 2733 summary: A1B1C1
2728 2734
2729 2735 $ cd ..
2730 2736
2731 2737 --- going to test line wrap fix on using both --stat and -G (issue5800)
2732 2738 $ hg init issue5800
2733 2739 $ cd issue5800
2734 2740 $ touch a
2735 2741 $ hg ci -Am 'add a'
2736 2742 adding a
2737 2743 ---- now we are going to add 300 lines to a
2738 2744 $ for i in `$TESTDIR/seq.py 1 300`; do echo $i >> a; done
2739 2745 $ hg ci -m 'modify a'
2740 2746 $ hg log
2741 2747 changeset: 1:a98683e6a834
2742 2748 tag: tip
2743 2749 user: test
2744 2750 date: Thu Jan 01 00:00:00 1970 +0000
2745 2751 summary: modify a
2746 2752
2747 2753 changeset: 0:ac82d8b1f7c4
2748 2754 user: test
2749 2755 date: Thu Jan 01 00:00:00 1970 +0000
2750 2756 summary: add a
2751 2757
2752 2758 ---- now visualise the changes we made without template
2753 2759 $ hg log -l1 -r a98683e6a834 --stat -G
2754 2760 @ changeset: 1:a98683e6a834
2755 2761 | tag: tip
2756 2762 ~ user: test
2757 2763 date: Thu Jan 01 00:00:00 1970 +0000
2758 2764 summary: modify a
2759 2765
2760 2766 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2761 2767 1 files changed, 300 insertions(+), 0 deletions(-)
2762 2768
2763 2769 ---- with template
2764 2770 $ hg log -l1 -r a98683e6a834 --stat -G -T bisect
2765 2771 @ changeset: 1:a98683e6a834
2766 2772 | bisect:
2767 2773 ~ tag: tip
2768 2774 user: test
2769 2775 date: Thu Jan 01 00:00:00 1970 +0000
2770 2776 summary: modify a
2771 2777
2772 2778 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2773 2779 1 files changed, 300 insertions(+), 0 deletions(-)
2774 2780
2775 2781 $ hg log -l1 -r a98683e6a834 --stat -G -T changelog
2776 2782 1970-01-01 test <test>
2777 2783
2778 2784 @ * a:
2779 2785 | modify a
2780 2786 ~ [a98683e6a834] [tip]
2781 2787
2782 2788 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2783 2789 1 files changed, 300 insertions(+), 0 deletions(-)
2784 2790
2785 2791 $ hg log -l1 -r a98683e6a834 --stat -G -T compact
2786 2792 @ 1[tip] a98683e6a834 1970-01-01 00:00 +0000 test
2787 2793 | modify a
2788 2794 ~
2789 2795 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2790 2796 1 files changed, 300 insertions(+), 0 deletions(-)
2791 2797
2792 2798 $ hg log -l1 -r a98683e6a834 --stat -G -T default
2793 2799 @ changeset: 1:a98683e6a834
2794 2800 | tag: tip
2795 2801 ~ user: test
2796 2802 date: Thu Jan 01 00:00:00 1970 +0000
2797 2803 summary: modify a
2798 2804
2799 2805 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2800 2806 1 files changed, 300 insertions(+), 0 deletions(-)
2801 2807
2802 2808 $ hg log -l1 -r a98683e6a834 --stat -G -T phases
2803 2809 @ changeset: 1:a98683e6a834
2804 2810 | tag: tip
2805 2811 ~ phase: draft
2806 2812 user: test
2807 2813 date: Thu Jan 01 00:00:00 1970 +0000
2808 2814 summary: modify a
2809 2815
2810 2816 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2811 2817 1 files changed, 300 insertions(+), 0 deletions(-)
2812 2818
2813 2819 $ hg log -l1 -r a98683e6a834 --stat -G -T show
2814 2820 @ changeset: 1:a98683e6a834
2815 2821 | tag: tip
2816 2822 ~ user: test
2817 2823 date: Thu Jan 01 00:00:00 1970 +0000
2818 2824 summary: modify a
2819 2825
2820 2826 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2821 2827 1 files changed, 300 insertions(+), 0 deletions(-)
2822 2828
2823 2829 $ hg log -l1 -r a98683e6a834 --stat -G -T status
2824 2830 @ changeset: 1:a98683e6a834
2825 2831 | tag: tip
2826 2832 ~ user: test
2827 2833 date: Thu Jan 01 00:00:00 1970 +0000
2828 2834 summary: modify a
2829 2835 files:
2830 2836 M a
2831 2837
2832 2838 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2833 2839 1 files changed, 300 insertions(+), 0 deletions(-)
2834 2840
2835 2841 $ hg log -l1 -r a98683e6a834 --stat -G -T xml
2836 2842 <?xml version="1.0"?>
2837 2843 <log>
2838 2844 @ <logentry revision="1" node="a98683e6a8340830a7683909768b62871e84bc9d">
2839 2845 | <tag>tip</tag>
2840 2846 ~ <author email="test">test</author>
2841 2847 <date>1970-01-01T00:00:00+00:00</date>
2842 2848 <msg xml:space="preserve">modify a</msg>
2843 2849 </logentry>
2844 2850 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2845 2851 1 files changed, 300 insertions(+), 0 deletions(-)
2846 2852
2847 2853 </log>
2848 2854
2849 2855 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now