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