##// END OF EJS Templates
logcmdutil: raise `StateError` when file to follow doesn't exist...
Martin von Zweigbergk -
r49385:ca2a776a default draft
parent child Browse files
Show More
@@ -1,1287 +1,1287 b''
1 # logcmdutil.py - utility for log-like commands
1 # logcmdutil.py - utility for log-like commands
2 #
2 #
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
3 # Copyright 2005-2007 Olivia Mackall <olivia@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 nullrev, wdirrev
15 from .node import nullrev, wdirrev
16
16
17 from .thirdparty import attr
17 from .thirdparty import attr
18
18
19 from . import (
19 from . import (
20 dagop,
20 dagop,
21 error,
21 error,
22 formatter,
22 formatter,
23 graphmod,
23 graphmod,
24 match as matchmod,
24 match as matchmod,
25 mdiff,
25 mdiff,
26 merge,
26 merge,
27 patch,
27 patch,
28 pathutil,
28 pathutil,
29 pycompat,
29 pycompat,
30 revset,
30 revset,
31 revsetlang,
31 revsetlang,
32 scmutil,
32 scmutil,
33 smartset,
33 smartset,
34 templatekw,
34 templatekw,
35 templater,
35 templater,
36 util,
36 util,
37 )
37 )
38 from .utils import (
38 from .utils import (
39 dateutil,
39 dateutil,
40 stringutil,
40 stringutil,
41 )
41 )
42
42
43
43
44 if pycompat.TYPE_CHECKING:
44 if pycompat.TYPE_CHECKING:
45 from typing import (
45 from typing import (
46 Any,
46 Any,
47 Callable,
47 Callable,
48 Dict,
48 Dict,
49 Optional,
49 Optional,
50 Sequence,
50 Sequence,
51 Tuple,
51 Tuple,
52 )
52 )
53
53
54 for t in (Any, Callable, Dict, Optional, Tuple):
54 for t in (Any, Callable, Dict, Optional, Tuple):
55 assert t
55 assert t
56
56
57
57
58 def getlimit(opts):
58 def getlimit(opts):
59 """get the log limit according to option -l/--limit"""
59 """get the log limit according to option -l/--limit"""
60 limit = opts.get(b'limit')
60 limit = opts.get(b'limit')
61 if limit:
61 if limit:
62 try:
62 try:
63 limit = int(limit)
63 limit = int(limit)
64 except ValueError:
64 except ValueError:
65 raise error.InputError(_(b'limit must be a positive integer'))
65 raise error.InputError(_(b'limit must be a positive integer'))
66 if limit <= 0:
66 if limit <= 0:
67 raise error.InputError(_(b'limit must be positive'))
67 raise error.InputError(_(b'limit must be positive'))
68 else:
68 else:
69 limit = None
69 limit = None
70 return limit
70 return limit
71
71
72
72
73 def diff_parent(ctx):
73 def diff_parent(ctx):
74 """get the context object to use as parent when diffing
74 """get the context object to use as parent when diffing
75
75
76
76
77 If diff.merge is enabled, an overlayworkingctx of the auto-merged parents will be returned.
77 If diff.merge is enabled, an overlayworkingctx of the auto-merged parents will be returned.
78 """
78 """
79 repo = ctx.repo()
79 repo = ctx.repo()
80 if repo.ui.configbool(b"diff", b"merge") and ctx.p2().rev() != nullrev:
80 if repo.ui.configbool(b"diff", b"merge") and ctx.p2().rev() != nullrev:
81 # avoid cycle context -> subrepo -> cmdutil -> logcmdutil
81 # avoid cycle context -> subrepo -> cmdutil -> logcmdutil
82 from . import context
82 from . import context
83
83
84 wctx = context.overlayworkingctx(repo)
84 wctx = context.overlayworkingctx(repo)
85 wctx.setbase(ctx.p1())
85 wctx.setbase(ctx.p1())
86 with repo.ui.configoverride(
86 with repo.ui.configoverride(
87 {
87 {
88 (
88 (
89 b"ui",
89 b"ui",
90 b"forcemerge",
90 b"forcemerge",
91 ): b"internal:merge3-lie-about-conflicts",
91 ): b"internal:merge3-lie-about-conflicts",
92 },
92 },
93 b"merge-diff",
93 b"merge-diff",
94 ):
94 ):
95 with repo.ui.silent():
95 with repo.ui.silent():
96 merge.merge(ctx.p2(), wc=wctx)
96 merge.merge(ctx.p2(), wc=wctx)
97 return wctx
97 return wctx
98 else:
98 else:
99 return ctx.p1()
99 return ctx.p1()
100
100
101
101
102 def diffordiffstat(
102 def diffordiffstat(
103 ui,
103 ui,
104 repo,
104 repo,
105 diffopts,
105 diffopts,
106 ctx1,
106 ctx1,
107 ctx2,
107 ctx2,
108 match,
108 match,
109 changes=None,
109 changes=None,
110 stat=False,
110 stat=False,
111 fp=None,
111 fp=None,
112 graphwidth=0,
112 graphwidth=0,
113 prefix=b'',
113 prefix=b'',
114 root=b'',
114 root=b'',
115 listsubrepos=False,
115 listsubrepos=False,
116 hunksfilterfn=None,
116 hunksfilterfn=None,
117 ):
117 ):
118 '''show diff or diffstat.'''
118 '''show diff or diffstat.'''
119 if root:
119 if root:
120 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
120 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
121 else:
121 else:
122 relroot = b''
122 relroot = b''
123 copysourcematch = None
123 copysourcematch = None
124
124
125 def compose(f, g):
125 def compose(f, g):
126 return lambda x: f(g(x))
126 return lambda x: f(g(x))
127
127
128 def pathfn(f):
128 def pathfn(f):
129 return posixpath.join(prefix, f)
129 return posixpath.join(prefix, f)
130
130
131 if relroot != b'':
131 if relroot != b'':
132 # XXX relative roots currently don't work if the root is within a
132 # XXX relative roots currently don't work if the root is within a
133 # subrepo
133 # subrepo
134 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
134 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
135 uirelroot = uipathfn(pathfn(relroot))
135 uirelroot = uipathfn(pathfn(relroot))
136 relroot += b'/'
136 relroot += b'/'
137 for matchroot in match.files():
137 for matchroot in match.files():
138 if not matchroot.startswith(relroot):
138 if not matchroot.startswith(relroot):
139 ui.warn(
139 ui.warn(
140 _(b'warning: %s not inside relative root %s\n')
140 _(b'warning: %s not inside relative root %s\n')
141 % (uipathfn(pathfn(matchroot)), uirelroot)
141 % (uipathfn(pathfn(matchroot)), uirelroot)
142 )
142 )
143
143
144 relrootmatch = scmutil.match(ctx2, pats=[relroot], default=b'path')
144 relrootmatch = scmutil.match(ctx2, pats=[relroot], default=b'path')
145 match = matchmod.intersectmatchers(match, relrootmatch)
145 match = matchmod.intersectmatchers(match, relrootmatch)
146 copysourcematch = relrootmatch
146 copysourcematch = relrootmatch
147
147
148 checkroot = repo.ui.configbool(
148 checkroot = repo.ui.configbool(
149 b'devel', b'all-warnings'
149 b'devel', b'all-warnings'
150 ) or repo.ui.configbool(b'devel', b'check-relroot')
150 ) or repo.ui.configbool(b'devel', b'check-relroot')
151
151
152 def relrootpathfn(f):
152 def relrootpathfn(f):
153 if checkroot and not f.startswith(relroot):
153 if checkroot and not f.startswith(relroot):
154 raise AssertionError(
154 raise AssertionError(
155 b"file %s doesn't start with relroot %s" % (f, relroot)
155 b"file %s doesn't start with relroot %s" % (f, relroot)
156 )
156 )
157 return f[len(relroot) :]
157 return f[len(relroot) :]
158
158
159 pathfn = compose(relrootpathfn, pathfn)
159 pathfn = compose(relrootpathfn, pathfn)
160
160
161 if stat:
161 if stat:
162 diffopts = diffopts.copy(context=0, noprefix=False)
162 diffopts = diffopts.copy(context=0, noprefix=False)
163 width = 80
163 width = 80
164 if not ui.plain():
164 if not ui.plain():
165 width = ui.termwidth() - graphwidth
165 width = ui.termwidth() - graphwidth
166 # If an explicit --root was given, don't respect ui.relative-paths
166 # If an explicit --root was given, don't respect ui.relative-paths
167 if not relroot:
167 if not relroot:
168 pathfn = compose(scmutil.getuipathfn(repo), pathfn)
168 pathfn = compose(scmutil.getuipathfn(repo), pathfn)
169
169
170 chunks = ctx2.diff(
170 chunks = ctx2.diff(
171 ctx1,
171 ctx1,
172 match,
172 match,
173 changes,
173 changes,
174 opts=diffopts,
174 opts=diffopts,
175 pathfn=pathfn,
175 pathfn=pathfn,
176 copysourcematch=copysourcematch,
176 copysourcematch=copysourcematch,
177 hunksfilterfn=hunksfilterfn,
177 hunksfilterfn=hunksfilterfn,
178 )
178 )
179
179
180 if fp is not None or ui.canwritewithoutlabels():
180 if fp is not None or ui.canwritewithoutlabels():
181 out = fp or ui
181 out = fp or ui
182 if stat:
182 if stat:
183 chunks = [patch.diffstat(util.iterlines(chunks), width=width)]
183 chunks = [patch.diffstat(util.iterlines(chunks), width=width)]
184 for chunk in util.filechunkiter(util.chunkbuffer(chunks)):
184 for chunk in util.filechunkiter(util.chunkbuffer(chunks)):
185 out.write(chunk)
185 out.write(chunk)
186 else:
186 else:
187 if stat:
187 if stat:
188 chunks = patch.diffstatui(util.iterlines(chunks), width=width)
188 chunks = patch.diffstatui(util.iterlines(chunks), width=width)
189 else:
189 else:
190 chunks = patch.difflabel(
190 chunks = patch.difflabel(
191 lambda chunks, **kwargs: chunks, chunks, opts=diffopts
191 lambda chunks, **kwargs: chunks, chunks, opts=diffopts
192 )
192 )
193 if ui.canbatchlabeledwrites():
193 if ui.canbatchlabeledwrites():
194
194
195 def gen():
195 def gen():
196 for chunk, label in chunks:
196 for chunk, label in chunks:
197 yield ui.label(chunk, label=label)
197 yield ui.label(chunk, label=label)
198
198
199 for chunk in util.filechunkiter(util.chunkbuffer(gen())):
199 for chunk in util.filechunkiter(util.chunkbuffer(gen())):
200 ui.write(chunk)
200 ui.write(chunk)
201 else:
201 else:
202 for chunk, label in chunks:
202 for chunk, label in chunks:
203 ui.write(chunk, label=label)
203 ui.write(chunk, label=label)
204
204
205 node2 = ctx2.node()
205 node2 = ctx2.node()
206 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
206 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
207 tempnode2 = node2
207 tempnode2 = node2
208 try:
208 try:
209 if node2 is not None:
209 if node2 is not None:
210 tempnode2 = ctx2.substate[subpath][1]
210 tempnode2 = ctx2.substate[subpath][1]
211 except KeyError:
211 except KeyError:
212 # A subrepo that existed in node1 was deleted between node1 and
212 # A subrepo that existed in node1 was deleted between node1 and
213 # node2 (inclusive). Thus, ctx2's substate won't contain that
213 # node2 (inclusive). Thus, ctx2's substate won't contain that
214 # subpath. The best we can do is to ignore it.
214 # subpath. The best we can do is to ignore it.
215 tempnode2 = None
215 tempnode2 = None
216 submatch = matchmod.subdirmatcher(subpath, match)
216 submatch = matchmod.subdirmatcher(subpath, match)
217 subprefix = repo.wvfs.reljoin(prefix, subpath)
217 subprefix = repo.wvfs.reljoin(prefix, subpath)
218 if listsubrepos or match.exact(subpath) or any(submatch.files()):
218 if listsubrepos or match.exact(subpath) or any(submatch.files()):
219 sub.diff(
219 sub.diff(
220 ui,
220 ui,
221 diffopts,
221 diffopts,
222 tempnode2,
222 tempnode2,
223 submatch,
223 submatch,
224 changes=changes,
224 changes=changes,
225 stat=stat,
225 stat=stat,
226 fp=fp,
226 fp=fp,
227 prefix=subprefix,
227 prefix=subprefix,
228 )
228 )
229
229
230
230
231 class changesetdiffer(object):
231 class changesetdiffer(object):
232 """Generate diff of changeset with pre-configured filtering functions"""
232 """Generate diff of changeset with pre-configured filtering functions"""
233
233
234 def _makefilematcher(self, ctx):
234 def _makefilematcher(self, ctx):
235 return scmutil.matchall(ctx.repo())
235 return scmutil.matchall(ctx.repo())
236
236
237 def _makehunksfilter(self, ctx):
237 def _makehunksfilter(self, ctx):
238 return None
238 return None
239
239
240 def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False):
240 def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False):
241 diffordiffstat(
241 diffordiffstat(
242 ui,
242 ui,
243 ctx.repo(),
243 ctx.repo(),
244 diffopts,
244 diffopts,
245 diff_parent(ctx),
245 diff_parent(ctx),
246 ctx,
246 ctx,
247 match=self._makefilematcher(ctx),
247 match=self._makefilematcher(ctx),
248 stat=stat,
248 stat=stat,
249 graphwidth=graphwidth,
249 graphwidth=graphwidth,
250 hunksfilterfn=self._makehunksfilter(ctx),
250 hunksfilterfn=self._makehunksfilter(ctx),
251 )
251 )
252
252
253
253
254 def changesetlabels(ctx):
254 def changesetlabels(ctx):
255 labels = [b'log.changeset', b'changeset.%s' % ctx.phasestr()]
255 labels = [b'log.changeset', b'changeset.%s' % ctx.phasestr()]
256 if ctx.obsolete():
256 if ctx.obsolete():
257 labels.append(b'changeset.obsolete')
257 labels.append(b'changeset.obsolete')
258 if ctx.isunstable():
258 if ctx.isunstable():
259 labels.append(b'changeset.unstable')
259 labels.append(b'changeset.unstable')
260 for instability in ctx.instabilities():
260 for instability in ctx.instabilities():
261 labels.append(b'instability.%s' % instability)
261 labels.append(b'instability.%s' % instability)
262 return b' '.join(labels)
262 return b' '.join(labels)
263
263
264
264
265 class changesetprinter(object):
265 class changesetprinter(object):
266 '''show changeset information when templating not requested.'''
266 '''show changeset information when templating not requested.'''
267
267
268 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
268 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
269 self.ui = ui
269 self.ui = ui
270 self.repo = repo
270 self.repo = repo
271 self.buffered = buffered
271 self.buffered = buffered
272 self._differ = differ or changesetdiffer()
272 self._differ = differ or changesetdiffer()
273 self._diffopts = patch.diffallopts(ui, diffopts)
273 self._diffopts = patch.diffallopts(ui, diffopts)
274 self._includestat = diffopts and diffopts.get(b'stat')
274 self._includestat = diffopts and diffopts.get(b'stat')
275 self._includediff = diffopts and diffopts.get(b'patch')
275 self._includediff = diffopts and diffopts.get(b'patch')
276 self.header = {}
276 self.header = {}
277 self.hunk = {}
277 self.hunk = {}
278 self.lastheader = None
278 self.lastheader = None
279 self.footer = None
279 self.footer = None
280 self._columns = templatekw.getlogcolumns()
280 self._columns = templatekw.getlogcolumns()
281
281
282 def flush(self, ctx):
282 def flush(self, ctx):
283 rev = ctx.rev()
283 rev = ctx.rev()
284 if rev in self.header:
284 if rev in self.header:
285 h = self.header[rev]
285 h = self.header[rev]
286 if h != self.lastheader:
286 if h != self.lastheader:
287 self.lastheader = h
287 self.lastheader = h
288 self.ui.write(h)
288 self.ui.write(h)
289 del self.header[rev]
289 del self.header[rev]
290 if rev in self.hunk:
290 if rev in self.hunk:
291 self.ui.write(self.hunk[rev])
291 self.ui.write(self.hunk[rev])
292 del self.hunk[rev]
292 del self.hunk[rev]
293
293
294 def close(self):
294 def close(self):
295 if self.footer:
295 if self.footer:
296 self.ui.write(self.footer)
296 self.ui.write(self.footer)
297
297
298 def show(self, ctx, copies=None, **props):
298 def show(self, ctx, copies=None, **props):
299 props = pycompat.byteskwargs(props)
299 props = pycompat.byteskwargs(props)
300 if self.buffered:
300 if self.buffered:
301 self.ui.pushbuffer(labeled=True)
301 self.ui.pushbuffer(labeled=True)
302 self._show(ctx, copies, props)
302 self._show(ctx, copies, props)
303 self.hunk[ctx.rev()] = self.ui.popbuffer()
303 self.hunk[ctx.rev()] = self.ui.popbuffer()
304 else:
304 else:
305 self._show(ctx, copies, props)
305 self._show(ctx, copies, props)
306
306
307 def _show(self, ctx, copies, props):
307 def _show(self, ctx, copies, props):
308 '''show a single changeset or file revision'''
308 '''show a single changeset or file revision'''
309 changenode = ctx.node()
309 changenode = ctx.node()
310 graphwidth = props.get(b'graphwidth', 0)
310 graphwidth = props.get(b'graphwidth', 0)
311
311
312 if self.ui.quiet:
312 if self.ui.quiet:
313 self.ui.write(
313 self.ui.write(
314 b"%s\n" % scmutil.formatchangeid(ctx), label=b'log.node'
314 b"%s\n" % scmutil.formatchangeid(ctx), label=b'log.node'
315 )
315 )
316 return
316 return
317
317
318 columns = self._columns
318 columns = self._columns
319 self.ui.write(
319 self.ui.write(
320 columns[b'changeset'] % scmutil.formatchangeid(ctx),
320 columns[b'changeset'] % scmutil.formatchangeid(ctx),
321 label=changesetlabels(ctx),
321 label=changesetlabels(ctx),
322 )
322 )
323
323
324 # branches are shown first before any other names due to backwards
324 # branches are shown first before any other names due to backwards
325 # compatibility
325 # compatibility
326 branch = ctx.branch()
326 branch = ctx.branch()
327 # don't show the default branch name
327 # don't show the default branch name
328 if branch != b'default':
328 if branch != b'default':
329 self.ui.write(columns[b'branch'] % branch, label=b'log.branch')
329 self.ui.write(columns[b'branch'] % branch, label=b'log.branch')
330
330
331 for nsname, ns in pycompat.iteritems(self.repo.names):
331 for nsname, ns in pycompat.iteritems(self.repo.names):
332 # branches has special logic already handled above, so here we just
332 # branches has special logic already handled above, so here we just
333 # skip it
333 # skip it
334 if nsname == b'branches':
334 if nsname == b'branches':
335 continue
335 continue
336 # we will use the templatename as the color name since those two
336 # we will use the templatename as the color name since those two
337 # should be the same
337 # should be the same
338 for name in ns.names(self.repo, changenode):
338 for name in ns.names(self.repo, changenode):
339 self.ui.write(ns.logfmt % name, label=b'log.%s' % ns.colorname)
339 self.ui.write(ns.logfmt % name, label=b'log.%s' % ns.colorname)
340 if self.ui.debugflag:
340 if self.ui.debugflag:
341 self.ui.write(
341 self.ui.write(
342 columns[b'phase'] % ctx.phasestr(), label=b'log.phase'
342 columns[b'phase'] % ctx.phasestr(), label=b'log.phase'
343 )
343 )
344 for pctx in scmutil.meaningfulparents(self.repo, ctx):
344 for pctx in scmutil.meaningfulparents(self.repo, ctx):
345 label = b'log.parent changeset.%s' % pctx.phasestr()
345 label = b'log.parent changeset.%s' % pctx.phasestr()
346 self.ui.write(
346 self.ui.write(
347 columns[b'parent'] % scmutil.formatchangeid(pctx), label=label
347 columns[b'parent'] % scmutil.formatchangeid(pctx), label=label
348 )
348 )
349
349
350 if self.ui.debugflag:
350 if self.ui.debugflag:
351 mnode = ctx.manifestnode()
351 mnode = ctx.manifestnode()
352 if mnode is None:
352 if mnode is None:
353 mnode = self.repo.nodeconstants.wdirid
353 mnode = self.repo.nodeconstants.wdirid
354 mrev = wdirrev
354 mrev = wdirrev
355 else:
355 else:
356 mrev = self.repo.manifestlog.rev(mnode)
356 mrev = self.repo.manifestlog.rev(mnode)
357 self.ui.write(
357 self.ui.write(
358 columns[b'manifest']
358 columns[b'manifest']
359 % scmutil.formatrevnode(self.ui, mrev, mnode),
359 % scmutil.formatrevnode(self.ui, mrev, mnode),
360 label=b'ui.debug log.manifest',
360 label=b'ui.debug log.manifest',
361 )
361 )
362 self.ui.write(columns[b'user'] % ctx.user(), label=b'log.user')
362 self.ui.write(columns[b'user'] % ctx.user(), label=b'log.user')
363 self.ui.write(
363 self.ui.write(
364 columns[b'date'] % dateutil.datestr(ctx.date()), label=b'log.date'
364 columns[b'date'] % dateutil.datestr(ctx.date()), label=b'log.date'
365 )
365 )
366
366
367 if ctx.isunstable():
367 if ctx.isunstable():
368 instabilities = ctx.instabilities()
368 instabilities = ctx.instabilities()
369 self.ui.write(
369 self.ui.write(
370 columns[b'instability'] % b', '.join(instabilities),
370 columns[b'instability'] % b', '.join(instabilities),
371 label=b'log.instability',
371 label=b'log.instability',
372 )
372 )
373
373
374 elif ctx.obsolete():
374 elif ctx.obsolete():
375 self._showobsfate(ctx)
375 self._showobsfate(ctx)
376
376
377 self._exthook(ctx)
377 self._exthook(ctx)
378
378
379 if self.ui.debugflag:
379 if self.ui.debugflag:
380 files = ctx.p1().status(ctx)
380 files = ctx.p1().status(ctx)
381 for key, value in zip(
381 for key, value in zip(
382 [b'files', b'files+', b'files-'],
382 [b'files', b'files+', b'files-'],
383 [files.modified, files.added, files.removed],
383 [files.modified, files.added, files.removed],
384 ):
384 ):
385 if value:
385 if value:
386 self.ui.write(
386 self.ui.write(
387 columns[key] % b" ".join(value),
387 columns[key] % b" ".join(value),
388 label=b'ui.debug log.files',
388 label=b'ui.debug log.files',
389 )
389 )
390 elif ctx.files() and self.ui.verbose:
390 elif ctx.files() and self.ui.verbose:
391 self.ui.write(
391 self.ui.write(
392 columns[b'files'] % b" ".join(ctx.files()),
392 columns[b'files'] % b" ".join(ctx.files()),
393 label=b'ui.note log.files',
393 label=b'ui.note log.files',
394 )
394 )
395 if copies and self.ui.verbose:
395 if copies and self.ui.verbose:
396 copies = [b'%s (%s)' % c for c in copies]
396 copies = [b'%s (%s)' % c for c in copies]
397 self.ui.write(
397 self.ui.write(
398 columns[b'copies'] % b' '.join(copies),
398 columns[b'copies'] % b' '.join(copies),
399 label=b'ui.note log.copies',
399 label=b'ui.note log.copies',
400 )
400 )
401
401
402 extra = ctx.extra()
402 extra = ctx.extra()
403 if extra and self.ui.debugflag:
403 if extra and self.ui.debugflag:
404 for key, value in sorted(extra.items()):
404 for key, value in sorted(extra.items()):
405 self.ui.write(
405 self.ui.write(
406 columns[b'extra'] % (key, stringutil.escapestr(value)),
406 columns[b'extra'] % (key, stringutil.escapestr(value)),
407 label=b'ui.debug log.extra',
407 label=b'ui.debug log.extra',
408 )
408 )
409
409
410 description = ctx.description().strip()
410 description = ctx.description().strip()
411 if description:
411 if description:
412 if self.ui.verbose:
412 if self.ui.verbose:
413 self.ui.write(
413 self.ui.write(
414 _(b"description:\n"), label=b'ui.note log.description'
414 _(b"description:\n"), label=b'ui.note log.description'
415 )
415 )
416 self.ui.write(description, label=b'ui.note log.description')
416 self.ui.write(description, label=b'ui.note log.description')
417 self.ui.write(b"\n\n")
417 self.ui.write(b"\n\n")
418 else:
418 else:
419 self.ui.write(
419 self.ui.write(
420 columns[b'summary'] % description.splitlines()[0],
420 columns[b'summary'] % description.splitlines()[0],
421 label=b'log.summary',
421 label=b'log.summary',
422 )
422 )
423 self.ui.write(b"\n")
423 self.ui.write(b"\n")
424
424
425 self._showpatch(ctx, graphwidth)
425 self._showpatch(ctx, graphwidth)
426
426
427 def _showobsfate(self, ctx):
427 def _showobsfate(self, ctx):
428 # TODO: do not depend on templater
428 # TODO: do not depend on templater
429 tres = formatter.templateresources(self.repo.ui, self.repo)
429 tres = formatter.templateresources(self.repo.ui, self.repo)
430 t = formatter.maketemplater(
430 t = formatter.maketemplater(
431 self.repo.ui,
431 self.repo.ui,
432 b'{join(obsfate, "\n")}',
432 b'{join(obsfate, "\n")}',
433 defaults=templatekw.keywords,
433 defaults=templatekw.keywords,
434 resources=tres,
434 resources=tres,
435 )
435 )
436 obsfate = t.renderdefault({b'ctx': ctx}).splitlines()
436 obsfate = t.renderdefault({b'ctx': ctx}).splitlines()
437
437
438 if obsfate:
438 if obsfate:
439 for obsfateline in obsfate:
439 for obsfateline in obsfate:
440 self.ui.write(
440 self.ui.write(
441 self._columns[b'obsolete'] % obsfateline,
441 self._columns[b'obsolete'] % obsfateline,
442 label=b'log.obsfate',
442 label=b'log.obsfate',
443 )
443 )
444
444
445 def _exthook(self, ctx):
445 def _exthook(self, ctx):
446 """empty method used by extension as a hook point"""
446 """empty method used by extension as a hook point"""
447
447
448 def _showpatch(self, ctx, graphwidth=0):
448 def _showpatch(self, ctx, graphwidth=0):
449 if self._includestat:
449 if self._includestat:
450 self._differ.showdiff(
450 self._differ.showdiff(
451 self.ui, ctx, self._diffopts, graphwidth, stat=True
451 self.ui, ctx, self._diffopts, graphwidth, stat=True
452 )
452 )
453 if self._includestat and self._includediff:
453 if self._includestat and self._includediff:
454 self.ui.write(b"\n")
454 self.ui.write(b"\n")
455 if self._includediff:
455 if self._includediff:
456 self._differ.showdiff(
456 self._differ.showdiff(
457 self.ui, ctx, self._diffopts, graphwidth, stat=False
457 self.ui, ctx, self._diffopts, graphwidth, stat=False
458 )
458 )
459 if self._includestat or self._includediff:
459 if self._includestat or self._includediff:
460 self.ui.write(b"\n")
460 self.ui.write(b"\n")
461
461
462
462
463 class changesetformatter(changesetprinter):
463 class changesetformatter(changesetprinter):
464 """Format changeset information by generic formatter"""
464 """Format changeset information by generic formatter"""
465
465
466 def __init__(
466 def __init__(
467 self, ui, repo, fm, differ=None, diffopts=None, buffered=False
467 self, ui, repo, fm, differ=None, diffopts=None, buffered=False
468 ):
468 ):
469 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
469 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
470 self._diffopts = patch.difffeatureopts(ui, diffopts, git=True)
470 self._diffopts = patch.difffeatureopts(ui, diffopts, git=True)
471 self._fm = fm
471 self._fm = fm
472
472
473 def close(self):
473 def close(self):
474 self._fm.end()
474 self._fm.end()
475
475
476 def _show(self, ctx, copies, props):
476 def _show(self, ctx, copies, props):
477 '''show a single changeset or file revision'''
477 '''show a single changeset or file revision'''
478 fm = self._fm
478 fm = self._fm
479 fm.startitem()
479 fm.startitem()
480 fm.context(ctx=ctx)
480 fm.context(ctx=ctx)
481 fm.data(rev=scmutil.intrev(ctx), node=fm.hexfunc(scmutil.binnode(ctx)))
481 fm.data(rev=scmutil.intrev(ctx), node=fm.hexfunc(scmutil.binnode(ctx)))
482
482
483 datahint = fm.datahint()
483 datahint = fm.datahint()
484 if self.ui.quiet and not datahint:
484 if self.ui.quiet and not datahint:
485 return
485 return
486
486
487 fm.data(
487 fm.data(
488 branch=ctx.branch(),
488 branch=ctx.branch(),
489 phase=ctx.phasestr(),
489 phase=ctx.phasestr(),
490 user=ctx.user(),
490 user=ctx.user(),
491 date=fm.formatdate(ctx.date()),
491 date=fm.formatdate(ctx.date()),
492 desc=ctx.description(),
492 desc=ctx.description(),
493 bookmarks=fm.formatlist(ctx.bookmarks(), name=b'bookmark'),
493 bookmarks=fm.formatlist(ctx.bookmarks(), name=b'bookmark'),
494 tags=fm.formatlist(ctx.tags(), name=b'tag'),
494 tags=fm.formatlist(ctx.tags(), name=b'tag'),
495 parents=fm.formatlist(
495 parents=fm.formatlist(
496 [fm.hexfunc(c.node()) for c in ctx.parents()], name=b'node'
496 [fm.hexfunc(c.node()) for c in ctx.parents()], name=b'node'
497 ),
497 ),
498 )
498 )
499
499
500 if self.ui.debugflag or b'manifest' in datahint:
500 if self.ui.debugflag or b'manifest' in datahint:
501 fm.data(
501 fm.data(
502 manifest=fm.hexfunc(
502 manifest=fm.hexfunc(
503 ctx.manifestnode() or self.repo.nodeconstants.wdirid
503 ctx.manifestnode() or self.repo.nodeconstants.wdirid
504 )
504 )
505 )
505 )
506 if self.ui.debugflag or b'extra' in datahint:
506 if self.ui.debugflag or b'extra' in datahint:
507 fm.data(extra=fm.formatdict(ctx.extra()))
507 fm.data(extra=fm.formatdict(ctx.extra()))
508
508
509 if (
509 if (
510 self.ui.debugflag
510 self.ui.debugflag
511 or b'modified' in datahint
511 or b'modified' in datahint
512 or b'added' in datahint
512 or b'added' in datahint
513 or b'removed' in datahint
513 or b'removed' in datahint
514 ):
514 ):
515 files = ctx.p1().status(ctx)
515 files = ctx.p1().status(ctx)
516 fm.data(
516 fm.data(
517 modified=fm.formatlist(files.modified, name=b'file'),
517 modified=fm.formatlist(files.modified, name=b'file'),
518 added=fm.formatlist(files.added, name=b'file'),
518 added=fm.formatlist(files.added, name=b'file'),
519 removed=fm.formatlist(files.removed, name=b'file'),
519 removed=fm.formatlist(files.removed, name=b'file'),
520 )
520 )
521
521
522 verbose = not self.ui.debugflag and self.ui.verbose
522 verbose = not self.ui.debugflag and self.ui.verbose
523 if verbose or b'files' in datahint:
523 if verbose or b'files' in datahint:
524 fm.data(files=fm.formatlist(ctx.files(), name=b'file'))
524 fm.data(files=fm.formatlist(ctx.files(), name=b'file'))
525 if verbose and copies or b'copies' in datahint:
525 if verbose and copies or b'copies' in datahint:
526 fm.data(
526 fm.data(
527 copies=fm.formatdict(copies or {}, key=b'name', value=b'source')
527 copies=fm.formatdict(copies or {}, key=b'name', value=b'source')
528 )
528 )
529
529
530 if self._includestat or b'diffstat' in datahint:
530 if self._includestat or b'diffstat' in datahint:
531 self.ui.pushbuffer()
531 self.ui.pushbuffer()
532 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
532 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
533 fm.data(diffstat=self.ui.popbuffer())
533 fm.data(diffstat=self.ui.popbuffer())
534 if self._includediff or b'diff' in datahint:
534 if self._includediff or b'diff' in datahint:
535 self.ui.pushbuffer()
535 self.ui.pushbuffer()
536 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
536 self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
537 fm.data(diff=self.ui.popbuffer())
537 fm.data(diff=self.ui.popbuffer())
538
538
539
539
540 class changesettemplater(changesetprinter):
540 class changesettemplater(changesetprinter):
541 """format changeset information.
541 """format changeset information.
542
542
543 Note: there are a variety of convenience functions to build a
543 Note: there are a variety of convenience functions to build a
544 changesettemplater for common cases. See functions such as:
544 changesettemplater for common cases. See functions such as:
545 maketemplater, changesetdisplayer, buildcommittemplate, or other
545 maketemplater, changesetdisplayer, buildcommittemplate, or other
546 functions that use changesest_templater.
546 functions that use changesest_templater.
547 """
547 """
548
548
549 # Arguments before "buffered" used to be positional. Consider not
549 # Arguments before "buffered" used to be positional. Consider not
550 # adding/removing arguments before "buffered" to not break callers.
550 # adding/removing arguments before "buffered" to not break callers.
551 def __init__(
551 def __init__(
552 self, ui, repo, tmplspec, differ=None, diffopts=None, buffered=False
552 self, ui, repo, tmplspec, differ=None, diffopts=None, buffered=False
553 ):
553 ):
554 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
554 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
555 # tres is shared with _graphnodeformatter()
555 # tres is shared with _graphnodeformatter()
556 self._tresources = tres = formatter.templateresources(ui, repo)
556 self._tresources = tres = formatter.templateresources(ui, repo)
557 self.t = formatter.loadtemplater(
557 self.t = formatter.loadtemplater(
558 ui,
558 ui,
559 tmplspec,
559 tmplspec,
560 defaults=templatekw.keywords,
560 defaults=templatekw.keywords,
561 resources=tres,
561 resources=tres,
562 cache=templatekw.defaulttempl,
562 cache=templatekw.defaulttempl,
563 )
563 )
564 self._counter = itertools.count()
564 self._counter = itertools.count()
565
565
566 self._tref = tmplspec.ref
566 self._tref = tmplspec.ref
567 self._parts = {
567 self._parts = {
568 b'header': b'',
568 b'header': b'',
569 b'footer': b'',
569 b'footer': b'',
570 tmplspec.ref: tmplspec.ref,
570 tmplspec.ref: tmplspec.ref,
571 b'docheader': b'',
571 b'docheader': b'',
572 b'docfooter': b'',
572 b'docfooter': b'',
573 b'separator': b'',
573 b'separator': b'',
574 }
574 }
575 if tmplspec.mapfile:
575 if tmplspec.mapfile:
576 # find correct templates for current mode, for backward
576 # find correct templates for current mode, for backward
577 # compatibility with 'log -v/-q/--debug' using a mapfile
577 # compatibility with 'log -v/-q/--debug' using a mapfile
578 tmplmodes = [
578 tmplmodes = [
579 (True, b''),
579 (True, b''),
580 (self.ui.verbose, b'_verbose'),
580 (self.ui.verbose, b'_verbose'),
581 (self.ui.quiet, b'_quiet'),
581 (self.ui.quiet, b'_quiet'),
582 (self.ui.debugflag, b'_debug'),
582 (self.ui.debugflag, b'_debug'),
583 ]
583 ]
584 for mode, postfix in tmplmodes:
584 for mode, postfix in tmplmodes:
585 for t in self._parts:
585 for t in self._parts:
586 cur = t + postfix
586 cur = t + postfix
587 if mode and cur in self.t:
587 if mode and cur in self.t:
588 self._parts[t] = cur
588 self._parts[t] = cur
589 else:
589 else:
590 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
590 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
591 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
591 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
592 self._parts.update(m)
592 self._parts.update(m)
593
593
594 if self._parts[b'docheader']:
594 if self._parts[b'docheader']:
595 self.ui.write(self.t.render(self._parts[b'docheader'], {}))
595 self.ui.write(self.t.render(self._parts[b'docheader'], {}))
596
596
597 def close(self):
597 def close(self):
598 if self._parts[b'docfooter']:
598 if self._parts[b'docfooter']:
599 if not self.footer:
599 if not self.footer:
600 self.footer = b""
600 self.footer = b""
601 self.footer += self.t.render(self._parts[b'docfooter'], {})
601 self.footer += self.t.render(self._parts[b'docfooter'], {})
602 return super(changesettemplater, self).close()
602 return super(changesettemplater, self).close()
603
603
604 def _show(self, ctx, copies, props):
604 def _show(self, ctx, copies, props):
605 '''show a single changeset or file revision'''
605 '''show a single changeset or file revision'''
606 props = props.copy()
606 props = props.copy()
607 props[b'ctx'] = ctx
607 props[b'ctx'] = ctx
608 props[b'index'] = index = next(self._counter)
608 props[b'index'] = index = next(self._counter)
609 props[b'revcache'] = {b'copies': copies}
609 props[b'revcache'] = {b'copies': copies}
610 graphwidth = props.get(b'graphwidth', 0)
610 graphwidth = props.get(b'graphwidth', 0)
611
611
612 # write separator, which wouldn't work well with the header part below
612 # write separator, which wouldn't work well with the header part below
613 # since there's inherently a conflict between header (across items) and
613 # since there's inherently a conflict between header (across items) and
614 # separator (per item)
614 # separator (per item)
615 if self._parts[b'separator'] and index > 0:
615 if self._parts[b'separator'] and index > 0:
616 self.ui.write(self.t.render(self._parts[b'separator'], {}))
616 self.ui.write(self.t.render(self._parts[b'separator'], {}))
617
617
618 # write header
618 # write header
619 if self._parts[b'header']:
619 if self._parts[b'header']:
620 h = self.t.render(self._parts[b'header'], props)
620 h = self.t.render(self._parts[b'header'], props)
621 if self.buffered:
621 if self.buffered:
622 self.header[ctx.rev()] = h
622 self.header[ctx.rev()] = h
623 else:
623 else:
624 if self.lastheader != h:
624 if self.lastheader != h:
625 self.lastheader = h
625 self.lastheader = h
626 self.ui.write(h)
626 self.ui.write(h)
627
627
628 # write changeset metadata, then patch if requested
628 # write changeset metadata, then patch if requested
629 key = self._parts[self._tref]
629 key = self._parts[self._tref]
630 self.ui.write(self.t.render(key, props))
630 self.ui.write(self.t.render(key, props))
631 self._exthook(ctx)
631 self._exthook(ctx)
632 self._showpatch(ctx, graphwidth)
632 self._showpatch(ctx, graphwidth)
633
633
634 if self._parts[b'footer']:
634 if self._parts[b'footer']:
635 if not self.footer:
635 if not self.footer:
636 self.footer = self.t.render(self._parts[b'footer'], props)
636 self.footer = self.t.render(self._parts[b'footer'], props)
637
637
638
638
639 def templatespec(tmpl, mapfile):
639 def templatespec(tmpl, mapfile):
640 assert not (tmpl and mapfile)
640 assert not (tmpl and mapfile)
641 if mapfile:
641 if mapfile:
642 return formatter.mapfile_templatespec(b'changeset', mapfile)
642 return formatter.mapfile_templatespec(b'changeset', mapfile)
643 else:
643 else:
644 return formatter.literal_templatespec(tmpl)
644 return formatter.literal_templatespec(tmpl)
645
645
646
646
647 def _lookuptemplate(ui, tmpl, style):
647 def _lookuptemplate(ui, tmpl, style):
648 """Find the template matching the given template spec or style
648 """Find the template matching the given template spec or style
649
649
650 See formatter.lookuptemplate() for details.
650 See formatter.lookuptemplate() for details.
651 """
651 """
652
652
653 # ui settings
653 # ui settings
654 if not tmpl and not style: # template are stronger than style
654 if not tmpl and not style: # template are stronger than style
655 tmpl = ui.config(b'command-templates', b'log')
655 tmpl = ui.config(b'command-templates', b'log')
656 if tmpl:
656 if tmpl:
657 return formatter.literal_templatespec(templater.unquotestring(tmpl))
657 return formatter.literal_templatespec(templater.unquotestring(tmpl))
658 else:
658 else:
659 style = util.expandpath(ui.config(b'ui', b'style'))
659 style = util.expandpath(ui.config(b'ui', b'style'))
660
660
661 if not tmpl and style:
661 if not tmpl and style:
662 mapfile = style
662 mapfile = style
663 fp = None
663 fp = None
664 if not os.path.split(mapfile)[0]:
664 if not os.path.split(mapfile)[0]:
665 (mapname, fp) = templater.try_open_template(
665 (mapname, fp) = templater.try_open_template(
666 b'map-cmdline.' + mapfile
666 b'map-cmdline.' + mapfile
667 ) or templater.try_open_template(mapfile)
667 ) or templater.try_open_template(mapfile)
668 if mapname:
668 if mapname:
669 mapfile = mapname
669 mapfile = mapname
670 return formatter.mapfile_templatespec(b'changeset', mapfile, fp)
670 return formatter.mapfile_templatespec(b'changeset', mapfile, fp)
671
671
672 return formatter.lookuptemplate(ui, b'changeset', tmpl)
672 return formatter.lookuptemplate(ui, b'changeset', tmpl)
673
673
674
674
675 def maketemplater(ui, repo, tmpl, buffered=False):
675 def maketemplater(ui, repo, tmpl, buffered=False):
676 """Create a changesettemplater from a literal template 'tmpl'
676 """Create a changesettemplater from a literal template 'tmpl'
677 byte-string."""
677 byte-string."""
678 spec = formatter.literal_templatespec(tmpl)
678 spec = formatter.literal_templatespec(tmpl)
679 return changesettemplater(ui, repo, spec, buffered=buffered)
679 return changesettemplater(ui, repo, spec, buffered=buffered)
680
680
681
681
682 def changesetdisplayer(ui, repo, opts, differ=None, buffered=False):
682 def changesetdisplayer(ui, repo, opts, differ=None, buffered=False):
683 """show one changeset using template or regular display.
683 """show one changeset using template or regular display.
684
684
685 Display format will be the first non-empty hit of:
685 Display format will be the first non-empty hit of:
686 1. option 'template'
686 1. option 'template'
687 2. option 'style'
687 2. option 'style'
688 3. [command-templates] setting 'log'
688 3. [command-templates] setting 'log'
689 4. [ui] setting 'style'
689 4. [ui] setting 'style'
690 If all of these values are either the unset or the empty string,
690 If all of these values are either the unset or the empty string,
691 regular display via changesetprinter() is done.
691 regular display via changesetprinter() is done.
692 """
692 """
693 postargs = (differ, opts, buffered)
693 postargs = (differ, opts, buffered)
694 spec = _lookuptemplate(ui, opts.get(b'template'), opts.get(b'style'))
694 spec = _lookuptemplate(ui, opts.get(b'template'), opts.get(b'style'))
695
695
696 # machine-readable formats have slightly different keyword set than
696 # machine-readable formats have slightly different keyword set than
697 # plain templates, which are handled by changesetformatter.
697 # plain templates, which are handled by changesetformatter.
698 # note that {b'pickle', b'debug'} can also be added to the list if needed.
698 # note that {b'pickle', b'debug'} can also be added to the list if needed.
699 if spec.ref in {b'cbor', b'json'}:
699 if spec.ref in {b'cbor', b'json'}:
700 fm = ui.formatter(b'log', opts)
700 fm = ui.formatter(b'log', opts)
701 return changesetformatter(ui, repo, fm, *postargs)
701 return changesetformatter(ui, repo, fm, *postargs)
702
702
703 if not spec.ref and not spec.tmpl and not spec.mapfile:
703 if not spec.ref and not spec.tmpl and not spec.mapfile:
704 return changesetprinter(ui, repo, *postargs)
704 return changesetprinter(ui, repo, *postargs)
705
705
706 return changesettemplater(ui, repo, spec, *postargs)
706 return changesettemplater(ui, repo, spec, *postargs)
707
707
708
708
709 @attr.s
709 @attr.s
710 class walkopts(object):
710 class walkopts(object):
711 """Options to configure a set of revisions and file matcher factory
711 """Options to configure a set of revisions and file matcher factory
712 to scan revision/file history
712 to scan revision/file history
713 """
713 """
714
714
715 # raw command-line parameters, which a matcher will be built from
715 # raw command-line parameters, which a matcher will be built from
716 pats = attr.ib()
716 pats = attr.ib()
717 opts = attr.ib()
717 opts = attr.ib()
718
718
719 # a list of revset expressions to be traversed; if follow, it specifies
719 # a list of revset expressions to be traversed; if follow, it specifies
720 # the start revisions
720 # the start revisions
721 revspec = attr.ib()
721 revspec = attr.ib()
722
722
723 # miscellaneous queries to filter revisions (see "hg help log" for details)
723 # miscellaneous queries to filter revisions (see "hg help log" for details)
724 bookmarks = attr.ib(default=attr.Factory(list))
724 bookmarks = attr.ib(default=attr.Factory(list))
725 branches = attr.ib(default=attr.Factory(list))
725 branches = attr.ib(default=attr.Factory(list))
726 date = attr.ib(default=None)
726 date = attr.ib(default=None)
727 keywords = attr.ib(default=attr.Factory(list))
727 keywords = attr.ib(default=attr.Factory(list))
728 no_merges = attr.ib(default=False)
728 no_merges = attr.ib(default=False)
729 only_merges = attr.ib(default=False)
729 only_merges = attr.ib(default=False)
730 prune_ancestors = attr.ib(default=attr.Factory(list))
730 prune_ancestors = attr.ib(default=attr.Factory(list))
731 users = attr.ib(default=attr.Factory(list))
731 users = attr.ib(default=attr.Factory(list))
732
732
733 # miscellaneous matcher arguments
733 # miscellaneous matcher arguments
734 include_pats = attr.ib(default=attr.Factory(list))
734 include_pats = attr.ib(default=attr.Factory(list))
735 exclude_pats = attr.ib(default=attr.Factory(list))
735 exclude_pats = attr.ib(default=attr.Factory(list))
736
736
737 # 0: no follow, 1: follow first, 2: follow both parents
737 # 0: no follow, 1: follow first, 2: follow both parents
738 follow = attr.ib(default=0)
738 follow = attr.ib(default=0)
739
739
740 # do not attempt filelog-based traversal, which may be fast but cannot
740 # do not attempt filelog-based traversal, which may be fast but cannot
741 # include revisions where files were removed
741 # include revisions where files were removed
742 force_changelog_traversal = attr.ib(default=False)
742 force_changelog_traversal = attr.ib(default=False)
743
743
744 # filter revisions by file patterns, which should be disabled only if
744 # filter revisions by file patterns, which should be disabled only if
745 # you want to include revisions where files were unmodified
745 # you want to include revisions where files were unmodified
746 filter_revisions_by_pats = attr.ib(default=True)
746 filter_revisions_by_pats = attr.ib(default=True)
747
747
748 # sort revisions prior to traversal: 'desc', 'topo', or None
748 # sort revisions prior to traversal: 'desc', 'topo', or None
749 sort_revisions = attr.ib(default=None)
749 sort_revisions = attr.ib(default=None)
750
750
751 # limit number of changes displayed; None means unlimited
751 # limit number of changes displayed; None means unlimited
752 limit = attr.ib(default=None)
752 limit = attr.ib(default=None)
753
753
754
754
755 def parseopts(ui, pats, opts):
755 def parseopts(ui, pats, opts):
756 # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
756 # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
757 """Parse log command options into walkopts
757 """Parse log command options into walkopts
758
758
759 The returned walkopts will be passed in to getrevs() or makewalker().
759 The returned walkopts will be passed in to getrevs() or makewalker().
760 """
760 """
761 if opts.get(b'follow_first'):
761 if opts.get(b'follow_first'):
762 follow = 1
762 follow = 1
763 elif opts.get(b'follow'):
763 elif opts.get(b'follow'):
764 follow = 2
764 follow = 2
765 else:
765 else:
766 follow = 0
766 follow = 0
767
767
768 if opts.get(b'graph'):
768 if opts.get(b'graph'):
769 if ui.configbool(b'experimental', b'log.topo'):
769 if ui.configbool(b'experimental', b'log.topo'):
770 sort_revisions = b'topo'
770 sort_revisions = b'topo'
771 else:
771 else:
772 sort_revisions = b'desc'
772 sort_revisions = b'desc'
773 else:
773 else:
774 sort_revisions = None
774 sort_revisions = None
775
775
776 return walkopts(
776 return walkopts(
777 pats=pats,
777 pats=pats,
778 opts=opts,
778 opts=opts,
779 revspec=opts.get(b'rev', []),
779 revspec=opts.get(b'rev', []),
780 bookmarks=opts.get(b'bookmark', []),
780 bookmarks=opts.get(b'bookmark', []),
781 # branch and only_branch are really aliases and must be handled at
781 # branch and only_branch are really aliases and must be handled at
782 # the same time
782 # the same time
783 branches=opts.get(b'branch', []) + opts.get(b'only_branch', []),
783 branches=opts.get(b'branch', []) + opts.get(b'only_branch', []),
784 date=opts.get(b'date'),
784 date=opts.get(b'date'),
785 keywords=opts.get(b'keyword', []),
785 keywords=opts.get(b'keyword', []),
786 no_merges=bool(opts.get(b'no_merges')),
786 no_merges=bool(opts.get(b'no_merges')),
787 only_merges=bool(opts.get(b'only_merges')),
787 only_merges=bool(opts.get(b'only_merges')),
788 prune_ancestors=opts.get(b'prune', []),
788 prune_ancestors=opts.get(b'prune', []),
789 users=opts.get(b'user', []),
789 users=opts.get(b'user', []),
790 include_pats=opts.get(b'include', []),
790 include_pats=opts.get(b'include', []),
791 exclude_pats=opts.get(b'exclude', []),
791 exclude_pats=opts.get(b'exclude', []),
792 follow=follow,
792 follow=follow,
793 force_changelog_traversal=bool(opts.get(b'removed')),
793 force_changelog_traversal=bool(opts.get(b'removed')),
794 sort_revisions=sort_revisions,
794 sort_revisions=sort_revisions,
795 limit=getlimit(opts),
795 limit=getlimit(opts),
796 )
796 )
797
797
798
798
799 def _makematcher(repo, revs, wopts):
799 def _makematcher(repo, revs, wopts):
800 """Build matcher and expanded patterns from log options
800 """Build matcher and expanded patterns from log options
801
801
802 If --follow, revs are the revisions to follow from.
802 If --follow, revs are the revisions to follow from.
803
803
804 Returns (match, pats, slowpath) where
804 Returns (match, pats, slowpath) where
805 - match: a matcher built from the given pats and -I/-X opts
805 - match: a matcher built from the given pats and -I/-X opts
806 - pats: patterns used (globs are expanded on Windows)
806 - pats: patterns used (globs are expanded on Windows)
807 - slowpath: True if patterns aren't as simple as scanning filelogs
807 - slowpath: True if patterns aren't as simple as scanning filelogs
808 """
808 """
809 # pats/include/exclude are passed to match.match() directly in
809 # pats/include/exclude are passed to match.match() directly in
810 # _matchfiles() revset, but a log-like command should build its matcher
810 # _matchfiles() revset, but a log-like command should build its matcher
811 # with scmutil.match(). The difference is input pats are globbed on
811 # with scmutil.match(). The difference is input pats are globbed on
812 # platforms without shell expansion (windows).
812 # platforms without shell expansion (windows).
813 wctx = repo[None]
813 wctx = repo[None]
814 match, pats = scmutil.matchandpats(wctx, wopts.pats, wopts.opts)
814 match, pats = scmutil.matchandpats(wctx, wopts.pats, wopts.opts)
815 slowpath = match.anypats() or (
815 slowpath = match.anypats() or (
816 not match.always() and wopts.force_changelog_traversal
816 not match.always() and wopts.force_changelog_traversal
817 )
817 )
818 if not slowpath:
818 if not slowpath:
819 if wopts.follow and wopts.revspec:
819 if wopts.follow and wopts.revspec:
820 # There may be the case that a path doesn't exist in some (but
820 # There may be the case that a path doesn't exist in some (but
821 # not all) of the specified start revisions, but let's consider
821 # not all) of the specified start revisions, but let's consider
822 # the path is valid. Missing files will be warned by the matcher.
822 # the path is valid. Missing files will be warned by the matcher.
823 startctxs = [repo[r] for r in revs]
823 startctxs = [repo[r] for r in revs]
824 for f in match.files():
824 for f in match.files():
825 found = False
825 found = False
826 for c in startctxs:
826 for c in startctxs:
827 if f in c:
827 if f in c:
828 found = True
828 found = True
829 elif c.hasdir(f):
829 elif c.hasdir(f):
830 # If a directory exists in any of the start revisions,
830 # If a directory exists in any of the start revisions,
831 # take the slow path.
831 # take the slow path.
832 found = slowpath = True
832 found = slowpath = True
833 if not found:
833 if not found:
834 raise error.Abort(
834 raise error.StateError(
835 _(
835 _(
836 b'cannot follow file not in any of the specified '
836 b'cannot follow file not in any of the specified '
837 b'revisions: "%s"'
837 b'revisions: "%s"'
838 )
838 )
839 % f
839 % f
840 )
840 )
841 elif wopts.follow:
841 elif wopts.follow:
842 for f in match.files():
842 for f in match.files():
843 if f not in wctx:
843 if f not in wctx:
844 # If the file exists, it may be a directory, so let it
844 # If the file exists, it may be a directory, so let it
845 # take the slow path.
845 # take the slow path.
846 if os.path.exists(repo.wjoin(f)):
846 if os.path.exists(repo.wjoin(f)):
847 slowpath = True
847 slowpath = True
848 continue
848 continue
849 else:
849 else:
850 raise error.Abort(
850 raise error.StateError(
851 _(
851 _(
852 b'cannot follow file not in parent '
852 b'cannot follow file not in parent '
853 b'revision: "%s"'
853 b'revision: "%s"'
854 )
854 )
855 % f
855 % f
856 )
856 )
857 filelog = repo.file(f)
857 filelog = repo.file(f)
858 if not filelog:
858 if not filelog:
859 # A file exists in wdir but not in history, which means
859 # A file exists in wdir but not in history, which means
860 # the file isn't committed yet.
860 # the file isn't committed yet.
861 raise error.Abort(
861 raise error.StateError(
862 _(b'cannot follow nonexistent file: "%s"') % f
862 _(b'cannot follow nonexistent file: "%s"') % f
863 )
863 )
864 else:
864 else:
865 for f in match.files():
865 for f in match.files():
866 filelog = repo.file(f)
866 filelog = repo.file(f)
867 if not filelog:
867 if not filelog:
868 # A zero count may be a directory or deleted file, so
868 # A zero count may be a directory or deleted file, so
869 # try to find matching entries on the slow path.
869 # try to find matching entries on the slow path.
870 slowpath = True
870 slowpath = True
871
871
872 # We decided to fall back to the slowpath because at least one
872 # We decided to fall back to the slowpath because at least one
873 # of the paths was not a file. Check to see if at least one of them
873 # of the paths was not a file. Check to see if at least one of them
874 # existed in history - in that case, we'll continue down the
874 # existed in history - in that case, we'll continue down the
875 # slowpath; otherwise, we can turn off the slowpath
875 # slowpath; otherwise, we can turn off the slowpath
876 if slowpath:
876 if slowpath:
877 for path in match.files():
877 for path in match.files():
878 if not path or path in repo.store:
878 if not path or path in repo.store:
879 break
879 break
880 else:
880 else:
881 slowpath = False
881 slowpath = False
882
882
883 return match, pats, slowpath
883 return match, pats, slowpath
884
884
885
885
886 def _fileancestors(repo, revs, match, followfirst):
886 def _fileancestors(repo, revs, match, followfirst):
887 fctxs = []
887 fctxs = []
888 for r in revs:
888 for r in revs:
889 ctx = repo[r]
889 ctx = repo[r]
890 fctxs.extend(ctx[f].introfilectx() for f in ctx.walk(match))
890 fctxs.extend(ctx[f].introfilectx() for f in ctx.walk(match))
891
891
892 # When displaying a revision with --patch --follow FILE, we have
892 # When displaying a revision with --patch --follow FILE, we have
893 # to know which file of the revision must be diffed. With
893 # to know which file of the revision must be diffed. With
894 # --follow, we want the names of the ancestors of FILE in the
894 # --follow, we want the names of the ancestors of FILE in the
895 # revision, stored in "fcache". "fcache" is populated as a side effect
895 # revision, stored in "fcache". "fcache" is populated as a side effect
896 # of the graph traversal.
896 # of the graph traversal.
897 fcache = {}
897 fcache = {}
898
898
899 def filematcher(ctx):
899 def filematcher(ctx):
900 return scmutil.matchfiles(repo, fcache.get(scmutil.intrev(ctx), []))
900 return scmutil.matchfiles(repo, fcache.get(scmutil.intrev(ctx), []))
901
901
902 def revgen():
902 def revgen():
903 for rev, cs in dagop.filectxancestors(fctxs, followfirst=followfirst):
903 for rev, cs in dagop.filectxancestors(fctxs, followfirst=followfirst):
904 fcache[rev] = [c.path() for c in cs]
904 fcache[rev] = [c.path() for c in cs]
905 yield rev
905 yield rev
906
906
907 return smartset.generatorset(revgen(), iterasc=False), filematcher
907 return smartset.generatorset(revgen(), iterasc=False), filematcher
908
908
909
909
910 def _makenofollowfilematcher(repo, pats, opts):
910 def _makenofollowfilematcher(repo, pats, opts):
911 '''hook for extensions to override the filematcher for non-follow cases'''
911 '''hook for extensions to override the filematcher for non-follow cases'''
912 return None
912 return None
913
913
914
914
915 def revsingle(repo, revspec, default=b'.', localalias=None):
915 def revsingle(repo, revspec, default=b'.', localalias=None):
916 """Resolves user-provided revset(s) into a single revision.
916 """Resolves user-provided revset(s) into a single revision.
917
917
918 This just wraps the lower-level scmutil.revsingle() in order to raise an
918 This just wraps the lower-level scmutil.revsingle() in order to raise an
919 exception indicating user error.
919 exception indicating user error.
920 """
920 """
921 try:
921 try:
922 return scmutil.revsingle(repo, revspec, default, localalias)
922 return scmutil.revsingle(repo, revspec, default, localalias)
923 except error.RepoLookupError as e:
923 except error.RepoLookupError as e:
924 raise error.InputError(e.args[0], hint=e.hint)
924 raise error.InputError(e.args[0], hint=e.hint)
925
925
926
926
927 def revpair(repo, revs):
927 def revpair(repo, revs):
928 """Resolves user-provided revset(s) into two revisions.
928 """Resolves user-provided revset(s) into two revisions.
929
929
930 This just wraps the lower-level scmutil.revpair() in order to raise an
930 This just wraps the lower-level scmutil.revpair() in order to raise an
931 exception indicating user error.
931 exception indicating user error.
932 """
932 """
933 try:
933 try:
934 return scmutil.revpair(repo, revs)
934 return scmutil.revpair(repo, revs)
935 except error.RepoLookupError as e:
935 except error.RepoLookupError as e:
936 raise error.InputError(e.args[0], hint=e.hint)
936 raise error.InputError(e.args[0], hint=e.hint)
937
937
938
938
939 def revrange(repo, specs, localalias=None):
939 def revrange(repo, specs, localalias=None):
940 """Resolves user-provided revset(s).
940 """Resolves user-provided revset(s).
941
941
942 This just wraps the lower-level scmutil.revrange() in order to raise an
942 This just wraps the lower-level scmutil.revrange() in order to raise an
943 exception indicating user error.
943 exception indicating user error.
944 """
944 """
945 try:
945 try:
946 return scmutil.revrange(repo, specs, localalias)
946 return scmutil.revrange(repo, specs, localalias)
947 except error.RepoLookupError as e:
947 except error.RepoLookupError as e:
948 raise error.InputError(e.args[0], hint=e.hint)
948 raise error.InputError(e.args[0], hint=e.hint)
949
949
950
950
951 _opt2logrevset = {
951 _opt2logrevset = {
952 b'no_merges': (b'not merge()', None),
952 b'no_merges': (b'not merge()', None),
953 b'only_merges': (b'merge()', None),
953 b'only_merges': (b'merge()', None),
954 b'_matchfiles': (None, b'_matchfiles(%ps)'),
954 b'_matchfiles': (None, b'_matchfiles(%ps)'),
955 b'date': (b'date(%s)', None),
955 b'date': (b'date(%s)', None),
956 b'branch': (b'branch(%s)', b'%lr'),
956 b'branch': (b'branch(%s)', b'%lr'),
957 b'_patslog': (b'filelog(%s)', b'%lr'),
957 b'_patslog': (b'filelog(%s)', b'%lr'),
958 b'keyword': (b'keyword(%s)', b'%lr'),
958 b'keyword': (b'keyword(%s)', b'%lr'),
959 b'prune': (b'ancestors(%s)', b'not %lr'),
959 b'prune': (b'ancestors(%s)', b'not %lr'),
960 b'user': (b'user(%s)', b'%lr'),
960 b'user': (b'user(%s)', b'%lr'),
961 }
961 }
962
962
963
963
964 def _makerevset(repo, wopts, slowpath):
964 def _makerevset(repo, wopts, slowpath):
965 """Return a revset string built from log options and file patterns"""
965 """Return a revset string built from log options and file patterns"""
966 opts = {
966 opts = {
967 b'branch': [b'literal:' + repo.lookupbranch(b) for b in wopts.branches],
967 b'branch': [b'literal:' + repo.lookupbranch(b) for b in wopts.branches],
968 b'date': wopts.date,
968 b'date': wopts.date,
969 b'keyword': wopts.keywords,
969 b'keyword': wopts.keywords,
970 b'no_merges': wopts.no_merges,
970 b'no_merges': wopts.no_merges,
971 b'only_merges': wopts.only_merges,
971 b'only_merges': wopts.only_merges,
972 b'prune': wopts.prune_ancestors,
972 b'prune': wopts.prune_ancestors,
973 b'user': [b'literal:' + v for v in wopts.users],
973 b'user': [b'literal:' + v for v in wopts.users],
974 }
974 }
975
975
976 if wopts.filter_revisions_by_pats and slowpath:
976 if wopts.filter_revisions_by_pats and slowpath:
977 # pats/include/exclude cannot be represented as separate
977 # pats/include/exclude cannot be represented as separate
978 # revset expressions as their filtering logic applies at file
978 # revset expressions as their filtering logic applies at file
979 # level. For instance "-I a -X b" matches a revision touching
979 # level. For instance "-I a -X b" matches a revision touching
980 # "a" and "b" while "file(a) and not file(b)" does
980 # "a" and "b" while "file(a) and not file(b)" does
981 # not. Besides, filesets are evaluated against the working
981 # not. Besides, filesets are evaluated against the working
982 # directory.
982 # directory.
983 matchargs = [b'r:', b'd:relpath']
983 matchargs = [b'r:', b'd:relpath']
984 for p in wopts.pats:
984 for p in wopts.pats:
985 matchargs.append(b'p:' + p)
985 matchargs.append(b'p:' + p)
986 for p in wopts.include_pats:
986 for p in wopts.include_pats:
987 matchargs.append(b'i:' + p)
987 matchargs.append(b'i:' + p)
988 for p in wopts.exclude_pats:
988 for p in wopts.exclude_pats:
989 matchargs.append(b'x:' + p)
989 matchargs.append(b'x:' + p)
990 opts[b'_matchfiles'] = matchargs
990 opts[b'_matchfiles'] = matchargs
991 elif wopts.filter_revisions_by_pats and not wopts.follow:
991 elif wopts.filter_revisions_by_pats and not wopts.follow:
992 opts[b'_patslog'] = list(wopts.pats)
992 opts[b'_patslog'] = list(wopts.pats)
993
993
994 expr = []
994 expr = []
995 for op, val in sorted(pycompat.iteritems(opts)):
995 for op, val in sorted(pycompat.iteritems(opts)):
996 if not val:
996 if not val:
997 continue
997 continue
998 revop, listop = _opt2logrevset[op]
998 revop, listop = _opt2logrevset[op]
999 if revop and b'%' not in revop:
999 if revop and b'%' not in revop:
1000 expr.append(revop)
1000 expr.append(revop)
1001 elif not listop:
1001 elif not listop:
1002 expr.append(revsetlang.formatspec(revop, val))
1002 expr.append(revsetlang.formatspec(revop, val))
1003 else:
1003 else:
1004 if revop:
1004 if revop:
1005 val = [revsetlang.formatspec(revop, v) for v in val]
1005 val = [revsetlang.formatspec(revop, v) for v in val]
1006 expr.append(revsetlang.formatspec(listop, val))
1006 expr.append(revsetlang.formatspec(listop, val))
1007
1007
1008 if wopts.bookmarks:
1008 if wopts.bookmarks:
1009 expr.append(
1009 expr.append(
1010 revsetlang.formatspec(
1010 revsetlang.formatspec(
1011 b'%lr',
1011 b'%lr',
1012 [scmutil.format_bookmark_revspec(v) for v in wopts.bookmarks],
1012 [scmutil.format_bookmark_revspec(v) for v in wopts.bookmarks],
1013 )
1013 )
1014 )
1014 )
1015
1015
1016 if expr:
1016 if expr:
1017 expr = b'(' + b' and '.join(expr) + b')'
1017 expr = b'(' + b' and '.join(expr) + b')'
1018 else:
1018 else:
1019 expr = None
1019 expr = None
1020 return expr
1020 return expr
1021
1021
1022
1022
1023 def _initialrevs(repo, wopts):
1023 def _initialrevs(repo, wopts):
1024 """Return the initial set of revisions to be filtered or followed"""
1024 """Return the initial set of revisions to be filtered or followed"""
1025 if wopts.revspec:
1025 if wopts.revspec:
1026 revs = revrange(repo, wopts.revspec)
1026 revs = revrange(repo, wopts.revspec)
1027 elif wopts.follow and repo.dirstate.p1() == repo.nullid:
1027 elif wopts.follow and repo.dirstate.p1() == repo.nullid:
1028 revs = smartset.baseset()
1028 revs = smartset.baseset()
1029 elif wopts.follow:
1029 elif wopts.follow:
1030 revs = repo.revs(b'.')
1030 revs = repo.revs(b'.')
1031 else:
1031 else:
1032 revs = smartset.spanset(repo)
1032 revs = smartset.spanset(repo)
1033 revs.reverse()
1033 revs.reverse()
1034 return revs
1034 return revs
1035
1035
1036
1036
1037 def makewalker(repo, wopts):
1037 def makewalker(repo, wopts):
1038 # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]]
1038 # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[Callable[[Any], matchmod.basematcher]]]
1039 """Build (revs, makefilematcher) to scan revision/file history
1039 """Build (revs, makefilematcher) to scan revision/file history
1040
1040
1041 - revs is the smartset to be traversed.
1041 - revs is the smartset to be traversed.
1042 - makefilematcher is a function to map ctx to a matcher for that revision
1042 - makefilematcher is a function to map ctx to a matcher for that revision
1043 """
1043 """
1044 revs = _initialrevs(repo, wopts)
1044 revs = _initialrevs(repo, wopts)
1045 if not revs:
1045 if not revs:
1046 return smartset.baseset(), None
1046 return smartset.baseset(), None
1047 # TODO: might want to merge slowpath with wopts.force_changelog_traversal
1047 # TODO: might want to merge slowpath with wopts.force_changelog_traversal
1048 match, pats, slowpath = _makematcher(repo, revs, wopts)
1048 match, pats, slowpath = _makematcher(repo, revs, wopts)
1049 wopts = attr.evolve(wopts, pats=pats)
1049 wopts = attr.evolve(wopts, pats=pats)
1050
1050
1051 filematcher = None
1051 filematcher = None
1052 if wopts.follow:
1052 if wopts.follow:
1053 if slowpath or match.always():
1053 if slowpath or match.always():
1054 revs = dagop.revancestors(repo, revs, followfirst=wopts.follow == 1)
1054 revs = dagop.revancestors(repo, revs, followfirst=wopts.follow == 1)
1055 else:
1055 else:
1056 assert not wopts.force_changelog_traversal
1056 assert not wopts.force_changelog_traversal
1057 revs, filematcher = _fileancestors(
1057 revs, filematcher = _fileancestors(
1058 repo, revs, match, followfirst=wopts.follow == 1
1058 repo, revs, match, followfirst=wopts.follow == 1
1059 )
1059 )
1060 revs.reverse()
1060 revs.reverse()
1061 if filematcher is None:
1061 if filematcher is None:
1062 filematcher = _makenofollowfilematcher(repo, wopts.pats, wopts.opts)
1062 filematcher = _makenofollowfilematcher(repo, wopts.pats, wopts.opts)
1063 if filematcher is None:
1063 if filematcher is None:
1064
1064
1065 def filematcher(ctx):
1065 def filematcher(ctx):
1066 return match
1066 return match
1067
1067
1068 expr = _makerevset(repo, wopts, slowpath)
1068 expr = _makerevset(repo, wopts, slowpath)
1069 if wopts.sort_revisions:
1069 if wopts.sort_revisions:
1070 assert wopts.sort_revisions in {b'topo', b'desc'}
1070 assert wopts.sort_revisions in {b'topo', b'desc'}
1071 if wopts.sort_revisions == b'topo':
1071 if wopts.sort_revisions == b'topo':
1072 if not revs.istopo():
1072 if not revs.istopo():
1073 revs = dagop.toposort(revs, repo.changelog.parentrevs)
1073 revs = dagop.toposort(revs, repo.changelog.parentrevs)
1074 # TODO: try to iterate the set lazily
1074 # TODO: try to iterate the set lazily
1075 revs = revset.baseset(list(revs), istopo=True)
1075 revs = revset.baseset(list(revs), istopo=True)
1076 elif not (revs.isdescending() or revs.istopo()):
1076 elif not (revs.isdescending() or revs.istopo()):
1077 # User-specified revs might be unsorted
1077 # User-specified revs might be unsorted
1078 revs.sort(reverse=True)
1078 revs.sort(reverse=True)
1079 if expr:
1079 if expr:
1080 matcher = revset.match(None, expr)
1080 matcher = revset.match(None, expr)
1081 revs = matcher(repo, revs)
1081 revs = matcher(repo, revs)
1082 if wopts.limit is not None:
1082 if wopts.limit is not None:
1083 revs = revs.slice(0, wopts.limit)
1083 revs = revs.slice(0, wopts.limit)
1084
1084
1085 return revs, filematcher
1085 return revs, filematcher
1086
1086
1087
1087
1088 def getrevs(repo, wopts):
1088 def getrevs(repo, wopts):
1089 # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]
1089 # type: (Any, walkopts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]]
1090 """Return (revs, differ) where revs is a smartset
1090 """Return (revs, differ) where revs is a smartset
1091
1091
1092 differ is a changesetdiffer with pre-configured file matcher.
1092 differ is a changesetdiffer with pre-configured file matcher.
1093 """
1093 """
1094 revs, filematcher = makewalker(repo, wopts)
1094 revs, filematcher = makewalker(repo, wopts)
1095 if not revs:
1095 if not revs:
1096 return revs, None
1096 return revs, None
1097 differ = changesetdiffer()
1097 differ = changesetdiffer()
1098 differ._makefilematcher = filematcher
1098 differ._makefilematcher = filematcher
1099 return revs, differ
1099 return revs, differ
1100
1100
1101
1101
1102 def _parselinerangeopt(repo, opts):
1102 def _parselinerangeopt(repo, opts):
1103 """Parse --line-range log option and return a list of tuples (filename,
1103 """Parse --line-range log option and return a list of tuples (filename,
1104 (fromline, toline)).
1104 (fromline, toline)).
1105 """
1105 """
1106 linerangebyfname = []
1106 linerangebyfname = []
1107 for pat in opts.get(b'line_range', []):
1107 for pat in opts.get(b'line_range', []):
1108 try:
1108 try:
1109 pat, linerange = pat.rsplit(b',', 1)
1109 pat, linerange = pat.rsplit(b',', 1)
1110 except ValueError:
1110 except ValueError:
1111 raise error.InputError(
1111 raise error.InputError(
1112 _(b'malformatted line-range pattern %s') % pat
1112 _(b'malformatted line-range pattern %s') % pat
1113 )
1113 )
1114 try:
1114 try:
1115 fromline, toline = map(int, linerange.split(b':'))
1115 fromline, toline = map(int, linerange.split(b':'))
1116 except ValueError:
1116 except ValueError:
1117 raise error.InputError(_(b"invalid line range for %s") % pat)
1117 raise error.InputError(_(b"invalid line range for %s") % pat)
1118 msg = _(b"line range pattern '%s' must match exactly one file") % pat
1118 msg = _(b"line range pattern '%s' must match exactly one file") % pat
1119 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
1119 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
1120 linerangebyfname.append(
1120 linerangebyfname.append(
1121 (fname, util.processlinerange(fromline, toline))
1121 (fname, util.processlinerange(fromline, toline))
1122 )
1122 )
1123 return linerangebyfname
1123 return linerangebyfname
1124
1124
1125
1125
1126 def getlinerangerevs(repo, userrevs, opts):
1126 def getlinerangerevs(repo, userrevs, opts):
1127 """Return (revs, differ).
1127 """Return (revs, differ).
1128
1128
1129 "revs" are revisions obtained by processing "line-range" log options and
1129 "revs" are revisions obtained by processing "line-range" log options and
1130 walking block ancestors of each specified file/line-range.
1130 walking block ancestors of each specified file/line-range.
1131
1131
1132 "differ" is a changesetdiffer with pre-configured file matcher and hunks
1132 "differ" is a changesetdiffer with pre-configured file matcher and hunks
1133 filter.
1133 filter.
1134 """
1134 """
1135 wctx = repo[None]
1135 wctx = repo[None]
1136
1136
1137 # Two-levels map of "rev -> file ctx -> [line range]".
1137 # Two-levels map of "rev -> file ctx -> [line range]".
1138 linerangesbyrev = {}
1138 linerangesbyrev = {}
1139 for fname, (fromline, toline) in _parselinerangeopt(repo, opts):
1139 for fname, (fromline, toline) in _parselinerangeopt(repo, opts):
1140 if fname not in wctx:
1140 if fname not in wctx:
1141 raise error.Abort(
1141 raise error.StateError(
1142 _(b'cannot follow file not in parent revision: "%s"') % fname
1142 _(b'cannot follow file not in parent revision: "%s"') % fname
1143 )
1143 )
1144 fctx = wctx.filectx(fname)
1144 fctx = wctx.filectx(fname)
1145 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
1145 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
1146 rev = fctx.introrev()
1146 rev = fctx.introrev()
1147 if rev is None:
1147 if rev is None:
1148 rev = wdirrev
1148 rev = wdirrev
1149 if rev not in userrevs:
1149 if rev not in userrevs:
1150 continue
1150 continue
1151 linerangesbyrev.setdefault(rev, {}).setdefault(
1151 linerangesbyrev.setdefault(rev, {}).setdefault(
1152 fctx.path(), []
1152 fctx.path(), []
1153 ).append(linerange)
1153 ).append(linerange)
1154
1154
1155 def nofilterhunksfn(fctx, hunks):
1155 def nofilterhunksfn(fctx, hunks):
1156 return hunks
1156 return hunks
1157
1157
1158 def hunksfilter(ctx):
1158 def hunksfilter(ctx):
1159 fctxlineranges = linerangesbyrev.get(scmutil.intrev(ctx))
1159 fctxlineranges = linerangesbyrev.get(scmutil.intrev(ctx))
1160 if fctxlineranges is None:
1160 if fctxlineranges is None:
1161 return nofilterhunksfn
1161 return nofilterhunksfn
1162
1162
1163 def filterfn(fctx, hunks):
1163 def filterfn(fctx, hunks):
1164 lineranges = fctxlineranges.get(fctx.path())
1164 lineranges = fctxlineranges.get(fctx.path())
1165 if lineranges is not None:
1165 if lineranges is not None:
1166 for hr, lines in hunks:
1166 for hr, lines in hunks:
1167 if hr is None: # binary
1167 if hr is None: # binary
1168 yield hr, lines
1168 yield hr, lines
1169 continue
1169 continue
1170 if any(mdiff.hunkinrange(hr[2:], lr) for lr in lineranges):
1170 if any(mdiff.hunkinrange(hr[2:], lr) for lr in lineranges):
1171 yield hr, lines
1171 yield hr, lines
1172 else:
1172 else:
1173 for hunk in hunks:
1173 for hunk in hunks:
1174 yield hunk
1174 yield hunk
1175
1175
1176 return filterfn
1176 return filterfn
1177
1177
1178 def filematcher(ctx):
1178 def filematcher(ctx):
1179 files = list(linerangesbyrev.get(scmutil.intrev(ctx), []))
1179 files = list(linerangesbyrev.get(scmutil.intrev(ctx), []))
1180 return scmutil.matchfiles(repo, files)
1180 return scmutil.matchfiles(repo, files)
1181
1181
1182 revs = sorted(linerangesbyrev, reverse=True)
1182 revs = sorted(linerangesbyrev, reverse=True)
1183
1183
1184 differ = changesetdiffer()
1184 differ = changesetdiffer()
1185 differ._makefilematcher = filematcher
1185 differ._makefilematcher = filematcher
1186 differ._makehunksfilter = hunksfilter
1186 differ._makehunksfilter = hunksfilter
1187 return smartset.baseset(revs), differ
1187 return smartset.baseset(revs), differ
1188
1188
1189
1189
1190 def _graphnodeformatter(ui, displayer):
1190 def _graphnodeformatter(ui, displayer):
1191 spec = ui.config(b'command-templates', b'graphnode')
1191 spec = ui.config(b'command-templates', b'graphnode')
1192 if not spec:
1192 if not spec:
1193 return templatekw.getgraphnode # fast path for "{graphnode}"
1193 return templatekw.getgraphnode # fast path for "{graphnode}"
1194
1194
1195 spec = templater.unquotestring(spec)
1195 spec = templater.unquotestring(spec)
1196 if isinstance(displayer, changesettemplater):
1196 if isinstance(displayer, changesettemplater):
1197 # reuse cache of slow templates
1197 # reuse cache of slow templates
1198 tres = displayer._tresources
1198 tres = displayer._tresources
1199 else:
1199 else:
1200 tres = formatter.templateresources(ui)
1200 tres = formatter.templateresources(ui)
1201 templ = formatter.maketemplater(
1201 templ = formatter.maketemplater(
1202 ui, spec, defaults=templatekw.keywords, resources=tres
1202 ui, spec, defaults=templatekw.keywords, resources=tres
1203 )
1203 )
1204
1204
1205 def formatnode(repo, ctx, cache):
1205 def formatnode(repo, ctx, cache):
1206 props = {b'ctx': ctx, b'repo': repo}
1206 props = {b'ctx': ctx, b'repo': repo}
1207 return templ.renderdefault(props)
1207 return templ.renderdefault(props)
1208
1208
1209 return formatnode
1209 return formatnode
1210
1210
1211
1211
1212 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None):
1212 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None):
1213 props = props or {}
1213 props = props or {}
1214 formatnode = _graphnodeformatter(ui, displayer)
1214 formatnode = _graphnodeformatter(ui, displayer)
1215 state = graphmod.asciistate()
1215 state = graphmod.asciistate()
1216 styles = state.styles
1216 styles = state.styles
1217
1217
1218 # only set graph styling if HGPLAIN is not set.
1218 # only set graph styling if HGPLAIN is not set.
1219 if ui.plain(b'graph'):
1219 if ui.plain(b'graph'):
1220 # set all edge styles to |, the default pre-3.8 behaviour
1220 # set all edge styles to |, the default pre-3.8 behaviour
1221 styles.update(dict.fromkeys(styles, b'|'))
1221 styles.update(dict.fromkeys(styles, b'|'))
1222 else:
1222 else:
1223 edgetypes = {
1223 edgetypes = {
1224 b'parent': graphmod.PARENT,
1224 b'parent': graphmod.PARENT,
1225 b'grandparent': graphmod.GRANDPARENT,
1225 b'grandparent': graphmod.GRANDPARENT,
1226 b'missing': graphmod.MISSINGPARENT,
1226 b'missing': graphmod.MISSINGPARENT,
1227 }
1227 }
1228 for name, key in edgetypes.items():
1228 for name, key in edgetypes.items():
1229 # experimental config: experimental.graphstyle.*
1229 # experimental config: experimental.graphstyle.*
1230 styles[key] = ui.config(
1230 styles[key] = ui.config(
1231 b'experimental', b'graphstyle.%s' % name, styles[key]
1231 b'experimental', b'graphstyle.%s' % name, styles[key]
1232 )
1232 )
1233 if not styles[key]:
1233 if not styles[key]:
1234 styles[key] = None
1234 styles[key] = None
1235
1235
1236 # experimental config: experimental.graphshorten
1236 # experimental config: experimental.graphshorten
1237 state.graphshorten = ui.configbool(b'experimental', b'graphshorten')
1237 state.graphshorten = ui.configbool(b'experimental', b'graphshorten')
1238
1238
1239 formatnode_cache = {}
1239 formatnode_cache = {}
1240 for rev, type, ctx, parents in dag:
1240 for rev, type, ctx, parents in dag:
1241 char = formatnode(repo, ctx, formatnode_cache)
1241 char = formatnode(repo, ctx, formatnode_cache)
1242 copies = getcopies(ctx) if getcopies else None
1242 copies = getcopies(ctx) if getcopies else None
1243 edges = edgefn(type, char, state, rev, parents)
1243 edges = edgefn(type, char, state, rev, parents)
1244 firstedge = next(edges)
1244 firstedge = next(edges)
1245 width = firstedge[2]
1245 width = firstedge[2]
1246 displayer.show(
1246 displayer.show(
1247 ctx, copies=copies, graphwidth=width, **pycompat.strkwargs(props)
1247 ctx, copies=copies, graphwidth=width, **pycompat.strkwargs(props)
1248 )
1248 )
1249 lines = displayer.hunk.pop(rev).split(b'\n')
1249 lines = displayer.hunk.pop(rev).split(b'\n')
1250 if not lines[-1]:
1250 if not lines[-1]:
1251 del lines[-1]
1251 del lines[-1]
1252 displayer.flush(ctx)
1252 displayer.flush(ctx)
1253 for type, char, width, coldata in itertools.chain([firstedge], edges):
1253 for type, char, width, coldata in itertools.chain([firstedge], edges):
1254 graphmod.ascii(ui, state, type, char, lines, coldata)
1254 graphmod.ascii(ui, state, type, char, lines, coldata)
1255 lines = []
1255 lines = []
1256 displayer.close()
1256 displayer.close()
1257
1257
1258
1258
1259 def displaygraphrevs(ui, repo, revs, displayer, getrenamed):
1259 def displaygraphrevs(ui, repo, revs, displayer, getrenamed):
1260 revdag = graphmod.dagwalker(repo, revs)
1260 revdag = graphmod.dagwalker(repo, revs)
1261 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed)
1261 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed)
1262
1262
1263
1263
1264 def displayrevs(ui, repo, revs, displayer, getcopies):
1264 def displayrevs(ui, repo, revs, displayer, getcopies):
1265 for rev in revs:
1265 for rev in revs:
1266 ctx = repo[rev]
1266 ctx = repo[rev]
1267 copies = getcopies(ctx) if getcopies else None
1267 copies = getcopies(ctx) if getcopies else None
1268 displayer.show(ctx, copies=copies)
1268 displayer.show(ctx, copies=copies)
1269 displayer.flush(ctx)
1269 displayer.flush(ctx)
1270 displayer.close()
1270 displayer.close()
1271
1271
1272
1272
1273 def checkunsupportedgraphflags(pats, opts):
1273 def checkunsupportedgraphflags(pats, opts):
1274 for op in [b"newest_first"]:
1274 for op in [b"newest_first"]:
1275 if op in opts and opts[op]:
1275 if op in opts and opts[op]:
1276 raise error.InputError(
1276 raise error.InputError(
1277 _(b"-G/--graph option is incompatible with --%s")
1277 _(b"-G/--graph option is incompatible with --%s")
1278 % op.replace(b"_", b"-")
1278 % op.replace(b"_", b"-")
1279 )
1279 )
1280
1280
1281
1281
1282 def graphrevs(repo, nodes, opts):
1282 def graphrevs(repo, nodes, opts):
1283 limit = getlimit(opts)
1283 limit = getlimit(opts)
1284 nodes.reverse()
1284 nodes.reverse()
1285 if limit is not None:
1285 if limit is not None:
1286 nodes = nodes[:limit]
1286 nodes = nodes[:limit]
1287 return graphmod.nodes(repo, nodes)
1287 return graphmod.nodes(repo, nodes)
@@ -1,1464 +1,1464 b''
1 $ hg init t
1 $ hg init t
2 $ cd t
2 $ cd t
3 $ echo import > port
3 $ echo import > port
4 $ hg add port
4 $ hg add port
5 $ hg commit -m 0 -u spam -d '0 0'
5 $ hg commit -m 0 -u spam -d '0 0'
6 $ echo export >> port
6 $ echo export >> port
7 $ hg commit -m 1 -u eggs -d '1 0'
7 $ hg commit -m 1 -u eggs -d '1 0'
8 $ echo export > port
8 $ echo export > port
9 $ echo vaportight >> port
9 $ echo vaportight >> port
10 $ echo 'import/export' >> port
10 $ echo 'import/export' >> port
11 $ hg commit -m 2 -u spam -d '2 0'
11 $ hg commit -m 2 -u spam -d '2 0'
12 $ echo 'import/export' >> port
12 $ echo 'import/export' >> port
13 $ hg commit -m 3 -u eggs -d '3 0'
13 $ hg commit -m 3 -u eggs -d '3 0'
14 $ head -n 3 port > port1
14 $ head -n 3 port > port1
15 $ mv port1 port
15 $ mv port1 port
16 $ hg commit -m 4 -u spam -d '4 0'
16 $ hg commit -m 4 -u spam -d '4 0'
17
17
18 pattern error
18 pattern error
19
19
20 $ hg grep '**test**'
20 $ hg grep '**test**'
21 grep: invalid match pattern: nothing to repeat* (glob)
21 grep: invalid match pattern: nothing to repeat* (glob)
22 [1]
22 [1]
23
23
24 invalid revset syntax
24 invalid revset syntax
25
25
26 $ hg log -r 'diffcontains()'
26 $ hg log -r 'diffcontains()'
27 hg: parse error: diffcontains takes at least 1 argument
27 hg: parse error: diffcontains takes at least 1 argument
28 [10]
28 [10]
29 $ hg log -r 'diffcontains(:)'
29 $ hg log -r 'diffcontains(:)'
30 hg: parse error: diffcontains requires a string pattern
30 hg: parse error: diffcontains requires a string pattern
31 [10]
31 [10]
32 $ hg log -r 'diffcontains("re:**test**")'
32 $ hg log -r 'diffcontains("re:**test**")'
33 hg: parse error: invalid regular expression: nothing to repeat* (glob)
33 hg: parse error: invalid regular expression: nothing to repeat* (glob)
34 [10]
34 [10]
35
35
36 simple
36 simple
37
37
38 $ hg grep -r tip:0 '.*'
38 $ hg grep -r tip:0 '.*'
39 port:4:export
39 port:4:export
40 port:4:vaportight
40 port:4:vaportight
41 port:4:import/export
41 port:4:import/export
42 port:3:export
42 port:3:export
43 port:3:vaportight
43 port:3:vaportight
44 port:3:import/export
44 port:3:import/export
45 port:3:import/export
45 port:3:import/export
46 port:2:export
46 port:2:export
47 port:2:vaportight
47 port:2:vaportight
48 port:2:import/export
48 port:2:import/export
49 port:1:import
49 port:1:import
50 port:1:export
50 port:1:export
51 port:0:import
51 port:0:import
52 $ hg grep -r tip:0 port port
52 $ hg grep -r tip:0 port port
53 port:4:export
53 port:4:export
54 port:4:vaportight
54 port:4:vaportight
55 port:4:import/export
55 port:4:import/export
56 port:3:export
56 port:3:export
57 port:3:vaportight
57 port:3:vaportight
58 port:3:import/export
58 port:3:import/export
59 port:3:import/export
59 port:3:import/export
60 port:2:export
60 port:2:export
61 port:2:vaportight
61 port:2:vaportight
62 port:2:import/export
62 port:2:import/export
63 port:1:import
63 port:1:import
64 port:1:export
64 port:1:export
65 port:0:import
65 port:0:import
66
66
67 simple from subdirectory
67 simple from subdirectory
68
68
69 $ mkdir dir
69 $ mkdir dir
70 $ cd dir
70 $ cd dir
71 $ hg grep -r tip:0 port
71 $ hg grep -r tip:0 port
72 port:4:export
72 port:4:export
73 port:4:vaportight
73 port:4:vaportight
74 port:4:import/export
74 port:4:import/export
75 port:3:export
75 port:3:export
76 port:3:vaportight
76 port:3:vaportight
77 port:3:import/export
77 port:3:import/export
78 port:3:import/export
78 port:3:import/export
79 port:2:export
79 port:2:export
80 port:2:vaportight
80 port:2:vaportight
81 port:2:import/export
81 port:2:import/export
82 port:1:import
82 port:1:import
83 port:1:export
83 port:1:export
84 port:0:import
84 port:0:import
85 $ hg grep -r tip:0 port --config ui.relative-paths=yes
85 $ hg grep -r tip:0 port --config ui.relative-paths=yes
86 ../port:4:export
86 ../port:4:export
87 ../port:4:vaportight
87 ../port:4:vaportight
88 ../port:4:import/export
88 ../port:4:import/export
89 ../port:3:export
89 ../port:3:export
90 ../port:3:vaportight
90 ../port:3:vaportight
91 ../port:3:import/export
91 ../port:3:import/export
92 ../port:3:import/export
92 ../port:3:import/export
93 ../port:2:export
93 ../port:2:export
94 ../port:2:vaportight
94 ../port:2:vaportight
95 ../port:2:import/export
95 ../port:2:import/export
96 ../port:1:import
96 ../port:1:import
97 ../port:1:export
97 ../port:1:export
98 ../port:0:import
98 ../port:0:import
99 $ cd ..
99 $ cd ..
100
100
101 simple with color
101 simple with color
102
102
103 $ hg --config extensions.color= grep --config color.mode=ansi \
103 $ hg --config extensions.color= grep --config color.mode=ansi \
104 > --color=always port port -r tip:0
104 > --color=always port port -r tip:0
105 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
105 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
106 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
106 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
107 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
107 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
108 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
108 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
109 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
109 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
110 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
110 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
111 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
111 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
112 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
112 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
113 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
113 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
114 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
114 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
115 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
115 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
116 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
116 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
117 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m0\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
117 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m0\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m (esc)
118
118
119 simple templated
119 simple templated
120
120
121 $ hg grep port -r tip:0 \
121 $ hg grep port -r tip:0 \
122 > -T '{path}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n'
122 > -T '{path}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n'
123 port:4:914fa752cdea:exPORT
123 port:4:914fa752cdea:exPORT
124 port:4:914fa752cdea:vaPORTight
124 port:4:914fa752cdea:vaPORTight
125 port:4:914fa752cdea:imPORT/exPORT
125 port:4:914fa752cdea:imPORT/exPORT
126 port:3:95040cfd017d:exPORT
126 port:3:95040cfd017d:exPORT
127 port:3:95040cfd017d:vaPORTight
127 port:3:95040cfd017d:vaPORTight
128 port:3:95040cfd017d:imPORT/exPORT
128 port:3:95040cfd017d:imPORT/exPORT
129 port:3:95040cfd017d:imPORT/exPORT
129 port:3:95040cfd017d:imPORT/exPORT
130 port:2:3b325e3481a1:exPORT
130 port:2:3b325e3481a1:exPORT
131 port:2:3b325e3481a1:vaPORTight
131 port:2:3b325e3481a1:vaPORTight
132 port:2:3b325e3481a1:imPORT/exPORT
132 port:2:3b325e3481a1:imPORT/exPORT
133 port:1:8b20f75c1585:imPORT
133 port:1:8b20f75c1585:imPORT
134 port:1:8b20f75c1585:exPORT
134 port:1:8b20f75c1585:exPORT
135 port:0:f31323c92170:imPORT
135 port:0:f31323c92170:imPORT
136
136
137 $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
137 $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
138 port:4:export
138 port:4:export
139 port:4:vaportight
139 port:4:vaportight
140 port:4:import/export
140 port:4:import/export
141 port:3:export
141 port:3:export
142 port:3:vaportight
142 port:3:vaportight
143 port:3:import/export
143 port:3:import/export
144 port:3:import/export
144 port:3:import/export
145 port:2:export
145 port:2:export
146 port:2:vaportight
146 port:2:vaportight
147 port:2:import/export
147 port:2:import/export
148 port:1:import
148 port:1:import
149 port:1:export
149 port:1:export
150 port:0:import
150 port:0:import
151
151
152 $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
152 $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
153 port:tip:export
153 port:tip:export
154 port:tip:vaportight
154 port:tip:vaportight
155 port:tip:import/export
155 port:tip:import/export
156 port::export
156 port::export
157 port::vaportight
157 port::vaportight
158 port::import/export
158 port::import/export
159 port::import/export
159 port::import/export
160 port::export
160 port::export
161 port::vaportight
161 port::vaportight
162 port::import/export
162 port::import/export
163 port::import
163 port::import
164 port::export
164 port::export
165 port::import
165 port::import
166
166
167 simple JSON (no "change" field)
167 simple JSON (no "change" field)
168
168
169 $ hg grep -r tip:0 -Tjson port
169 $ hg grep -r tip:0 -Tjson port
170 [
170 [
171 {
171 {
172 "date": [4, 0],
172 "date": [4, 0],
173 "lineno": 1,
173 "lineno": 1,
174 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
174 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
175 "path": "port",
175 "path": "port",
176 "rev": 4,
176 "rev": 4,
177 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
177 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
178 "user": "spam"
178 "user": "spam"
179 },
179 },
180 {
180 {
181 "date": [4, 0],
181 "date": [4, 0],
182 "lineno": 2,
182 "lineno": 2,
183 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
183 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
184 "path": "port",
184 "path": "port",
185 "rev": 4,
185 "rev": 4,
186 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
186 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
187 "user": "spam"
187 "user": "spam"
188 },
188 },
189 {
189 {
190 "date": [4, 0],
190 "date": [4, 0],
191 "lineno": 3,
191 "lineno": 3,
192 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
192 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
193 "path": "port",
193 "path": "port",
194 "rev": 4,
194 "rev": 4,
195 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
195 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
196 "user": "spam"
196 "user": "spam"
197 },
197 },
198 {
198 {
199 "date": [3, 0],
199 "date": [3, 0],
200 "lineno": 1,
200 "lineno": 1,
201 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
201 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
202 "path": "port",
202 "path": "port",
203 "rev": 3,
203 "rev": 3,
204 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
204 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
205 "user": "eggs"
205 "user": "eggs"
206 },
206 },
207 {
207 {
208 "date": [3, 0],
208 "date": [3, 0],
209 "lineno": 2,
209 "lineno": 2,
210 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
210 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
211 "path": "port",
211 "path": "port",
212 "rev": 3,
212 "rev": 3,
213 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
213 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
214 "user": "eggs"
214 "user": "eggs"
215 },
215 },
216 {
216 {
217 "date": [3, 0],
217 "date": [3, 0],
218 "lineno": 3,
218 "lineno": 3,
219 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
219 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
220 "path": "port",
220 "path": "port",
221 "rev": 3,
221 "rev": 3,
222 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
222 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
223 "user": "eggs"
223 "user": "eggs"
224 },
224 },
225 {
225 {
226 "date": [3, 0],
226 "date": [3, 0],
227 "lineno": 4,
227 "lineno": 4,
228 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
228 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
229 "path": "port",
229 "path": "port",
230 "rev": 3,
230 "rev": 3,
231 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
231 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
232 "user": "eggs"
232 "user": "eggs"
233 },
233 },
234 {
234 {
235 "date": [2, 0],
235 "date": [2, 0],
236 "lineno": 1,
236 "lineno": 1,
237 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
237 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
238 "path": "port",
238 "path": "port",
239 "rev": 2,
239 "rev": 2,
240 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
240 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
241 "user": "spam"
241 "user": "spam"
242 },
242 },
243 {
243 {
244 "date": [2, 0],
244 "date": [2, 0],
245 "lineno": 2,
245 "lineno": 2,
246 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
246 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
247 "path": "port",
247 "path": "port",
248 "rev": 2,
248 "rev": 2,
249 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
249 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
250 "user": "spam"
250 "user": "spam"
251 },
251 },
252 {
252 {
253 "date": [2, 0],
253 "date": [2, 0],
254 "lineno": 3,
254 "lineno": 3,
255 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
255 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
256 "path": "port",
256 "path": "port",
257 "rev": 2,
257 "rev": 2,
258 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
258 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
259 "user": "spam"
259 "user": "spam"
260 },
260 },
261 {
261 {
262 "date": [1, 0],
262 "date": [1, 0],
263 "lineno": 1,
263 "lineno": 1,
264 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
264 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
265 "path": "port",
265 "path": "port",
266 "rev": 1,
266 "rev": 1,
267 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
267 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
268 "user": "eggs"
268 "user": "eggs"
269 },
269 },
270 {
270 {
271 "date": [1, 0],
271 "date": [1, 0],
272 "lineno": 2,
272 "lineno": 2,
273 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
273 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
274 "path": "port",
274 "path": "port",
275 "rev": 1,
275 "rev": 1,
276 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
276 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
277 "user": "eggs"
277 "user": "eggs"
278 },
278 },
279 {
279 {
280 "date": [0, 0],
280 "date": [0, 0],
281 "lineno": 1,
281 "lineno": 1,
282 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
282 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
283 "path": "port",
283 "path": "port",
284 "rev": 0,
284 "rev": 0,
285 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
285 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
286 "user": "spam"
286 "user": "spam"
287 }
287 }
288 ]
288 ]
289
289
290 simple JSON without matching lines
290 simple JSON without matching lines
291
291
292 $ hg grep -r tip:0 -Tjson -l port
292 $ hg grep -r tip:0 -Tjson -l port
293 [
293 [
294 {
294 {
295 "date": [4, 0],
295 "date": [4, 0],
296 "lineno": 1,
296 "lineno": 1,
297 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
297 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
298 "path": "port",
298 "path": "port",
299 "rev": 4,
299 "rev": 4,
300 "user": "spam"
300 "user": "spam"
301 },
301 },
302 {
302 {
303 "date": [3, 0],
303 "date": [3, 0],
304 "lineno": 1,
304 "lineno": 1,
305 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
305 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
306 "path": "port",
306 "path": "port",
307 "rev": 3,
307 "rev": 3,
308 "user": "eggs"
308 "user": "eggs"
309 },
309 },
310 {
310 {
311 "date": [2, 0],
311 "date": [2, 0],
312 "lineno": 1,
312 "lineno": 1,
313 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
313 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
314 "path": "port",
314 "path": "port",
315 "rev": 2,
315 "rev": 2,
316 "user": "spam"
316 "user": "spam"
317 },
317 },
318 {
318 {
319 "date": [1, 0],
319 "date": [1, 0],
320 "lineno": 1,
320 "lineno": 1,
321 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
321 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
322 "path": "port",
322 "path": "port",
323 "rev": 1,
323 "rev": 1,
324 "user": "eggs"
324 "user": "eggs"
325 },
325 },
326 {
326 {
327 "date": [0, 0],
327 "date": [0, 0],
328 "lineno": 1,
328 "lineno": 1,
329 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
329 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
330 "path": "port",
330 "path": "port",
331 "rev": 0,
331 "rev": 0,
332 "user": "spam"
332 "user": "spam"
333 }
333 }
334 ]
334 ]
335
335
336 diff of each revision for reference
336 diff of each revision for reference
337
337
338 $ hg log -p -T'== rev: {rev} ==\n'
338 $ hg log -p -T'== rev: {rev} ==\n'
339 == rev: 4 ==
339 == rev: 4 ==
340 diff -r 95040cfd017d -r 914fa752cdea port
340 diff -r 95040cfd017d -r 914fa752cdea port
341 --- a/port Thu Jan 01 00:00:03 1970 +0000
341 --- a/port Thu Jan 01 00:00:03 1970 +0000
342 +++ b/port Thu Jan 01 00:00:04 1970 +0000
342 +++ b/port Thu Jan 01 00:00:04 1970 +0000
343 @@ -1,4 +1,3 @@
343 @@ -1,4 +1,3 @@
344 export
344 export
345 vaportight
345 vaportight
346 import/export
346 import/export
347 -import/export
347 -import/export
348
348
349 == rev: 3 ==
349 == rev: 3 ==
350 diff -r 3b325e3481a1 -r 95040cfd017d port
350 diff -r 3b325e3481a1 -r 95040cfd017d port
351 --- a/port Thu Jan 01 00:00:02 1970 +0000
351 --- a/port Thu Jan 01 00:00:02 1970 +0000
352 +++ b/port Thu Jan 01 00:00:03 1970 +0000
352 +++ b/port Thu Jan 01 00:00:03 1970 +0000
353 @@ -1,3 +1,4 @@
353 @@ -1,3 +1,4 @@
354 export
354 export
355 vaportight
355 vaportight
356 import/export
356 import/export
357 +import/export
357 +import/export
358
358
359 == rev: 2 ==
359 == rev: 2 ==
360 diff -r 8b20f75c1585 -r 3b325e3481a1 port
360 diff -r 8b20f75c1585 -r 3b325e3481a1 port
361 --- a/port Thu Jan 01 00:00:01 1970 +0000
361 --- a/port Thu Jan 01 00:00:01 1970 +0000
362 +++ b/port Thu Jan 01 00:00:02 1970 +0000
362 +++ b/port Thu Jan 01 00:00:02 1970 +0000
363 @@ -1,2 +1,3 @@
363 @@ -1,2 +1,3 @@
364 -import
364 -import
365 export
365 export
366 +vaportight
366 +vaportight
367 +import/export
367 +import/export
368
368
369 == rev: 1 ==
369 == rev: 1 ==
370 diff -r f31323c92170 -r 8b20f75c1585 port
370 diff -r f31323c92170 -r 8b20f75c1585 port
371 --- a/port Thu Jan 01 00:00:00 1970 +0000
371 --- a/port Thu Jan 01 00:00:00 1970 +0000
372 +++ b/port Thu Jan 01 00:00:01 1970 +0000
372 +++ b/port Thu Jan 01 00:00:01 1970 +0000
373 @@ -1,1 +1,2 @@
373 @@ -1,1 +1,2 @@
374 import
374 import
375 +export
375 +export
376
376
377 == rev: 0 ==
377 == rev: 0 ==
378 diff -r 000000000000 -r f31323c92170 port
378 diff -r 000000000000 -r f31323c92170 port
379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
380 +++ b/port Thu Jan 01 00:00:00 1970 +0000
380 +++ b/port Thu Jan 01 00:00:00 1970 +0000
381 @@ -0,0 +1,1 @@
381 @@ -0,0 +1,1 @@
382 +import
382 +import
383
383
384
384
385 all
385 all
386
386
387 $ hg grep --traceback --all -nu port port
387 $ hg grep --traceback --all -nu port port
388 port:4:4:-:spam:import/export
388 port:4:4:-:spam:import/export
389 port:3:4:+:eggs:import/export
389 port:3:4:+:eggs:import/export
390 port:2:1:-:spam:import
390 port:2:1:-:spam:import
391 port:2:2:+:spam:vaportight
391 port:2:2:+:spam:vaportight
392 port:2:3:+:spam:import/export
392 port:2:3:+:spam:import/export
393 port:1:2:+:eggs:export
393 port:1:2:+:eggs:export
394 port:0:1:+:spam:import
394 port:0:1:+:spam:import
395
395
396 all JSON
396 all JSON
397
397
398 $ hg grep --all -Tjson port port
398 $ hg grep --all -Tjson port port
399 [
399 [
400 {
400 {
401 "change": "-",
401 "change": "-",
402 "date": [4, 0],
402 "date": [4, 0],
403 "lineno": 4,
403 "lineno": 4,
404 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
404 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
405 "path": "port",
405 "path": "port",
406 "rev": 4,
406 "rev": 4,
407 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
407 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
408 "user": "spam"
408 "user": "spam"
409 },
409 },
410 {
410 {
411 "change": "+",
411 "change": "+",
412 "date": [3, 0],
412 "date": [3, 0],
413 "lineno": 4,
413 "lineno": 4,
414 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
414 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
415 "path": "port",
415 "path": "port",
416 "rev": 3,
416 "rev": 3,
417 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
417 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
418 "user": "eggs"
418 "user": "eggs"
419 },
419 },
420 {
420 {
421 "change": "-",
421 "change": "-",
422 "date": [2, 0],
422 "date": [2, 0],
423 "lineno": 1,
423 "lineno": 1,
424 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
424 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
425 "path": "port",
425 "path": "port",
426 "rev": 2,
426 "rev": 2,
427 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
427 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
428 "user": "spam"
428 "user": "spam"
429 },
429 },
430 {
430 {
431 "change": "+",
431 "change": "+",
432 "date": [2, 0],
432 "date": [2, 0],
433 "lineno": 2,
433 "lineno": 2,
434 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
434 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
435 "path": "port",
435 "path": "port",
436 "rev": 2,
436 "rev": 2,
437 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
437 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
438 "user": "spam"
438 "user": "spam"
439 },
439 },
440 {
440 {
441 "change": "+",
441 "change": "+",
442 "date": [2, 0],
442 "date": [2, 0],
443 "lineno": 3,
443 "lineno": 3,
444 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
444 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
445 "path": "port",
445 "path": "port",
446 "rev": 2,
446 "rev": 2,
447 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
447 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
448 "user": "spam"
448 "user": "spam"
449 },
449 },
450 {
450 {
451 "change": "+",
451 "change": "+",
452 "date": [1, 0],
452 "date": [1, 0],
453 "lineno": 2,
453 "lineno": 2,
454 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
454 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
455 "path": "port",
455 "path": "port",
456 "rev": 1,
456 "rev": 1,
457 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
457 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
458 "user": "eggs"
458 "user": "eggs"
459 },
459 },
460 {
460 {
461 "change": "+",
461 "change": "+",
462 "date": [0, 0],
462 "date": [0, 0],
463 "lineno": 1,
463 "lineno": 1,
464 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
464 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
465 "path": "port",
465 "path": "port",
466 "rev": 0,
466 "rev": 0,
467 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
467 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
468 "user": "spam"
468 "user": "spam"
469 }
469 }
470 ]
470 ]
471
471
472 other
472 other
473
473
474 $ hg grep -r tip:0 -l port port
474 $ hg grep -r tip:0 -l port port
475 port:4
475 port:4
476 port:3
476 port:3
477 port:2
477 port:2
478 port:1
478 port:1
479 port:0
479 port:0
480 $ hg grep -r tip:0 import port
480 $ hg grep -r tip:0 import port
481 port:4:import/export
481 port:4:import/export
482 port:3:import/export
482 port:3:import/export
483 port:3:import/export
483 port:3:import/export
484 port:2:import/export
484 port:2:import/export
485 port:1:import
485 port:1:import
486 port:0:import
486 port:0:import
487
487
488 $ hg cp port port2
488 $ hg cp port port2
489 $ hg commit -m 4 -u spam -d '5 0'
489 $ hg commit -m 4 -u spam -d '5 0'
490
490
491 follow
491 follow
492
492
493 $ hg grep -r tip:0 --traceback -f 'import\n\Z' port2
493 $ hg grep -r tip:0 --traceback -f 'import\n\Z' port2
494 [1]
494 [1]
495 $ echo deport >> port2
495 $ echo deport >> port2
496 $ hg commit -m 5 -u eggs -d '6 0'
496 $ hg commit -m 5 -u eggs -d '6 0'
497 $ hg grep -f --all -nu port port2
497 $ hg grep -f --all -nu port port2
498 port2:6:4:+:eggs:deport
498 port2:6:4:+:eggs:deport
499 port:4:4:-:spam:import/export
499 port:4:4:-:spam:import/export
500 port:3:4:+:eggs:import/export
500 port:3:4:+:eggs:import/export
501 port:2:1:-:spam:import
501 port:2:1:-:spam:import
502 port:2:2:+:spam:vaportight
502 port:2:2:+:spam:vaportight
503 port:2:3:+:spam:import/export
503 port:2:3:+:spam:import/export
504 port:1:2:+:eggs:export
504 port:1:2:+:eggs:export
505 port:0:1:+:spam:import
505 port:0:1:+:spam:import
506
506
507 $ hg up -q null
507 $ hg up -q null
508 $ hg grep -r 'reverse(:.)' -f port
508 $ hg grep -r 'reverse(:.)' -f port
509 port:0:import
509 port:0:import
510
510
511 Test wdir
511 Test wdir
512 (at least, this shouldn't crash)
512 (at least, this shouldn't crash)
513
513
514 $ hg up -q
514 $ hg up -q
515 $ echo wport >> port2
515 $ echo wport >> port2
516 $ hg stat
516 $ hg stat
517 M port2
517 M port2
518 $ hg grep -r 'wdir()' port
518 $ hg grep -r 'wdir()' port
519 port:2147483647:export
519 port:2147483647:export
520 port:2147483647:vaportight
520 port:2147483647:vaportight
521 port:2147483647:import/export
521 port:2147483647:import/export
522 port2:2147483647:export
522 port2:2147483647:export
523 port2:2147483647:vaportight
523 port2:2147483647:vaportight
524 port2:2147483647:import/export
524 port2:2147483647:import/export
525 port2:2147483647:deport
525 port2:2147483647:deport
526 port2:2147483647:wport
526 port2:2147483647:wport
527
527
528 $ cd ..
528 $ cd ..
529 $ hg init t2
529 $ hg init t2
530 $ cd t2
530 $ cd t2
531 $ hg grep -r tip:0 foobar foo
531 $ hg grep -r tip:0 foobar foo
532 [1]
532 [1]
533 $ hg grep -r tip:0 foobar
533 $ hg grep -r tip:0 foobar
534 [1]
534 [1]
535 $ echo blue >> color
535 $ echo blue >> color
536 $ echo black >> color
536 $ echo black >> color
537 $ hg add color
537 $ hg add color
538 $ hg ci -m 0
538 $ hg ci -m 0
539 $ echo orange >> color
539 $ echo orange >> color
540 $ hg ci -m 1
540 $ hg ci -m 1
541 $ echo black > color
541 $ echo black > color
542 $ hg ci -m 2
542 $ hg ci -m 2
543 $ echo orange >> color
543 $ echo orange >> color
544 $ echo blue >> color
544 $ echo blue >> color
545 $ hg ci -m 3
545 $ hg ci -m 3
546 $ hg grep -r tip:0 orange
546 $ hg grep -r tip:0 orange
547 color:3:orange
547 color:3:orange
548 color:1:orange
548 color:1:orange
549 $ hg grep --all orange
549 $ hg grep --all orange
550 color:3:+:orange
550 color:3:+:orange
551 color:2:-:orange
551 color:2:-:orange
552 color:1:+:orange
552 color:1:+:orange
553 $ hg grep --diff orange --color=debug
553 $ hg grep --diff orange --color=debug
554 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
554 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
555 [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange]
555 [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange]
556 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
556 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
557
557
558 $ hg grep --diff orange --color=yes
558 $ hg grep --diff orange --color=yes
559 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
559 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
560 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
560 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
561 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
561 \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
562
562
563 $ hg grep --diff orange
563 $ hg grep --diff orange
564 color:3:+:orange
564 color:3:+:orange
565 color:2:-:orange
565 color:2:-:orange
566 color:1:+:orange
566 color:1:+:orange
567
567
568 revset predicate for "grep --diff"
568 revset predicate for "grep --diff"
569
569
570 $ hg log -qr 'diffcontains("re:^bl...$")'
570 $ hg log -qr 'diffcontains("re:^bl...$")'
571 0:203191eb5e21
571 0:203191eb5e21
572 $ hg log -qr 'diffcontains("orange")'
572 $ hg log -qr 'diffcontains("orange")'
573 1:7c585a21e0d1
573 1:7c585a21e0d1
574 2:11bd8bc8d653
574 2:11bd8bc8d653
575 3:e0116d3829f8
575 3:e0116d3829f8
576 $ hg log -qr '2:0 & diffcontains("orange")'
576 $ hg log -qr '2:0 & diffcontains("orange")'
577 2:11bd8bc8d653
577 2:11bd8bc8d653
578 1:7c585a21e0d1
578 1:7c585a21e0d1
579
579
580 test substring match: '^' should only match at the beginning
580 test substring match: '^' should only match at the beginning
581
581
582 $ hg grep -r tip:0 '^.' --config extensions.color= --color debug
582 $ hg grep -r tip:0 '^.' --config extensions.color= --color debug
583 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack
583 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack
584 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range
584 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range
585 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue
585 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue
586 [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.match|b]lack
586 [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.match|b]lack
587 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lue
587 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lue
588 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lack
588 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|b]lack
589 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|o]range
589 [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.match|o]range
590 [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lue
590 [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lue
591 [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lack
591 [grep.filename|color][grep.sep|:][grep.rev|0][grep.sep|:][grep.match|b]lack
592
592
593 match in last "line" without newline
593 match in last "line" without newline
594
594
595 $ "$PYTHON" -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();'
595 $ "$PYTHON" -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();'
596 $ hg ci -Amnoeol
596 $ hg ci -Amnoeol
597 adding noeol
597 adding noeol
598 $ hg grep -r tip:0 loop
598 $ hg grep -r tip:0 loop
599 noeol:4:no infinite loop
599 noeol:4:no infinite loop
600
600
601 $ cd ..
601 $ cd ..
602
602
603 Issue685: traceback in grep -r after rename
603 Issue685: traceback in grep -r after rename
604
604
605 Got a traceback when using grep on a single
605 Got a traceback when using grep on a single
606 revision with renamed files.
606 revision with renamed files.
607
607
608 $ hg init issue685
608 $ hg init issue685
609 $ cd issue685
609 $ cd issue685
610 $ echo octarine > color
610 $ echo octarine > color
611 $ hg ci -Amcolor
611 $ hg ci -Amcolor
612 adding color
612 adding color
613 $ hg rename color colour
613 $ hg rename color colour
614 $ hg ci -Am rename
614 $ hg ci -Am rename
615 $ hg grep -r tip:0 octarine
615 $ hg grep -r tip:0 octarine
616 colour:1:octarine
616 colour:1:octarine
617 color:0:octarine
617 color:0:octarine
618
618
619 Used to crash here
619 Used to crash here
620
620
621 $ hg grep -r 1 octarine
621 $ hg grep -r 1 octarine
622 colour:1:octarine
622 colour:1:octarine
623 $ cd ..
623 $ cd ..
624
624
625
625
626 Issue337: test that grep follows parent-child relationships instead
626 Issue337: test that grep follows parent-child relationships instead
627 of just using revision numbers.
627 of just using revision numbers.
628
628
629 $ hg init issue337
629 $ hg init issue337
630 $ cd issue337
630 $ cd issue337
631
631
632 $ echo white > color
632 $ echo white > color
633 $ hg commit -A -m "0 white"
633 $ hg commit -A -m "0 white"
634 adding color
634 adding color
635
635
636 $ echo red > color
636 $ echo red > color
637 $ hg commit -A -m "1 red"
637 $ hg commit -A -m "1 red"
638
638
639 $ hg update 0
639 $ hg update 0
640 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
640 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
641 $ echo black > color
641 $ echo black > color
642 $ hg commit -A -m "2 black"
642 $ hg commit -A -m "2 black"
643 created new head
643 created new head
644
644
645 $ hg update --clean 1
645 $ hg update --clean 1
646 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
647 $ echo blue > color
647 $ echo blue > color
648 $ hg commit -A -m "3 blue"
648 $ hg commit -A -m "3 blue"
649
649
650 $ hg grep --all red
650 $ hg grep --all red
651 color:3:-:red
651 color:3:-:red
652 color:1:+:red
652 color:1:+:red
653
653
654 $ hg grep --diff red
654 $ hg grep --diff red
655 color:3:-:red
655 color:3:-:red
656 color:1:+:red
656 color:1:+:red
657
657
658 Issue3885: test that changing revision order does not alter the
658 Issue3885: test that changing revision order does not alter the
659 revisions printed, just their order.
659 revisions printed, just their order.
660
660
661 $ hg grep --all red -r "all()"
661 $ hg grep --all red -r "all()"
662 color:1:+:red
662 color:1:+:red
663 color:3:-:red
663 color:3:-:red
664
664
665 $ hg grep --all red -r "reverse(all())"
665 $ hg grep --all red -r "reverse(all())"
666 color:3:-:red
666 color:3:-:red
667 color:1:+:red
667 color:1:+:red
668
668
669 $ hg grep --diff red -r "all()"
669 $ hg grep --diff red -r "all()"
670 color:1:+:red
670 color:1:+:red
671 color:3:-:red
671 color:3:-:red
672
672
673 $ hg grep --diff red -r "reverse(all())"
673 $ hg grep --diff red -r "reverse(all())"
674 color:3:-:red
674 color:3:-:red
675 color:1:+:red
675 color:1:+:red
676
676
677 $ cd ..
677 $ cd ..
678
678
679 $ hg init a
679 $ hg init a
680 $ cd a
680 $ cd a
681 $ cp "$TESTDIR/binfile.bin" .
681 $ cp "$TESTDIR/binfile.bin" .
682 $ hg add binfile.bin
682 $ hg add binfile.bin
683 $ hg ci -m 'add binfile.bin'
683 $ hg ci -m 'add binfile.bin'
684 $ hg grep "MaCam" --all
684 $ hg grep "MaCam" --all
685 binfile.bin:0:+: Binary file matches
685 binfile.bin:0:+: Binary file matches
686
686
687 $ hg grep "MaCam" --diff
687 $ hg grep "MaCam" --diff
688 binfile.bin:0:+: Binary file matches
688 binfile.bin:0:+: Binary file matches
689
689
690 $ cd ..
690 $ cd ..
691
691
692 Moved line may not be collected by "grep --diff" since it first filters
692 Moved line may not be collected by "grep --diff" since it first filters
693 the contents to be diffed by the pattern. (i.e.
693 the contents to be diffed by the pattern. (i.e.
694 "diff <(grep pat a) <(grep pat b)", not "diff a b | grep pat".)
694 "diff <(grep pat a) <(grep pat b)", not "diff a b | grep pat".)
695 This is much faster than generating full diff per revision.
695 This is much faster than generating full diff per revision.
696
696
697 $ hg init moved-line
697 $ hg init moved-line
698 $ cd moved-line
698 $ cd moved-line
699 $ cat <<'EOF' > a
699 $ cat <<'EOF' > a
700 > foo
700 > foo
701 > bar
701 > bar
702 > baz
702 > baz
703 > EOF
703 > EOF
704 $ hg ci -Am initial
704 $ hg ci -Am initial
705 adding a
705 adding a
706 $ cat <<'EOF' > a
706 $ cat <<'EOF' > a
707 > bar
707 > bar
708 > baz
708 > baz
709 > foo
709 > foo
710 > EOF
710 > EOF
711 $ hg ci -m reorder
711 $ hg ci -m reorder
712
712
713 $ hg diff -c 1
713 $ hg diff -c 1
714 diff -r a593cc55e81b -r 69789a3b6e80 a
714 diff -r a593cc55e81b -r 69789a3b6e80 a
715 --- a/a Thu Jan 01 00:00:00 1970 +0000
715 --- a/a Thu Jan 01 00:00:00 1970 +0000
716 +++ b/a Thu Jan 01 00:00:00 1970 +0000
716 +++ b/a Thu Jan 01 00:00:00 1970 +0000
717 @@ -1,3 +1,3 @@
717 @@ -1,3 +1,3 @@
718 -foo
718 -foo
719 bar
719 bar
720 baz
720 baz
721 +foo
721 +foo
722
722
723 can't find the move of "foo" at the revision 1:
723 can't find the move of "foo" at the revision 1:
724
724
725 $ hg grep --diff foo -r1
725 $ hg grep --diff foo -r1
726 [1]
726 [1]
727
727
728 "bar" isn't moved at the revisoin 1:
728 "bar" isn't moved at the revisoin 1:
729
729
730 $ hg grep --diff bar -r1
730 $ hg grep --diff bar -r1
731 [1]
731 [1]
732
732
733 $ cd ..
733 $ cd ..
734
734
735 Test for showing working of allfiles flag
735 Test for showing working of allfiles flag
736
736
737 $ hg init sng
737 $ hg init sng
738 $ cd sng
738 $ cd sng
739 $ echo "unmod" >> um
739 $ echo "unmod" >> um
740 $ echo old > old
740 $ echo old > old
741 $ hg ci -q -A -m "adds unmod to um"
741 $ hg ci -q -A -m "adds unmod to um"
742 $ echo "something else" >> new
742 $ echo "something else" >> new
743 $ hg ci -A -m "second commit"
743 $ hg ci -A -m "second commit"
744 adding new
744 adding new
745 $ hg grep -r "." "unmod"
745 $ hg grep -r "." "unmod"
746 um:1:unmod
746 um:1:unmod
747
747
748 Existing tracked files in the working directory are searched by default
748 Existing tracked files in the working directory are searched by default
749
749
750 $ echo modified >> new
750 $ echo modified >> new
751 $ echo 'added' > added; hg add added
751 $ echo 'added' > added; hg add added
752 $ echo 'added, missing' > added-missing; hg add added-missing; rm added-missing
752 $ echo 'added, missing' > added-missing; hg add added-missing; rm added-missing
753 $ echo 'untracked' > untracked
753 $ echo 'untracked' > untracked
754 $ hg rm old
754 $ hg rm old
755 $ hg grep ''
755 $ hg grep ''
756 added:added
756 added:added
757 new:something else
757 new:something else
758 new:modified
758 new:modified
759 um:unmod
759 um:unmod
760
760
761 #if symlink
761 #if symlink
762 Grepping a symlink greps its destination
762 Grepping a symlink greps its destination
763
763
764 $ rm -f added; ln -s symlink-added added
764 $ rm -f added; ln -s symlink-added added
765 $ hg grep '' | grep added
765 $ hg grep '' | grep added
766 added:symlink-added
766 added:symlink-added
767
767
768 But we reject symlinks as directories components of a tracked file as
768 But we reject symlinks as directories components of a tracked file as
769 usual:
769 usual:
770
770
771 $ mkdir dir; touch dir/f; hg add dir/f
771 $ mkdir dir; touch dir/f; hg add dir/f
772 $ rm -rf dir; ln -s / dir
772 $ rm -rf dir; ln -s / dir
773 $ hg grep ''
773 $ hg grep ''
774 abort: path 'dir/f' traverses symbolic link 'dir'
774 abort: path 'dir/f' traverses symbolic link 'dir'
775 [255]
775 [255]
776 #endif
776 #endif
777
777
778 But we can search files from some other revision with -rREV
778 But we can search files from some other revision with -rREV
779
779
780 $ hg grep -r. mod
780 $ hg grep -r. mod
781 um:1:unmod
781 um:1:unmod
782
782
783 $ hg grep --diff mod
783 $ hg grep --diff mod
784 um:0:+:unmod
784 um:0:+:unmod
785
785
786 $ cd ..
786 $ cd ..
787
787
788 Change Default of grep by ui.tweakdefaults, that is, the files not in current
788 Change Default of grep by ui.tweakdefaults, that is, the files not in current
789 working directory should not be grepp-ed on
789 working directory should not be grepp-ed on
790
790
791 $ hg init ab
791 $ hg init ab
792 $ cd ab
792 $ cd ab
793 $ cat <<'EOF' >> .hg/hgrc
793 $ cat <<'EOF' >> .hg/hgrc
794 > [ui]
794 > [ui]
795 > tweakdefaults = True
795 > tweakdefaults = True
796 > EOF
796 > EOF
797 $ echo "some text">>file1
797 $ echo "some text">>file1
798 $ hg add file1
798 $ hg add file1
799 $ hg commit -m "adds file1"
799 $ hg commit -m "adds file1"
800 $ hg mv file1 file2
800 $ hg mv file1 file2
801
801
802 wdir revision is hidden by default:
802 wdir revision is hidden by default:
803
803
804 $ hg grep "some"
804 $ hg grep "some"
805 file2:some text
805 file2:some text
806
806
807 but it should be available in template dict:
807 but it should be available in template dict:
808
808
809 $ hg grep "some" -Tjson
809 $ hg grep "some" -Tjson
810 [
810 [
811 {
811 {
812 "date": [0, 0],
812 "date": [0, 0],
813 "lineno": 1,
813 "lineno": 1,
814 "node": "ffffffffffffffffffffffffffffffffffffffff",
814 "node": "ffffffffffffffffffffffffffffffffffffffff",
815 "path": "file2",
815 "path": "file2",
816 "rev": 2147483647,
816 "rev": 2147483647,
817 "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}],
817 "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}],
818 "user": "test"
818 "user": "test"
819 }
819 }
820 ]
820 ]
821
821
822 $ cd ..
822 $ cd ..
823
823
824 test -rMULTIREV
824 test -rMULTIREV
825
825
826 $ cd sng
826 $ cd sng
827 $ hg rm um
827 $ hg rm um
828 $ hg commit -m "deletes um"
828 $ hg commit -m "deletes um"
829 $ hg grep -r "0:2" "unmod"
829 $ hg grep -r "0:2" "unmod"
830 um:0:unmod
830 um:0:unmod
831 um:1:unmod
831 um:1:unmod
832 $ hg grep -r "0:2" "unmod" um
832 $ hg grep -r "0:2" "unmod" um
833 um:0:unmod
833 um:0:unmod
834 um:1:unmod
834 um:1:unmod
835 $ hg grep -r "0:2" "unmod" "glob:**/um" # Check that patterns also work
835 $ hg grep -r "0:2" "unmod" "glob:**/um" # Check that patterns also work
836 um:0:unmod
836 um:0:unmod
837 um:1:unmod
837 um:1:unmod
838 $ cd ..
838 $ cd ..
839
839
840 --follow with/without --diff and/or paths
840 --follow with/without --diff and/or paths
841 -----------------------------------------
841 -----------------------------------------
842
842
843 For each test case, we compare the history traversal of "hg log",
843 For each test case, we compare the history traversal of "hg log",
844 "hg grep --diff", and "hg grep" (--all-files).
844 "hg grep --diff", and "hg grep" (--all-files).
845
845
846 "hg grep --diff" should traverse the log in the same way as "hg log".
846 "hg grep --diff" should traverse the log in the same way as "hg log".
847 "hg grep" (--all-files) is slightly different in that it includes
847 "hg grep" (--all-files) is slightly different in that it includes
848 unmodified changes.
848 unmodified changes.
849
849
850 $ hg init follow
850 $ hg init follow
851 $ cd follow
851 $ cd follow
852
852
853 $ cat <<'EOF' >> .hg/hgrc
853 $ cat <<'EOF' >> .hg/hgrc
854 > [command-templates]
854 > [command-templates]
855 > log = '{rev}: {join(files % "{status} {path}", ", ")}\n'
855 > log = '{rev}: {join(files % "{status} {path}", ", ")}\n'
856 > EOF
856 > EOF
857
857
858 $ for f in add0 add0-mod1 add0-rm1 add0-mod2 add0-rm2 add0-mod3 add0-mod4 add0-rm4; do
858 $ for f in add0 add0-mod1 add0-rm1 add0-mod2 add0-rm2 add0-mod3 add0-mod4 add0-rm4; do
859 > echo data0 >> $f
859 > echo data0 >> $f
860 > done
860 > done
861 $ hg ci -qAm0
861 $ hg ci -qAm0
862
862
863 $ hg cp add0 add0-cp1
863 $ hg cp add0 add0-cp1
864 $ hg cp add0 add0-cp1-mod1
864 $ hg cp add0 add0-cp1-mod1
865 $ hg cp add0 add0-cp1-mod1-rm3
865 $ hg cp add0 add0-cp1-mod1-rm3
866 $ hg rm add0-rm1
866 $ hg rm add0-rm1
867 $ for f in *mod1*; do
867 $ for f in *mod1*; do
868 > echo data1 >> $f
868 > echo data1 >> $f
869 > done
869 > done
870 $ hg ci -qAm1
870 $ hg ci -qAm1
871
871
872 $ hg update -q 0
872 $ hg update -q 0
873 $ hg cp add0 add0-cp2
873 $ hg cp add0 add0-cp2
874 $ hg cp add0 add0-cp2-mod2
874 $ hg cp add0 add0-cp2-mod2
875 $ hg rm add0-rm2
875 $ hg rm add0-rm2
876 $ for f in *mod2*; do
876 $ for f in *mod2*; do
877 > echo data2 >> $f
877 > echo data2 >> $f
878 > done
878 > done
879 $ hg ci -qAm2
879 $ hg ci -qAm2
880
880
881 $ hg update -q 1
881 $ hg update -q 1
882 $ hg cp add0-cp1 add0-cp1-cp3
882 $ hg cp add0-cp1 add0-cp1-cp3
883 $ hg cp add0-cp1-mod1 add0-cp1-mod1-cp3-mod3
883 $ hg cp add0-cp1-mod1 add0-cp1-mod1-cp3-mod3
884 $ hg rm add0-cp1-mod1-rm3
884 $ hg rm add0-cp1-mod1-rm3
885 $ for f in *mod3*; do
885 $ for f in *mod3*; do
886 > echo data3 >> $f
886 > echo data3 >> $f
887 > done
887 > done
888 $ hg ci -qAm3
888 $ hg ci -qAm3
889
889
890 $ hg cp add0 add0-cp4
890 $ hg cp add0 add0-cp4
891 $ hg cp add0 add0-cp4-mod4
891 $ hg cp add0 add0-cp4-mod4
892 $ hg rm add0-rm4
892 $ hg rm add0-rm4
893 $ for f in *mod4*; do
893 $ for f in *mod4*; do
894 > echo data4 >> $f
894 > echo data4 >> $f
895 > done
895 > done
896
896
897 $ hg log -Gr':wdir()'
897 $ hg log -Gr':wdir()'
898 o 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
898 o 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
899 |
899 |
900 @ 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
900 @ 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
901 |
901 |
902 | o 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
902 | o 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
903 | |
903 | |
904 o | 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
904 o | 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
905 |/
905 |/
906 o 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
906 o 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
907
907
908
908
909 follow revision history from wdir parent:
909 follow revision history from wdir parent:
910
910
911 $ hg log -f
911 $ hg log -f
912 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
912 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
913 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
913 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
914 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
914 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
915
915
916 $ hg grep --diff -f data
916 $ hg grep --diff -f data
917 add0-cp1-mod1-cp3-mod3:3:+:data3
917 add0-cp1-mod1-cp3-mod3:3:+:data3
918 add0-mod3:3:+:data3
918 add0-mod3:3:+:data3
919 add0-cp1-mod1:1:+:data1
919 add0-cp1-mod1:1:+:data1
920 add0-cp1-mod1-rm3:1:+:data1
920 add0-cp1-mod1-rm3:1:+:data1
921 add0-mod1:1:+:data1
921 add0-mod1:1:+:data1
922 add0:0:+:data0
922 add0:0:+:data0
923 add0-mod1:0:+:data0
923 add0-mod1:0:+:data0
924 add0-mod2:0:+:data0
924 add0-mod2:0:+:data0
925 add0-mod3:0:+:data0
925 add0-mod3:0:+:data0
926 add0-mod4:0:+:data0
926 add0-mod4:0:+:data0
927 add0-rm1:0:+:data0
927 add0-rm1:0:+:data0
928 add0-rm2:0:+:data0
928 add0-rm2:0:+:data0
929 add0-rm4:0:+:data0
929 add0-rm4:0:+:data0
930
930
931 $ hg grep -f data
931 $ hg grep -f data
932 add0:3:data0
932 add0:3:data0
933 add0-cp1:3:data0
933 add0-cp1:3:data0
934 add0-cp1-cp3:3:data0
934 add0-cp1-cp3:3:data0
935 add0-cp1-mod1:3:data0
935 add0-cp1-mod1:3:data0
936 add0-cp1-mod1:3:data1
936 add0-cp1-mod1:3:data1
937 add0-cp1-mod1-cp3-mod3:3:data0
937 add0-cp1-mod1-cp3-mod3:3:data0
938 add0-cp1-mod1-cp3-mod3:3:data1
938 add0-cp1-mod1-cp3-mod3:3:data1
939 add0-cp1-mod1-cp3-mod3:3:data3
939 add0-cp1-mod1-cp3-mod3:3:data3
940 add0-mod1:3:data0
940 add0-mod1:3:data0
941 add0-mod1:3:data1
941 add0-mod1:3:data1
942 add0-mod2:3:data0
942 add0-mod2:3:data0
943 add0-mod3:3:data0
943 add0-mod3:3:data0
944 add0-mod3:3:data3
944 add0-mod3:3:data3
945 add0-mod4:3:data0
945 add0-mod4:3:data0
946 add0-rm2:3:data0
946 add0-rm2:3:data0
947 add0-rm4:3:data0
947 add0-rm4:3:data0
948 add0:1:data0
948 add0:1:data0
949 add0-cp1:1:data0
949 add0-cp1:1:data0
950 add0-cp1-mod1:1:data0
950 add0-cp1-mod1:1:data0
951 add0-cp1-mod1:1:data1
951 add0-cp1-mod1:1:data1
952 add0-cp1-mod1-rm3:1:data0
952 add0-cp1-mod1-rm3:1:data0
953 add0-cp1-mod1-rm3:1:data1
953 add0-cp1-mod1-rm3:1:data1
954 add0-mod1:1:data0
954 add0-mod1:1:data0
955 add0-mod1:1:data1
955 add0-mod1:1:data1
956 add0-mod2:1:data0
956 add0-mod2:1:data0
957 add0-mod3:1:data0
957 add0-mod3:1:data0
958 add0-mod4:1:data0
958 add0-mod4:1:data0
959 add0-rm2:1:data0
959 add0-rm2:1:data0
960 add0-rm4:1:data0
960 add0-rm4:1:data0
961 add0:0:data0
961 add0:0:data0
962 add0-mod1:0:data0
962 add0-mod1:0:data0
963 add0-mod2:0:data0
963 add0-mod2:0:data0
964 add0-mod3:0:data0
964 add0-mod3:0:data0
965 add0-mod4:0:data0
965 add0-mod4:0:data0
966 add0-rm1:0:data0
966 add0-rm1:0:data0
967 add0-rm2:0:data0
967 add0-rm2:0:data0
968 add0-rm4:0:data0
968 add0-rm4:0:data0
969
969
970 follow revision history from specified revision:
970 follow revision history from specified revision:
971
971
972 $ hg log -fr2
972 $ hg log -fr2
973 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
973 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
974 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
974 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
975
975
976 $ hg grep --diff -fr2 data
976 $ hg grep --diff -fr2 data
977 add0-cp2-mod2:2:+:data2
977 add0-cp2-mod2:2:+:data2
978 add0-mod2:2:+:data2
978 add0-mod2:2:+:data2
979 add0:0:+:data0
979 add0:0:+:data0
980 add0-mod1:0:+:data0
980 add0-mod1:0:+:data0
981 add0-mod2:0:+:data0
981 add0-mod2:0:+:data0
982 add0-mod3:0:+:data0
982 add0-mod3:0:+:data0
983 add0-mod4:0:+:data0
983 add0-mod4:0:+:data0
984 add0-rm1:0:+:data0
984 add0-rm1:0:+:data0
985 add0-rm2:0:+:data0
985 add0-rm2:0:+:data0
986 add0-rm4:0:+:data0
986 add0-rm4:0:+:data0
987
987
988 $ hg grep -fr2 data
988 $ hg grep -fr2 data
989 add0:2:data0
989 add0:2:data0
990 add0-cp2:2:data0
990 add0-cp2:2:data0
991 add0-cp2-mod2:2:data0
991 add0-cp2-mod2:2:data0
992 add0-cp2-mod2:2:data2
992 add0-cp2-mod2:2:data2
993 add0-mod1:2:data0
993 add0-mod1:2:data0
994 add0-mod2:2:data0
994 add0-mod2:2:data0
995 add0-mod2:2:data2
995 add0-mod2:2:data2
996 add0-mod3:2:data0
996 add0-mod3:2:data0
997 add0-mod4:2:data0
997 add0-mod4:2:data0
998 add0-rm1:2:data0
998 add0-rm1:2:data0
999 add0-rm4:2:data0
999 add0-rm4:2:data0
1000 add0:0:data0
1000 add0:0:data0
1001 add0-mod1:0:data0
1001 add0-mod1:0:data0
1002 add0-mod2:0:data0
1002 add0-mod2:0:data0
1003 add0-mod3:0:data0
1003 add0-mod3:0:data0
1004 add0-mod4:0:data0
1004 add0-mod4:0:data0
1005 add0-rm1:0:data0
1005 add0-rm1:0:data0
1006 add0-rm2:0:data0
1006 add0-rm2:0:data0
1007 add0-rm4:0:data0
1007 add0-rm4:0:data0
1008
1008
1009 follow revision history from wdir:
1009 follow revision history from wdir:
1010
1010
1011 $ hg log -fr'wdir()'
1011 $ hg log -fr'wdir()'
1012 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1012 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1013 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1013 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1014 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1014 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1015 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1015 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1016
1016
1017 BROKEN: should not abort because of removed file
1017 BROKEN: should not abort because of removed file
1018 $ hg grep --diff -fr'wdir()' data
1018 $ hg grep --diff -fr'wdir()' data
1019 add0-cp4-mod4:2147483647:+:data4
1019 add0-cp4-mod4:2147483647:+:data4
1020 add0-mod4:2147483647:+:data4
1020 add0-mod4:2147483647:+:data4
1021 add0-rm4:2147483647:-:abort: add0-rm4@None: not found in manifest
1021 add0-rm4:2147483647:-:abort: add0-rm4@None: not found in manifest
1022 [50]
1022 [50]
1023
1023
1024 $ hg grep -fr'wdir()' data
1024 $ hg grep -fr'wdir()' data
1025 add0:2147483647:data0
1025 add0:2147483647:data0
1026 add0-cp1:2147483647:data0
1026 add0-cp1:2147483647:data0
1027 add0-cp1-cp3:2147483647:data0
1027 add0-cp1-cp3:2147483647:data0
1028 add0-cp1-mod1:2147483647:data0
1028 add0-cp1-mod1:2147483647:data0
1029 add0-cp1-mod1:2147483647:data1
1029 add0-cp1-mod1:2147483647:data1
1030 add0-cp1-mod1-cp3-mod3:2147483647:data0
1030 add0-cp1-mod1-cp3-mod3:2147483647:data0
1031 add0-cp1-mod1-cp3-mod3:2147483647:data1
1031 add0-cp1-mod1-cp3-mod3:2147483647:data1
1032 add0-cp1-mod1-cp3-mod3:2147483647:data3
1032 add0-cp1-mod1-cp3-mod3:2147483647:data3
1033 add0-cp4:2147483647:data0
1033 add0-cp4:2147483647:data0
1034 add0-cp4-mod4:2147483647:data0
1034 add0-cp4-mod4:2147483647:data0
1035 add0-cp4-mod4:2147483647:data4
1035 add0-cp4-mod4:2147483647:data4
1036 add0-mod1:2147483647:data0
1036 add0-mod1:2147483647:data0
1037 add0-mod1:2147483647:data1
1037 add0-mod1:2147483647:data1
1038 add0-mod2:2147483647:data0
1038 add0-mod2:2147483647:data0
1039 add0-mod3:2147483647:data0
1039 add0-mod3:2147483647:data0
1040 add0-mod3:2147483647:data3
1040 add0-mod3:2147483647:data3
1041 add0-mod4:2147483647:data0
1041 add0-mod4:2147483647:data0
1042 add0-mod4:2147483647:data4
1042 add0-mod4:2147483647:data4
1043 add0-rm2:2147483647:data0
1043 add0-rm2:2147483647:data0
1044 add0:3:data0
1044 add0:3:data0
1045 add0-cp1:3:data0
1045 add0-cp1:3:data0
1046 add0-cp1-cp3:3:data0
1046 add0-cp1-cp3:3:data0
1047 add0-cp1-mod1:3:data0
1047 add0-cp1-mod1:3:data0
1048 add0-cp1-mod1:3:data1
1048 add0-cp1-mod1:3:data1
1049 add0-cp1-mod1-cp3-mod3:3:data0
1049 add0-cp1-mod1-cp3-mod3:3:data0
1050 add0-cp1-mod1-cp3-mod3:3:data1
1050 add0-cp1-mod1-cp3-mod3:3:data1
1051 add0-cp1-mod1-cp3-mod3:3:data3
1051 add0-cp1-mod1-cp3-mod3:3:data3
1052 add0-mod1:3:data0
1052 add0-mod1:3:data0
1053 add0-mod1:3:data1
1053 add0-mod1:3:data1
1054 add0-mod2:3:data0
1054 add0-mod2:3:data0
1055 add0-mod3:3:data0
1055 add0-mod3:3:data0
1056 add0-mod3:3:data3
1056 add0-mod3:3:data3
1057 add0-mod4:3:data0
1057 add0-mod4:3:data0
1058 add0-rm2:3:data0
1058 add0-rm2:3:data0
1059 add0-rm4:3:data0
1059 add0-rm4:3:data0
1060 add0:1:data0
1060 add0:1:data0
1061 add0-cp1:1:data0
1061 add0-cp1:1:data0
1062 add0-cp1-mod1:1:data0
1062 add0-cp1-mod1:1:data0
1063 add0-cp1-mod1:1:data1
1063 add0-cp1-mod1:1:data1
1064 add0-cp1-mod1-rm3:1:data0
1064 add0-cp1-mod1-rm3:1:data0
1065 add0-cp1-mod1-rm3:1:data1
1065 add0-cp1-mod1-rm3:1:data1
1066 add0-mod1:1:data0
1066 add0-mod1:1:data0
1067 add0-mod1:1:data1
1067 add0-mod1:1:data1
1068 add0-mod2:1:data0
1068 add0-mod2:1:data0
1069 add0-mod3:1:data0
1069 add0-mod3:1:data0
1070 add0-mod4:1:data0
1070 add0-mod4:1:data0
1071 add0-rm2:1:data0
1071 add0-rm2:1:data0
1072 add0-rm4:1:data0
1072 add0-rm4:1:data0
1073 add0:0:data0
1073 add0:0:data0
1074 add0-mod1:0:data0
1074 add0-mod1:0:data0
1075 add0-mod2:0:data0
1075 add0-mod2:0:data0
1076 add0-mod3:0:data0
1076 add0-mod3:0:data0
1077 add0-mod4:0:data0
1077 add0-mod4:0:data0
1078 add0-rm1:0:data0
1078 add0-rm1:0:data0
1079 add0-rm2:0:data0
1079 add0-rm2:0:data0
1080 add0-rm4:0:data0
1080 add0-rm4:0:data0
1081
1081
1082 follow revision history from multiple revisions:
1082 follow revision history from multiple revisions:
1083
1083
1084 $ hg log -fr'1+2'
1084 $ hg log -fr'1+2'
1085 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1085 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1086 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1086 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1087 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1087 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1088
1088
1089 $ hg grep --diff -fr'1+2' data
1089 $ hg grep --diff -fr'1+2' data
1090 add0-cp2-mod2:2:+:data2
1090 add0-cp2-mod2:2:+:data2
1091 add0-mod2:2:+:data2
1091 add0-mod2:2:+:data2
1092 add0-cp1-mod1:1:+:data1
1092 add0-cp1-mod1:1:+:data1
1093 add0-cp1-mod1-rm3:1:+:data1
1093 add0-cp1-mod1-rm3:1:+:data1
1094 add0-mod1:1:+:data1
1094 add0-mod1:1:+:data1
1095 add0:0:+:data0
1095 add0:0:+:data0
1096 add0-mod1:0:+:data0
1096 add0-mod1:0:+:data0
1097 add0-mod2:0:+:data0
1097 add0-mod2:0:+:data0
1098 add0-mod3:0:+:data0
1098 add0-mod3:0:+:data0
1099 add0-mod4:0:+:data0
1099 add0-mod4:0:+:data0
1100 add0-rm1:0:+:data0
1100 add0-rm1:0:+:data0
1101 add0-rm2:0:+:data0
1101 add0-rm2:0:+:data0
1102 add0-rm4:0:+:data0
1102 add0-rm4:0:+:data0
1103
1103
1104 $ hg grep -fr'1+2' data
1104 $ hg grep -fr'1+2' data
1105 add0:2:data0
1105 add0:2:data0
1106 add0-cp2:2:data0
1106 add0-cp2:2:data0
1107 add0-cp2-mod2:2:data0
1107 add0-cp2-mod2:2:data0
1108 add0-cp2-mod2:2:data2
1108 add0-cp2-mod2:2:data2
1109 add0-mod1:2:data0
1109 add0-mod1:2:data0
1110 add0-mod2:2:data0
1110 add0-mod2:2:data0
1111 add0-mod2:2:data2
1111 add0-mod2:2:data2
1112 add0-mod3:2:data0
1112 add0-mod3:2:data0
1113 add0-mod4:2:data0
1113 add0-mod4:2:data0
1114 add0-rm1:2:data0
1114 add0-rm1:2:data0
1115 add0-rm4:2:data0
1115 add0-rm4:2:data0
1116 add0:1:data0
1116 add0:1:data0
1117 add0-cp1:1:data0
1117 add0-cp1:1:data0
1118 add0-cp1-mod1:1:data0
1118 add0-cp1-mod1:1:data0
1119 add0-cp1-mod1:1:data1
1119 add0-cp1-mod1:1:data1
1120 add0-cp1-mod1-rm3:1:data0
1120 add0-cp1-mod1-rm3:1:data0
1121 add0-cp1-mod1-rm3:1:data1
1121 add0-cp1-mod1-rm3:1:data1
1122 add0-mod1:1:data0
1122 add0-mod1:1:data0
1123 add0-mod1:1:data1
1123 add0-mod1:1:data1
1124 add0-mod2:1:data0
1124 add0-mod2:1:data0
1125 add0-mod3:1:data0
1125 add0-mod3:1:data0
1126 add0-mod4:1:data0
1126 add0-mod4:1:data0
1127 add0-rm2:1:data0
1127 add0-rm2:1:data0
1128 add0-rm4:1:data0
1128 add0-rm4:1:data0
1129 add0:0:data0
1129 add0:0:data0
1130 add0-mod1:0:data0
1130 add0-mod1:0:data0
1131 add0-mod2:0:data0
1131 add0-mod2:0:data0
1132 add0-mod3:0:data0
1132 add0-mod3:0:data0
1133 add0-mod4:0:data0
1133 add0-mod4:0:data0
1134 add0-rm1:0:data0
1134 add0-rm1:0:data0
1135 add0-rm2:0:data0
1135 add0-rm2:0:data0
1136 add0-rm4:0:data0
1136 add0-rm4:0:data0
1137
1137
1138 follow file history from wdir parent, unmodified in wdir:
1138 follow file history from wdir parent, unmodified in wdir:
1139
1139
1140 $ hg log -f add0-mod3
1140 $ hg log -f add0-mod3
1141 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1141 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1142 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1142 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1143
1143
1144 $ hg grep --diff -f data add0-mod3
1144 $ hg grep --diff -f data add0-mod3
1145 add0-mod3:3:+:data3
1145 add0-mod3:3:+:data3
1146 add0-mod3:0:+:data0
1146 add0-mod3:0:+:data0
1147
1147
1148 $ hg grep -f data add0-mod3
1148 $ hg grep -f data add0-mod3
1149 add0-mod3:3:data0
1149 add0-mod3:3:data0
1150 add0-mod3:3:data3
1150 add0-mod3:3:data3
1151 add0-mod3:1:data0
1151 add0-mod3:1:data0
1152 add0-mod3:0:data0
1152 add0-mod3:0:data0
1153
1153
1154 follow file history from wdir parent, modified in wdir:
1154 follow file history from wdir parent, modified in wdir:
1155
1155
1156 $ hg log -f add0-mod4
1156 $ hg log -f add0-mod4
1157 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1157 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1158
1158
1159 $ hg grep --diff -f data add0-mod4
1159 $ hg grep --diff -f data add0-mod4
1160 add0-mod4:0:+:data0
1160 add0-mod4:0:+:data0
1161
1161
1162 $ hg grep -f data add0-mod4
1162 $ hg grep -f data add0-mod4
1163 add0-mod4:3:data0
1163 add0-mod4:3:data0
1164 add0-mod4:1:data0
1164 add0-mod4:1:data0
1165 add0-mod4:0:data0
1165 add0-mod4:0:data0
1166
1166
1167 follow file history from wdir parent, copied but unmodified:
1167 follow file history from wdir parent, copied but unmodified:
1168
1168
1169 $ hg log -f add0-cp1-cp3
1169 $ hg log -f add0-cp1-cp3
1170 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1170 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1171 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1171 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1172 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1172 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1173
1173
1174 $ hg grep --diff -f data add0-cp1-cp3
1174 $ hg grep --diff -f data add0-cp1-cp3
1175 add0:0:+:data0
1175 add0:0:+:data0
1176
1176
1177 BROKEN: should follow history across renames
1177 BROKEN: should follow history across renames
1178 $ hg grep -f data add0-cp1-cp3
1178 $ hg grep -f data add0-cp1-cp3
1179 add0-cp1-cp3:3:data0
1179 add0-cp1-cp3:3:data0
1180
1180
1181 follow file history from wdir parent, copied and modified:
1181 follow file history from wdir parent, copied and modified:
1182
1182
1183 $ hg log -f add0-cp1-mod1-cp3-mod3
1183 $ hg log -f add0-cp1-mod1-cp3-mod3
1184 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1184 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1185 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1185 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1186 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1186 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1187
1187
1188 $ hg grep --diff -f data add0-cp1-mod1-cp3-mod3
1188 $ hg grep --diff -f data add0-cp1-mod1-cp3-mod3
1189 add0-cp1-mod1-cp3-mod3:3:+:data3
1189 add0-cp1-mod1-cp3-mod3:3:+:data3
1190 add0-cp1-mod1:1:+:data1
1190 add0-cp1-mod1:1:+:data1
1191 add0:0:+:data0
1191 add0:0:+:data0
1192
1192
1193 BROKEN: should follow history across renames
1193 BROKEN: should follow history across renames
1194 $ hg grep -f data add0-cp1-mod1-cp3-mod3
1194 $ hg grep -f data add0-cp1-mod1-cp3-mod3
1195 add0-cp1-mod1-cp3-mod3:3:data0
1195 add0-cp1-mod1-cp3-mod3:3:data0
1196 add0-cp1-mod1-cp3-mod3:3:data1
1196 add0-cp1-mod1-cp3-mod3:3:data1
1197 add0-cp1-mod1-cp3-mod3:3:data3
1197 add0-cp1-mod1-cp3-mod3:3:data3
1198
1198
1199 follow file history from wdir parent, copied in wdir:
1199 follow file history from wdir parent, copied in wdir:
1200
1200
1201 $ hg log -f add0-cp4
1201 $ hg log -f add0-cp4
1202 abort: cannot follow nonexistent file: "add0-cp4"
1202 abort: cannot follow nonexistent file: "add0-cp4"
1203 [255]
1203 [20]
1204
1204
1205 $ hg grep --diff -f data add0-cp4
1205 $ hg grep --diff -f data add0-cp4
1206 abort: cannot follow nonexistent file: "add0-cp4"
1206 abort: cannot follow nonexistent file: "add0-cp4"
1207 [255]
1207 [20]
1208
1208
1209 BROKEN: maybe better to abort
1209 BROKEN: maybe better to abort
1210 $ hg grep -f data add0-cp4
1210 $ hg grep -f data add0-cp4
1211 [1]
1211 [1]
1212
1212
1213 follow file history from wdir parent, removed:
1213 follow file history from wdir parent, removed:
1214
1214
1215 $ hg log -f add0-cp1-mod1-rm3
1215 $ hg log -f add0-cp1-mod1-rm3
1216 abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3"
1216 abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3"
1217 [255]
1217 [20]
1218
1218
1219 $ hg grep --diff -f data add0-cp1-mod1-rm3
1219 $ hg grep --diff -f data add0-cp1-mod1-rm3
1220 abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3"
1220 abort: cannot follow file not in parent revision: "add0-cp1-mod1-rm3"
1221 [255]
1221 [20]
1222
1222
1223 BROKEN: maybe better to abort
1223 BROKEN: maybe better to abort
1224 $ hg grep -f data add0-cp1-mod1-rm3
1224 $ hg grep -f data add0-cp1-mod1-rm3
1225 add0-cp1-mod1-rm3:1:data0
1225 add0-cp1-mod1-rm3:1:data0
1226 add0-cp1-mod1-rm3:1:data1
1226 add0-cp1-mod1-rm3:1:data1
1227
1227
1228 follow file history from wdir parent (explicit), removed:
1228 follow file history from wdir parent (explicit), removed:
1229
1229
1230 $ hg log -fr. add0-cp1-mod1-rm3
1230 $ hg log -fr. add0-cp1-mod1-rm3
1231 abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3"
1231 abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3"
1232 [255]
1232 [20]
1233
1233
1234 $ hg grep --diff -fr. data add0-cp1-mod1-rm3
1234 $ hg grep --diff -fr. data add0-cp1-mod1-rm3
1235 abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3"
1235 abort: cannot follow file not in any of the specified revisions: "add0-cp1-mod1-rm3"
1236 [255]
1236 [20]
1237
1237
1238 BROKEN: should abort
1238 BROKEN: should abort
1239 $ hg grep -fr. data add0-cp1-mod1-rm3
1239 $ hg grep -fr. data add0-cp1-mod1-rm3
1240 add0-cp1-mod1-rm3:1:data0
1240 add0-cp1-mod1-rm3:1:data0
1241 add0-cp1-mod1-rm3:1:data1
1241 add0-cp1-mod1-rm3:1:data1
1242
1242
1243 follow file history from wdir parent, removed in wdir:
1243 follow file history from wdir parent, removed in wdir:
1244
1244
1245 $ hg log -f add0-rm4
1245 $ hg log -f add0-rm4
1246 abort: cannot follow file not in parent revision: "add0-rm4"
1246 abort: cannot follow file not in parent revision: "add0-rm4"
1247 [255]
1247 [20]
1248
1248
1249 $ hg grep --diff -f data add0-rm4
1249 $ hg grep --diff -f data add0-rm4
1250 abort: cannot follow file not in parent revision: "add0-rm4"
1250 abort: cannot follow file not in parent revision: "add0-rm4"
1251 [255]
1251 [20]
1252
1252
1253 BROKEN: should abort
1253 BROKEN: should abort
1254 $ hg grep -f data add0-rm4
1254 $ hg grep -f data add0-rm4
1255 add0-rm4:3:data0
1255 add0-rm4:3:data0
1256 add0-rm4:1:data0
1256 add0-rm4:1:data0
1257 add0-rm4:0:data0
1257 add0-rm4:0:data0
1258
1258
1259 follow file history from wdir parent (explicit), removed in wdir:
1259 follow file history from wdir parent (explicit), removed in wdir:
1260
1260
1261 $ hg log -fr. add0-rm4
1261 $ hg log -fr. add0-rm4
1262 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1262 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1263
1263
1264 $ hg grep --diff -fr. data add0-rm4
1264 $ hg grep --diff -fr. data add0-rm4
1265 add0-rm4:0:+:data0
1265 add0-rm4:0:+:data0
1266
1266
1267 $ hg grep -fr. data add0-rm4
1267 $ hg grep -fr. data add0-rm4
1268 add0-rm4:3:data0
1268 add0-rm4:3:data0
1269 add0-rm4:1:data0
1269 add0-rm4:1:data0
1270 add0-rm4:0:data0
1270 add0-rm4:0:data0
1271
1271
1272 follow file history from wdir parent, multiple files:
1272 follow file history from wdir parent, multiple files:
1273
1273
1274 $ hg log -f add0-mod3 add0-cp1-mod1
1274 $ hg log -f add0-mod3 add0-cp1-mod1
1275 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1275 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1276 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1276 1: A add0-cp1, A add0-cp1-mod1, A add0-cp1-mod1-rm3, M add0-mod1, R add0-rm1
1277 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1277 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1278
1278
1279 $ hg grep --diff -f data add0-mod3 add0-cp1-mod1
1279 $ hg grep --diff -f data add0-mod3 add0-cp1-mod1
1280 add0-mod3:3:+:data3
1280 add0-mod3:3:+:data3
1281 add0-cp1-mod1:1:+:data1
1281 add0-cp1-mod1:1:+:data1
1282 add0:0:+:data0
1282 add0:0:+:data0
1283 add0-mod3:0:+:data0
1283 add0-mod3:0:+:data0
1284
1284
1285 BROKEN: should follow history across renames
1285 BROKEN: should follow history across renames
1286 $ hg grep -f data add0-mod3 add0-cp1-mod1
1286 $ hg grep -f data add0-mod3 add0-cp1-mod1
1287 add0-cp1-mod1:3:data0
1287 add0-cp1-mod1:3:data0
1288 add0-cp1-mod1:3:data1
1288 add0-cp1-mod1:3:data1
1289 add0-mod3:3:data0
1289 add0-mod3:3:data0
1290 add0-mod3:3:data3
1290 add0-mod3:3:data3
1291 add0-cp1-mod1:1:data0
1291 add0-cp1-mod1:1:data0
1292 add0-cp1-mod1:1:data1
1292 add0-cp1-mod1:1:data1
1293 add0-mod3:1:data0
1293 add0-mod3:1:data0
1294 add0-mod3:0:data0
1294 add0-mod3:0:data0
1295
1295
1296 follow file history from specified revision, modified:
1296 follow file history from specified revision, modified:
1297
1297
1298 $ hg log -fr2 add0-mod2
1298 $ hg log -fr2 add0-mod2
1299 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1299 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1300 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1300 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1301
1301
1302 $ hg grep --diff -fr2 data add0-mod2
1302 $ hg grep --diff -fr2 data add0-mod2
1303 add0-mod2:2:+:data2
1303 add0-mod2:2:+:data2
1304 add0-mod2:0:+:data0
1304 add0-mod2:0:+:data0
1305
1305
1306 $ hg grep -fr2 data add0-mod2
1306 $ hg grep -fr2 data add0-mod2
1307 add0-mod2:2:data0
1307 add0-mod2:2:data0
1308 add0-mod2:2:data2
1308 add0-mod2:2:data2
1309 add0-mod2:0:data0
1309 add0-mod2:0:data0
1310
1310
1311 follow file history from specified revision, copied but unmodified:
1311 follow file history from specified revision, copied but unmodified:
1312
1312
1313 $ hg log -fr2 add0-cp2
1313 $ hg log -fr2 add0-cp2
1314 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1314 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1315 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1315 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1316
1316
1317 $ hg grep --diff -fr2 data add0-cp2
1317 $ hg grep --diff -fr2 data add0-cp2
1318 add0:0:+:data0
1318 add0:0:+:data0
1319
1319
1320 BROKEN: should follow history across renames
1320 BROKEN: should follow history across renames
1321 $ hg grep -fr2 data add0-cp2
1321 $ hg grep -fr2 data add0-cp2
1322 add0-cp2:2:data0
1322 add0-cp2:2:data0
1323
1323
1324 follow file history from specified revision, copied and modified:
1324 follow file history from specified revision, copied and modified:
1325
1325
1326 $ hg log -fr2 add0-cp2-mod2
1326 $ hg log -fr2 add0-cp2-mod2
1327 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1327 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1328 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1328 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1329
1329
1330 $ hg grep --diff -fr2 data add0-cp2-mod2
1330 $ hg grep --diff -fr2 data add0-cp2-mod2
1331 add0-cp2-mod2:2:+:data2
1331 add0-cp2-mod2:2:+:data2
1332 add0:0:+:data0
1332 add0:0:+:data0
1333
1333
1334 BROKEN: should follow history across renames
1334 BROKEN: should follow history across renames
1335 $ hg grep -fr2 data add0-cp2-mod2
1335 $ hg grep -fr2 data add0-cp2-mod2
1336 add0-cp2-mod2:2:data0
1336 add0-cp2-mod2:2:data0
1337 add0-cp2-mod2:2:data2
1337 add0-cp2-mod2:2:data2
1338
1338
1339 follow file history from specified revision, removed:
1339 follow file history from specified revision, removed:
1340
1340
1341 $ hg log -fr2 add0-rm2
1341 $ hg log -fr2 add0-rm2
1342 abort: cannot follow file not in any of the specified revisions: "add0-rm2"
1342 abort: cannot follow file not in any of the specified revisions: "add0-rm2"
1343 [255]
1343 [20]
1344
1344
1345 $ hg grep --diff -fr2 data add0-rm2
1345 $ hg grep --diff -fr2 data add0-rm2
1346 abort: cannot follow file not in any of the specified revisions: "add0-rm2"
1346 abort: cannot follow file not in any of the specified revisions: "add0-rm2"
1347 [255]
1347 [20]
1348
1348
1349 BROKEN: should abort
1349 BROKEN: should abort
1350 $ hg grep -fr2 data add0-rm2
1350 $ hg grep -fr2 data add0-rm2
1351 add0-rm2:0:data0
1351 add0-rm2:0:data0
1352
1352
1353 follow file history from specified revision, multiple files:
1353 follow file history from specified revision, multiple files:
1354
1354
1355 $ hg log -fr2 add0-cp2 add0-mod2
1355 $ hg log -fr2 add0-cp2 add0-mod2
1356 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1356 2: A add0-cp2, A add0-cp2-mod2, M add0-mod2, R add0-rm2
1357 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1357 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1358
1358
1359 $ hg grep --diff -fr2 data add0-cp2 add0-mod2
1359 $ hg grep --diff -fr2 data add0-cp2 add0-mod2
1360 add0-mod2:2:+:data2
1360 add0-mod2:2:+:data2
1361 add0:0:+:data0
1361 add0:0:+:data0
1362 add0-mod2:0:+:data0
1362 add0-mod2:0:+:data0
1363
1363
1364 BROKEN: should follow history across renames
1364 BROKEN: should follow history across renames
1365 $ hg grep -fr2 data add0-cp2 add0-mod2
1365 $ hg grep -fr2 data add0-cp2 add0-mod2
1366 add0-cp2:2:data0
1366 add0-cp2:2:data0
1367 add0-mod2:2:data0
1367 add0-mod2:2:data0
1368 add0-mod2:2:data2
1368 add0-mod2:2:data2
1369 add0-mod2:0:data0
1369 add0-mod2:0:data0
1370
1370
1371 follow file history from wdir, unmodified:
1371 follow file history from wdir, unmodified:
1372
1372
1373 $ hg log -fr'wdir()' add0-mod3
1373 $ hg log -fr'wdir()' add0-mod3
1374 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1374 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1375 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1375 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1376 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1376 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1377
1377
1378 $ hg grep --diff -fr'wdir()' data add0-mod3
1378 $ hg grep --diff -fr'wdir()' data add0-mod3
1379 add0-mod3:3:+:data3
1379 add0-mod3:3:+:data3
1380 add0-mod3:0:+:data0
1380 add0-mod3:0:+:data0
1381
1381
1382 $ hg grep -fr'wdir()' data add0-mod3
1382 $ hg grep -fr'wdir()' data add0-mod3
1383 add0-mod3:2147483647:data0
1383 add0-mod3:2147483647:data0
1384 add0-mod3:2147483647:data3
1384 add0-mod3:2147483647:data3
1385 add0-mod3:3:data0
1385 add0-mod3:3:data0
1386 add0-mod3:3:data3
1386 add0-mod3:3:data3
1387 add0-mod3:1:data0
1387 add0-mod3:1:data0
1388 add0-mod3:0:data0
1388 add0-mod3:0:data0
1389
1389
1390 follow file history from wdir, modified:
1390 follow file history from wdir, modified:
1391
1391
1392 $ hg log -fr'wdir()' add0-mod4
1392 $ hg log -fr'wdir()' add0-mod4
1393 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1393 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1394 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1394 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1395
1395
1396 $ hg grep --diff -fr'wdir()' data add0-mod4
1396 $ hg grep --diff -fr'wdir()' data add0-mod4
1397 add0-mod4:2147483647:+:data4
1397 add0-mod4:2147483647:+:data4
1398 add0-mod4:0:+:data0
1398 add0-mod4:0:+:data0
1399
1399
1400 $ hg grep -fr'wdir()' data add0-mod4
1400 $ hg grep -fr'wdir()' data add0-mod4
1401 add0-mod4:2147483647:data0
1401 add0-mod4:2147483647:data0
1402 add0-mod4:2147483647:data4
1402 add0-mod4:2147483647:data4
1403 add0-mod4:3:data0
1403 add0-mod4:3:data0
1404 add0-mod4:1:data0
1404 add0-mod4:1:data0
1405 add0-mod4:0:data0
1405 add0-mod4:0:data0
1406
1406
1407 follow file history from wdir, copied but unmodified:
1407 follow file history from wdir, copied but unmodified:
1408
1408
1409 $ hg log -fr'wdir()' add0-cp4
1409 $ hg log -fr'wdir()' add0-cp4
1410 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1410 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1411 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1411 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1412
1412
1413 $ hg grep --diff -fr'wdir()' data add0-cp4
1413 $ hg grep --diff -fr'wdir()' data add0-cp4
1414 add0:0:+:data0
1414 add0:0:+:data0
1415
1415
1416 BROKEN: should follow history across renames
1416 BROKEN: should follow history across renames
1417 $ hg grep -fr'wdir()' data add0-cp4
1417 $ hg grep -fr'wdir()' data add0-cp4
1418 add0-cp4:2147483647:data0
1418 add0-cp4:2147483647:data0
1419
1419
1420 follow file history from wdir, copied and modified:
1420 follow file history from wdir, copied and modified:
1421
1421
1422 $ hg log -fr'wdir()' add0-cp4-mod4
1422 $ hg log -fr'wdir()' add0-cp4-mod4
1423 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1423 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1424 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1424 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1425
1425
1426 $ hg grep --diff -fr'wdir()' data add0-cp4-mod4
1426 $ hg grep --diff -fr'wdir()' data add0-cp4-mod4
1427 add0-cp4-mod4:2147483647:+:data4
1427 add0-cp4-mod4:2147483647:+:data4
1428 add0:0:+:data0
1428 add0:0:+:data0
1429
1429
1430 BROKEN: should follow history across renames
1430 BROKEN: should follow history across renames
1431 $ hg grep -fr'wdir()' data add0-cp4-mod4
1431 $ hg grep -fr'wdir()' data add0-cp4-mod4
1432 add0-cp4-mod4:2147483647:data0
1432 add0-cp4-mod4:2147483647:data0
1433 add0-cp4-mod4:2147483647:data4
1433 add0-cp4-mod4:2147483647:data4
1434
1434
1435 follow file history from wdir, multiple files:
1435 follow file history from wdir, multiple files:
1436
1436
1437 $ hg log -fr'wdir()' add0-cp4 add0-mod4 add0-mod3
1437 $ hg log -fr'wdir()' add0-cp4 add0-mod4 add0-mod3
1438 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1438 2147483647: A add0-cp4, A add0-cp4-mod4, M add0-mod4, R add0-rm4
1439 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1439 3: A add0-cp1-cp3, A add0-cp1-mod1-cp3-mod3, R add0-cp1-mod1-rm3, M add0-mod3
1440 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1440 0: A add0, A add0-mod1, A add0-mod2, A add0-mod3, A add0-mod4, A add0-rm1, A add0-rm2, A add0-rm4
1441
1441
1442 $ hg grep --diff -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1442 $ hg grep --diff -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1443 add0-mod4:2147483647:+:data4
1443 add0-mod4:2147483647:+:data4
1444 add0-mod3:3:+:data3
1444 add0-mod3:3:+:data3
1445 add0:0:+:data0
1445 add0:0:+:data0
1446 add0-mod3:0:+:data0
1446 add0-mod3:0:+:data0
1447 add0-mod4:0:+:data0
1447 add0-mod4:0:+:data0
1448
1448
1449 BROKEN: should follow history across renames
1449 BROKEN: should follow history across renames
1450 $ hg grep -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1450 $ hg grep -fr'wdir()' data add0-cp4 add0-mod4 add0-mod3
1451 add0-cp4:2147483647:data0
1451 add0-cp4:2147483647:data0
1452 add0-mod3:2147483647:data0
1452 add0-mod3:2147483647:data0
1453 add0-mod3:2147483647:data3
1453 add0-mod3:2147483647:data3
1454 add0-mod4:2147483647:data0
1454 add0-mod4:2147483647:data0
1455 add0-mod4:2147483647:data4
1455 add0-mod4:2147483647:data4
1456 add0-mod3:3:data0
1456 add0-mod3:3:data0
1457 add0-mod3:3:data3
1457 add0-mod3:3:data3
1458 add0-mod4:3:data0
1458 add0-mod4:3:data0
1459 add0-mod3:1:data0
1459 add0-mod3:1:data0
1460 add0-mod4:1:data0
1460 add0-mod4:1:data0
1461 add0-mod3:0:data0
1461 add0-mod3:0:data0
1462 add0-mod4:0:data0
1462 add0-mod4:0:data0
1463
1463
1464 $ cd ..
1464 $ cd ..
@@ -1,1153 +1,1153 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [diff]
2 > [diff]
3 > git = true
3 > git = true
4 > EOF
4 > EOF
5
5
6 $ hg init
6 $ hg init
7 $ cat > foo << EOF
7 $ cat > foo << EOF
8 > 0
8 > 0
9 > 1
9 > 1
10 > 2
10 > 2
11 > 3
11 > 3
12 > 4
12 > 4
13 > EOF
13 > EOF
14 $ hg ci -Am init
14 $ hg ci -Am init
15 adding foo
15 adding foo
16 $ cat > foo << EOF
16 $ cat > foo << EOF
17 > 0
17 > 0
18 > 0
18 > 0
19 > 0
19 > 0
20 > 0
20 > 0
21 > 1
21 > 1
22 > 2
22 > 2
23 > 3
23 > 3
24 > 4
24 > 4
25 > EOF
25 > EOF
26 $ hg ci -m 'more 0'
26 $ hg ci -m 'more 0'
27 $ sed 's/2/2+/' foo > foo.new
27 $ sed 's/2/2+/' foo > foo.new
28 $ mv foo.new foo
28 $ mv foo.new foo
29 $ cat > bar << EOF
29 $ cat > bar << EOF
30 > a
30 > a
31 > b
31 > b
32 > c
32 > c
33 > d
33 > d
34 > e
34 > e
35 > EOF
35 > EOF
36 $ hg add bar
36 $ hg add bar
37 $ hg ci -Am "2 -> 2+; added bar"
37 $ hg ci -Am "2 -> 2+; added bar"
38 $ cat >> foo << EOF
38 $ cat >> foo << EOF
39 > 5
39 > 5
40 > 6
40 > 6
41 > 7
41 > 7
42 > 8
42 > 8
43 > 9
43 > 9
44 > 10
44 > 10
45 > 11
45 > 11
46 > EOF
46 > EOF
47 $ hg ci -m "to 11"
47 $ hg ci -m "to 11"
48
48
49 Add some changes with two diff hunks
49 Add some changes with two diff hunks
50
50
51 $ sed 's/^1$/ 1/' foo > foo.new
51 $ sed 's/^1$/ 1/' foo > foo.new
52 $ mv foo.new foo
52 $ mv foo.new foo
53 $ sed 's/^11$/11+/' foo > foo.new
53 $ sed 's/^11$/11+/' foo > foo.new
54 $ mv foo.new foo
54 $ mv foo.new foo
55 $ hg ci -m '11 -> 11+; leading space before "1"'
55 $ hg ci -m '11 -> 11+; leading space before "1"'
56 (make sure there are two hunks in "foo")
56 (make sure there are two hunks in "foo")
57 $ hg diff -c .
57 $ hg diff -c .
58 diff --git a/foo b/foo
58 diff --git a/foo b/foo
59 --- a/foo
59 --- a/foo
60 +++ b/foo
60 +++ b/foo
61 @@ -2,7 +2,7 @@
61 @@ -2,7 +2,7 @@
62 0
62 0
63 0
63 0
64 0
64 0
65 -1
65 -1
66 + 1
66 + 1
67 2+
67 2+
68 3
68 3
69 4
69 4
70 @@ -12,4 +12,4 @@
70 @@ -12,4 +12,4 @@
71 8
71 8
72 9
72 9
73 10
73 10
74 -11
74 -11
75 +11+
75 +11+
76 $ sed 's/3/3+/' foo > foo.new
76 $ sed 's/3/3+/' foo > foo.new
77 $ mv foo.new foo
77 $ mv foo.new foo
78 $ sed 's/^11+$/11-/' foo > foo.new
78 $ sed 's/^11+$/11-/' foo > foo.new
79 $ mv foo.new foo
79 $ mv foo.new foo
80 $ sed 's/a/a+/' bar > bar.new
80 $ sed 's/a/a+/' bar > bar.new
81 $ mv bar.new bar
81 $ mv bar.new bar
82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 (make sure there are two hunks in "foo")
83 (make sure there are two hunks in "foo")
84 $ hg diff -c . foo
84 $ hg diff -c . foo
85 diff --git a/foo b/foo
85 diff --git a/foo b/foo
86 --- a/foo
86 --- a/foo
87 +++ b/foo
87 +++ b/foo
88 @@ -4,7 +4,7 @@
88 @@ -4,7 +4,7 @@
89 0
89 0
90 1
90 1
91 2+
91 2+
92 -3
92 -3
93 +3+
93 +3+
94 4
94 4
95 5
95 5
96 6
96 6
97 @@ -12,4 +12,4 @@
97 @@ -12,4 +12,4 @@
98 8
98 8
99 9
99 9
100 10
100 10
101 -11+
101 -11+
102 +11-
102 +11-
103
103
104 $ hg log -f -L foo,5:7 -p
104 $ hg log -f -L foo,5:7 -p
105 changeset: 5:cfdf972b3971
105 changeset: 5:cfdf972b3971
106 tag: tip
106 tag: tip
107 user: test
107 user: test
108 date: Thu Jan 01 00:00:00 1970 +0000
108 date: Thu Jan 01 00:00:00 1970 +0000
109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110
110
111 diff --git a/foo b/foo
111 diff --git a/foo b/foo
112 --- a/foo
112 --- a/foo
113 +++ b/foo
113 +++ b/foo
114 @@ -4,7 +4,7 @@
114 @@ -4,7 +4,7 @@
115 0
115 0
116 1
116 1
117 2+
117 2+
118 -3
118 -3
119 +3+
119 +3+
120 4
120 4
121 5
121 5
122 6
122 6
123
123
124 changeset: 4:eaec41c1a0c9
124 changeset: 4:eaec41c1a0c9
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:00 1970 +0000
126 date: Thu Jan 01 00:00:00 1970 +0000
127 summary: 11 -> 11+; leading space before "1"
127 summary: 11 -> 11+; leading space before "1"
128
128
129 diff --git a/foo b/foo
129 diff --git a/foo b/foo
130 --- a/foo
130 --- a/foo
131 +++ b/foo
131 +++ b/foo
132 @@ -2,7 +2,7 @@
132 @@ -2,7 +2,7 @@
133 0
133 0
134 0
134 0
135 0
135 0
136 -1
136 -1
137 + 1
137 + 1
138 2+
138 2+
139 3
139 3
140 4
140 4
141
141
142 changeset: 2:63a884426fd0
142 changeset: 2:63a884426fd0
143 user: test
143 user: test
144 date: Thu Jan 01 00:00:00 1970 +0000
144 date: Thu Jan 01 00:00:00 1970 +0000
145 summary: 2 -> 2+; added bar
145 summary: 2 -> 2+; added bar
146
146
147 diff --git a/foo b/foo
147 diff --git a/foo b/foo
148 --- a/foo
148 --- a/foo
149 +++ b/foo
149 +++ b/foo
150 @@ -3,6 +3,6 @@
150 @@ -3,6 +3,6 @@
151 0
151 0
152 0
152 0
153 1
153 1
154 -2
154 -2
155 +2+
155 +2+
156 3
156 3
157 4
157 4
158
158
159 changeset: 0:5ae1f82b9a00
159 changeset: 0:5ae1f82b9a00
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: init
162 summary: init
163
163
164 diff --git a/foo b/foo
164 diff --git a/foo b/foo
165 new file mode 100644
165 new file mode 100644
166 --- /dev/null
166 --- /dev/null
167 +++ b/foo
167 +++ b/foo
168 @@ -0,0 +1,5 @@
168 @@ -0,0 +1,5 @@
169 +0
169 +0
170 +1
170 +1
171 +2
171 +2
172 +3
172 +3
173 +4
173 +4
174
174
175 $ hg log -f --graph -L foo,5:7 -p
175 $ hg log -f --graph -L foo,5:7 -p
176 @ changeset: 5:cfdf972b3971
176 @ changeset: 5:cfdf972b3971
177 | tag: tip
177 | tag: tip
178 | user: test
178 | user: test
179 | date: Thu Jan 01 00:00:00 1970 +0000
179 | date: Thu Jan 01 00:00:00 1970 +0000
180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 |
181 |
182 | diff --git a/foo b/foo
182 | diff --git a/foo b/foo
183 | --- a/foo
183 | --- a/foo
184 | +++ b/foo
184 | +++ b/foo
185 | @@ -4,7 +4,7 @@
185 | @@ -4,7 +4,7 @@
186 | 0
186 | 0
187 | 1
187 | 1
188 | 2+
188 | 2+
189 | -3
189 | -3
190 | +3+
190 | +3+
191 | 4
191 | 4
192 | 5
192 | 5
193 | 6
193 | 6
194 |
194 |
195 o changeset: 4:eaec41c1a0c9
195 o changeset: 4:eaec41c1a0c9
196 : user: test
196 : user: test
197 : date: Thu Jan 01 00:00:00 1970 +0000
197 : date: Thu Jan 01 00:00:00 1970 +0000
198 : summary: 11 -> 11+; leading space before "1"
198 : summary: 11 -> 11+; leading space before "1"
199 :
199 :
200 : diff --git a/foo b/foo
200 : diff --git a/foo b/foo
201 : --- a/foo
201 : --- a/foo
202 : +++ b/foo
202 : +++ b/foo
203 : @@ -2,7 +2,7 @@
203 : @@ -2,7 +2,7 @@
204 : 0
204 : 0
205 : 0
205 : 0
206 : 0
206 : 0
207 : -1
207 : -1
208 : + 1
208 : + 1
209 : 2+
209 : 2+
210 : 3
210 : 3
211 : 4
211 : 4
212 :
212 :
213 o changeset: 2:63a884426fd0
213 o changeset: 2:63a884426fd0
214 : user: test
214 : user: test
215 : date: Thu Jan 01 00:00:00 1970 +0000
215 : date: Thu Jan 01 00:00:00 1970 +0000
216 : summary: 2 -> 2+; added bar
216 : summary: 2 -> 2+; added bar
217 :
217 :
218 : diff --git a/foo b/foo
218 : diff --git a/foo b/foo
219 : --- a/foo
219 : --- a/foo
220 : +++ b/foo
220 : +++ b/foo
221 : @@ -3,6 +3,6 @@
221 : @@ -3,6 +3,6 @@
222 : 0
222 : 0
223 : 0
223 : 0
224 : 1
224 : 1
225 : -2
225 : -2
226 : +2+
226 : +2+
227 : 3
227 : 3
228 : 4
228 : 4
229 :
229 :
230 o changeset: 0:5ae1f82b9a00
230 o changeset: 0:5ae1f82b9a00
231 user: test
231 user: test
232 date: Thu Jan 01 00:00:00 1970 +0000
232 date: Thu Jan 01 00:00:00 1970 +0000
233 summary: init
233 summary: init
234
234
235 diff --git a/foo b/foo
235 diff --git a/foo b/foo
236 new file mode 100644
236 new file mode 100644
237 --- /dev/null
237 --- /dev/null
238 +++ b/foo
238 +++ b/foo
239 @@ -0,0 +1,5 @@
239 @@ -0,0 +1,5 @@
240 +0
240 +0
241 +1
241 +1
242 +2
242 +2
243 +3
243 +3
244 +4
244 +4
245
245
246
246
247 With --template.
247 With --template.
248
248
249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 2:63a884426fd0 2 -> 2+; added bar
252 2:63a884426fd0 2 -> 2+; added bar
253 0:5ae1f82b9a00 init
253 0:5ae1f82b9a00 init
254 $ hg log -f -L foo,5:7 -T json
254 $ hg log -f -L foo,5:7 -T json
255 [
255 [
256 {
256 {
257 "bookmarks": [],
257 "bookmarks": [],
258 "branch": "default",
258 "branch": "default",
259 "date": [0, 0],
259 "date": [0, 0],
260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 "phase": "draft",
263 "phase": "draft",
264 "rev": 5,
264 "rev": 5,
265 "tags": ["tip"],
265 "tags": ["tip"],
266 "user": "test"
266 "user": "test"
267 },
267 },
268 {
268 {
269 "bookmarks": [],
269 "bookmarks": [],
270 "branch": "default",
270 "branch": "default",
271 "date": [0, 0],
271 "date": [0, 0],
272 "desc": "11 -> 11+; leading space before \"1\"",
272 "desc": "11 -> 11+; leading space before \"1\"",
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 "phase": "draft",
275 "phase": "draft",
276 "rev": 4,
276 "rev": 4,
277 "tags": [],
277 "tags": [],
278 "user": "test"
278 "user": "test"
279 },
279 },
280 {
280 {
281 "bookmarks": [],
281 "bookmarks": [],
282 "branch": "default",
282 "branch": "default",
283 "date": [0, 0],
283 "date": [0, 0],
284 "desc": "2 -> 2+; added bar",
284 "desc": "2 -> 2+; added bar",
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 "phase": "draft",
287 "phase": "draft",
288 "rev": 2,
288 "rev": 2,
289 "tags": [],
289 "tags": [],
290 "user": "test"
290 "user": "test"
291 },
291 },
292 {
292 {
293 "bookmarks": [],
293 "bookmarks": [],
294 "branch": "default",
294 "branch": "default",
295 "date": [0, 0],
295 "date": [0, 0],
296 "desc": "init",
296 "desc": "init",
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 "parents": ["0000000000000000000000000000000000000000"],
298 "parents": ["0000000000000000000000000000000000000000"],
299 "phase": "draft",
299 "phase": "draft",
300 "rev": 0,
300 "rev": 0,
301 "tags": [],
301 "tags": [],
302 "user": "test"
302 "user": "test"
303 }
303 }
304 ]
304 ]
305
305
306 With some white-space diff option, respective revisions are skipped.
306 With some white-space diff option, respective revisions are skipped.
307
307
308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 changeset: 5:cfdf972b3971
309 changeset: 5:cfdf972b3971
310 tag: tip
310 tag: tip
311 user: test
311 user: test
312 date: Thu Jan 01 00:00:00 1970 +0000
312 date: Thu Jan 01 00:00:00 1970 +0000
313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314
314
315 diff --git a/foo b/foo
315 diff --git a/foo b/foo
316 --- a/foo
316 --- a/foo
317 +++ b/foo
317 +++ b/foo
318 @@ -4,7 +4,7 @@
318 @@ -4,7 +4,7 @@
319 0
319 0
320 1
320 1
321 2+
321 2+
322 -3
322 -3
323 +3+
323 +3+
324 4
324 4
325 5
325 5
326 6
326 6
327
327
328 changeset: 2:63a884426fd0
328 changeset: 2:63a884426fd0
329 user: test
329 user: test
330 date: Thu Jan 01 00:00:00 1970 +0000
330 date: Thu Jan 01 00:00:00 1970 +0000
331 summary: 2 -> 2+; added bar
331 summary: 2 -> 2+; added bar
332
332
333 diff --git a/foo b/foo
333 diff --git a/foo b/foo
334 --- a/foo
334 --- a/foo
335 +++ b/foo
335 +++ b/foo
336 @@ -3,6 +3,6 @@
336 @@ -3,6 +3,6 @@
337 0
337 0
338 0
338 0
339 1
339 1
340 -2
340 -2
341 +2+
341 +2+
342 3
342 3
343 4
343 4
344
344
345 changeset: 0:5ae1f82b9a00
345 changeset: 0:5ae1f82b9a00
346 user: test
346 user: test
347 date: Thu Jan 01 00:00:00 1970 +0000
347 date: Thu Jan 01 00:00:00 1970 +0000
348 summary: init
348 summary: init
349
349
350 diff --git a/foo b/foo
350 diff --git a/foo b/foo
351 new file mode 100644
351 new file mode 100644
352 --- /dev/null
352 --- /dev/null
353 +++ b/foo
353 +++ b/foo
354 @@ -0,0 +1,5 @@
354 @@ -0,0 +1,5 @@
355 +0
355 +0
356 +1
356 +1
357 +2
357 +2
358 +3
358 +3
359 +4
359 +4
360
360
361
361
362 Regular file patterns are not allowed.
362 Regular file patterns are not allowed.
363
363
364 $ hg log -f -L foo,5:7 -p bar
364 $ hg log -f -L foo,5:7 -p bar
365 abort: FILE arguments are not compatible with --line-range option
365 abort: FILE arguments are not compatible with --line-range option
366 [10]
366 [10]
367
367
368 Option --rev acts as a restriction.
368 Option --rev acts as a restriction.
369
369
370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 changeset: 2:63a884426fd0
371 changeset: 2:63a884426fd0
372 user: test
372 user: test
373 date: Thu Jan 01 00:00:00 1970 +0000
373 date: Thu Jan 01 00:00:00 1970 +0000
374 summary: 2 -> 2+; added bar
374 summary: 2 -> 2+; added bar
375
375
376 diff --git a/foo b/foo
376 diff --git a/foo b/foo
377 --- a/foo
377 --- a/foo
378 +++ b/foo
378 +++ b/foo
379 @@ -3,6 +3,6 @@
379 @@ -3,6 +3,6 @@
380 0
380 0
381 0
381 0
382 1
382 1
383 -2
383 -2
384 +2+
384 +2+
385 3
385 3
386 4
386 4
387
387
388 changeset: 0:5ae1f82b9a00
388 changeset: 0:5ae1f82b9a00
389 user: test
389 user: test
390 date: Thu Jan 01 00:00:00 1970 +0000
390 date: Thu Jan 01 00:00:00 1970 +0000
391 summary: init
391 summary: init
392
392
393 diff --git a/foo b/foo
393 diff --git a/foo b/foo
394 new file mode 100644
394 new file mode 100644
395 --- /dev/null
395 --- /dev/null
396 +++ b/foo
396 +++ b/foo
397 @@ -0,0 +1,5 @@
397 @@ -0,0 +1,5 @@
398 +0
398 +0
399 +1
399 +1
400 +2
400 +2
401 +3
401 +3
402 +4
402 +4
403
403
404
404
405 With several -L patterns, changes touching any files in their respective line
405 With several -L patterns, changes touching any files in their respective line
406 range are show.
406 range are show.
407
407
408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 changeset: 5:cfdf972b3971
409 changeset: 5:cfdf972b3971
410 tag: tip
410 tag: tip
411 user: test
411 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
412 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414
414
415 diff --git a/bar b/bar
415 diff --git a/bar b/bar
416 --- a/bar
416 --- a/bar
417 +++ b/bar
417 +++ b/bar
418 @@ -1,4 +1,4 @@
418 @@ -1,4 +1,4 @@
419 -a
419 -a
420 +a+
420 +a+
421 b
421 b
422 c
422 c
423 d
423 d
424 diff --git a/foo b/foo
424 diff --git a/foo b/foo
425 --- a/foo
425 --- a/foo
426 +++ b/foo
426 +++ b/foo
427 @@ -4,7 +4,7 @@
427 @@ -4,7 +4,7 @@
428 0
428 0
429 1
429 1
430 2+
430 2+
431 -3
431 -3
432 +3+
432 +3+
433 4
433 4
434 5
434 5
435 6
435 6
436
436
437 changeset: 4:eaec41c1a0c9
437 changeset: 4:eaec41c1a0c9
438 user: test
438 user: test
439 date: Thu Jan 01 00:00:00 1970 +0000
439 date: Thu Jan 01 00:00:00 1970 +0000
440 summary: 11 -> 11+; leading space before "1"
440 summary: 11 -> 11+; leading space before "1"
441
441
442 diff --git a/foo b/foo
442 diff --git a/foo b/foo
443 --- a/foo
443 --- a/foo
444 +++ b/foo
444 +++ b/foo
445 @@ -2,7 +2,7 @@
445 @@ -2,7 +2,7 @@
446 0
446 0
447 0
447 0
448 0
448 0
449 -1
449 -1
450 + 1
450 + 1
451 2+
451 2+
452 3
452 3
453 4
453 4
454
454
455 changeset: 2:63a884426fd0
455 changeset: 2:63a884426fd0
456 user: test
456 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
457 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: 2 -> 2+; added bar
458 summary: 2 -> 2+; added bar
459
459
460 diff --git a/bar b/bar
460 diff --git a/bar b/bar
461 new file mode 100644
461 new file mode 100644
462 --- /dev/null
462 --- /dev/null
463 +++ b/bar
463 +++ b/bar
464 @@ -0,0 +1,5 @@
464 @@ -0,0 +1,5 @@
465 +a
465 +a
466 +b
466 +b
467 +c
467 +c
468 +d
468 +d
469 +e
469 +e
470 diff --git a/foo b/foo
470 diff --git a/foo b/foo
471 --- a/foo
471 --- a/foo
472 +++ b/foo
472 +++ b/foo
473 @@ -3,6 +3,6 @@
473 @@ -3,6 +3,6 @@
474 0
474 0
475 0
475 0
476 1
476 1
477 -2
477 -2
478 +2+
478 +2+
479 3
479 3
480 4
480 4
481
481
482 changeset: 0:5ae1f82b9a00
482 changeset: 0:5ae1f82b9a00
483 user: test
483 user: test
484 date: Thu Jan 01 00:00:00 1970 +0000
484 date: Thu Jan 01 00:00:00 1970 +0000
485 summary: init
485 summary: init
486
486
487 diff --git a/foo b/foo
487 diff --git a/foo b/foo
488 new file mode 100644
488 new file mode 100644
489 --- /dev/null
489 --- /dev/null
490 +++ b/foo
490 +++ b/foo
491 @@ -0,0 +1,5 @@
491 @@ -0,0 +1,5 @@
492 +0
492 +0
493 +1
493 +1
494 +2
494 +2
495 +3
495 +3
496 +4
496 +4
497
497
498
498
499 Multiple -L options with the same file yields changes touching any of
499 Multiple -L options with the same file yields changes touching any of
500 specified line ranges.
500 specified line ranges.
501
501
502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 changeset: 5:cfdf972b3971
503 changeset: 5:cfdf972b3971
504 tag: tip
504 tag: tip
505 user: test
505 user: test
506 date: Thu Jan 01 00:00:00 1970 +0000
506 date: Thu Jan 01 00:00:00 1970 +0000
507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508
508
509 diff --git a/foo b/foo
509 diff --git a/foo b/foo
510 --- a/foo
510 --- a/foo
511 +++ b/foo
511 +++ b/foo
512 @@ -4,7 +4,7 @@
512 @@ -4,7 +4,7 @@
513 0
513 0
514 1
514 1
515 2+
515 2+
516 -3
516 -3
517 +3+
517 +3+
518 4
518 4
519 5
519 5
520 6
520 6
521 @@ -12,4 +12,4 @@
521 @@ -12,4 +12,4 @@
522 8
522 8
523 9
523 9
524 10
524 10
525 -11+
525 -11+
526 +11-
526 +11-
527
527
528 changeset: 4:eaec41c1a0c9
528 changeset: 4:eaec41c1a0c9
529 user: test
529 user: test
530 date: Thu Jan 01 00:00:00 1970 +0000
530 date: Thu Jan 01 00:00:00 1970 +0000
531 summary: 11 -> 11+; leading space before "1"
531 summary: 11 -> 11+; leading space before "1"
532
532
533 diff --git a/foo b/foo
533 diff --git a/foo b/foo
534 --- a/foo
534 --- a/foo
535 +++ b/foo
535 +++ b/foo
536 @@ -2,7 +2,7 @@
536 @@ -2,7 +2,7 @@
537 0
537 0
538 0
538 0
539 0
539 0
540 -1
540 -1
541 + 1
541 + 1
542 2+
542 2+
543 3
543 3
544 4
544 4
545 @@ -12,4 +12,4 @@
545 @@ -12,4 +12,4 @@
546 8
546 8
547 9
547 9
548 10
548 10
549 -11
549 -11
550 +11+
550 +11+
551
551
552 changeset: 3:730a61fbaecf
552 changeset: 3:730a61fbaecf
553 user: test
553 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: to 11
555 summary: to 11
556
556
557 diff --git a/foo b/foo
557 diff --git a/foo b/foo
558 --- a/foo
558 --- a/foo
559 +++ b/foo
559 +++ b/foo
560 @@ -6,3 +6,10 @@
560 @@ -6,3 +6,10 @@
561 2+
561 2+
562 3
562 3
563 4
563 4
564 +5
564 +5
565 +6
565 +6
566 +7
566 +7
567 +8
567 +8
568 +9
568 +9
569 +10
569 +10
570 +11
570 +11
571
571
572 changeset: 2:63a884426fd0
572 changeset: 2:63a884426fd0
573 user: test
573 user: test
574 date: Thu Jan 01 00:00:00 1970 +0000
574 date: Thu Jan 01 00:00:00 1970 +0000
575 summary: 2 -> 2+; added bar
575 summary: 2 -> 2+; added bar
576
576
577 diff --git a/foo b/foo
577 diff --git a/foo b/foo
578 --- a/foo
578 --- a/foo
579 +++ b/foo
579 +++ b/foo
580 @@ -3,6 +3,6 @@
580 @@ -3,6 +3,6 @@
581 0
581 0
582 0
582 0
583 1
583 1
584 -2
584 -2
585 +2+
585 +2+
586 3
586 3
587 4
587 4
588
588
589 changeset: 0:5ae1f82b9a00
589 changeset: 0:5ae1f82b9a00
590 user: test
590 user: test
591 date: Thu Jan 01 00:00:00 1970 +0000
591 date: Thu Jan 01 00:00:00 1970 +0000
592 summary: init
592 summary: init
593
593
594 diff --git a/foo b/foo
594 diff --git a/foo b/foo
595 new file mode 100644
595 new file mode 100644
596 --- /dev/null
596 --- /dev/null
597 +++ b/foo
597 +++ b/foo
598 @@ -0,0 +1,5 @@
598 @@ -0,0 +1,5 @@
599 +0
599 +0
600 +1
600 +1
601 +2
601 +2
602 +3
602 +3
603 +4
603 +4
604
604
605
605
606 A file with a comma in its name.
606 A file with a comma in its name.
607
607
608 $ cat > ba,z << EOF
608 $ cat > ba,z << EOF
609 > q
609 > q
610 > w
610 > w
611 > e
611 > e
612 > r
612 > r
613 > t
613 > t
614 > y
614 > y
615 > EOF
615 > EOF
616 $ hg ci -Am 'querty'
616 $ hg ci -Am 'querty'
617 adding ba,z
617 adding ba,z
618 $ cat >> ba,z << EOF
618 $ cat >> ba,z << EOF
619 > u
619 > u
620 > i
620 > i
621 > o
621 > o
622 > p
622 > p
623 > EOF
623 > EOF
624 $ hg ci -m 'more keys'
624 $ hg ci -m 'more keys'
625 $ cat > ba,z << EOF
625 $ cat > ba,z << EOF
626 > a
626 > a
627 > z
627 > z
628 > e
628 > e
629 > r
629 > r
630 > t
630 > t
631 > y
631 > y
632 > u
632 > u
633 > i
633 > i
634 > o
634 > o
635 > p
635 > p
636 > EOF
636 > EOF
637 $ hg ci -m 'azerty'
637 $ hg ci -m 'azerty'
638 $ hg log -f -L ba,z,1:2 -p
638 $ hg log -f -L ba,z,1:2 -p
639 changeset: 8:52373265138b
639 changeset: 8:52373265138b
640 tag: tip
640 tag: tip
641 user: test
641 user: test
642 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
643 summary: azerty
643 summary: azerty
644
644
645 diff --git a/ba,z b/ba,z
645 diff --git a/ba,z b/ba,z
646 --- a/ba,z
646 --- a/ba,z
647 +++ b/ba,z
647 +++ b/ba,z
648 @@ -1,5 +1,5 @@
648 @@ -1,5 +1,5 @@
649 -q
649 -q
650 -w
650 -w
651 +a
651 +a
652 +z
652 +z
653 e
653 e
654 r
654 r
655 t
655 t
656
656
657 changeset: 6:96ba8850f316
657 changeset: 6:96ba8850f316
658 user: test
658 user: test
659 date: Thu Jan 01 00:00:00 1970 +0000
659 date: Thu Jan 01 00:00:00 1970 +0000
660 summary: querty
660 summary: querty
661
661
662 diff --git a/ba,z b/ba,z
662 diff --git a/ba,z b/ba,z
663 new file mode 100644
663 new file mode 100644
664 --- /dev/null
664 --- /dev/null
665 +++ b/ba,z
665 +++ b/ba,z
666 @@ -0,0 +1,6 @@
666 @@ -0,0 +1,6 @@
667 +q
667 +q
668 +w
668 +w
669 +e
669 +e
670 +r
670 +r
671 +t
671 +t
672 +y
672 +y
673
673
674
674
675 Exact prefix kinds work in -L options.
675 Exact prefix kinds work in -L options.
676
676
677 $ mkdir dir
677 $ mkdir dir
678 $ cd dir
678 $ cd dir
679 $ hg log -f -L path:foo,5:7 -p
679 $ hg log -f -L path:foo,5:7 -p
680 changeset: 5:cfdf972b3971
680 changeset: 5:cfdf972b3971
681 user: test
681 user: test
682 date: Thu Jan 01 00:00:00 1970 +0000
682 date: Thu Jan 01 00:00:00 1970 +0000
683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684
684
685 diff --git a/foo b/foo
685 diff --git a/foo b/foo
686 --- a/foo
686 --- a/foo
687 +++ b/foo
687 +++ b/foo
688 @@ -4,7 +4,7 @@
688 @@ -4,7 +4,7 @@
689 0
689 0
690 1
690 1
691 2+
691 2+
692 -3
692 -3
693 +3+
693 +3+
694 4
694 4
695 5
695 5
696 6
696 6
697
697
698 changeset: 4:eaec41c1a0c9
698 changeset: 4:eaec41c1a0c9
699 user: test
699 user: test
700 date: Thu Jan 01 00:00:00 1970 +0000
700 date: Thu Jan 01 00:00:00 1970 +0000
701 summary: 11 -> 11+; leading space before "1"
701 summary: 11 -> 11+; leading space before "1"
702
702
703 diff --git a/foo b/foo
703 diff --git a/foo b/foo
704 --- a/foo
704 --- a/foo
705 +++ b/foo
705 +++ b/foo
706 @@ -2,7 +2,7 @@
706 @@ -2,7 +2,7 @@
707 0
707 0
708 0
708 0
709 0
709 0
710 -1
710 -1
711 + 1
711 + 1
712 2+
712 2+
713 3
713 3
714 4
714 4
715
715
716 changeset: 2:63a884426fd0
716 changeset: 2:63a884426fd0
717 user: test
717 user: test
718 date: Thu Jan 01 00:00:00 1970 +0000
718 date: Thu Jan 01 00:00:00 1970 +0000
719 summary: 2 -> 2+; added bar
719 summary: 2 -> 2+; added bar
720
720
721 diff --git a/foo b/foo
721 diff --git a/foo b/foo
722 --- a/foo
722 --- a/foo
723 +++ b/foo
723 +++ b/foo
724 @@ -3,6 +3,6 @@
724 @@ -3,6 +3,6 @@
725 0
725 0
726 0
726 0
727 1
727 1
728 -2
728 -2
729 +2+
729 +2+
730 3
730 3
731 4
731 4
732
732
733 changeset: 0:5ae1f82b9a00
733 changeset: 0:5ae1f82b9a00
734 user: test
734 user: test
735 date: Thu Jan 01 00:00:00 1970 +0000
735 date: Thu Jan 01 00:00:00 1970 +0000
736 summary: init
736 summary: init
737
737
738 diff --git a/foo b/foo
738 diff --git a/foo b/foo
739 new file mode 100644
739 new file mode 100644
740 --- /dev/null
740 --- /dev/null
741 +++ b/foo
741 +++ b/foo
742 @@ -0,0 +1,5 @@
742 @@ -0,0 +1,5 @@
743 +0
743 +0
744 +1
744 +1
745 +2
745 +2
746 +3
746 +3
747 +4
747 +4
748
748
749
749
750 Renames are followed.
750 Renames are followed.
751
751
752 $ hg mv ../foo baz
752 $ hg mv ../foo baz
753 $ sed 's/1/1+/' baz > baz.new
753 $ sed 's/1/1+/' baz > baz.new
754 $ mv baz.new baz
754 $ mv baz.new baz
755 $ hg ci -m 'foo -> dir/baz; 1-1+'
755 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 $ hg diff -c .
756 $ hg diff -c .
757 diff --git a/foo b/dir/baz
757 diff --git a/foo b/dir/baz
758 rename from foo
758 rename from foo
759 rename to dir/baz
759 rename to dir/baz
760 --- a/foo
760 --- a/foo
761 +++ b/dir/baz
761 +++ b/dir/baz
762 @@ -2,7 +2,7 @@
762 @@ -2,7 +2,7 @@
763 0
763 0
764 0
764 0
765 0
765 0
766 - 1
766 - 1
767 + 1+
767 + 1+
768 2+
768 2+
769 3+
769 3+
770 4
770 4
771 @@ -11,5 +11,5 @@
771 @@ -11,5 +11,5 @@
772 7
772 7
773 8
773 8
774 9
774 9
775 -10
775 -10
776 -11-
776 -11-
777 +1+0
777 +1+0
778 +1+1-
778 +1+1-
779 $ hg log -f -L relpath:baz,5:7 -p
779 $ hg log -f -L relpath:baz,5:7 -p
780 changeset: 9:6af29c3a778f
780 changeset: 9:6af29c3a778f
781 tag: tip
781 tag: tip
782 user: test
782 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000
783 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: foo -> dir/baz; 1-1+
784 summary: foo -> dir/baz; 1-1+
785
785
786 diff --git a/foo b/dir/baz
786 diff --git a/foo b/dir/baz
787 copy from foo
787 copy from foo
788 copy to dir/baz
788 copy to dir/baz
789 --- a/foo
789 --- a/foo
790 +++ b/dir/baz
790 +++ b/dir/baz
791 @@ -2,7 +2,7 @@
791 @@ -2,7 +2,7 @@
792 0
792 0
793 0
793 0
794 0
794 0
795 - 1
795 - 1
796 + 1+
796 + 1+
797 2+
797 2+
798 3+
798 3+
799 4
799 4
800
800
801 changeset: 5:cfdf972b3971
801 changeset: 5:cfdf972b3971
802 user: test
802 user: test
803 date: Thu Jan 01 00:00:00 1970 +0000
803 date: Thu Jan 01 00:00:00 1970 +0000
804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805
805
806 diff --git a/foo b/foo
806 diff --git a/foo b/foo
807 --- a/foo
807 --- a/foo
808 +++ b/foo
808 +++ b/foo
809 @@ -4,7 +4,7 @@
809 @@ -4,7 +4,7 @@
810 0
810 0
811 1
811 1
812 2+
812 2+
813 -3
813 -3
814 +3+
814 +3+
815 4
815 4
816 5
816 5
817 6
817 6
818
818
819 changeset: 4:eaec41c1a0c9
819 changeset: 4:eaec41c1a0c9
820 user: test
820 user: test
821 date: Thu Jan 01 00:00:00 1970 +0000
821 date: Thu Jan 01 00:00:00 1970 +0000
822 summary: 11 -> 11+; leading space before "1"
822 summary: 11 -> 11+; leading space before "1"
823
823
824 diff --git a/foo b/foo
824 diff --git a/foo b/foo
825 --- a/foo
825 --- a/foo
826 +++ b/foo
826 +++ b/foo
827 @@ -2,7 +2,7 @@
827 @@ -2,7 +2,7 @@
828 0
828 0
829 0
829 0
830 0
830 0
831 -1
831 -1
832 + 1
832 + 1
833 2+
833 2+
834 3
834 3
835 4
835 4
836
836
837 changeset: 2:63a884426fd0
837 changeset: 2:63a884426fd0
838 user: test
838 user: test
839 date: Thu Jan 01 00:00:00 1970 +0000
839 date: Thu Jan 01 00:00:00 1970 +0000
840 summary: 2 -> 2+; added bar
840 summary: 2 -> 2+; added bar
841
841
842 diff --git a/foo b/foo
842 diff --git a/foo b/foo
843 --- a/foo
843 --- a/foo
844 +++ b/foo
844 +++ b/foo
845 @@ -3,6 +3,6 @@
845 @@ -3,6 +3,6 @@
846 0
846 0
847 0
847 0
848 1
848 1
849 -2
849 -2
850 +2+
850 +2+
851 3
851 3
852 4
852 4
853
853
854 changeset: 0:5ae1f82b9a00
854 changeset: 0:5ae1f82b9a00
855 user: test
855 user: test
856 date: Thu Jan 01 00:00:00 1970 +0000
856 date: Thu Jan 01 00:00:00 1970 +0000
857 summary: init
857 summary: init
858
858
859 diff --git a/foo b/foo
859 diff --git a/foo b/foo
860 new file mode 100644
860 new file mode 100644
861 --- /dev/null
861 --- /dev/null
862 +++ b/foo
862 +++ b/foo
863 @@ -0,0 +1,5 @@
863 @@ -0,0 +1,5 @@
864 +0
864 +0
865 +1
865 +1
866 +2
866 +2
867 +3
867 +3
868 +4
868 +4
869
869
870
870
871 Uncommitted changes with a rename
871 Uncommitted changes with a rename
872
872
873 $ hg mv baz bazn
873 $ hg mv baz bazn
874 $ hg log -f -L bazn,5:7
874 $ hg log -f -L bazn,5:7
875 changeset: 9:6af29c3a778f
875 changeset: 9:6af29c3a778f
876 tag: tip
876 tag: tip
877 user: test
877 user: test
878 date: Thu Jan 01 00:00:00 1970 +0000
878 date: Thu Jan 01 00:00:00 1970 +0000
879 summary: foo -> dir/baz; 1-1+
879 summary: foo -> dir/baz; 1-1+
880
880
881 changeset: 5:cfdf972b3971
881 changeset: 5:cfdf972b3971
882 user: test
882 user: test
883 date: Thu Jan 01 00:00:00 1970 +0000
883 date: Thu Jan 01 00:00:00 1970 +0000
884 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
884 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
885
885
886 changeset: 4:eaec41c1a0c9
886 changeset: 4:eaec41c1a0c9
887 user: test
887 user: test
888 date: Thu Jan 01 00:00:00 1970 +0000
888 date: Thu Jan 01 00:00:00 1970 +0000
889 summary: 11 -> 11+; leading space before "1"
889 summary: 11 -> 11+; leading space before "1"
890
890
891 changeset: 2:63a884426fd0
891 changeset: 2:63a884426fd0
892 user: test
892 user: test
893 date: Thu Jan 01 00:00:00 1970 +0000
893 date: Thu Jan 01 00:00:00 1970 +0000
894 summary: 2 -> 2+; added bar
894 summary: 2 -> 2+; added bar
895
895
896 changeset: 0:5ae1f82b9a00
896 changeset: 0:5ae1f82b9a00
897 user: test
897 user: test
898 date: Thu Jan 01 00:00:00 1970 +0000
898 date: Thu Jan 01 00:00:00 1970 +0000
899 summary: init
899 summary: init
900
900
901
901
902 Uncommitted changes in requested line range
902 Uncommitted changes in requested line range
903
903
904 $ sed 's/2/ /' bazn > bazn.new
904 $ sed 's/2/ /' bazn > bazn.new
905 $ mv bazn.new bazn
905 $ mv bazn.new bazn
906 $ hg diff
906 $ hg diff
907 diff --git a/dir/baz b/dir/bazn
907 diff --git a/dir/baz b/dir/bazn
908 rename from dir/baz
908 rename from dir/baz
909 rename to dir/bazn
909 rename to dir/bazn
910 --- a/dir/baz
910 --- a/dir/baz
911 +++ b/dir/bazn
911 +++ b/dir/bazn
912 @@ -3,7 +3,7 @@
912 @@ -3,7 +3,7 @@
913 0
913 0
914 0
914 0
915 1+
915 1+
916 -2+
916 -2+
917 + +
917 + +
918 3+
918 3+
919 4
919 4
920 5
920 5
921 $ hg log -f -L bazn,5:7
921 $ hg log -f -L bazn,5:7
922 changeset: 9:6af29c3a778f
922 changeset: 9:6af29c3a778f
923 tag: tip
923 tag: tip
924 user: test
924 user: test
925 date: Thu Jan 01 00:00:00 1970 +0000
925 date: Thu Jan 01 00:00:00 1970 +0000
926 summary: foo -> dir/baz; 1-1+
926 summary: foo -> dir/baz; 1-1+
927
927
928 changeset: 5:cfdf972b3971
928 changeset: 5:cfdf972b3971
929 user: test
929 user: test
930 date: Thu Jan 01 00:00:00 1970 +0000
930 date: Thu Jan 01 00:00:00 1970 +0000
931 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
931 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
932
932
933 changeset: 4:eaec41c1a0c9
933 changeset: 4:eaec41c1a0c9
934 user: test
934 user: test
935 date: Thu Jan 01 00:00:00 1970 +0000
935 date: Thu Jan 01 00:00:00 1970 +0000
936 summary: 11 -> 11+; leading space before "1"
936 summary: 11 -> 11+; leading space before "1"
937
937
938 changeset: 2:63a884426fd0
938 changeset: 2:63a884426fd0
939 user: test
939 user: test
940 date: Thu Jan 01 00:00:00 1970 +0000
940 date: Thu Jan 01 00:00:00 1970 +0000
941 summary: 2 -> 2+; added bar
941 summary: 2 -> 2+; added bar
942
942
943 changeset: 0:5ae1f82b9a00
943 changeset: 0:5ae1f82b9a00
944 user: test
944 user: test
945 date: Thu Jan 01 00:00:00 1970 +0000
945 date: Thu Jan 01 00:00:00 1970 +0000
946 summary: init
946 summary: init
947
947
948
948
949 Uncommitted changes in line-range + wdir()
949 Uncommitted changes in line-range + wdir()
950
950
951 $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p
951 $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p
952 changeset: 2147483647:ffffffffffff
952 changeset: 2147483647:ffffffffffff
953 parent: 9:6af29c3a778f
953 parent: 9:6af29c3a778f
954 user: test
954 user: test
955 date: Thu Jan 01 00:00:00 1970 +0000
955 date: Thu Jan 01 00:00:00 1970 +0000
956
956
957 diff --git a/dir/baz b/dir/bazn
957 diff --git a/dir/baz b/dir/bazn
958 copy from dir/baz
958 copy from dir/baz
959 copy to dir/bazn
959 copy to dir/bazn
960 --- a/dir/baz
960 --- a/dir/baz
961 +++ b/dir/bazn
961 +++ b/dir/bazn
962 @@ -3,7 +3,7 @@
962 @@ -3,7 +3,7 @@
963 0
963 0
964 0
964 0
965 1+
965 1+
966 -2+
966 -2+
967 + +
967 + +
968 3+
968 3+
969 4
969 4
970 5
970 5
971
971
972 changeset: 9:6af29c3a778f
972 changeset: 9:6af29c3a778f
973 tag: tip
973 tag: tip
974 user: test
974 user: test
975 date: Thu Jan 01 00:00:00 1970 +0000
975 date: Thu Jan 01 00:00:00 1970 +0000
976 summary: foo -> dir/baz; 1-1+
976 summary: foo -> dir/baz; 1-1+
977
977
978 diff --git a/foo b/dir/baz
978 diff --git a/foo b/dir/baz
979 copy from foo
979 copy from foo
980 copy to dir/baz
980 copy to dir/baz
981 --- a/foo
981 --- a/foo
982 +++ b/dir/baz
982 +++ b/dir/baz
983 @@ -2,7 +2,7 @@
983 @@ -2,7 +2,7 @@
984 0
984 0
985 0
985 0
986 0
986 0
987 - 1
987 - 1
988 + 1+
988 + 1+
989 2+
989 2+
990 3+
990 3+
991 4
991 4
992
992
993
993
994 $ hg revert -a -C -q
994 $ hg revert -a -C -q
995
995
996 Copies.
996 Copies.
997
997
998 $ hg copy baz bbaz
998 $ hg copy baz bbaz
999 $ sed 's/6/6+/' bbaz > bbaz.new
999 $ sed 's/6/6+/' bbaz > bbaz.new
1000 $ mv bbaz.new bbaz
1000 $ mv bbaz.new bbaz
1001 $ hg commit -m 'cp baz bbaz; 6-6+'
1001 $ hg commit -m 'cp baz bbaz; 6-6+'
1002 $ hg diff -c .
1002 $ hg diff -c .
1003 diff --git a/dir/baz b/dir/bbaz
1003 diff --git a/dir/baz b/dir/bbaz
1004 copy from dir/baz
1004 copy from dir/baz
1005 copy to dir/bbaz
1005 copy to dir/bbaz
1006 --- a/dir/baz
1006 --- a/dir/baz
1007 +++ b/dir/bbaz
1007 +++ b/dir/bbaz
1008 @@ -7,7 +7,7 @@
1008 @@ -7,7 +7,7 @@
1009 3+
1009 3+
1010 4
1010 4
1011 5
1011 5
1012 -6
1012 -6
1013 +6+
1013 +6+
1014 7
1014 7
1015 8
1015 8
1016 9
1016 9
1017 $ hg log --copies -f -L bbaz,10:11 -p
1017 $ hg log --copies -f -L bbaz,10:11 -p
1018 changeset: 10:91a3d3b6c546
1018 changeset: 10:91a3d3b6c546
1019 tag: tip
1019 tag: tip
1020 user: test
1020 user: test
1021 date: Thu Jan 01 00:00:00 1970 +0000
1021 date: Thu Jan 01 00:00:00 1970 +0000
1022 summary: cp baz bbaz; 6-6+
1022 summary: cp baz bbaz; 6-6+
1023
1023
1024 diff --git a/dir/baz b/dir/bbaz
1024 diff --git a/dir/baz b/dir/bbaz
1025 copy from dir/baz
1025 copy from dir/baz
1026 copy to dir/bbaz
1026 copy to dir/bbaz
1027 --- a/dir/baz
1027 --- a/dir/baz
1028 +++ b/dir/bbaz
1028 +++ b/dir/bbaz
1029 @@ -7,7 +7,7 @@
1029 @@ -7,7 +7,7 @@
1030 3+
1030 3+
1031 4
1031 4
1032 5
1032 5
1033 -6
1033 -6
1034 +6+
1034 +6+
1035 7
1035 7
1036 8
1036 8
1037 9
1037 9
1038
1038
1039 changeset: 3:730a61fbaecf
1039 changeset: 3:730a61fbaecf
1040 user: test
1040 user: test
1041 date: Thu Jan 01 00:00:00 1970 +0000
1041 date: Thu Jan 01 00:00:00 1970 +0000
1042 summary: to 11
1042 summary: to 11
1043
1043
1044 diff --git a/foo b/foo
1044 diff --git a/foo b/foo
1045 --- a/foo
1045 --- a/foo
1046 +++ b/foo
1046 +++ b/foo
1047 @@ -6,3 +6,10 @@
1047 @@ -6,3 +6,10 @@
1048 2+
1048 2+
1049 3
1049 3
1050 4
1050 4
1051 +5
1051 +5
1052 +6
1052 +6
1053 +7
1053 +7
1054 +8
1054 +8
1055 +9
1055 +9
1056 +10
1056 +10
1057 +11
1057 +11
1058
1058
1059 $ hg log -f -L bbaz,10:11 -p
1059 $ hg log -f -L bbaz,10:11 -p
1060 changeset: 10:91a3d3b6c546
1060 changeset: 10:91a3d3b6c546
1061 tag: tip
1061 tag: tip
1062 user: test
1062 user: test
1063 date: Thu Jan 01 00:00:00 1970 +0000
1063 date: Thu Jan 01 00:00:00 1970 +0000
1064 summary: cp baz bbaz; 6-6+
1064 summary: cp baz bbaz; 6-6+
1065
1065
1066 diff --git a/dir/baz b/dir/bbaz
1066 diff --git a/dir/baz b/dir/bbaz
1067 copy from dir/baz
1067 copy from dir/baz
1068 copy to dir/bbaz
1068 copy to dir/bbaz
1069 --- a/dir/baz
1069 --- a/dir/baz
1070 +++ b/dir/bbaz
1070 +++ b/dir/bbaz
1071 @@ -7,7 +7,7 @@
1071 @@ -7,7 +7,7 @@
1072 3+
1072 3+
1073 4
1073 4
1074 5
1074 5
1075 -6
1075 -6
1076 +6+
1076 +6+
1077 7
1077 7
1078 8
1078 8
1079 9
1079 9
1080
1080
1081 changeset: 3:730a61fbaecf
1081 changeset: 3:730a61fbaecf
1082 user: test
1082 user: test
1083 date: Thu Jan 01 00:00:00 1970 +0000
1083 date: Thu Jan 01 00:00:00 1970 +0000
1084 summary: to 11
1084 summary: to 11
1085
1085
1086 diff --git a/foo b/foo
1086 diff --git a/foo b/foo
1087 --- a/foo
1087 --- a/foo
1088 +++ b/foo
1088 +++ b/foo
1089 @@ -6,3 +6,10 @@
1089 @@ -6,3 +6,10 @@
1090 2+
1090 2+
1091 3
1091 3
1092 4
1092 4
1093 +5
1093 +5
1094 +6
1094 +6
1095 +7
1095 +7
1096 +8
1096 +8
1097 +9
1097 +9
1098 +10
1098 +10
1099 +11
1099 +11
1100
1100
1101
1101
1102 Binary files work but without diff hunks filtering.
1102 Binary files work but without diff hunks filtering.
1103 (Checking w/ and w/o diff.git option.)
1103 (Checking w/ and w/o diff.git option.)
1104
1104
1105 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
1105 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
1106 $ hg add binary
1106 $ hg add binary
1107 $ hg ci -m 'add a binary file' --quiet
1107 $ hg ci -m 'add a binary file' --quiet
1108 $ hg log -f -L binary,1:2 -p
1108 $ hg log -f -L binary,1:2 -p
1109 changeset: 11:dc865b608edf
1109 changeset: 11:dc865b608edf
1110 tag: tip
1110 tag: tip
1111 user: test
1111 user: test
1112 date: Thu Jan 01 00:00:00 1970 +0000
1112 date: Thu Jan 01 00:00:00 1970 +0000
1113 summary: add a binary file
1113 summary: add a binary file
1114
1114
1115 diff --git a/dir/binary b/dir/binary
1115 diff --git a/dir/binary b/dir/binary
1116 new file mode 100644
1116 new file mode 100644
1117 index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
1117 index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
1118 GIT binary patch
1118 GIT binary patch
1119 literal 17
1119 literal 17
1120 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
1120 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
1121
1121
1122
1122
1123 $ hg log -f -L binary,1:2 -p --config diff.git=false
1123 $ hg log -f -L binary,1:2 -p --config diff.git=false
1124 changeset: 11:dc865b608edf
1124 changeset: 11:dc865b608edf
1125 tag: tip
1125 tag: tip
1126 user: test
1126 user: test
1127 date: Thu Jan 01 00:00:00 1970 +0000
1127 date: Thu Jan 01 00:00:00 1970 +0000
1128 summary: add a binary file
1128 summary: add a binary file
1129
1129
1130 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
1130 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
1131 Binary file dir/binary has changed
1131 Binary file dir/binary has changed
1132
1132
1133
1133
1134 Option --follow is required.
1134 Option --follow is required.
1135
1135
1136 $ hg log -L foo,5:7
1136 $ hg log -L foo,5:7
1137 abort: --line-range requires --follow
1137 abort: --line-range requires --follow
1138 [10]
1138 [10]
1139
1139
1140 Non-exact pattern kinds are not allowed.
1140 Non-exact pattern kinds are not allowed.
1141
1141
1142 $ cd ..
1142 $ cd ..
1143 $ hg log -f -L glob:*a*,1:2
1143 $ hg log -f -L glob:*a*,1:2
1144 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1144 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1145 [10]
1145 [10]
1146
1146
1147 We get an error for removed files.
1147 We get an error for removed files.
1148
1148
1149 $ hg rm dir/baz
1149 $ hg rm dir/baz
1150 $ hg ci -m 'remove baz' --quiet
1150 $ hg ci -m 'remove baz' --quiet
1151 $ hg log -f -L dir/baz,5:7 -p
1151 $ hg log -f -L dir/baz,5:7 -p
1152 abort: cannot follow file not in parent revision: "dir/baz"
1152 abort: cannot follow file not in parent revision: "dir/baz"
1153 [255]
1153 [20]
@@ -1,2971 +1,2971 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 [10]
8 [10]
9 $ hg log -r -1:0
9 $ hg log -r -1:0
10 abort: unknown revision '-1'
10 abort: unknown revision '-1'
11 [10]
11 [10]
12 $ hg log -r 'branch(name)'
12 $ hg log -r 'branch(name)'
13 abort: unknown revision 'name'
13 abort: unknown revision 'name'
14 [10]
14 [10]
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 log empty path (or repo root) of slow path shouldn't crash (issue6478)
105 log empty path (or repo root) of slow path shouldn't crash (issue6478)
106
106
107 $ hg log -ql1 '' inexistent
107 $ hg log -ql1 '' inexistent
108 4:7e4639b4691b
108 4:7e4639b4691b
109 $ hg log -ql1 . inexistent
109 $ hg log -ql1 . inexistent
110 4:7e4639b4691b
110 4:7e4639b4691b
111 $ hg log -ql1 "`pwd`" inexistent
111 $ hg log -ql1 "`pwd`" inexistent
112 4:7e4639b4691b
112 4:7e4639b4691b
113
113
114 $ hg log -ql1 '' e
114 $ hg log -ql1 '' e
115 4:7e4639b4691b
115 4:7e4639b4691b
116 $ hg log -ql1 . e
116 $ hg log -ql1 . e
117 4:7e4639b4691b
117 4:7e4639b4691b
118 $ hg log -ql1 "`pwd`" e
118 $ hg log -ql1 "`pwd`" e
119 4:7e4639b4691b
119 4:7e4639b4691b
120
120
121 log -f empty path (or repo root) shouldn't crash
121 log -f empty path (or repo root) shouldn't crash
122
122
123 $ hg log -qfl1 '' inexistent
123 $ hg log -qfl1 '' inexistent
124 abort: cannot follow file not in parent revision: "inexistent"
124 abort: cannot follow file not in parent revision: "inexistent"
125 [255]
125 [20]
126 $ hg log -qfl1 . inexistent
126 $ hg log -qfl1 . inexistent
127 abort: cannot follow file not in parent revision: "inexistent"
127 abort: cannot follow file not in parent revision: "inexistent"
128 [255]
128 [20]
129 $ hg log -qfl1 "`pwd`" inexistent
129 $ hg log -qfl1 "`pwd`" inexistent
130 abort: cannot follow file not in parent revision: "inexistent"
130 abort: cannot follow file not in parent revision: "inexistent"
131 [255]
131 [20]
132
132
133 $ hg log -qfl1 '' e
133 $ hg log -qfl1 '' e
134 4:7e4639b4691b
134 4:7e4639b4691b
135 $ hg log -qfl1 . e
135 $ hg log -qfl1 . e
136 4:7e4639b4691b
136 4:7e4639b4691b
137 $ hg log -qfl1 "`pwd`" e
137 $ hg log -qfl1 "`pwd`" e
138 4:7e4639b4691b
138 4:7e4639b4691b
139
139
140 -X, with explicit path
140 -X, with explicit path
141
141
142 $ hg log a -X a
142 $ hg log a -X a
143
143
144 -f, non-existent directory
144 -f, non-existent directory
145
145
146 $ hg log -f dir
146 $ hg log -f dir
147 abort: cannot follow file not in parent revision: "dir"
147 abort: cannot follow file not in parent revision: "dir"
148 [255]
148 [20]
149
149
150 -f, directory
150 -f, directory
151
151
152 $ hg up -q 3
152 $ hg up -q 3
153 $ hg log -f dir
153 $ hg log -f dir
154 changeset: 2:f8954cd4dc1f
154 changeset: 2:f8954cd4dc1f
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:03 1970 +0000
156 date: Thu Jan 01 00:00:03 1970 +0000
157 summary: c
157 summary: c
158
158
159 -f, directory with --patch
159 -f, directory with --patch
160
160
161 $ hg log -f dir -p
161 $ hg log -f dir -p
162 changeset: 2:f8954cd4dc1f
162 changeset: 2:f8954cd4dc1f
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:03 1970 +0000
164 date: Thu Jan 01 00:00:03 1970 +0000
165 summary: c
165 summary: c
166
166
167 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
167 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
168 --- /dev/null* (glob)
168 --- /dev/null* (glob)
169 +++ b/dir/b* (glob)
169 +++ b/dir/b* (glob)
170 @@ -0,0 +1,1 @@
170 @@ -0,0 +1,1 @@
171 +a
171 +a
172
172
173
173
174 -f, pattern
174 -f, pattern
175
175
176 $ hg log -f -I 'dir**' -p
176 $ hg log -f -I 'dir**' -p
177 changeset: 2:f8954cd4dc1f
177 changeset: 2:f8954cd4dc1f
178 user: test
178 user: test
179 date: Thu Jan 01 00:00:03 1970 +0000
179 date: Thu Jan 01 00:00:03 1970 +0000
180 summary: c
180 summary: c
181
181
182 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
182 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
183 --- /dev/null* (glob)
183 --- /dev/null* (glob)
184 +++ b/dir/b* (glob)
184 +++ b/dir/b* (glob)
185 @@ -0,0 +1,1 @@
185 @@ -0,0 +1,1 @@
186 +a
186 +a
187
187
188 $ hg up -q 4
188 $ hg up -q 4
189
189
190 -f, a wrong style
190 -f, a wrong style
191
191
192 $ hg log -f -l1 --style something
192 $ hg log -f -l1 --style something
193 abort: style 'something' not found
193 abort: style 'something' not found
194 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
194 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
195 [255]
195 [255]
196
196
197 -f, phases style
197 -f, phases style
198
198
199
199
200 $ hg log -f -l1 --style phases
200 $ hg log -f -l1 --style phases
201 changeset: 4:7e4639b4691b
201 changeset: 4:7e4639b4691b
202 tag: tip
202 tag: tip
203 phase: draft
203 phase: draft
204 user: test
204 user: test
205 date: Thu Jan 01 00:00:05 1970 +0000
205 date: Thu Jan 01 00:00:05 1970 +0000
206 summary: e
206 summary: e
207
207
208
208
209 $ hg log -f -l1 --style phases -q
209 $ hg log -f -l1 --style phases -q
210 4:7e4639b4691b
210 4:7e4639b4691b
211
211
212 -f, but no args
212 -f, but no args
213
213
214 $ hg log -f
214 $ hg log -f
215 changeset: 4:7e4639b4691b
215 changeset: 4:7e4639b4691b
216 tag: tip
216 tag: tip
217 user: test
217 user: test
218 date: Thu Jan 01 00:00:05 1970 +0000
218 date: Thu Jan 01 00:00:05 1970 +0000
219 summary: e
219 summary: e
220
220
221 changeset: 3:2ca5ba701980
221 changeset: 3:2ca5ba701980
222 user: test
222 user: test
223 date: Thu Jan 01 00:00:04 1970 +0000
223 date: Thu Jan 01 00:00:04 1970 +0000
224 summary: d
224 summary: d
225
225
226 changeset: 2:f8954cd4dc1f
226 changeset: 2:f8954cd4dc1f
227 user: test
227 user: test
228 date: Thu Jan 01 00:00:03 1970 +0000
228 date: Thu Jan 01 00:00:03 1970 +0000
229 summary: c
229 summary: c
230
230
231 changeset: 1:d89b0a12d229
231 changeset: 1:d89b0a12d229
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:02 1970 +0000
233 date: Thu Jan 01 00:00:02 1970 +0000
234 summary: b
234 summary: b
235
235
236 changeset: 0:9161b9aeaf16
236 changeset: 0:9161b9aeaf16
237 user: test
237 user: test
238 date: Thu Jan 01 00:00:01 1970 +0000
238 date: Thu Jan 01 00:00:01 1970 +0000
239 summary: a
239 summary: a
240
240
241
241
242 one rename
242 one rename
243
243
244 $ hg up -q 2
244 $ hg up -q 2
245 $ hg log -vf a
245 $ hg log -vf a
246 changeset: 0:9161b9aeaf16
246 changeset: 0:9161b9aeaf16
247 user: test
247 user: test
248 date: Thu Jan 01 00:00:01 1970 +0000
248 date: Thu Jan 01 00:00:01 1970 +0000
249 files: a f
249 files: a f
250 description:
250 description:
251 a
251 a
252
252
253
253
254
254
255 many renames
255 many renames
256
256
257 $ hg up -q tip
257 $ hg up -q tip
258 $ hg log -vf e
258 $ hg log -vf e
259 changeset: 4:7e4639b4691b
259 changeset: 4:7e4639b4691b
260 tag: tip
260 tag: tip
261 user: test
261 user: test
262 date: Thu Jan 01 00:00:05 1970 +0000
262 date: Thu Jan 01 00:00:05 1970 +0000
263 files: dir/b e
263 files: dir/b e
264 description:
264 description:
265 e
265 e
266
266
267
267
268 changeset: 2:f8954cd4dc1f
268 changeset: 2:f8954cd4dc1f
269 user: test
269 user: test
270 date: Thu Jan 01 00:00:03 1970 +0000
270 date: Thu Jan 01 00:00:03 1970 +0000
271 files: b dir/b f g
271 files: b dir/b f g
272 description:
272 description:
273 c
273 c
274
274
275
275
276 changeset: 1:d89b0a12d229
276 changeset: 1:d89b0a12d229
277 user: test
277 user: test
278 date: Thu Jan 01 00:00:02 1970 +0000
278 date: Thu Jan 01 00:00:02 1970 +0000
279 files: b g
279 files: b g
280 description:
280 description:
281 b
281 b
282
282
283
283
284 changeset: 0:9161b9aeaf16
284 changeset: 0:9161b9aeaf16
285 user: test
285 user: test
286 date: Thu Jan 01 00:00:01 1970 +0000
286 date: Thu Jan 01 00:00:01 1970 +0000
287 files: a f
287 files: a f
288 description:
288 description:
289 a
289 a
290
290
291
291
292
292
293
293
294 log -pf dir/b
294 log -pf dir/b
295
295
296 $ hg up -q 3
296 $ hg up -q 3
297 $ hg log -pf dir/b
297 $ hg log -pf dir/b
298 changeset: 2:f8954cd4dc1f
298 changeset: 2:f8954cd4dc1f
299 user: test
299 user: test
300 date: Thu Jan 01 00:00:03 1970 +0000
300 date: Thu Jan 01 00:00:03 1970 +0000
301 summary: c
301 summary: c
302
302
303 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
303 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
304 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
304 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
305 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
305 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
306 @@ -0,0 +1,1 @@
306 @@ -0,0 +1,1 @@
307 +a
307 +a
308
308
309 changeset: 1:d89b0a12d229
309 changeset: 1:d89b0a12d229
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:02 1970 +0000
311 date: Thu Jan 01 00:00:02 1970 +0000
312 summary: b
312 summary: b
313
313
314 diff -r 9161b9aeaf16 -r d89b0a12d229 b
314 diff -r 9161b9aeaf16 -r d89b0a12d229 b
315 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
315 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
316 +++ b/b Thu Jan 01 00:00:02 1970 +0000
316 +++ b/b Thu Jan 01 00:00:02 1970 +0000
317 @@ -0,0 +1,1 @@
317 @@ -0,0 +1,1 @@
318 +a
318 +a
319
319
320 changeset: 0:9161b9aeaf16
320 changeset: 0:9161b9aeaf16
321 user: test
321 user: test
322 date: Thu Jan 01 00:00:01 1970 +0000
322 date: Thu Jan 01 00:00:01 1970 +0000
323 summary: a
323 summary: a
324
324
325 diff -r 000000000000 -r 9161b9aeaf16 a
325 diff -r 000000000000 -r 9161b9aeaf16 a
326 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
326 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
327 +++ b/a Thu Jan 01 00:00:01 1970 +0000
327 +++ b/a Thu Jan 01 00:00:01 1970 +0000
328 @@ -0,0 +1,1 @@
328 @@ -0,0 +1,1 @@
329 +a
329 +a
330
330
331
331
332 log -pf b inside dir
332 log -pf b inside dir
333
333
334 $ hg --cwd=dir log -pf b
334 $ hg --cwd=dir log -pf b
335 changeset: 2:f8954cd4dc1f
335 changeset: 2:f8954cd4dc1f
336 user: test
336 user: test
337 date: Thu Jan 01 00:00:03 1970 +0000
337 date: Thu Jan 01 00:00:03 1970 +0000
338 summary: c
338 summary: c
339
339
340 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
340 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
341 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
341 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
342 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
342 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
343 @@ -0,0 +1,1 @@
343 @@ -0,0 +1,1 @@
344 +a
344 +a
345
345
346 changeset: 1:d89b0a12d229
346 changeset: 1:d89b0a12d229
347 user: test
347 user: test
348 date: Thu Jan 01 00:00:02 1970 +0000
348 date: Thu Jan 01 00:00:02 1970 +0000
349 summary: b
349 summary: b
350
350
351 diff -r 9161b9aeaf16 -r d89b0a12d229 b
351 diff -r 9161b9aeaf16 -r d89b0a12d229 b
352 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
352 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
353 +++ b/b Thu Jan 01 00:00:02 1970 +0000
353 +++ b/b Thu Jan 01 00:00:02 1970 +0000
354 @@ -0,0 +1,1 @@
354 @@ -0,0 +1,1 @@
355 +a
355 +a
356
356
357 changeset: 0:9161b9aeaf16
357 changeset: 0:9161b9aeaf16
358 user: test
358 user: test
359 date: Thu Jan 01 00:00:01 1970 +0000
359 date: Thu Jan 01 00:00:01 1970 +0000
360 summary: a
360 summary: a
361
361
362 diff -r 000000000000 -r 9161b9aeaf16 a
362 diff -r 000000000000 -r 9161b9aeaf16 a
363 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
363 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
364 +++ b/a Thu Jan 01 00:00:01 1970 +0000
364 +++ b/a Thu Jan 01 00:00:01 1970 +0000
365 @@ -0,0 +1,1 @@
365 @@ -0,0 +1,1 @@
366 +a
366 +a
367
367
368
368
369 log -pf, but no args
369 log -pf, but no args
370
370
371 $ hg log -pf
371 $ hg log -pf
372 changeset: 3:2ca5ba701980
372 changeset: 3:2ca5ba701980
373 user: test
373 user: test
374 date: Thu Jan 01 00:00:04 1970 +0000
374 date: Thu Jan 01 00:00:04 1970 +0000
375 summary: d
375 summary: d
376
376
377 diff -r f8954cd4dc1f -r 2ca5ba701980 a
377 diff -r f8954cd4dc1f -r 2ca5ba701980 a
378 --- a/a Thu Jan 01 00:00:03 1970 +0000
378 --- a/a Thu Jan 01 00:00:03 1970 +0000
379 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
379 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
380 @@ -1,1 +0,0 @@
380 @@ -1,1 +0,0 @@
381 -a
381 -a
382 diff -r f8954cd4dc1f -r 2ca5ba701980 b
382 diff -r f8954cd4dc1f -r 2ca5ba701980 b
383 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
383 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
384 +++ b/b Thu Jan 01 00:00:04 1970 +0000
384 +++ b/b Thu Jan 01 00:00:04 1970 +0000
385 @@ -0,0 +1,1 @@
385 @@ -0,0 +1,1 @@
386 +a
386 +a
387 diff -r f8954cd4dc1f -r 2ca5ba701980 d
387 diff -r f8954cd4dc1f -r 2ca5ba701980 d
388 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
388 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
389 +++ b/d Thu Jan 01 00:00:04 1970 +0000
389 +++ b/d Thu Jan 01 00:00:04 1970 +0000
390 @@ -0,0 +1,1 @@
390 @@ -0,0 +1,1 @@
391 +a
391 +a
392 diff -r f8954cd4dc1f -r 2ca5ba701980 g
392 diff -r f8954cd4dc1f -r 2ca5ba701980 g
393 --- a/g Thu Jan 01 00:00:03 1970 +0000
393 --- a/g Thu Jan 01 00:00:03 1970 +0000
394 +++ b/g Thu Jan 01 00:00:04 1970 +0000
394 +++ b/g Thu Jan 01 00:00:04 1970 +0000
395 @@ -1,2 +1,2 @@
395 @@ -1,2 +1,2 @@
396 f
396 f
397 -g
397 -g
398 +f
398 +f
399
399
400 changeset: 2:f8954cd4dc1f
400 changeset: 2:f8954cd4dc1f
401 user: test
401 user: test
402 date: Thu Jan 01 00:00:03 1970 +0000
402 date: Thu Jan 01 00:00:03 1970 +0000
403 summary: c
403 summary: c
404
404
405 diff -r d89b0a12d229 -r f8954cd4dc1f b
405 diff -r d89b0a12d229 -r f8954cd4dc1f b
406 --- a/b Thu Jan 01 00:00:02 1970 +0000
406 --- a/b Thu Jan 01 00:00:02 1970 +0000
407 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
407 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
408 @@ -1,1 +0,0 @@
408 @@ -1,1 +0,0 @@
409 -a
409 -a
410 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
410 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
411 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
411 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
412 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
412 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
413 @@ -0,0 +1,1 @@
413 @@ -0,0 +1,1 @@
414 +a
414 +a
415 diff -r d89b0a12d229 -r f8954cd4dc1f f
415 diff -r d89b0a12d229 -r f8954cd4dc1f f
416 --- a/f Thu Jan 01 00:00:02 1970 +0000
416 --- a/f Thu Jan 01 00:00:02 1970 +0000
417 +++ b/f Thu Jan 01 00:00:03 1970 +0000
417 +++ b/f Thu Jan 01 00:00:03 1970 +0000
418 @@ -1,1 +1,2 @@
418 @@ -1,1 +1,2 @@
419 f
419 f
420 +f
420 +f
421 diff -r d89b0a12d229 -r f8954cd4dc1f g
421 diff -r d89b0a12d229 -r f8954cd4dc1f g
422 --- a/g Thu Jan 01 00:00:02 1970 +0000
422 --- a/g Thu Jan 01 00:00:02 1970 +0000
423 +++ b/g Thu Jan 01 00:00:03 1970 +0000
423 +++ b/g Thu Jan 01 00:00:03 1970 +0000
424 @@ -1,1 +1,2 @@
424 @@ -1,1 +1,2 @@
425 f
425 f
426 +g
426 +g
427
427
428 changeset: 1:d89b0a12d229
428 changeset: 1:d89b0a12d229
429 user: test
429 user: test
430 date: Thu Jan 01 00:00:02 1970 +0000
430 date: Thu Jan 01 00:00:02 1970 +0000
431 summary: b
431 summary: b
432
432
433 diff -r 9161b9aeaf16 -r d89b0a12d229 b
433 diff -r 9161b9aeaf16 -r d89b0a12d229 b
434 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
434 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
435 +++ b/b Thu Jan 01 00:00:02 1970 +0000
435 +++ b/b Thu Jan 01 00:00:02 1970 +0000
436 @@ -0,0 +1,1 @@
436 @@ -0,0 +1,1 @@
437 +a
437 +a
438 diff -r 9161b9aeaf16 -r d89b0a12d229 g
438 diff -r 9161b9aeaf16 -r d89b0a12d229 g
439 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
439 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
440 +++ b/g Thu Jan 01 00:00:02 1970 +0000
440 +++ b/g Thu Jan 01 00:00:02 1970 +0000
441 @@ -0,0 +1,1 @@
441 @@ -0,0 +1,1 @@
442 +f
442 +f
443
443
444 changeset: 0:9161b9aeaf16
444 changeset: 0:9161b9aeaf16
445 user: test
445 user: test
446 date: Thu Jan 01 00:00:01 1970 +0000
446 date: Thu Jan 01 00:00:01 1970 +0000
447 summary: a
447 summary: a
448
448
449 diff -r 000000000000 -r 9161b9aeaf16 a
449 diff -r 000000000000 -r 9161b9aeaf16 a
450 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
450 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
451 +++ b/a Thu Jan 01 00:00:01 1970 +0000
451 +++ b/a Thu Jan 01 00:00:01 1970 +0000
452 @@ -0,0 +1,1 @@
452 @@ -0,0 +1,1 @@
453 +a
453 +a
454 diff -r 000000000000 -r 9161b9aeaf16 f
454 diff -r 000000000000 -r 9161b9aeaf16 f
455 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
455 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
456 +++ b/f Thu Jan 01 00:00:01 1970 +0000
456 +++ b/f Thu Jan 01 00:00:01 1970 +0000
457 @@ -0,0 +1,1 @@
457 @@ -0,0 +1,1 @@
458 +f
458 +f
459
459
460
460
461 log -vf dir/b
461 log -vf dir/b
462
462
463 $ hg log -vf dir/b
463 $ hg log -vf dir/b
464 changeset: 2:f8954cd4dc1f
464 changeset: 2:f8954cd4dc1f
465 user: test
465 user: test
466 date: Thu Jan 01 00:00:03 1970 +0000
466 date: Thu Jan 01 00:00:03 1970 +0000
467 files: b dir/b f g
467 files: b dir/b f g
468 description:
468 description:
469 c
469 c
470
470
471
471
472 changeset: 1:d89b0a12d229
472 changeset: 1:d89b0a12d229
473 user: test
473 user: test
474 date: Thu Jan 01 00:00:02 1970 +0000
474 date: Thu Jan 01 00:00:02 1970 +0000
475 files: b g
475 files: b g
476 description:
476 description:
477 b
477 b
478
478
479
479
480 changeset: 0:9161b9aeaf16
480 changeset: 0:9161b9aeaf16
481 user: test
481 user: test
482 date: Thu Jan 01 00:00:01 1970 +0000
482 date: Thu Jan 01 00:00:01 1970 +0000
483 files: a f
483 files: a f
484 description:
484 description:
485 a
485 a
486
486
487
487
488 Respects ui.logtemplate and command-templates.log configs (the latter takes
488 Respects ui.logtemplate and command-templates.log configs (the latter takes
489 precedence)
489 precedence)
490
490
491 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n"
491 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n"
492 foo 0
492 foo 0
493 $ hg log -r 0 --config command-templates.log="bar {rev}\n"
493 $ hg log -r 0 --config command-templates.log="bar {rev}\n"
494 bar 0
494 bar 0
495 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n" \
495 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n" \
496 > --config command-templates.log="bar {rev}\n"
496 > --config command-templates.log="bar {rev}\n"
497 bar 0
497 bar 0
498
498
499
499
500 -f and multiple filelog heads
500 -f and multiple filelog heads
501
501
502 $ hg up -q 2
502 $ hg up -q 2
503 $ hg log -f g --template '{rev}\n'
503 $ hg log -f g --template '{rev}\n'
504 2
504 2
505 1
505 1
506 0
506 0
507 $ hg up -q tip
507 $ hg up -q tip
508 $ hg log -f g --template '{rev}\n'
508 $ hg log -f g --template '{rev}\n'
509 3
509 3
510 2
510 2
511 0
511 0
512
512
513 follow files from the specified revisions (issue4959)
513 follow files from the specified revisions (issue4959)
514
514
515 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
515 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
516 @ 4 dir/b e, dir/b->e
516 @ 4 dir/b e, dir/b->e
517 |
517 |
518 o 3 a b d g, a->b f->g
518 o 3 a b d g, a->b f->g
519 |
519 |
520 o 2 b dir/b f g, b->dir/b
520 o 2 b dir/b f g, b->dir/b
521 |
521 |
522 o 1 b g, a->b f->g
522 o 1 b g, a->b f->g
523 |
523 |
524 o 0 a f,
524 o 0 a f,
525
525
526
526
527 $ hg log -T '{rev}\n' -fr 4 e
527 $ hg log -T '{rev}\n' -fr 4 e
528 4
528 4
529 2
529 2
530 1
530 1
531 0
531 0
532 $ hg log -T '{rev}\n' -fr 2 g
532 $ hg log -T '{rev}\n' -fr 2 g
533 2
533 2
534 1
534 1
535 0
535 0
536 $ hg log -T '{rev}\n' -fr '2+3' g
536 $ hg log -T '{rev}\n' -fr '2+3' g
537 3
537 3
538 2
538 2
539 1
539 1
540 0
540 0
541
541
542 follow files from the specified revisions with glob patterns (issue5053)
542 follow files from the specified revisions with glob patterns (issue5053)
543 (BROKEN: should follow copies from e@4)
543 (BROKEN: should follow copies from e@4)
544
544
545 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
545 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
546 4
546 4
547 2 (false !)
547 2 (false !)
548 1 (false !)
548 1 (false !)
549 0 (false !)
549 0 (false !)
550
550
551 follow files from the specified revisions with missing patterns
551 follow files from the specified revisions with missing patterns
552
552
553 $ hg log -T '{rev}\n' -fr4 e x
553 $ hg log -T '{rev}\n' -fr4 e x
554 abort: cannot follow file not in any of the specified revisions: "x"
554 abort: cannot follow file not in any of the specified revisions: "x"
555 [255]
555 [20]
556
556
557 follow files from the specified revisions with directory patterns
557 follow files from the specified revisions with directory patterns
558 (BROKEN: should follow copies from dir/b@2)
558 (BROKEN: should follow copies from dir/b@2)
559
559
560 $ hg log -T '{rev}\n' -fr2 dir/b dir
560 $ hg log -T '{rev}\n' -fr2 dir/b dir
561 2
561 2
562 1 (false !)
562 1 (false !)
563 0 (false !)
563 0 (false !)
564
564
565 follow files from multiple revisions, but the pattern is missing in
565 follow files from multiple revisions, but the pattern is missing in
566 one of the specified revisions
566 one of the specified revisions
567
567
568 $ hg log -T '{rev}\n' -fr'2+4' dir/b e
568 $ hg log -T '{rev}\n' -fr'2+4' dir/b e
569 e: no such file in rev f8954cd4dc1f
569 e: no such file in rev f8954cd4dc1f
570 dir/b: no such file in rev 7e4639b4691b
570 dir/b: no such file in rev 7e4639b4691b
571 4
571 4
572 2
572 2
573 1
573 1
574 0
574 0
575
575
576 follow files from multiple revisions, and the pattern matches a file in
576 follow files from multiple revisions, and the pattern matches a file in
577 one revision but matches a directory in another:
577 one revision but matches a directory in another:
578 (BROKEN: should follow copies from dir/b@2 and dir/b/g@5)
578 (BROKEN: should follow copies from dir/b@2 and dir/b/g@5)
579 (BROKEN: the revision 4 should not be included since dir/b/g@5 is unchanged)
579 (BROKEN: the revision 4 should not be included since dir/b/g@5 is unchanged)
580
580
581 $ mkdir -p dir/b
581 $ mkdir -p dir/b
582 $ hg mv g dir/b
582 $ hg mv g dir/b
583 $ hg ci -m 'make dir/b a directory'
583 $ hg ci -m 'make dir/b a directory'
584
584
585 $ hg log -T '{rev}\n' -fr'2+5' dir/b
585 $ hg log -T '{rev}\n' -fr'2+5' dir/b
586 5
586 5
587 4
587 4
588 3 (false !)
588 3 (false !)
589 2
589 2
590 1 (false !)
590 1 (false !)
591 0 (false !)
591 0 (false !)
592
592
593 $ hg --config extensions.strip= strip -r. --no-backup
593 $ hg --config extensions.strip= strip -r. --no-backup
594 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
594 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
595
595
596 follow files from the specified revisions across copies with -p/--patch
596 follow files from the specified revisions across copies with -p/--patch
597
597
598 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
598 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
599 == rev: 4, dir/b->e ==
599 == rev: 4, dir/b->e ==
600 diff -r 2ca5ba701980 -r 7e4639b4691b e
600 diff -r 2ca5ba701980 -r 7e4639b4691b e
601 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
601 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
602 +++ b/e Thu Jan 01 00:00:05 1970 +0000
602 +++ b/e Thu Jan 01 00:00:05 1970 +0000
603 @@ -0,0 +1,1 @@
603 @@ -0,0 +1,1 @@
604 +a
604 +a
605
605
606 == rev: 3, a->b f->g ==
606 == rev: 3, a->b f->g ==
607 diff -r f8954cd4dc1f -r 2ca5ba701980 g
607 diff -r f8954cd4dc1f -r 2ca5ba701980 g
608 --- a/g Thu Jan 01 00:00:03 1970 +0000
608 --- a/g Thu Jan 01 00:00:03 1970 +0000
609 +++ b/g Thu Jan 01 00:00:04 1970 +0000
609 +++ b/g Thu Jan 01 00:00:04 1970 +0000
610 @@ -1,2 +1,2 @@
610 @@ -1,2 +1,2 @@
611 f
611 f
612 -g
612 -g
613 +f
613 +f
614
614
615 == rev: 2, b->dir/b ==
615 == rev: 2, b->dir/b ==
616 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
616 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
617 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
617 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
618 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
618 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
619 @@ -0,0 +1,1 @@
619 @@ -0,0 +1,1 @@
620 +a
620 +a
621 diff -r d89b0a12d229 -r f8954cd4dc1f f
621 diff -r d89b0a12d229 -r f8954cd4dc1f f
622 --- a/f Thu Jan 01 00:00:02 1970 +0000
622 --- a/f Thu Jan 01 00:00:02 1970 +0000
623 +++ b/f Thu Jan 01 00:00:03 1970 +0000
623 +++ b/f Thu Jan 01 00:00:03 1970 +0000
624 @@ -1,1 +1,2 @@
624 @@ -1,1 +1,2 @@
625 f
625 f
626 +f
626 +f
627
627
628 == rev: 1, a->b f->g ==
628 == rev: 1, a->b f->g ==
629 diff -r 9161b9aeaf16 -r d89b0a12d229 b
629 diff -r 9161b9aeaf16 -r d89b0a12d229 b
630 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
630 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
631 +++ b/b Thu Jan 01 00:00:02 1970 +0000
631 +++ b/b Thu Jan 01 00:00:02 1970 +0000
632 @@ -0,0 +1,1 @@
632 @@ -0,0 +1,1 @@
633 +a
633 +a
634
634
635 == rev: 0, ==
635 == rev: 0, ==
636 diff -r 000000000000 -r 9161b9aeaf16 a
636 diff -r 000000000000 -r 9161b9aeaf16 a
637 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
637 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
638 +++ b/a Thu Jan 01 00:00:01 1970 +0000
638 +++ b/a Thu Jan 01 00:00:01 1970 +0000
639 @@ -0,0 +1,1 @@
639 @@ -0,0 +1,1 @@
640 +a
640 +a
641 diff -r 000000000000 -r 9161b9aeaf16 f
641 diff -r 000000000000 -r 9161b9aeaf16 f
642 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
642 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
643 +++ b/f Thu Jan 01 00:00:01 1970 +0000
643 +++ b/f Thu Jan 01 00:00:01 1970 +0000
644 @@ -0,0 +1,1 @@
644 @@ -0,0 +1,1 @@
645 +f
645 +f
646
646
647
647
648 log copies with --copies
648 log copies with --copies
649
649
650 $ hg log -vC --template '{rev} {file_copies}\n'
650 $ hg log -vC --template '{rev} {file_copies}\n'
651 4 e (dir/b)
651 4 e (dir/b)
652 3 b (a)g (f)
652 3 b (a)g (f)
653 2 dir/b (b)
653 2 dir/b (b)
654 1 b (a)g (f)
654 1 b (a)g (f)
655 0
655 0
656
656
657 log copies switch without --copies, with old filecopy template
657 log copies switch without --copies, with old filecopy template
658
658
659 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
659 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
660 4
660 4
661 3
661 3
662 2
662 2
663 1
663 1
664 0
664 0
665
665
666 log copies switch with --copies
666 log copies switch with --copies
667
667
668 $ hg log -vC --template '{rev} {file_copies_switch}\n'
668 $ hg log -vC --template '{rev} {file_copies_switch}\n'
669 4 e (dir/b)
669 4 e (dir/b)
670 3 b (a)g (f)
670 3 b (a)g (f)
671 2 dir/b (b)
671 2 dir/b (b)
672 1 b (a)g (f)
672 1 b (a)g (f)
673 0
673 0
674
674
675
675
676 log copies with hardcoded style and with --style=default
676 log copies with hardcoded style and with --style=default
677
677
678 $ hg log -vC -r4
678 $ hg log -vC -r4
679 changeset: 4:7e4639b4691b
679 changeset: 4:7e4639b4691b
680 tag: tip
680 tag: tip
681 user: test
681 user: test
682 date: Thu Jan 01 00:00:05 1970 +0000
682 date: Thu Jan 01 00:00:05 1970 +0000
683 files: dir/b e
683 files: dir/b e
684 copies: e (dir/b)
684 copies: e (dir/b)
685 description:
685 description:
686 e
686 e
687
687
688
688
689 $ hg log -vC -r4 --style=default
689 $ hg log -vC -r4 --style=default
690 changeset: 4:7e4639b4691b
690 changeset: 4:7e4639b4691b
691 tag: tip
691 tag: tip
692 user: test
692 user: test
693 date: Thu Jan 01 00:00:05 1970 +0000
693 date: Thu Jan 01 00:00:05 1970 +0000
694 files: dir/b e
694 files: dir/b e
695 copies: e (dir/b)
695 copies: e (dir/b)
696 description:
696 description:
697 e
697 e
698
698
699
699
700 $ hg log -vC -r4 -Tjson
700 $ hg log -vC -r4 -Tjson
701 [
701 [
702 {
702 {
703 "bookmarks": [],
703 "bookmarks": [],
704 "branch": "default",
704 "branch": "default",
705 "copies": {"e": "dir/b"},
705 "copies": {"e": "dir/b"},
706 "date": [5, 0],
706 "date": [5, 0],
707 "desc": "e",
707 "desc": "e",
708 "files": ["dir/b", "e"],
708 "files": ["dir/b", "e"],
709 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
709 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
710 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
710 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
711 "phase": "draft",
711 "phase": "draft",
712 "rev": 4,
712 "rev": 4,
713 "tags": ["tip"],
713 "tags": ["tip"],
714 "user": "test"
714 "user": "test"
715 }
715 }
716 ]
716 ]
717
717
718 log copies, non-linear manifest
718 log copies, non-linear manifest
719
719
720 $ hg up -C 3
720 $ hg up -C 3
721 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
721 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
722 $ hg mv dir/b e
722 $ hg mv dir/b e
723 $ echo foo > foo
723 $ echo foo > foo
724 $ hg ci -Ame2 -d '6 0'
724 $ hg ci -Ame2 -d '6 0'
725 adding foo
725 adding foo
726 created new head
726 created new head
727 $ hg log -v --template '{rev} {file_copies}\n' -r 5
727 $ hg log -v --template '{rev} {file_copies}\n' -r 5
728 5 e (dir/b)
728 5 e (dir/b)
729
729
730
730
731 log copies, execute bit set
731 log copies, execute bit set
732
732
733 #if execbit
733 #if execbit
734 $ chmod +x e
734 $ chmod +x e
735 $ hg ci -me3 -d '7 0'
735 $ hg ci -me3 -d '7 0'
736 $ hg log -v --template '{rev} {file_copies}\n' -r 6
736 $ hg log -v --template '{rev} {file_copies}\n' -r 6
737 6
737 6
738 #endif
738 #endif
739
739
740 log copies, empty set
740 log copies, empty set
741
741
742 $ hg log --copies -r '0 and not 0'
742 $ hg log --copies -r '0 and not 0'
743
743
744 log -p d
744 log -p d
745
745
746 $ hg log -pv d
746 $ hg log -pv d
747 changeset: 3:2ca5ba701980
747 changeset: 3:2ca5ba701980
748 user: test
748 user: test
749 date: Thu Jan 01 00:00:04 1970 +0000
749 date: Thu Jan 01 00:00:04 1970 +0000
750 files: a b d g
750 files: a b d g
751 description:
751 description:
752 d
752 d
753
753
754
754
755 diff -r f8954cd4dc1f -r 2ca5ba701980 d
755 diff -r f8954cd4dc1f -r 2ca5ba701980 d
756 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
756 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
757 +++ b/d Thu Jan 01 00:00:04 1970 +0000
757 +++ b/d Thu Jan 01 00:00:04 1970 +0000
758 @@ -0,0 +1,1 @@
758 @@ -0,0 +1,1 @@
759 +a
759 +a
760
760
761
761
762
762
763 log --removed file
763 log --removed file
764
764
765 $ hg log --removed -v a
765 $ hg log --removed -v a
766 changeset: 3:2ca5ba701980
766 changeset: 3:2ca5ba701980
767 user: test
767 user: test
768 date: Thu Jan 01 00:00:04 1970 +0000
768 date: Thu Jan 01 00:00:04 1970 +0000
769 files: a b d g
769 files: a b d g
770 description:
770 description:
771 d
771 d
772
772
773
773
774 changeset: 0:9161b9aeaf16
774 changeset: 0:9161b9aeaf16
775 user: test
775 user: test
776 date: Thu Jan 01 00:00:01 1970 +0000
776 date: Thu Jan 01 00:00:01 1970 +0000
777 files: a f
777 files: a f
778 description:
778 description:
779 a
779 a
780
780
781
781
782
782
783 log --removed revrange file
783 log --removed revrange file
784
784
785 $ hg log --removed -v -r0:2 a
785 $ hg log --removed -v -r0:2 a
786 changeset: 0:9161b9aeaf16
786 changeset: 0:9161b9aeaf16
787 user: test
787 user: test
788 date: Thu Jan 01 00:00:01 1970 +0000
788 date: Thu Jan 01 00:00:01 1970 +0000
789 files: a f
789 files: a f
790 description:
790 description:
791 a
791 a
792
792
793
793
794 $ cd ..
794 $ cd ..
795
795
796 log --follow tests
796 log --follow tests
797
797
798 $ hg init follow
798 $ hg init follow
799 $ cd follow
799 $ cd follow
800
800
801 $ echo base > base
801 $ echo base > base
802 $ hg ci -Ambase -d '1 0'
802 $ hg ci -Ambase -d '1 0'
803 adding base
803 adding base
804
804
805 $ echo r1 >> base
805 $ echo r1 >> base
806 $ hg ci -Amr1 -d '1 0'
806 $ hg ci -Amr1 -d '1 0'
807 $ echo r2 >> base
807 $ echo r2 >> base
808 $ hg ci -Amr2 -d '1 0'
808 $ hg ci -Amr2 -d '1 0'
809
809
810 $ hg up -C 1
810 $ hg up -C 1
811 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
812 $ echo b1 > b1
812 $ echo b1 > b1
813
813
814 log -r "follow('set:clean()')"
814 log -r "follow('set:clean()')"
815
815
816 $ hg log -r "follow('set:clean()')"
816 $ hg log -r "follow('set:clean()')"
817 changeset: 0:67e992f2c4f3
817 changeset: 0:67e992f2c4f3
818 user: test
818 user: test
819 date: Thu Jan 01 00:00:01 1970 +0000
819 date: Thu Jan 01 00:00:01 1970 +0000
820 summary: base
820 summary: base
821
821
822 changeset: 1:3d5bf5654eda
822 changeset: 1:3d5bf5654eda
823 user: test
823 user: test
824 date: Thu Jan 01 00:00:01 1970 +0000
824 date: Thu Jan 01 00:00:01 1970 +0000
825 summary: r1
825 summary: r1
826
826
827
827
828 $ hg ci -Amb1 -d '1 0'
828 $ hg ci -Amb1 -d '1 0'
829 adding b1
829 adding b1
830 created new head
830 created new head
831
831
832
832
833 log -f
833 log -f
834
834
835 $ hg log -f
835 $ hg log -f
836 changeset: 3:e62f78d544b4
836 changeset: 3:e62f78d544b4
837 tag: tip
837 tag: tip
838 parent: 1:3d5bf5654eda
838 parent: 1:3d5bf5654eda
839 user: test
839 user: test
840 date: Thu Jan 01 00:00:01 1970 +0000
840 date: Thu Jan 01 00:00:01 1970 +0000
841 summary: b1
841 summary: b1
842
842
843 changeset: 1:3d5bf5654eda
843 changeset: 1:3d5bf5654eda
844 user: test
844 user: test
845 date: Thu Jan 01 00:00:01 1970 +0000
845 date: Thu Jan 01 00:00:01 1970 +0000
846 summary: r1
846 summary: r1
847
847
848 changeset: 0:67e992f2c4f3
848 changeset: 0:67e992f2c4f3
849 user: test
849 user: test
850 date: Thu Jan 01 00:00:01 1970 +0000
850 date: Thu Jan 01 00:00:01 1970 +0000
851 summary: base
851 summary: base
852
852
853
853
854 log -r follow('glob:b*')
854 log -r follow('glob:b*')
855
855
856 $ hg log -r "follow('glob:b*')"
856 $ hg log -r "follow('glob:b*')"
857 changeset: 0:67e992f2c4f3
857 changeset: 0:67e992f2c4f3
858 user: test
858 user: test
859 date: Thu Jan 01 00:00:01 1970 +0000
859 date: Thu Jan 01 00:00:01 1970 +0000
860 summary: base
860 summary: base
861
861
862 changeset: 1:3d5bf5654eda
862 changeset: 1:3d5bf5654eda
863 user: test
863 user: test
864 date: Thu Jan 01 00:00:01 1970 +0000
864 date: Thu Jan 01 00:00:01 1970 +0000
865 summary: r1
865 summary: r1
866
866
867 changeset: 3:e62f78d544b4
867 changeset: 3:e62f78d544b4
868 tag: tip
868 tag: tip
869 parent: 1:3d5bf5654eda
869 parent: 1:3d5bf5654eda
870 user: test
870 user: test
871 date: Thu Jan 01 00:00:01 1970 +0000
871 date: Thu Jan 01 00:00:01 1970 +0000
872 summary: b1
872 summary: b1
873
873
874 log -f -r '1 + 4'
874 log -f -r '1 + 4'
875
875
876 $ hg up -C 0
876 $ hg up -C 0
877 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
877 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
878 $ echo b2 > b2
878 $ echo b2 > b2
879 $ hg ci -Amb2 -d '1 0'
879 $ hg ci -Amb2 -d '1 0'
880 adding b2
880 adding b2
881 created new head
881 created new head
882 $ hg log -f -r '1 + 4'
882 $ hg log -f -r '1 + 4'
883 changeset: 4:ddb82e70d1a1
883 changeset: 4:ddb82e70d1a1
884 tag: tip
884 tag: tip
885 parent: 0:67e992f2c4f3
885 parent: 0:67e992f2c4f3
886 user: test
886 user: test
887 date: Thu Jan 01 00:00:01 1970 +0000
887 date: Thu Jan 01 00:00:01 1970 +0000
888 summary: b2
888 summary: b2
889
889
890 changeset: 1:3d5bf5654eda
890 changeset: 1:3d5bf5654eda
891 user: test
891 user: test
892 date: Thu Jan 01 00:00:01 1970 +0000
892 date: Thu Jan 01 00:00:01 1970 +0000
893 summary: r1
893 summary: r1
894
894
895 changeset: 0:67e992f2c4f3
895 changeset: 0:67e992f2c4f3
896 user: test
896 user: test
897 date: Thu Jan 01 00:00:01 1970 +0000
897 date: Thu Jan 01 00:00:01 1970 +0000
898 summary: base
898 summary: base
899
899
900
900
901 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
901 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
902 effect
902 effect
903
903
904 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
904 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
905 4:ddb82e70d1a1
905 4:ddb82e70d1a1
906 1:3d5bf5654eda
906 1:3d5bf5654eda
907 0:67e992f2c4f3
907 0:67e992f2c4f3
908
908
909 log -r "follow('set:grep(b2)')"
909 log -r "follow('set:grep(b2)')"
910
910
911 $ hg log -r "follow('set:grep(b2)')"
911 $ hg log -r "follow('set:grep(b2)')"
912 changeset: 4:ddb82e70d1a1
912 changeset: 4:ddb82e70d1a1
913 tag: tip
913 tag: tip
914 parent: 0:67e992f2c4f3
914 parent: 0:67e992f2c4f3
915 user: test
915 user: test
916 date: Thu Jan 01 00:00:01 1970 +0000
916 date: Thu Jan 01 00:00:01 1970 +0000
917 summary: b2
917 summary: b2
918
918
919 log -r "follow('set:grep(b2)', 4)"
919 log -r "follow('set:grep(b2)', 4)"
920
920
921 $ hg up -qC 0
921 $ hg up -qC 0
922 $ hg log -r "follow('set:grep(b2)', 4)"
922 $ hg log -r "follow('set:grep(b2)', 4)"
923 changeset: 4:ddb82e70d1a1
923 changeset: 4:ddb82e70d1a1
924 tag: tip
924 tag: tip
925 parent: 0:67e992f2c4f3
925 parent: 0:67e992f2c4f3
926 user: test
926 user: test
927 date: Thu Jan 01 00:00:01 1970 +0000
927 date: Thu Jan 01 00:00:01 1970 +0000
928 summary: b2
928 summary: b2
929
929
930
930
931 follow files starting from multiple revisions:
931 follow files starting from multiple revisions:
932
932
933 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
933 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
934 3: b1
934 3: b1
935 4: b2
935 4: b2
936
936
937 follow files starting from empty revision:
937 follow files starting from empty revision:
938
938
939 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
939 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
940
940
941 follow starting from revisions:
941 follow starting from revisions:
942
942
943 $ hg log -Gq -r "follow(startrev=2+4)"
943 $ hg log -Gq -r "follow(startrev=2+4)"
944 o 4:ddb82e70d1a1
944 o 4:ddb82e70d1a1
945 |
945 |
946 | o 2:60c670bf5b30
946 | o 2:60c670bf5b30
947 | |
947 | |
948 | o 1:3d5bf5654eda
948 | o 1:3d5bf5654eda
949 |/
949 |/
950 @ 0:67e992f2c4f3
950 @ 0:67e992f2c4f3
951
951
952
952
953 follow the current revision:
953 follow the current revision:
954
954
955 $ hg log -Gq -r "follow()"
955 $ hg log -Gq -r "follow()"
956 @ 0:67e992f2c4f3
956 @ 0:67e992f2c4f3
957
957
958
958
959 $ hg up -qC 4
959 $ hg up -qC 4
960
960
961 log -f -r null
961 log -f -r null
962
962
963 $ hg log -f -r null
963 $ hg log -f -r null
964 changeset: -1:000000000000
964 changeset: -1:000000000000
965 user:
965 user:
966 date: Thu Jan 01 00:00:00 1970 +0000
966 date: Thu Jan 01 00:00:00 1970 +0000
967
967
968 $ hg log -f -r null -G
968 $ hg log -f -r null -G
969 o changeset: -1:000000000000
969 o changeset: -1:000000000000
970 user:
970 user:
971 date: Thu Jan 01 00:00:00 1970 +0000
971 date: Thu Jan 01 00:00:00 1970 +0000
972
972
973
973
974
974
975 log -f with null parent
975 log -f with null parent
976
976
977 $ hg up -C null
977 $ hg up -C null
978 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
978 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
979 $ hg log -f
979 $ hg log -f
980
980
981
981
982 log -r . with two parents
982 log -r . with two parents
983
983
984 $ hg up -C 3
984 $ hg up -C 3
985 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
985 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
986 $ hg merge tip
986 $ hg merge tip
987 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
987 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
988 (branch merge, don't forget to commit)
988 (branch merge, don't forget to commit)
989 $ hg log -r .
989 $ hg log -r .
990 changeset: 3:e62f78d544b4
990 changeset: 3:e62f78d544b4
991 parent: 1:3d5bf5654eda
991 parent: 1:3d5bf5654eda
992 user: test
992 user: test
993 date: Thu Jan 01 00:00:01 1970 +0000
993 date: Thu Jan 01 00:00:01 1970 +0000
994 summary: b1
994 summary: b1
995
995
996
996
997
997
998 log -r . with one parent
998 log -r . with one parent
999
999
1000 $ hg ci -mm12 -d '1 0'
1000 $ hg ci -mm12 -d '1 0'
1001 $ hg log -r .
1001 $ hg log -r .
1002 changeset: 5:302e9dd6890d
1002 changeset: 5:302e9dd6890d
1003 tag: tip
1003 tag: tip
1004 parent: 3:e62f78d544b4
1004 parent: 3:e62f78d544b4
1005 parent: 4:ddb82e70d1a1
1005 parent: 4:ddb82e70d1a1
1006 user: test
1006 user: test
1007 date: Thu Jan 01 00:00:01 1970 +0000
1007 date: Thu Jan 01 00:00:01 1970 +0000
1008 summary: m12
1008 summary: m12
1009
1009
1010
1010
1011 $ echo postm >> b1
1011 $ echo postm >> b1
1012 $ hg ci -Amb1.1 -d'1 0'
1012 $ hg ci -Amb1.1 -d'1 0'
1013
1013
1014
1014
1015 log --follow-first
1015 log --follow-first
1016
1016
1017 $ hg log --follow-first
1017 $ hg log --follow-first
1018 changeset: 6:2404bbcab562
1018 changeset: 6:2404bbcab562
1019 tag: tip
1019 tag: tip
1020 user: test
1020 user: test
1021 date: Thu Jan 01 00:00:01 1970 +0000
1021 date: Thu Jan 01 00:00:01 1970 +0000
1022 summary: b1.1
1022 summary: b1.1
1023
1023
1024 changeset: 5:302e9dd6890d
1024 changeset: 5:302e9dd6890d
1025 parent: 3:e62f78d544b4
1025 parent: 3:e62f78d544b4
1026 parent: 4:ddb82e70d1a1
1026 parent: 4:ddb82e70d1a1
1027 user: test
1027 user: test
1028 date: Thu Jan 01 00:00:01 1970 +0000
1028 date: Thu Jan 01 00:00:01 1970 +0000
1029 summary: m12
1029 summary: m12
1030
1030
1031 changeset: 3:e62f78d544b4
1031 changeset: 3:e62f78d544b4
1032 parent: 1:3d5bf5654eda
1032 parent: 1:3d5bf5654eda
1033 user: test
1033 user: test
1034 date: Thu Jan 01 00:00:01 1970 +0000
1034 date: Thu Jan 01 00:00:01 1970 +0000
1035 summary: b1
1035 summary: b1
1036
1036
1037 changeset: 1:3d5bf5654eda
1037 changeset: 1:3d5bf5654eda
1038 user: test
1038 user: test
1039 date: Thu Jan 01 00:00:01 1970 +0000
1039 date: Thu Jan 01 00:00:01 1970 +0000
1040 summary: r1
1040 summary: r1
1041
1041
1042 changeset: 0:67e992f2c4f3
1042 changeset: 0:67e992f2c4f3
1043 user: test
1043 user: test
1044 date: Thu Jan 01 00:00:01 1970 +0000
1044 date: Thu Jan 01 00:00:01 1970 +0000
1045 summary: base
1045 summary: base
1046
1046
1047
1047
1048
1048
1049 log -P 2
1049 log -P 2
1050
1050
1051 $ hg log -P 2
1051 $ hg log -P 2
1052 changeset: 6:2404bbcab562
1052 changeset: 6:2404bbcab562
1053 tag: tip
1053 tag: tip
1054 user: test
1054 user: test
1055 date: Thu Jan 01 00:00:01 1970 +0000
1055 date: Thu Jan 01 00:00:01 1970 +0000
1056 summary: b1.1
1056 summary: b1.1
1057
1057
1058 changeset: 5:302e9dd6890d
1058 changeset: 5:302e9dd6890d
1059 parent: 3:e62f78d544b4
1059 parent: 3:e62f78d544b4
1060 parent: 4:ddb82e70d1a1
1060 parent: 4:ddb82e70d1a1
1061 user: test
1061 user: test
1062 date: Thu Jan 01 00:00:01 1970 +0000
1062 date: Thu Jan 01 00:00:01 1970 +0000
1063 summary: m12
1063 summary: m12
1064
1064
1065 changeset: 4:ddb82e70d1a1
1065 changeset: 4:ddb82e70d1a1
1066 parent: 0:67e992f2c4f3
1066 parent: 0:67e992f2c4f3
1067 user: test
1067 user: test
1068 date: Thu Jan 01 00:00:01 1970 +0000
1068 date: Thu Jan 01 00:00:01 1970 +0000
1069 summary: b2
1069 summary: b2
1070
1070
1071 changeset: 3:e62f78d544b4
1071 changeset: 3:e62f78d544b4
1072 parent: 1:3d5bf5654eda
1072 parent: 1:3d5bf5654eda
1073 user: test
1073 user: test
1074 date: Thu Jan 01 00:00:01 1970 +0000
1074 date: Thu Jan 01 00:00:01 1970 +0000
1075 summary: b1
1075 summary: b1
1076
1076
1077
1077
1078
1078
1079 log -r tip -p --git
1079 log -r tip -p --git
1080
1080
1081 $ hg log -r tip -p --git
1081 $ hg log -r tip -p --git
1082 changeset: 6:2404bbcab562
1082 changeset: 6:2404bbcab562
1083 tag: tip
1083 tag: tip
1084 user: test
1084 user: test
1085 date: Thu Jan 01 00:00:01 1970 +0000
1085 date: Thu Jan 01 00:00:01 1970 +0000
1086 summary: b1.1
1086 summary: b1.1
1087
1087
1088 diff --git a/b1 b/b1
1088 diff --git a/b1 b/b1
1089 --- a/b1
1089 --- a/b1
1090 +++ b/b1
1090 +++ b/b1
1091 @@ -1,1 +1,2 @@
1091 @@ -1,1 +1,2 @@
1092 b1
1092 b1
1093 +postm
1093 +postm
1094
1094
1095
1095
1096
1096
1097 log -r ""
1097 log -r ""
1098
1098
1099 $ hg log -r ''
1099 $ hg log -r ''
1100 hg: parse error: empty query
1100 hg: parse error: empty query
1101 [10]
1101 [10]
1102
1102
1103 log -r <some unknown node id>
1103 log -r <some unknown node id>
1104
1104
1105 $ hg log -r 1000000000000000000000000000000000000000
1105 $ hg log -r 1000000000000000000000000000000000000000
1106 abort: unknown revision '1000000000000000000000000000000000000000'
1106 abort: unknown revision '1000000000000000000000000000000000000000'
1107 [10]
1107 [10]
1108
1108
1109 log -k r1
1109 log -k r1
1110
1110
1111 $ hg log -k r1
1111 $ hg log -k r1
1112 changeset: 1:3d5bf5654eda
1112 changeset: 1:3d5bf5654eda
1113 user: test
1113 user: test
1114 date: Thu Jan 01 00:00:01 1970 +0000
1114 date: Thu Jan 01 00:00:01 1970 +0000
1115 summary: r1
1115 summary: r1
1116
1116
1117 log -p -l2 --color=always
1117 log -p -l2 --color=always
1118
1118
1119 $ hg --config extensions.color= --config color.mode=ansi \
1119 $ hg --config extensions.color= --config color.mode=ansi \
1120 > log -p -l2 --color=always
1120 > log -p -l2 --color=always
1121 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1121 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1122 tag: tip
1122 tag: tip
1123 user: test
1123 user: test
1124 date: Thu Jan 01 00:00:01 1970 +0000
1124 date: Thu Jan 01 00:00:01 1970 +0000
1125 summary: b1.1
1125 summary: b1.1
1126
1126
1127 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1127 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1128 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1128 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1129 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1129 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1130 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1130 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1131 b1
1131 b1
1132 \x1b[0;32m+postm\x1b[0m (esc)
1132 \x1b[0;32m+postm\x1b[0m (esc)
1133
1133
1134 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1134 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1135 parent: 3:e62f78d544b4
1135 parent: 3:e62f78d544b4
1136 parent: 4:ddb82e70d1a1
1136 parent: 4:ddb82e70d1a1
1137 user: test
1137 user: test
1138 date: Thu Jan 01 00:00:01 1970 +0000
1138 date: Thu Jan 01 00:00:01 1970 +0000
1139 summary: m12
1139 summary: m12
1140
1140
1141 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1141 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1142 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1142 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1143 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1143 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1144 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1144 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1145 \x1b[0;32m+b2\x1b[0m (esc)
1145 \x1b[0;32m+b2\x1b[0m (esc)
1146
1146
1147
1147
1148
1148
1149 log -r tip --stat
1149 log -r tip --stat
1150
1150
1151 $ hg log -r tip --stat
1151 $ hg log -r tip --stat
1152 changeset: 6:2404bbcab562
1152 changeset: 6:2404bbcab562
1153 tag: tip
1153 tag: tip
1154 user: test
1154 user: test
1155 date: Thu Jan 01 00:00:01 1970 +0000
1155 date: Thu Jan 01 00:00:01 1970 +0000
1156 summary: b1.1
1156 summary: b1.1
1157
1157
1158 b1 | 1 +
1158 b1 | 1 +
1159 1 files changed, 1 insertions(+), 0 deletions(-)
1159 1 files changed, 1 insertions(+), 0 deletions(-)
1160
1160
1161
1161
1162 $ cd ..
1162 $ cd ..
1163
1163
1164 log --follow --patch FILE in repository where linkrev isn't trustworthy
1164 log --follow --patch FILE in repository where linkrev isn't trustworthy
1165 (issue5376, issue6124)
1165 (issue5376, issue6124)
1166
1166
1167 $ hg init follow-dup
1167 $ hg init follow-dup
1168 $ cd follow-dup
1168 $ cd follow-dup
1169 $ cat <<EOF >> .hg/hgrc
1169 $ cat <<EOF >> .hg/hgrc
1170 > [command-templates]
1170 > [command-templates]
1171 > log = '=== {rev}: {desc}\n'
1171 > log = '=== {rev}: {desc}\n'
1172 > [diff]
1172 > [diff]
1173 > nodates = True
1173 > nodates = True
1174 > EOF
1174 > EOF
1175 $ echo 0 >> a
1175 $ echo 0 >> a
1176 $ hg ci -qAm 'a0'
1176 $ hg ci -qAm 'a0'
1177 $ echo 1 >> a
1177 $ echo 1 >> a
1178 $ hg ci -m 'a1'
1178 $ hg ci -m 'a1'
1179 $ hg up -q 0
1179 $ hg up -q 0
1180 $ echo 1 >> a
1180 $ echo 1 >> a
1181 $ touch b
1181 $ touch b
1182 $ hg ci -qAm 'a1 with b'
1182 $ hg ci -qAm 'a1 with b'
1183 $ echo 3 >> a
1183 $ echo 3 >> a
1184 $ hg ci -m 'a3'
1184 $ hg ci -m 'a3'
1185
1185
1186 fctx.rev() == 2, but fctx.linkrev() == 1
1186 fctx.rev() == 2, but fctx.linkrev() == 1
1187
1187
1188 $ hg log -pf a
1188 $ hg log -pf a
1189 === 3: a3
1189 === 3: a3
1190 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1190 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1191 --- a/a
1191 --- a/a
1192 +++ b/a
1192 +++ b/a
1193 @@ -1,2 +1,3 @@
1193 @@ -1,2 +1,3 @@
1194 0
1194 0
1195 1
1195 1
1196 +3
1196 +3
1197
1197
1198 === 2: a1 with b
1198 === 2: a1 with b
1199 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1199 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1200 --- a/a
1200 --- a/a
1201 +++ b/a
1201 +++ b/a
1202 @@ -1,1 +1,2 @@
1202 @@ -1,1 +1,2 @@
1203 0
1203 0
1204 +1
1204 +1
1205
1205
1206 === 0: a0
1206 === 0: a0
1207 diff -r 000000000000 -r 49b5e81287e2 a
1207 diff -r 000000000000 -r 49b5e81287e2 a
1208 --- /dev/null
1208 --- /dev/null
1209 +++ b/a
1209 +++ b/a
1210 @@ -0,0 +1,1 @@
1210 @@ -0,0 +1,1 @@
1211 +0
1211 +0
1212
1212
1213 $ hg log -pr . a
1213 $ hg log -pr . a
1214 === 3: a3
1214 === 3: a3
1215 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1215 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1216 --- a/a
1216 --- a/a
1217 +++ b/a
1217 +++ b/a
1218 @@ -1,2 +1,3 @@
1218 @@ -1,2 +1,3 @@
1219 0
1219 0
1220 1
1220 1
1221 +3
1221 +3
1222
1222
1223
1223
1224 fctx.introrev() == 2, but fctx.linkrev() == 1
1224 fctx.introrev() == 2, but fctx.linkrev() == 1
1225
1225
1226 $ hg up -q 2
1226 $ hg up -q 2
1227 $ hg log -pf a
1227 $ hg log -pf a
1228 === 2: a1 with b
1228 === 2: a1 with b
1229 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1229 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1230 --- a/a
1230 --- a/a
1231 +++ b/a
1231 +++ b/a
1232 @@ -1,1 +1,2 @@
1232 @@ -1,1 +1,2 @@
1233 0
1233 0
1234 +1
1234 +1
1235
1235
1236 === 0: a0
1236 === 0: a0
1237 diff -r 000000000000 -r 49b5e81287e2 a
1237 diff -r 000000000000 -r 49b5e81287e2 a
1238 --- /dev/null
1238 --- /dev/null
1239 +++ b/a
1239 +++ b/a
1240 @@ -0,0 +1,1 @@
1240 @@ -0,0 +1,1 @@
1241 +0
1241 +0
1242
1242
1243
1243
1244 BROKEN: should show the same diff as for rev 2 above
1244 BROKEN: should show the same diff as for rev 2 above
1245 $ hg log -pr . a
1245 $ hg log -pr . a
1246
1246
1247 $ cd ..
1247 $ cd ..
1248
1248
1249 Multiple copy sources of a file:
1249 Multiple copy sources of a file:
1250
1250
1251 $ hg init follow-multi
1251 $ hg init follow-multi
1252 $ cd follow-multi
1252 $ cd follow-multi
1253 $ echo 0 >> a
1253 $ echo 0 >> a
1254 $ hg ci -qAm 'a'
1254 $ hg ci -qAm 'a'
1255 $ hg cp a b
1255 $ hg cp a b
1256 $ hg ci -m 'a->b'
1256 $ hg ci -m 'a->b'
1257 $ echo 2 >> a
1257 $ echo 2 >> a
1258 $ hg ci -m 'a'
1258 $ hg ci -m 'a'
1259 $ echo 3 >> b
1259 $ echo 3 >> b
1260 $ hg ci -m 'b'
1260 $ hg ci -m 'b'
1261 $ echo 4 >> a
1261 $ echo 4 >> a
1262 $ echo 4 >> b
1262 $ echo 4 >> b
1263 $ hg ci -m 'a,b'
1263 $ hg ci -m 'a,b'
1264 $ echo 5 >> a
1264 $ echo 5 >> a
1265 $ hg ci -m 'a0'
1265 $ hg ci -m 'a0'
1266 $ echo 6 >> b
1266 $ echo 6 >> b
1267 $ hg ci -m 'b0'
1267 $ hg ci -m 'b0'
1268 $ hg up -q 4
1268 $ hg up -q 4
1269 $ echo 7 >> b
1269 $ echo 7 >> b
1270 $ hg ci -m 'b1'
1270 $ hg ci -m 'b1'
1271 created new head
1271 created new head
1272 $ echo 8 >> a
1272 $ echo 8 >> a
1273 $ hg ci -m 'a1'
1273 $ hg ci -m 'a1'
1274 $ hg rm a
1274 $ hg rm a
1275 $ hg mv b a
1275 $ hg mv b a
1276 $ hg ci -m 'b1->a1'
1276 $ hg ci -m 'b1->a1'
1277 $ hg merge -qt :local
1277 $ hg merge -qt :local
1278 $ hg ci -m '(a0,b1->a1)->a'
1278 $ hg ci -m '(a0,b1->a1)->a'
1279
1279
1280 $ hg log -GT '{rev}: {desc}\n'
1280 $ hg log -GT '{rev}: {desc}\n'
1281 @ 10: (a0,b1->a1)->a
1281 @ 10: (a0,b1->a1)->a
1282 |\
1282 |\
1283 | o 9: b1->a1
1283 | o 9: b1->a1
1284 | |
1284 | |
1285 | o 8: a1
1285 | o 8: a1
1286 | |
1286 | |
1287 | o 7: b1
1287 | o 7: b1
1288 | |
1288 | |
1289 o | 6: b0
1289 o | 6: b0
1290 | |
1290 | |
1291 o | 5: a0
1291 o | 5: a0
1292 |/
1292 |/
1293 o 4: a,b
1293 o 4: a,b
1294 |
1294 |
1295 o 3: b
1295 o 3: b
1296 |
1296 |
1297 o 2: a
1297 o 2: a
1298 |
1298 |
1299 o 1: a->b
1299 o 1: a->b
1300 |
1300 |
1301 o 0: a
1301 o 0: a
1302
1302
1303
1303
1304 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1304 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1305 be indexed solely by fctx.linkrev().
1305 be indexed solely by fctx.linkrev().
1306
1306
1307 $ hg log -T '{rev}: {desc}\n' -f a
1307 $ hg log -T '{rev}: {desc}\n' -f a
1308 10: (a0,b1->a1)->a
1308 10: (a0,b1->a1)->a
1309 9: b1->a1
1309 9: b1->a1
1310 7: b1
1310 7: b1
1311 5: a0
1311 5: a0
1312 4: a,b
1312 4: a,b
1313 3: b
1313 3: b
1314 2: a
1314 2: a
1315 1: a->b
1315 1: a->b
1316 0: a
1316 0: a
1317
1317
1318 $ cd ..
1318 $ cd ..
1319
1319
1320 Test that log should respect the order of -rREV even if multiple OR conditions
1320 Test that log should respect the order of -rREV even if multiple OR conditions
1321 are specified (issue5100):
1321 are specified (issue5100):
1322
1322
1323 $ hg init revorder
1323 $ hg init revorder
1324 $ cd revorder
1324 $ cd revorder
1325
1325
1326 $ hg branch -q b0
1326 $ hg branch -q b0
1327 $ echo 0 >> f0
1327 $ echo 0 >> f0
1328 $ hg ci -qAm k0 -u u0
1328 $ hg ci -qAm k0 -u u0
1329 $ hg branch -q b1
1329 $ hg branch -q b1
1330 $ echo 1 >> f1
1330 $ echo 1 >> f1
1331 $ hg ci -qAm k1 -u u1
1331 $ hg ci -qAm k1 -u u1
1332 $ hg branch -q b2
1332 $ hg branch -q b2
1333 $ echo 2 >> f2
1333 $ echo 2 >> f2
1334 $ hg ci -qAm k2 -u u2
1334 $ hg ci -qAm k2 -u u2
1335
1335
1336 $ hg update -q b2
1336 $ hg update -q b2
1337 $ echo 3 >> f2
1337 $ echo 3 >> f2
1338 $ hg ci -qAm k2 -u u2
1338 $ hg ci -qAm k2 -u u2
1339 $ hg update -q b1
1339 $ hg update -q b1
1340 $ echo 4 >> f1
1340 $ echo 4 >> f1
1341 $ hg ci -qAm k1 -u u1
1341 $ hg ci -qAm k1 -u u1
1342 $ hg update -q b0
1342 $ hg update -q b0
1343 $ echo 5 >> f0
1343 $ echo 5 >> f0
1344 $ hg ci -qAm k0 -u u0
1344 $ hg ci -qAm k0 -u u0
1345
1345
1346 summary of revisions:
1346 summary of revisions:
1347
1347
1348 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1348 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1349 @ 5 b0 u0 k0 f0
1349 @ 5 b0 u0 k0 f0
1350 |
1350 |
1351 | o 4 b1 u1 k1 f1
1351 | o 4 b1 u1 k1 f1
1352 | |
1352 | |
1353 | | o 3 b2 u2 k2 f2
1353 | | o 3 b2 u2 k2 f2
1354 | | |
1354 | | |
1355 | | o 2 b2 u2 k2 f2
1355 | | o 2 b2 u2 k2 f2
1356 | |/
1356 | |/
1357 | o 1 b1 u1 k1 f1
1357 | o 1 b1 u1 k1 f1
1358 |/
1358 |/
1359 o 0 b0 u0 k0 f0
1359 o 0 b0 u0 k0 f0
1360
1360
1361
1361
1362 log -b BRANCH in ascending order:
1362 log -b BRANCH in ascending order:
1363
1363
1364 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1364 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1365 0 b0
1365 0 b0
1366 1 b1
1366 1 b1
1367 4 b1
1367 4 b1
1368 5 b0
1368 5 b0
1369 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1369 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1370 0 b0
1370 0 b0
1371 1 b1
1371 1 b1
1372 4 b1
1372 4 b1
1373 5 b0
1373 5 b0
1374
1374
1375 log --only-branch BRANCH in descending order:
1375 log --only-branch BRANCH in descending order:
1376
1376
1377 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1377 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1378 4 b1
1378 4 b1
1379 3 b2
1379 3 b2
1380 2 b2
1380 2 b2
1381 1 b1
1381 1 b1
1382 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1382 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1383 4 b1
1383 4 b1
1384 3 b2
1384 3 b2
1385 2 b2
1385 2 b2
1386 1 b1
1386 1 b1
1387
1387
1388 log -u USER in ascending order, against compound set:
1388 log -u USER in ascending order, against compound set:
1389
1389
1390 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1390 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1391 0 u0
1391 0 u0
1392 2 u2
1392 2 u2
1393 3 u2
1393 3 u2
1394 5 u0
1394 5 u0
1395 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1395 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1396 0 u0
1396 0 u0
1397 2 u2
1397 2 u2
1398 3 u2
1398 3 u2
1399 5 u0
1399 5 u0
1400
1400
1401 log -k TEXT in descending order, against compound set:
1401 log -k TEXT in descending order, against compound set:
1402
1402
1403 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1403 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1404 5 k0
1404 5 k0
1405 3 k2
1405 3 k2
1406 2 k2
1406 2 k2
1407 1 k1
1407 1 k1
1408 0 k0
1408 0 k0
1409 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1409 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1410 5 k0
1410 5 k0
1411 3 k2
1411 3 k2
1412 2 k2
1412 2 k2
1413 1 k1
1413 1 k1
1414 0 k0
1414 0 k0
1415
1415
1416 log -b/-u/-k shouldn't accept string-matcher syntax:
1416 log -b/-u/-k shouldn't accept string-matcher syntax:
1417
1417
1418 $ hg log -b 're:.*'
1418 $ hg log -b 're:.*'
1419 abort: unknown revision 're:.*'
1419 abort: unknown revision 're:.*'
1420 [10]
1420 [10]
1421 $ hg log -k 're:.*'
1421 $ hg log -k 're:.*'
1422 $ hg log -u 're:.*'
1422 $ hg log -u 're:.*'
1423
1423
1424 log FILE in ascending order, against dagrange:
1424 log FILE in ascending order, against dagrange:
1425
1425
1426 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1426 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1427 1 f1
1427 1 f1
1428 2 f2
1428 2 f2
1429 3 f2
1429 3 f2
1430 4 f1
1430 4 f1
1431 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1431 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1432 1 f1
1432 1 f1
1433 2 f2
1433 2 f2
1434 3 f2
1434 3 f2
1435 4 f1
1435 4 f1
1436
1436
1437 $ cd ..
1437 $ cd ..
1438
1438
1439 User
1439 User
1440
1440
1441 $ hg init usertest
1441 $ hg init usertest
1442 $ cd usertest
1442 $ cd usertest
1443
1443
1444 $ echo a > a
1444 $ echo a > a
1445 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1445 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1446 adding a
1446 adding a
1447 $ echo b > b
1447 $ echo b > b
1448 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1448 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1449 adding b
1449 adding b
1450
1450
1451 $ hg log -u "User One <user1@example.org>"
1451 $ hg log -u "User One <user1@example.org>"
1452 changeset: 0:29a4c94f1924
1452 changeset: 0:29a4c94f1924
1453 user: User One <user1@example.org>
1453 user: User One <user1@example.org>
1454 date: Thu Jan 01 00:00:00 1970 +0000
1454 date: Thu Jan 01 00:00:00 1970 +0000
1455 summary: a
1455 summary: a
1456
1456
1457 $ hg log -u "user1" -u "user2"
1457 $ hg log -u "user1" -u "user2"
1458 changeset: 1:e834b5e69c0e
1458 changeset: 1:e834b5e69c0e
1459 tag: tip
1459 tag: tip
1460 user: User Two <user2@example.org>
1460 user: User Two <user2@example.org>
1461 date: Thu Jan 01 00:00:00 1970 +0000
1461 date: Thu Jan 01 00:00:00 1970 +0000
1462 summary: b
1462 summary: b
1463
1463
1464 changeset: 0:29a4c94f1924
1464 changeset: 0:29a4c94f1924
1465 user: User One <user1@example.org>
1465 user: User One <user1@example.org>
1466 date: Thu Jan 01 00:00:00 1970 +0000
1466 date: Thu Jan 01 00:00:00 1970 +0000
1467 summary: a
1467 summary: a
1468
1468
1469 $ hg log -u "user3"
1469 $ hg log -u "user3"
1470
1470
1471 "-u USER" shouldn't be overridden by "user(USER)" alias
1471 "-u USER" shouldn't be overridden by "user(USER)" alias
1472
1472
1473 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1473 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1474 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1474 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1475 changeset: 0:29a4c94f1924
1475 changeset: 0:29a4c94f1924
1476 user: User One <user1@example.org>
1476 user: User One <user1@example.org>
1477 date: Thu Jan 01 00:00:00 1970 +0000
1477 date: Thu Jan 01 00:00:00 1970 +0000
1478 summary: a
1478 summary: a
1479
1479
1480
1480
1481 $ cd ..
1481 $ cd ..
1482
1482
1483 $ hg init branches
1483 $ hg init branches
1484 $ cd branches
1484 $ cd branches
1485
1485
1486 $ echo a > a
1486 $ echo a > a
1487 $ hg ci -A -m "commit on default"
1487 $ hg ci -A -m "commit on default"
1488 adding a
1488 adding a
1489 $ hg branch test
1489 $ hg branch test
1490 marked working directory as branch test
1490 marked working directory as branch test
1491 (branches are permanent and global, did you want a bookmark?)
1491 (branches are permanent and global, did you want a bookmark?)
1492 $ echo b > b
1492 $ echo b > b
1493 $ hg ci -A -m "commit on test"
1493 $ hg ci -A -m "commit on test"
1494 adding b
1494 adding b
1495
1495
1496 $ hg up default
1496 $ hg up default
1497 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1497 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1498 $ echo c > c
1498 $ echo c > c
1499 $ hg ci -A -m "commit on default"
1499 $ hg ci -A -m "commit on default"
1500 adding c
1500 adding c
1501 $ hg up test
1501 $ hg up test
1502 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1502 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1503 $ echo c > c
1503 $ echo c > c
1504 $ hg ci -A -m "commit on test"
1504 $ hg ci -A -m "commit on test"
1505 adding c
1505 adding c
1506
1506
1507
1507
1508 log -b default
1508 log -b default
1509
1509
1510 $ hg log -b default
1510 $ hg log -b default
1511 changeset: 2:c3a4f03cc9a7
1511 changeset: 2:c3a4f03cc9a7
1512 parent: 0:24427303d56f
1512 parent: 0:24427303d56f
1513 user: test
1513 user: test
1514 date: Thu Jan 01 00:00:00 1970 +0000
1514 date: Thu Jan 01 00:00:00 1970 +0000
1515 summary: commit on default
1515 summary: commit on default
1516
1516
1517 changeset: 0:24427303d56f
1517 changeset: 0:24427303d56f
1518 user: test
1518 user: test
1519 date: Thu Jan 01 00:00:00 1970 +0000
1519 date: Thu Jan 01 00:00:00 1970 +0000
1520 summary: commit on default
1520 summary: commit on default
1521
1521
1522
1522
1523
1523
1524 log -b test
1524 log -b test
1525
1525
1526 $ hg log -b test
1526 $ hg log -b test
1527 changeset: 3:f5d8de11c2e2
1527 changeset: 3:f5d8de11c2e2
1528 branch: test
1528 branch: test
1529 tag: tip
1529 tag: tip
1530 parent: 1:d32277701ccb
1530 parent: 1:d32277701ccb
1531 user: test
1531 user: test
1532 date: Thu Jan 01 00:00:00 1970 +0000
1532 date: Thu Jan 01 00:00:00 1970 +0000
1533 summary: commit on test
1533 summary: commit on test
1534
1534
1535 changeset: 1:d32277701ccb
1535 changeset: 1:d32277701ccb
1536 branch: test
1536 branch: test
1537 user: test
1537 user: test
1538 date: Thu Jan 01 00:00:00 1970 +0000
1538 date: Thu Jan 01 00:00:00 1970 +0000
1539 summary: commit on test
1539 summary: commit on test
1540
1540
1541
1541
1542
1542
1543 log -b dummy
1543 log -b dummy
1544
1544
1545 $ hg log -b dummy
1545 $ hg log -b dummy
1546 abort: unknown revision 'dummy'
1546 abort: unknown revision 'dummy'
1547 [10]
1547 [10]
1548
1548
1549
1549
1550 log -b .
1550 log -b .
1551
1551
1552 $ hg log -b .
1552 $ hg log -b .
1553 changeset: 3:f5d8de11c2e2
1553 changeset: 3:f5d8de11c2e2
1554 branch: test
1554 branch: test
1555 tag: tip
1555 tag: tip
1556 parent: 1:d32277701ccb
1556 parent: 1:d32277701ccb
1557 user: test
1557 user: test
1558 date: Thu Jan 01 00:00:00 1970 +0000
1558 date: Thu Jan 01 00:00:00 1970 +0000
1559 summary: commit on test
1559 summary: commit on test
1560
1560
1561 changeset: 1:d32277701ccb
1561 changeset: 1:d32277701ccb
1562 branch: test
1562 branch: test
1563 user: test
1563 user: test
1564 date: Thu Jan 01 00:00:00 1970 +0000
1564 date: Thu Jan 01 00:00:00 1970 +0000
1565 summary: commit on test
1565 summary: commit on test
1566
1566
1567
1567
1568
1568
1569 log -b default -b test
1569 log -b default -b test
1570
1570
1571 $ hg log -b default -b test
1571 $ hg log -b default -b test
1572 changeset: 3:f5d8de11c2e2
1572 changeset: 3:f5d8de11c2e2
1573 branch: test
1573 branch: test
1574 tag: tip
1574 tag: tip
1575 parent: 1:d32277701ccb
1575 parent: 1:d32277701ccb
1576 user: test
1576 user: test
1577 date: Thu Jan 01 00:00:00 1970 +0000
1577 date: Thu Jan 01 00:00:00 1970 +0000
1578 summary: commit on test
1578 summary: commit on test
1579
1579
1580 changeset: 2:c3a4f03cc9a7
1580 changeset: 2:c3a4f03cc9a7
1581 parent: 0:24427303d56f
1581 parent: 0:24427303d56f
1582 user: test
1582 user: test
1583 date: Thu Jan 01 00:00:00 1970 +0000
1583 date: Thu Jan 01 00:00:00 1970 +0000
1584 summary: commit on default
1584 summary: commit on default
1585
1585
1586 changeset: 1:d32277701ccb
1586 changeset: 1:d32277701ccb
1587 branch: test
1587 branch: test
1588 user: test
1588 user: test
1589 date: Thu Jan 01 00:00:00 1970 +0000
1589 date: Thu Jan 01 00:00:00 1970 +0000
1590 summary: commit on test
1590 summary: commit on test
1591
1591
1592 changeset: 0:24427303d56f
1592 changeset: 0:24427303d56f
1593 user: test
1593 user: test
1594 date: Thu Jan 01 00:00:00 1970 +0000
1594 date: Thu Jan 01 00:00:00 1970 +0000
1595 summary: commit on default
1595 summary: commit on default
1596
1596
1597
1597
1598
1598
1599 log -b default -b .
1599 log -b default -b .
1600
1600
1601 $ hg log -b default -b .
1601 $ hg log -b default -b .
1602 changeset: 3:f5d8de11c2e2
1602 changeset: 3:f5d8de11c2e2
1603 branch: test
1603 branch: test
1604 tag: tip
1604 tag: tip
1605 parent: 1:d32277701ccb
1605 parent: 1:d32277701ccb
1606 user: test
1606 user: test
1607 date: Thu Jan 01 00:00:00 1970 +0000
1607 date: Thu Jan 01 00:00:00 1970 +0000
1608 summary: commit on test
1608 summary: commit on test
1609
1609
1610 changeset: 2:c3a4f03cc9a7
1610 changeset: 2:c3a4f03cc9a7
1611 parent: 0:24427303d56f
1611 parent: 0:24427303d56f
1612 user: test
1612 user: test
1613 date: Thu Jan 01 00:00:00 1970 +0000
1613 date: Thu Jan 01 00:00:00 1970 +0000
1614 summary: commit on default
1614 summary: commit on default
1615
1615
1616 changeset: 1:d32277701ccb
1616 changeset: 1:d32277701ccb
1617 branch: test
1617 branch: test
1618 user: test
1618 user: test
1619 date: Thu Jan 01 00:00:00 1970 +0000
1619 date: Thu Jan 01 00:00:00 1970 +0000
1620 summary: commit on test
1620 summary: commit on test
1621
1621
1622 changeset: 0:24427303d56f
1622 changeset: 0:24427303d56f
1623 user: test
1623 user: test
1624 date: Thu Jan 01 00:00:00 1970 +0000
1624 date: Thu Jan 01 00:00:00 1970 +0000
1625 summary: commit on default
1625 summary: commit on default
1626
1626
1627
1627
1628
1628
1629 log -b . -b test
1629 log -b . -b test
1630
1630
1631 $ hg log -b . -b test
1631 $ hg log -b . -b test
1632 changeset: 3:f5d8de11c2e2
1632 changeset: 3:f5d8de11c2e2
1633 branch: test
1633 branch: test
1634 tag: tip
1634 tag: tip
1635 parent: 1:d32277701ccb
1635 parent: 1:d32277701ccb
1636 user: test
1636 user: test
1637 date: Thu Jan 01 00:00:00 1970 +0000
1637 date: Thu Jan 01 00:00:00 1970 +0000
1638 summary: commit on test
1638 summary: commit on test
1639
1639
1640 changeset: 1:d32277701ccb
1640 changeset: 1:d32277701ccb
1641 branch: test
1641 branch: test
1642 user: test
1642 user: test
1643 date: Thu Jan 01 00:00:00 1970 +0000
1643 date: Thu Jan 01 00:00:00 1970 +0000
1644 summary: commit on test
1644 summary: commit on test
1645
1645
1646
1646
1647
1647
1648 log -b 2
1648 log -b 2
1649
1649
1650 $ hg log -b 2
1650 $ hg log -b 2
1651 changeset: 2:c3a4f03cc9a7
1651 changeset: 2:c3a4f03cc9a7
1652 parent: 0:24427303d56f
1652 parent: 0:24427303d56f
1653 user: test
1653 user: test
1654 date: Thu Jan 01 00:00:00 1970 +0000
1654 date: Thu Jan 01 00:00:00 1970 +0000
1655 summary: commit on default
1655 summary: commit on default
1656
1656
1657 changeset: 0:24427303d56f
1657 changeset: 0:24427303d56f
1658 user: test
1658 user: test
1659 date: Thu Jan 01 00:00:00 1970 +0000
1659 date: Thu Jan 01 00:00:00 1970 +0000
1660 summary: commit on default
1660 summary: commit on default
1661
1661
1662 #if gettext
1662 #if gettext
1663
1663
1664 Test that all log names are translated (e.g. branches, bookmarks, tags):
1664 Test that all log names are translated (e.g. branches, bookmarks, tags):
1665
1665
1666 $ hg bookmark babar -r tip
1666 $ hg bookmark babar -r tip
1667
1667
1668 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1668 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1669 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1669 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1670 Zweig: test
1670 Zweig: test
1671 Lesezeichen: babar
1671 Lesezeichen: babar
1672 Marke: tip
1672 Marke: tip
1673 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1673 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1674 Nutzer: test
1674 Nutzer: test
1675 Datum: Thu Jan 01 00:00:00 1970 +0000
1675 Datum: Thu Jan 01 00:00:00 1970 +0000
1676 Zusammenfassung: commit on test
1676 Zusammenfassung: commit on test
1677
1677
1678 $ hg bookmark -d babar
1678 $ hg bookmark -d babar
1679
1679
1680 #endif
1680 #endif
1681
1681
1682 log -p --cwd dir (in subdir)
1682 log -p --cwd dir (in subdir)
1683
1683
1684 $ mkdir dir
1684 $ mkdir dir
1685 $ hg log -p --cwd dir
1685 $ hg log -p --cwd dir
1686 changeset: 3:f5d8de11c2e2
1686 changeset: 3:f5d8de11c2e2
1687 branch: test
1687 branch: test
1688 tag: tip
1688 tag: tip
1689 parent: 1:d32277701ccb
1689 parent: 1:d32277701ccb
1690 user: test
1690 user: test
1691 date: Thu Jan 01 00:00:00 1970 +0000
1691 date: Thu Jan 01 00:00:00 1970 +0000
1692 summary: commit on test
1692 summary: commit on test
1693
1693
1694 diff -r d32277701ccb -r f5d8de11c2e2 c
1694 diff -r d32277701ccb -r f5d8de11c2e2 c
1695 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1695 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1696 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1696 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1697 @@ -0,0 +1,1 @@
1697 @@ -0,0 +1,1 @@
1698 +c
1698 +c
1699
1699
1700 changeset: 2:c3a4f03cc9a7
1700 changeset: 2:c3a4f03cc9a7
1701 parent: 0:24427303d56f
1701 parent: 0:24427303d56f
1702 user: test
1702 user: test
1703 date: Thu Jan 01 00:00:00 1970 +0000
1703 date: Thu Jan 01 00:00:00 1970 +0000
1704 summary: commit on default
1704 summary: commit on default
1705
1705
1706 diff -r 24427303d56f -r c3a4f03cc9a7 c
1706 diff -r 24427303d56f -r c3a4f03cc9a7 c
1707 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1707 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1708 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1708 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1709 @@ -0,0 +1,1 @@
1709 @@ -0,0 +1,1 @@
1710 +c
1710 +c
1711
1711
1712 changeset: 1:d32277701ccb
1712 changeset: 1:d32277701ccb
1713 branch: test
1713 branch: test
1714 user: test
1714 user: test
1715 date: Thu Jan 01 00:00:00 1970 +0000
1715 date: Thu Jan 01 00:00:00 1970 +0000
1716 summary: commit on test
1716 summary: commit on test
1717
1717
1718 diff -r 24427303d56f -r d32277701ccb b
1718 diff -r 24427303d56f -r d32277701ccb b
1719 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1719 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1720 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1720 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1721 @@ -0,0 +1,1 @@
1721 @@ -0,0 +1,1 @@
1722 +b
1722 +b
1723
1723
1724 changeset: 0:24427303d56f
1724 changeset: 0:24427303d56f
1725 user: test
1725 user: test
1726 date: Thu Jan 01 00:00:00 1970 +0000
1726 date: Thu Jan 01 00:00:00 1970 +0000
1727 summary: commit on default
1727 summary: commit on default
1728
1728
1729 diff -r 000000000000 -r 24427303d56f a
1729 diff -r 000000000000 -r 24427303d56f a
1730 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1730 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1731 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1731 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1732 @@ -0,0 +1,1 @@
1732 @@ -0,0 +1,1 @@
1733 +a
1733 +a
1734
1734
1735
1735
1736
1736
1737 log -p -R repo
1737 log -p -R repo
1738
1738
1739 $ cd dir
1739 $ cd dir
1740 $ hg log -p -R .. ../a
1740 $ hg log -p -R .. ../a
1741 changeset: 0:24427303d56f
1741 changeset: 0:24427303d56f
1742 user: test
1742 user: test
1743 date: Thu Jan 01 00:00:00 1970 +0000
1743 date: Thu Jan 01 00:00:00 1970 +0000
1744 summary: commit on default
1744 summary: commit on default
1745
1745
1746 diff -r 000000000000 -r 24427303d56f a
1746 diff -r 000000000000 -r 24427303d56f a
1747 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1747 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1748 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1748 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1749 @@ -0,0 +1,1 @@
1749 @@ -0,0 +1,1 @@
1750 +a
1750 +a
1751
1751
1752
1752
1753 $ cd ../..
1753 $ cd ../..
1754
1754
1755 $ hg init follow2
1755 $ hg init follow2
1756 $ cd follow2
1756 $ cd follow2
1757
1757
1758 # Build the following history:
1758 # Build the following history:
1759 # tip - o - x - o - x - x
1759 # tip - o - x - o - x - x
1760 # \ /
1760 # \ /
1761 # o - o - o - x
1761 # o - o - o - x
1762 # \ /
1762 # \ /
1763 # o
1763 # o
1764 #
1764 #
1765 # Where "o" is a revision containing "foo" and
1765 # Where "o" is a revision containing "foo" and
1766 # "x" is a revision without "foo"
1766 # "x" is a revision without "foo"
1767
1767
1768 $ touch init
1768 $ touch init
1769 $ hg ci -A -m "init, unrelated"
1769 $ hg ci -A -m "init, unrelated"
1770 adding init
1770 adding init
1771 $ echo 'foo' > init
1771 $ echo 'foo' > init
1772 $ hg ci -m "change, unrelated"
1772 $ hg ci -m "change, unrelated"
1773 $ echo 'foo' > foo
1773 $ echo 'foo' > foo
1774 $ hg ci -A -m "add unrelated old foo"
1774 $ hg ci -A -m "add unrelated old foo"
1775 adding foo
1775 adding foo
1776 $ hg rm foo
1776 $ hg rm foo
1777 $ hg ci -m "delete foo, unrelated"
1777 $ hg ci -m "delete foo, unrelated"
1778 $ echo 'related' > foo
1778 $ echo 'related' > foo
1779 $ hg ci -A -m "add foo, related"
1779 $ hg ci -A -m "add foo, related"
1780 adding foo
1780 adding foo
1781
1781
1782 $ hg up 0
1782 $ hg up 0
1783 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1783 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1784 $ touch branch
1784 $ touch branch
1785 $ hg ci -A -m "first branch, unrelated"
1785 $ hg ci -A -m "first branch, unrelated"
1786 adding branch
1786 adding branch
1787 created new head
1787 created new head
1788 $ touch foo
1788 $ touch foo
1789 $ hg ci -A -m "create foo, related"
1789 $ hg ci -A -m "create foo, related"
1790 adding foo
1790 adding foo
1791 $ echo 'change' > foo
1791 $ echo 'change' > foo
1792 $ hg ci -m "change foo, related"
1792 $ hg ci -m "change foo, related"
1793
1793
1794 $ hg up 6
1794 $ hg up 6
1795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1796 $ echo 'change foo in branch' > foo
1796 $ echo 'change foo in branch' > foo
1797 $ hg ci -m "change foo in branch, related"
1797 $ hg ci -m "change foo in branch, related"
1798 created new head
1798 created new head
1799 $ hg merge 7
1799 $ hg merge 7
1800 merging foo
1800 merging foo
1801 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1801 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1802 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1802 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1803 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1803 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1804 [1]
1804 [1]
1805 $ echo 'merge 1' > foo
1805 $ echo 'merge 1' > foo
1806 $ hg resolve -m foo
1806 $ hg resolve -m foo
1807 (no more unresolved files)
1807 (no more unresolved files)
1808 $ hg ci -m "First merge, related"
1808 $ hg ci -m "First merge, related"
1809
1809
1810 $ hg merge 4
1810 $ hg merge 4
1811 merging foo
1811 merging foo
1812 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1812 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1813 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1813 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1814 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1814 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1815 [1]
1815 [1]
1816 $ echo 'merge 2' > foo
1816 $ echo 'merge 2' > foo
1817 $ hg resolve -m foo
1817 $ hg resolve -m foo
1818 (no more unresolved files)
1818 (no more unresolved files)
1819 $ hg ci -m "Last merge, related"
1819 $ hg ci -m "Last merge, related"
1820
1820
1821 $ hg log --graph
1821 $ hg log --graph
1822 @ changeset: 10:4dae8563d2c5
1822 @ changeset: 10:4dae8563d2c5
1823 |\ tag: tip
1823 |\ tag: tip
1824 | | parent: 9:7b35701b003e
1824 | | parent: 9:7b35701b003e
1825 | | parent: 4:88176d361b69
1825 | | parent: 4:88176d361b69
1826 | | user: test
1826 | | user: test
1827 | | date: Thu Jan 01 00:00:00 1970 +0000
1827 | | date: Thu Jan 01 00:00:00 1970 +0000
1828 | | summary: Last merge, related
1828 | | summary: Last merge, related
1829 | |
1829 | |
1830 | o changeset: 9:7b35701b003e
1830 | o changeset: 9:7b35701b003e
1831 | |\ parent: 8:e5416ad8a855
1831 | |\ parent: 8:e5416ad8a855
1832 | | | parent: 7:87fe3144dcfa
1832 | | | parent: 7:87fe3144dcfa
1833 | | | user: test
1833 | | | user: test
1834 | | | date: Thu Jan 01 00:00:00 1970 +0000
1834 | | | date: Thu Jan 01 00:00:00 1970 +0000
1835 | | | summary: First merge, related
1835 | | | summary: First merge, related
1836 | | |
1836 | | |
1837 | | o changeset: 8:e5416ad8a855
1837 | | o changeset: 8:e5416ad8a855
1838 | | | parent: 6:dc6c325fe5ee
1838 | | | parent: 6:dc6c325fe5ee
1839 | | | user: test
1839 | | | user: test
1840 | | | date: Thu Jan 01 00:00:00 1970 +0000
1840 | | | date: Thu Jan 01 00:00:00 1970 +0000
1841 | | | summary: change foo in branch, related
1841 | | | summary: change foo in branch, related
1842 | | |
1842 | | |
1843 | o | changeset: 7:87fe3144dcfa
1843 | o | changeset: 7:87fe3144dcfa
1844 | |/ user: test
1844 | |/ user: test
1845 | | date: Thu Jan 01 00:00:00 1970 +0000
1845 | | date: Thu Jan 01 00:00:00 1970 +0000
1846 | | summary: change foo, related
1846 | | summary: change foo, related
1847 | |
1847 | |
1848 | o changeset: 6:dc6c325fe5ee
1848 | o changeset: 6:dc6c325fe5ee
1849 | | user: test
1849 | | user: test
1850 | | date: Thu Jan 01 00:00:00 1970 +0000
1850 | | date: Thu Jan 01 00:00:00 1970 +0000
1851 | | summary: create foo, related
1851 | | summary: create foo, related
1852 | |
1852 | |
1853 | o changeset: 5:73db34516eb9
1853 | o changeset: 5:73db34516eb9
1854 | | parent: 0:e87515fd044a
1854 | | parent: 0:e87515fd044a
1855 | | user: test
1855 | | user: test
1856 | | date: Thu Jan 01 00:00:00 1970 +0000
1856 | | date: Thu Jan 01 00:00:00 1970 +0000
1857 | | summary: first branch, unrelated
1857 | | summary: first branch, unrelated
1858 | |
1858 | |
1859 o | changeset: 4:88176d361b69
1859 o | changeset: 4:88176d361b69
1860 | | user: test
1860 | | user: test
1861 | | date: Thu Jan 01 00:00:00 1970 +0000
1861 | | date: Thu Jan 01 00:00:00 1970 +0000
1862 | | summary: add foo, related
1862 | | summary: add foo, related
1863 | |
1863 | |
1864 o | changeset: 3:dd78ae4afb56
1864 o | changeset: 3:dd78ae4afb56
1865 | | user: test
1865 | | user: test
1866 | | date: Thu Jan 01 00:00:00 1970 +0000
1866 | | date: Thu Jan 01 00:00:00 1970 +0000
1867 | | summary: delete foo, unrelated
1867 | | summary: delete foo, unrelated
1868 | |
1868 | |
1869 o | changeset: 2:c4c64aedf0f7
1869 o | changeset: 2:c4c64aedf0f7
1870 | | user: test
1870 | | user: test
1871 | | date: Thu Jan 01 00:00:00 1970 +0000
1871 | | date: Thu Jan 01 00:00:00 1970 +0000
1872 | | summary: add unrelated old foo
1872 | | summary: add unrelated old foo
1873 | |
1873 | |
1874 o | changeset: 1:e5faa7440653
1874 o | changeset: 1:e5faa7440653
1875 |/ user: test
1875 |/ user: test
1876 | date: Thu Jan 01 00:00:00 1970 +0000
1876 | date: Thu Jan 01 00:00:00 1970 +0000
1877 | summary: change, unrelated
1877 | summary: change, unrelated
1878 |
1878 |
1879 o changeset: 0:e87515fd044a
1879 o changeset: 0:e87515fd044a
1880 user: test
1880 user: test
1881 date: Thu Jan 01 00:00:00 1970 +0000
1881 date: Thu Jan 01 00:00:00 1970 +0000
1882 summary: init, unrelated
1882 summary: init, unrelated
1883
1883
1884
1884
1885 $ hg --traceback log -f foo
1885 $ hg --traceback log -f foo
1886 changeset: 10:4dae8563d2c5
1886 changeset: 10:4dae8563d2c5
1887 tag: tip
1887 tag: tip
1888 parent: 9:7b35701b003e
1888 parent: 9:7b35701b003e
1889 parent: 4:88176d361b69
1889 parent: 4:88176d361b69
1890 user: test
1890 user: test
1891 date: Thu Jan 01 00:00:00 1970 +0000
1891 date: Thu Jan 01 00:00:00 1970 +0000
1892 summary: Last merge, related
1892 summary: Last merge, related
1893
1893
1894 changeset: 9:7b35701b003e
1894 changeset: 9:7b35701b003e
1895 parent: 8:e5416ad8a855
1895 parent: 8:e5416ad8a855
1896 parent: 7:87fe3144dcfa
1896 parent: 7:87fe3144dcfa
1897 user: test
1897 user: test
1898 date: Thu Jan 01 00:00:00 1970 +0000
1898 date: Thu Jan 01 00:00:00 1970 +0000
1899 summary: First merge, related
1899 summary: First merge, related
1900
1900
1901 changeset: 8:e5416ad8a855
1901 changeset: 8:e5416ad8a855
1902 parent: 6:dc6c325fe5ee
1902 parent: 6:dc6c325fe5ee
1903 user: test
1903 user: test
1904 date: Thu Jan 01 00:00:00 1970 +0000
1904 date: Thu Jan 01 00:00:00 1970 +0000
1905 summary: change foo in branch, related
1905 summary: change foo in branch, related
1906
1906
1907 changeset: 7:87fe3144dcfa
1907 changeset: 7:87fe3144dcfa
1908 user: test
1908 user: test
1909 date: Thu Jan 01 00:00:00 1970 +0000
1909 date: Thu Jan 01 00:00:00 1970 +0000
1910 summary: change foo, related
1910 summary: change foo, related
1911
1911
1912 changeset: 6:dc6c325fe5ee
1912 changeset: 6:dc6c325fe5ee
1913 user: test
1913 user: test
1914 date: Thu Jan 01 00:00:00 1970 +0000
1914 date: Thu Jan 01 00:00:00 1970 +0000
1915 summary: create foo, related
1915 summary: create foo, related
1916
1916
1917 changeset: 4:88176d361b69
1917 changeset: 4:88176d361b69
1918 user: test
1918 user: test
1919 date: Thu Jan 01 00:00:00 1970 +0000
1919 date: Thu Jan 01 00:00:00 1970 +0000
1920 summary: add foo, related
1920 summary: add foo, related
1921
1921
1922
1922
1923 Also check when maxrev < lastrevfilelog
1923 Also check when maxrev < lastrevfilelog
1924
1924
1925 $ hg --traceback log -f -r4 foo
1925 $ hg --traceback log -f -r4 foo
1926 changeset: 4:88176d361b69
1926 changeset: 4:88176d361b69
1927 user: test
1927 user: test
1928 date: Thu Jan 01 00:00:00 1970 +0000
1928 date: Thu Jan 01 00:00:00 1970 +0000
1929 summary: add foo, related
1929 summary: add foo, related
1930
1930
1931 $ cd ..
1931 $ cd ..
1932
1932
1933 Issue2383: hg log showing _less_ differences than hg diff
1933 Issue2383: hg log showing _less_ differences than hg diff
1934
1934
1935 $ hg init issue2383
1935 $ hg init issue2383
1936 $ cd issue2383
1936 $ cd issue2383
1937
1937
1938 Create a test repo:
1938 Create a test repo:
1939
1939
1940 $ echo a > a
1940 $ echo a > a
1941 $ hg ci -Am0
1941 $ hg ci -Am0
1942 adding a
1942 adding a
1943 $ echo b > b
1943 $ echo b > b
1944 $ hg ci -Am1
1944 $ hg ci -Am1
1945 adding b
1945 adding b
1946 $ hg co 0
1946 $ hg co 0
1947 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1947 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1948 $ echo b > a
1948 $ echo b > a
1949 $ hg ci -m2
1949 $ hg ci -m2
1950 created new head
1950 created new head
1951
1951
1952 Merge:
1952 Merge:
1953
1953
1954 $ hg merge
1954 $ hg merge
1955 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1955 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1956 (branch merge, don't forget to commit)
1956 (branch merge, don't forget to commit)
1957
1957
1958 Make sure there's a file listed in the merge to trigger the bug:
1958 Make sure there's a file listed in the merge to trigger the bug:
1959
1959
1960 $ echo c > a
1960 $ echo c > a
1961 $ hg ci -m3
1961 $ hg ci -m3
1962
1962
1963 Two files shown here in diff:
1963 Two files shown here in diff:
1964
1964
1965 $ hg diff --rev 2:3
1965 $ hg diff --rev 2:3
1966 diff -r b09be438c43a -r 8e07aafe1edc a
1966 diff -r b09be438c43a -r 8e07aafe1edc a
1967 --- a/a Thu Jan 01 00:00:00 1970 +0000
1967 --- a/a Thu Jan 01 00:00:00 1970 +0000
1968 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1968 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1969 @@ -1,1 +1,1 @@
1969 @@ -1,1 +1,1 @@
1970 -b
1970 -b
1971 +c
1971 +c
1972 diff -r b09be438c43a -r 8e07aafe1edc b
1972 diff -r b09be438c43a -r 8e07aafe1edc b
1973 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1973 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1974 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1974 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1975 @@ -0,0 +1,1 @@
1975 @@ -0,0 +1,1 @@
1976 +b
1976 +b
1977
1977
1978 Diff here should be the same:
1978 Diff here should be the same:
1979
1979
1980 $ hg log -vpr 3
1980 $ hg log -vpr 3
1981 changeset: 3:8e07aafe1edc
1981 changeset: 3:8e07aafe1edc
1982 tag: tip
1982 tag: tip
1983 parent: 2:b09be438c43a
1983 parent: 2:b09be438c43a
1984 parent: 1:925d80f479bb
1984 parent: 1:925d80f479bb
1985 user: test
1985 user: test
1986 date: Thu Jan 01 00:00:00 1970 +0000
1986 date: Thu Jan 01 00:00:00 1970 +0000
1987 files: a
1987 files: a
1988 description:
1988 description:
1989 3
1989 3
1990
1990
1991
1991
1992 diff -r b09be438c43a -r 8e07aafe1edc a
1992 diff -r b09be438c43a -r 8e07aafe1edc a
1993 --- a/a Thu Jan 01 00:00:00 1970 +0000
1993 --- a/a Thu Jan 01 00:00:00 1970 +0000
1994 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1994 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1995 @@ -1,1 +1,1 @@
1995 @@ -1,1 +1,1 @@
1996 -b
1996 -b
1997 +c
1997 +c
1998 diff -r b09be438c43a -r 8e07aafe1edc b
1998 diff -r b09be438c43a -r 8e07aafe1edc b
1999 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1999 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2000 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2000 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2001 @@ -0,0 +1,1 @@
2001 @@ -0,0 +1,1 @@
2002 +b
2002 +b
2003
2003
2004
2004
2005 Test that diff.merge is respected (file b was added on one side and
2005 Test that diff.merge is respected (file b was added on one side and
2006 and therefore merged cleanly)
2006 and therefore merged cleanly)
2007
2007
2008 $ hg log -pr 3 --config diff.merge=yes
2008 $ hg log -pr 3 --config diff.merge=yes
2009 changeset: 3:8e07aafe1edc
2009 changeset: 3:8e07aafe1edc
2010 tag: tip
2010 tag: tip
2011 parent: 2:b09be438c43a
2011 parent: 2:b09be438c43a
2012 parent: 1:925d80f479bb
2012 parent: 1:925d80f479bb
2013 user: test
2013 user: test
2014 date: Thu Jan 01 00:00:00 1970 +0000
2014 date: Thu Jan 01 00:00:00 1970 +0000
2015 summary: 3
2015 summary: 3
2016
2016
2017 diff -r 8e07aafe1edc a
2017 diff -r 8e07aafe1edc a
2018 --- a/a Thu Jan 01 00:00:00 1970 +0000
2018 --- a/a Thu Jan 01 00:00:00 1970 +0000
2019 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2019 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2020 @@ -1,1 +1,1 @@
2020 @@ -1,1 +1,1 @@
2021 -b
2021 -b
2022 +c
2022 +c
2023
2023
2024 $ cd ..
2024 $ cd ..
2025
2025
2026 'hg log -r rev fn' when last(filelog(fn)) != rev
2026 'hg log -r rev fn' when last(filelog(fn)) != rev
2027
2027
2028 $ hg init simplelog
2028 $ hg init simplelog
2029 $ cd simplelog
2029 $ cd simplelog
2030 $ echo f > a
2030 $ echo f > a
2031 $ hg ci -Am'a' -d '0 0'
2031 $ hg ci -Am'a' -d '0 0'
2032 adding a
2032 adding a
2033 $ echo f >> a
2033 $ echo f >> a
2034 $ hg ci -Am'a bis' -d '1 0'
2034 $ hg ci -Am'a bis' -d '1 0'
2035
2035
2036 $ hg log -r0 a
2036 $ hg log -r0 a
2037 changeset: 0:9f758d63dcde
2037 changeset: 0:9f758d63dcde
2038 user: test
2038 user: test
2039 date: Thu Jan 01 00:00:00 1970 +0000
2039 date: Thu Jan 01 00:00:00 1970 +0000
2040 summary: a
2040 summary: a
2041
2041
2042 enable obsolete to test hidden feature
2042 enable obsolete to test hidden feature
2043
2043
2044 $ cat >> $HGRCPATH << EOF
2044 $ cat >> $HGRCPATH << EOF
2045 > [experimental]
2045 > [experimental]
2046 > evolution.createmarkers=True
2046 > evolution.createmarkers=True
2047 > EOF
2047 > EOF
2048
2048
2049 $ hg log --template='{rev}:{node}\n'
2049 $ hg log --template='{rev}:{node}\n'
2050 1:a765632148dc55d38c35c4f247c618701886cb2f
2050 1:a765632148dc55d38c35c4f247c618701886cb2f
2051 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2051 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2052 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
2052 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
2053 1 new obsolescence markers
2053 1 new obsolescence markers
2054 obsoleted 1 changesets
2054 obsoleted 1 changesets
2055 $ hg up null -q
2055 $ hg up null -q
2056 $ hg log --template='{rev}:{node}\n'
2056 $ hg log --template='{rev}:{node}\n'
2057 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2057 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2058 $ hg log --template='{rev}:{node}\n' --hidden
2058 $ hg log --template='{rev}:{node}\n' --hidden
2059 1:a765632148dc55d38c35c4f247c618701886cb2f
2059 1:a765632148dc55d38c35c4f247c618701886cb2f
2060 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2060 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2061 $ hg log -r a
2061 $ hg log -r a
2062 abort: hidden revision 'a' is pruned
2062 abort: hidden revision 'a' is pruned
2063 (use --hidden to access hidden revisions)
2063 (use --hidden to access hidden revisions)
2064 [10]
2064 [10]
2065
2065
2066 test that parent prevent a changeset to be hidden
2066 test that parent prevent a changeset to be hidden
2067
2067
2068 $ hg up 1 -q --hidden
2068 $ hg up 1 -q --hidden
2069 updated to hidden changeset a765632148dc
2069 updated to hidden changeset a765632148dc
2070 (hidden revision 'a765632148dc' is pruned)
2070 (hidden revision 'a765632148dc' is pruned)
2071 $ hg log --template='{rev}:{node}\n'
2071 $ hg log --template='{rev}:{node}\n'
2072 1:a765632148dc55d38c35c4f247c618701886cb2f
2072 1:a765632148dc55d38c35c4f247c618701886cb2f
2073 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2073 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2074
2074
2075 test that second parent prevent a changeset to be hidden too
2075 test that second parent prevent a changeset to be hidden too
2076
2076
2077 $ hg debugsetparents 0 1 # nothing suitable to merge here
2077 $ hg debugsetparents 0 1 # nothing suitable to merge here
2078 $ hg log --template='{rev}:{node}\n'
2078 $ hg log --template='{rev}:{node}\n'
2079 1:a765632148dc55d38c35c4f247c618701886cb2f
2079 1:a765632148dc55d38c35c4f247c618701886cb2f
2080 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2080 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2081 $ hg debugsetparents 1
2081 $ hg debugsetparents 1
2082 $ hg up -q null
2082 $ hg up -q null
2083
2083
2084 bookmarks prevent a changeset being hidden
2084 bookmarks prevent a changeset being hidden
2085
2085
2086 $ hg bookmark --hidden -r 1 X
2086 $ hg bookmark --hidden -r 1 X
2087 bookmarking hidden changeset a765632148dc
2087 bookmarking hidden changeset a765632148dc
2088 (hidden revision 'a765632148dc' is pruned)
2088 (hidden revision 'a765632148dc' is pruned)
2089 $ hg log --template '{rev}:{node}\n'
2089 $ hg log --template '{rev}:{node}\n'
2090 1:a765632148dc55d38c35c4f247c618701886cb2f
2090 1:a765632148dc55d38c35c4f247c618701886cb2f
2091 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2091 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2092 $ hg bookmark -d X
2092 $ hg bookmark -d X
2093
2093
2094 divergent bookmarks are not hidden
2094 divergent bookmarks are not hidden
2095
2095
2096 $ hg bookmark --hidden -r 1 X@foo
2096 $ hg bookmark --hidden -r 1 X@foo
2097 bookmarking hidden changeset a765632148dc
2097 bookmarking hidden changeset a765632148dc
2098 (hidden revision 'a765632148dc' is pruned)
2098 (hidden revision 'a765632148dc' is pruned)
2099 $ hg log --template '{rev}:{node}\n'
2099 $ hg log --template '{rev}:{node}\n'
2100 1:a765632148dc55d38c35c4f247c618701886cb2f
2100 1:a765632148dc55d38c35c4f247c618701886cb2f
2101 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2101 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2102
2102
2103 test hidden revision 0 (issue5385)
2103 test hidden revision 0 (issue5385)
2104
2104
2105 $ hg bookmark -d X@foo
2105 $ hg bookmark -d X@foo
2106 $ hg up null -q
2106 $ hg up null -q
2107 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2107 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
2108 1 new obsolescence markers
2108 1 new obsolescence markers
2109 obsoleted 1 changesets
2109 obsoleted 1 changesets
2110 $ echo f > b
2110 $ echo f > b
2111 $ hg ci -Am'b' -d '2 0'
2111 $ hg ci -Am'b' -d '2 0'
2112 adding b
2112 adding b
2113 $ echo f >> b
2113 $ echo f >> b
2114 $ hg ci -m'b bis' -d '3 0'
2114 $ hg ci -m'b bis' -d '3 0'
2115 $ hg log -T'{rev}:{node}\n'
2115 $ hg log -T'{rev}:{node}\n'
2116 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2116 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2117 2:94375ec45bddd2a824535fc04855bd058c926ec0
2117 2:94375ec45bddd2a824535fc04855bd058c926ec0
2118
2118
2119 $ hg log -T'{rev}:{node}\n' -r:
2119 $ hg log -T'{rev}:{node}\n' -r:
2120 2:94375ec45bddd2a824535fc04855bd058c926ec0
2120 2:94375ec45bddd2a824535fc04855bd058c926ec0
2121 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2121 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2122 $ hg log -T'{rev}:{node}\n' -r:tip
2122 $ hg log -T'{rev}:{node}\n' -r:tip
2123 2:94375ec45bddd2a824535fc04855bd058c926ec0
2123 2:94375ec45bddd2a824535fc04855bd058c926ec0
2124 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2124 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2125 $ hg log -T'{rev}:{node}\n' -r:0
2125 $ hg log -T'{rev}:{node}\n' -r:0
2126 abort: hidden revision '0' is pruned
2126 abort: hidden revision '0' is pruned
2127 (use --hidden to access hidden revisions)
2127 (use --hidden to access hidden revisions)
2128 [10]
2128 [10]
2129 $ hg log -T'{rev}:{node}\n' -f
2129 $ hg log -T'{rev}:{node}\n' -f
2130 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2130 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2131 2:94375ec45bddd2a824535fc04855bd058c926ec0
2131 2:94375ec45bddd2a824535fc04855bd058c926ec0
2132
2132
2133 clear extensions configuration
2133 clear extensions configuration
2134 $ echo '[extensions]' >> $HGRCPATH
2134 $ echo '[extensions]' >> $HGRCPATH
2135 $ echo "obs=!" >> $HGRCPATH
2135 $ echo "obs=!" >> $HGRCPATH
2136 $ cd ..
2136 $ cd ..
2137
2137
2138 test -u/-k for problematic encoding
2138 test -u/-k for problematic encoding
2139 # unicode: cp932:
2139 # unicode: cp932:
2140 # u30A2 0x83 0x41(= 'A')
2140 # u30A2 0x83 0x41(= 'A')
2141 # u30C2 0x83 0x61(= 'a')
2141 # u30C2 0x83 0x61(= 'a')
2142
2142
2143 $ hg init problematicencoding
2143 $ hg init problematicencoding
2144 $ cd problematicencoding
2144 $ cd problematicencoding
2145
2145
2146 >>> with open('setup.sh', 'wb') as f:
2146 >>> with open('setup.sh', 'wb') as f:
2147 ... f.write(u'''
2147 ... f.write(u'''
2148 ... echo a > text
2148 ... echo a > text
2149 ... hg add text
2149 ... hg add text
2150 ... hg --encoding utf-8 commit -u '\u30A2' -m none
2150 ... hg --encoding utf-8 commit -u '\u30A2' -m none
2151 ... echo b > text
2151 ... echo b > text
2152 ... hg --encoding utf-8 commit -u '\u30C2' -m none
2152 ... hg --encoding utf-8 commit -u '\u30C2' -m none
2153 ... echo c > text
2153 ... echo c > text
2154 ... hg --encoding utf-8 commit -u none -m '\u30A2'
2154 ... hg --encoding utf-8 commit -u none -m '\u30A2'
2155 ... echo d > text
2155 ... echo d > text
2156 ... hg --encoding utf-8 commit -u none -m '\u30C2'
2156 ... hg --encoding utf-8 commit -u none -m '\u30C2'
2157 ... '''.encode('utf-8')) and None
2157 ... '''.encode('utf-8')) and None
2158 $ sh < setup.sh
2158 $ sh < setup.sh
2159
2159
2160 test in problematic encoding
2160 test in problematic encoding
2161 >>> with open('test.sh', 'wb') as f:
2161 >>> with open('test.sh', 'wb') as f:
2162 ... f.write(u'''
2162 ... f.write(u'''
2163 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2163 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2164 ... echo ====
2164 ... echo ====
2165 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2165 ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2166 ... echo ====
2166 ... echo ====
2167 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2167 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2168 ... echo ====
2168 ... echo ====
2169 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2169 ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2170 ... '''.encode('cp932')) and None
2170 ... '''.encode('cp932')) and None
2171 $ sh < test.sh
2171 $ sh < test.sh
2172 0
2172 0
2173 ====
2173 ====
2174 1
2174 1
2175 ====
2175 ====
2176 2
2176 2
2177 0
2177 0
2178 ====
2178 ====
2179 3
2179 3
2180 1
2180 1
2181
2181
2182 $ cd ..
2182 $ cd ..
2183
2183
2184 test hg log on non-existent files and on directories
2184 test hg log on non-existent files and on directories
2185 $ hg init issue1340
2185 $ hg init issue1340
2186 $ cd issue1340
2186 $ cd issue1340
2187 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2187 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2188 $ echo 1 > d1/f1
2188 $ echo 1 > d1/f1
2189 $ echo 1 > D2/f1
2189 $ echo 1 > D2/f1
2190 $ echo 1 > D3.i/f1
2190 $ echo 1 > D3.i/f1
2191 $ echo 1 > d4.hg/f1
2191 $ echo 1 > d4.hg/f1
2192 $ echo 1 > d5.d/f1
2192 $ echo 1 > d5.d/f1
2193 $ echo 1 > .d6/f1
2193 $ echo 1 > .d6/f1
2194 $ hg -q add .
2194 $ hg -q add .
2195 $ hg commit -m "a bunch of weird directories"
2195 $ hg commit -m "a bunch of weird directories"
2196 $ hg log -l1 d1/f1 | grep changeset
2196 $ hg log -l1 d1/f1 | grep changeset
2197 changeset: 0:65624cd9070a
2197 changeset: 0:65624cd9070a
2198 $ hg log -l1 f1
2198 $ hg log -l1 f1
2199 $ hg log -l1 . | grep changeset
2199 $ hg log -l1 . | grep changeset
2200 changeset: 0:65624cd9070a
2200 changeset: 0:65624cd9070a
2201 $ hg log -l1 ./ | grep changeset
2201 $ hg log -l1 ./ | grep changeset
2202 changeset: 0:65624cd9070a
2202 changeset: 0:65624cd9070a
2203 $ hg log -l1 d1 | grep changeset
2203 $ hg log -l1 d1 | grep changeset
2204 changeset: 0:65624cd9070a
2204 changeset: 0:65624cd9070a
2205 $ hg log -l1 D2 | grep changeset
2205 $ hg log -l1 D2 | grep changeset
2206 changeset: 0:65624cd9070a
2206 changeset: 0:65624cd9070a
2207 $ hg log -l1 D2/f1 | grep changeset
2207 $ hg log -l1 D2/f1 | grep changeset
2208 changeset: 0:65624cd9070a
2208 changeset: 0:65624cd9070a
2209 $ hg log -l1 D3.i | grep changeset
2209 $ hg log -l1 D3.i | grep changeset
2210 changeset: 0:65624cd9070a
2210 changeset: 0:65624cd9070a
2211 $ hg log -l1 D3.i/f1 | grep changeset
2211 $ hg log -l1 D3.i/f1 | grep changeset
2212 changeset: 0:65624cd9070a
2212 changeset: 0:65624cd9070a
2213 $ hg log -l1 d4.hg | grep changeset
2213 $ hg log -l1 d4.hg | grep changeset
2214 changeset: 0:65624cd9070a
2214 changeset: 0:65624cd9070a
2215 $ hg log -l1 d4.hg/f1 | grep changeset
2215 $ hg log -l1 d4.hg/f1 | grep changeset
2216 changeset: 0:65624cd9070a
2216 changeset: 0:65624cd9070a
2217 $ hg log -l1 d5.d | grep changeset
2217 $ hg log -l1 d5.d | grep changeset
2218 changeset: 0:65624cd9070a
2218 changeset: 0:65624cd9070a
2219 $ hg log -l1 d5.d/f1 | grep changeset
2219 $ hg log -l1 d5.d/f1 | grep changeset
2220 changeset: 0:65624cd9070a
2220 changeset: 0:65624cd9070a
2221 $ hg log -l1 .d6 | grep changeset
2221 $ hg log -l1 .d6 | grep changeset
2222 changeset: 0:65624cd9070a
2222 changeset: 0:65624cd9070a
2223 $ hg log -l1 .d6/f1 | grep changeset
2223 $ hg log -l1 .d6/f1 | grep changeset
2224 changeset: 0:65624cd9070a
2224 changeset: 0:65624cd9070a
2225
2225
2226 issue3772: hg log -r :null showing revision 0 as well
2226 issue3772: hg log -r :null showing revision 0 as well
2227
2227
2228 $ hg log -r :null
2228 $ hg log -r :null
2229 changeset: 0:65624cd9070a
2229 changeset: 0:65624cd9070a
2230 tag: tip
2230 tag: tip
2231 user: test
2231 user: test
2232 date: Thu Jan 01 00:00:00 1970 +0000
2232 date: Thu Jan 01 00:00:00 1970 +0000
2233 summary: a bunch of weird directories
2233 summary: a bunch of weird directories
2234
2234
2235 changeset: -1:000000000000
2235 changeset: -1:000000000000
2236 user:
2236 user:
2237 date: Thu Jan 01 00:00:00 1970 +0000
2237 date: Thu Jan 01 00:00:00 1970 +0000
2238
2238
2239 $ hg log -r null:null
2239 $ hg log -r null:null
2240 changeset: -1:000000000000
2240 changeset: -1:000000000000
2241 user:
2241 user:
2242 date: Thu Jan 01 00:00:00 1970 +0000
2242 date: Thu Jan 01 00:00:00 1970 +0000
2243
2243
2244 working-directory revision requires special treatment
2244 working-directory revision requires special treatment
2245
2245
2246 clean:
2246 clean:
2247
2247
2248 $ hg log -r 'wdir()' --debug
2248 $ hg log -r 'wdir()' --debug
2249 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2249 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2250 phase: draft
2250 phase: draft
2251 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2251 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2252 parent: -1:0000000000000000000000000000000000000000
2252 parent: -1:0000000000000000000000000000000000000000
2253 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2253 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2254 user: test
2254 user: test
2255 date: [A-Za-z0-9:+ ]+ (re)
2255 date: [A-Za-z0-9:+ ]+ (re)
2256 extra: branch=default
2256 extra: branch=default
2257
2257
2258 $ hg log -r 'wdir()' -p --stat
2258 $ hg log -r 'wdir()' -p --stat
2259 changeset: 2147483647:ffffffffffff
2259 changeset: 2147483647:ffffffffffff
2260 parent: 0:65624cd9070a
2260 parent: 0:65624cd9070a
2261 user: test
2261 user: test
2262 date: [A-Za-z0-9:+ ]+ (re)
2262 date: [A-Za-z0-9:+ ]+ (re)
2263
2263
2264
2264
2265
2265
2266
2266
2267 dirty:
2267 dirty:
2268
2268
2269 $ echo 2 >> d1/f1
2269 $ echo 2 >> d1/f1
2270 $ echo 2 > d1/f2
2270 $ echo 2 > d1/f2
2271 $ hg add d1/f2
2271 $ hg add d1/f2
2272 $ hg remove .d6/f1
2272 $ hg remove .d6/f1
2273 $ hg status
2273 $ hg status
2274 M d1/f1
2274 M d1/f1
2275 A d1/f2
2275 A d1/f2
2276 R .d6/f1
2276 R .d6/f1
2277
2277
2278 $ hg log -r 'wdir()'
2278 $ hg log -r 'wdir()'
2279 changeset: 2147483647:ffffffffffff
2279 changeset: 2147483647:ffffffffffff
2280 parent: 0:65624cd9070a
2280 parent: 0:65624cd9070a
2281 user: test
2281 user: test
2282 date: [A-Za-z0-9:+ ]+ (re)
2282 date: [A-Za-z0-9:+ ]+ (re)
2283
2283
2284 $ hg log -r 'wdir()' -q
2284 $ hg log -r 'wdir()' -q
2285 2147483647:ffffffffffff
2285 2147483647:ffffffffffff
2286
2286
2287 $ hg log -r 'wdir()' --debug
2287 $ hg log -r 'wdir()' --debug
2288 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2288 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2289 phase: draft
2289 phase: draft
2290 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2290 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2291 parent: -1:0000000000000000000000000000000000000000
2291 parent: -1:0000000000000000000000000000000000000000
2292 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2292 manifest: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2293 user: test
2293 user: test
2294 date: [A-Za-z0-9:+ ]+ (re)
2294 date: [A-Za-z0-9:+ ]+ (re)
2295 files: d1/f1
2295 files: d1/f1
2296 files+: d1/f2
2296 files+: d1/f2
2297 files-: .d6/f1
2297 files-: .d6/f1
2298 extra: branch=default
2298 extra: branch=default
2299
2299
2300 $ hg log -r 'wdir()' -p --stat --git
2300 $ hg log -r 'wdir()' -p --stat --git
2301 changeset: 2147483647:ffffffffffff
2301 changeset: 2147483647:ffffffffffff
2302 parent: 0:65624cd9070a
2302 parent: 0:65624cd9070a
2303 user: test
2303 user: test
2304 date: [A-Za-z0-9:+ ]+ (re)
2304 date: [A-Za-z0-9:+ ]+ (re)
2305
2305
2306 .d6/f1 | 1 -
2306 .d6/f1 | 1 -
2307 d1/f1 | 1 +
2307 d1/f1 | 1 +
2308 d1/f2 | 1 +
2308 d1/f2 | 1 +
2309 3 files changed, 2 insertions(+), 1 deletions(-)
2309 3 files changed, 2 insertions(+), 1 deletions(-)
2310
2310
2311 diff --git a/.d6/f1 b/.d6/f1
2311 diff --git a/.d6/f1 b/.d6/f1
2312 deleted file mode 100644
2312 deleted file mode 100644
2313 --- a/.d6/f1
2313 --- a/.d6/f1
2314 +++ /dev/null
2314 +++ /dev/null
2315 @@ -1,1 +0,0 @@
2315 @@ -1,1 +0,0 @@
2316 -1
2316 -1
2317 diff --git a/d1/f1 b/d1/f1
2317 diff --git a/d1/f1 b/d1/f1
2318 --- a/d1/f1
2318 --- a/d1/f1
2319 +++ b/d1/f1
2319 +++ b/d1/f1
2320 @@ -1,1 +1,2 @@
2320 @@ -1,1 +1,2 @@
2321 1
2321 1
2322 +2
2322 +2
2323 diff --git a/d1/f2 b/d1/f2
2323 diff --git a/d1/f2 b/d1/f2
2324 new file mode 100644
2324 new file mode 100644
2325 --- /dev/null
2325 --- /dev/null
2326 +++ b/d1/f2
2326 +++ b/d1/f2
2327 @@ -0,0 +1,1 @@
2327 @@ -0,0 +1,1 @@
2328 +2
2328 +2
2329
2329
2330 $ hg log -r 'wdir()' -Tjson
2330 $ hg log -r 'wdir()' -Tjson
2331 [
2331 [
2332 {
2332 {
2333 "bookmarks": [],
2333 "bookmarks": [],
2334 "branch": "default",
2334 "branch": "default",
2335 "date": [*, 0], (glob)
2335 "date": [*, 0], (glob)
2336 "desc": "",
2336 "desc": "",
2337 "node": "ffffffffffffffffffffffffffffffffffffffff",
2337 "node": "ffffffffffffffffffffffffffffffffffffffff",
2338 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2338 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2339 "phase": "draft",
2339 "phase": "draft",
2340 "rev": 2147483647,
2340 "rev": 2147483647,
2341 "tags": [],
2341 "tags": [],
2342 "user": "test"
2342 "user": "test"
2343 }
2343 }
2344 ]
2344 ]
2345
2345
2346 $ hg log -r 'wdir()' -Tjson -q
2346 $ hg log -r 'wdir()' -Tjson -q
2347 [
2347 [
2348 {
2348 {
2349 "node": "ffffffffffffffffffffffffffffffffffffffff",
2349 "node": "ffffffffffffffffffffffffffffffffffffffff",
2350 "rev": 2147483647
2350 "rev": 2147483647
2351 }
2351 }
2352 ]
2352 ]
2353
2353
2354 $ hg log -r 'wdir()' -Tjson --debug
2354 $ hg log -r 'wdir()' -Tjson --debug
2355 [
2355 [
2356 {
2356 {
2357 "added": ["d1/f2"],
2357 "added": ["d1/f2"],
2358 "bookmarks": [],
2358 "bookmarks": [],
2359 "branch": "default",
2359 "branch": "default",
2360 "date": [*, 0], (glob)
2360 "date": [*, 0], (glob)
2361 "desc": "",
2361 "desc": "",
2362 "extra": {"branch": "default"},
2362 "extra": {"branch": "default"},
2363 "manifest": "ffffffffffffffffffffffffffffffffffffffff",
2363 "manifest": "ffffffffffffffffffffffffffffffffffffffff",
2364 "modified": ["d1/f1"],
2364 "modified": ["d1/f1"],
2365 "node": "ffffffffffffffffffffffffffffffffffffffff",
2365 "node": "ffffffffffffffffffffffffffffffffffffffff",
2366 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2366 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2367 "phase": "draft",
2367 "phase": "draft",
2368 "removed": [".d6/f1"],
2368 "removed": [".d6/f1"],
2369 "rev": 2147483647,
2369 "rev": 2147483647,
2370 "tags": [],
2370 "tags": [],
2371 "user": "test"
2371 "user": "test"
2372 }
2372 }
2373 ]
2373 ]
2374
2374
2375 follow files from wdir
2375 follow files from wdir
2376
2376
2377 $ hg cp d1/f1 f1-copy
2377 $ hg cp d1/f1 f1-copy
2378 $ hg stat --all
2378 $ hg stat --all
2379 M d1/f1
2379 M d1/f1
2380 A d1/f2
2380 A d1/f2
2381 A f1-copy
2381 A f1-copy
2382 d1/f1
2382 d1/f1
2383 R .d6/f1
2383 R .d6/f1
2384 C D2/f1
2384 C D2/f1
2385 C D3.i/f1
2385 C D3.i/f1
2386 C d4.hg/f1
2386 C d4.hg/f1
2387 C d5.d/f1
2387 C d5.d/f1
2388
2388
2389 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d5.d/f1
2389 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d5.d/f1
2390 == 2147483647 ==
2390 == 2147483647 ==
2391
2391
2392 == 0 ==
2392 == 0 ==
2393 d5.d/f1 | 1 +
2393 d5.d/f1 | 1 +
2394 1 files changed, 1 insertions(+), 0 deletions(-)
2394 1 files changed, 1 insertions(+), 0 deletions(-)
2395
2395
2396
2396
2397 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f1
2397 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f1
2398 == 2147483647 ==
2398 == 2147483647 ==
2399 d1/f1 | 1 +
2399 d1/f1 | 1 +
2400 1 files changed, 1 insertions(+), 0 deletions(-)
2400 1 files changed, 1 insertions(+), 0 deletions(-)
2401
2401
2402 == 0 ==
2402 == 0 ==
2403 d1/f1 | 1 +
2403 d1/f1 | 1 +
2404 1 files changed, 1 insertions(+), 0 deletions(-)
2404 1 files changed, 1 insertions(+), 0 deletions(-)
2405
2405
2406
2406
2407 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f2
2407 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat d1/f2
2408 == 2147483647 ==
2408 == 2147483647 ==
2409 d1/f2 | 1 +
2409 d1/f2 | 1 +
2410 1 files changed, 1 insertions(+), 0 deletions(-)
2410 1 files changed, 1 insertions(+), 0 deletions(-)
2411
2411
2412
2412
2413 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat f1-copy
2413 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat f1-copy
2414 == 2147483647 ==
2414 == 2147483647 ==
2415 f1-copy | 1 +
2415 f1-copy | 1 +
2416 1 files changed, 1 insertions(+), 0 deletions(-)
2416 1 files changed, 1 insertions(+), 0 deletions(-)
2417
2417
2418 == 0 ==
2418 == 0 ==
2419 d1/f1 | 1 +
2419 d1/f1 | 1 +
2420 1 files changed, 1 insertions(+), 0 deletions(-)
2420 1 files changed, 1 insertions(+), 0 deletions(-)
2421
2421
2422
2422
2423 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound
2423 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound
2424 abort: cannot follow file not in any of the specified revisions: "notfound"
2424 abort: cannot follow file not in any of the specified revisions: "notfound"
2425 [255]
2425 [20]
2426
2426
2427 follow files from wdir and non-wdir revision:
2427 follow files from wdir and non-wdir revision:
2428
2428
2429 $ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy
2429 $ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy
2430 f1-copy: no such file in rev 65624cd9070a
2430 f1-copy: no such file in rev 65624cd9070a
2431 2147483647
2431 2147483647
2432 0
2432 0
2433
2433
2434 follow added/removed files from wdir parent
2434 follow added/removed files from wdir parent
2435
2435
2436 $ hg log -T '{rev}\n' -f d1/f2
2436 $ hg log -T '{rev}\n' -f d1/f2
2437 abort: cannot follow nonexistent file: "d1/f2"
2437 abort: cannot follow nonexistent file: "d1/f2"
2438 [255]
2438 [20]
2439
2439
2440 $ hg log -T '{rev}\n' -f f1-copy
2440 $ hg log -T '{rev}\n' -f f1-copy
2441 abort: cannot follow nonexistent file: "f1-copy"
2441 abort: cannot follow nonexistent file: "f1-copy"
2442 [255]
2442 [20]
2443
2443
2444 $ hg log -T '{rev}\n' -f .d6/f1
2444 $ hg log -T '{rev}\n' -f .d6/f1
2445 abort: cannot follow file not in parent revision: ".d6/f1"
2445 abort: cannot follow file not in parent revision: ".d6/f1"
2446 [255]
2446 [20]
2447
2447
2448 $ hg revert -aqC
2448 $ hg revert -aqC
2449
2449
2450 Check that adding an arbitrary name shows up in log automatically
2450 Check that adding an arbitrary name shows up in log automatically
2451
2451
2452 $ cat > ../names.py <<EOF
2452 $ cat > ../names.py <<EOF
2453 > """A small extension to test adding arbitrary names to a repo"""
2453 > """A small extension to test adding arbitrary names to a repo"""
2454 > from __future__ import absolute_import
2454 > from __future__ import absolute_import
2455 > from mercurial import namespaces
2455 > from mercurial import namespaces
2456 >
2456 >
2457 > def reposetup(ui, repo):
2457 > def reposetup(ui, repo):
2458 > if not repo.local():
2458 > if not repo.local():
2459 > return
2459 > return
2460 > foo = {b'foo': repo[0].node()}
2460 > foo = {b'foo': repo[0].node()}
2461 > names = lambda r: foo.keys()
2461 > names = lambda r: foo.keys()
2462 > namemap = lambda r, name: foo.get(name)
2462 > namemap = lambda r, name: foo.get(name)
2463 > nodemap = lambda r, node: [name for name, n in foo.items()
2463 > nodemap = lambda r, node: [name for name, n in foo.items()
2464 > if n == node]
2464 > if n == node]
2465 > ns = namespaces.namespace(
2465 > ns = namespaces.namespace(
2466 > b"bars", templatename=b"bar", logname=b"barlog",
2466 > b"bars", templatename=b"bar", logname=b"barlog",
2467 > colorname=b"barcolor", listnames=names, namemap=namemap,
2467 > colorname=b"barcolor", listnames=names, namemap=namemap,
2468 > nodemap=nodemap)
2468 > nodemap=nodemap)
2469 >
2469 >
2470 > repo.names.addnamespace(ns)
2470 > repo.names.addnamespace(ns)
2471 > EOF
2471 > EOF
2472
2472
2473 $ hg --config extensions.names=../names.py log -r 0
2473 $ hg --config extensions.names=../names.py log -r 0
2474 changeset: 0:65624cd9070a
2474 changeset: 0:65624cd9070a
2475 tag: tip
2475 tag: tip
2476 barlog: foo
2476 barlog: foo
2477 user: test
2477 user: test
2478 date: Thu Jan 01 00:00:00 1970 +0000
2478 date: Thu Jan 01 00:00:00 1970 +0000
2479 summary: a bunch of weird directories
2479 summary: a bunch of weird directories
2480
2480
2481 $ hg --config extensions.names=../names.py \
2481 $ hg --config extensions.names=../names.py \
2482 > --config extensions.color= --config color.log.barcolor=red \
2482 > --config extensions.color= --config color.log.barcolor=red \
2483 > --color=always log -r 0
2483 > --color=always log -r 0
2484 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2484 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2485 tag: tip
2485 tag: tip
2486 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2486 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2487 user: test
2487 user: test
2488 date: Thu Jan 01 00:00:00 1970 +0000
2488 date: Thu Jan 01 00:00:00 1970 +0000
2489 summary: a bunch of weird directories
2489 summary: a bunch of weird directories
2490
2490
2491 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2491 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2492 foo
2492 foo
2493
2493
2494 Templater parse errors:
2494 Templater parse errors:
2495
2495
2496 simple error
2496 simple error
2497 $ hg log -r . -T '{shortest(node}'
2497 $ hg log -r . -T '{shortest(node}'
2498 hg: parse error at 14: unexpected token: end
2498 hg: parse error at 14: unexpected token: end
2499 ({shortest(node}
2499 ({shortest(node}
2500 ^ here)
2500 ^ here)
2501 [10]
2501 [10]
2502
2502
2503 multi-line template with error
2503 multi-line template with error
2504 $ hg log -r . -T 'line 1
2504 $ hg log -r . -T 'line 1
2505 > line2
2505 > line2
2506 > {shortest(node}
2506 > {shortest(node}
2507 > line4\nline5'
2507 > line4\nline5'
2508 hg: parse error at 27: unexpected token: end
2508 hg: parse error at 27: unexpected token: end
2509 (line 1\nline2\n{shortest(node}\nline4\nline5
2509 (line 1\nline2\n{shortest(node}\nline4\nline5
2510 ^ here)
2510 ^ here)
2511 [10]
2511 [10]
2512
2512
2513 $ cd ..
2513 $ cd ..
2514
2514
2515 New namespace is registered per repo instance, but the template keyword
2515 New namespace is registered per repo instance, but the template keyword
2516 is global. So we shouldn't expect the namespace always exists. Using
2516 is global. So we shouldn't expect the namespace always exists. Using
2517 ssh:// makes sure a bundle repository is created from scratch. (issue6301)
2517 ssh:// makes sure a bundle repository is created from scratch. (issue6301)
2518
2518
2519 $ hg clone -qr0 "ssh://user@dummy/`pwd`/a" a-clone
2519 $ hg clone -qr0 "ssh://user@dummy/`pwd`/a" a-clone
2520 $ hg incoming --config extensions.names=names.py -R a-clone \
2520 $ hg incoming --config extensions.names=names.py -R a-clone \
2521 > -T '{bars}\n' -l1
2521 > -T '{bars}\n' -l1
2522 comparing with ssh://user@dummy/$TESTTMP/a
2522 comparing with ssh://user@dummy/$TESTTMP/a
2523 searching for changes
2523 searching for changes
2524
2524
2525
2525
2526 hg log -f dir across branches
2526 hg log -f dir across branches
2527
2527
2528 $ hg init acrossbranches
2528 $ hg init acrossbranches
2529 $ cd acrossbranches
2529 $ cd acrossbranches
2530 $ mkdir d
2530 $ mkdir d
2531 $ echo a > d/a && hg ci -Aqm a
2531 $ echo a > d/a && hg ci -Aqm a
2532 $ echo b > d/a && hg ci -Aqm b
2532 $ echo b > d/a && hg ci -Aqm b
2533 $ hg up -q 0
2533 $ hg up -q 0
2534 $ echo b > d/a && hg ci -Aqm c
2534 $ echo b > d/a && hg ci -Aqm c
2535 $ hg log -f d -T '{desc}' -G
2535 $ hg log -f d -T '{desc}' -G
2536 @ c
2536 @ c
2537 |
2537 |
2538 o a
2538 o a
2539
2539
2540 Ensure that largefiles doesn't interfere with following a normal file
2540 Ensure that largefiles doesn't interfere with following a normal file
2541 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2541 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2542 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2542 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2543 @ c
2543 @ c
2544 |
2544 |
2545 o a
2545 o a
2546
2546
2547 $ hg log -f d/a -T '{desc}' -G
2547 $ hg log -f d/a -T '{desc}' -G
2548 @ c
2548 @ c
2549 |
2549 |
2550 o a
2550 o a
2551
2551
2552 $ cd ..
2552 $ cd ..
2553
2553
2554 hg log -f with linkrev pointing to another branch
2554 hg log -f with linkrev pointing to another branch
2555 -------------------------------------------------
2555 -------------------------------------------------
2556
2556
2557 create history with a filerev whose linkrev points to another branch
2557 create history with a filerev whose linkrev points to another branch
2558
2558
2559 $ hg init branchedlinkrev
2559 $ hg init branchedlinkrev
2560 $ cd branchedlinkrev
2560 $ cd branchedlinkrev
2561 $ echo 1 > a
2561 $ echo 1 > a
2562 $ hg commit -Am 'content1'
2562 $ hg commit -Am 'content1'
2563 adding a
2563 adding a
2564 $ echo 2 > a
2564 $ echo 2 > a
2565 $ hg commit -m 'content2'
2565 $ hg commit -m 'content2'
2566 $ hg up --rev 'desc(content1)'
2566 $ hg up --rev 'desc(content1)'
2567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2568 $ echo unrelated > unrelated
2568 $ echo unrelated > unrelated
2569 $ hg commit -Am 'unrelated'
2569 $ hg commit -Am 'unrelated'
2570 adding unrelated
2570 adding unrelated
2571 created new head
2571 created new head
2572 $ hg graft -r 'desc(content2)'
2572 $ hg graft -r 'desc(content2)'
2573 grafting 1:2294ae80ad84 "content2"
2573 grafting 1:2294ae80ad84 "content2"
2574 $ echo 3 > a
2574 $ echo 3 > a
2575 $ hg commit -m 'content3'
2575 $ hg commit -m 'content3'
2576 $ hg log -G
2576 $ hg log -G
2577 @ changeset: 4:50b9b36e9c5d
2577 @ changeset: 4:50b9b36e9c5d
2578 | tag: tip
2578 | tag: tip
2579 | user: test
2579 | user: test
2580 | date: Thu Jan 01 00:00:00 1970 +0000
2580 | date: Thu Jan 01 00:00:00 1970 +0000
2581 | summary: content3
2581 | summary: content3
2582 |
2582 |
2583 o changeset: 3:15b2327059e5
2583 o changeset: 3:15b2327059e5
2584 | user: test
2584 | user: test
2585 | date: Thu Jan 01 00:00:00 1970 +0000
2585 | date: Thu Jan 01 00:00:00 1970 +0000
2586 | summary: content2
2586 | summary: content2
2587 |
2587 |
2588 o changeset: 2:2029acd1168c
2588 o changeset: 2:2029acd1168c
2589 | parent: 0:ae0a3c9f9e95
2589 | parent: 0:ae0a3c9f9e95
2590 | user: test
2590 | user: test
2591 | date: Thu Jan 01 00:00:00 1970 +0000
2591 | date: Thu Jan 01 00:00:00 1970 +0000
2592 | summary: unrelated
2592 | summary: unrelated
2593 |
2593 |
2594 | o changeset: 1:2294ae80ad84
2594 | o changeset: 1:2294ae80ad84
2595 |/ user: test
2595 |/ user: test
2596 | date: Thu Jan 01 00:00:00 1970 +0000
2596 | date: Thu Jan 01 00:00:00 1970 +0000
2597 | summary: content2
2597 | summary: content2
2598 |
2598 |
2599 o changeset: 0:ae0a3c9f9e95
2599 o changeset: 0:ae0a3c9f9e95
2600 user: test
2600 user: test
2601 date: Thu Jan 01 00:00:00 1970 +0000
2601 date: Thu Jan 01 00:00:00 1970 +0000
2602 summary: content1
2602 summary: content1
2603
2603
2604
2604
2605 log -f on the file should list the graft result.
2605 log -f on the file should list the graft result.
2606
2606
2607 $ hg log -Gf a
2607 $ hg log -Gf a
2608 @ changeset: 4:50b9b36e9c5d
2608 @ changeset: 4:50b9b36e9c5d
2609 | tag: tip
2609 | tag: tip
2610 | user: test
2610 | user: test
2611 | date: Thu Jan 01 00:00:00 1970 +0000
2611 | date: Thu Jan 01 00:00:00 1970 +0000
2612 | summary: content3
2612 | summary: content3
2613 |
2613 |
2614 o changeset: 3:15b2327059e5
2614 o changeset: 3:15b2327059e5
2615 : user: test
2615 : user: test
2616 : date: Thu Jan 01 00:00:00 1970 +0000
2616 : date: Thu Jan 01 00:00:00 1970 +0000
2617 : summary: content2
2617 : summary: content2
2618 :
2618 :
2619 o changeset: 0:ae0a3c9f9e95
2619 o changeset: 0:ae0a3c9f9e95
2620 user: test
2620 user: test
2621 date: Thu Jan 01 00:00:00 1970 +0000
2621 date: Thu Jan 01 00:00:00 1970 +0000
2622 summary: content1
2622 summary: content1
2623
2623
2624
2624
2625 plain log lists the original version
2625 plain log lists the original version
2626 (XXX we should probably list both)
2626 (XXX we should probably list both)
2627
2627
2628 $ hg log -G a
2628 $ hg log -G a
2629 @ changeset: 4:50b9b36e9c5d
2629 @ changeset: 4:50b9b36e9c5d
2630 : tag: tip
2630 : tag: tip
2631 : user: test
2631 : user: test
2632 : date: Thu Jan 01 00:00:00 1970 +0000
2632 : date: Thu Jan 01 00:00:00 1970 +0000
2633 : summary: content3
2633 : summary: content3
2634 :
2634 :
2635 : o changeset: 1:2294ae80ad84
2635 : o changeset: 1:2294ae80ad84
2636 :/ user: test
2636 :/ user: test
2637 : date: Thu Jan 01 00:00:00 1970 +0000
2637 : date: Thu Jan 01 00:00:00 1970 +0000
2638 : summary: content2
2638 : summary: content2
2639 :
2639 :
2640 o changeset: 0:ae0a3c9f9e95
2640 o changeset: 0:ae0a3c9f9e95
2641 user: test
2641 user: test
2642 date: Thu Jan 01 00:00:00 1970 +0000
2642 date: Thu Jan 01 00:00:00 1970 +0000
2643 summary: content1
2643 summary: content1
2644
2644
2645
2645
2646 hg log -f from the grafted changeset
2646 hg log -f from the grafted changeset
2647 (The bootstrap should properly take the topology in account)
2647 (The bootstrap should properly take the topology in account)
2648
2648
2649 $ hg up 'desc(content3)^'
2649 $ hg up 'desc(content3)^'
2650 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2650 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2651 $ hg log -Gf a
2651 $ hg log -Gf a
2652 @ changeset: 3:15b2327059e5
2652 @ changeset: 3:15b2327059e5
2653 : user: test
2653 : user: test
2654 : date: Thu Jan 01 00:00:00 1970 +0000
2654 : date: Thu Jan 01 00:00:00 1970 +0000
2655 : summary: content2
2655 : summary: content2
2656 :
2656 :
2657 o changeset: 0:ae0a3c9f9e95
2657 o changeset: 0:ae0a3c9f9e95
2658 user: test
2658 user: test
2659 date: Thu Jan 01 00:00:00 1970 +0000
2659 date: Thu Jan 01 00:00:00 1970 +0000
2660 summary: content1
2660 summary: content1
2661
2661
2662
2662
2663 Test that we use the first non-hidden changeset in that case.
2663 Test that we use the first non-hidden changeset in that case.
2664
2664
2665 (hide the changeset)
2665 (hide the changeset)
2666
2666
2667 $ hg log -T '{node}\n' -r 1
2667 $ hg log -T '{node}\n' -r 1
2668 2294ae80ad8447bc78383182eeac50cb049df623
2668 2294ae80ad8447bc78383182eeac50cb049df623
2669 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2669 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2670 1 new obsolescence markers
2670 1 new obsolescence markers
2671 obsoleted 1 changesets
2671 obsoleted 1 changesets
2672 $ hg log -G
2672 $ hg log -G
2673 o changeset: 4:50b9b36e9c5d
2673 o changeset: 4:50b9b36e9c5d
2674 | tag: tip
2674 | tag: tip
2675 | user: test
2675 | user: test
2676 | date: Thu Jan 01 00:00:00 1970 +0000
2676 | date: Thu Jan 01 00:00:00 1970 +0000
2677 | summary: content3
2677 | summary: content3
2678 |
2678 |
2679 @ changeset: 3:15b2327059e5
2679 @ changeset: 3:15b2327059e5
2680 | user: test
2680 | user: test
2681 | date: Thu Jan 01 00:00:00 1970 +0000
2681 | date: Thu Jan 01 00:00:00 1970 +0000
2682 | summary: content2
2682 | summary: content2
2683 |
2683 |
2684 o changeset: 2:2029acd1168c
2684 o changeset: 2:2029acd1168c
2685 | parent: 0:ae0a3c9f9e95
2685 | parent: 0:ae0a3c9f9e95
2686 | user: test
2686 | user: test
2687 | date: Thu Jan 01 00:00:00 1970 +0000
2687 | date: Thu Jan 01 00:00:00 1970 +0000
2688 | summary: unrelated
2688 | summary: unrelated
2689 |
2689 |
2690 o changeset: 0:ae0a3c9f9e95
2690 o changeset: 0:ae0a3c9f9e95
2691 user: test
2691 user: test
2692 date: Thu Jan 01 00:00:00 1970 +0000
2692 date: Thu Jan 01 00:00:00 1970 +0000
2693 summary: content1
2693 summary: content1
2694
2694
2695
2695
2696 Check that log on the file does not drop the file revision.
2696 Check that log on the file does not drop the file revision.
2697
2697
2698 $ hg log -G a
2698 $ hg log -G a
2699 o changeset: 4:50b9b36e9c5d
2699 o changeset: 4:50b9b36e9c5d
2700 | tag: tip
2700 | tag: tip
2701 | user: test
2701 | user: test
2702 | date: Thu Jan 01 00:00:00 1970 +0000
2702 | date: Thu Jan 01 00:00:00 1970 +0000
2703 | summary: content3
2703 | summary: content3
2704 |
2704 |
2705 @ changeset: 3:15b2327059e5
2705 @ changeset: 3:15b2327059e5
2706 : user: test
2706 : user: test
2707 : date: Thu Jan 01 00:00:00 1970 +0000
2707 : date: Thu Jan 01 00:00:00 1970 +0000
2708 : summary: content2
2708 : summary: content2
2709 :
2709 :
2710 o changeset: 0:ae0a3c9f9e95
2710 o changeset: 0:ae0a3c9f9e95
2711 user: test
2711 user: test
2712 date: Thu Jan 01 00:00:00 1970 +0000
2712 date: Thu Jan 01 00:00:00 1970 +0000
2713 summary: content1
2713 summary: content1
2714
2714
2715
2715
2716 Even when a head revision is linkrev-shadowed.
2716 Even when a head revision is linkrev-shadowed.
2717
2717
2718 $ hg log -T '{node}\n' -r 4
2718 $ hg log -T '{node}\n' -r 4
2719 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2719 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2720 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2720 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2721 1 new obsolescence markers
2721 1 new obsolescence markers
2722 obsoleted 1 changesets
2722 obsoleted 1 changesets
2723 $ hg log -G a
2723 $ hg log -G a
2724 @ changeset: 3:15b2327059e5
2724 @ changeset: 3:15b2327059e5
2725 : tag: tip
2725 : tag: tip
2726 : user: test
2726 : user: test
2727 : date: Thu Jan 01 00:00:00 1970 +0000
2727 : date: Thu Jan 01 00:00:00 1970 +0000
2728 : summary: content2
2728 : summary: content2
2729 :
2729 :
2730 o changeset: 0:ae0a3c9f9e95
2730 o changeset: 0:ae0a3c9f9e95
2731 user: test
2731 user: test
2732 date: Thu Jan 01 00:00:00 1970 +0000
2732 date: Thu Jan 01 00:00:00 1970 +0000
2733 summary: content1
2733 summary: content1
2734
2734
2735
2735
2736 $ cd ..
2736 $ cd ..
2737
2737
2738 Even when the file revision is missing from some head:
2738 Even when the file revision is missing from some head:
2739
2739
2740 $ hg init issue4490
2740 $ hg init issue4490
2741 $ cd issue4490
2741 $ cd issue4490
2742 $ echo '[experimental]' >> .hg/hgrc
2742 $ echo '[experimental]' >> .hg/hgrc
2743 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2743 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2744 $ echo a > a
2744 $ echo a > a
2745 $ hg ci -Am0
2745 $ hg ci -Am0
2746 adding a
2746 adding a
2747 $ echo b > b
2747 $ echo b > b
2748 $ hg ci -Am1
2748 $ hg ci -Am1
2749 adding b
2749 adding b
2750 $ echo B > b
2750 $ echo B > b
2751 $ hg ci --amend -m 1
2751 $ hg ci --amend -m 1
2752 $ hg up 0
2752 $ hg up 0
2753 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2753 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2754 $ echo c > c
2754 $ echo c > c
2755 $ hg ci -Am2
2755 $ hg ci -Am2
2756 adding c
2756 adding c
2757 created new head
2757 created new head
2758 $ hg up 'head() and not .'
2758 $ hg up 'head() and not .'
2759 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2759 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2760 $ hg log -G
2760 $ hg log -G
2761 o changeset: 3:db815d6d32e6
2761 o changeset: 3:db815d6d32e6
2762 | tag: tip
2762 | tag: tip
2763 | parent: 0:f7b1eb17ad24
2763 | parent: 0:f7b1eb17ad24
2764 | user: test
2764 | user: test
2765 | date: Thu Jan 01 00:00:00 1970 +0000
2765 | date: Thu Jan 01 00:00:00 1970 +0000
2766 | summary: 2
2766 | summary: 2
2767 |
2767 |
2768 | @ changeset: 2:9bc8ce7f9356
2768 | @ changeset: 2:9bc8ce7f9356
2769 |/ parent: 0:f7b1eb17ad24
2769 |/ parent: 0:f7b1eb17ad24
2770 | user: test
2770 | user: test
2771 | date: Thu Jan 01 00:00:00 1970 +0000
2771 | date: Thu Jan 01 00:00:00 1970 +0000
2772 | summary: 1
2772 | summary: 1
2773 |
2773 |
2774 o changeset: 0:f7b1eb17ad24
2774 o changeset: 0:f7b1eb17ad24
2775 user: test
2775 user: test
2776 date: Thu Jan 01 00:00:00 1970 +0000
2776 date: Thu Jan 01 00:00:00 1970 +0000
2777 summary: 0
2777 summary: 0
2778
2778
2779 $ hg log -f -G b
2779 $ hg log -f -G b
2780 @ changeset: 2:9bc8ce7f9356
2780 @ changeset: 2:9bc8ce7f9356
2781 | parent: 0:f7b1eb17ad24
2781 | parent: 0:f7b1eb17ad24
2782 ~ user: test
2782 ~ user: test
2783 date: Thu Jan 01 00:00:00 1970 +0000
2783 date: Thu Jan 01 00:00:00 1970 +0000
2784 summary: 1
2784 summary: 1
2785
2785
2786 $ hg log -G b
2786 $ hg log -G b
2787 @ changeset: 2:9bc8ce7f9356
2787 @ changeset: 2:9bc8ce7f9356
2788 | parent: 0:f7b1eb17ad24
2788 | parent: 0:f7b1eb17ad24
2789 ~ user: test
2789 ~ user: test
2790 date: Thu Jan 01 00:00:00 1970 +0000
2790 date: Thu Jan 01 00:00:00 1970 +0000
2791 summary: 1
2791 summary: 1
2792
2792
2793 $ cd ..
2793 $ cd ..
2794
2794
2795 Check proper report when the manifest changes but not the file issue4499
2795 Check proper report when the manifest changes but not the file issue4499
2796 ------------------------------------------------------------------------
2796 ------------------------------------------------------------------------
2797
2797
2798 $ hg init issue4499
2798 $ hg init issue4499
2799 $ cd issue4499
2799 $ cd issue4499
2800 $ 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
2800 $ 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
2801 > echo 1 > $f;
2801 > echo 1 > $f;
2802 > hg add $f;
2802 > hg add $f;
2803 > done
2803 > done
2804 $ hg commit -m 'A1B1C1'
2804 $ hg commit -m 'A1B1C1'
2805 $ echo 2 > A
2805 $ echo 2 > A
2806 $ echo 2 > B
2806 $ echo 2 > B
2807 $ echo 2 > C
2807 $ echo 2 > C
2808 $ hg commit -m 'A2B2C2'
2808 $ hg commit -m 'A2B2C2'
2809 $ hg up 0
2809 $ hg up 0
2810 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2810 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2811 $ echo 3 > A
2811 $ echo 3 > A
2812 $ echo 2 > B
2812 $ echo 2 > B
2813 $ echo 2 > C
2813 $ echo 2 > C
2814 $ hg commit -m 'A3B2C2'
2814 $ hg commit -m 'A3B2C2'
2815 created new head
2815 created new head
2816
2816
2817 $ hg log -G
2817 $ hg log -G
2818 @ changeset: 2:fe5fc3d0eb17
2818 @ changeset: 2:fe5fc3d0eb17
2819 | tag: tip
2819 | tag: tip
2820 | parent: 0:abf4f0e38563
2820 | parent: 0:abf4f0e38563
2821 | user: test
2821 | user: test
2822 | date: Thu Jan 01 00:00:00 1970 +0000
2822 | date: Thu Jan 01 00:00:00 1970 +0000
2823 | summary: A3B2C2
2823 | summary: A3B2C2
2824 |
2824 |
2825 | o changeset: 1:07dcc6b312c0
2825 | o changeset: 1:07dcc6b312c0
2826 |/ user: test
2826 |/ user: test
2827 | date: Thu Jan 01 00:00:00 1970 +0000
2827 | date: Thu Jan 01 00:00:00 1970 +0000
2828 | summary: A2B2C2
2828 | summary: A2B2C2
2829 |
2829 |
2830 o changeset: 0:abf4f0e38563
2830 o changeset: 0:abf4f0e38563
2831 user: test
2831 user: test
2832 date: Thu Jan 01 00:00:00 1970 +0000
2832 date: Thu Jan 01 00:00:00 1970 +0000
2833 summary: A1B1C1
2833 summary: A1B1C1
2834
2834
2835
2835
2836 Log -f on B should reports current changesets
2836 Log -f on B should reports current changesets
2837
2837
2838 $ hg log -fG B
2838 $ hg log -fG B
2839 @ changeset: 2:fe5fc3d0eb17
2839 @ changeset: 2:fe5fc3d0eb17
2840 | tag: tip
2840 | tag: tip
2841 | parent: 0:abf4f0e38563
2841 | parent: 0:abf4f0e38563
2842 | user: test
2842 | user: test
2843 | date: Thu Jan 01 00:00:00 1970 +0000
2843 | date: Thu Jan 01 00:00:00 1970 +0000
2844 | summary: A3B2C2
2844 | summary: A3B2C2
2845 |
2845 |
2846 o changeset: 0:abf4f0e38563
2846 o changeset: 0:abf4f0e38563
2847 user: test
2847 user: test
2848 date: Thu Jan 01 00:00:00 1970 +0000
2848 date: Thu Jan 01 00:00:00 1970 +0000
2849 summary: A1B1C1
2849 summary: A1B1C1
2850
2850
2851 $ cd ..
2851 $ cd ..
2852
2852
2853 --- going to test line wrap fix on using both --stat and -G (issue5800)
2853 --- going to test line wrap fix on using both --stat and -G (issue5800)
2854 $ hg init issue5800
2854 $ hg init issue5800
2855 $ cd issue5800
2855 $ cd issue5800
2856 $ touch a
2856 $ touch a
2857 $ hg ci -Am 'add a'
2857 $ hg ci -Am 'add a'
2858 adding a
2858 adding a
2859 ---- now we are going to add 300 lines to a
2859 ---- now we are going to add 300 lines to a
2860 $ for i in `$TESTDIR/seq.py 1 300`; do echo $i >> a; done
2860 $ for i in `$TESTDIR/seq.py 1 300`; do echo $i >> a; done
2861 $ hg ci -m 'modify a'
2861 $ hg ci -m 'modify a'
2862 $ hg log
2862 $ hg log
2863 changeset: 1:a98683e6a834
2863 changeset: 1:a98683e6a834
2864 tag: tip
2864 tag: tip
2865 user: test
2865 user: test
2866 date: Thu Jan 01 00:00:00 1970 +0000
2866 date: Thu Jan 01 00:00:00 1970 +0000
2867 summary: modify a
2867 summary: modify a
2868
2868
2869 changeset: 0:ac82d8b1f7c4
2869 changeset: 0:ac82d8b1f7c4
2870 user: test
2870 user: test
2871 date: Thu Jan 01 00:00:00 1970 +0000
2871 date: Thu Jan 01 00:00:00 1970 +0000
2872 summary: add a
2872 summary: add a
2873
2873
2874 ---- now visualise the changes we made without template
2874 ---- now visualise the changes we made without template
2875 $ hg log -l1 -r a98683e6a834 --stat -G
2875 $ hg log -l1 -r a98683e6a834 --stat -G
2876 @ changeset: 1:a98683e6a834
2876 @ changeset: 1:a98683e6a834
2877 | tag: tip
2877 | tag: tip
2878 ~ user: test
2878 ~ user: test
2879 date: Thu Jan 01 00:00:00 1970 +0000
2879 date: Thu Jan 01 00:00:00 1970 +0000
2880 summary: modify a
2880 summary: modify a
2881
2881
2882 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2882 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2883 1 files changed, 300 insertions(+), 0 deletions(-)
2883 1 files changed, 300 insertions(+), 0 deletions(-)
2884
2884
2885 ---- with template
2885 ---- with template
2886 $ hg log -l1 -r a98683e6a834 --stat -G -T bisect
2886 $ hg log -l1 -r a98683e6a834 --stat -G -T bisect
2887 @ changeset: 1:a98683e6a834
2887 @ changeset: 1:a98683e6a834
2888 | bisect:
2888 | bisect:
2889 ~ tag: tip
2889 ~ tag: tip
2890 user: test
2890 user: test
2891 date: Thu Jan 01 00:00:00 1970 +0000
2891 date: Thu Jan 01 00:00:00 1970 +0000
2892 summary: modify a
2892 summary: modify a
2893
2893
2894 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2894 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2895 1 files changed, 300 insertions(+), 0 deletions(-)
2895 1 files changed, 300 insertions(+), 0 deletions(-)
2896
2896
2897 $ hg log -l1 -r a98683e6a834 --stat -G -T changelog
2897 $ hg log -l1 -r a98683e6a834 --stat -G -T changelog
2898 1970-01-01 test <test>
2898 1970-01-01 test <test>
2899
2899
2900 @ * a:
2900 @ * a:
2901 | modify a
2901 | modify a
2902 ~ [a98683e6a834] [tip]
2902 ~ [a98683e6a834] [tip]
2903
2903
2904 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2904 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2905 1 files changed, 300 insertions(+), 0 deletions(-)
2905 1 files changed, 300 insertions(+), 0 deletions(-)
2906
2906
2907 $ hg log -l1 -r a98683e6a834 --stat -G -T compact
2907 $ hg log -l1 -r a98683e6a834 --stat -G -T compact
2908 @ 1[tip] a98683e6a834 1970-01-01 00:00 +0000 test
2908 @ 1[tip] a98683e6a834 1970-01-01 00:00 +0000 test
2909 | modify a
2909 | modify a
2910 ~
2910 ~
2911 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2911 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2912 1 files changed, 300 insertions(+), 0 deletions(-)
2912 1 files changed, 300 insertions(+), 0 deletions(-)
2913
2913
2914 $ hg log -l1 -r a98683e6a834 --stat -G -T default
2914 $ hg log -l1 -r a98683e6a834 --stat -G -T default
2915 @ changeset: 1:a98683e6a834
2915 @ changeset: 1:a98683e6a834
2916 | tag: tip
2916 | tag: tip
2917 ~ user: test
2917 ~ user: test
2918 date: Thu Jan 01 00:00:00 1970 +0000
2918 date: Thu Jan 01 00:00:00 1970 +0000
2919 summary: modify a
2919 summary: modify a
2920
2920
2921 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2921 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2922 1 files changed, 300 insertions(+), 0 deletions(-)
2922 1 files changed, 300 insertions(+), 0 deletions(-)
2923
2923
2924 $ hg log -l1 -r a98683e6a834 --stat -G -T phases
2924 $ hg log -l1 -r a98683e6a834 --stat -G -T phases
2925 @ changeset: 1:a98683e6a834
2925 @ changeset: 1:a98683e6a834
2926 | tag: tip
2926 | tag: tip
2927 ~ phase: draft
2927 ~ phase: draft
2928 user: test
2928 user: test
2929 date: Thu Jan 01 00:00:00 1970 +0000
2929 date: Thu Jan 01 00:00:00 1970 +0000
2930 summary: modify a
2930 summary: modify a
2931
2931
2932 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2932 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2933 1 files changed, 300 insertions(+), 0 deletions(-)
2933 1 files changed, 300 insertions(+), 0 deletions(-)
2934
2934
2935 $ hg log -l1 -r a98683e6a834 --stat -G -T show
2935 $ hg log -l1 -r a98683e6a834 --stat -G -T show
2936 @ changeset: 1:a98683e6a834
2936 @ changeset: 1:a98683e6a834
2937 | tag: tip
2937 | tag: tip
2938 ~ user: test
2938 ~ user: test
2939 date: Thu Jan 01 00:00:00 1970 +0000
2939 date: Thu Jan 01 00:00:00 1970 +0000
2940 summary: modify a
2940 summary: modify a
2941
2941
2942 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2942 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2943 1 files changed, 300 insertions(+), 0 deletions(-)
2943 1 files changed, 300 insertions(+), 0 deletions(-)
2944
2944
2945 $ hg log -l1 -r a98683e6a834 --stat -G -T status
2945 $ hg log -l1 -r a98683e6a834 --stat -G -T status
2946 @ changeset: 1:a98683e6a834
2946 @ changeset: 1:a98683e6a834
2947 | tag: tip
2947 | tag: tip
2948 ~ user: test
2948 ~ user: test
2949 date: Thu Jan 01 00:00:00 1970 +0000
2949 date: Thu Jan 01 00:00:00 1970 +0000
2950 summary: modify a
2950 summary: modify a
2951 files:
2951 files:
2952 M a
2952 M a
2953
2953
2954 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2954 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2955 1 files changed, 300 insertions(+), 0 deletions(-)
2955 1 files changed, 300 insertions(+), 0 deletions(-)
2956
2956
2957 $ hg log -l1 -r a98683e6a834 --stat -G -T xml
2957 $ hg log -l1 -r a98683e6a834 --stat -G -T xml
2958 <?xml version="1.0"?>
2958 <?xml version="1.0"?>
2959 <log>
2959 <log>
2960 @ <logentry revision="1" node="a98683e6a8340830a7683909768b62871e84bc9d">
2960 @ <logentry revision="1" node="a98683e6a8340830a7683909768b62871e84bc9d">
2961 | <tag>tip</tag>
2961 | <tag>tip</tag>
2962 ~ <author email="test">test</author>
2962 ~ <author email="test">test</author>
2963 <date>1970-01-01T00:00:00+00:00</date>
2963 <date>1970-01-01T00:00:00+00:00</date>
2964 <msg xml:space="preserve">modify a</msg>
2964 <msg xml:space="preserve">modify a</msg>
2965 </logentry>
2965 </logentry>
2966 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2966 a | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2967 1 files changed, 300 insertions(+), 0 deletions(-)
2967 1 files changed, 300 insertions(+), 0 deletions(-)
2968
2968
2969 </log>
2969 </log>
2970
2970
2971 $ cd ..
2971 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now