##// END OF EJS Templates
log: build follow-log filematcher at once...
Yuya Nishihara -
r35708:3e394e05 default
parent child Browse files
Show More
@@ -1,3963 +1,3935 b''
1 # cmdutil.py - help for command processing in mercurial
1 # cmdutil.py - help for command processing in mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11 import itertools
11 import itertools
12 import os
12 import os
13 import re
13 import re
14 import tempfile
14 import tempfile
15
15
16 from .i18n import _
16 from .i18n import _
17 from .node import (
17 from .node import (
18 hex,
18 hex,
19 nullid,
19 nullid,
20 nullrev,
20 nullrev,
21 short,
21 short,
22 )
22 )
23
23
24 from . import (
24 from . import (
25 bookmarks,
25 bookmarks,
26 changelog,
26 changelog,
27 copies,
27 copies,
28 crecord as crecordmod,
28 crecord as crecordmod,
29 dagop,
29 dagop,
30 dirstateguard,
30 dirstateguard,
31 encoding,
31 encoding,
32 error,
32 error,
33 formatter,
33 formatter,
34 graphmod,
34 graphmod,
35 match as matchmod,
35 match as matchmod,
36 mdiff,
36 mdiff,
37 obsolete,
37 obsolete,
38 patch,
38 patch,
39 pathutil,
39 pathutil,
40 pycompat,
40 pycompat,
41 registrar,
41 registrar,
42 revlog,
42 revlog,
43 revset,
43 revset,
44 revsetlang,
44 revsetlang,
45 scmutil,
45 scmutil,
46 smartset,
46 smartset,
47 templatekw,
47 templatekw,
48 templater,
48 templater,
49 util,
49 util,
50 vfs as vfsmod,
50 vfs as vfsmod,
51 )
51 )
52 stringio = util.stringio
52 stringio = util.stringio
53
53
54 # templates of common command options
54 # templates of common command options
55
55
56 dryrunopts = [
56 dryrunopts = [
57 ('n', 'dry-run', None,
57 ('n', 'dry-run', None,
58 _('do not perform actions, just print output')),
58 _('do not perform actions, just print output')),
59 ]
59 ]
60
60
61 remoteopts = [
61 remoteopts = [
62 ('e', 'ssh', '',
62 ('e', 'ssh', '',
63 _('specify ssh command to use'), _('CMD')),
63 _('specify ssh command to use'), _('CMD')),
64 ('', 'remotecmd', '',
64 ('', 'remotecmd', '',
65 _('specify hg command to run on the remote side'), _('CMD')),
65 _('specify hg command to run on the remote side'), _('CMD')),
66 ('', 'insecure', None,
66 ('', 'insecure', None,
67 _('do not verify server certificate (ignoring web.cacerts config)')),
67 _('do not verify server certificate (ignoring web.cacerts config)')),
68 ]
68 ]
69
69
70 walkopts = [
70 walkopts = [
71 ('I', 'include', [],
71 ('I', 'include', [],
72 _('include names matching the given patterns'), _('PATTERN')),
72 _('include names matching the given patterns'), _('PATTERN')),
73 ('X', 'exclude', [],
73 ('X', 'exclude', [],
74 _('exclude names matching the given patterns'), _('PATTERN')),
74 _('exclude names matching the given patterns'), _('PATTERN')),
75 ]
75 ]
76
76
77 commitopts = [
77 commitopts = [
78 ('m', 'message', '',
78 ('m', 'message', '',
79 _('use text as commit message'), _('TEXT')),
79 _('use text as commit message'), _('TEXT')),
80 ('l', 'logfile', '',
80 ('l', 'logfile', '',
81 _('read commit message from file'), _('FILE')),
81 _('read commit message from file'), _('FILE')),
82 ]
82 ]
83
83
84 commitopts2 = [
84 commitopts2 = [
85 ('d', 'date', '',
85 ('d', 'date', '',
86 _('record the specified date as commit date'), _('DATE')),
86 _('record the specified date as commit date'), _('DATE')),
87 ('u', 'user', '',
87 ('u', 'user', '',
88 _('record the specified user as committer'), _('USER')),
88 _('record the specified user as committer'), _('USER')),
89 ]
89 ]
90
90
91 # hidden for now
91 # hidden for now
92 formatteropts = [
92 formatteropts = [
93 ('T', 'template', '',
93 ('T', 'template', '',
94 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
94 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
95 ]
95 ]
96
96
97 templateopts = [
97 templateopts = [
98 ('', 'style', '',
98 ('', 'style', '',
99 _('display using template map file (DEPRECATED)'), _('STYLE')),
99 _('display using template map file (DEPRECATED)'), _('STYLE')),
100 ('T', 'template', '',
100 ('T', 'template', '',
101 _('display with template'), _('TEMPLATE')),
101 _('display with template'), _('TEMPLATE')),
102 ]
102 ]
103
103
104 logopts = [
104 logopts = [
105 ('p', 'patch', None, _('show patch')),
105 ('p', 'patch', None, _('show patch')),
106 ('g', 'git', None, _('use git extended diff format')),
106 ('g', 'git', None, _('use git extended diff format')),
107 ('l', 'limit', '',
107 ('l', 'limit', '',
108 _('limit number of changes displayed'), _('NUM')),
108 _('limit number of changes displayed'), _('NUM')),
109 ('M', 'no-merges', None, _('do not show merges')),
109 ('M', 'no-merges', None, _('do not show merges')),
110 ('', 'stat', None, _('output diffstat-style summary of changes')),
110 ('', 'stat', None, _('output diffstat-style summary of changes')),
111 ('G', 'graph', None, _("show the revision DAG")),
111 ('G', 'graph', None, _("show the revision DAG")),
112 ] + templateopts
112 ] + templateopts
113
113
114 diffopts = [
114 diffopts = [
115 ('a', 'text', None, _('treat all files as text')),
115 ('a', 'text', None, _('treat all files as text')),
116 ('g', 'git', None, _('use git extended diff format')),
116 ('g', 'git', None, _('use git extended diff format')),
117 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
117 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
118 ('', 'nodates', None, _('omit dates from diff headers'))
118 ('', 'nodates', None, _('omit dates from diff headers'))
119 ]
119 ]
120
120
121 diffwsopts = [
121 diffwsopts = [
122 ('w', 'ignore-all-space', None,
122 ('w', 'ignore-all-space', None,
123 _('ignore white space when comparing lines')),
123 _('ignore white space when comparing lines')),
124 ('b', 'ignore-space-change', None,
124 ('b', 'ignore-space-change', None,
125 _('ignore changes in the amount of white space')),
125 _('ignore changes in the amount of white space')),
126 ('B', 'ignore-blank-lines', None,
126 ('B', 'ignore-blank-lines', None,
127 _('ignore changes whose lines are all blank')),
127 _('ignore changes whose lines are all blank')),
128 ('Z', 'ignore-space-at-eol', None,
128 ('Z', 'ignore-space-at-eol', None,
129 _('ignore changes in whitespace at EOL')),
129 _('ignore changes in whitespace at EOL')),
130 ]
130 ]
131
131
132 diffopts2 = [
132 diffopts2 = [
133 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
133 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
134 ('p', 'show-function', None, _('show which function each change is in')),
134 ('p', 'show-function', None, _('show which function each change is in')),
135 ('', 'reverse', None, _('produce a diff that undoes the changes')),
135 ('', 'reverse', None, _('produce a diff that undoes the changes')),
136 ] + diffwsopts + [
136 ] + diffwsopts + [
137 ('U', 'unified', '',
137 ('U', 'unified', '',
138 _('number of lines of context to show'), _('NUM')),
138 _('number of lines of context to show'), _('NUM')),
139 ('', 'stat', None, _('output diffstat-style summary of changes')),
139 ('', 'stat', None, _('output diffstat-style summary of changes')),
140 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
140 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
141 ]
141 ]
142
142
143 mergetoolopts = [
143 mergetoolopts = [
144 ('t', 'tool', '', _('specify merge tool')),
144 ('t', 'tool', '', _('specify merge tool')),
145 ]
145 ]
146
146
147 similarityopts = [
147 similarityopts = [
148 ('s', 'similarity', '',
148 ('s', 'similarity', '',
149 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
149 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
150 ]
150 ]
151
151
152 subrepoopts = [
152 subrepoopts = [
153 ('S', 'subrepos', None,
153 ('S', 'subrepos', None,
154 _('recurse into subrepositories'))
154 _('recurse into subrepositories'))
155 ]
155 ]
156
156
157 debugrevlogopts = [
157 debugrevlogopts = [
158 ('c', 'changelog', False, _('open changelog')),
158 ('c', 'changelog', False, _('open changelog')),
159 ('m', 'manifest', False, _('open manifest')),
159 ('m', 'manifest', False, _('open manifest')),
160 ('', 'dir', '', _('open directory manifest')),
160 ('', 'dir', '', _('open directory manifest')),
161 ]
161 ]
162
162
163 # special string such that everything below this line will be ingored in the
163 # special string such that everything below this line will be ingored in the
164 # editor text
164 # editor text
165 _linebelow = "^HG: ------------------------ >8 ------------------------$"
165 _linebelow = "^HG: ------------------------ >8 ------------------------$"
166
166
167 def ishunk(x):
167 def ishunk(x):
168 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
168 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
169 return isinstance(x, hunkclasses)
169 return isinstance(x, hunkclasses)
170
170
171 def newandmodified(chunks, originalchunks):
171 def newandmodified(chunks, originalchunks):
172 newlyaddedandmodifiedfiles = set()
172 newlyaddedandmodifiedfiles = set()
173 for chunk in chunks:
173 for chunk in chunks:
174 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
174 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
175 originalchunks:
175 originalchunks:
176 newlyaddedandmodifiedfiles.add(chunk.header.filename())
176 newlyaddedandmodifiedfiles.add(chunk.header.filename())
177 return newlyaddedandmodifiedfiles
177 return newlyaddedandmodifiedfiles
178
178
179 def parsealiases(cmd):
179 def parsealiases(cmd):
180 return cmd.lstrip("^").split("|")
180 return cmd.lstrip("^").split("|")
181
181
182 def setupwrapcolorwrite(ui):
182 def setupwrapcolorwrite(ui):
183 # wrap ui.write so diff output can be labeled/colorized
183 # wrap ui.write so diff output can be labeled/colorized
184 def wrapwrite(orig, *args, **kw):
184 def wrapwrite(orig, *args, **kw):
185 label = kw.pop(r'label', '')
185 label = kw.pop(r'label', '')
186 for chunk, l in patch.difflabel(lambda: args):
186 for chunk, l in patch.difflabel(lambda: args):
187 orig(chunk, label=label + l)
187 orig(chunk, label=label + l)
188
188
189 oldwrite = ui.write
189 oldwrite = ui.write
190 def wrap(*args, **kwargs):
190 def wrap(*args, **kwargs):
191 return wrapwrite(oldwrite, *args, **kwargs)
191 return wrapwrite(oldwrite, *args, **kwargs)
192 setattr(ui, 'write', wrap)
192 setattr(ui, 'write', wrap)
193 return oldwrite
193 return oldwrite
194
194
195 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
195 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
196 if usecurses:
196 if usecurses:
197 if testfile:
197 if testfile:
198 recordfn = crecordmod.testdecorator(testfile,
198 recordfn = crecordmod.testdecorator(testfile,
199 crecordmod.testchunkselector)
199 crecordmod.testchunkselector)
200 else:
200 else:
201 recordfn = crecordmod.chunkselector
201 recordfn = crecordmod.chunkselector
202
202
203 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
203 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
204
204
205 else:
205 else:
206 return patch.filterpatch(ui, originalhunks, operation)
206 return patch.filterpatch(ui, originalhunks, operation)
207
207
208 def recordfilter(ui, originalhunks, operation=None):
208 def recordfilter(ui, originalhunks, operation=None):
209 """ Prompts the user to filter the originalhunks and return a list of
209 """ Prompts the user to filter the originalhunks and return a list of
210 selected hunks.
210 selected hunks.
211 *operation* is used for to build ui messages to indicate the user what
211 *operation* is used for to build ui messages to indicate the user what
212 kind of filtering they are doing: reverting, committing, shelving, etc.
212 kind of filtering they are doing: reverting, committing, shelving, etc.
213 (see patch.filterpatch).
213 (see patch.filterpatch).
214 """
214 """
215 usecurses = crecordmod.checkcurses(ui)
215 usecurses = crecordmod.checkcurses(ui)
216 testfile = ui.config('experimental', 'crecordtest')
216 testfile = ui.config('experimental', 'crecordtest')
217 oldwrite = setupwrapcolorwrite(ui)
217 oldwrite = setupwrapcolorwrite(ui)
218 try:
218 try:
219 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
219 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
220 testfile, operation)
220 testfile, operation)
221 finally:
221 finally:
222 ui.write = oldwrite
222 ui.write = oldwrite
223 return newchunks, newopts
223 return newchunks, newopts
224
224
225 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
225 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
226 filterfn, *pats, **opts):
226 filterfn, *pats, **opts):
227 from . import merge as mergemod
227 from . import merge as mergemod
228 opts = pycompat.byteskwargs(opts)
228 opts = pycompat.byteskwargs(opts)
229 if not ui.interactive():
229 if not ui.interactive():
230 if cmdsuggest:
230 if cmdsuggest:
231 msg = _('running non-interactively, use %s instead') % cmdsuggest
231 msg = _('running non-interactively, use %s instead') % cmdsuggest
232 else:
232 else:
233 msg = _('running non-interactively')
233 msg = _('running non-interactively')
234 raise error.Abort(msg)
234 raise error.Abort(msg)
235
235
236 # make sure username is set before going interactive
236 # make sure username is set before going interactive
237 if not opts.get('user'):
237 if not opts.get('user'):
238 ui.username() # raise exception, username not provided
238 ui.username() # raise exception, username not provided
239
239
240 def recordfunc(ui, repo, message, match, opts):
240 def recordfunc(ui, repo, message, match, opts):
241 """This is generic record driver.
241 """This is generic record driver.
242
242
243 Its job is to interactively filter local changes, and
243 Its job is to interactively filter local changes, and
244 accordingly prepare working directory into a state in which the
244 accordingly prepare working directory into a state in which the
245 job can be delegated to a non-interactive commit command such as
245 job can be delegated to a non-interactive commit command such as
246 'commit' or 'qrefresh'.
246 'commit' or 'qrefresh'.
247
247
248 After the actual job is done by non-interactive command, the
248 After the actual job is done by non-interactive command, the
249 working directory is restored to its original state.
249 working directory is restored to its original state.
250
250
251 In the end we'll record interesting changes, and everything else
251 In the end we'll record interesting changes, and everything else
252 will be left in place, so the user can continue working.
252 will be left in place, so the user can continue working.
253 """
253 """
254
254
255 checkunfinished(repo, commit=True)
255 checkunfinished(repo, commit=True)
256 wctx = repo[None]
256 wctx = repo[None]
257 merge = len(wctx.parents()) > 1
257 merge = len(wctx.parents()) > 1
258 if merge:
258 if merge:
259 raise error.Abort(_('cannot partially commit a merge '
259 raise error.Abort(_('cannot partially commit a merge '
260 '(use "hg commit" instead)'))
260 '(use "hg commit" instead)'))
261
261
262 def fail(f, msg):
262 def fail(f, msg):
263 raise error.Abort('%s: %s' % (f, msg))
263 raise error.Abort('%s: %s' % (f, msg))
264
264
265 force = opts.get('force')
265 force = opts.get('force')
266 if not force:
266 if not force:
267 vdirs = []
267 vdirs = []
268 match.explicitdir = vdirs.append
268 match.explicitdir = vdirs.append
269 match.bad = fail
269 match.bad = fail
270
270
271 status = repo.status(match=match)
271 status = repo.status(match=match)
272 if not force:
272 if not force:
273 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
273 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
274 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
274 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
275 diffopts.nodates = True
275 diffopts.nodates = True
276 diffopts.git = True
276 diffopts.git = True
277 diffopts.showfunc = True
277 diffopts.showfunc = True
278 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
278 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
279 originalchunks = patch.parsepatch(originaldiff)
279 originalchunks = patch.parsepatch(originaldiff)
280
280
281 # 1. filter patch, since we are intending to apply subset of it
281 # 1. filter patch, since we are intending to apply subset of it
282 try:
282 try:
283 chunks, newopts = filterfn(ui, originalchunks)
283 chunks, newopts = filterfn(ui, originalchunks)
284 except error.PatchError as err:
284 except error.PatchError as err:
285 raise error.Abort(_('error parsing patch: %s') % err)
285 raise error.Abort(_('error parsing patch: %s') % err)
286 opts.update(newopts)
286 opts.update(newopts)
287
287
288 # We need to keep a backup of files that have been newly added and
288 # We need to keep a backup of files that have been newly added and
289 # modified during the recording process because there is a previous
289 # modified during the recording process because there is a previous
290 # version without the edit in the workdir
290 # version without the edit in the workdir
291 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
291 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
292 contenders = set()
292 contenders = set()
293 for h in chunks:
293 for h in chunks:
294 try:
294 try:
295 contenders.update(set(h.files()))
295 contenders.update(set(h.files()))
296 except AttributeError:
296 except AttributeError:
297 pass
297 pass
298
298
299 changed = status.modified + status.added + status.removed
299 changed = status.modified + status.added + status.removed
300 newfiles = [f for f in changed if f in contenders]
300 newfiles = [f for f in changed if f in contenders]
301 if not newfiles:
301 if not newfiles:
302 ui.status(_('no changes to record\n'))
302 ui.status(_('no changes to record\n'))
303 return 0
303 return 0
304
304
305 modified = set(status.modified)
305 modified = set(status.modified)
306
306
307 # 2. backup changed files, so we can restore them in the end
307 # 2. backup changed files, so we can restore them in the end
308
308
309 if backupall:
309 if backupall:
310 tobackup = changed
310 tobackup = changed
311 else:
311 else:
312 tobackup = [f for f in newfiles if f in modified or f in \
312 tobackup = [f for f in newfiles if f in modified or f in \
313 newlyaddedandmodifiedfiles]
313 newlyaddedandmodifiedfiles]
314 backups = {}
314 backups = {}
315 if tobackup:
315 if tobackup:
316 backupdir = repo.vfs.join('record-backups')
316 backupdir = repo.vfs.join('record-backups')
317 try:
317 try:
318 os.mkdir(backupdir)
318 os.mkdir(backupdir)
319 except OSError as err:
319 except OSError as err:
320 if err.errno != errno.EEXIST:
320 if err.errno != errno.EEXIST:
321 raise
321 raise
322 try:
322 try:
323 # backup continues
323 # backup continues
324 for f in tobackup:
324 for f in tobackup:
325 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
325 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
326 dir=backupdir)
326 dir=backupdir)
327 os.close(fd)
327 os.close(fd)
328 ui.debug('backup %r as %r\n' % (f, tmpname))
328 ui.debug('backup %r as %r\n' % (f, tmpname))
329 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
329 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
330 backups[f] = tmpname
330 backups[f] = tmpname
331
331
332 fp = stringio()
332 fp = stringio()
333 for c in chunks:
333 for c in chunks:
334 fname = c.filename()
334 fname = c.filename()
335 if fname in backups:
335 if fname in backups:
336 c.write(fp)
336 c.write(fp)
337 dopatch = fp.tell()
337 dopatch = fp.tell()
338 fp.seek(0)
338 fp.seek(0)
339
339
340 # 2.5 optionally review / modify patch in text editor
340 # 2.5 optionally review / modify patch in text editor
341 if opts.get('review', False):
341 if opts.get('review', False):
342 patchtext = (crecordmod.diffhelptext
342 patchtext = (crecordmod.diffhelptext
343 + crecordmod.patchhelptext
343 + crecordmod.patchhelptext
344 + fp.read())
344 + fp.read())
345 reviewedpatch = ui.edit(patchtext, "",
345 reviewedpatch = ui.edit(patchtext, "",
346 action="diff",
346 action="diff",
347 repopath=repo.path)
347 repopath=repo.path)
348 fp.truncate(0)
348 fp.truncate(0)
349 fp.write(reviewedpatch)
349 fp.write(reviewedpatch)
350 fp.seek(0)
350 fp.seek(0)
351
351
352 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
352 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
353 # 3a. apply filtered patch to clean repo (clean)
353 # 3a. apply filtered patch to clean repo (clean)
354 if backups:
354 if backups:
355 # Equivalent to hg.revert
355 # Equivalent to hg.revert
356 m = scmutil.matchfiles(repo, backups.keys())
356 m = scmutil.matchfiles(repo, backups.keys())
357 mergemod.update(repo, repo.dirstate.p1(),
357 mergemod.update(repo, repo.dirstate.p1(),
358 False, True, matcher=m)
358 False, True, matcher=m)
359
359
360 # 3b. (apply)
360 # 3b. (apply)
361 if dopatch:
361 if dopatch:
362 try:
362 try:
363 ui.debug('applying patch\n')
363 ui.debug('applying patch\n')
364 ui.debug(fp.getvalue())
364 ui.debug(fp.getvalue())
365 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
365 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
366 except error.PatchError as err:
366 except error.PatchError as err:
367 raise error.Abort(str(err))
367 raise error.Abort(str(err))
368 del fp
368 del fp
369
369
370 # 4. We prepared working directory according to filtered
370 # 4. We prepared working directory according to filtered
371 # patch. Now is the time to delegate the job to
371 # patch. Now is the time to delegate the job to
372 # commit/qrefresh or the like!
372 # commit/qrefresh or the like!
373
373
374 # Make all of the pathnames absolute.
374 # Make all of the pathnames absolute.
375 newfiles = [repo.wjoin(nf) for nf in newfiles]
375 newfiles = [repo.wjoin(nf) for nf in newfiles]
376 return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
376 return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
377 finally:
377 finally:
378 # 5. finally restore backed-up files
378 # 5. finally restore backed-up files
379 try:
379 try:
380 dirstate = repo.dirstate
380 dirstate = repo.dirstate
381 for realname, tmpname in backups.iteritems():
381 for realname, tmpname in backups.iteritems():
382 ui.debug('restoring %r to %r\n' % (tmpname, realname))
382 ui.debug('restoring %r to %r\n' % (tmpname, realname))
383
383
384 if dirstate[realname] == 'n':
384 if dirstate[realname] == 'n':
385 # without normallookup, restoring timestamp
385 # without normallookup, restoring timestamp
386 # may cause partially committed files
386 # may cause partially committed files
387 # to be treated as unmodified
387 # to be treated as unmodified
388 dirstate.normallookup(realname)
388 dirstate.normallookup(realname)
389
389
390 # copystat=True here and above are a hack to trick any
390 # copystat=True here and above are a hack to trick any
391 # editors that have f open that we haven't modified them.
391 # editors that have f open that we haven't modified them.
392 #
392 #
393 # Also note that this racy as an editor could notice the
393 # Also note that this racy as an editor could notice the
394 # file's mtime before we've finished writing it.
394 # file's mtime before we've finished writing it.
395 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
395 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
396 os.unlink(tmpname)
396 os.unlink(tmpname)
397 if tobackup:
397 if tobackup:
398 os.rmdir(backupdir)
398 os.rmdir(backupdir)
399 except OSError:
399 except OSError:
400 pass
400 pass
401
401
402 def recordinwlock(ui, repo, message, match, opts):
402 def recordinwlock(ui, repo, message, match, opts):
403 with repo.wlock():
403 with repo.wlock():
404 return recordfunc(ui, repo, message, match, opts)
404 return recordfunc(ui, repo, message, match, opts)
405
405
406 return commit(ui, repo, recordinwlock, pats, opts)
406 return commit(ui, repo, recordinwlock, pats, opts)
407
407
408 class dirnode(object):
408 class dirnode(object):
409 """
409 """
410 Represent a directory in user working copy with information required for
410 Represent a directory in user working copy with information required for
411 the purpose of tersing its status.
411 the purpose of tersing its status.
412
412
413 path is the path to the directory
413 path is the path to the directory
414
414
415 statuses is a set of statuses of all files in this directory (this includes
415 statuses is a set of statuses of all files in this directory (this includes
416 all the files in all the subdirectories too)
416 all the files in all the subdirectories too)
417
417
418 files is a list of files which are direct child of this directory
418 files is a list of files which are direct child of this directory
419
419
420 subdirs is a dictionary of sub-directory name as the key and it's own
420 subdirs is a dictionary of sub-directory name as the key and it's own
421 dirnode object as the value
421 dirnode object as the value
422 """
422 """
423
423
424 def __init__(self, dirpath):
424 def __init__(self, dirpath):
425 self.path = dirpath
425 self.path = dirpath
426 self.statuses = set([])
426 self.statuses = set([])
427 self.files = []
427 self.files = []
428 self.subdirs = {}
428 self.subdirs = {}
429
429
430 def _addfileindir(self, filename, status):
430 def _addfileindir(self, filename, status):
431 """Add a file in this directory as a direct child."""
431 """Add a file in this directory as a direct child."""
432 self.files.append((filename, status))
432 self.files.append((filename, status))
433
433
434 def addfile(self, filename, status):
434 def addfile(self, filename, status):
435 """
435 """
436 Add a file to this directory or to its direct parent directory.
436 Add a file to this directory or to its direct parent directory.
437
437
438 If the file is not direct child of this directory, we traverse to the
438 If the file is not direct child of this directory, we traverse to the
439 directory of which this file is a direct child of and add the file
439 directory of which this file is a direct child of and add the file
440 there.
440 there.
441 """
441 """
442
442
443 # the filename contains a path separator, it means it's not the direct
443 # the filename contains a path separator, it means it's not the direct
444 # child of this directory
444 # child of this directory
445 if '/' in filename:
445 if '/' in filename:
446 subdir, filep = filename.split('/', 1)
446 subdir, filep = filename.split('/', 1)
447
447
448 # does the dirnode object for subdir exists
448 # does the dirnode object for subdir exists
449 if subdir not in self.subdirs:
449 if subdir not in self.subdirs:
450 subdirpath = os.path.join(self.path, subdir)
450 subdirpath = os.path.join(self.path, subdir)
451 self.subdirs[subdir] = dirnode(subdirpath)
451 self.subdirs[subdir] = dirnode(subdirpath)
452
452
453 # try adding the file in subdir
453 # try adding the file in subdir
454 self.subdirs[subdir].addfile(filep, status)
454 self.subdirs[subdir].addfile(filep, status)
455
455
456 else:
456 else:
457 self._addfileindir(filename, status)
457 self._addfileindir(filename, status)
458
458
459 if status not in self.statuses:
459 if status not in self.statuses:
460 self.statuses.add(status)
460 self.statuses.add(status)
461
461
462 def iterfilepaths(self):
462 def iterfilepaths(self):
463 """Yield (status, path) for files directly under this directory."""
463 """Yield (status, path) for files directly under this directory."""
464 for f, st in self.files:
464 for f, st in self.files:
465 yield st, os.path.join(self.path, f)
465 yield st, os.path.join(self.path, f)
466
466
467 def tersewalk(self, terseargs):
467 def tersewalk(self, terseargs):
468 """
468 """
469 Yield (status, path) obtained by processing the status of this
469 Yield (status, path) obtained by processing the status of this
470 dirnode.
470 dirnode.
471
471
472 terseargs is the string of arguments passed by the user with `--terse`
472 terseargs is the string of arguments passed by the user with `--terse`
473 flag.
473 flag.
474
474
475 Following are the cases which can happen:
475 Following are the cases which can happen:
476
476
477 1) All the files in the directory (including all the files in its
477 1) All the files in the directory (including all the files in its
478 subdirectories) share the same status and the user has asked us to terse
478 subdirectories) share the same status and the user has asked us to terse
479 that status. -> yield (status, dirpath)
479 that status. -> yield (status, dirpath)
480
480
481 2) Otherwise, we do following:
481 2) Otherwise, we do following:
482
482
483 a) Yield (status, filepath) for all the files which are in this
483 a) Yield (status, filepath) for all the files which are in this
484 directory (only the ones in this directory, not the subdirs)
484 directory (only the ones in this directory, not the subdirs)
485
485
486 b) Recurse the function on all the subdirectories of this
486 b) Recurse the function on all the subdirectories of this
487 directory
487 directory
488 """
488 """
489
489
490 if len(self.statuses) == 1:
490 if len(self.statuses) == 1:
491 onlyst = self.statuses.pop()
491 onlyst = self.statuses.pop()
492
492
493 # Making sure we terse only when the status abbreviation is
493 # Making sure we terse only when the status abbreviation is
494 # passed as terse argument
494 # passed as terse argument
495 if onlyst in terseargs:
495 if onlyst in terseargs:
496 yield onlyst, self.path + pycompat.ossep
496 yield onlyst, self.path + pycompat.ossep
497 return
497 return
498
498
499 # add the files to status list
499 # add the files to status list
500 for st, fpath in self.iterfilepaths():
500 for st, fpath in self.iterfilepaths():
501 yield st, fpath
501 yield st, fpath
502
502
503 #recurse on the subdirs
503 #recurse on the subdirs
504 for dirobj in self.subdirs.values():
504 for dirobj in self.subdirs.values():
505 for st, fpath in dirobj.tersewalk(terseargs):
505 for st, fpath in dirobj.tersewalk(terseargs):
506 yield st, fpath
506 yield st, fpath
507
507
508 def tersedir(statuslist, terseargs):
508 def tersedir(statuslist, terseargs):
509 """
509 """
510 Terse the status if all the files in a directory shares the same status.
510 Terse the status if all the files in a directory shares the same status.
511
511
512 statuslist is scmutil.status() object which contains a list of files for
512 statuslist is scmutil.status() object which contains a list of files for
513 each status.
513 each status.
514 terseargs is string which is passed by the user as the argument to `--terse`
514 terseargs is string which is passed by the user as the argument to `--terse`
515 flag.
515 flag.
516
516
517 The function makes a tree of objects of dirnode class, and at each node it
517 The function makes a tree of objects of dirnode class, and at each node it
518 stores the information required to know whether we can terse a certain
518 stores the information required to know whether we can terse a certain
519 directory or not.
519 directory or not.
520 """
520 """
521 # the order matters here as that is used to produce final list
521 # the order matters here as that is used to produce final list
522 allst = ('m', 'a', 'r', 'd', 'u', 'i', 'c')
522 allst = ('m', 'a', 'r', 'd', 'u', 'i', 'c')
523
523
524 # checking the argument validity
524 # checking the argument validity
525 for s in pycompat.bytestr(terseargs):
525 for s in pycompat.bytestr(terseargs):
526 if s not in allst:
526 if s not in allst:
527 raise error.Abort(_("'%s' not recognized") % s)
527 raise error.Abort(_("'%s' not recognized") % s)
528
528
529 # creating a dirnode object for the root of the repo
529 # creating a dirnode object for the root of the repo
530 rootobj = dirnode('')
530 rootobj = dirnode('')
531 pstatus = ('modified', 'added', 'deleted', 'clean', 'unknown',
531 pstatus = ('modified', 'added', 'deleted', 'clean', 'unknown',
532 'ignored', 'removed')
532 'ignored', 'removed')
533
533
534 tersedict = {}
534 tersedict = {}
535 for attrname in pstatus:
535 for attrname in pstatus:
536 statuschar = attrname[0:1]
536 statuschar = attrname[0:1]
537 for f in getattr(statuslist, attrname):
537 for f in getattr(statuslist, attrname):
538 rootobj.addfile(f, statuschar)
538 rootobj.addfile(f, statuschar)
539 tersedict[statuschar] = []
539 tersedict[statuschar] = []
540
540
541 # we won't be tersing the root dir, so add files in it
541 # we won't be tersing the root dir, so add files in it
542 for st, fpath in rootobj.iterfilepaths():
542 for st, fpath in rootobj.iterfilepaths():
543 tersedict[st].append(fpath)
543 tersedict[st].append(fpath)
544
544
545 # process each sub-directory and build tersedict
545 # process each sub-directory and build tersedict
546 for subdir in rootobj.subdirs.values():
546 for subdir in rootobj.subdirs.values():
547 for st, f in subdir.tersewalk(terseargs):
547 for st, f in subdir.tersewalk(terseargs):
548 tersedict[st].append(f)
548 tersedict[st].append(f)
549
549
550 tersedlist = []
550 tersedlist = []
551 for st in allst:
551 for st in allst:
552 tersedict[st].sort()
552 tersedict[st].sort()
553 tersedlist.append(tersedict[st])
553 tersedlist.append(tersedict[st])
554
554
555 return tersedlist
555 return tersedlist
556
556
557 def _commentlines(raw):
557 def _commentlines(raw):
558 '''Surround lineswith a comment char and a new line'''
558 '''Surround lineswith a comment char and a new line'''
559 lines = raw.splitlines()
559 lines = raw.splitlines()
560 commentedlines = ['# %s' % line for line in lines]
560 commentedlines = ['# %s' % line for line in lines]
561 return '\n'.join(commentedlines) + '\n'
561 return '\n'.join(commentedlines) + '\n'
562
562
563 def _conflictsmsg(repo):
563 def _conflictsmsg(repo):
564 # avoid merge cycle
564 # avoid merge cycle
565 from . import merge as mergemod
565 from . import merge as mergemod
566 mergestate = mergemod.mergestate.read(repo)
566 mergestate = mergemod.mergestate.read(repo)
567 if not mergestate.active():
567 if not mergestate.active():
568 return
568 return
569
569
570 m = scmutil.match(repo[None])
570 m = scmutil.match(repo[None])
571 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
571 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
572 if unresolvedlist:
572 if unresolvedlist:
573 mergeliststr = '\n'.join(
573 mergeliststr = '\n'.join(
574 [' %s' % util.pathto(repo.root, pycompat.getcwd(), path)
574 [' %s' % util.pathto(repo.root, pycompat.getcwd(), path)
575 for path in unresolvedlist])
575 for path in unresolvedlist])
576 msg = _('''Unresolved merge conflicts:
576 msg = _('''Unresolved merge conflicts:
577
577
578 %s
578 %s
579
579
580 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
580 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
581 else:
581 else:
582 msg = _('No unresolved merge conflicts.')
582 msg = _('No unresolved merge conflicts.')
583
583
584 return _commentlines(msg)
584 return _commentlines(msg)
585
585
586 def _helpmessage(continuecmd, abortcmd):
586 def _helpmessage(continuecmd, abortcmd):
587 msg = _('To continue: %s\n'
587 msg = _('To continue: %s\n'
588 'To abort: %s') % (continuecmd, abortcmd)
588 'To abort: %s') % (continuecmd, abortcmd)
589 return _commentlines(msg)
589 return _commentlines(msg)
590
590
591 def _rebasemsg():
591 def _rebasemsg():
592 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
592 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
593
593
594 def _histeditmsg():
594 def _histeditmsg():
595 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
595 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
596
596
597 def _unshelvemsg():
597 def _unshelvemsg():
598 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
598 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
599
599
600 def _updatecleanmsg(dest=None):
600 def _updatecleanmsg(dest=None):
601 warning = _('warning: this will discard uncommitted changes')
601 warning = _('warning: this will discard uncommitted changes')
602 return 'hg update --clean %s (%s)' % (dest or '.', warning)
602 return 'hg update --clean %s (%s)' % (dest or '.', warning)
603
603
604 def _graftmsg():
604 def _graftmsg():
605 # tweakdefaults requires `update` to have a rev hence the `.`
605 # tweakdefaults requires `update` to have a rev hence the `.`
606 return _helpmessage('hg graft --continue', _updatecleanmsg())
606 return _helpmessage('hg graft --continue', _updatecleanmsg())
607
607
608 def _mergemsg():
608 def _mergemsg():
609 # tweakdefaults requires `update` to have a rev hence the `.`
609 # tweakdefaults requires `update` to have a rev hence the `.`
610 return _helpmessage('hg commit', _updatecleanmsg())
610 return _helpmessage('hg commit', _updatecleanmsg())
611
611
612 def _bisectmsg():
612 def _bisectmsg():
613 msg = _('To mark the changeset good: hg bisect --good\n'
613 msg = _('To mark the changeset good: hg bisect --good\n'
614 'To mark the changeset bad: hg bisect --bad\n'
614 'To mark the changeset bad: hg bisect --bad\n'
615 'To abort: hg bisect --reset\n')
615 'To abort: hg bisect --reset\n')
616 return _commentlines(msg)
616 return _commentlines(msg)
617
617
618 def fileexistspredicate(filename):
618 def fileexistspredicate(filename):
619 return lambda repo: repo.vfs.exists(filename)
619 return lambda repo: repo.vfs.exists(filename)
620
620
621 def _mergepredicate(repo):
621 def _mergepredicate(repo):
622 return len(repo[None].parents()) > 1
622 return len(repo[None].parents()) > 1
623
623
624 STATES = (
624 STATES = (
625 # (state, predicate to detect states, helpful message function)
625 # (state, predicate to detect states, helpful message function)
626 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
626 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
627 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
627 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
628 ('graft', fileexistspredicate('graftstate'), _graftmsg),
628 ('graft', fileexistspredicate('graftstate'), _graftmsg),
629 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
629 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
630 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
630 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
631 # The merge state is part of a list that will be iterated over.
631 # The merge state is part of a list that will be iterated over.
632 # They need to be last because some of the other unfinished states may also
632 # They need to be last because some of the other unfinished states may also
633 # be in a merge or update state (eg. rebase, histedit, graft, etc).
633 # be in a merge or update state (eg. rebase, histedit, graft, etc).
634 # We want those to have priority.
634 # We want those to have priority.
635 ('merge', _mergepredicate, _mergemsg),
635 ('merge', _mergepredicate, _mergemsg),
636 )
636 )
637
637
638 def _getrepostate(repo):
638 def _getrepostate(repo):
639 # experimental config: commands.status.skipstates
639 # experimental config: commands.status.skipstates
640 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
640 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
641 for state, statedetectionpredicate, msgfn in STATES:
641 for state, statedetectionpredicate, msgfn in STATES:
642 if state in skip:
642 if state in skip:
643 continue
643 continue
644 if statedetectionpredicate(repo):
644 if statedetectionpredicate(repo):
645 return (state, statedetectionpredicate, msgfn)
645 return (state, statedetectionpredicate, msgfn)
646
646
647 def morestatus(repo, fm):
647 def morestatus(repo, fm):
648 statetuple = _getrepostate(repo)
648 statetuple = _getrepostate(repo)
649 label = 'status.morestatus'
649 label = 'status.morestatus'
650 if statetuple:
650 if statetuple:
651 fm.startitem()
651 fm.startitem()
652 state, statedetectionpredicate, helpfulmsg = statetuple
652 state, statedetectionpredicate, helpfulmsg = statetuple
653 statemsg = _('The repository is in an unfinished *%s* state.') % state
653 statemsg = _('The repository is in an unfinished *%s* state.') % state
654 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
654 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
655 conmsg = _conflictsmsg(repo)
655 conmsg = _conflictsmsg(repo)
656 if conmsg:
656 if conmsg:
657 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
657 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
658 if helpfulmsg:
658 if helpfulmsg:
659 helpmsg = helpfulmsg()
659 helpmsg = helpfulmsg()
660 fm.write('helpmsg', '%s\n', helpmsg, label=label)
660 fm.write('helpmsg', '%s\n', helpmsg, label=label)
661
661
662 def findpossible(cmd, table, strict=False):
662 def findpossible(cmd, table, strict=False):
663 """
663 """
664 Return cmd -> (aliases, command table entry)
664 Return cmd -> (aliases, command table entry)
665 for each matching command.
665 for each matching command.
666 Return debug commands (or their aliases) only if no normal command matches.
666 Return debug commands (or their aliases) only if no normal command matches.
667 """
667 """
668 choice = {}
668 choice = {}
669 debugchoice = {}
669 debugchoice = {}
670
670
671 if cmd in table:
671 if cmd in table:
672 # short-circuit exact matches, "log" alias beats "^log|history"
672 # short-circuit exact matches, "log" alias beats "^log|history"
673 keys = [cmd]
673 keys = [cmd]
674 else:
674 else:
675 keys = table.keys()
675 keys = table.keys()
676
676
677 allcmds = []
677 allcmds = []
678 for e in keys:
678 for e in keys:
679 aliases = parsealiases(e)
679 aliases = parsealiases(e)
680 allcmds.extend(aliases)
680 allcmds.extend(aliases)
681 found = None
681 found = None
682 if cmd in aliases:
682 if cmd in aliases:
683 found = cmd
683 found = cmd
684 elif not strict:
684 elif not strict:
685 for a in aliases:
685 for a in aliases:
686 if a.startswith(cmd):
686 if a.startswith(cmd):
687 found = a
687 found = a
688 break
688 break
689 if found is not None:
689 if found is not None:
690 if aliases[0].startswith("debug") or found.startswith("debug"):
690 if aliases[0].startswith("debug") or found.startswith("debug"):
691 debugchoice[found] = (aliases, table[e])
691 debugchoice[found] = (aliases, table[e])
692 else:
692 else:
693 choice[found] = (aliases, table[e])
693 choice[found] = (aliases, table[e])
694
694
695 if not choice and debugchoice:
695 if not choice and debugchoice:
696 choice = debugchoice
696 choice = debugchoice
697
697
698 return choice, allcmds
698 return choice, allcmds
699
699
700 def findcmd(cmd, table, strict=True):
700 def findcmd(cmd, table, strict=True):
701 """Return (aliases, command table entry) for command string."""
701 """Return (aliases, command table entry) for command string."""
702 choice, allcmds = findpossible(cmd, table, strict)
702 choice, allcmds = findpossible(cmd, table, strict)
703
703
704 if cmd in choice:
704 if cmd in choice:
705 return choice[cmd]
705 return choice[cmd]
706
706
707 if len(choice) > 1:
707 if len(choice) > 1:
708 clist = sorted(choice)
708 clist = sorted(choice)
709 raise error.AmbiguousCommand(cmd, clist)
709 raise error.AmbiguousCommand(cmd, clist)
710
710
711 if choice:
711 if choice:
712 return list(choice.values())[0]
712 return list(choice.values())[0]
713
713
714 raise error.UnknownCommand(cmd, allcmds)
714 raise error.UnknownCommand(cmd, allcmds)
715
715
716 def findrepo(p):
716 def findrepo(p):
717 while not os.path.isdir(os.path.join(p, ".hg")):
717 while not os.path.isdir(os.path.join(p, ".hg")):
718 oldp, p = p, os.path.dirname(p)
718 oldp, p = p, os.path.dirname(p)
719 if p == oldp:
719 if p == oldp:
720 return None
720 return None
721
721
722 return p
722 return p
723
723
724 def bailifchanged(repo, merge=True, hint=None):
724 def bailifchanged(repo, merge=True, hint=None):
725 """ enforce the precondition that working directory must be clean.
725 """ enforce the precondition that working directory must be clean.
726
726
727 'merge' can be set to false if a pending uncommitted merge should be
727 'merge' can be set to false if a pending uncommitted merge should be
728 ignored (such as when 'update --check' runs).
728 ignored (such as when 'update --check' runs).
729
729
730 'hint' is the usual hint given to Abort exception.
730 'hint' is the usual hint given to Abort exception.
731 """
731 """
732
732
733 if merge and repo.dirstate.p2() != nullid:
733 if merge and repo.dirstate.p2() != nullid:
734 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
734 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
735 modified, added, removed, deleted = repo.status()[:4]
735 modified, added, removed, deleted = repo.status()[:4]
736 if modified or added or removed or deleted:
736 if modified or added or removed or deleted:
737 raise error.Abort(_('uncommitted changes'), hint=hint)
737 raise error.Abort(_('uncommitted changes'), hint=hint)
738 ctx = repo[None]
738 ctx = repo[None]
739 for s in sorted(ctx.substate):
739 for s in sorted(ctx.substate):
740 ctx.sub(s).bailifchanged(hint=hint)
740 ctx.sub(s).bailifchanged(hint=hint)
741
741
742 def logmessage(ui, opts):
742 def logmessage(ui, opts):
743 """ get the log message according to -m and -l option """
743 """ get the log message according to -m and -l option """
744 message = opts.get('message')
744 message = opts.get('message')
745 logfile = opts.get('logfile')
745 logfile = opts.get('logfile')
746
746
747 if message and logfile:
747 if message and logfile:
748 raise error.Abort(_('options --message and --logfile are mutually '
748 raise error.Abort(_('options --message and --logfile are mutually '
749 'exclusive'))
749 'exclusive'))
750 if not message and logfile:
750 if not message and logfile:
751 try:
751 try:
752 if isstdiofilename(logfile):
752 if isstdiofilename(logfile):
753 message = ui.fin.read()
753 message = ui.fin.read()
754 else:
754 else:
755 message = '\n'.join(util.readfile(logfile).splitlines())
755 message = '\n'.join(util.readfile(logfile).splitlines())
756 except IOError as inst:
756 except IOError as inst:
757 raise error.Abort(_("can't read commit message '%s': %s") %
757 raise error.Abort(_("can't read commit message '%s': %s") %
758 (logfile, encoding.strtolocal(inst.strerror)))
758 (logfile, encoding.strtolocal(inst.strerror)))
759 return message
759 return message
760
760
761 def mergeeditform(ctxorbool, baseformname):
761 def mergeeditform(ctxorbool, baseformname):
762 """return appropriate editform name (referencing a committemplate)
762 """return appropriate editform name (referencing a committemplate)
763
763
764 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
764 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
765 merging is committed.
765 merging is committed.
766
766
767 This returns baseformname with '.merge' appended if it is a merge,
767 This returns baseformname with '.merge' appended if it is a merge,
768 otherwise '.normal' is appended.
768 otherwise '.normal' is appended.
769 """
769 """
770 if isinstance(ctxorbool, bool):
770 if isinstance(ctxorbool, bool):
771 if ctxorbool:
771 if ctxorbool:
772 return baseformname + ".merge"
772 return baseformname + ".merge"
773 elif 1 < len(ctxorbool.parents()):
773 elif 1 < len(ctxorbool.parents()):
774 return baseformname + ".merge"
774 return baseformname + ".merge"
775
775
776 return baseformname + ".normal"
776 return baseformname + ".normal"
777
777
778 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
778 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
779 editform='', **opts):
779 editform='', **opts):
780 """get appropriate commit message editor according to '--edit' option
780 """get appropriate commit message editor according to '--edit' option
781
781
782 'finishdesc' is a function to be called with edited commit message
782 'finishdesc' is a function to be called with edited commit message
783 (= 'description' of the new changeset) just after editing, but
783 (= 'description' of the new changeset) just after editing, but
784 before checking empty-ness. It should return actual text to be
784 before checking empty-ness. It should return actual text to be
785 stored into history. This allows to change description before
785 stored into history. This allows to change description before
786 storing.
786 storing.
787
787
788 'extramsg' is a extra message to be shown in the editor instead of
788 'extramsg' is a extra message to be shown in the editor instead of
789 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
789 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
790 is automatically added.
790 is automatically added.
791
791
792 'editform' is a dot-separated list of names, to distinguish
792 'editform' is a dot-separated list of names, to distinguish
793 the purpose of commit text editing.
793 the purpose of commit text editing.
794
794
795 'getcommiteditor' returns 'commitforceeditor' regardless of
795 'getcommiteditor' returns 'commitforceeditor' regardless of
796 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
796 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
797 they are specific for usage in MQ.
797 they are specific for usage in MQ.
798 """
798 """
799 if edit or finishdesc or extramsg:
799 if edit or finishdesc or extramsg:
800 return lambda r, c, s: commitforceeditor(r, c, s,
800 return lambda r, c, s: commitforceeditor(r, c, s,
801 finishdesc=finishdesc,
801 finishdesc=finishdesc,
802 extramsg=extramsg,
802 extramsg=extramsg,
803 editform=editform)
803 editform=editform)
804 elif editform:
804 elif editform:
805 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
805 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
806 else:
806 else:
807 return commiteditor
807 return commiteditor
808
808
809 def loglimit(opts):
809 def loglimit(opts):
810 """get the log limit according to option -l/--limit"""
810 """get the log limit according to option -l/--limit"""
811 limit = opts.get('limit')
811 limit = opts.get('limit')
812 if limit:
812 if limit:
813 try:
813 try:
814 limit = int(limit)
814 limit = int(limit)
815 except ValueError:
815 except ValueError:
816 raise error.Abort(_('limit must be a positive integer'))
816 raise error.Abort(_('limit must be a positive integer'))
817 if limit <= 0:
817 if limit <= 0:
818 raise error.Abort(_('limit must be positive'))
818 raise error.Abort(_('limit must be positive'))
819 else:
819 else:
820 limit = None
820 limit = None
821 return limit
821 return limit
822
822
823 def makefilename(repo, pat, node, desc=None,
823 def makefilename(repo, pat, node, desc=None,
824 total=None, seqno=None, revwidth=None, pathname=None):
824 total=None, seqno=None, revwidth=None, pathname=None):
825 node_expander = {
825 node_expander = {
826 'H': lambda: hex(node),
826 'H': lambda: hex(node),
827 'R': lambda: '%d' % repo.changelog.rev(node),
827 'R': lambda: '%d' % repo.changelog.rev(node),
828 'h': lambda: short(node),
828 'h': lambda: short(node),
829 'm': lambda: re.sub('[^\w]', '_', desc or '')
829 'm': lambda: re.sub('[^\w]', '_', desc or '')
830 }
830 }
831 expander = {
831 expander = {
832 '%': lambda: '%',
832 '%': lambda: '%',
833 'b': lambda: os.path.basename(repo.root),
833 'b': lambda: os.path.basename(repo.root),
834 }
834 }
835
835
836 try:
836 try:
837 if node:
837 if node:
838 expander.update(node_expander)
838 expander.update(node_expander)
839 if node:
839 if node:
840 expander['r'] = (lambda:
840 expander['r'] = (lambda:
841 ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
841 ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
842 if total is not None:
842 if total is not None:
843 expander['N'] = lambda: '%d' % total
843 expander['N'] = lambda: '%d' % total
844 if seqno is not None:
844 if seqno is not None:
845 expander['n'] = lambda: '%d' % seqno
845 expander['n'] = lambda: '%d' % seqno
846 if total is not None and seqno is not None:
846 if total is not None and seqno is not None:
847 expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
847 expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
848 if pathname is not None:
848 if pathname is not None:
849 expander['s'] = lambda: os.path.basename(pathname)
849 expander['s'] = lambda: os.path.basename(pathname)
850 expander['d'] = lambda: os.path.dirname(pathname) or '.'
850 expander['d'] = lambda: os.path.dirname(pathname) or '.'
851 expander['p'] = lambda: pathname
851 expander['p'] = lambda: pathname
852
852
853 newname = []
853 newname = []
854 patlen = len(pat)
854 patlen = len(pat)
855 i = 0
855 i = 0
856 while i < patlen:
856 while i < patlen:
857 c = pat[i:i + 1]
857 c = pat[i:i + 1]
858 if c == '%':
858 if c == '%':
859 i += 1
859 i += 1
860 c = pat[i:i + 1]
860 c = pat[i:i + 1]
861 c = expander[c]()
861 c = expander[c]()
862 newname.append(c)
862 newname.append(c)
863 i += 1
863 i += 1
864 return ''.join(newname)
864 return ''.join(newname)
865 except KeyError as inst:
865 except KeyError as inst:
866 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
866 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
867 inst.args[0])
867 inst.args[0])
868
868
869 def isstdiofilename(pat):
869 def isstdiofilename(pat):
870 """True if the given pat looks like a filename denoting stdin/stdout"""
870 """True if the given pat looks like a filename denoting stdin/stdout"""
871 return not pat or pat == '-'
871 return not pat or pat == '-'
872
872
873 class _unclosablefile(object):
873 class _unclosablefile(object):
874 def __init__(self, fp):
874 def __init__(self, fp):
875 self._fp = fp
875 self._fp = fp
876
876
877 def close(self):
877 def close(self):
878 pass
878 pass
879
879
880 def __iter__(self):
880 def __iter__(self):
881 return iter(self._fp)
881 return iter(self._fp)
882
882
883 def __getattr__(self, attr):
883 def __getattr__(self, attr):
884 return getattr(self._fp, attr)
884 return getattr(self._fp, attr)
885
885
886 def __enter__(self):
886 def __enter__(self):
887 return self
887 return self
888
888
889 def __exit__(self, exc_type, exc_value, exc_tb):
889 def __exit__(self, exc_type, exc_value, exc_tb):
890 pass
890 pass
891
891
892 def makefileobj(repo, pat, node=None, desc=None, total=None,
892 def makefileobj(repo, pat, node=None, desc=None, total=None,
893 seqno=None, revwidth=None, mode='wb', modemap=None,
893 seqno=None, revwidth=None, mode='wb', modemap=None,
894 pathname=None):
894 pathname=None):
895
895
896 writable = mode not in ('r', 'rb')
896 writable = mode not in ('r', 'rb')
897
897
898 if isstdiofilename(pat):
898 if isstdiofilename(pat):
899 if writable:
899 if writable:
900 fp = repo.ui.fout
900 fp = repo.ui.fout
901 else:
901 else:
902 fp = repo.ui.fin
902 fp = repo.ui.fin
903 return _unclosablefile(fp)
903 return _unclosablefile(fp)
904 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
904 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
905 if modemap is not None:
905 if modemap is not None:
906 mode = modemap.get(fn, mode)
906 mode = modemap.get(fn, mode)
907 if mode == 'wb':
907 if mode == 'wb':
908 modemap[fn] = 'ab'
908 modemap[fn] = 'ab'
909 return open(fn, mode)
909 return open(fn, mode)
910
910
911 def openrevlog(repo, cmd, file_, opts):
911 def openrevlog(repo, cmd, file_, opts):
912 """opens the changelog, manifest, a filelog or a given revlog"""
912 """opens the changelog, manifest, a filelog or a given revlog"""
913 cl = opts['changelog']
913 cl = opts['changelog']
914 mf = opts['manifest']
914 mf = opts['manifest']
915 dir = opts['dir']
915 dir = opts['dir']
916 msg = None
916 msg = None
917 if cl and mf:
917 if cl and mf:
918 msg = _('cannot specify --changelog and --manifest at the same time')
918 msg = _('cannot specify --changelog and --manifest at the same time')
919 elif cl and dir:
919 elif cl and dir:
920 msg = _('cannot specify --changelog and --dir at the same time')
920 msg = _('cannot specify --changelog and --dir at the same time')
921 elif cl or mf or dir:
921 elif cl or mf or dir:
922 if file_:
922 if file_:
923 msg = _('cannot specify filename with --changelog or --manifest')
923 msg = _('cannot specify filename with --changelog or --manifest')
924 elif not repo:
924 elif not repo:
925 msg = _('cannot specify --changelog or --manifest or --dir '
925 msg = _('cannot specify --changelog or --manifest or --dir '
926 'without a repository')
926 'without a repository')
927 if msg:
927 if msg:
928 raise error.Abort(msg)
928 raise error.Abort(msg)
929
929
930 r = None
930 r = None
931 if repo:
931 if repo:
932 if cl:
932 if cl:
933 r = repo.unfiltered().changelog
933 r = repo.unfiltered().changelog
934 elif dir:
934 elif dir:
935 if 'treemanifest' not in repo.requirements:
935 if 'treemanifest' not in repo.requirements:
936 raise error.Abort(_("--dir can only be used on repos with "
936 raise error.Abort(_("--dir can only be used on repos with "
937 "treemanifest enabled"))
937 "treemanifest enabled"))
938 dirlog = repo.manifestlog._revlog.dirlog(dir)
938 dirlog = repo.manifestlog._revlog.dirlog(dir)
939 if len(dirlog):
939 if len(dirlog):
940 r = dirlog
940 r = dirlog
941 elif mf:
941 elif mf:
942 r = repo.manifestlog._revlog
942 r = repo.manifestlog._revlog
943 elif file_:
943 elif file_:
944 filelog = repo.file(file_)
944 filelog = repo.file(file_)
945 if len(filelog):
945 if len(filelog):
946 r = filelog
946 r = filelog
947 if not r:
947 if not r:
948 if not file_:
948 if not file_:
949 raise error.CommandError(cmd, _('invalid arguments'))
949 raise error.CommandError(cmd, _('invalid arguments'))
950 if not os.path.isfile(file_):
950 if not os.path.isfile(file_):
951 raise error.Abort(_("revlog '%s' not found") % file_)
951 raise error.Abort(_("revlog '%s' not found") % file_)
952 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
952 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
953 file_[:-2] + ".i")
953 file_[:-2] + ".i")
954 return r
954 return r
955
955
956 def copy(ui, repo, pats, opts, rename=False):
956 def copy(ui, repo, pats, opts, rename=False):
957 # called with the repo lock held
957 # called with the repo lock held
958 #
958 #
959 # hgsep => pathname that uses "/" to separate directories
959 # hgsep => pathname that uses "/" to separate directories
960 # ossep => pathname that uses os.sep to separate directories
960 # ossep => pathname that uses os.sep to separate directories
961 cwd = repo.getcwd()
961 cwd = repo.getcwd()
962 targets = {}
962 targets = {}
963 after = opts.get("after")
963 after = opts.get("after")
964 dryrun = opts.get("dry_run")
964 dryrun = opts.get("dry_run")
965 wctx = repo[None]
965 wctx = repo[None]
966
966
967 def walkpat(pat):
967 def walkpat(pat):
968 srcs = []
968 srcs = []
969 if after:
969 if after:
970 badstates = '?'
970 badstates = '?'
971 else:
971 else:
972 badstates = '?r'
972 badstates = '?r'
973 m = scmutil.match(wctx, [pat], opts, globbed=True)
973 m = scmutil.match(wctx, [pat], opts, globbed=True)
974 for abs in wctx.walk(m):
974 for abs in wctx.walk(m):
975 state = repo.dirstate[abs]
975 state = repo.dirstate[abs]
976 rel = m.rel(abs)
976 rel = m.rel(abs)
977 exact = m.exact(abs)
977 exact = m.exact(abs)
978 if state in badstates:
978 if state in badstates:
979 if exact and state == '?':
979 if exact and state == '?':
980 ui.warn(_('%s: not copying - file is not managed\n') % rel)
980 ui.warn(_('%s: not copying - file is not managed\n') % rel)
981 if exact and state == 'r':
981 if exact and state == 'r':
982 ui.warn(_('%s: not copying - file has been marked for'
982 ui.warn(_('%s: not copying - file has been marked for'
983 ' remove\n') % rel)
983 ' remove\n') % rel)
984 continue
984 continue
985 # abs: hgsep
985 # abs: hgsep
986 # rel: ossep
986 # rel: ossep
987 srcs.append((abs, rel, exact))
987 srcs.append((abs, rel, exact))
988 return srcs
988 return srcs
989
989
990 # abssrc: hgsep
990 # abssrc: hgsep
991 # relsrc: ossep
991 # relsrc: ossep
992 # otarget: ossep
992 # otarget: ossep
993 def copyfile(abssrc, relsrc, otarget, exact):
993 def copyfile(abssrc, relsrc, otarget, exact):
994 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
994 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
995 if '/' in abstarget:
995 if '/' in abstarget:
996 # We cannot normalize abstarget itself, this would prevent
996 # We cannot normalize abstarget itself, this would prevent
997 # case only renames, like a => A.
997 # case only renames, like a => A.
998 abspath, absname = abstarget.rsplit('/', 1)
998 abspath, absname = abstarget.rsplit('/', 1)
999 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
999 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
1000 reltarget = repo.pathto(abstarget, cwd)
1000 reltarget = repo.pathto(abstarget, cwd)
1001 target = repo.wjoin(abstarget)
1001 target = repo.wjoin(abstarget)
1002 src = repo.wjoin(abssrc)
1002 src = repo.wjoin(abssrc)
1003 state = repo.dirstate[abstarget]
1003 state = repo.dirstate[abstarget]
1004
1004
1005 scmutil.checkportable(ui, abstarget)
1005 scmutil.checkportable(ui, abstarget)
1006
1006
1007 # check for collisions
1007 # check for collisions
1008 prevsrc = targets.get(abstarget)
1008 prevsrc = targets.get(abstarget)
1009 if prevsrc is not None:
1009 if prevsrc is not None:
1010 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1010 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1011 (reltarget, repo.pathto(abssrc, cwd),
1011 (reltarget, repo.pathto(abssrc, cwd),
1012 repo.pathto(prevsrc, cwd)))
1012 repo.pathto(prevsrc, cwd)))
1013 return
1013 return
1014
1014
1015 # check for overwrites
1015 # check for overwrites
1016 exists = os.path.lexists(target)
1016 exists = os.path.lexists(target)
1017 samefile = False
1017 samefile = False
1018 if exists and abssrc != abstarget:
1018 if exists and abssrc != abstarget:
1019 if (repo.dirstate.normalize(abssrc) ==
1019 if (repo.dirstate.normalize(abssrc) ==
1020 repo.dirstate.normalize(abstarget)):
1020 repo.dirstate.normalize(abstarget)):
1021 if not rename:
1021 if not rename:
1022 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1022 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1023 return
1023 return
1024 exists = False
1024 exists = False
1025 samefile = True
1025 samefile = True
1026
1026
1027 if not after and exists or after and state in 'mn':
1027 if not after and exists or after and state in 'mn':
1028 if not opts['force']:
1028 if not opts['force']:
1029 if state in 'mn':
1029 if state in 'mn':
1030 msg = _('%s: not overwriting - file already committed\n')
1030 msg = _('%s: not overwriting - file already committed\n')
1031 if after:
1031 if after:
1032 flags = '--after --force'
1032 flags = '--after --force'
1033 else:
1033 else:
1034 flags = '--force'
1034 flags = '--force'
1035 if rename:
1035 if rename:
1036 hint = _('(hg rename %s to replace the file by '
1036 hint = _('(hg rename %s to replace the file by '
1037 'recording a rename)\n') % flags
1037 'recording a rename)\n') % flags
1038 else:
1038 else:
1039 hint = _('(hg copy %s to replace the file by '
1039 hint = _('(hg copy %s to replace the file by '
1040 'recording a copy)\n') % flags
1040 'recording a copy)\n') % flags
1041 else:
1041 else:
1042 msg = _('%s: not overwriting - file exists\n')
1042 msg = _('%s: not overwriting - file exists\n')
1043 if rename:
1043 if rename:
1044 hint = _('(hg rename --after to record the rename)\n')
1044 hint = _('(hg rename --after to record the rename)\n')
1045 else:
1045 else:
1046 hint = _('(hg copy --after to record the copy)\n')
1046 hint = _('(hg copy --after to record the copy)\n')
1047 ui.warn(msg % reltarget)
1047 ui.warn(msg % reltarget)
1048 ui.warn(hint)
1048 ui.warn(hint)
1049 return
1049 return
1050
1050
1051 if after:
1051 if after:
1052 if not exists:
1052 if not exists:
1053 if rename:
1053 if rename:
1054 ui.warn(_('%s: not recording move - %s does not exist\n') %
1054 ui.warn(_('%s: not recording move - %s does not exist\n') %
1055 (relsrc, reltarget))
1055 (relsrc, reltarget))
1056 else:
1056 else:
1057 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1057 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1058 (relsrc, reltarget))
1058 (relsrc, reltarget))
1059 return
1059 return
1060 elif not dryrun:
1060 elif not dryrun:
1061 try:
1061 try:
1062 if exists:
1062 if exists:
1063 os.unlink(target)
1063 os.unlink(target)
1064 targetdir = os.path.dirname(target) or '.'
1064 targetdir = os.path.dirname(target) or '.'
1065 if not os.path.isdir(targetdir):
1065 if not os.path.isdir(targetdir):
1066 os.makedirs(targetdir)
1066 os.makedirs(targetdir)
1067 if samefile:
1067 if samefile:
1068 tmp = target + "~hgrename"
1068 tmp = target + "~hgrename"
1069 os.rename(src, tmp)
1069 os.rename(src, tmp)
1070 os.rename(tmp, target)
1070 os.rename(tmp, target)
1071 else:
1071 else:
1072 util.copyfile(src, target)
1072 util.copyfile(src, target)
1073 srcexists = True
1073 srcexists = True
1074 except IOError as inst:
1074 except IOError as inst:
1075 if inst.errno == errno.ENOENT:
1075 if inst.errno == errno.ENOENT:
1076 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1076 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1077 srcexists = False
1077 srcexists = False
1078 else:
1078 else:
1079 ui.warn(_('%s: cannot copy - %s\n') %
1079 ui.warn(_('%s: cannot copy - %s\n') %
1080 (relsrc, encoding.strtolocal(inst.strerror)))
1080 (relsrc, encoding.strtolocal(inst.strerror)))
1081 return True # report a failure
1081 return True # report a failure
1082
1082
1083 if ui.verbose or not exact:
1083 if ui.verbose or not exact:
1084 if rename:
1084 if rename:
1085 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1085 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1086 else:
1086 else:
1087 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1087 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1088
1088
1089 targets[abstarget] = abssrc
1089 targets[abstarget] = abssrc
1090
1090
1091 # fix up dirstate
1091 # fix up dirstate
1092 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1092 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1093 dryrun=dryrun, cwd=cwd)
1093 dryrun=dryrun, cwd=cwd)
1094 if rename and not dryrun:
1094 if rename and not dryrun:
1095 if not after and srcexists and not samefile:
1095 if not after and srcexists and not samefile:
1096 repo.wvfs.unlinkpath(abssrc)
1096 repo.wvfs.unlinkpath(abssrc)
1097 wctx.forget([abssrc])
1097 wctx.forget([abssrc])
1098
1098
1099 # pat: ossep
1099 # pat: ossep
1100 # dest ossep
1100 # dest ossep
1101 # srcs: list of (hgsep, hgsep, ossep, bool)
1101 # srcs: list of (hgsep, hgsep, ossep, bool)
1102 # return: function that takes hgsep and returns ossep
1102 # return: function that takes hgsep and returns ossep
1103 def targetpathfn(pat, dest, srcs):
1103 def targetpathfn(pat, dest, srcs):
1104 if os.path.isdir(pat):
1104 if os.path.isdir(pat):
1105 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1105 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1106 abspfx = util.localpath(abspfx)
1106 abspfx = util.localpath(abspfx)
1107 if destdirexists:
1107 if destdirexists:
1108 striplen = len(os.path.split(abspfx)[0])
1108 striplen = len(os.path.split(abspfx)[0])
1109 else:
1109 else:
1110 striplen = len(abspfx)
1110 striplen = len(abspfx)
1111 if striplen:
1111 if striplen:
1112 striplen += len(pycompat.ossep)
1112 striplen += len(pycompat.ossep)
1113 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1113 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1114 elif destdirexists:
1114 elif destdirexists:
1115 res = lambda p: os.path.join(dest,
1115 res = lambda p: os.path.join(dest,
1116 os.path.basename(util.localpath(p)))
1116 os.path.basename(util.localpath(p)))
1117 else:
1117 else:
1118 res = lambda p: dest
1118 res = lambda p: dest
1119 return res
1119 return res
1120
1120
1121 # pat: ossep
1121 # pat: ossep
1122 # dest ossep
1122 # dest ossep
1123 # srcs: list of (hgsep, hgsep, ossep, bool)
1123 # srcs: list of (hgsep, hgsep, ossep, bool)
1124 # return: function that takes hgsep and returns ossep
1124 # return: function that takes hgsep and returns ossep
1125 def targetpathafterfn(pat, dest, srcs):
1125 def targetpathafterfn(pat, dest, srcs):
1126 if matchmod.patkind(pat):
1126 if matchmod.patkind(pat):
1127 # a mercurial pattern
1127 # a mercurial pattern
1128 res = lambda p: os.path.join(dest,
1128 res = lambda p: os.path.join(dest,
1129 os.path.basename(util.localpath(p)))
1129 os.path.basename(util.localpath(p)))
1130 else:
1130 else:
1131 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1131 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1132 if len(abspfx) < len(srcs[0][0]):
1132 if len(abspfx) < len(srcs[0][0]):
1133 # A directory. Either the target path contains the last
1133 # A directory. Either the target path contains the last
1134 # component of the source path or it does not.
1134 # component of the source path or it does not.
1135 def evalpath(striplen):
1135 def evalpath(striplen):
1136 score = 0
1136 score = 0
1137 for s in srcs:
1137 for s in srcs:
1138 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1138 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1139 if os.path.lexists(t):
1139 if os.path.lexists(t):
1140 score += 1
1140 score += 1
1141 return score
1141 return score
1142
1142
1143 abspfx = util.localpath(abspfx)
1143 abspfx = util.localpath(abspfx)
1144 striplen = len(abspfx)
1144 striplen = len(abspfx)
1145 if striplen:
1145 if striplen:
1146 striplen += len(pycompat.ossep)
1146 striplen += len(pycompat.ossep)
1147 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1147 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1148 score = evalpath(striplen)
1148 score = evalpath(striplen)
1149 striplen1 = len(os.path.split(abspfx)[0])
1149 striplen1 = len(os.path.split(abspfx)[0])
1150 if striplen1:
1150 if striplen1:
1151 striplen1 += len(pycompat.ossep)
1151 striplen1 += len(pycompat.ossep)
1152 if evalpath(striplen1) > score:
1152 if evalpath(striplen1) > score:
1153 striplen = striplen1
1153 striplen = striplen1
1154 res = lambda p: os.path.join(dest,
1154 res = lambda p: os.path.join(dest,
1155 util.localpath(p)[striplen:])
1155 util.localpath(p)[striplen:])
1156 else:
1156 else:
1157 # a file
1157 # a file
1158 if destdirexists:
1158 if destdirexists:
1159 res = lambda p: os.path.join(dest,
1159 res = lambda p: os.path.join(dest,
1160 os.path.basename(util.localpath(p)))
1160 os.path.basename(util.localpath(p)))
1161 else:
1161 else:
1162 res = lambda p: dest
1162 res = lambda p: dest
1163 return res
1163 return res
1164
1164
1165 pats = scmutil.expandpats(pats)
1165 pats = scmutil.expandpats(pats)
1166 if not pats:
1166 if not pats:
1167 raise error.Abort(_('no source or destination specified'))
1167 raise error.Abort(_('no source or destination specified'))
1168 if len(pats) == 1:
1168 if len(pats) == 1:
1169 raise error.Abort(_('no destination specified'))
1169 raise error.Abort(_('no destination specified'))
1170 dest = pats.pop()
1170 dest = pats.pop()
1171 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1171 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1172 if not destdirexists:
1172 if not destdirexists:
1173 if len(pats) > 1 or matchmod.patkind(pats[0]):
1173 if len(pats) > 1 or matchmod.patkind(pats[0]):
1174 raise error.Abort(_('with multiple sources, destination must be an '
1174 raise error.Abort(_('with multiple sources, destination must be an '
1175 'existing directory'))
1175 'existing directory'))
1176 if util.endswithsep(dest):
1176 if util.endswithsep(dest):
1177 raise error.Abort(_('destination %s is not a directory') % dest)
1177 raise error.Abort(_('destination %s is not a directory') % dest)
1178
1178
1179 tfn = targetpathfn
1179 tfn = targetpathfn
1180 if after:
1180 if after:
1181 tfn = targetpathafterfn
1181 tfn = targetpathafterfn
1182 copylist = []
1182 copylist = []
1183 for pat in pats:
1183 for pat in pats:
1184 srcs = walkpat(pat)
1184 srcs = walkpat(pat)
1185 if not srcs:
1185 if not srcs:
1186 continue
1186 continue
1187 copylist.append((tfn(pat, dest, srcs), srcs))
1187 copylist.append((tfn(pat, dest, srcs), srcs))
1188 if not copylist:
1188 if not copylist:
1189 raise error.Abort(_('no files to copy'))
1189 raise error.Abort(_('no files to copy'))
1190
1190
1191 errors = 0
1191 errors = 0
1192 for targetpath, srcs in copylist:
1192 for targetpath, srcs in copylist:
1193 for abssrc, relsrc, exact in srcs:
1193 for abssrc, relsrc, exact in srcs:
1194 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1194 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1195 errors += 1
1195 errors += 1
1196
1196
1197 if errors:
1197 if errors:
1198 ui.warn(_('(consider using --after)\n'))
1198 ui.warn(_('(consider using --after)\n'))
1199
1199
1200 return errors != 0
1200 return errors != 0
1201
1201
1202 ## facility to let extension process additional data into an import patch
1202 ## facility to let extension process additional data into an import patch
1203 # list of identifier to be executed in order
1203 # list of identifier to be executed in order
1204 extrapreimport = [] # run before commit
1204 extrapreimport = [] # run before commit
1205 extrapostimport = [] # run after commit
1205 extrapostimport = [] # run after commit
1206 # mapping from identifier to actual import function
1206 # mapping from identifier to actual import function
1207 #
1207 #
1208 # 'preimport' are run before the commit is made and are provided the following
1208 # 'preimport' are run before the commit is made and are provided the following
1209 # arguments:
1209 # arguments:
1210 # - repo: the localrepository instance,
1210 # - repo: the localrepository instance,
1211 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1211 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1212 # - extra: the future extra dictionary of the changeset, please mutate it,
1212 # - extra: the future extra dictionary of the changeset, please mutate it,
1213 # - opts: the import options.
1213 # - opts: the import options.
1214 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1214 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1215 # mutation of in memory commit and more. Feel free to rework the code to get
1215 # mutation of in memory commit and more. Feel free to rework the code to get
1216 # there.
1216 # there.
1217 extrapreimportmap = {}
1217 extrapreimportmap = {}
1218 # 'postimport' are run after the commit is made and are provided the following
1218 # 'postimport' are run after the commit is made and are provided the following
1219 # argument:
1219 # argument:
1220 # - ctx: the changectx created by import.
1220 # - ctx: the changectx created by import.
1221 extrapostimportmap = {}
1221 extrapostimportmap = {}
1222
1222
1223 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1223 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1224 """Utility function used by commands.import to import a single patch
1224 """Utility function used by commands.import to import a single patch
1225
1225
1226 This function is explicitly defined here to help the evolve extension to
1226 This function is explicitly defined here to help the evolve extension to
1227 wrap this part of the import logic.
1227 wrap this part of the import logic.
1228
1228
1229 The API is currently a bit ugly because it a simple code translation from
1229 The API is currently a bit ugly because it a simple code translation from
1230 the import command. Feel free to make it better.
1230 the import command. Feel free to make it better.
1231
1231
1232 :hunk: a patch (as a binary string)
1232 :hunk: a patch (as a binary string)
1233 :parents: nodes that will be parent of the created commit
1233 :parents: nodes that will be parent of the created commit
1234 :opts: the full dict of option passed to the import command
1234 :opts: the full dict of option passed to the import command
1235 :msgs: list to save commit message to.
1235 :msgs: list to save commit message to.
1236 (used in case we need to save it when failing)
1236 (used in case we need to save it when failing)
1237 :updatefunc: a function that update a repo to a given node
1237 :updatefunc: a function that update a repo to a given node
1238 updatefunc(<repo>, <node>)
1238 updatefunc(<repo>, <node>)
1239 """
1239 """
1240 # avoid cycle context -> subrepo -> cmdutil
1240 # avoid cycle context -> subrepo -> cmdutil
1241 from . import context
1241 from . import context
1242 extractdata = patch.extract(ui, hunk)
1242 extractdata = patch.extract(ui, hunk)
1243 tmpname = extractdata.get('filename')
1243 tmpname = extractdata.get('filename')
1244 message = extractdata.get('message')
1244 message = extractdata.get('message')
1245 user = opts.get('user') or extractdata.get('user')
1245 user = opts.get('user') or extractdata.get('user')
1246 date = opts.get('date') or extractdata.get('date')
1246 date = opts.get('date') or extractdata.get('date')
1247 branch = extractdata.get('branch')
1247 branch = extractdata.get('branch')
1248 nodeid = extractdata.get('nodeid')
1248 nodeid = extractdata.get('nodeid')
1249 p1 = extractdata.get('p1')
1249 p1 = extractdata.get('p1')
1250 p2 = extractdata.get('p2')
1250 p2 = extractdata.get('p2')
1251
1251
1252 nocommit = opts.get('no_commit')
1252 nocommit = opts.get('no_commit')
1253 importbranch = opts.get('import_branch')
1253 importbranch = opts.get('import_branch')
1254 update = not opts.get('bypass')
1254 update = not opts.get('bypass')
1255 strip = opts["strip"]
1255 strip = opts["strip"]
1256 prefix = opts["prefix"]
1256 prefix = opts["prefix"]
1257 sim = float(opts.get('similarity') or 0)
1257 sim = float(opts.get('similarity') or 0)
1258 if not tmpname:
1258 if not tmpname:
1259 return (None, None, False)
1259 return (None, None, False)
1260
1260
1261 rejects = False
1261 rejects = False
1262
1262
1263 try:
1263 try:
1264 cmdline_message = logmessage(ui, opts)
1264 cmdline_message = logmessage(ui, opts)
1265 if cmdline_message:
1265 if cmdline_message:
1266 # pickup the cmdline msg
1266 # pickup the cmdline msg
1267 message = cmdline_message
1267 message = cmdline_message
1268 elif message:
1268 elif message:
1269 # pickup the patch msg
1269 # pickup the patch msg
1270 message = message.strip()
1270 message = message.strip()
1271 else:
1271 else:
1272 # launch the editor
1272 # launch the editor
1273 message = None
1273 message = None
1274 ui.debug('message:\n%s\n' % message)
1274 ui.debug('message:\n%s\n' % message)
1275
1275
1276 if len(parents) == 1:
1276 if len(parents) == 1:
1277 parents.append(repo[nullid])
1277 parents.append(repo[nullid])
1278 if opts.get('exact'):
1278 if opts.get('exact'):
1279 if not nodeid or not p1:
1279 if not nodeid or not p1:
1280 raise error.Abort(_('not a Mercurial patch'))
1280 raise error.Abort(_('not a Mercurial patch'))
1281 p1 = repo[p1]
1281 p1 = repo[p1]
1282 p2 = repo[p2 or nullid]
1282 p2 = repo[p2 or nullid]
1283 elif p2:
1283 elif p2:
1284 try:
1284 try:
1285 p1 = repo[p1]
1285 p1 = repo[p1]
1286 p2 = repo[p2]
1286 p2 = repo[p2]
1287 # Without any options, consider p2 only if the
1287 # Without any options, consider p2 only if the
1288 # patch is being applied on top of the recorded
1288 # patch is being applied on top of the recorded
1289 # first parent.
1289 # first parent.
1290 if p1 != parents[0]:
1290 if p1 != parents[0]:
1291 p1 = parents[0]
1291 p1 = parents[0]
1292 p2 = repo[nullid]
1292 p2 = repo[nullid]
1293 except error.RepoError:
1293 except error.RepoError:
1294 p1, p2 = parents
1294 p1, p2 = parents
1295 if p2.node() == nullid:
1295 if p2.node() == nullid:
1296 ui.warn(_("warning: import the patch as a normal revision\n"
1296 ui.warn(_("warning: import the patch as a normal revision\n"
1297 "(use --exact to import the patch as a merge)\n"))
1297 "(use --exact to import the patch as a merge)\n"))
1298 else:
1298 else:
1299 p1, p2 = parents
1299 p1, p2 = parents
1300
1300
1301 n = None
1301 n = None
1302 if update:
1302 if update:
1303 if p1 != parents[0]:
1303 if p1 != parents[0]:
1304 updatefunc(repo, p1.node())
1304 updatefunc(repo, p1.node())
1305 if p2 != parents[1]:
1305 if p2 != parents[1]:
1306 repo.setparents(p1.node(), p2.node())
1306 repo.setparents(p1.node(), p2.node())
1307
1307
1308 if opts.get('exact') or importbranch:
1308 if opts.get('exact') or importbranch:
1309 repo.dirstate.setbranch(branch or 'default')
1309 repo.dirstate.setbranch(branch or 'default')
1310
1310
1311 partial = opts.get('partial', False)
1311 partial = opts.get('partial', False)
1312 files = set()
1312 files = set()
1313 try:
1313 try:
1314 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1314 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1315 files=files, eolmode=None, similarity=sim / 100.0)
1315 files=files, eolmode=None, similarity=sim / 100.0)
1316 except error.PatchError as e:
1316 except error.PatchError as e:
1317 if not partial:
1317 if not partial:
1318 raise error.Abort(str(e))
1318 raise error.Abort(str(e))
1319 if partial:
1319 if partial:
1320 rejects = True
1320 rejects = True
1321
1321
1322 files = list(files)
1322 files = list(files)
1323 if nocommit:
1323 if nocommit:
1324 if message:
1324 if message:
1325 msgs.append(message)
1325 msgs.append(message)
1326 else:
1326 else:
1327 if opts.get('exact') or p2:
1327 if opts.get('exact') or p2:
1328 # If you got here, you either use --force and know what
1328 # If you got here, you either use --force and know what
1329 # you are doing or used --exact or a merge patch while
1329 # you are doing or used --exact or a merge patch while
1330 # being updated to its first parent.
1330 # being updated to its first parent.
1331 m = None
1331 m = None
1332 else:
1332 else:
1333 m = scmutil.matchfiles(repo, files or [])
1333 m = scmutil.matchfiles(repo, files or [])
1334 editform = mergeeditform(repo[None], 'import.normal')
1334 editform = mergeeditform(repo[None], 'import.normal')
1335 if opts.get('exact'):
1335 if opts.get('exact'):
1336 editor = None
1336 editor = None
1337 else:
1337 else:
1338 editor = getcommiteditor(editform=editform,
1338 editor = getcommiteditor(editform=editform,
1339 **pycompat.strkwargs(opts))
1339 **pycompat.strkwargs(opts))
1340 extra = {}
1340 extra = {}
1341 for idfunc in extrapreimport:
1341 for idfunc in extrapreimport:
1342 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1342 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1343 overrides = {}
1343 overrides = {}
1344 if partial:
1344 if partial:
1345 overrides[('ui', 'allowemptycommit')] = True
1345 overrides[('ui', 'allowemptycommit')] = True
1346 with repo.ui.configoverride(overrides, 'import'):
1346 with repo.ui.configoverride(overrides, 'import'):
1347 n = repo.commit(message, user,
1347 n = repo.commit(message, user,
1348 date, match=m,
1348 date, match=m,
1349 editor=editor, extra=extra)
1349 editor=editor, extra=extra)
1350 for idfunc in extrapostimport:
1350 for idfunc in extrapostimport:
1351 extrapostimportmap[idfunc](repo[n])
1351 extrapostimportmap[idfunc](repo[n])
1352 else:
1352 else:
1353 if opts.get('exact') or importbranch:
1353 if opts.get('exact') or importbranch:
1354 branch = branch or 'default'
1354 branch = branch or 'default'
1355 else:
1355 else:
1356 branch = p1.branch()
1356 branch = p1.branch()
1357 store = patch.filestore()
1357 store = patch.filestore()
1358 try:
1358 try:
1359 files = set()
1359 files = set()
1360 try:
1360 try:
1361 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1361 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1362 files, eolmode=None)
1362 files, eolmode=None)
1363 except error.PatchError as e:
1363 except error.PatchError as e:
1364 raise error.Abort(str(e))
1364 raise error.Abort(str(e))
1365 if opts.get('exact'):
1365 if opts.get('exact'):
1366 editor = None
1366 editor = None
1367 else:
1367 else:
1368 editor = getcommiteditor(editform='import.bypass')
1368 editor = getcommiteditor(editform='import.bypass')
1369 memctx = context.memctx(repo, (p1.node(), p2.node()),
1369 memctx = context.memctx(repo, (p1.node(), p2.node()),
1370 message,
1370 message,
1371 files=files,
1371 files=files,
1372 filectxfn=store,
1372 filectxfn=store,
1373 user=user,
1373 user=user,
1374 date=date,
1374 date=date,
1375 branch=branch,
1375 branch=branch,
1376 editor=editor)
1376 editor=editor)
1377 n = memctx.commit()
1377 n = memctx.commit()
1378 finally:
1378 finally:
1379 store.close()
1379 store.close()
1380 if opts.get('exact') and nocommit:
1380 if opts.get('exact') and nocommit:
1381 # --exact with --no-commit is still useful in that it does merge
1381 # --exact with --no-commit is still useful in that it does merge
1382 # and branch bits
1382 # and branch bits
1383 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1383 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1384 elif opts.get('exact') and hex(n) != nodeid:
1384 elif opts.get('exact') and hex(n) != nodeid:
1385 raise error.Abort(_('patch is damaged or loses information'))
1385 raise error.Abort(_('patch is damaged or loses information'))
1386 msg = _('applied to working directory')
1386 msg = _('applied to working directory')
1387 if n:
1387 if n:
1388 # i18n: refers to a short changeset id
1388 # i18n: refers to a short changeset id
1389 msg = _('created %s') % short(n)
1389 msg = _('created %s') % short(n)
1390 return (msg, n, rejects)
1390 return (msg, n, rejects)
1391 finally:
1391 finally:
1392 os.unlink(tmpname)
1392 os.unlink(tmpname)
1393
1393
1394 # facility to let extensions include additional data in an exported patch
1394 # facility to let extensions include additional data in an exported patch
1395 # list of identifiers to be executed in order
1395 # list of identifiers to be executed in order
1396 extraexport = []
1396 extraexport = []
1397 # mapping from identifier to actual export function
1397 # mapping from identifier to actual export function
1398 # function as to return a string to be added to the header or None
1398 # function as to return a string to be added to the header or None
1399 # it is given two arguments (sequencenumber, changectx)
1399 # it is given two arguments (sequencenumber, changectx)
1400 extraexportmap = {}
1400 extraexportmap = {}
1401
1401
1402 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1402 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1403 node = scmutil.binnode(ctx)
1403 node = scmutil.binnode(ctx)
1404 parents = [p.node() for p in ctx.parents() if p]
1404 parents = [p.node() for p in ctx.parents() if p]
1405 branch = ctx.branch()
1405 branch = ctx.branch()
1406 if switch_parent:
1406 if switch_parent:
1407 parents.reverse()
1407 parents.reverse()
1408
1408
1409 if parents:
1409 if parents:
1410 prev = parents[0]
1410 prev = parents[0]
1411 else:
1411 else:
1412 prev = nullid
1412 prev = nullid
1413
1413
1414 write("# HG changeset patch\n")
1414 write("# HG changeset patch\n")
1415 write("# User %s\n" % ctx.user())
1415 write("# User %s\n" % ctx.user())
1416 write("# Date %d %d\n" % ctx.date())
1416 write("# Date %d %d\n" % ctx.date())
1417 write("# %s\n" % util.datestr(ctx.date()))
1417 write("# %s\n" % util.datestr(ctx.date()))
1418 if branch and branch != 'default':
1418 if branch and branch != 'default':
1419 write("# Branch %s\n" % branch)
1419 write("# Branch %s\n" % branch)
1420 write("# Node ID %s\n" % hex(node))
1420 write("# Node ID %s\n" % hex(node))
1421 write("# Parent %s\n" % hex(prev))
1421 write("# Parent %s\n" % hex(prev))
1422 if len(parents) > 1:
1422 if len(parents) > 1:
1423 write("# Parent %s\n" % hex(parents[1]))
1423 write("# Parent %s\n" % hex(parents[1]))
1424
1424
1425 for headerid in extraexport:
1425 for headerid in extraexport:
1426 header = extraexportmap[headerid](seqno, ctx)
1426 header = extraexportmap[headerid](seqno, ctx)
1427 if header is not None:
1427 if header is not None:
1428 write('# %s\n' % header)
1428 write('# %s\n' % header)
1429 write(ctx.description().rstrip())
1429 write(ctx.description().rstrip())
1430 write("\n\n")
1430 write("\n\n")
1431
1431
1432 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1432 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1433 write(chunk, label=label)
1433 write(chunk, label=label)
1434
1434
1435 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1435 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1436 opts=None, match=None):
1436 opts=None, match=None):
1437 '''export changesets as hg patches
1437 '''export changesets as hg patches
1438
1438
1439 Args:
1439 Args:
1440 repo: The repository from which we're exporting revisions.
1440 repo: The repository from which we're exporting revisions.
1441 revs: A list of revisions to export as revision numbers.
1441 revs: A list of revisions to export as revision numbers.
1442 fntemplate: An optional string to use for generating patch file names.
1442 fntemplate: An optional string to use for generating patch file names.
1443 fp: An optional file-like object to which patches should be written.
1443 fp: An optional file-like object to which patches should be written.
1444 switch_parent: If True, show diffs against second parent when not nullid.
1444 switch_parent: If True, show diffs against second parent when not nullid.
1445 Default is false, which always shows diff against p1.
1445 Default is false, which always shows diff against p1.
1446 opts: diff options to use for generating the patch.
1446 opts: diff options to use for generating the patch.
1447 match: If specified, only export changes to files matching this matcher.
1447 match: If specified, only export changes to files matching this matcher.
1448
1448
1449 Returns:
1449 Returns:
1450 Nothing.
1450 Nothing.
1451
1451
1452 Side Effect:
1452 Side Effect:
1453 "HG Changeset Patch" data is emitted to one of the following
1453 "HG Changeset Patch" data is emitted to one of the following
1454 destinations:
1454 destinations:
1455 fp is specified: All revs are written to the specified
1455 fp is specified: All revs are written to the specified
1456 file-like object.
1456 file-like object.
1457 fntemplate specified: Each rev is written to a unique file named using
1457 fntemplate specified: Each rev is written to a unique file named using
1458 the given template.
1458 the given template.
1459 Neither fp nor template specified: All revs written to repo.ui.write()
1459 Neither fp nor template specified: All revs written to repo.ui.write()
1460 '''
1460 '''
1461
1461
1462 total = len(revs)
1462 total = len(revs)
1463 revwidth = max(len(str(rev)) for rev in revs)
1463 revwidth = max(len(str(rev)) for rev in revs)
1464 filemode = {}
1464 filemode = {}
1465
1465
1466 write = None
1466 write = None
1467 dest = '<unnamed>'
1467 dest = '<unnamed>'
1468 if fp:
1468 if fp:
1469 dest = getattr(fp, 'name', dest)
1469 dest = getattr(fp, 'name', dest)
1470 def write(s, **kw):
1470 def write(s, **kw):
1471 fp.write(s)
1471 fp.write(s)
1472 elif not fntemplate:
1472 elif not fntemplate:
1473 write = repo.ui.write
1473 write = repo.ui.write
1474
1474
1475 for seqno, rev in enumerate(revs, 1):
1475 for seqno, rev in enumerate(revs, 1):
1476 ctx = repo[rev]
1476 ctx = repo[rev]
1477 fo = None
1477 fo = None
1478 if not fp and fntemplate:
1478 if not fp and fntemplate:
1479 desc_lines = ctx.description().rstrip().split('\n')
1479 desc_lines = ctx.description().rstrip().split('\n')
1480 desc = desc_lines[0] #Commit always has a first line.
1480 desc = desc_lines[0] #Commit always has a first line.
1481 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1481 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1482 total=total, seqno=seqno, revwidth=revwidth,
1482 total=total, seqno=seqno, revwidth=revwidth,
1483 mode='wb', modemap=filemode)
1483 mode='wb', modemap=filemode)
1484 dest = fo.name
1484 dest = fo.name
1485 def write(s, **kw):
1485 def write(s, **kw):
1486 fo.write(s)
1486 fo.write(s)
1487 if not dest.startswith('<'):
1487 if not dest.startswith('<'):
1488 repo.ui.note("%s\n" % dest)
1488 repo.ui.note("%s\n" % dest)
1489 _exportsingle(
1489 _exportsingle(
1490 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1490 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1491 if fo is not None:
1491 if fo is not None:
1492 fo.close()
1492 fo.close()
1493
1493
1494 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1494 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1495 changes=None, stat=False, fp=None, prefix='',
1495 changes=None, stat=False, fp=None, prefix='',
1496 root='', listsubrepos=False, hunksfilterfn=None):
1496 root='', listsubrepos=False, hunksfilterfn=None):
1497 '''show diff or diffstat.'''
1497 '''show diff or diffstat.'''
1498 if fp is None:
1498 if fp is None:
1499 write = ui.write
1499 write = ui.write
1500 else:
1500 else:
1501 def write(s, **kw):
1501 def write(s, **kw):
1502 fp.write(s)
1502 fp.write(s)
1503
1503
1504 if root:
1504 if root:
1505 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1505 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1506 else:
1506 else:
1507 relroot = ''
1507 relroot = ''
1508 if relroot != '':
1508 if relroot != '':
1509 # XXX relative roots currently don't work if the root is within a
1509 # XXX relative roots currently don't work if the root is within a
1510 # subrepo
1510 # subrepo
1511 uirelroot = match.uipath(relroot)
1511 uirelroot = match.uipath(relroot)
1512 relroot += '/'
1512 relroot += '/'
1513 for matchroot in match.files():
1513 for matchroot in match.files():
1514 if not matchroot.startswith(relroot):
1514 if not matchroot.startswith(relroot):
1515 ui.warn(_('warning: %s not inside relative root %s\n') % (
1515 ui.warn(_('warning: %s not inside relative root %s\n') % (
1516 match.uipath(matchroot), uirelroot))
1516 match.uipath(matchroot), uirelroot))
1517
1517
1518 if stat:
1518 if stat:
1519 diffopts = diffopts.copy(context=0, noprefix=False)
1519 diffopts = diffopts.copy(context=0, noprefix=False)
1520 width = 80
1520 width = 80
1521 if not ui.plain():
1521 if not ui.plain():
1522 width = ui.termwidth()
1522 width = ui.termwidth()
1523 chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
1523 chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
1524 prefix=prefix, relroot=relroot,
1524 prefix=prefix, relroot=relroot,
1525 hunksfilterfn=hunksfilterfn)
1525 hunksfilterfn=hunksfilterfn)
1526 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1526 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1527 width=width):
1527 width=width):
1528 write(chunk, label=label)
1528 write(chunk, label=label)
1529 else:
1529 else:
1530 for chunk, label in patch.diffui(repo, node1, node2, match,
1530 for chunk, label in patch.diffui(repo, node1, node2, match,
1531 changes, opts=diffopts, prefix=prefix,
1531 changes, opts=diffopts, prefix=prefix,
1532 relroot=relroot,
1532 relroot=relroot,
1533 hunksfilterfn=hunksfilterfn):
1533 hunksfilterfn=hunksfilterfn):
1534 write(chunk, label=label)
1534 write(chunk, label=label)
1535
1535
1536 if listsubrepos:
1536 if listsubrepos:
1537 ctx1 = repo[node1]
1537 ctx1 = repo[node1]
1538 ctx2 = repo[node2]
1538 ctx2 = repo[node2]
1539 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1539 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1540 tempnode2 = node2
1540 tempnode2 = node2
1541 try:
1541 try:
1542 if node2 is not None:
1542 if node2 is not None:
1543 tempnode2 = ctx2.substate[subpath][1]
1543 tempnode2 = ctx2.substate[subpath][1]
1544 except KeyError:
1544 except KeyError:
1545 # A subrepo that existed in node1 was deleted between node1 and
1545 # A subrepo that existed in node1 was deleted between node1 and
1546 # node2 (inclusive). Thus, ctx2's substate won't contain that
1546 # node2 (inclusive). Thus, ctx2's substate won't contain that
1547 # subpath. The best we can do is to ignore it.
1547 # subpath. The best we can do is to ignore it.
1548 tempnode2 = None
1548 tempnode2 = None
1549 submatch = matchmod.subdirmatcher(subpath, match)
1549 submatch = matchmod.subdirmatcher(subpath, match)
1550 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1550 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1551 stat=stat, fp=fp, prefix=prefix)
1551 stat=stat, fp=fp, prefix=prefix)
1552
1552
1553 def _changesetlabels(ctx):
1553 def _changesetlabels(ctx):
1554 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1554 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1555 if ctx.obsolete():
1555 if ctx.obsolete():
1556 labels.append('changeset.obsolete')
1556 labels.append('changeset.obsolete')
1557 if ctx.isunstable():
1557 if ctx.isunstable():
1558 labels.append('changeset.unstable')
1558 labels.append('changeset.unstable')
1559 for instability in ctx.instabilities():
1559 for instability in ctx.instabilities():
1560 labels.append('instability.%s' % instability)
1560 labels.append('instability.%s' % instability)
1561 return ' '.join(labels)
1561 return ' '.join(labels)
1562
1562
1563 class changeset_printer(object):
1563 class changeset_printer(object):
1564 '''show changeset information when templating not requested.'''
1564 '''show changeset information when templating not requested.'''
1565
1565
1566 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1566 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1567 self.ui = ui
1567 self.ui = ui
1568 self.repo = repo
1568 self.repo = repo
1569 self.buffered = buffered
1569 self.buffered = buffered
1570 self.matchfn = matchfn
1570 self.matchfn = matchfn
1571 self.diffopts = diffopts
1571 self.diffopts = diffopts
1572 self.header = {}
1572 self.header = {}
1573 self.hunk = {}
1573 self.hunk = {}
1574 self.lastheader = None
1574 self.lastheader = None
1575 self.footer = None
1575 self.footer = None
1576 self._columns = templatekw.getlogcolumns()
1576 self._columns = templatekw.getlogcolumns()
1577
1577
1578 def flush(self, ctx):
1578 def flush(self, ctx):
1579 rev = ctx.rev()
1579 rev = ctx.rev()
1580 if rev in self.header:
1580 if rev in self.header:
1581 h = self.header[rev]
1581 h = self.header[rev]
1582 if h != self.lastheader:
1582 if h != self.lastheader:
1583 self.lastheader = h
1583 self.lastheader = h
1584 self.ui.write(h)
1584 self.ui.write(h)
1585 del self.header[rev]
1585 del self.header[rev]
1586 if rev in self.hunk:
1586 if rev in self.hunk:
1587 self.ui.write(self.hunk[rev])
1587 self.ui.write(self.hunk[rev])
1588 del self.hunk[rev]
1588 del self.hunk[rev]
1589
1589
1590 def close(self):
1590 def close(self):
1591 if self.footer:
1591 if self.footer:
1592 self.ui.write(self.footer)
1592 self.ui.write(self.footer)
1593
1593
1594 def show(self, ctx, copies=None, matchfn=None, hunksfilterfn=None,
1594 def show(self, ctx, copies=None, matchfn=None, hunksfilterfn=None,
1595 **props):
1595 **props):
1596 props = pycompat.byteskwargs(props)
1596 props = pycompat.byteskwargs(props)
1597 if self.buffered:
1597 if self.buffered:
1598 self.ui.pushbuffer(labeled=True)
1598 self.ui.pushbuffer(labeled=True)
1599 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1599 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1600 self.hunk[ctx.rev()] = self.ui.popbuffer()
1600 self.hunk[ctx.rev()] = self.ui.popbuffer()
1601 else:
1601 else:
1602 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1602 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1603
1603
1604 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1604 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1605 '''show a single changeset or file revision'''
1605 '''show a single changeset or file revision'''
1606 changenode = ctx.node()
1606 changenode = ctx.node()
1607 rev = ctx.rev()
1607 rev = ctx.rev()
1608
1608
1609 if self.ui.quiet:
1609 if self.ui.quiet:
1610 self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
1610 self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
1611 label='log.node')
1611 label='log.node')
1612 return
1612 return
1613
1613
1614 columns = self._columns
1614 columns = self._columns
1615 self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx),
1615 self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx),
1616 label=_changesetlabels(ctx))
1616 label=_changesetlabels(ctx))
1617
1617
1618 # branches are shown first before any other names due to backwards
1618 # branches are shown first before any other names due to backwards
1619 # compatibility
1619 # compatibility
1620 branch = ctx.branch()
1620 branch = ctx.branch()
1621 # don't show the default branch name
1621 # don't show the default branch name
1622 if branch != 'default':
1622 if branch != 'default':
1623 self.ui.write(columns['branch'] % branch, label='log.branch')
1623 self.ui.write(columns['branch'] % branch, label='log.branch')
1624
1624
1625 for nsname, ns in self.repo.names.iteritems():
1625 for nsname, ns in self.repo.names.iteritems():
1626 # branches has special logic already handled above, so here we just
1626 # branches has special logic already handled above, so here we just
1627 # skip it
1627 # skip it
1628 if nsname == 'branches':
1628 if nsname == 'branches':
1629 continue
1629 continue
1630 # we will use the templatename as the color name since those two
1630 # we will use the templatename as the color name since those two
1631 # should be the same
1631 # should be the same
1632 for name in ns.names(self.repo, changenode):
1632 for name in ns.names(self.repo, changenode):
1633 self.ui.write(ns.logfmt % name,
1633 self.ui.write(ns.logfmt % name,
1634 label='log.%s' % ns.colorname)
1634 label='log.%s' % ns.colorname)
1635 if self.ui.debugflag:
1635 if self.ui.debugflag:
1636 self.ui.write(columns['phase'] % ctx.phasestr(), label='log.phase')
1636 self.ui.write(columns['phase'] % ctx.phasestr(), label='log.phase')
1637 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1637 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1638 label = 'log.parent changeset.%s' % pctx.phasestr()
1638 label = 'log.parent changeset.%s' % pctx.phasestr()
1639 self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
1639 self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
1640 label=label)
1640 label=label)
1641
1641
1642 if self.ui.debugflag and rev is not None:
1642 if self.ui.debugflag and rev is not None:
1643 mnode = ctx.manifestnode()
1643 mnode = ctx.manifestnode()
1644 mrev = self.repo.manifestlog._revlog.rev(mnode)
1644 mrev = self.repo.manifestlog._revlog.rev(mnode)
1645 self.ui.write(columns['manifest']
1645 self.ui.write(columns['manifest']
1646 % scmutil.formatrevnode(self.ui, mrev, mnode),
1646 % scmutil.formatrevnode(self.ui, mrev, mnode),
1647 label='ui.debug log.manifest')
1647 label='ui.debug log.manifest')
1648 self.ui.write(columns['user'] % ctx.user(), label='log.user')
1648 self.ui.write(columns['user'] % ctx.user(), label='log.user')
1649 self.ui.write(columns['date'] % util.datestr(ctx.date()),
1649 self.ui.write(columns['date'] % util.datestr(ctx.date()),
1650 label='log.date')
1650 label='log.date')
1651
1651
1652 if ctx.isunstable():
1652 if ctx.isunstable():
1653 instabilities = ctx.instabilities()
1653 instabilities = ctx.instabilities()
1654 self.ui.write(columns['instability'] % ', '.join(instabilities),
1654 self.ui.write(columns['instability'] % ', '.join(instabilities),
1655 label='log.instability')
1655 label='log.instability')
1656
1656
1657 elif ctx.obsolete():
1657 elif ctx.obsolete():
1658 self._showobsfate(ctx)
1658 self._showobsfate(ctx)
1659
1659
1660 self._exthook(ctx)
1660 self._exthook(ctx)
1661
1661
1662 if self.ui.debugflag:
1662 if self.ui.debugflag:
1663 files = ctx.p1().status(ctx)[:3]
1663 files = ctx.p1().status(ctx)[:3]
1664 for key, value in zip(['files', 'files+', 'files-'], files):
1664 for key, value in zip(['files', 'files+', 'files-'], files):
1665 if value:
1665 if value:
1666 self.ui.write(columns[key] % " ".join(value),
1666 self.ui.write(columns[key] % " ".join(value),
1667 label='ui.debug log.files')
1667 label='ui.debug log.files')
1668 elif ctx.files() and self.ui.verbose:
1668 elif ctx.files() and self.ui.verbose:
1669 self.ui.write(columns['files'] % " ".join(ctx.files()),
1669 self.ui.write(columns['files'] % " ".join(ctx.files()),
1670 label='ui.note log.files')
1670 label='ui.note log.files')
1671 if copies and self.ui.verbose:
1671 if copies and self.ui.verbose:
1672 copies = ['%s (%s)' % c for c in copies]
1672 copies = ['%s (%s)' % c for c in copies]
1673 self.ui.write(columns['copies'] % ' '.join(copies),
1673 self.ui.write(columns['copies'] % ' '.join(copies),
1674 label='ui.note log.copies')
1674 label='ui.note log.copies')
1675
1675
1676 extra = ctx.extra()
1676 extra = ctx.extra()
1677 if extra and self.ui.debugflag:
1677 if extra and self.ui.debugflag:
1678 for key, value in sorted(extra.items()):
1678 for key, value in sorted(extra.items()):
1679 self.ui.write(columns['extra'] % (key, util.escapestr(value)),
1679 self.ui.write(columns['extra'] % (key, util.escapestr(value)),
1680 label='ui.debug log.extra')
1680 label='ui.debug log.extra')
1681
1681
1682 description = ctx.description().strip()
1682 description = ctx.description().strip()
1683 if description:
1683 if description:
1684 if self.ui.verbose:
1684 if self.ui.verbose:
1685 self.ui.write(_("description:\n"),
1685 self.ui.write(_("description:\n"),
1686 label='ui.note log.description')
1686 label='ui.note log.description')
1687 self.ui.write(description,
1687 self.ui.write(description,
1688 label='ui.note log.description')
1688 label='ui.note log.description')
1689 self.ui.write("\n\n")
1689 self.ui.write("\n\n")
1690 else:
1690 else:
1691 self.ui.write(columns['summary'] % description.splitlines()[0],
1691 self.ui.write(columns['summary'] % description.splitlines()[0],
1692 label='log.summary')
1692 label='log.summary')
1693 self.ui.write("\n")
1693 self.ui.write("\n")
1694
1694
1695 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1695 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1696
1696
1697 def _showobsfate(self, ctx):
1697 def _showobsfate(self, ctx):
1698 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui)
1698 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui)
1699
1699
1700 if obsfate:
1700 if obsfate:
1701 for obsfateline in obsfate:
1701 for obsfateline in obsfate:
1702 self.ui.write(self._columns['obsolete'] % obsfateline,
1702 self.ui.write(self._columns['obsolete'] % obsfateline,
1703 label='log.obsfate')
1703 label='log.obsfate')
1704
1704
1705 def _exthook(self, ctx):
1705 def _exthook(self, ctx):
1706 '''empty method used by extension as a hook point
1706 '''empty method used by extension as a hook point
1707 '''
1707 '''
1708
1708
1709 def showpatch(self, ctx, matchfn, hunksfilterfn=None):
1709 def showpatch(self, ctx, matchfn, hunksfilterfn=None):
1710 if not matchfn:
1710 if not matchfn:
1711 matchfn = self.matchfn
1711 matchfn = self.matchfn
1712 if matchfn:
1712 if matchfn:
1713 stat = self.diffopts.get('stat')
1713 stat = self.diffopts.get('stat')
1714 diff = self.diffopts.get('patch')
1714 diff = self.diffopts.get('patch')
1715 diffopts = patch.diffallopts(self.ui, self.diffopts)
1715 diffopts = patch.diffallopts(self.ui, self.diffopts)
1716 node = ctx.node()
1716 node = ctx.node()
1717 prev = ctx.p1().node()
1717 prev = ctx.p1().node()
1718 if stat:
1718 if stat:
1719 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1719 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1720 match=matchfn, stat=True,
1720 match=matchfn, stat=True,
1721 hunksfilterfn=hunksfilterfn)
1721 hunksfilterfn=hunksfilterfn)
1722 if diff:
1722 if diff:
1723 if stat:
1723 if stat:
1724 self.ui.write("\n")
1724 self.ui.write("\n")
1725 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1725 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1726 match=matchfn, stat=False,
1726 match=matchfn, stat=False,
1727 hunksfilterfn=hunksfilterfn)
1727 hunksfilterfn=hunksfilterfn)
1728 if stat or diff:
1728 if stat or diff:
1729 self.ui.write("\n")
1729 self.ui.write("\n")
1730
1730
1731 class jsonchangeset(changeset_printer):
1731 class jsonchangeset(changeset_printer):
1732 '''format changeset information.'''
1732 '''format changeset information.'''
1733
1733
1734 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1734 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1735 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1735 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1736 self.cache = {}
1736 self.cache = {}
1737 self._first = True
1737 self._first = True
1738
1738
1739 def close(self):
1739 def close(self):
1740 if not self._first:
1740 if not self._first:
1741 self.ui.write("\n]\n")
1741 self.ui.write("\n]\n")
1742 else:
1742 else:
1743 self.ui.write("[]\n")
1743 self.ui.write("[]\n")
1744
1744
1745 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1745 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1746 '''show a single changeset or file revision'''
1746 '''show a single changeset or file revision'''
1747 rev = ctx.rev()
1747 rev = ctx.rev()
1748 if rev is None:
1748 if rev is None:
1749 jrev = jnode = 'null'
1749 jrev = jnode = 'null'
1750 else:
1750 else:
1751 jrev = '%d' % rev
1751 jrev = '%d' % rev
1752 jnode = '"%s"' % hex(ctx.node())
1752 jnode = '"%s"' % hex(ctx.node())
1753 j = encoding.jsonescape
1753 j = encoding.jsonescape
1754
1754
1755 if self._first:
1755 if self._first:
1756 self.ui.write("[\n {")
1756 self.ui.write("[\n {")
1757 self._first = False
1757 self._first = False
1758 else:
1758 else:
1759 self.ui.write(",\n {")
1759 self.ui.write(",\n {")
1760
1760
1761 if self.ui.quiet:
1761 if self.ui.quiet:
1762 self.ui.write(('\n "rev": %s') % jrev)
1762 self.ui.write(('\n "rev": %s') % jrev)
1763 self.ui.write((',\n "node": %s') % jnode)
1763 self.ui.write((',\n "node": %s') % jnode)
1764 self.ui.write('\n }')
1764 self.ui.write('\n }')
1765 return
1765 return
1766
1766
1767 self.ui.write(('\n "rev": %s') % jrev)
1767 self.ui.write(('\n "rev": %s') % jrev)
1768 self.ui.write((',\n "node": %s') % jnode)
1768 self.ui.write((',\n "node": %s') % jnode)
1769 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1769 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1770 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1770 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1771 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1771 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1772 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1772 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1773 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1773 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1774
1774
1775 self.ui.write((',\n "bookmarks": [%s]') %
1775 self.ui.write((',\n "bookmarks": [%s]') %
1776 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1776 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1777 self.ui.write((',\n "tags": [%s]') %
1777 self.ui.write((',\n "tags": [%s]') %
1778 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1778 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1779 self.ui.write((',\n "parents": [%s]') %
1779 self.ui.write((',\n "parents": [%s]') %
1780 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1780 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1781
1781
1782 if self.ui.debugflag:
1782 if self.ui.debugflag:
1783 if rev is None:
1783 if rev is None:
1784 jmanifestnode = 'null'
1784 jmanifestnode = 'null'
1785 else:
1785 else:
1786 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1786 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1787 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1787 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1788
1788
1789 self.ui.write((',\n "extra": {%s}') %
1789 self.ui.write((',\n "extra": {%s}') %
1790 ", ".join('"%s": "%s"' % (j(k), j(v))
1790 ", ".join('"%s": "%s"' % (j(k), j(v))
1791 for k, v in ctx.extra().items()))
1791 for k, v in ctx.extra().items()))
1792
1792
1793 files = ctx.p1().status(ctx)
1793 files = ctx.p1().status(ctx)
1794 self.ui.write((',\n "modified": [%s]') %
1794 self.ui.write((',\n "modified": [%s]') %
1795 ", ".join('"%s"' % j(f) for f in files[0]))
1795 ", ".join('"%s"' % j(f) for f in files[0]))
1796 self.ui.write((',\n "added": [%s]') %
1796 self.ui.write((',\n "added": [%s]') %
1797 ", ".join('"%s"' % j(f) for f in files[1]))
1797 ", ".join('"%s"' % j(f) for f in files[1]))
1798 self.ui.write((',\n "removed": [%s]') %
1798 self.ui.write((',\n "removed": [%s]') %
1799 ", ".join('"%s"' % j(f) for f in files[2]))
1799 ", ".join('"%s"' % j(f) for f in files[2]))
1800
1800
1801 elif self.ui.verbose:
1801 elif self.ui.verbose:
1802 self.ui.write((',\n "files": [%s]') %
1802 self.ui.write((',\n "files": [%s]') %
1803 ", ".join('"%s"' % j(f) for f in ctx.files()))
1803 ", ".join('"%s"' % j(f) for f in ctx.files()))
1804
1804
1805 if copies:
1805 if copies:
1806 self.ui.write((',\n "copies": {%s}') %
1806 self.ui.write((',\n "copies": {%s}') %
1807 ", ".join('"%s": "%s"' % (j(k), j(v))
1807 ", ".join('"%s": "%s"' % (j(k), j(v))
1808 for k, v in copies))
1808 for k, v in copies))
1809
1809
1810 matchfn = self.matchfn
1810 matchfn = self.matchfn
1811 if matchfn:
1811 if matchfn:
1812 stat = self.diffopts.get('stat')
1812 stat = self.diffopts.get('stat')
1813 diff = self.diffopts.get('patch')
1813 diff = self.diffopts.get('patch')
1814 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1814 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1815 node, prev = ctx.node(), ctx.p1().node()
1815 node, prev = ctx.node(), ctx.p1().node()
1816 if stat:
1816 if stat:
1817 self.ui.pushbuffer()
1817 self.ui.pushbuffer()
1818 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1818 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1819 match=matchfn, stat=True)
1819 match=matchfn, stat=True)
1820 self.ui.write((',\n "diffstat": "%s"')
1820 self.ui.write((',\n "diffstat": "%s"')
1821 % j(self.ui.popbuffer()))
1821 % j(self.ui.popbuffer()))
1822 if diff:
1822 if diff:
1823 self.ui.pushbuffer()
1823 self.ui.pushbuffer()
1824 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1824 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1825 match=matchfn, stat=False)
1825 match=matchfn, stat=False)
1826 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1826 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1827
1827
1828 self.ui.write("\n }")
1828 self.ui.write("\n }")
1829
1829
1830 class changeset_templater(changeset_printer):
1830 class changeset_templater(changeset_printer):
1831 '''format changeset information.
1831 '''format changeset information.
1832
1832
1833 Note: there are a variety of convenience functions to build a
1833 Note: there are a variety of convenience functions to build a
1834 changeset_templater for common cases. See functions such as:
1834 changeset_templater for common cases. See functions such as:
1835 makelogtemplater, show_changeset, buildcommittemplate, or other
1835 makelogtemplater, show_changeset, buildcommittemplate, or other
1836 functions that use changesest_templater.
1836 functions that use changesest_templater.
1837 '''
1837 '''
1838
1838
1839 # Arguments before "buffered" used to be positional. Consider not
1839 # Arguments before "buffered" used to be positional. Consider not
1840 # adding/removing arguments before "buffered" to not break callers.
1840 # adding/removing arguments before "buffered" to not break callers.
1841 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1841 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1842 buffered=False):
1842 buffered=False):
1843 diffopts = diffopts or {}
1843 diffopts = diffopts or {}
1844
1844
1845 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1845 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1846 tres = formatter.templateresources(ui, repo)
1846 tres = formatter.templateresources(ui, repo)
1847 self.t = formatter.loadtemplater(ui, tmplspec,
1847 self.t = formatter.loadtemplater(ui, tmplspec,
1848 defaults=templatekw.keywords,
1848 defaults=templatekw.keywords,
1849 resources=tres,
1849 resources=tres,
1850 cache=templatekw.defaulttempl)
1850 cache=templatekw.defaulttempl)
1851 self._counter = itertools.count()
1851 self._counter = itertools.count()
1852 self.cache = tres['cache'] # shared with _graphnodeformatter()
1852 self.cache = tres['cache'] # shared with _graphnodeformatter()
1853
1853
1854 self._tref = tmplspec.ref
1854 self._tref = tmplspec.ref
1855 self._parts = {'header': '', 'footer': '',
1855 self._parts = {'header': '', 'footer': '',
1856 tmplspec.ref: tmplspec.ref,
1856 tmplspec.ref: tmplspec.ref,
1857 'docheader': '', 'docfooter': '',
1857 'docheader': '', 'docfooter': '',
1858 'separator': ''}
1858 'separator': ''}
1859 if tmplspec.mapfile:
1859 if tmplspec.mapfile:
1860 # find correct templates for current mode, for backward
1860 # find correct templates for current mode, for backward
1861 # compatibility with 'log -v/-q/--debug' using a mapfile
1861 # compatibility with 'log -v/-q/--debug' using a mapfile
1862 tmplmodes = [
1862 tmplmodes = [
1863 (True, ''),
1863 (True, ''),
1864 (self.ui.verbose, '_verbose'),
1864 (self.ui.verbose, '_verbose'),
1865 (self.ui.quiet, '_quiet'),
1865 (self.ui.quiet, '_quiet'),
1866 (self.ui.debugflag, '_debug'),
1866 (self.ui.debugflag, '_debug'),
1867 ]
1867 ]
1868 for mode, postfix in tmplmodes:
1868 for mode, postfix in tmplmodes:
1869 for t in self._parts:
1869 for t in self._parts:
1870 cur = t + postfix
1870 cur = t + postfix
1871 if mode and cur in self.t:
1871 if mode and cur in self.t:
1872 self._parts[t] = cur
1872 self._parts[t] = cur
1873 else:
1873 else:
1874 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1874 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1875 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1875 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1876 self._parts.update(m)
1876 self._parts.update(m)
1877
1877
1878 if self._parts['docheader']:
1878 if self._parts['docheader']:
1879 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1879 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1880
1880
1881 def close(self):
1881 def close(self):
1882 if self._parts['docfooter']:
1882 if self._parts['docfooter']:
1883 if not self.footer:
1883 if not self.footer:
1884 self.footer = ""
1884 self.footer = ""
1885 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1885 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1886 return super(changeset_templater, self).close()
1886 return super(changeset_templater, self).close()
1887
1887
1888 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1888 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1889 '''show a single changeset or file revision'''
1889 '''show a single changeset or file revision'''
1890 props = props.copy()
1890 props = props.copy()
1891 props['ctx'] = ctx
1891 props['ctx'] = ctx
1892 props['index'] = index = next(self._counter)
1892 props['index'] = index = next(self._counter)
1893 props['revcache'] = {'copies': copies}
1893 props['revcache'] = {'copies': copies}
1894 props = pycompat.strkwargs(props)
1894 props = pycompat.strkwargs(props)
1895
1895
1896 # write separator, which wouldn't work well with the header part below
1896 # write separator, which wouldn't work well with the header part below
1897 # since there's inherently a conflict between header (across items) and
1897 # since there's inherently a conflict between header (across items) and
1898 # separator (per item)
1898 # separator (per item)
1899 if self._parts['separator'] and index > 0:
1899 if self._parts['separator'] and index > 0:
1900 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1900 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1901
1901
1902 # write header
1902 # write header
1903 if self._parts['header']:
1903 if self._parts['header']:
1904 h = templater.stringify(self.t(self._parts['header'], **props))
1904 h = templater.stringify(self.t(self._parts['header'], **props))
1905 if self.buffered:
1905 if self.buffered:
1906 self.header[ctx.rev()] = h
1906 self.header[ctx.rev()] = h
1907 else:
1907 else:
1908 if self.lastheader != h:
1908 if self.lastheader != h:
1909 self.lastheader = h
1909 self.lastheader = h
1910 self.ui.write(h)
1910 self.ui.write(h)
1911
1911
1912 # write changeset metadata, then patch if requested
1912 # write changeset metadata, then patch if requested
1913 key = self._parts[self._tref]
1913 key = self._parts[self._tref]
1914 self.ui.write(templater.stringify(self.t(key, **props)))
1914 self.ui.write(templater.stringify(self.t(key, **props)))
1915 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1915 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1916
1916
1917 if self._parts['footer']:
1917 if self._parts['footer']:
1918 if not self.footer:
1918 if not self.footer:
1919 self.footer = templater.stringify(
1919 self.footer = templater.stringify(
1920 self.t(self._parts['footer'], **props))
1920 self.t(self._parts['footer'], **props))
1921
1921
1922 def logtemplatespec(tmpl, mapfile):
1922 def logtemplatespec(tmpl, mapfile):
1923 if mapfile:
1923 if mapfile:
1924 return formatter.templatespec('changeset', tmpl, mapfile)
1924 return formatter.templatespec('changeset', tmpl, mapfile)
1925 else:
1925 else:
1926 return formatter.templatespec('', tmpl, None)
1926 return formatter.templatespec('', tmpl, None)
1927
1927
1928 def _lookuplogtemplate(ui, tmpl, style):
1928 def _lookuplogtemplate(ui, tmpl, style):
1929 """Find the template matching the given template spec or style
1929 """Find the template matching the given template spec or style
1930
1930
1931 See formatter.lookuptemplate() for details.
1931 See formatter.lookuptemplate() for details.
1932 """
1932 """
1933
1933
1934 # ui settings
1934 # ui settings
1935 if not tmpl and not style: # template are stronger than style
1935 if not tmpl and not style: # template are stronger than style
1936 tmpl = ui.config('ui', 'logtemplate')
1936 tmpl = ui.config('ui', 'logtemplate')
1937 if tmpl:
1937 if tmpl:
1938 return logtemplatespec(templater.unquotestring(tmpl), None)
1938 return logtemplatespec(templater.unquotestring(tmpl), None)
1939 else:
1939 else:
1940 style = util.expandpath(ui.config('ui', 'style'))
1940 style = util.expandpath(ui.config('ui', 'style'))
1941
1941
1942 if not tmpl and style:
1942 if not tmpl and style:
1943 mapfile = style
1943 mapfile = style
1944 if not os.path.split(mapfile)[0]:
1944 if not os.path.split(mapfile)[0]:
1945 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1945 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1946 or templater.templatepath(mapfile))
1946 or templater.templatepath(mapfile))
1947 if mapname:
1947 if mapname:
1948 mapfile = mapname
1948 mapfile = mapname
1949 return logtemplatespec(None, mapfile)
1949 return logtemplatespec(None, mapfile)
1950
1950
1951 if not tmpl:
1951 if not tmpl:
1952 return logtemplatespec(None, None)
1952 return logtemplatespec(None, None)
1953
1953
1954 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1954 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1955
1955
1956 def makelogtemplater(ui, repo, tmpl, buffered=False):
1956 def makelogtemplater(ui, repo, tmpl, buffered=False):
1957 """Create a changeset_templater from a literal template 'tmpl'
1957 """Create a changeset_templater from a literal template 'tmpl'
1958 byte-string."""
1958 byte-string."""
1959 spec = logtemplatespec(tmpl, None)
1959 spec = logtemplatespec(tmpl, None)
1960 return changeset_templater(ui, repo, spec, buffered=buffered)
1960 return changeset_templater(ui, repo, spec, buffered=buffered)
1961
1961
1962 def show_changeset(ui, repo, opts, buffered=False):
1962 def show_changeset(ui, repo, opts, buffered=False):
1963 """show one changeset using template or regular display.
1963 """show one changeset using template or regular display.
1964
1964
1965 Display format will be the first non-empty hit of:
1965 Display format will be the first non-empty hit of:
1966 1. option 'template'
1966 1. option 'template'
1967 2. option 'style'
1967 2. option 'style'
1968 3. [ui] setting 'logtemplate'
1968 3. [ui] setting 'logtemplate'
1969 4. [ui] setting 'style'
1969 4. [ui] setting 'style'
1970 If all of these values are either the unset or the empty string,
1970 If all of these values are either the unset or the empty string,
1971 regular display via changeset_printer() is done.
1971 regular display via changeset_printer() is done.
1972 """
1972 """
1973 # options
1973 # options
1974 match = None
1974 match = None
1975 if opts.get('patch') or opts.get('stat'):
1975 if opts.get('patch') or opts.get('stat'):
1976 match = scmutil.matchall(repo)
1976 match = scmutil.matchall(repo)
1977
1977
1978 if opts.get('template') == 'json':
1978 if opts.get('template') == 'json':
1979 return jsonchangeset(ui, repo, match, opts, buffered)
1979 return jsonchangeset(ui, repo, match, opts, buffered)
1980
1980
1981 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
1981 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
1982
1982
1983 if not spec.ref and not spec.tmpl and not spec.mapfile:
1983 if not spec.ref and not spec.tmpl and not spec.mapfile:
1984 return changeset_printer(ui, repo, match, opts, buffered)
1984 return changeset_printer(ui, repo, match, opts, buffered)
1985
1985
1986 return changeset_templater(ui, repo, spec, match, opts, buffered)
1986 return changeset_templater(ui, repo, spec, match, opts, buffered)
1987
1987
1988 def showmarker(fm, marker, index=None):
1988 def showmarker(fm, marker, index=None):
1989 """utility function to display obsolescence marker in a readable way
1989 """utility function to display obsolescence marker in a readable way
1990
1990
1991 To be used by debug function."""
1991 To be used by debug function."""
1992 if index is not None:
1992 if index is not None:
1993 fm.write('index', '%i ', index)
1993 fm.write('index', '%i ', index)
1994 fm.write('prednode', '%s ', hex(marker.prednode()))
1994 fm.write('prednode', '%s ', hex(marker.prednode()))
1995 succs = marker.succnodes()
1995 succs = marker.succnodes()
1996 fm.condwrite(succs, 'succnodes', '%s ',
1996 fm.condwrite(succs, 'succnodes', '%s ',
1997 fm.formatlist(map(hex, succs), name='node'))
1997 fm.formatlist(map(hex, succs), name='node'))
1998 fm.write('flag', '%X ', marker.flags())
1998 fm.write('flag', '%X ', marker.flags())
1999 parents = marker.parentnodes()
1999 parents = marker.parentnodes()
2000 if parents is not None:
2000 if parents is not None:
2001 fm.write('parentnodes', '{%s} ',
2001 fm.write('parentnodes', '{%s} ',
2002 fm.formatlist(map(hex, parents), name='node', sep=', '))
2002 fm.formatlist(map(hex, parents), name='node', sep=', '))
2003 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2003 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2004 meta = marker.metadata().copy()
2004 meta = marker.metadata().copy()
2005 meta.pop('date', None)
2005 meta.pop('date', None)
2006 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2006 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2007 fm.plain('\n')
2007 fm.plain('\n')
2008
2008
2009 def finddate(ui, repo, date):
2009 def finddate(ui, repo, date):
2010 """Find the tipmost changeset that matches the given date spec"""
2010 """Find the tipmost changeset that matches the given date spec"""
2011
2011
2012 df = util.matchdate(date)
2012 df = util.matchdate(date)
2013 m = scmutil.matchall(repo)
2013 m = scmutil.matchall(repo)
2014 results = {}
2014 results = {}
2015
2015
2016 def prep(ctx, fns):
2016 def prep(ctx, fns):
2017 d = ctx.date()
2017 d = ctx.date()
2018 if df(d[0]):
2018 if df(d[0]):
2019 results[ctx.rev()] = d
2019 results[ctx.rev()] = d
2020
2020
2021 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2021 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2022 rev = ctx.rev()
2022 rev = ctx.rev()
2023 if rev in results:
2023 if rev in results:
2024 ui.status(_("found revision %s from %s\n") %
2024 ui.status(_("found revision %s from %s\n") %
2025 (rev, util.datestr(results[rev])))
2025 (rev, util.datestr(results[rev])))
2026 return '%d' % rev
2026 return '%d' % rev
2027
2027
2028 raise error.Abort(_("revision matching date not found"))
2028 raise error.Abort(_("revision matching date not found"))
2029
2029
2030 def increasingwindows(windowsize=8, sizelimit=512):
2030 def increasingwindows(windowsize=8, sizelimit=512):
2031 while True:
2031 while True:
2032 yield windowsize
2032 yield windowsize
2033 if windowsize < sizelimit:
2033 if windowsize < sizelimit:
2034 windowsize *= 2
2034 windowsize *= 2
2035
2035
2036 def _walkrevs(repo, opts):
2036 def _walkrevs(repo, opts):
2037 # Default --rev value depends on --follow but --follow behavior
2037 # Default --rev value depends on --follow but --follow behavior
2038 # depends on revisions resolved from --rev...
2038 # depends on revisions resolved from --rev...
2039 follow = opts.get('follow') or opts.get('follow_first')
2039 follow = opts.get('follow') or opts.get('follow_first')
2040 if opts.get('rev'):
2040 if opts.get('rev'):
2041 revs = scmutil.revrange(repo, opts['rev'])
2041 revs = scmutil.revrange(repo, opts['rev'])
2042 elif follow and repo.dirstate.p1() == nullid:
2042 elif follow and repo.dirstate.p1() == nullid:
2043 revs = smartset.baseset()
2043 revs = smartset.baseset()
2044 elif follow:
2044 elif follow:
2045 revs = repo.revs('reverse(:.)')
2045 revs = repo.revs('reverse(:.)')
2046 else:
2046 else:
2047 revs = smartset.spanset(repo)
2047 revs = smartset.spanset(repo)
2048 revs.reverse()
2048 revs.reverse()
2049 return revs
2049 return revs
2050
2050
2051 class FileWalkError(Exception):
2051 class FileWalkError(Exception):
2052 pass
2052 pass
2053
2053
2054 def walkfilerevs(repo, match, follow, revs, fncache):
2054 def walkfilerevs(repo, match, follow, revs, fncache):
2055 '''Walks the file history for the matched files.
2055 '''Walks the file history for the matched files.
2056
2056
2057 Returns the changeset revs that are involved in the file history.
2057 Returns the changeset revs that are involved in the file history.
2058
2058
2059 Throws FileWalkError if the file history can't be walked using
2059 Throws FileWalkError if the file history can't be walked using
2060 filelogs alone.
2060 filelogs alone.
2061 '''
2061 '''
2062 wanted = set()
2062 wanted = set()
2063 copies = []
2063 copies = []
2064 minrev, maxrev = min(revs), max(revs)
2064 minrev, maxrev = min(revs), max(revs)
2065 def filerevgen(filelog, last):
2065 def filerevgen(filelog, last):
2066 """
2066 """
2067 Only files, no patterns. Check the history of each file.
2067 Only files, no patterns. Check the history of each file.
2068
2068
2069 Examines filelog entries within minrev, maxrev linkrev range
2069 Examines filelog entries within minrev, maxrev linkrev range
2070 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2070 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2071 tuples in backwards order
2071 tuples in backwards order
2072 """
2072 """
2073 cl_count = len(repo)
2073 cl_count = len(repo)
2074 revs = []
2074 revs = []
2075 for j in xrange(0, last + 1):
2075 for j in xrange(0, last + 1):
2076 linkrev = filelog.linkrev(j)
2076 linkrev = filelog.linkrev(j)
2077 if linkrev < minrev:
2077 if linkrev < minrev:
2078 continue
2078 continue
2079 # only yield rev for which we have the changelog, it can
2079 # only yield rev for which we have the changelog, it can
2080 # happen while doing "hg log" during a pull or commit
2080 # happen while doing "hg log" during a pull or commit
2081 if linkrev >= cl_count:
2081 if linkrev >= cl_count:
2082 break
2082 break
2083
2083
2084 parentlinkrevs = []
2084 parentlinkrevs = []
2085 for p in filelog.parentrevs(j):
2085 for p in filelog.parentrevs(j):
2086 if p != nullrev:
2086 if p != nullrev:
2087 parentlinkrevs.append(filelog.linkrev(p))
2087 parentlinkrevs.append(filelog.linkrev(p))
2088 n = filelog.node(j)
2088 n = filelog.node(j)
2089 revs.append((linkrev, parentlinkrevs,
2089 revs.append((linkrev, parentlinkrevs,
2090 follow and filelog.renamed(n)))
2090 follow and filelog.renamed(n)))
2091
2091
2092 return reversed(revs)
2092 return reversed(revs)
2093 def iterfiles():
2093 def iterfiles():
2094 pctx = repo['.']
2094 pctx = repo['.']
2095 for filename in match.files():
2095 for filename in match.files():
2096 if follow:
2096 if follow:
2097 if filename not in pctx:
2097 if filename not in pctx:
2098 raise error.Abort(_('cannot follow file not in parent '
2098 raise error.Abort(_('cannot follow file not in parent '
2099 'revision: "%s"') % filename)
2099 'revision: "%s"') % filename)
2100 yield filename, pctx[filename].filenode()
2100 yield filename, pctx[filename].filenode()
2101 else:
2101 else:
2102 yield filename, None
2102 yield filename, None
2103 for filename_node in copies:
2103 for filename_node in copies:
2104 yield filename_node
2104 yield filename_node
2105
2105
2106 for file_, node in iterfiles():
2106 for file_, node in iterfiles():
2107 filelog = repo.file(file_)
2107 filelog = repo.file(file_)
2108 if not len(filelog):
2108 if not len(filelog):
2109 if node is None:
2109 if node is None:
2110 # A zero count may be a directory or deleted file, so
2110 # A zero count may be a directory or deleted file, so
2111 # try to find matching entries on the slow path.
2111 # try to find matching entries on the slow path.
2112 if follow:
2112 if follow:
2113 raise error.Abort(
2113 raise error.Abort(
2114 _('cannot follow nonexistent file: "%s"') % file_)
2114 _('cannot follow nonexistent file: "%s"') % file_)
2115 raise FileWalkError("Cannot walk via filelog")
2115 raise FileWalkError("Cannot walk via filelog")
2116 else:
2116 else:
2117 continue
2117 continue
2118
2118
2119 if node is None:
2119 if node is None:
2120 last = len(filelog) - 1
2120 last = len(filelog) - 1
2121 else:
2121 else:
2122 last = filelog.rev(node)
2122 last = filelog.rev(node)
2123
2123
2124 # keep track of all ancestors of the file
2124 # keep track of all ancestors of the file
2125 ancestors = {filelog.linkrev(last)}
2125 ancestors = {filelog.linkrev(last)}
2126
2126
2127 # iterate from latest to oldest revision
2127 # iterate from latest to oldest revision
2128 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2128 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2129 if not follow:
2129 if not follow:
2130 if rev > maxrev:
2130 if rev > maxrev:
2131 continue
2131 continue
2132 else:
2132 else:
2133 # Note that last might not be the first interesting
2133 # Note that last might not be the first interesting
2134 # rev to us:
2134 # rev to us:
2135 # if the file has been changed after maxrev, we'll
2135 # if the file has been changed after maxrev, we'll
2136 # have linkrev(last) > maxrev, and we still need
2136 # have linkrev(last) > maxrev, and we still need
2137 # to explore the file graph
2137 # to explore the file graph
2138 if rev not in ancestors:
2138 if rev not in ancestors:
2139 continue
2139 continue
2140 # XXX insert 1327 fix here
2140 # XXX insert 1327 fix here
2141 if flparentlinkrevs:
2141 if flparentlinkrevs:
2142 ancestors.update(flparentlinkrevs)
2142 ancestors.update(flparentlinkrevs)
2143
2143
2144 fncache.setdefault(rev, []).append(file_)
2144 fncache.setdefault(rev, []).append(file_)
2145 wanted.add(rev)
2145 wanted.add(rev)
2146 if copied:
2146 if copied:
2147 copies.append(copied)
2147 copies.append(copied)
2148
2148
2149 return wanted
2149 return wanted
2150
2150
2151 class _followfilter(object):
2151 class _followfilter(object):
2152 def __init__(self, repo, onlyfirst=False):
2152 def __init__(self, repo, onlyfirst=False):
2153 self.repo = repo
2153 self.repo = repo
2154 self.startrev = nullrev
2154 self.startrev = nullrev
2155 self.roots = set()
2155 self.roots = set()
2156 self.onlyfirst = onlyfirst
2156 self.onlyfirst = onlyfirst
2157
2157
2158 def match(self, rev):
2158 def match(self, rev):
2159 def realparents(rev):
2159 def realparents(rev):
2160 if self.onlyfirst:
2160 if self.onlyfirst:
2161 return self.repo.changelog.parentrevs(rev)[0:1]
2161 return self.repo.changelog.parentrevs(rev)[0:1]
2162 else:
2162 else:
2163 return filter(lambda x: x != nullrev,
2163 return filter(lambda x: x != nullrev,
2164 self.repo.changelog.parentrevs(rev))
2164 self.repo.changelog.parentrevs(rev))
2165
2165
2166 if self.startrev == nullrev:
2166 if self.startrev == nullrev:
2167 self.startrev = rev
2167 self.startrev = rev
2168 return True
2168 return True
2169
2169
2170 if rev > self.startrev:
2170 if rev > self.startrev:
2171 # forward: all descendants
2171 # forward: all descendants
2172 if not self.roots:
2172 if not self.roots:
2173 self.roots.add(self.startrev)
2173 self.roots.add(self.startrev)
2174 for parent in realparents(rev):
2174 for parent in realparents(rev):
2175 if parent in self.roots:
2175 if parent in self.roots:
2176 self.roots.add(rev)
2176 self.roots.add(rev)
2177 return True
2177 return True
2178 else:
2178 else:
2179 # backwards: all parents
2179 # backwards: all parents
2180 if not self.roots:
2180 if not self.roots:
2181 self.roots.update(realparents(self.startrev))
2181 self.roots.update(realparents(self.startrev))
2182 if rev in self.roots:
2182 if rev in self.roots:
2183 self.roots.remove(rev)
2183 self.roots.remove(rev)
2184 self.roots.update(realparents(rev))
2184 self.roots.update(realparents(rev))
2185 return True
2185 return True
2186
2186
2187 return False
2187 return False
2188
2188
2189 def walkchangerevs(repo, match, opts, prepare):
2189 def walkchangerevs(repo, match, opts, prepare):
2190 '''Iterate over files and the revs in which they changed.
2190 '''Iterate over files and the revs in which they changed.
2191
2191
2192 Callers most commonly need to iterate backwards over the history
2192 Callers most commonly need to iterate backwards over the history
2193 in which they are interested. Doing so has awful (quadratic-looking)
2193 in which they are interested. Doing so has awful (quadratic-looking)
2194 performance, so we use iterators in a "windowed" way.
2194 performance, so we use iterators in a "windowed" way.
2195
2195
2196 We walk a window of revisions in the desired order. Within the
2196 We walk a window of revisions in the desired order. Within the
2197 window, we first walk forwards to gather data, then in the desired
2197 window, we first walk forwards to gather data, then in the desired
2198 order (usually backwards) to display it.
2198 order (usually backwards) to display it.
2199
2199
2200 This function returns an iterator yielding contexts. Before
2200 This function returns an iterator yielding contexts. Before
2201 yielding each context, the iterator will first call the prepare
2201 yielding each context, the iterator will first call the prepare
2202 function on each context in the window in forward order.'''
2202 function on each context in the window in forward order.'''
2203
2203
2204 follow = opts.get('follow') or opts.get('follow_first')
2204 follow = opts.get('follow') or opts.get('follow_first')
2205 revs = _walkrevs(repo, opts)
2205 revs = _walkrevs(repo, opts)
2206 if not revs:
2206 if not revs:
2207 return []
2207 return []
2208 wanted = set()
2208 wanted = set()
2209 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2209 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2210 fncache = {}
2210 fncache = {}
2211 change = repo.changectx
2211 change = repo.changectx
2212
2212
2213 # First step is to fill wanted, the set of revisions that we want to yield.
2213 # First step is to fill wanted, the set of revisions that we want to yield.
2214 # When it does not induce extra cost, we also fill fncache for revisions in
2214 # When it does not induce extra cost, we also fill fncache for revisions in
2215 # wanted: a cache of filenames that were changed (ctx.files()) and that
2215 # wanted: a cache of filenames that were changed (ctx.files()) and that
2216 # match the file filtering conditions.
2216 # match the file filtering conditions.
2217
2217
2218 if match.always():
2218 if match.always():
2219 # No files, no patterns. Display all revs.
2219 # No files, no patterns. Display all revs.
2220 wanted = revs
2220 wanted = revs
2221 elif not slowpath:
2221 elif not slowpath:
2222 # We only have to read through the filelog to find wanted revisions
2222 # We only have to read through the filelog to find wanted revisions
2223
2223
2224 try:
2224 try:
2225 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2225 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2226 except FileWalkError:
2226 except FileWalkError:
2227 slowpath = True
2227 slowpath = True
2228
2228
2229 # We decided to fall back to the slowpath because at least one
2229 # We decided to fall back to the slowpath because at least one
2230 # of the paths was not a file. Check to see if at least one of them
2230 # of the paths was not a file. Check to see if at least one of them
2231 # existed in history, otherwise simply return
2231 # existed in history, otherwise simply return
2232 for path in match.files():
2232 for path in match.files():
2233 if path == '.' or path in repo.store:
2233 if path == '.' or path in repo.store:
2234 break
2234 break
2235 else:
2235 else:
2236 return []
2236 return []
2237
2237
2238 if slowpath:
2238 if slowpath:
2239 # We have to read the changelog to match filenames against
2239 # We have to read the changelog to match filenames against
2240 # changed files
2240 # changed files
2241
2241
2242 if follow:
2242 if follow:
2243 raise error.Abort(_('can only follow copies/renames for explicit '
2243 raise error.Abort(_('can only follow copies/renames for explicit '
2244 'filenames'))
2244 'filenames'))
2245
2245
2246 # The slow path checks files modified in every changeset.
2246 # The slow path checks files modified in every changeset.
2247 # This is really slow on large repos, so compute the set lazily.
2247 # This is really slow on large repos, so compute the set lazily.
2248 class lazywantedset(object):
2248 class lazywantedset(object):
2249 def __init__(self):
2249 def __init__(self):
2250 self.set = set()
2250 self.set = set()
2251 self.revs = set(revs)
2251 self.revs = set(revs)
2252
2252
2253 # No need to worry about locality here because it will be accessed
2253 # No need to worry about locality here because it will be accessed
2254 # in the same order as the increasing window below.
2254 # in the same order as the increasing window below.
2255 def __contains__(self, value):
2255 def __contains__(self, value):
2256 if value in self.set:
2256 if value in self.set:
2257 return True
2257 return True
2258 elif not value in self.revs:
2258 elif not value in self.revs:
2259 return False
2259 return False
2260 else:
2260 else:
2261 self.revs.discard(value)
2261 self.revs.discard(value)
2262 ctx = change(value)
2262 ctx = change(value)
2263 matches = filter(match, ctx.files())
2263 matches = filter(match, ctx.files())
2264 if matches:
2264 if matches:
2265 fncache[value] = matches
2265 fncache[value] = matches
2266 self.set.add(value)
2266 self.set.add(value)
2267 return True
2267 return True
2268 return False
2268 return False
2269
2269
2270 def discard(self, value):
2270 def discard(self, value):
2271 self.revs.discard(value)
2271 self.revs.discard(value)
2272 self.set.discard(value)
2272 self.set.discard(value)
2273
2273
2274 wanted = lazywantedset()
2274 wanted = lazywantedset()
2275
2275
2276 # it might be worthwhile to do this in the iterator if the rev range
2276 # it might be worthwhile to do this in the iterator if the rev range
2277 # is descending and the prune args are all within that range
2277 # is descending and the prune args are all within that range
2278 for rev in opts.get('prune', ()):
2278 for rev in opts.get('prune', ()):
2279 rev = repo[rev].rev()
2279 rev = repo[rev].rev()
2280 ff = _followfilter(repo)
2280 ff = _followfilter(repo)
2281 stop = min(revs[0], revs[-1])
2281 stop = min(revs[0], revs[-1])
2282 for x in xrange(rev, stop - 1, -1):
2282 for x in xrange(rev, stop - 1, -1):
2283 if ff.match(x):
2283 if ff.match(x):
2284 wanted = wanted - [x]
2284 wanted = wanted - [x]
2285
2285
2286 # Now that wanted is correctly initialized, we can iterate over the
2286 # Now that wanted is correctly initialized, we can iterate over the
2287 # revision range, yielding only revisions in wanted.
2287 # revision range, yielding only revisions in wanted.
2288 def iterate():
2288 def iterate():
2289 if follow and match.always():
2289 if follow and match.always():
2290 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2290 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2291 def want(rev):
2291 def want(rev):
2292 return ff.match(rev) and rev in wanted
2292 return ff.match(rev) and rev in wanted
2293 else:
2293 else:
2294 def want(rev):
2294 def want(rev):
2295 return rev in wanted
2295 return rev in wanted
2296
2296
2297 it = iter(revs)
2297 it = iter(revs)
2298 stopiteration = False
2298 stopiteration = False
2299 for windowsize in increasingwindows():
2299 for windowsize in increasingwindows():
2300 nrevs = []
2300 nrevs = []
2301 for i in xrange(windowsize):
2301 for i in xrange(windowsize):
2302 rev = next(it, None)
2302 rev = next(it, None)
2303 if rev is None:
2303 if rev is None:
2304 stopiteration = True
2304 stopiteration = True
2305 break
2305 break
2306 elif want(rev):
2306 elif want(rev):
2307 nrevs.append(rev)
2307 nrevs.append(rev)
2308 for rev in sorted(nrevs):
2308 for rev in sorted(nrevs):
2309 fns = fncache.get(rev)
2309 fns = fncache.get(rev)
2310 ctx = change(rev)
2310 ctx = change(rev)
2311 if not fns:
2311 if not fns:
2312 def fns_generator():
2312 def fns_generator():
2313 for f in ctx.files():
2313 for f in ctx.files():
2314 if match(f):
2314 if match(f):
2315 yield f
2315 yield f
2316 fns = fns_generator()
2316 fns = fns_generator()
2317 prepare(ctx, fns)
2317 prepare(ctx, fns)
2318 for rev in nrevs:
2318 for rev in nrevs:
2319 yield change(rev)
2319 yield change(rev)
2320
2320
2321 if stopiteration:
2321 if stopiteration:
2322 break
2322 break
2323
2323
2324 return iterate()
2324 return iterate()
2325
2325
2326 def _makelogmatcher(repo, revs, pats, opts):
2326 def _makelogmatcher(repo, revs, pats, opts):
2327 """Build matcher and expanded patterns from log options
2327 """Build matcher and expanded patterns from log options
2328
2328
2329 If --follow, revs are the revisions to follow from.
2329 If --follow, revs are the revisions to follow from.
2330
2330
2331 Returns (match, pats, slowpath) where
2331 Returns (match, pats, slowpath) where
2332 - match: a matcher built from the given pats and -I/-X opts
2332 - match: a matcher built from the given pats and -I/-X opts
2333 - pats: patterns used (globs are expanded on Windows)
2333 - pats: patterns used (globs are expanded on Windows)
2334 - slowpath: True if patterns aren't as simple as scanning filelogs
2334 - slowpath: True if patterns aren't as simple as scanning filelogs
2335 """
2335 """
2336 # pats/include/exclude are passed to match.match() directly in
2336 # pats/include/exclude are passed to match.match() directly in
2337 # _matchfiles() revset but walkchangerevs() builds its matcher with
2337 # _matchfiles() revset but walkchangerevs() builds its matcher with
2338 # scmutil.match(). The difference is input pats are globbed on
2338 # scmutil.match(). The difference is input pats are globbed on
2339 # platforms without shell expansion (windows).
2339 # platforms without shell expansion (windows).
2340 wctx = repo[None]
2340 wctx = repo[None]
2341 match, pats = scmutil.matchandpats(wctx, pats, opts)
2341 match, pats = scmutil.matchandpats(wctx, pats, opts)
2342 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2342 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2343 if not slowpath:
2343 if not slowpath:
2344 follow = opts.get('follow') or opts.get('follow_first')
2344 follow = opts.get('follow') or opts.get('follow_first')
2345 startctxs = []
2345 startctxs = []
2346 if follow and opts.get('rev'):
2346 if follow and opts.get('rev'):
2347 startctxs = [repo[r] for r in revs]
2347 startctxs = [repo[r] for r in revs]
2348 for f in match.files():
2348 for f in match.files():
2349 if follow and startctxs:
2349 if follow and startctxs:
2350 # No idea if the path was a directory at that revision, so
2350 # No idea if the path was a directory at that revision, so
2351 # take the slow path.
2351 # take the slow path.
2352 if any(f not in c for c in startctxs):
2352 if any(f not in c for c in startctxs):
2353 slowpath = True
2353 slowpath = True
2354 continue
2354 continue
2355 elif follow and f not in wctx:
2355 elif follow and f not in wctx:
2356 # If the file exists, it may be a directory, so let it
2356 # If the file exists, it may be a directory, so let it
2357 # take the slow path.
2357 # take the slow path.
2358 if os.path.exists(repo.wjoin(f)):
2358 if os.path.exists(repo.wjoin(f)):
2359 slowpath = True
2359 slowpath = True
2360 continue
2360 continue
2361 else:
2361 else:
2362 raise error.Abort(_('cannot follow file not in parent '
2362 raise error.Abort(_('cannot follow file not in parent '
2363 'revision: "%s"') % f)
2363 'revision: "%s"') % f)
2364 filelog = repo.file(f)
2364 filelog = repo.file(f)
2365 if not filelog:
2365 if not filelog:
2366 # A zero count may be a directory or deleted file, so
2366 # A zero count may be a directory or deleted file, so
2367 # try to find matching entries on the slow path.
2367 # try to find matching entries on the slow path.
2368 if follow:
2368 if follow:
2369 raise error.Abort(
2369 raise error.Abort(
2370 _('cannot follow nonexistent file: "%s"') % f)
2370 _('cannot follow nonexistent file: "%s"') % f)
2371 slowpath = True
2371 slowpath = True
2372
2372
2373 # We decided to fall back to the slowpath because at least one
2373 # We decided to fall back to the slowpath because at least one
2374 # of the paths was not a file. Check to see if at least one of them
2374 # of the paths was not a file. Check to see if at least one of them
2375 # existed in history - in that case, we'll continue down the
2375 # existed in history - in that case, we'll continue down the
2376 # slowpath; otherwise, we can turn off the slowpath
2376 # slowpath; otherwise, we can turn off the slowpath
2377 if slowpath:
2377 if slowpath:
2378 for path in match.files():
2378 for path in match.files():
2379 if path == '.' or path in repo.store:
2379 if path == '.' or path in repo.store:
2380 break
2380 break
2381 else:
2381 else:
2382 slowpath = False
2382 slowpath = False
2383
2383
2384 return match, pats, slowpath
2384 return match, pats, slowpath
2385
2385
2386 def _fileancestors(repo, revs, match, followfirst):
2386 def _fileancestors(repo, revs, match, followfirst):
2387 fctxs = []
2387 fctxs = []
2388 for r in revs:
2388 for r in revs:
2389 ctx = repo[r]
2389 ctx = repo[r]
2390 fctxs.extend(ctx[f].introfilectx() for f in ctx.walk(match))
2390 fctxs.extend(ctx[f].introfilectx() for f in ctx.walk(match))
2391 return dagop.filerevancestors(fctxs, followfirst=followfirst)
2391
2392
2393 def _makefollowlogfilematcher(repo, files, followfirst):
2394 # When displaying a revision with --patch --follow FILE, we have
2392 # When displaying a revision with --patch --follow FILE, we have
2395 # to know which file of the revision must be diffed. With
2393 # to know which file of the revision must be diffed. With
2396 # --follow, we want the names of the ancestors of FILE in the
2394 # --follow, we want the names of the ancestors of FILE in the
2397 # revision, stored in "fcache". "fcache" is populated by
2395 # revision, stored in "fcache". "fcache" is populated as a side effect
2398 # reproducing the graph traversal already done by --follow revset
2396 # of the graph traversal.
2399 # and relating revs to file names (which is not "correct" but
2400 # good enough).
2401 fcache = {}
2397 fcache = {}
2402 fcacheready = [False]
2403 pctx = repo['.']
2404
2405 def populate():
2406 for fn in files:
2407 fctx = pctx[fn]
2408 fcache.setdefault(fctx.introrev(), set()).add(fctx.path())
2409 for c in fctx.ancestors(followfirst=followfirst):
2410 fcache.setdefault(c.rev(), set()).add(c.path())
2411
2412 def filematcher(rev):
2398 def filematcher(rev):
2413 if not fcacheready[0]:
2414 # Lazy initialization
2415 fcacheready[0] = True
2416 populate()
2417 return scmutil.matchfiles(repo, fcache.get(rev, []))
2399 return scmutil.matchfiles(repo, fcache.get(rev, []))
2418
2400
2419 return filematcher
2401 def revgen():
2402 for rev, cs in dagop.filectxancestors(fctxs, followfirst=followfirst):
2403 fcache[rev] = [c.path() for c in cs]
2404 yield rev
2405 return smartset.generatorset(revgen(), iterasc=False), filematcher
2420
2406
2421 def _makenofollowlogfilematcher(repo, pats, opts):
2407 def _makenofollowlogfilematcher(repo, pats, opts):
2422 '''hook for extensions to override the filematcher for non-follow cases'''
2408 '''hook for extensions to override the filematcher for non-follow cases'''
2423 return None
2409 return None
2424
2410
2425 _opt2logrevset = {
2411 _opt2logrevset = {
2426 'no_merges': ('not merge()', None),
2412 'no_merges': ('not merge()', None),
2427 'only_merges': ('merge()', None),
2413 'only_merges': ('merge()', None),
2428 '_matchfiles': (None, '_matchfiles(%ps)'),
2414 '_matchfiles': (None, '_matchfiles(%ps)'),
2429 'date': ('date(%s)', None),
2415 'date': ('date(%s)', None),
2430 'branch': ('branch(%s)', '%lr'),
2416 'branch': ('branch(%s)', '%lr'),
2431 '_patslog': ('filelog(%s)', '%lr'),
2417 '_patslog': ('filelog(%s)', '%lr'),
2432 'keyword': ('keyword(%s)', '%lr'),
2418 'keyword': ('keyword(%s)', '%lr'),
2433 'prune': ('ancestors(%s)', 'not %lr'),
2419 'prune': ('ancestors(%s)', 'not %lr'),
2434 'user': ('user(%s)', '%lr'),
2420 'user': ('user(%s)', '%lr'),
2435 }
2421 }
2436
2422
2437 def _makelogrevset(repo, match, pats, slowpath, opts):
2423 def _makelogrevset(repo, match, pats, slowpath, opts):
2438 """Return (expr, filematcher) where expr is a revset string built
2424 """Return a revset string built from log options and file patterns"""
2439 from log options and file patterns or None. If --stat or --patch
2440 are not passed filematcher is None. Otherwise it is a callable
2441 taking a revision number and returning a match objects filtering
2442 the files to be detailed when displaying the revision.
2443 """
2444 opts = dict(opts)
2425 opts = dict(opts)
2445 # follow or not follow?
2426 # follow or not follow?
2446 follow = opts.get('follow') or opts.get('follow_first')
2427 follow = opts.get('follow') or opts.get('follow_first')
2447
2428
2448 # branch and only_branch are really aliases and must be handled at
2429 # branch and only_branch are really aliases and must be handled at
2449 # the same time
2430 # the same time
2450 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2431 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2451 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2432 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2452
2433
2453 if slowpath:
2434 if slowpath:
2454 # See walkchangerevs() slow path.
2435 # See walkchangerevs() slow path.
2455 #
2436 #
2456 # pats/include/exclude cannot be represented as separate
2437 # pats/include/exclude cannot be represented as separate
2457 # revset expressions as their filtering logic applies at file
2438 # revset expressions as their filtering logic applies at file
2458 # level. For instance "-I a -X a" matches a revision touching
2439 # level. For instance "-I a -X a" matches a revision touching
2459 # "a" and "b" while "file(a) and not file(b)" does
2440 # "a" and "b" while "file(a) and not file(b)" does
2460 # not. Besides, filesets are evaluated against the working
2441 # not. Besides, filesets are evaluated against the working
2461 # directory.
2442 # directory.
2462 matchargs = ['r:', 'd:relpath']
2443 matchargs = ['r:', 'd:relpath']
2463 for p in pats:
2444 for p in pats:
2464 matchargs.append('p:' + p)
2445 matchargs.append('p:' + p)
2465 for p in opts.get('include', []):
2446 for p in opts.get('include', []):
2466 matchargs.append('i:' + p)
2447 matchargs.append('i:' + p)
2467 for p in opts.get('exclude', []):
2448 for p in opts.get('exclude', []):
2468 matchargs.append('x:' + p)
2449 matchargs.append('x:' + p)
2469 opts['_matchfiles'] = matchargs
2450 opts['_matchfiles'] = matchargs
2470 elif not follow:
2451 elif not follow:
2471 opts['_patslog'] = list(pats)
2452 opts['_patslog'] = list(pats)
2472
2453
2473 filematcher = None
2474 if opts.get('patch') or opts.get('stat'):
2475 # When following files, track renames via a special matcher.
2476 # If we're forced to take the slowpath it means we're following
2477 # at least one pattern/directory, so don't bother with rename tracking.
2478 if follow and not match.always() and not slowpath:
2479 # _makefollowlogfilematcher expects its files argument to be
2480 # relative to the repo root, so use match.files(), not pats.
2481 filematcher = _makefollowlogfilematcher(repo, match.files(),
2482 opts.get('follow_first'))
2483 else:
2484 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2485 if filematcher is None:
2486 filematcher = lambda rev: match
2487
2488 expr = []
2454 expr = []
2489 for op, val in sorted(opts.iteritems()):
2455 for op, val in sorted(opts.iteritems()):
2490 if not val:
2456 if not val:
2491 continue
2457 continue
2492 if op not in _opt2logrevset:
2458 if op not in _opt2logrevset:
2493 continue
2459 continue
2494 revop, listop = _opt2logrevset[op]
2460 revop, listop = _opt2logrevset[op]
2495 if revop and '%' not in revop:
2461 if revop and '%' not in revop:
2496 expr.append(revop)
2462 expr.append(revop)
2497 elif not listop:
2463 elif not listop:
2498 expr.append(revsetlang.formatspec(revop, val))
2464 expr.append(revsetlang.formatspec(revop, val))
2499 else:
2465 else:
2500 if revop:
2466 if revop:
2501 val = [revsetlang.formatspec(revop, v) for v in val]
2467 val = [revsetlang.formatspec(revop, v) for v in val]
2502 expr.append(revsetlang.formatspec(listop, val))
2468 expr.append(revsetlang.formatspec(listop, val))
2503
2469
2504 if expr:
2470 if expr:
2505 expr = '(' + ' and '.join(expr) + ')'
2471 expr = '(' + ' and '.join(expr) + ')'
2506 else:
2472 else:
2507 expr = None
2473 expr = None
2508 return expr, filematcher
2474 return expr
2509
2475
2510 def _logrevs(repo, opts):
2476 def _logrevs(repo, opts):
2511 """Return the initial set of revisions to be filtered or followed"""
2477 """Return the initial set of revisions to be filtered or followed"""
2512 follow = opts.get('follow') or opts.get('follow_first')
2478 follow = opts.get('follow') or opts.get('follow_first')
2513 if opts.get('rev'):
2479 if opts.get('rev'):
2514 revs = scmutil.revrange(repo, opts['rev'])
2480 revs = scmutil.revrange(repo, opts['rev'])
2515 elif follow and repo.dirstate.p1() == nullid:
2481 elif follow and repo.dirstate.p1() == nullid:
2516 revs = smartset.baseset()
2482 revs = smartset.baseset()
2517 elif follow:
2483 elif follow:
2518 revs = repo.revs('.')
2484 revs = repo.revs('.')
2519 else:
2485 else:
2520 revs = smartset.spanset(repo)
2486 revs = smartset.spanset(repo)
2521 revs.reverse()
2487 revs.reverse()
2522 return revs
2488 return revs
2523
2489
2524 def getlogrevs(repo, pats, opts):
2490 def getlogrevs(repo, pats, opts):
2525 """Return (revs, filematcher) where revs is a smartset
2491 """Return (revs, filematcher) where revs is a smartset
2526
2492
2527 If --stat or --patch is not passed, filematcher is None. Otherwise it
2493 filematcher is a callable taking a revision number and returning a match
2528 is a callable taking a revision number and returning a match objects
2494 objects filtering the files to be detailed when displaying the revision.
2529 filtering the files to be detailed when displaying the revision.
2530 """
2495 """
2531 follow = opts.get('follow') or opts.get('follow_first')
2496 follow = opts.get('follow') or opts.get('follow_first')
2532 followfirst = opts.get('follow_first')
2497 followfirst = opts.get('follow_first')
2533 limit = loglimit(opts)
2498 limit = loglimit(opts)
2534 revs = _logrevs(repo, opts)
2499 revs = _logrevs(repo, opts)
2535 if not revs:
2500 if not revs:
2536 return smartset.baseset(), None
2501 return smartset.baseset(), None
2537 match, pats, slowpath = _makelogmatcher(repo, revs, pats, opts)
2502 match, pats, slowpath = _makelogmatcher(repo, revs, pats, opts)
2503 filematcher = None
2538 if follow:
2504 if follow:
2539 if slowpath or match.always():
2505 if slowpath or match.always():
2540 revs = dagop.revancestors(repo, revs, followfirst=followfirst)
2506 revs = dagop.revancestors(repo, revs, followfirst=followfirst)
2541 else:
2507 else:
2542 revs = _fileancestors(repo, revs, match, followfirst)
2508 revs, filematcher = _fileancestors(repo, revs, match, followfirst)
2543 revs.reverse()
2509 revs.reverse()
2544 expr, filematcher = _makelogrevset(repo, match, pats, slowpath, opts)
2510 if filematcher is None:
2511 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2512 if filematcher is None:
2513 def filematcher(rev):
2514 return match
2515
2516 expr = _makelogrevset(repo, match, pats, slowpath, opts)
2545 if opts.get('graph') and opts.get('rev'):
2517 if opts.get('graph') and opts.get('rev'):
2546 # User-specified revs might be unsorted, but don't sort before
2518 # User-specified revs might be unsorted, but don't sort before
2547 # _makelogrevset because it might depend on the order of revs
2519 # _makelogrevset because it might depend on the order of revs
2548 if not (revs.isdescending() or revs.istopo()):
2520 if not (revs.isdescending() or revs.istopo()):
2549 revs.sort(reverse=True)
2521 revs.sort(reverse=True)
2550 if expr:
2522 if expr:
2551 matcher = revset.match(None, expr)
2523 matcher = revset.match(None, expr)
2552 revs = matcher(repo, revs)
2524 revs = matcher(repo, revs)
2553 if limit is not None:
2525 if limit is not None:
2554 revs = revs.slice(0, limit)
2526 revs = revs.slice(0, limit)
2555 return revs, filematcher
2527 return revs, filematcher
2556
2528
2557 def _parselinerangelogopt(repo, opts):
2529 def _parselinerangelogopt(repo, opts):
2558 """Parse --line-range log option and return a list of tuples (filename,
2530 """Parse --line-range log option and return a list of tuples (filename,
2559 (fromline, toline)).
2531 (fromline, toline)).
2560 """
2532 """
2561 linerangebyfname = []
2533 linerangebyfname = []
2562 for pat in opts.get('line_range', []):
2534 for pat in opts.get('line_range', []):
2563 try:
2535 try:
2564 pat, linerange = pat.rsplit(',', 1)
2536 pat, linerange = pat.rsplit(',', 1)
2565 except ValueError:
2537 except ValueError:
2566 raise error.Abort(_('malformatted line-range pattern %s') % pat)
2538 raise error.Abort(_('malformatted line-range pattern %s') % pat)
2567 try:
2539 try:
2568 fromline, toline = map(int, linerange.split(':'))
2540 fromline, toline = map(int, linerange.split(':'))
2569 except ValueError:
2541 except ValueError:
2570 raise error.Abort(_("invalid line range for %s") % pat)
2542 raise error.Abort(_("invalid line range for %s") % pat)
2571 msg = _("line range pattern '%s' must match exactly one file") % pat
2543 msg = _("line range pattern '%s' must match exactly one file") % pat
2572 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
2544 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
2573 linerangebyfname.append(
2545 linerangebyfname.append(
2574 (fname, util.processlinerange(fromline, toline)))
2546 (fname, util.processlinerange(fromline, toline)))
2575 return linerangebyfname
2547 return linerangebyfname
2576
2548
2577 def getloglinerangerevs(repo, userrevs, opts):
2549 def getloglinerangerevs(repo, userrevs, opts):
2578 """Return (revs, filematcher, hunksfilter).
2550 """Return (revs, filematcher, hunksfilter).
2579
2551
2580 "revs" are revisions obtained by processing "line-range" log options and
2552 "revs" are revisions obtained by processing "line-range" log options and
2581 walking block ancestors of each specified file/line-range.
2553 walking block ancestors of each specified file/line-range.
2582
2554
2583 "filematcher(rev) -> match" is a factory function returning a match object
2555 "filematcher(rev) -> match" is a factory function returning a match object
2584 for a given revision for file patterns specified in --line-range option.
2556 for a given revision for file patterns specified in --line-range option.
2585 If neither --stat nor --patch options are passed, "filematcher" is None.
2557 If neither --stat nor --patch options are passed, "filematcher" is None.
2586
2558
2587 "hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function
2559 "hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function
2588 returning a hunks filtering function.
2560 returning a hunks filtering function.
2589 If neither --stat nor --patch options are passed, "filterhunks" is None.
2561 If neither --stat nor --patch options are passed, "filterhunks" is None.
2590 """
2562 """
2591 wctx = repo[None]
2563 wctx = repo[None]
2592
2564
2593 # Two-levels map of "rev -> file ctx -> [line range]".
2565 # Two-levels map of "rev -> file ctx -> [line range]".
2594 linerangesbyrev = {}
2566 linerangesbyrev = {}
2595 for fname, (fromline, toline) in _parselinerangelogopt(repo, opts):
2567 for fname, (fromline, toline) in _parselinerangelogopt(repo, opts):
2596 if fname not in wctx:
2568 if fname not in wctx:
2597 raise error.Abort(_('cannot follow file not in parent '
2569 raise error.Abort(_('cannot follow file not in parent '
2598 'revision: "%s"') % fname)
2570 'revision: "%s"') % fname)
2599 fctx = wctx.filectx(fname)
2571 fctx = wctx.filectx(fname)
2600 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
2572 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
2601 rev = fctx.introrev()
2573 rev = fctx.introrev()
2602 if rev not in userrevs:
2574 if rev not in userrevs:
2603 continue
2575 continue
2604 linerangesbyrev.setdefault(
2576 linerangesbyrev.setdefault(
2605 rev, {}).setdefault(
2577 rev, {}).setdefault(
2606 fctx.path(), []).append(linerange)
2578 fctx.path(), []).append(linerange)
2607
2579
2608 filematcher = None
2580 filematcher = None
2609 hunksfilter = None
2581 hunksfilter = None
2610 if opts.get('patch') or opts.get('stat'):
2582 if opts.get('patch') or opts.get('stat'):
2611
2583
2612 def nofilterhunksfn(fctx, hunks):
2584 def nofilterhunksfn(fctx, hunks):
2613 return hunks
2585 return hunks
2614
2586
2615 def hunksfilter(rev):
2587 def hunksfilter(rev):
2616 fctxlineranges = linerangesbyrev.get(rev)
2588 fctxlineranges = linerangesbyrev.get(rev)
2617 if fctxlineranges is None:
2589 if fctxlineranges is None:
2618 return nofilterhunksfn
2590 return nofilterhunksfn
2619
2591
2620 def filterfn(fctx, hunks):
2592 def filterfn(fctx, hunks):
2621 lineranges = fctxlineranges.get(fctx.path())
2593 lineranges = fctxlineranges.get(fctx.path())
2622 if lineranges is not None:
2594 if lineranges is not None:
2623 for hr, lines in hunks:
2595 for hr, lines in hunks:
2624 if hr is None: # binary
2596 if hr is None: # binary
2625 yield hr, lines
2597 yield hr, lines
2626 continue
2598 continue
2627 if any(mdiff.hunkinrange(hr[2:], lr)
2599 if any(mdiff.hunkinrange(hr[2:], lr)
2628 for lr in lineranges):
2600 for lr in lineranges):
2629 yield hr, lines
2601 yield hr, lines
2630 else:
2602 else:
2631 for hunk in hunks:
2603 for hunk in hunks:
2632 yield hunk
2604 yield hunk
2633
2605
2634 return filterfn
2606 return filterfn
2635
2607
2636 def filematcher(rev):
2608 def filematcher(rev):
2637 files = list(linerangesbyrev.get(rev, []))
2609 files = list(linerangesbyrev.get(rev, []))
2638 return scmutil.matchfiles(repo, files)
2610 return scmutil.matchfiles(repo, files)
2639
2611
2640 revs = sorted(linerangesbyrev, reverse=True)
2612 revs = sorted(linerangesbyrev, reverse=True)
2641
2613
2642 return revs, filematcher, hunksfilter
2614 return revs, filematcher, hunksfilter
2643
2615
2644 def _graphnodeformatter(ui, displayer):
2616 def _graphnodeformatter(ui, displayer):
2645 spec = ui.config('ui', 'graphnodetemplate')
2617 spec = ui.config('ui', 'graphnodetemplate')
2646 if not spec:
2618 if not spec:
2647 return templatekw.showgraphnode # fast path for "{graphnode}"
2619 return templatekw.showgraphnode # fast path for "{graphnode}"
2648
2620
2649 spec = templater.unquotestring(spec)
2621 spec = templater.unquotestring(spec)
2650 tres = formatter.templateresources(ui)
2622 tres = formatter.templateresources(ui)
2651 if isinstance(displayer, changeset_templater):
2623 if isinstance(displayer, changeset_templater):
2652 tres['cache'] = displayer.cache # reuse cache of slow templates
2624 tres['cache'] = displayer.cache # reuse cache of slow templates
2653 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
2625 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
2654 resources=tres)
2626 resources=tres)
2655 def formatnode(repo, ctx):
2627 def formatnode(repo, ctx):
2656 props = {'ctx': ctx, 'repo': repo, 'revcache': {}}
2628 props = {'ctx': ctx, 'repo': repo, 'revcache': {}}
2657 return templ.render(props)
2629 return templ.render(props)
2658 return formatnode
2630 return formatnode
2659
2631
2660 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2632 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2661 filematcher=None, props=None):
2633 filematcher=None, props=None):
2662 props = props or {}
2634 props = props or {}
2663 formatnode = _graphnodeformatter(ui, displayer)
2635 formatnode = _graphnodeformatter(ui, displayer)
2664 state = graphmod.asciistate()
2636 state = graphmod.asciistate()
2665 styles = state['styles']
2637 styles = state['styles']
2666
2638
2667 # only set graph styling if HGPLAIN is not set.
2639 # only set graph styling if HGPLAIN is not set.
2668 if ui.plain('graph'):
2640 if ui.plain('graph'):
2669 # set all edge styles to |, the default pre-3.8 behaviour
2641 # set all edge styles to |, the default pre-3.8 behaviour
2670 styles.update(dict.fromkeys(styles, '|'))
2642 styles.update(dict.fromkeys(styles, '|'))
2671 else:
2643 else:
2672 edgetypes = {
2644 edgetypes = {
2673 'parent': graphmod.PARENT,
2645 'parent': graphmod.PARENT,
2674 'grandparent': graphmod.GRANDPARENT,
2646 'grandparent': graphmod.GRANDPARENT,
2675 'missing': graphmod.MISSINGPARENT
2647 'missing': graphmod.MISSINGPARENT
2676 }
2648 }
2677 for name, key in edgetypes.items():
2649 for name, key in edgetypes.items():
2678 # experimental config: experimental.graphstyle.*
2650 # experimental config: experimental.graphstyle.*
2679 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2651 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2680 styles[key])
2652 styles[key])
2681 if not styles[key]:
2653 if not styles[key]:
2682 styles[key] = None
2654 styles[key] = None
2683
2655
2684 # experimental config: experimental.graphshorten
2656 # experimental config: experimental.graphshorten
2685 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2657 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2686
2658
2687 for rev, type, ctx, parents in dag:
2659 for rev, type, ctx, parents in dag:
2688 char = formatnode(repo, ctx)
2660 char = formatnode(repo, ctx)
2689 copies = None
2661 copies = None
2690 if getrenamed and ctx.rev():
2662 if getrenamed and ctx.rev():
2691 copies = []
2663 copies = []
2692 for fn in ctx.files():
2664 for fn in ctx.files():
2693 rename = getrenamed(fn, ctx.rev())
2665 rename = getrenamed(fn, ctx.rev())
2694 if rename:
2666 if rename:
2695 copies.append((fn, rename[0]))
2667 copies.append((fn, rename[0]))
2696 revmatchfn = None
2668 revmatchfn = None
2697 if filematcher is not None:
2669 if filematcher is not None:
2698 revmatchfn = filematcher(ctx.rev())
2670 revmatchfn = filematcher(ctx.rev())
2699 edges = edgefn(type, char, state, rev, parents)
2671 edges = edgefn(type, char, state, rev, parents)
2700 firstedge = next(edges)
2672 firstedge = next(edges)
2701 width = firstedge[2]
2673 width = firstedge[2]
2702 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2674 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2703 _graphwidth=width, **pycompat.strkwargs(props))
2675 _graphwidth=width, **pycompat.strkwargs(props))
2704 lines = displayer.hunk.pop(rev).split('\n')
2676 lines = displayer.hunk.pop(rev).split('\n')
2705 if not lines[-1]:
2677 if not lines[-1]:
2706 del lines[-1]
2678 del lines[-1]
2707 displayer.flush(ctx)
2679 displayer.flush(ctx)
2708 for type, char, width, coldata in itertools.chain([firstedge], edges):
2680 for type, char, width, coldata in itertools.chain([firstedge], edges):
2709 graphmod.ascii(ui, state, type, char, lines, coldata)
2681 graphmod.ascii(ui, state, type, char, lines, coldata)
2710 lines = []
2682 lines = []
2711 displayer.close()
2683 displayer.close()
2712
2684
2713 def graphlog(ui, repo, revs, filematcher, opts):
2685 def graphlog(ui, repo, revs, filematcher, opts):
2714 # Parameters are identical to log command ones
2686 # Parameters are identical to log command ones
2715 revdag = graphmod.dagwalker(repo, revs)
2687 revdag = graphmod.dagwalker(repo, revs)
2716
2688
2717 getrenamed = None
2689 getrenamed = None
2718 if opts.get('copies'):
2690 if opts.get('copies'):
2719 endrev = None
2691 endrev = None
2720 if opts.get('rev'):
2692 if opts.get('rev'):
2721 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2693 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2722 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2694 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2723
2695
2724 ui.pager('log')
2696 ui.pager('log')
2725 displayer = show_changeset(ui, repo, opts, buffered=True)
2697 displayer = show_changeset(ui, repo, opts, buffered=True)
2726 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2698 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2727 filematcher)
2699 filematcher)
2728
2700
2729 def checkunsupportedgraphflags(pats, opts):
2701 def checkunsupportedgraphflags(pats, opts):
2730 for op in ["newest_first"]:
2702 for op in ["newest_first"]:
2731 if op in opts and opts[op]:
2703 if op in opts and opts[op]:
2732 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2704 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2733 % op.replace("_", "-"))
2705 % op.replace("_", "-"))
2734
2706
2735 def graphrevs(repo, nodes, opts):
2707 def graphrevs(repo, nodes, opts):
2736 limit = loglimit(opts)
2708 limit = loglimit(opts)
2737 nodes.reverse()
2709 nodes.reverse()
2738 if limit is not None:
2710 if limit is not None:
2739 nodes = nodes[:limit]
2711 nodes = nodes[:limit]
2740 return graphmod.nodes(repo, nodes)
2712 return graphmod.nodes(repo, nodes)
2741
2713
2742 def add(ui, repo, match, prefix, explicitonly, **opts):
2714 def add(ui, repo, match, prefix, explicitonly, **opts):
2743 join = lambda f: os.path.join(prefix, f)
2715 join = lambda f: os.path.join(prefix, f)
2744 bad = []
2716 bad = []
2745
2717
2746 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2718 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2747 names = []
2719 names = []
2748 wctx = repo[None]
2720 wctx = repo[None]
2749 cca = None
2721 cca = None
2750 abort, warn = scmutil.checkportabilityalert(ui)
2722 abort, warn = scmutil.checkportabilityalert(ui)
2751 if abort or warn:
2723 if abort or warn:
2752 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2724 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2753
2725
2754 badmatch = matchmod.badmatch(match, badfn)
2726 badmatch = matchmod.badmatch(match, badfn)
2755 dirstate = repo.dirstate
2727 dirstate = repo.dirstate
2756 # We don't want to just call wctx.walk here, since it would return a lot of
2728 # We don't want to just call wctx.walk here, since it would return a lot of
2757 # clean files, which we aren't interested in and takes time.
2729 # clean files, which we aren't interested in and takes time.
2758 for f in sorted(dirstate.walk(badmatch, subrepos=sorted(wctx.substate),
2730 for f in sorted(dirstate.walk(badmatch, subrepos=sorted(wctx.substate),
2759 unknown=True, ignored=False, full=False)):
2731 unknown=True, ignored=False, full=False)):
2760 exact = match.exact(f)
2732 exact = match.exact(f)
2761 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2733 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2762 if cca:
2734 if cca:
2763 cca(f)
2735 cca(f)
2764 names.append(f)
2736 names.append(f)
2765 if ui.verbose or not exact:
2737 if ui.verbose or not exact:
2766 ui.status(_('adding %s\n') % match.rel(f))
2738 ui.status(_('adding %s\n') % match.rel(f))
2767
2739
2768 for subpath in sorted(wctx.substate):
2740 for subpath in sorted(wctx.substate):
2769 sub = wctx.sub(subpath)
2741 sub = wctx.sub(subpath)
2770 try:
2742 try:
2771 submatch = matchmod.subdirmatcher(subpath, match)
2743 submatch = matchmod.subdirmatcher(subpath, match)
2772 if opts.get(r'subrepos'):
2744 if opts.get(r'subrepos'):
2773 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2745 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2774 else:
2746 else:
2775 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2747 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2776 except error.LookupError:
2748 except error.LookupError:
2777 ui.status(_("skipping missing subrepository: %s\n")
2749 ui.status(_("skipping missing subrepository: %s\n")
2778 % join(subpath))
2750 % join(subpath))
2779
2751
2780 if not opts.get(r'dry_run'):
2752 if not opts.get(r'dry_run'):
2781 rejected = wctx.add(names, prefix)
2753 rejected = wctx.add(names, prefix)
2782 bad.extend(f for f in rejected if f in match.files())
2754 bad.extend(f for f in rejected if f in match.files())
2783 return bad
2755 return bad
2784
2756
2785 def addwebdirpath(repo, serverpath, webconf):
2757 def addwebdirpath(repo, serverpath, webconf):
2786 webconf[serverpath] = repo.root
2758 webconf[serverpath] = repo.root
2787 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2759 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2788
2760
2789 for r in repo.revs('filelog("path:.hgsub")'):
2761 for r in repo.revs('filelog("path:.hgsub")'):
2790 ctx = repo[r]
2762 ctx = repo[r]
2791 for subpath in ctx.substate:
2763 for subpath in ctx.substate:
2792 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2764 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2793
2765
2794 def forget(ui, repo, match, prefix, explicitonly):
2766 def forget(ui, repo, match, prefix, explicitonly):
2795 join = lambda f: os.path.join(prefix, f)
2767 join = lambda f: os.path.join(prefix, f)
2796 bad = []
2768 bad = []
2797 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2769 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2798 wctx = repo[None]
2770 wctx = repo[None]
2799 forgot = []
2771 forgot = []
2800
2772
2801 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2773 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2802 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2774 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2803 if explicitonly:
2775 if explicitonly:
2804 forget = [f for f in forget if match.exact(f)]
2776 forget = [f for f in forget if match.exact(f)]
2805
2777
2806 for subpath in sorted(wctx.substate):
2778 for subpath in sorted(wctx.substate):
2807 sub = wctx.sub(subpath)
2779 sub = wctx.sub(subpath)
2808 try:
2780 try:
2809 submatch = matchmod.subdirmatcher(subpath, match)
2781 submatch = matchmod.subdirmatcher(subpath, match)
2810 subbad, subforgot = sub.forget(submatch, prefix)
2782 subbad, subforgot = sub.forget(submatch, prefix)
2811 bad.extend([subpath + '/' + f for f in subbad])
2783 bad.extend([subpath + '/' + f for f in subbad])
2812 forgot.extend([subpath + '/' + f for f in subforgot])
2784 forgot.extend([subpath + '/' + f for f in subforgot])
2813 except error.LookupError:
2785 except error.LookupError:
2814 ui.status(_("skipping missing subrepository: %s\n")
2786 ui.status(_("skipping missing subrepository: %s\n")
2815 % join(subpath))
2787 % join(subpath))
2816
2788
2817 if not explicitonly:
2789 if not explicitonly:
2818 for f in match.files():
2790 for f in match.files():
2819 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2791 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2820 if f not in forgot:
2792 if f not in forgot:
2821 if repo.wvfs.exists(f):
2793 if repo.wvfs.exists(f):
2822 # Don't complain if the exact case match wasn't given.
2794 # Don't complain if the exact case match wasn't given.
2823 # But don't do this until after checking 'forgot', so
2795 # But don't do this until after checking 'forgot', so
2824 # that subrepo files aren't normalized, and this op is
2796 # that subrepo files aren't normalized, and this op is
2825 # purely from data cached by the status walk above.
2797 # purely from data cached by the status walk above.
2826 if repo.dirstate.normalize(f) in repo.dirstate:
2798 if repo.dirstate.normalize(f) in repo.dirstate:
2827 continue
2799 continue
2828 ui.warn(_('not removing %s: '
2800 ui.warn(_('not removing %s: '
2829 'file is already untracked\n')
2801 'file is already untracked\n')
2830 % match.rel(f))
2802 % match.rel(f))
2831 bad.append(f)
2803 bad.append(f)
2832
2804
2833 for f in forget:
2805 for f in forget:
2834 if ui.verbose or not match.exact(f):
2806 if ui.verbose or not match.exact(f):
2835 ui.status(_('removing %s\n') % match.rel(f))
2807 ui.status(_('removing %s\n') % match.rel(f))
2836
2808
2837 rejected = wctx.forget(forget, prefix)
2809 rejected = wctx.forget(forget, prefix)
2838 bad.extend(f for f in rejected if f in match.files())
2810 bad.extend(f for f in rejected if f in match.files())
2839 forgot.extend(f for f in forget if f not in rejected)
2811 forgot.extend(f for f in forget if f not in rejected)
2840 return bad, forgot
2812 return bad, forgot
2841
2813
2842 def files(ui, ctx, m, fm, fmt, subrepos):
2814 def files(ui, ctx, m, fm, fmt, subrepos):
2843 rev = ctx.rev()
2815 rev = ctx.rev()
2844 ret = 1
2816 ret = 1
2845 ds = ctx.repo().dirstate
2817 ds = ctx.repo().dirstate
2846
2818
2847 for f in ctx.matches(m):
2819 for f in ctx.matches(m):
2848 if rev is None and ds[f] == 'r':
2820 if rev is None and ds[f] == 'r':
2849 continue
2821 continue
2850 fm.startitem()
2822 fm.startitem()
2851 if ui.verbose:
2823 if ui.verbose:
2852 fc = ctx[f]
2824 fc = ctx[f]
2853 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2825 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2854 fm.data(abspath=f)
2826 fm.data(abspath=f)
2855 fm.write('path', fmt, m.rel(f))
2827 fm.write('path', fmt, m.rel(f))
2856 ret = 0
2828 ret = 0
2857
2829
2858 for subpath in sorted(ctx.substate):
2830 for subpath in sorted(ctx.substate):
2859 submatch = matchmod.subdirmatcher(subpath, m)
2831 submatch = matchmod.subdirmatcher(subpath, m)
2860 if (subrepos or m.exact(subpath) or any(submatch.files())):
2832 if (subrepos or m.exact(subpath) or any(submatch.files())):
2861 sub = ctx.sub(subpath)
2833 sub = ctx.sub(subpath)
2862 try:
2834 try:
2863 recurse = m.exact(subpath) or subrepos
2835 recurse = m.exact(subpath) or subrepos
2864 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2836 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2865 ret = 0
2837 ret = 0
2866 except error.LookupError:
2838 except error.LookupError:
2867 ui.status(_("skipping missing subrepository: %s\n")
2839 ui.status(_("skipping missing subrepository: %s\n")
2868 % m.abs(subpath))
2840 % m.abs(subpath))
2869
2841
2870 return ret
2842 return ret
2871
2843
2872 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2844 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2873 join = lambda f: os.path.join(prefix, f)
2845 join = lambda f: os.path.join(prefix, f)
2874 ret = 0
2846 ret = 0
2875 s = repo.status(match=m, clean=True)
2847 s = repo.status(match=m, clean=True)
2876 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2848 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2877
2849
2878 wctx = repo[None]
2850 wctx = repo[None]
2879
2851
2880 if warnings is None:
2852 if warnings is None:
2881 warnings = []
2853 warnings = []
2882 warn = True
2854 warn = True
2883 else:
2855 else:
2884 warn = False
2856 warn = False
2885
2857
2886 subs = sorted(wctx.substate)
2858 subs = sorted(wctx.substate)
2887 total = len(subs)
2859 total = len(subs)
2888 count = 0
2860 count = 0
2889 for subpath in subs:
2861 for subpath in subs:
2890 count += 1
2862 count += 1
2891 submatch = matchmod.subdirmatcher(subpath, m)
2863 submatch = matchmod.subdirmatcher(subpath, m)
2892 if subrepos or m.exact(subpath) or any(submatch.files()):
2864 if subrepos or m.exact(subpath) or any(submatch.files()):
2893 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2865 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2894 sub = wctx.sub(subpath)
2866 sub = wctx.sub(subpath)
2895 try:
2867 try:
2896 if sub.removefiles(submatch, prefix, after, force, subrepos,
2868 if sub.removefiles(submatch, prefix, after, force, subrepos,
2897 warnings):
2869 warnings):
2898 ret = 1
2870 ret = 1
2899 except error.LookupError:
2871 except error.LookupError:
2900 warnings.append(_("skipping missing subrepository: %s\n")
2872 warnings.append(_("skipping missing subrepository: %s\n")
2901 % join(subpath))
2873 % join(subpath))
2902 ui.progress(_('searching'), None)
2874 ui.progress(_('searching'), None)
2903
2875
2904 # warn about failure to delete explicit files/dirs
2876 # warn about failure to delete explicit files/dirs
2905 deleteddirs = util.dirs(deleted)
2877 deleteddirs = util.dirs(deleted)
2906 files = m.files()
2878 files = m.files()
2907 total = len(files)
2879 total = len(files)
2908 count = 0
2880 count = 0
2909 for f in files:
2881 for f in files:
2910 def insubrepo():
2882 def insubrepo():
2911 for subpath in wctx.substate:
2883 for subpath in wctx.substate:
2912 if f.startswith(subpath + '/'):
2884 if f.startswith(subpath + '/'):
2913 return True
2885 return True
2914 return False
2886 return False
2915
2887
2916 count += 1
2888 count += 1
2917 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2889 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2918 isdir = f in deleteddirs or wctx.hasdir(f)
2890 isdir = f in deleteddirs or wctx.hasdir(f)
2919 if (f in repo.dirstate or isdir or f == '.'
2891 if (f in repo.dirstate or isdir or f == '.'
2920 or insubrepo() or f in subs):
2892 or insubrepo() or f in subs):
2921 continue
2893 continue
2922
2894
2923 if repo.wvfs.exists(f):
2895 if repo.wvfs.exists(f):
2924 if repo.wvfs.isdir(f):
2896 if repo.wvfs.isdir(f):
2925 warnings.append(_('not removing %s: no tracked files\n')
2897 warnings.append(_('not removing %s: no tracked files\n')
2926 % m.rel(f))
2898 % m.rel(f))
2927 else:
2899 else:
2928 warnings.append(_('not removing %s: file is untracked\n')
2900 warnings.append(_('not removing %s: file is untracked\n')
2929 % m.rel(f))
2901 % m.rel(f))
2930 # missing files will generate a warning elsewhere
2902 # missing files will generate a warning elsewhere
2931 ret = 1
2903 ret = 1
2932 ui.progress(_('deleting'), None)
2904 ui.progress(_('deleting'), None)
2933
2905
2934 if force:
2906 if force:
2935 list = modified + deleted + clean + added
2907 list = modified + deleted + clean + added
2936 elif after:
2908 elif after:
2937 list = deleted
2909 list = deleted
2938 remaining = modified + added + clean
2910 remaining = modified + added + clean
2939 total = len(remaining)
2911 total = len(remaining)
2940 count = 0
2912 count = 0
2941 for f in remaining:
2913 for f in remaining:
2942 count += 1
2914 count += 1
2943 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2915 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2944 if ui.verbose or (f in files):
2916 if ui.verbose or (f in files):
2945 warnings.append(_('not removing %s: file still exists\n')
2917 warnings.append(_('not removing %s: file still exists\n')
2946 % m.rel(f))
2918 % m.rel(f))
2947 ret = 1
2919 ret = 1
2948 ui.progress(_('skipping'), None)
2920 ui.progress(_('skipping'), None)
2949 else:
2921 else:
2950 list = deleted + clean
2922 list = deleted + clean
2951 total = len(modified) + len(added)
2923 total = len(modified) + len(added)
2952 count = 0
2924 count = 0
2953 for f in modified:
2925 for f in modified:
2954 count += 1
2926 count += 1
2955 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2927 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2956 warnings.append(_('not removing %s: file is modified (use -f'
2928 warnings.append(_('not removing %s: file is modified (use -f'
2957 ' to force removal)\n') % m.rel(f))
2929 ' to force removal)\n') % m.rel(f))
2958 ret = 1
2930 ret = 1
2959 for f in added:
2931 for f in added:
2960 count += 1
2932 count += 1
2961 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2933 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2962 warnings.append(_("not removing %s: file has been marked for add"
2934 warnings.append(_("not removing %s: file has been marked for add"
2963 " (use 'hg forget' to undo add)\n") % m.rel(f))
2935 " (use 'hg forget' to undo add)\n") % m.rel(f))
2964 ret = 1
2936 ret = 1
2965 ui.progress(_('skipping'), None)
2937 ui.progress(_('skipping'), None)
2966
2938
2967 list = sorted(list)
2939 list = sorted(list)
2968 total = len(list)
2940 total = len(list)
2969 count = 0
2941 count = 0
2970 for f in list:
2942 for f in list:
2971 count += 1
2943 count += 1
2972 if ui.verbose or not m.exact(f):
2944 if ui.verbose or not m.exact(f):
2973 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2945 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2974 ui.status(_('removing %s\n') % m.rel(f))
2946 ui.status(_('removing %s\n') % m.rel(f))
2975 ui.progress(_('deleting'), None)
2947 ui.progress(_('deleting'), None)
2976
2948
2977 with repo.wlock():
2949 with repo.wlock():
2978 if not after:
2950 if not after:
2979 for f in list:
2951 for f in list:
2980 if f in added:
2952 if f in added:
2981 continue # we never unlink added files on remove
2953 continue # we never unlink added files on remove
2982 repo.wvfs.unlinkpath(f, ignoremissing=True)
2954 repo.wvfs.unlinkpath(f, ignoremissing=True)
2983 repo[None].forget(list)
2955 repo[None].forget(list)
2984
2956
2985 if warn:
2957 if warn:
2986 for warning in warnings:
2958 for warning in warnings:
2987 ui.warn(warning)
2959 ui.warn(warning)
2988
2960
2989 return ret
2961 return ret
2990
2962
2991 def _updatecatformatter(fm, ctx, matcher, path, decode):
2963 def _updatecatformatter(fm, ctx, matcher, path, decode):
2992 """Hook for adding data to the formatter used by ``hg cat``.
2964 """Hook for adding data to the formatter used by ``hg cat``.
2993
2965
2994 Extensions (e.g., lfs) can wrap this to inject keywords/data, but must call
2966 Extensions (e.g., lfs) can wrap this to inject keywords/data, but must call
2995 this method first."""
2967 this method first."""
2996 data = ctx[path].data()
2968 data = ctx[path].data()
2997 if decode:
2969 if decode:
2998 data = ctx.repo().wwritedata(path, data)
2970 data = ctx.repo().wwritedata(path, data)
2999 fm.startitem()
2971 fm.startitem()
3000 fm.write('data', '%s', data)
2972 fm.write('data', '%s', data)
3001 fm.data(abspath=path, path=matcher.rel(path))
2973 fm.data(abspath=path, path=matcher.rel(path))
3002
2974
3003 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2975 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
3004 err = 1
2976 err = 1
3005 opts = pycompat.byteskwargs(opts)
2977 opts = pycompat.byteskwargs(opts)
3006
2978
3007 def write(path):
2979 def write(path):
3008 filename = None
2980 filename = None
3009 if fntemplate:
2981 if fntemplate:
3010 filename = makefilename(repo, fntemplate, ctx.node(),
2982 filename = makefilename(repo, fntemplate, ctx.node(),
3011 pathname=os.path.join(prefix, path))
2983 pathname=os.path.join(prefix, path))
3012 # attempt to create the directory if it does not already exist
2984 # attempt to create the directory if it does not already exist
3013 try:
2985 try:
3014 os.makedirs(os.path.dirname(filename))
2986 os.makedirs(os.path.dirname(filename))
3015 except OSError:
2987 except OSError:
3016 pass
2988 pass
3017 with formatter.maybereopen(basefm, filename, opts) as fm:
2989 with formatter.maybereopen(basefm, filename, opts) as fm:
3018 _updatecatformatter(fm, ctx, matcher, path, opts.get('decode'))
2990 _updatecatformatter(fm, ctx, matcher, path, opts.get('decode'))
3019
2991
3020 # Automation often uses hg cat on single files, so special case it
2992 # Automation often uses hg cat on single files, so special case it
3021 # for performance to avoid the cost of parsing the manifest.
2993 # for performance to avoid the cost of parsing the manifest.
3022 if len(matcher.files()) == 1 and not matcher.anypats():
2994 if len(matcher.files()) == 1 and not matcher.anypats():
3023 file = matcher.files()[0]
2995 file = matcher.files()[0]
3024 mfl = repo.manifestlog
2996 mfl = repo.manifestlog
3025 mfnode = ctx.manifestnode()
2997 mfnode = ctx.manifestnode()
3026 try:
2998 try:
3027 if mfnode and mfl[mfnode].find(file)[0]:
2999 if mfnode and mfl[mfnode].find(file)[0]:
3028 write(file)
3000 write(file)
3029 return 0
3001 return 0
3030 except KeyError:
3002 except KeyError:
3031 pass
3003 pass
3032
3004
3033 for abs in ctx.walk(matcher):
3005 for abs in ctx.walk(matcher):
3034 write(abs)
3006 write(abs)
3035 err = 0
3007 err = 0
3036
3008
3037 for subpath in sorted(ctx.substate):
3009 for subpath in sorted(ctx.substate):
3038 sub = ctx.sub(subpath)
3010 sub = ctx.sub(subpath)
3039 try:
3011 try:
3040 submatch = matchmod.subdirmatcher(subpath, matcher)
3012 submatch = matchmod.subdirmatcher(subpath, matcher)
3041
3013
3042 if not sub.cat(submatch, basefm, fntemplate,
3014 if not sub.cat(submatch, basefm, fntemplate,
3043 os.path.join(prefix, sub._path),
3015 os.path.join(prefix, sub._path),
3044 **pycompat.strkwargs(opts)):
3016 **pycompat.strkwargs(opts)):
3045 err = 0
3017 err = 0
3046 except error.RepoLookupError:
3018 except error.RepoLookupError:
3047 ui.status(_("skipping missing subrepository: %s\n")
3019 ui.status(_("skipping missing subrepository: %s\n")
3048 % os.path.join(prefix, subpath))
3020 % os.path.join(prefix, subpath))
3049
3021
3050 return err
3022 return err
3051
3023
3052 def commit(ui, repo, commitfunc, pats, opts):
3024 def commit(ui, repo, commitfunc, pats, opts):
3053 '''commit the specified files or all outstanding changes'''
3025 '''commit the specified files or all outstanding changes'''
3054 date = opts.get('date')
3026 date = opts.get('date')
3055 if date:
3027 if date:
3056 opts['date'] = util.parsedate(date)
3028 opts['date'] = util.parsedate(date)
3057 message = logmessage(ui, opts)
3029 message = logmessage(ui, opts)
3058 matcher = scmutil.match(repo[None], pats, opts)
3030 matcher = scmutil.match(repo[None], pats, opts)
3059
3031
3060 dsguard = None
3032 dsguard = None
3061 # extract addremove carefully -- this function can be called from a command
3033 # extract addremove carefully -- this function can be called from a command
3062 # that doesn't support addremove
3034 # that doesn't support addremove
3063 if opts.get('addremove'):
3035 if opts.get('addremove'):
3064 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3036 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3065 with dsguard or util.nullcontextmanager():
3037 with dsguard or util.nullcontextmanager():
3066 if dsguard:
3038 if dsguard:
3067 if scmutil.addremove(repo, matcher, "", opts) != 0:
3039 if scmutil.addremove(repo, matcher, "", opts) != 0:
3068 raise error.Abort(
3040 raise error.Abort(
3069 _("failed to mark all new/missing files as added/removed"))
3041 _("failed to mark all new/missing files as added/removed"))
3070
3042
3071 return commitfunc(ui, repo, message, matcher, opts)
3043 return commitfunc(ui, repo, message, matcher, opts)
3072
3044
3073 def samefile(f, ctx1, ctx2):
3045 def samefile(f, ctx1, ctx2):
3074 if f in ctx1.manifest():
3046 if f in ctx1.manifest():
3075 a = ctx1.filectx(f)
3047 a = ctx1.filectx(f)
3076 if f in ctx2.manifest():
3048 if f in ctx2.manifest():
3077 b = ctx2.filectx(f)
3049 b = ctx2.filectx(f)
3078 return (not a.cmp(b)
3050 return (not a.cmp(b)
3079 and a.flags() == b.flags())
3051 and a.flags() == b.flags())
3080 else:
3052 else:
3081 return False
3053 return False
3082 else:
3054 else:
3083 return f not in ctx2.manifest()
3055 return f not in ctx2.manifest()
3084
3056
3085 def amend(ui, repo, old, extra, pats, opts):
3057 def amend(ui, repo, old, extra, pats, opts):
3086 # avoid cycle context -> subrepo -> cmdutil
3058 # avoid cycle context -> subrepo -> cmdutil
3087 from . import context
3059 from . import context
3088
3060
3089 # amend will reuse the existing user if not specified, but the obsolete
3061 # amend will reuse the existing user if not specified, but the obsolete
3090 # marker creation requires that the current user's name is specified.
3062 # marker creation requires that the current user's name is specified.
3091 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3063 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3092 ui.username() # raise exception if username not set
3064 ui.username() # raise exception if username not set
3093
3065
3094 ui.note(_('amending changeset %s\n') % old)
3066 ui.note(_('amending changeset %s\n') % old)
3095 base = old.p1()
3067 base = old.p1()
3096
3068
3097 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3069 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3098 # Participating changesets:
3070 # Participating changesets:
3099 #
3071 #
3100 # wctx o - workingctx that contains changes from working copy
3072 # wctx o - workingctx that contains changes from working copy
3101 # | to go into amending commit
3073 # | to go into amending commit
3102 # |
3074 # |
3103 # old o - changeset to amend
3075 # old o - changeset to amend
3104 # |
3076 # |
3105 # base o - first parent of the changeset to amend
3077 # base o - first parent of the changeset to amend
3106 wctx = repo[None]
3078 wctx = repo[None]
3107
3079
3108 # Copy to avoid mutating input
3080 # Copy to avoid mutating input
3109 extra = extra.copy()
3081 extra = extra.copy()
3110 # Update extra dict from amended commit (e.g. to preserve graft
3082 # Update extra dict from amended commit (e.g. to preserve graft
3111 # source)
3083 # source)
3112 extra.update(old.extra())
3084 extra.update(old.extra())
3113
3085
3114 # Also update it from the from the wctx
3086 # Also update it from the from the wctx
3115 extra.update(wctx.extra())
3087 extra.update(wctx.extra())
3116
3088
3117 user = opts.get('user') or old.user()
3089 user = opts.get('user') or old.user()
3118 date = opts.get('date') or old.date()
3090 date = opts.get('date') or old.date()
3119
3091
3120 # Parse the date to allow comparison between date and old.date()
3092 # Parse the date to allow comparison between date and old.date()
3121 date = util.parsedate(date)
3093 date = util.parsedate(date)
3122
3094
3123 if len(old.parents()) > 1:
3095 if len(old.parents()) > 1:
3124 # ctx.files() isn't reliable for merges, so fall back to the
3096 # ctx.files() isn't reliable for merges, so fall back to the
3125 # slower repo.status() method
3097 # slower repo.status() method
3126 files = set([fn for st in repo.status(base, old)[:3]
3098 files = set([fn for st in repo.status(base, old)[:3]
3127 for fn in st])
3099 for fn in st])
3128 else:
3100 else:
3129 files = set(old.files())
3101 files = set(old.files())
3130
3102
3131 # add/remove the files to the working copy if the "addremove" option
3103 # add/remove the files to the working copy if the "addremove" option
3132 # was specified.
3104 # was specified.
3133 matcher = scmutil.match(wctx, pats, opts)
3105 matcher = scmutil.match(wctx, pats, opts)
3134 if (opts.get('addremove')
3106 if (opts.get('addremove')
3135 and scmutil.addremove(repo, matcher, "", opts)):
3107 and scmutil.addremove(repo, matcher, "", opts)):
3136 raise error.Abort(
3108 raise error.Abort(
3137 _("failed to mark all new/missing files as added/removed"))
3109 _("failed to mark all new/missing files as added/removed"))
3138
3110
3139 # Check subrepos. This depends on in-place wctx._status update in
3111 # Check subrepos. This depends on in-place wctx._status update in
3140 # subrepo.precommit(). To minimize the risk of this hack, we do
3112 # subrepo.precommit(). To minimize the risk of this hack, we do
3141 # nothing if .hgsub does not exist.
3113 # nothing if .hgsub does not exist.
3142 if '.hgsub' in wctx or '.hgsub' in old:
3114 if '.hgsub' in wctx or '.hgsub' in old:
3143 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil
3115 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil
3144 subs, commitsubs, newsubstate = subrepo.precommit(
3116 subs, commitsubs, newsubstate = subrepo.precommit(
3145 ui, wctx, wctx._status, matcher)
3117 ui, wctx, wctx._status, matcher)
3146 # amend should abort if commitsubrepos is enabled
3118 # amend should abort if commitsubrepos is enabled
3147 assert not commitsubs
3119 assert not commitsubs
3148 if subs:
3120 if subs:
3149 subrepo.writestate(repo, newsubstate)
3121 subrepo.writestate(repo, newsubstate)
3150
3122
3151 filestoamend = set(f for f in wctx.files() if matcher(f))
3123 filestoamend = set(f for f in wctx.files() if matcher(f))
3152
3124
3153 changes = (len(filestoamend) > 0)
3125 changes = (len(filestoamend) > 0)
3154 if changes:
3126 if changes:
3155 # Recompute copies (avoid recording a -> b -> a)
3127 # Recompute copies (avoid recording a -> b -> a)
3156 copied = copies.pathcopies(base, wctx, matcher)
3128 copied = copies.pathcopies(base, wctx, matcher)
3157 if old.p2:
3129 if old.p2:
3158 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
3130 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
3159
3131
3160 # Prune files which were reverted by the updates: if old
3132 # Prune files which were reverted by the updates: if old
3161 # introduced file X and the file was renamed in the working
3133 # introduced file X and the file was renamed in the working
3162 # copy, then those two files are the same and
3134 # copy, then those two files are the same and
3163 # we can discard X from our list of files. Likewise if X
3135 # we can discard X from our list of files. Likewise if X
3164 # was removed, it's no longer relevant. If X is missing (aka
3136 # was removed, it's no longer relevant. If X is missing (aka
3165 # deleted), old X must be preserved.
3137 # deleted), old X must be preserved.
3166 files.update(filestoamend)
3138 files.update(filestoamend)
3167 files = [f for f in files if (not samefile(f, wctx, base)
3139 files = [f for f in files if (not samefile(f, wctx, base)
3168 or f in wctx.deleted())]
3140 or f in wctx.deleted())]
3169
3141
3170 def filectxfn(repo, ctx_, path):
3142 def filectxfn(repo, ctx_, path):
3171 try:
3143 try:
3172 # If the file being considered is not amongst the files
3144 # If the file being considered is not amongst the files
3173 # to be amended, we should return the file context from the
3145 # to be amended, we should return the file context from the
3174 # old changeset. This avoids issues when only some files in
3146 # old changeset. This avoids issues when only some files in
3175 # the working copy are being amended but there are also
3147 # the working copy are being amended but there are also
3176 # changes to other files from the old changeset.
3148 # changes to other files from the old changeset.
3177 if path not in filestoamend:
3149 if path not in filestoamend:
3178 return old.filectx(path)
3150 return old.filectx(path)
3179
3151
3180 # Return None for removed files.
3152 # Return None for removed files.
3181 if path in wctx.removed():
3153 if path in wctx.removed():
3182 return None
3154 return None
3183
3155
3184 fctx = wctx[path]
3156 fctx = wctx[path]
3185 flags = fctx.flags()
3157 flags = fctx.flags()
3186 mctx = context.memfilectx(repo, ctx_,
3158 mctx = context.memfilectx(repo, ctx_,
3187 fctx.path(), fctx.data(),
3159 fctx.path(), fctx.data(),
3188 islink='l' in flags,
3160 islink='l' in flags,
3189 isexec='x' in flags,
3161 isexec='x' in flags,
3190 copied=copied.get(path))
3162 copied=copied.get(path))
3191 return mctx
3163 return mctx
3192 except KeyError:
3164 except KeyError:
3193 return None
3165 return None
3194 else:
3166 else:
3195 ui.note(_('copying changeset %s to %s\n') % (old, base))
3167 ui.note(_('copying changeset %s to %s\n') % (old, base))
3196
3168
3197 # Use version of files as in the old cset
3169 # Use version of files as in the old cset
3198 def filectxfn(repo, ctx_, path):
3170 def filectxfn(repo, ctx_, path):
3199 try:
3171 try:
3200 return old.filectx(path)
3172 return old.filectx(path)
3201 except KeyError:
3173 except KeyError:
3202 return None
3174 return None
3203
3175
3204 # See if we got a message from -m or -l, if not, open the editor with
3176 # See if we got a message from -m or -l, if not, open the editor with
3205 # the message of the changeset to amend.
3177 # the message of the changeset to amend.
3206 message = logmessage(ui, opts)
3178 message = logmessage(ui, opts)
3207
3179
3208 editform = mergeeditform(old, 'commit.amend')
3180 editform = mergeeditform(old, 'commit.amend')
3209 editor = getcommiteditor(editform=editform,
3181 editor = getcommiteditor(editform=editform,
3210 **pycompat.strkwargs(opts))
3182 **pycompat.strkwargs(opts))
3211
3183
3212 if not message:
3184 if not message:
3213 editor = getcommiteditor(edit=True, editform=editform)
3185 editor = getcommiteditor(edit=True, editform=editform)
3214 message = old.description()
3186 message = old.description()
3215
3187
3216 pureextra = extra.copy()
3188 pureextra = extra.copy()
3217 extra['amend_source'] = old.hex()
3189 extra['amend_source'] = old.hex()
3218
3190
3219 new = context.memctx(repo,
3191 new = context.memctx(repo,
3220 parents=[base.node(), old.p2().node()],
3192 parents=[base.node(), old.p2().node()],
3221 text=message,
3193 text=message,
3222 files=files,
3194 files=files,
3223 filectxfn=filectxfn,
3195 filectxfn=filectxfn,
3224 user=user,
3196 user=user,
3225 date=date,
3197 date=date,
3226 extra=extra,
3198 extra=extra,
3227 editor=editor)
3199 editor=editor)
3228
3200
3229 newdesc = changelog.stripdesc(new.description())
3201 newdesc = changelog.stripdesc(new.description())
3230 if ((not changes)
3202 if ((not changes)
3231 and newdesc == old.description()
3203 and newdesc == old.description()
3232 and user == old.user()
3204 and user == old.user()
3233 and date == old.date()
3205 and date == old.date()
3234 and pureextra == old.extra()):
3206 and pureextra == old.extra()):
3235 # nothing changed. continuing here would create a new node
3207 # nothing changed. continuing here would create a new node
3236 # anyway because of the amend_source noise.
3208 # anyway because of the amend_source noise.
3237 #
3209 #
3238 # This not what we expect from amend.
3210 # This not what we expect from amend.
3239 return old.node()
3211 return old.node()
3240
3212
3241 if opts.get('secret'):
3213 if opts.get('secret'):
3242 commitphase = 'secret'
3214 commitphase = 'secret'
3243 else:
3215 else:
3244 commitphase = old.phase()
3216 commitphase = old.phase()
3245 overrides = {('phases', 'new-commit'): commitphase}
3217 overrides = {('phases', 'new-commit'): commitphase}
3246 with ui.configoverride(overrides, 'amend'):
3218 with ui.configoverride(overrides, 'amend'):
3247 newid = repo.commitctx(new)
3219 newid = repo.commitctx(new)
3248
3220
3249 # Reroute the working copy parent to the new changeset
3221 # Reroute the working copy parent to the new changeset
3250 repo.setparents(newid, nullid)
3222 repo.setparents(newid, nullid)
3251 mapping = {old.node(): (newid,)}
3223 mapping = {old.node(): (newid,)}
3252 obsmetadata = None
3224 obsmetadata = None
3253 if opts.get('note'):
3225 if opts.get('note'):
3254 obsmetadata = {'note': opts['note']}
3226 obsmetadata = {'note': opts['note']}
3255 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
3227 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
3256
3228
3257 # Fixing the dirstate because localrepo.commitctx does not update
3229 # Fixing the dirstate because localrepo.commitctx does not update
3258 # it. This is rather convenient because we did not need to update
3230 # it. This is rather convenient because we did not need to update
3259 # the dirstate for all the files in the new commit which commitctx
3231 # the dirstate for all the files in the new commit which commitctx
3260 # could have done if it updated the dirstate. Now, we can
3232 # could have done if it updated the dirstate. Now, we can
3261 # selectively update the dirstate only for the amended files.
3233 # selectively update the dirstate only for the amended files.
3262 dirstate = repo.dirstate
3234 dirstate = repo.dirstate
3263
3235
3264 # Update the state of the files which were added and
3236 # Update the state of the files which were added and
3265 # and modified in the amend to "normal" in the dirstate.
3237 # and modified in the amend to "normal" in the dirstate.
3266 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend
3238 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend
3267 for f in normalfiles:
3239 for f in normalfiles:
3268 dirstate.normal(f)
3240 dirstate.normal(f)
3269
3241
3270 # Update the state of files which were removed in the amend
3242 # Update the state of files which were removed in the amend
3271 # to "removed" in the dirstate.
3243 # to "removed" in the dirstate.
3272 removedfiles = set(wctx.removed()) & filestoamend
3244 removedfiles = set(wctx.removed()) & filestoamend
3273 for f in removedfiles:
3245 for f in removedfiles:
3274 dirstate.drop(f)
3246 dirstate.drop(f)
3275
3247
3276 return newid
3248 return newid
3277
3249
3278 def commiteditor(repo, ctx, subs, editform=''):
3250 def commiteditor(repo, ctx, subs, editform=''):
3279 if ctx.description():
3251 if ctx.description():
3280 return ctx.description()
3252 return ctx.description()
3281 return commitforceeditor(repo, ctx, subs, editform=editform,
3253 return commitforceeditor(repo, ctx, subs, editform=editform,
3282 unchangedmessagedetection=True)
3254 unchangedmessagedetection=True)
3283
3255
3284 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3256 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3285 editform='', unchangedmessagedetection=False):
3257 editform='', unchangedmessagedetection=False):
3286 if not extramsg:
3258 if not extramsg:
3287 extramsg = _("Leave message empty to abort commit.")
3259 extramsg = _("Leave message empty to abort commit.")
3288
3260
3289 forms = [e for e in editform.split('.') if e]
3261 forms = [e for e in editform.split('.') if e]
3290 forms.insert(0, 'changeset')
3262 forms.insert(0, 'changeset')
3291 templatetext = None
3263 templatetext = None
3292 while forms:
3264 while forms:
3293 ref = '.'.join(forms)
3265 ref = '.'.join(forms)
3294 if repo.ui.config('committemplate', ref):
3266 if repo.ui.config('committemplate', ref):
3295 templatetext = committext = buildcommittemplate(
3267 templatetext = committext = buildcommittemplate(
3296 repo, ctx, subs, extramsg, ref)
3268 repo, ctx, subs, extramsg, ref)
3297 break
3269 break
3298 forms.pop()
3270 forms.pop()
3299 else:
3271 else:
3300 committext = buildcommittext(repo, ctx, subs, extramsg)
3272 committext = buildcommittext(repo, ctx, subs, extramsg)
3301
3273
3302 # run editor in the repository root
3274 # run editor in the repository root
3303 olddir = pycompat.getcwd()
3275 olddir = pycompat.getcwd()
3304 os.chdir(repo.root)
3276 os.chdir(repo.root)
3305
3277
3306 # make in-memory changes visible to external process
3278 # make in-memory changes visible to external process
3307 tr = repo.currenttransaction()
3279 tr = repo.currenttransaction()
3308 repo.dirstate.write(tr)
3280 repo.dirstate.write(tr)
3309 pending = tr and tr.writepending() and repo.root
3281 pending = tr and tr.writepending() and repo.root
3310
3282
3311 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3283 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3312 editform=editform, pending=pending,
3284 editform=editform, pending=pending,
3313 repopath=repo.path, action='commit')
3285 repopath=repo.path, action='commit')
3314 text = editortext
3286 text = editortext
3315
3287
3316 # strip away anything below this special string (used for editors that want
3288 # strip away anything below this special string (used for editors that want
3317 # to display the diff)
3289 # to display the diff)
3318 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3290 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3319 if stripbelow:
3291 if stripbelow:
3320 text = text[:stripbelow.start()]
3292 text = text[:stripbelow.start()]
3321
3293
3322 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3294 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3323 os.chdir(olddir)
3295 os.chdir(olddir)
3324
3296
3325 if finishdesc:
3297 if finishdesc:
3326 text = finishdesc(text)
3298 text = finishdesc(text)
3327 if not text.strip():
3299 if not text.strip():
3328 raise error.Abort(_("empty commit message"))
3300 raise error.Abort(_("empty commit message"))
3329 if unchangedmessagedetection and editortext == templatetext:
3301 if unchangedmessagedetection and editortext == templatetext:
3330 raise error.Abort(_("commit message unchanged"))
3302 raise error.Abort(_("commit message unchanged"))
3331
3303
3332 return text
3304 return text
3333
3305
3334 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3306 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3335 ui = repo.ui
3307 ui = repo.ui
3336 spec = formatter.templatespec(ref, None, None)
3308 spec = formatter.templatespec(ref, None, None)
3337 t = changeset_templater(ui, repo, spec, None, {}, False)
3309 t = changeset_templater(ui, repo, spec, None, {}, False)
3338 t.t.cache.update((k, templater.unquotestring(v))
3310 t.t.cache.update((k, templater.unquotestring(v))
3339 for k, v in repo.ui.configitems('committemplate'))
3311 for k, v in repo.ui.configitems('committemplate'))
3340
3312
3341 if not extramsg:
3313 if not extramsg:
3342 extramsg = '' # ensure that extramsg is string
3314 extramsg = '' # ensure that extramsg is string
3343
3315
3344 ui.pushbuffer()
3316 ui.pushbuffer()
3345 t.show(ctx, extramsg=extramsg)
3317 t.show(ctx, extramsg=extramsg)
3346 return ui.popbuffer()
3318 return ui.popbuffer()
3347
3319
3348 def hgprefix(msg):
3320 def hgprefix(msg):
3349 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3321 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3350
3322
3351 def buildcommittext(repo, ctx, subs, extramsg):
3323 def buildcommittext(repo, ctx, subs, extramsg):
3352 edittext = []
3324 edittext = []
3353 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3325 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3354 if ctx.description():
3326 if ctx.description():
3355 edittext.append(ctx.description())
3327 edittext.append(ctx.description())
3356 edittext.append("")
3328 edittext.append("")
3357 edittext.append("") # Empty line between message and comments.
3329 edittext.append("") # Empty line between message and comments.
3358 edittext.append(hgprefix(_("Enter commit message."
3330 edittext.append(hgprefix(_("Enter commit message."
3359 " Lines beginning with 'HG:' are removed.")))
3331 " Lines beginning with 'HG:' are removed.")))
3360 edittext.append(hgprefix(extramsg))
3332 edittext.append(hgprefix(extramsg))
3361 edittext.append("HG: --")
3333 edittext.append("HG: --")
3362 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3334 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3363 if ctx.p2():
3335 if ctx.p2():
3364 edittext.append(hgprefix(_("branch merge")))
3336 edittext.append(hgprefix(_("branch merge")))
3365 if ctx.branch():
3337 if ctx.branch():
3366 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3338 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3367 if bookmarks.isactivewdirparent(repo):
3339 if bookmarks.isactivewdirparent(repo):
3368 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3340 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3369 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3341 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3370 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3342 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3371 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3343 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3372 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3344 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3373 if not added and not modified and not removed:
3345 if not added and not modified and not removed:
3374 edittext.append(hgprefix(_("no files changed")))
3346 edittext.append(hgprefix(_("no files changed")))
3375 edittext.append("")
3347 edittext.append("")
3376
3348
3377 return "\n".join(edittext)
3349 return "\n".join(edittext)
3378
3350
3379 def commitstatus(repo, node, branch, bheads=None, opts=None):
3351 def commitstatus(repo, node, branch, bheads=None, opts=None):
3380 if opts is None:
3352 if opts is None:
3381 opts = {}
3353 opts = {}
3382 ctx = repo[node]
3354 ctx = repo[node]
3383 parents = ctx.parents()
3355 parents = ctx.parents()
3384
3356
3385 if (not opts.get('amend') and bheads and node not in bheads and not
3357 if (not opts.get('amend') and bheads and node not in bheads and not
3386 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3358 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3387 repo.ui.status(_('created new head\n'))
3359 repo.ui.status(_('created new head\n'))
3388 # The message is not printed for initial roots. For the other
3360 # The message is not printed for initial roots. For the other
3389 # changesets, it is printed in the following situations:
3361 # changesets, it is printed in the following situations:
3390 #
3362 #
3391 # Par column: for the 2 parents with ...
3363 # Par column: for the 2 parents with ...
3392 # N: null or no parent
3364 # N: null or no parent
3393 # B: parent is on another named branch
3365 # B: parent is on another named branch
3394 # C: parent is a regular non head changeset
3366 # C: parent is a regular non head changeset
3395 # H: parent was a branch head of the current branch
3367 # H: parent was a branch head of the current branch
3396 # Msg column: whether we print "created new head" message
3368 # Msg column: whether we print "created new head" message
3397 # In the following, it is assumed that there already exists some
3369 # In the following, it is assumed that there already exists some
3398 # initial branch heads of the current branch, otherwise nothing is
3370 # initial branch heads of the current branch, otherwise nothing is
3399 # printed anyway.
3371 # printed anyway.
3400 #
3372 #
3401 # Par Msg Comment
3373 # Par Msg Comment
3402 # N N y additional topo root
3374 # N N y additional topo root
3403 #
3375 #
3404 # B N y additional branch root
3376 # B N y additional branch root
3405 # C N y additional topo head
3377 # C N y additional topo head
3406 # H N n usual case
3378 # H N n usual case
3407 #
3379 #
3408 # B B y weird additional branch root
3380 # B B y weird additional branch root
3409 # C B y branch merge
3381 # C B y branch merge
3410 # H B n merge with named branch
3382 # H B n merge with named branch
3411 #
3383 #
3412 # C C y additional head from merge
3384 # C C y additional head from merge
3413 # C H n merge with a head
3385 # C H n merge with a head
3414 #
3386 #
3415 # H H n head merge: head count decreases
3387 # H H n head merge: head count decreases
3416
3388
3417 if not opts.get('close_branch'):
3389 if not opts.get('close_branch'):
3418 for r in parents:
3390 for r in parents:
3419 if r.closesbranch() and r.branch() == branch:
3391 if r.closesbranch() and r.branch() == branch:
3420 repo.ui.status(_('reopening closed branch head %d\n') % r)
3392 repo.ui.status(_('reopening closed branch head %d\n') % r)
3421
3393
3422 if repo.ui.debugflag:
3394 if repo.ui.debugflag:
3423 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3395 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3424 elif repo.ui.verbose:
3396 elif repo.ui.verbose:
3425 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3397 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3426
3398
3427 def postcommitstatus(repo, pats, opts):
3399 def postcommitstatus(repo, pats, opts):
3428 return repo.status(match=scmutil.match(repo[None], pats, opts))
3400 return repo.status(match=scmutil.match(repo[None], pats, opts))
3429
3401
3430 def revert(ui, repo, ctx, parents, *pats, **opts):
3402 def revert(ui, repo, ctx, parents, *pats, **opts):
3431 opts = pycompat.byteskwargs(opts)
3403 opts = pycompat.byteskwargs(opts)
3432 parent, p2 = parents
3404 parent, p2 = parents
3433 node = ctx.node()
3405 node = ctx.node()
3434
3406
3435 mf = ctx.manifest()
3407 mf = ctx.manifest()
3436 if node == p2:
3408 if node == p2:
3437 parent = p2
3409 parent = p2
3438
3410
3439 # need all matching names in dirstate and manifest of target rev,
3411 # need all matching names in dirstate and manifest of target rev,
3440 # so have to walk both. do not print errors if files exist in one
3412 # so have to walk both. do not print errors if files exist in one
3441 # but not other. in both cases, filesets should be evaluated against
3413 # but not other. in both cases, filesets should be evaluated against
3442 # workingctx to get consistent result (issue4497). this means 'set:**'
3414 # workingctx to get consistent result (issue4497). this means 'set:**'
3443 # cannot be used to select missing files from target rev.
3415 # cannot be used to select missing files from target rev.
3444
3416
3445 # `names` is a mapping for all elements in working copy and target revision
3417 # `names` is a mapping for all elements in working copy and target revision
3446 # The mapping is in the form:
3418 # The mapping is in the form:
3447 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3419 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3448 names = {}
3420 names = {}
3449
3421
3450 with repo.wlock():
3422 with repo.wlock():
3451 ## filling of the `names` mapping
3423 ## filling of the `names` mapping
3452 # walk dirstate to fill `names`
3424 # walk dirstate to fill `names`
3453
3425
3454 interactive = opts.get('interactive', False)
3426 interactive = opts.get('interactive', False)
3455 wctx = repo[None]
3427 wctx = repo[None]
3456 m = scmutil.match(wctx, pats, opts)
3428 m = scmutil.match(wctx, pats, opts)
3457
3429
3458 # we'll need this later
3430 # we'll need this later
3459 targetsubs = sorted(s for s in wctx.substate if m(s))
3431 targetsubs = sorted(s for s in wctx.substate if m(s))
3460
3432
3461 if not m.always():
3433 if not m.always():
3462 matcher = matchmod.badmatch(m, lambda x, y: False)
3434 matcher = matchmod.badmatch(m, lambda x, y: False)
3463 for abs in wctx.walk(matcher):
3435 for abs in wctx.walk(matcher):
3464 names[abs] = m.rel(abs), m.exact(abs)
3436 names[abs] = m.rel(abs), m.exact(abs)
3465
3437
3466 # walk target manifest to fill `names`
3438 # walk target manifest to fill `names`
3467
3439
3468 def badfn(path, msg):
3440 def badfn(path, msg):
3469 if path in names:
3441 if path in names:
3470 return
3442 return
3471 if path in ctx.substate:
3443 if path in ctx.substate:
3472 return
3444 return
3473 path_ = path + '/'
3445 path_ = path + '/'
3474 for f in names:
3446 for f in names:
3475 if f.startswith(path_):
3447 if f.startswith(path_):
3476 return
3448 return
3477 ui.warn("%s: %s\n" % (m.rel(path), msg))
3449 ui.warn("%s: %s\n" % (m.rel(path), msg))
3478
3450
3479 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3451 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3480 if abs not in names:
3452 if abs not in names:
3481 names[abs] = m.rel(abs), m.exact(abs)
3453 names[abs] = m.rel(abs), m.exact(abs)
3482
3454
3483 # Find status of all file in `names`.
3455 # Find status of all file in `names`.
3484 m = scmutil.matchfiles(repo, names)
3456 m = scmutil.matchfiles(repo, names)
3485
3457
3486 changes = repo.status(node1=node, match=m,
3458 changes = repo.status(node1=node, match=m,
3487 unknown=True, ignored=True, clean=True)
3459 unknown=True, ignored=True, clean=True)
3488 else:
3460 else:
3489 changes = repo.status(node1=node, match=m)
3461 changes = repo.status(node1=node, match=m)
3490 for kind in changes:
3462 for kind in changes:
3491 for abs in kind:
3463 for abs in kind:
3492 names[abs] = m.rel(abs), m.exact(abs)
3464 names[abs] = m.rel(abs), m.exact(abs)
3493
3465
3494 m = scmutil.matchfiles(repo, names)
3466 m = scmutil.matchfiles(repo, names)
3495
3467
3496 modified = set(changes.modified)
3468 modified = set(changes.modified)
3497 added = set(changes.added)
3469 added = set(changes.added)
3498 removed = set(changes.removed)
3470 removed = set(changes.removed)
3499 _deleted = set(changes.deleted)
3471 _deleted = set(changes.deleted)
3500 unknown = set(changes.unknown)
3472 unknown = set(changes.unknown)
3501 unknown.update(changes.ignored)
3473 unknown.update(changes.ignored)
3502 clean = set(changes.clean)
3474 clean = set(changes.clean)
3503 modadded = set()
3475 modadded = set()
3504
3476
3505 # We need to account for the state of the file in the dirstate,
3477 # We need to account for the state of the file in the dirstate,
3506 # even when we revert against something else than parent. This will
3478 # even when we revert against something else than parent. This will
3507 # slightly alter the behavior of revert (doing back up or not, delete
3479 # slightly alter the behavior of revert (doing back up or not, delete
3508 # or just forget etc).
3480 # or just forget etc).
3509 if parent == node:
3481 if parent == node:
3510 dsmodified = modified
3482 dsmodified = modified
3511 dsadded = added
3483 dsadded = added
3512 dsremoved = removed
3484 dsremoved = removed
3513 # store all local modifications, useful later for rename detection
3485 # store all local modifications, useful later for rename detection
3514 localchanges = dsmodified | dsadded
3486 localchanges = dsmodified | dsadded
3515 modified, added, removed = set(), set(), set()
3487 modified, added, removed = set(), set(), set()
3516 else:
3488 else:
3517 changes = repo.status(node1=parent, match=m)
3489 changes = repo.status(node1=parent, match=m)
3518 dsmodified = set(changes.modified)
3490 dsmodified = set(changes.modified)
3519 dsadded = set(changes.added)
3491 dsadded = set(changes.added)
3520 dsremoved = set(changes.removed)
3492 dsremoved = set(changes.removed)
3521 # store all local modifications, useful later for rename detection
3493 # store all local modifications, useful later for rename detection
3522 localchanges = dsmodified | dsadded
3494 localchanges = dsmodified | dsadded
3523
3495
3524 # only take into account for removes between wc and target
3496 # only take into account for removes between wc and target
3525 clean |= dsremoved - removed
3497 clean |= dsremoved - removed
3526 dsremoved &= removed
3498 dsremoved &= removed
3527 # distinct between dirstate remove and other
3499 # distinct between dirstate remove and other
3528 removed -= dsremoved
3500 removed -= dsremoved
3529
3501
3530 modadded = added & dsmodified
3502 modadded = added & dsmodified
3531 added -= modadded
3503 added -= modadded
3532
3504
3533 # tell newly modified apart.
3505 # tell newly modified apart.
3534 dsmodified &= modified
3506 dsmodified &= modified
3535 dsmodified |= modified & dsadded # dirstate added may need backup
3507 dsmodified |= modified & dsadded # dirstate added may need backup
3536 modified -= dsmodified
3508 modified -= dsmodified
3537
3509
3538 # We need to wait for some post-processing to update this set
3510 # We need to wait for some post-processing to update this set
3539 # before making the distinction. The dirstate will be used for
3511 # before making the distinction. The dirstate will be used for
3540 # that purpose.
3512 # that purpose.
3541 dsadded = added
3513 dsadded = added
3542
3514
3543 # in case of merge, files that are actually added can be reported as
3515 # in case of merge, files that are actually added can be reported as
3544 # modified, we need to post process the result
3516 # modified, we need to post process the result
3545 if p2 != nullid:
3517 if p2 != nullid:
3546 mergeadd = set(dsmodified)
3518 mergeadd = set(dsmodified)
3547 for path in dsmodified:
3519 for path in dsmodified:
3548 if path in mf:
3520 if path in mf:
3549 mergeadd.remove(path)
3521 mergeadd.remove(path)
3550 dsadded |= mergeadd
3522 dsadded |= mergeadd
3551 dsmodified -= mergeadd
3523 dsmodified -= mergeadd
3552
3524
3553 # if f is a rename, update `names` to also revert the source
3525 # if f is a rename, update `names` to also revert the source
3554 cwd = repo.getcwd()
3526 cwd = repo.getcwd()
3555 for f in localchanges:
3527 for f in localchanges:
3556 src = repo.dirstate.copied(f)
3528 src = repo.dirstate.copied(f)
3557 # XXX should we check for rename down to target node?
3529 # XXX should we check for rename down to target node?
3558 if src and src not in names and repo.dirstate[src] == 'r':
3530 if src and src not in names and repo.dirstate[src] == 'r':
3559 dsremoved.add(src)
3531 dsremoved.add(src)
3560 names[src] = (repo.pathto(src, cwd), True)
3532 names[src] = (repo.pathto(src, cwd), True)
3561
3533
3562 # determine the exact nature of the deleted changesets
3534 # determine the exact nature of the deleted changesets
3563 deladded = set(_deleted)
3535 deladded = set(_deleted)
3564 for path in _deleted:
3536 for path in _deleted:
3565 if path in mf:
3537 if path in mf:
3566 deladded.remove(path)
3538 deladded.remove(path)
3567 deleted = _deleted - deladded
3539 deleted = _deleted - deladded
3568
3540
3569 # distinguish between file to forget and the other
3541 # distinguish between file to forget and the other
3570 added = set()
3542 added = set()
3571 for abs in dsadded:
3543 for abs in dsadded:
3572 if repo.dirstate[abs] != 'a':
3544 if repo.dirstate[abs] != 'a':
3573 added.add(abs)
3545 added.add(abs)
3574 dsadded -= added
3546 dsadded -= added
3575
3547
3576 for abs in deladded:
3548 for abs in deladded:
3577 if repo.dirstate[abs] == 'a':
3549 if repo.dirstate[abs] == 'a':
3578 dsadded.add(abs)
3550 dsadded.add(abs)
3579 deladded -= dsadded
3551 deladded -= dsadded
3580
3552
3581 # For files marked as removed, we check if an unknown file is present at
3553 # For files marked as removed, we check if an unknown file is present at
3582 # the same path. If a such file exists it may need to be backed up.
3554 # the same path. If a such file exists it may need to be backed up.
3583 # Making the distinction at this stage helps have simpler backup
3555 # Making the distinction at this stage helps have simpler backup
3584 # logic.
3556 # logic.
3585 removunk = set()
3557 removunk = set()
3586 for abs in removed:
3558 for abs in removed:
3587 target = repo.wjoin(abs)
3559 target = repo.wjoin(abs)
3588 if os.path.lexists(target):
3560 if os.path.lexists(target):
3589 removunk.add(abs)
3561 removunk.add(abs)
3590 removed -= removunk
3562 removed -= removunk
3591
3563
3592 dsremovunk = set()
3564 dsremovunk = set()
3593 for abs in dsremoved:
3565 for abs in dsremoved:
3594 target = repo.wjoin(abs)
3566 target = repo.wjoin(abs)
3595 if os.path.lexists(target):
3567 if os.path.lexists(target):
3596 dsremovunk.add(abs)
3568 dsremovunk.add(abs)
3597 dsremoved -= dsremovunk
3569 dsremoved -= dsremovunk
3598
3570
3599 # action to be actually performed by revert
3571 # action to be actually performed by revert
3600 # (<list of file>, message>) tuple
3572 # (<list of file>, message>) tuple
3601 actions = {'revert': ([], _('reverting %s\n')),
3573 actions = {'revert': ([], _('reverting %s\n')),
3602 'add': ([], _('adding %s\n')),
3574 'add': ([], _('adding %s\n')),
3603 'remove': ([], _('removing %s\n')),
3575 'remove': ([], _('removing %s\n')),
3604 'drop': ([], _('removing %s\n')),
3576 'drop': ([], _('removing %s\n')),
3605 'forget': ([], _('forgetting %s\n')),
3577 'forget': ([], _('forgetting %s\n')),
3606 'undelete': ([], _('undeleting %s\n')),
3578 'undelete': ([], _('undeleting %s\n')),
3607 'noop': (None, _('no changes needed to %s\n')),
3579 'noop': (None, _('no changes needed to %s\n')),
3608 'unknown': (None, _('file not managed: %s\n')),
3580 'unknown': (None, _('file not managed: %s\n')),
3609 }
3581 }
3610
3582
3611 # "constant" that convey the backup strategy.
3583 # "constant" that convey the backup strategy.
3612 # All set to `discard` if `no-backup` is set do avoid checking
3584 # All set to `discard` if `no-backup` is set do avoid checking
3613 # no_backup lower in the code.
3585 # no_backup lower in the code.
3614 # These values are ordered for comparison purposes
3586 # These values are ordered for comparison purposes
3615 backupinteractive = 3 # do backup if interactively modified
3587 backupinteractive = 3 # do backup if interactively modified
3616 backup = 2 # unconditionally do backup
3588 backup = 2 # unconditionally do backup
3617 check = 1 # check if the existing file differs from target
3589 check = 1 # check if the existing file differs from target
3618 discard = 0 # never do backup
3590 discard = 0 # never do backup
3619 if opts.get('no_backup'):
3591 if opts.get('no_backup'):
3620 backupinteractive = backup = check = discard
3592 backupinteractive = backup = check = discard
3621 if interactive:
3593 if interactive:
3622 dsmodifiedbackup = backupinteractive
3594 dsmodifiedbackup = backupinteractive
3623 else:
3595 else:
3624 dsmodifiedbackup = backup
3596 dsmodifiedbackup = backup
3625 tobackup = set()
3597 tobackup = set()
3626
3598
3627 backupanddel = actions['remove']
3599 backupanddel = actions['remove']
3628 if not opts.get('no_backup'):
3600 if not opts.get('no_backup'):
3629 backupanddel = actions['drop']
3601 backupanddel = actions['drop']
3630
3602
3631 disptable = (
3603 disptable = (
3632 # dispatch table:
3604 # dispatch table:
3633 # file state
3605 # file state
3634 # action
3606 # action
3635 # make backup
3607 # make backup
3636
3608
3637 ## Sets that results that will change file on disk
3609 ## Sets that results that will change file on disk
3638 # Modified compared to target, no local change
3610 # Modified compared to target, no local change
3639 (modified, actions['revert'], discard),
3611 (modified, actions['revert'], discard),
3640 # Modified compared to target, but local file is deleted
3612 # Modified compared to target, but local file is deleted
3641 (deleted, actions['revert'], discard),
3613 (deleted, actions['revert'], discard),
3642 # Modified compared to target, local change
3614 # Modified compared to target, local change
3643 (dsmodified, actions['revert'], dsmodifiedbackup),
3615 (dsmodified, actions['revert'], dsmodifiedbackup),
3644 # Added since target
3616 # Added since target
3645 (added, actions['remove'], discard),
3617 (added, actions['remove'], discard),
3646 # Added in working directory
3618 # Added in working directory
3647 (dsadded, actions['forget'], discard),
3619 (dsadded, actions['forget'], discard),
3648 # Added since target, have local modification
3620 # Added since target, have local modification
3649 (modadded, backupanddel, backup),
3621 (modadded, backupanddel, backup),
3650 # Added since target but file is missing in working directory
3622 # Added since target but file is missing in working directory
3651 (deladded, actions['drop'], discard),
3623 (deladded, actions['drop'], discard),
3652 # Removed since target, before working copy parent
3624 # Removed since target, before working copy parent
3653 (removed, actions['add'], discard),
3625 (removed, actions['add'], discard),
3654 # Same as `removed` but an unknown file exists at the same path
3626 # Same as `removed` but an unknown file exists at the same path
3655 (removunk, actions['add'], check),
3627 (removunk, actions['add'], check),
3656 # Removed since targe, marked as such in working copy parent
3628 # Removed since targe, marked as such in working copy parent
3657 (dsremoved, actions['undelete'], discard),
3629 (dsremoved, actions['undelete'], discard),
3658 # Same as `dsremoved` but an unknown file exists at the same path
3630 # Same as `dsremoved` but an unknown file exists at the same path
3659 (dsremovunk, actions['undelete'], check),
3631 (dsremovunk, actions['undelete'], check),
3660 ## the following sets does not result in any file changes
3632 ## the following sets does not result in any file changes
3661 # File with no modification
3633 # File with no modification
3662 (clean, actions['noop'], discard),
3634 (clean, actions['noop'], discard),
3663 # Existing file, not tracked anywhere
3635 # Existing file, not tracked anywhere
3664 (unknown, actions['unknown'], discard),
3636 (unknown, actions['unknown'], discard),
3665 )
3637 )
3666
3638
3667 for abs, (rel, exact) in sorted(names.items()):
3639 for abs, (rel, exact) in sorted(names.items()):
3668 # target file to be touch on disk (relative to cwd)
3640 # target file to be touch on disk (relative to cwd)
3669 target = repo.wjoin(abs)
3641 target = repo.wjoin(abs)
3670 # search the entry in the dispatch table.
3642 # search the entry in the dispatch table.
3671 # if the file is in any of these sets, it was touched in the working
3643 # if the file is in any of these sets, it was touched in the working
3672 # directory parent and we are sure it needs to be reverted.
3644 # directory parent and we are sure it needs to be reverted.
3673 for table, (xlist, msg), dobackup in disptable:
3645 for table, (xlist, msg), dobackup in disptable:
3674 if abs not in table:
3646 if abs not in table:
3675 continue
3647 continue
3676 if xlist is not None:
3648 if xlist is not None:
3677 xlist.append(abs)
3649 xlist.append(abs)
3678 if dobackup:
3650 if dobackup:
3679 # If in interactive mode, don't automatically create
3651 # If in interactive mode, don't automatically create
3680 # .orig files (issue4793)
3652 # .orig files (issue4793)
3681 if dobackup == backupinteractive:
3653 if dobackup == backupinteractive:
3682 tobackup.add(abs)
3654 tobackup.add(abs)
3683 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3655 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3684 bakname = scmutil.origpath(ui, repo, rel)
3656 bakname = scmutil.origpath(ui, repo, rel)
3685 ui.note(_('saving current version of %s as %s\n') %
3657 ui.note(_('saving current version of %s as %s\n') %
3686 (rel, bakname))
3658 (rel, bakname))
3687 if not opts.get('dry_run'):
3659 if not opts.get('dry_run'):
3688 if interactive:
3660 if interactive:
3689 util.copyfile(target, bakname)
3661 util.copyfile(target, bakname)
3690 else:
3662 else:
3691 util.rename(target, bakname)
3663 util.rename(target, bakname)
3692 if ui.verbose or not exact:
3664 if ui.verbose or not exact:
3693 if not isinstance(msg, bytes):
3665 if not isinstance(msg, bytes):
3694 msg = msg(abs)
3666 msg = msg(abs)
3695 ui.status(msg % rel)
3667 ui.status(msg % rel)
3696 elif exact:
3668 elif exact:
3697 ui.warn(msg % rel)
3669 ui.warn(msg % rel)
3698 break
3670 break
3699
3671
3700 if not opts.get('dry_run'):
3672 if not opts.get('dry_run'):
3701 needdata = ('revert', 'add', 'undelete')
3673 needdata = ('revert', 'add', 'undelete')
3702 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3674 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3703 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3675 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3704
3676
3705 if targetsubs:
3677 if targetsubs:
3706 # Revert the subrepos on the revert list
3678 # Revert the subrepos on the revert list
3707 for sub in targetsubs:
3679 for sub in targetsubs:
3708 try:
3680 try:
3709 wctx.sub(sub).revert(ctx.substate[sub], *pats,
3681 wctx.sub(sub).revert(ctx.substate[sub], *pats,
3710 **pycompat.strkwargs(opts))
3682 **pycompat.strkwargs(opts))
3711 except KeyError:
3683 except KeyError:
3712 raise error.Abort("subrepository '%s' does not exist in %s!"
3684 raise error.Abort("subrepository '%s' does not exist in %s!"
3713 % (sub, short(ctx.node())))
3685 % (sub, short(ctx.node())))
3714
3686
3715 def _revertprefetch(repo, ctx, *files):
3687 def _revertprefetch(repo, ctx, *files):
3716 """Let extension changing the storage layer prefetch content"""
3688 """Let extension changing the storage layer prefetch content"""
3717
3689
3718 def _performrevert(repo, parents, ctx, actions, interactive=False,
3690 def _performrevert(repo, parents, ctx, actions, interactive=False,
3719 tobackup=None):
3691 tobackup=None):
3720 """function that actually perform all the actions computed for revert
3692 """function that actually perform all the actions computed for revert
3721
3693
3722 This is an independent function to let extension to plug in and react to
3694 This is an independent function to let extension to plug in and react to
3723 the imminent revert.
3695 the imminent revert.
3724
3696
3725 Make sure you have the working directory locked when calling this function.
3697 Make sure you have the working directory locked when calling this function.
3726 """
3698 """
3727 parent, p2 = parents
3699 parent, p2 = parents
3728 node = ctx.node()
3700 node = ctx.node()
3729 excluded_files = []
3701 excluded_files = []
3730 matcher_opts = {"exclude": excluded_files}
3702 matcher_opts = {"exclude": excluded_files}
3731
3703
3732 def checkout(f):
3704 def checkout(f):
3733 fc = ctx[f]
3705 fc = ctx[f]
3734 repo.wwrite(f, fc.data(), fc.flags())
3706 repo.wwrite(f, fc.data(), fc.flags())
3735
3707
3736 def doremove(f):
3708 def doremove(f):
3737 try:
3709 try:
3738 repo.wvfs.unlinkpath(f)
3710 repo.wvfs.unlinkpath(f)
3739 except OSError:
3711 except OSError:
3740 pass
3712 pass
3741 repo.dirstate.remove(f)
3713 repo.dirstate.remove(f)
3742
3714
3743 audit_path = pathutil.pathauditor(repo.root, cached=True)
3715 audit_path = pathutil.pathauditor(repo.root, cached=True)
3744 for f in actions['forget'][0]:
3716 for f in actions['forget'][0]:
3745 if interactive:
3717 if interactive:
3746 choice = repo.ui.promptchoice(
3718 choice = repo.ui.promptchoice(
3747 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3719 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3748 if choice == 0:
3720 if choice == 0:
3749 repo.dirstate.drop(f)
3721 repo.dirstate.drop(f)
3750 else:
3722 else:
3751 excluded_files.append(repo.wjoin(f))
3723 excluded_files.append(repo.wjoin(f))
3752 else:
3724 else:
3753 repo.dirstate.drop(f)
3725 repo.dirstate.drop(f)
3754 for f in actions['remove'][0]:
3726 for f in actions['remove'][0]:
3755 audit_path(f)
3727 audit_path(f)
3756 if interactive:
3728 if interactive:
3757 choice = repo.ui.promptchoice(
3729 choice = repo.ui.promptchoice(
3758 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3730 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3759 if choice == 0:
3731 if choice == 0:
3760 doremove(f)
3732 doremove(f)
3761 else:
3733 else:
3762 excluded_files.append(repo.wjoin(f))
3734 excluded_files.append(repo.wjoin(f))
3763 else:
3735 else:
3764 doremove(f)
3736 doremove(f)
3765 for f in actions['drop'][0]:
3737 for f in actions['drop'][0]:
3766 audit_path(f)
3738 audit_path(f)
3767 repo.dirstate.remove(f)
3739 repo.dirstate.remove(f)
3768
3740
3769 normal = None
3741 normal = None
3770 if node == parent:
3742 if node == parent:
3771 # We're reverting to our parent. If possible, we'd like status
3743 # We're reverting to our parent. If possible, we'd like status
3772 # to report the file as clean. We have to use normallookup for
3744 # to report the file as clean. We have to use normallookup for
3773 # merges to avoid losing information about merged/dirty files.
3745 # merges to avoid losing information about merged/dirty files.
3774 if p2 != nullid:
3746 if p2 != nullid:
3775 normal = repo.dirstate.normallookup
3747 normal = repo.dirstate.normallookup
3776 else:
3748 else:
3777 normal = repo.dirstate.normal
3749 normal = repo.dirstate.normal
3778
3750
3779 newlyaddedandmodifiedfiles = set()
3751 newlyaddedandmodifiedfiles = set()
3780 if interactive:
3752 if interactive:
3781 # Prompt the user for changes to revert
3753 # Prompt the user for changes to revert
3782 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3754 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3783 m = scmutil.match(ctx, torevert, matcher_opts)
3755 m = scmutil.match(ctx, torevert, matcher_opts)
3784 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3756 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3785 diffopts.nodates = True
3757 diffopts.nodates = True
3786 diffopts.git = True
3758 diffopts.git = True
3787 operation = 'discard'
3759 operation = 'discard'
3788 reversehunks = True
3760 reversehunks = True
3789 if node != parent:
3761 if node != parent:
3790 operation = 'apply'
3762 operation = 'apply'
3791 reversehunks = False
3763 reversehunks = False
3792 if reversehunks:
3764 if reversehunks:
3793 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3765 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3794 else:
3766 else:
3795 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3767 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3796 originalchunks = patch.parsepatch(diff)
3768 originalchunks = patch.parsepatch(diff)
3797
3769
3798 try:
3770 try:
3799
3771
3800 chunks, opts = recordfilter(repo.ui, originalchunks,
3772 chunks, opts = recordfilter(repo.ui, originalchunks,
3801 operation=operation)
3773 operation=operation)
3802 if reversehunks:
3774 if reversehunks:
3803 chunks = patch.reversehunks(chunks)
3775 chunks = patch.reversehunks(chunks)
3804
3776
3805 except error.PatchError as err:
3777 except error.PatchError as err:
3806 raise error.Abort(_('error parsing patch: %s') % err)
3778 raise error.Abort(_('error parsing patch: %s') % err)
3807
3779
3808 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3780 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3809 if tobackup is None:
3781 if tobackup is None:
3810 tobackup = set()
3782 tobackup = set()
3811 # Apply changes
3783 # Apply changes
3812 fp = stringio()
3784 fp = stringio()
3813 for c in chunks:
3785 for c in chunks:
3814 # Create a backup file only if this hunk should be backed up
3786 # Create a backup file only if this hunk should be backed up
3815 if ishunk(c) and c.header.filename() in tobackup:
3787 if ishunk(c) and c.header.filename() in tobackup:
3816 abs = c.header.filename()
3788 abs = c.header.filename()
3817 target = repo.wjoin(abs)
3789 target = repo.wjoin(abs)
3818 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3790 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3819 util.copyfile(target, bakname)
3791 util.copyfile(target, bakname)
3820 tobackup.remove(abs)
3792 tobackup.remove(abs)
3821 c.write(fp)
3793 c.write(fp)
3822 dopatch = fp.tell()
3794 dopatch = fp.tell()
3823 fp.seek(0)
3795 fp.seek(0)
3824 if dopatch:
3796 if dopatch:
3825 try:
3797 try:
3826 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3798 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3827 except error.PatchError as err:
3799 except error.PatchError as err:
3828 raise error.Abort(str(err))
3800 raise error.Abort(str(err))
3829 del fp
3801 del fp
3830 else:
3802 else:
3831 for f in actions['revert'][0]:
3803 for f in actions['revert'][0]:
3832 checkout(f)
3804 checkout(f)
3833 if normal:
3805 if normal:
3834 normal(f)
3806 normal(f)
3835
3807
3836 for f in actions['add'][0]:
3808 for f in actions['add'][0]:
3837 # Don't checkout modified files, they are already created by the diff
3809 # Don't checkout modified files, they are already created by the diff
3838 if f not in newlyaddedandmodifiedfiles:
3810 if f not in newlyaddedandmodifiedfiles:
3839 checkout(f)
3811 checkout(f)
3840 repo.dirstate.add(f)
3812 repo.dirstate.add(f)
3841
3813
3842 normal = repo.dirstate.normallookup
3814 normal = repo.dirstate.normallookup
3843 if node == parent and p2 == nullid:
3815 if node == parent and p2 == nullid:
3844 normal = repo.dirstate.normal
3816 normal = repo.dirstate.normal
3845 for f in actions['undelete'][0]:
3817 for f in actions['undelete'][0]:
3846 checkout(f)
3818 checkout(f)
3847 normal(f)
3819 normal(f)
3848
3820
3849 copied = copies.pathcopies(repo[parent], ctx)
3821 copied = copies.pathcopies(repo[parent], ctx)
3850
3822
3851 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3823 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3852 if f in copied:
3824 if f in copied:
3853 repo.dirstate.copy(copied[f], f)
3825 repo.dirstate.copy(copied[f], f)
3854
3826
3855 class command(registrar.command):
3827 class command(registrar.command):
3856 """deprecated: used registrar.command instead"""
3828 """deprecated: used registrar.command instead"""
3857 def _doregister(self, func, name, *args, **kwargs):
3829 def _doregister(self, func, name, *args, **kwargs):
3858 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3830 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3859 return super(command, self)._doregister(func, name, *args, **kwargs)
3831 return super(command, self)._doregister(func, name, *args, **kwargs)
3860
3832
3861 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3833 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3862 # commands.outgoing. "missing" is "missing" of the result of
3834 # commands.outgoing. "missing" is "missing" of the result of
3863 # "findcommonoutgoing()"
3835 # "findcommonoutgoing()"
3864 outgoinghooks = util.hooks()
3836 outgoinghooks = util.hooks()
3865
3837
3866 # a list of (ui, repo) functions called by commands.summary
3838 # a list of (ui, repo) functions called by commands.summary
3867 summaryhooks = util.hooks()
3839 summaryhooks = util.hooks()
3868
3840
3869 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3841 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3870 #
3842 #
3871 # functions should return tuple of booleans below, if 'changes' is None:
3843 # functions should return tuple of booleans below, if 'changes' is None:
3872 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3844 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3873 #
3845 #
3874 # otherwise, 'changes' is a tuple of tuples below:
3846 # otherwise, 'changes' is a tuple of tuples below:
3875 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3847 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3876 # - (desturl, destbranch, destpeer, outgoing)
3848 # - (desturl, destbranch, destpeer, outgoing)
3877 summaryremotehooks = util.hooks()
3849 summaryremotehooks = util.hooks()
3878
3850
3879 # A list of state files kept by multistep operations like graft.
3851 # A list of state files kept by multistep operations like graft.
3880 # Since graft cannot be aborted, it is considered 'clearable' by update.
3852 # Since graft cannot be aborted, it is considered 'clearable' by update.
3881 # note: bisect is intentionally excluded
3853 # note: bisect is intentionally excluded
3882 # (state file, clearable, allowcommit, error, hint)
3854 # (state file, clearable, allowcommit, error, hint)
3883 unfinishedstates = [
3855 unfinishedstates = [
3884 ('graftstate', True, False, _('graft in progress'),
3856 ('graftstate', True, False, _('graft in progress'),
3885 _("use 'hg graft --continue' or 'hg update' to abort")),
3857 _("use 'hg graft --continue' or 'hg update' to abort")),
3886 ('updatestate', True, False, _('last update was interrupted'),
3858 ('updatestate', True, False, _('last update was interrupted'),
3887 _("use 'hg update' to get a consistent checkout"))
3859 _("use 'hg update' to get a consistent checkout"))
3888 ]
3860 ]
3889
3861
3890 def checkunfinished(repo, commit=False):
3862 def checkunfinished(repo, commit=False):
3891 '''Look for an unfinished multistep operation, like graft, and abort
3863 '''Look for an unfinished multistep operation, like graft, and abort
3892 if found. It's probably good to check this right before
3864 if found. It's probably good to check this right before
3893 bailifchanged().
3865 bailifchanged().
3894 '''
3866 '''
3895 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3867 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3896 if commit and allowcommit:
3868 if commit and allowcommit:
3897 continue
3869 continue
3898 if repo.vfs.exists(f):
3870 if repo.vfs.exists(f):
3899 raise error.Abort(msg, hint=hint)
3871 raise error.Abort(msg, hint=hint)
3900
3872
3901 def clearunfinished(repo):
3873 def clearunfinished(repo):
3902 '''Check for unfinished operations (as above), and clear the ones
3874 '''Check for unfinished operations (as above), and clear the ones
3903 that are clearable.
3875 that are clearable.
3904 '''
3876 '''
3905 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3877 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3906 if not clearable and repo.vfs.exists(f):
3878 if not clearable and repo.vfs.exists(f):
3907 raise error.Abort(msg, hint=hint)
3879 raise error.Abort(msg, hint=hint)
3908 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3880 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3909 if clearable and repo.vfs.exists(f):
3881 if clearable and repo.vfs.exists(f):
3910 util.unlink(repo.vfs.join(f))
3882 util.unlink(repo.vfs.join(f))
3911
3883
3912 afterresolvedstates = [
3884 afterresolvedstates = [
3913 ('graftstate',
3885 ('graftstate',
3914 _('hg graft --continue')),
3886 _('hg graft --continue')),
3915 ]
3887 ]
3916
3888
3917 def howtocontinue(repo):
3889 def howtocontinue(repo):
3918 '''Check for an unfinished operation and return the command to finish
3890 '''Check for an unfinished operation and return the command to finish
3919 it.
3891 it.
3920
3892
3921 afterresolvedstates tuples define a .hg/{file} and the corresponding
3893 afterresolvedstates tuples define a .hg/{file} and the corresponding
3922 command needed to finish it.
3894 command needed to finish it.
3923
3895
3924 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3896 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3925 a boolean.
3897 a boolean.
3926 '''
3898 '''
3927 contmsg = _("continue: %s")
3899 contmsg = _("continue: %s")
3928 for f, msg in afterresolvedstates:
3900 for f, msg in afterresolvedstates:
3929 if repo.vfs.exists(f):
3901 if repo.vfs.exists(f):
3930 return contmsg % msg, True
3902 return contmsg % msg, True
3931 if repo[None].dirty(missing=True, merge=False, branch=False):
3903 if repo[None].dirty(missing=True, merge=False, branch=False):
3932 return contmsg % _("hg commit"), False
3904 return contmsg % _("hg commit"), False
3933 return None, None
3905 return None, None
3934
3906
3935 def checkafterresolved(repo):
3907 def checkafterresolved(repo):
3936 '''Inform the user about the next action after completing hg resolve
3908 '''Inform the user about the next action after completing hg resolve
3937
3909
3938 If there's a matching afterresolvedstates, howtocontinue will yield
3910 If there's a matching afterresolvedstates, howtocontinue will yield
3939 repo.ui.warn as the reporter.
3911 repo.ui.warn as the reporter.
3940
3912
3941 Otherwise, it will yield repo.ui.note.
3913 Otherwise, it will yield repo.ui.note.
3942 '''
3914 '''
3943 msg, warning = howtocontinue(repo)
3915 msg, warning = howtocontinue(repo)
3944 if msg is not None:
3916 if msg is not None:
3945 if warning:
3917 if warning:
3946 repo.ui.warn("%s\n" % msg)
3918 repo.ui.warn("%s\n" % msg)
3947 else:
3919 else:
3948 repo.ui.note("%s\n" % msg)
3920 repo.ui.note("%s\n" % msg)
3949
3921
3950 def wrongtooltocontinue(repo, task):
3922 def wrongtooltocontinue(repo, task):
3951 '''Raise an abort suggesting how to properly continue if there is an
3923 '''Raise an abort suggesting how to properly continue if there is an
3952 active task.
3924 active task.
3953
3925
3954 Uses howtocontinue() to find the active task.
3926 Uses howtocontinue() to find the active task.
3955
3927
3956 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3928 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3957 a hint.
3929 a hint.
3958 '''
3930 '''
3959 after = howtocontinue(repo)
3931 after = howtocontinue(repo)
3960 hint = None
3932 hint = None
3961 if after[1]:
3933 if after[1]:
3962 hint = after[0]
3934 hint = after[0]
3963 raise error.Abort(_('no %s in progress') % task, hint=hint)
3935 raise error.Abort(_('no %s in progress') % task, hint=hint)
@@ -1,3484 +1,3484 b''
1 @ (34) head
1 @ (34) head
2 |
2 |
3 | o (33) head
3 | o (33) head
4 | |
4 | |
5 o | (32) expand
5 o | (32) expand
6 |\ \
6 |\ \
7 | o \ (31) expand
7 | o \ (31) expand
8 | |\ \
8 | |\ \
9 | | o \ (30) expand
9 | | o \ (30) expand
10 | | |\ \
10 | | |\ \
11 | | | o | (29) regular commit
11 | | | o | (29) regular commit
12 | | | | |
12 | | | | |
13 | | o | | (28) merge zero known
13 | | o | | (28) merge zero known
14 | | |\ \ \
14 | | |\ \ \
15 o | | | | | (27) collapse
15 o | | | | | (27) collapse
16 |/ / / / /
16 |/ / / / /
17 | | o---+ (26) merge one known; far right
17 | | o---+ (26) merge one known; far right
18 | | | | |
18 | | | | |
19 +---o | | (25) merge one known; far left
19 +---o | | (25) merge one known; far left
20 | | | | |
20 | | | | |
21 | | o | | (24) merge one known; immediate right
21 | | o | | (24) merge one known; immediate right
22 | | |\| |
22 | | |\| |
23 | | o | | (23) merge one known; immediate left
23 | | o | | (23) merge one known; immediate left
24 | |/| | |
24 | |/| | |
25 +---o---+ (22) merge two known; one far left, one far right
25 +---o---+ (22) merge two known; one far left, one far right
26 | | / /
26 | | / /
27 o | | | (21) expand
27 o | | | (21) expand
28 |\ \ \ \
28 |\ \ \ \
29 | o---+-+ (20) merge two known; two far right
29 | o---+-+ (20) merge two known; two far right
30 | / / /
30 | / / /
31 o | | | (19) expand
31 o | | | (19) expand
32 |\ \ \ \
32 |\ \ \ \
33 +---+---o (18) merge two known; two far left
33 +---+---o (18) merge two known; two far left
34 | | | |
34 | | | |
35 | o | | (17) expand
35 | o | | (17) expand
36 | |\ \ \
36 | |\ \ \
37 | | o---+ (16) merge two known; one immediate right, one near right
37 | | o---+ (16) merge two known; one immediate right, one near right
38 | | |/ /
38 | | |/ /
39 o | | | (15) expand
39 o | | | (15) expand
40 |\ \ \ \
40 |\ \ \ \
41 | o-----+ (14) merge two known; one immediate right, one far right
41 | o-----+ (14) merge two known; one immediate right, one far right
42 | |/ / /
42 | |/ / /
43 o | | | (13) expand
43 o | | | (13) expand
44 |\ \ \ \
44 |\ \ \ \
45 +---o | | (12) merge two known; one immediate right, one far left
45 +---o | | (12) merge two known; one immediate right, one far left
46 | | |/ /
46 | | |/ /
47 | o | | (11) expand
47 | o | | (11) expand
48 | |\ \ \
48 | |\ \ \
49 | | o---+ (10) merge two known; one immediate left, one near right
49 | | o---+ (10) merge two known; one immediate left, one near right
50 | |/ / /
50 | |/ / /
51 o | | | (9) expand
51 o | | | (9) expand
52 |\ \ \ \
52 |\ \ \ \
53 | o-----+ (8) merge two known; one immediate left, one far right
53 | o-----+ (8) merge two known; one immediate left, one far right
54 |/ / / /
54 |/ / / /
55 o | | | (7) expand
55 o | | | (7) expand
56 |\ \ \ \
56 |\ \ \ \
57 +---o | | (6) merge two known; one immediate left, one far left
57 +---o | | (6) merge two known; one immediate left, one far left
58 | |/ / /
58 | |/ / /
59 | o | | (5) expand
59 | o | | (5) expand
60 | |\ \ \
60 | |\ \ \
61 | | o | | (4) merge two known; one immediate left, one immediate right
61 | | o | | (4) merge two known; one immediate left, one immediate right
62 | |/|/ /
62 | |/|/ /
63 | o / / (3) collapse
63 | o / / (3) collapse
64 |/ / /
64 |/ / /
65 o / / (2) collapse
65 o / / (2) collapse
66 |/ /
66 |/ /
67 o / (1) collapse
67 o / (1) collapse
68 |/
68 |/
69 o (0) root
69 o (0) root
70
70
71
71
72 $ commit()
72 $ commit()
73 > {
73 > {
74 > rev=$1
74 > rev=$1
75 > msg=$2
75 > msg=$2
76 > shift 2
76 > shift 2
77 > if [ "$#" -gt 0 ]; then
77 > if [ "$#" -gt 0 ]; then
78 > hg debugsetparents "$@"
78 > hg debugsetparents "$@"
79 > fi
79 > fi
80 > echo $rev > a
80 > echo $rev > a
81 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
81 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
82 > }
82 > }
83
83
84 $ cat > printrevset.py <<EOF
84 $ cat > printrevset.py <<EOF
85 > from __future__ import absolute_import
85 > from __future__ import absolute_import
86 > from mercurial import (
86 > from mercurial import (
87 > cmdutil,
87 > cmdutil,
88 > commands,
88 > commands,
89 > extensions,
89 > extensions,
90 > revsetlang,
90 > revsetlang,
91 > smartset,
91 > smartset,
92 > )
92 > )
93 >
93 >
94 > def logrevset(repo, pats, opts):
94 > def logrevset(repo, pats, opts):
95 > revs = cmdutil._logrevs(repo, opts)
95 > revs = cmdutil._logrevs(repo, opts)
96 > if not revs:
96 > if not revs:
97 > return None
97 > return None
98 > match, pats, slowpath = cmdutil._makelogmatcher(repo, revs, pats, opts)
98 > match, pats, slowpath = cmdutil._makelogmatcher(repo, revs, pats, opts)
99 > return cmdutil._makelogrevset(repo, match, pats, slowpath, opts)[0]
99 > return cmdutil._makelogrevset(repo, match, pats, slowpath, opts)
100 >
100 >
101 > def uisetup(ui):
101 > def uisetup(ui):
102 > def printrevset(orig, repo, pats, opts):
102 > def printrevset(orig, repo, pats, opts):
103 > revs, filematcher = orig(repo, pats, opts)
103 > revs, filematcher = orig(repo, pats, opts)
104 > if opts.get('print_revset'):
104 > if opts.get('print_revset'):
105 > expr = logrevset(repo, pats, opts)
105 > expr = logrevset(repo, pats, opts)
106 > if expr:
106 > if expr:
107 > tree = revsetlang.parse(expr)
107 > tree = revsetlang.parse(expr)
108 > tree = revsetlang.analyze(tree)
108 > tree = revsetlang.analyze(tree)
109 > else:
109 > else:
110 > tree = []
110 > tree = []
111 > ui = repo.ui
111 > ui = repo.ui
112 > ui.write('%r\n' % (opts.get('rev', []),))
112 > ui.write('%r\n' % (opts.get('rev', []),))
113 > ui.write(revsetlang.prettyformat(tree) + '\n')
113 > ui.write(revsetlang.prettyformat(tree) + '\n')
114 > ui.write(smartset.prettyformat(revs) + '\n')
114 > ui.write(smartset.prettyformat(revs) + '\n')
115 > revs = smartset.baseset() # display no revisions
115 > revs = smartset.baseset() # display no revisions
116 > return revs, filematcher
116 > return revs, filematcher
117 > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
117 > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
118 > aliases, entry = cmdutil.findcmd('log', commands.table)
118 > aliases, entry = cmdutil.findcmd('log', commands.table)
119 > entry[1].append(('', 'print-revset', False,
119 > entry[1].append(('', 'print-revset', False,
120 > 'print generated revset and exit (DEPRECATED)'))
120 > 'print generated revset and exit (DEPRECATED)'))
121 > EOF
121 > EOF
122
122
123 $ echo "[extensions]" >> $HGRCPATH
123 $ echo "[extensions]" >> $HGRCPATH
124 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
124 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
125
125
126 $ hg init repo
126 $ hg init repo
127 $ cd repo
127 $ cd repo
128
128
129 Empty repo:
129 Empty repo:
130
130
131 $ hg log -G
131 $ hg log -G
132
132
133
133
134 Building DAG:
134 Building DAG:
135
135
136 $ commit 0 "root"
136 $ commit 0 "root"
137 $ commit 1 "collapse" 0
137 $ commit 1 "collapse" 0
138 $ commit 2 "collapse" 1
138 $ commit 2 "collapse" 1
139 $ commit 3 "collapse" 2
139 $ commit 3 "collapse" 2
140 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
140 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
141 $ commit 5 "expand" 3 4
141 $ commit 5 "expand" 3 4
142 $ commit 6 "merge two known; one immediate left, one far left" 2 5
142 $ commit 6 "merge two known; one immediate left, one far left" 2 5
143 $ commit 7 "expand" 2 5
143 $ commit 7 "expand" 2 5
144 $ commit 8 "merge two known; one immediate left, one far right" 0 7
144 $ commit 8 "merge two known; one immediate left, one far right" 0 7
145 $ commit 9 "expand" 7 8
145 $ commit 9 "expand" 7 8
146 $ commit 10 "merge two known; one immediate left, one near right" 0 6
146 $ commit 10 "merge two known; one immediate left, one near right" 0 6
147 $ commit 11 "expand" 6 10
147 $ commit 11 "expand" 6 10
148 $ commit 12 "merge two known; one immediate right, one far left" 1 9
148 $ commit 12 "merge two known; one immediate right, one far left" 1 9
149 $ commit 13 "expand" 9 11
149 $ commit 13 "expand" 9 11
150 $ commit 14 "merge two known; one immediate right, one far right" 0 12
150 $ commit 14 "merge two known; one immediate right, one far right" 0 12
151 $ commit 15 "expand" 13 14
151 $ commit 15 "expand" 13 14
152 $ commit 16 "merge two known; one immediate right, one near right" 0 1
152 $ commit 16 "merge two known; one immediate right, one near right" 0 1
153 $ commit 17 "expand" 12 16
153 $ commit 17 "expand" 12 16
154 $ commit 18 "merge two known; two far left" 1 15
154 $ commit 18 "merge two known; two far left" 1 15
155 $ commit 19 "expand" 15 17
155 $ commit 19 "expand" 15 17
156 $ commit 20 "merge two known; two far right" 0 18
156 $ commit 20 "merge two known; two far right" 0 18
157 $ commit 21 "expand" 19 20
157 $ commit 21 "expand" 19 20
158 $ commit 22 "merge two known; one far left, one far right" 18 21
158 $ commit 22 "merge two known; one far left, one far right" 18 21
159 $ commit 23 "merge one known; immediate left" 1 22
159 $ commit 23 "merge one known; immediate left" 1 22
160 $ commit 24 "merge one known; immediate right" 0 23
160 $ commit 24 "merge one known; immediate right" 0 23
161 $ commit 25 "merge one known; far left" 21 24
161 $ commit 25 "merge one known; far left" 21 24
162 $ commit 26 "merge one known; far right" 18 25
162 $ commit 26 "merge one known; far right" 18 25
163 $ commit 27 "collapse" 21
163 $ commit 27 "collapse" 21
164 $ commit 28 "merge zero known" 1 26
164 $ commit 28 "merge zero known" 1 26
165 $ commit 29 "regular commit" 0
165 $ commit 29 "regular commit" 0
166 $ commit 30 "expand" 28 29
166 $ commit 30 "expand" 28 29
167 $ commit 31 "expand" 21 30
167 $ commit 31 "expand" 21 30
168 $ commit 32 "expand" 27 31
168 $ commit 32 "expand" 27 31
169 $ commit 33 "head" 18
169 $ commit 33 "head" 18
170 $ commit 34 "head" 32
170 $ commit 34 "head" 32
171
171
172
172
173 $ hg log -G -q
173 $ hg log -G -q
174 @ 34:fea3ac5810e0
174 @ 34:fea3ac5810e0
175 |
175 |
176 | o 33:68608f5145f9
176 | o 33:68608f5145f9
177 | |
177 | |
178 o | 32:d06dffa21a31
178 o | 32:d06dffa21a31
179 |\ \
179 |\ \
180 | o \ 31:621d83e11f67
180 | o \ 31:621d83e11f67
181 | |\ \
181 | |\ \
182 | | o \ 30:6e11cd4b648f
182 | | o \ 30:6e11cd4b648f
183 | | |\ \
183 | | |\ \
184 | | | o | 29:cd9bb2be7593
184 | | | o | 29:cd9bb2be7593
185 | | | | |
185 | | | | |
186 | | o | | 28:44ecd0b9ae99
186 | | o | | 28:44ecd0b9ae99
187 | | |\ \ \
187 | | |\ \ \
188 o | | | | | 27:886ed638191b
188 o | | | | | 27:886ed638191b
189 |/ / / / /
189 |/ / / / /
190 | | o---+ 26:7f25b6c2f0b9
190 | | o---+ 26:7f25b6c2f0b9
191 | | | | |
191 | | | | |
192 +---o | | 25:91da8ed57247
192 +---o | | 25:91da8ed57247
193 | | | | |
193 | | | | |
194 | | o | | 24:a9c19a3d96b7
194 | | o | | 24:a9c19a3d96b7
195 | | |\| |
195 | | |\| |
196 | | o | | 23:a01cddf0766d
196 | | o | | 23:a01cddf0766d
197 | |/| | |
197 | |/| | |
198 +---o---+ 22:e0d9cccacb5d
198 +---o---+ 22:e0d9cccacb5d
199 | | / /
199 | | / /
200 o | | | 21:d42a756af44d
200 o | | | 21:d42a756af44d
201 |\ \ \ \
201 |\ \ \ \
202 | o---+-+ 20:d30ed6450e32
202 | o---+-+ 20:d30ed6450e32
203 | / / /
203 | / / /
204 o | | | 19:31ddc2c1573b
204 o | | | 19:31ddc2c1573b
205 |\ \ \ \
205 |\ \ \ \
206 +---+---o 18:1aa84d96232a
206 +---+---o 18:1aa84d96232a
207 | | | |
207 | | | |
208 | o | | 17:44765d7c06e0
208 | o | | 17:44765d7c06e0
209 | |\ \ \
209 | |\ \ \
210 | | o---+ 16:3677d192927d
210 | | o---+ 16:3677d192927d
211 | | |/ /
211 | | |/ /
212 o | | | 15:1dda3f72782d
212 o | | | 15:1dda3f72782d
213 |\ \ \ \
213 |\ \ \ \
214 | o-----+ 14:8eac370358ef
214 | o-----+ 14:8eac370358ef
215 | |/ / /
215 | |/ / /
216 o | | | 13:22d8966a97e3
216 o | | | 13:22d8966a97e3
217 |\ \ \ \
217 |\ \ \ \
218 +---o | | 12:86b91144a6e9
218 +---o | | 12:86b91144a6e9
219 | | |/ /
219 | | |/ /
220 | o | | 11:832d76e6bdf2
220 | o | | 11:832d76e6bdf2
221 | |\ \ \
221 | |\ \ \
222 | | o---+ 10:74c64d036d72
222 | | o---+ 10:74c64d036d72
223 | |/ / /
223 | |/ / /
224 o | | | 9:7010c0af0a35
224 o | | | 9:7010c0af0a35
225 |\ \ \ \
225 |\ \ \ \
226 | o-----+ 8:7a0b11f71937
226 | o-----+ 8:7a0b11f71937
227 |/ / / /
227 |/ / / /
228 o | | | 7:b632bb1b1224
228 o | | | 7:b632bb1b1224
229 |\ \ \ \
229 |\ \ \ \
230 +---o | | 6:b105a072e251
230 +---o | | 6:b105a072e251
231 | |/ / /
231 | |/ / /
232 | o | | 5:4409d547b708
232 | o | | 5:4409d547b708
233 | |\ \ \
233 | |\ \ \
234 | | o | | 4:26a8bac39d9f
234 | | o | | 4:26a8bac39d9f
235 | |/|/ /
235 | |/|/ /
236 | o / / 3:27eef8ed80b4
236 | o / / 3:27eef8ed80b4
237 |/ / /
237 |/ / /
238 o / / 2:3d9a33b8d1e1
238 o / / 2:3d9a33b8d1e1
239 |/ /
239 |/ /
240 o / 1:6db2ef61d156
240 o / 1:6db2ef61d156
241 |/
241 |/
242 o 0:e6eb3150255d
242 o 0:e6eb3150255d
243
243
244
244
245 $ hg log -G
245 $ hg log -G
246 @ changeset: 34:fea3ac5810e0
246 @ changeset: 34:fea3ac5810e0
247 | tag: tip
247 | tag: tip
248 | parent: 32:d06dffa21a31
248 | parent: 32:d06dffa21a31
249 | user: test
249 | user: test
250 | date: Thu Jan 01 00:00:34 1970 +0000
250 | date: Thu Jan 01 00:00:34 1970 +0000
251 | summary: (34) head
251 | summary: (34) head
252 |
252 |
253 | o changeset: 33:68608f5145f9
253 | o changeset: 33:68608f5145f9
254 | | parent: 18:1aa84d96232a
254 | | parent: 18:1aa84d96232a
255 | | user: test
255 | | user: test
256 | | date: Thu Jan 01 00:00:33 1970 +0000
256 | | date: Thu Jan 01 00:00:33 1970 +0000
257 | | summary: (33) head
257 | | summary: (33) head
258 | |
258 | |
259 o | changeset: 32:d06dffa21a31
259 o | changeset: 32:d06dffa21a31
260 |\ \ parent: 27:886ed638191b
260 |\ \ parent: 27:886ed638191b
261 | | | parent: 31:621d83e11f67
261 | | | parent: 31:621d83e11f67
262 | | | user: test
262 | | | user: test
263 | | | date: Thu Jan 01 00:00:32 1970 +0000
263 | | | date: Thu Jan 01 00:00:32 1970 +0000
264 | | | summary: (32) expand
264 | | | summary: (32) expand
265 | | |
265 | | |
266 | o | changeset: 31:621d83e11f67
266 | o | changeset: 31:621d83e11f67
267 | |\ \ parent: 21:d42a756af44d
267 | |\ \ parent: 21:d42a756af44d
268 | | | | parent: 30:6e11cd4b648f
268 | | | | parent: 30:6e11cd4b648f
269 | | | | user: test
269 | | | | user: test
270 | | | | date: Thu Jan 01 00:00:31 1970 +0000
270 | | | | date: Thu Jan 01 00:00:31 1970 +0000
271 | | | | summary: (31) expand
271 | | | | summary: (31) expand
272 | | | |
272 | | | |
273 | | o | changeset: 30:6e11cd4b648f
273 | | o | changeset: 30:6e11cd4b648f
274 | | |\ \ parent: 28:44ecd0b9ae99
274 | | |\ \ parent: 28:44ecd0b9ae99
275 | | | | | parent: 29:cd9bb2be7593
275 | | | | | parent: 29:cd9bb2be7593
276 | | | | | user: test
276 | | | | | user: test
277 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
277 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
278 | | | | | summary: (30) expand
278 | | | | | summary: (30) expand
279 | | | | |
279 | | | | |
280 | | | o | changeset: 29:cd9bb2be7593
280 | | | o | changeset: 29:cd9bb2be7593
281 | | | | | parent: 0:e6eb3150255d
281 | | | | | parent: 0:e6eb3150255d
282 | | | | | user: test
282 | | | | | user: test
283 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
283 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
284 | | | | | summary: (29) regular commit
284 | | | | | summary: (29) regular commit
285 | | | | |
285 | | | | |
286 | | o | | changeset: 28:44ecd0b9ae99
286 | | o | | changeset: 28:44ecd0b9ae99
287 | | |\ \ \ parent: 1:6db2ef61d156
287 | | |\ \ \ parent: 1:6db2ef61d156
288 | | | | | | parent: 26:7f25b6c2f0b9
288 | | | | | | parent: 26:7f25b6c2f0b9
289 | | | | | | user: test
289 | | | | | | user: test
290 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
290 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
291 | | | | | | summary: (28) merge zero known
291 | | | | | | summary: (28) merge zero known
292 | | | | | |
292 | | | | | |
293 o | | | | | changeset: 27:886ed638191b
293 o | | | | | changeset: 27:886ed638191b
294 |/ / / / / parent: 21:d42a756af44d
294 |/ / / / / parent: 21:d42a756af44d
295 | | | | | user: test
295 | | | | | user: test
296 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
296 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
297 | | | | | summary: (27) collapse
297 | | | | | summary: (27) collapse
298 | | | | |
298 | | | | |
299 | | o---+ changeset: 26:7f25b6c2f0b9
299 | | o---+ changeset: 26:7f25b6c2f0b9
300 | | | | | parent: 18:1aa84d96232a
300 | | | | | parent: 18:1aa84d96232a
301 | | | | | parent: 25:91da8ed57247
301 | | | | | parent: 25:91da8ed57247
302 | | | | | user: test
302 | | | | | user: test
303 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
303 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
304 | | | | | summary: (26) merge one known; far right
304 | | | | | summary: (26) merge one known; far right
305 | | | | |
305 | | | | |
306 +---o | | changeset: 25:91da8ed57247
306 +---o | | changeset: 25:91da8ed57247
307 | | | | | parent: 21:d42a756af44d
307 | | | | | parent: 21:d42a756af44d
308 | | | | | parent: 24:a9c19a3d96b7
308 | | | | | parent: 24:a9c19a3d96b7
309 | | | | | user: test
309 | | | | | user: test
310 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
310 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
311 | | | | | summary: (25) merge one known; far left
311 | | | | | summary: (25) merge one known; far left
312 | | | | |
312 | | | | |
313 | | o | | changeset: 24:a9c19a3d96b7
313 | | o | | changeset: 24:a9c19a3d96b7
314 | | |\| | parent: 0:e6eb3150255d
314 | | |\| | parent: 0:e6eb3150255d
315 | | | | | parent: 23:a01cddf0766d
315 | | | | | parent: 23:a01cddf0766d
316 | | | | | user: test
316 | | | | | user: test
317 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
317 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
318 | | | | | summary: (24) merge one known; immediate right
318 | | | | | summary: (24) merge one known; immediate right
319 | | | | |
319 | | | | |
320 | | o | | changeset: 23:a01cddf0766d
320 | | o | | changeset: 23:a01cddf0766d
321 | |/| | | parent: 1:6db2ef61d156
321 | |/| | | parent: 1:6db2ef61d156
322 | | | | | parent: 22:e0d9cccacb5d
322 | | | | | parent: 22:e0d9cccacb5d
323 | | | | | user: test
323 | | | | | user: test
324 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
324 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
325 | | | | | summary: (23) merge one known; immediate left
325 | | | | | summary: (23) merge one known; immediate left
326 | | | | |
326 | | | | |
327 +---o---+ changeset: 22:e0d9cccacb5d
327 +---o---+ changeset: 22:e0d9cccacb5d
328 | | | | parent: 18:1aa84d96232a
328 | | | | parent: 18:1aa84d96232a
329 | | / / parent: 21:d42a756af44d
329 | | / / parent: 21:d42a756af44d
330 | | | | user: test
330 | | | | user: test
331 | | | | date: Thu Jan 01 00:00:22 1970 +0000
331 | | | | date: Thu Jan 01 00:00:22 1970 +0000
332 | | | | summary: (22) merge two known; one far left, one far right
332 | | | | summary: (22) merge two known; one far left, one far right
333 | | | |
333 | | | |
334 o | | | changeset: 21:d42a756af44d
334 o | | | changeset: 21:d42a756af44d
335 |\ \ \ \ parent: 19:31ddc2c1573b
335 |\ \ \ \ parent: 19:31ddc2c1573b
336 | | | | | parent: 20:d30ed6450e32
336 | | | | | parent: 20:d30ed6450e32
337 | | | | | user: test
337 | | | | | user: test
338 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
338 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
339 | | | | | summary: (21) expand
339 | | | | | summary: (21) expand
340 | | | | |
340 | | | | |
341 | o---+-+ changeset: 20:d30ed6450e32
341 | o---+-+ changeset: 20:d30ed6450e32
342 | | | | parent: 0:e6eb3150255d
342 | | | | parent: 0:e6eb3150255d
343 | / / / parent: 18:1aa84d96232a
343 | / / / parent: 18:1aa84d96232a
344 | | | | user: test
344 | | | | user: test
345 | | | | date: Thu Jan 01 00:00:20 1970 +0000
345 | | | | date: Thu Jan 01 00:00:20 1970 +0000
346 | | | | summary: (20) merge two known; two far right
346 | | | | summary: (20) merge two known; two far right
347 | | | |
347 | | | |
348 o | | | changeset: 19:31ddc2c1573b
348 o | | | changeset: 19:31ddc2c1573b
349 |\ \ \ \ parent: 15:1dda3f72782d
349 |\ \ \ \ parent: 15:1dda3f72782d
350 | | | | | parent: 17:44765d7c06e0
350 | | | | | parent: 17:44765d7c06e0
351 | | | | | user: test
351 | | | | | user: test
352 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
352 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
353 | | | | | summary: (19) expand
353 | | | | | summary: (19) expand
354 | | | | |
354 | | | | |
355 +---+---o changeset: 18:1aa84d96232a
355 +---+---o changeset: 18:1aa84d96232a
356 | | | | parent: 1:6db2ef61d156
356 | | | | parent: 1:6db2ef61d156
357 | | | | parent: 15:1dda3f72782d
357 | | | | parent: 15:1dda3f72782d
358 | | | | user: test
358 | | | | user: test
359 | | | | date: Thu Jan 01 00:00:18 1970 +0000
359 | | | | date: Thu Jan 01 00:00:18 1970 +0000
360 | | | | summary: (18) merge two known; two far left
360 | | | | summary: (18) merge two known; two far left
361 | | | |
361 | | | |
362 | o | | changeset: 17:44765d7c06e0
362 | o | | changeset: 17:44765d7c06e0
363 | |\ \ \ parent: 12:86b91144a6e9
363 | |\ \ \ parent: 12:86b91144a6e9
364 | | | | | parent: 16:3677d192927d
364 | | | | | parent: 16:3677d192927d
365 | | | | | user: test
365 | | | | | user: test
366 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
366 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
367 | | | | | summary: (17) expand
367 | | | | | summary: (17) expand
368 | | | | |
368 | | | | |
369 | | o---+ changeset: 16:3677d192927d
369 | | o---+ changeset: 16:3677d192927d
370 | | | | | parent: 0:e6eb3150255d
370 | | | | | parent: 0:e6eb3150255d
371 | | |/ / parent: 1:6db2ef61d156
371 | | |/ / parent: 1:6db2ef61d156
372 | | | | user: test
372 | | | | user: test
373 | | | | date: Thu Jan 01 00:00:16 1970 +0000
373 | | | | date: Thu Jan 01 00:00:16 1970 +0000
374 | | | | summary: (16) merge two known; one immediate right, one near right
374 | | | | summary: (16) merge two known; one immediate right, one near right
375 | | | |
375 | | | |
376 o | | | changeset: 15:1dda3f72782d
376 o | | | changeset: 15:1dda3f72782d
377 |\ \ \ \ parent: 13:22d8966a97e3
377 |\ \ \ \ parent: 13:22d8966a97e3
378 | | | | | parent: 14:8eac370358ef
378 | | | | | parent: 14:8eac370358ef
379 | | | | | user: test
379 | | | | | user: test
380 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
380 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
381 | | | | | summary: (15) expand
381 | | | | | summary: (15) expand
382 | | | | |
382 | | | | |
383 | o-----+ changeset: 14:8eac370358ef
383 | o-----+ changeset: 14:8eac370358ef
384 | | | | | parent: 0:e6eb3150255d
384 | | | | | parent: 0:e6eb3150255d
385 | |/ / / parent: 12:86b91144a6e9
385 | |/ / / parent: 12:86b91144a6e9
386 | | | | user: test
386 | | | | user: test
387 | | | | date: Thu Jan 01 00:00:14 1970 +0000
387 | | | | date: Thu Jan 01 00:00:14 1970 +0000
388 | | | | summary: (14) merge two known; one immediate right, one far right
388 | | | | summary: (14) merge two known; one immediate right, one far right
389 | | | |
389 | | | |
390 o | | | changeset: 13:22d8966a97e3
390 o | | | changeset: 13:22d8966a97e3
391 |\ \ \ \ parent: 9:7010c0af0a35
391 |\ \ \ \ parent: 9:7010c0af0a35
392 | | | | | parent: 11:832d76e6bdf2
392 | | | | | parent: 11:832d76e6bdf2
393 | | | | | user: test
393 | | | | | user: test
394 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
394 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
395 | | | | | summary: (13) expand
395 | | | | | summary: (13) expand
396 | | | | |
396 | | | | |
397 +---o | | changeset: 12:86b91144a6e9
397 +---o | | changeset: 12:86b91144a6e9
398 | | |/ / parent: 1:6db2ef61d156
398 | | |/ / parent: 1:6db2ef61d156
399 | | | | parent: 9:7010c0af0a35
399 | | | | parent: 9:7010c0af0a35
400 | | | | user: test
400 | | | | user: test
401 | | | | date: Thu Jan 01 00:00:12 1970 +0000
401 | | | | date: Thu Jan 01 00:00:12 1970 +0000
402 | | | | summary: (12) merge two known; one immediate right, one far left
402 | | | | summary: (12) merge two known; one immediate right, one far left
403 | | | |
403 | | | |
404 | o | | changeset: 11:832d76e6bdf2
404 | o | | changeset: 11:832d76e6bdf2
405 | |\ \ \ parent: 6:b105a072e251
405 | |\ \ \ parent: 6:b105a072e251
406 | | | | | parent: 10:74c64d036d72
406 | | | | | parent: 10:74c64d036d72
407 | | | | | user: test
407 | | | | | user: test
408 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
408 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
409 | | | | | summary: (11) expand
409 | | | | | summary: (11) expand
410 | | | | |
410 | | | | |
411 | | o---+ changeset: 10:74c64d036d72
411 | | o---+ changeset: 10:74c64d036d72
412 | | | | | parent: 0:e6eb3150255d
412 | | | | | parent: 0:e6eb3150255d
413 | |/ / / parent: 6:b105a072e251
413 | |/ / / parent: 6:b105a072e251
414 | | | | user: test
414 | | | | user: test
415 | | | | date: Thu Jan 01 00:00:10 1970 +0000
415 | | | | date: Thu Jan 01 00:00:10 1970 +0000
416 | | | | summary: (10) merge two known; one immediate left, one near right
416 | | | | summary: (10) merge two known; one immediate left, one near right
417 | | | |
417 | | | |
418 o | | | changeset: 9:7010c0af0a35
418 o | | | changeset: 9:7010c0af0a35
419 |\ \ \ \ parent: 7:b632bb1b1224
419 |\ \ \ \ parent: 7:b632bb1b1224
420 | | | | | parent: 8:7a0b11f71937
420 | | | | | parent: 8:7a0b11f71937
421 | | | | | user: test
421 | | | | | user: test
422 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
422 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
423 | | | | | summary: (9) expand
423 | | | | | summary: (9) expand
424 | | | | |
424 | | | | |
425 | o-----+ changeset: 8:7a0b11f71937
425 | o-----+ changeset: 8:7a0b11f71937
426 | | | | | parent: 0:e6eb3150255d
426 | | | | | parent: 0:e6eb3150255d
427 |/ / / / parent: 7:b632bb1b1224
427 |/ / / / parent: 7:b632bb1b1224
428 | | | | user: test
428 | | | | user: test
429 | | | | date: Thu Jan 01 00:00:08 1970 +0000
429 | | | | date: Thu Jan 01 00:00:08 1970 +0000
430 | | | | summary: (8) merge two known; one immediate left, one far right
430 | | | | summary: (8) merge two known; one immediate left, one far right
431 | | | |
431 | | | |
432 o | | | changeset: 7:b632bb1b1224
432 o | | | changeset: 7:b632bb1b1224
433 |\ \ \ \ parent: 2:3d9a33b8d1e1
433 |\ \ \ \ parent: 2:3d9a33b8d1e1
434 | | | | | parent: 5:4409d547b708
434 | | | | | parent: 5:4409d547b708
435 | | | | | user: test
435 | | | | | user: test
436 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
436 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
437 | | | | | summary: (7) expand
437 | | | | | summary: (7) expand
438 | | | | |
438 | | | | |
439 +---o | | changeset: 6:b105a072e251
439 +---o | | changeset: 6:b105a072e251
440 | |/ / / parent: 2:3d9a33b8d1e1
440 | |/ / / parent: 2:3d9a33b8d1e1
441 | | | | parent: 5:4409d547b708
441 | | | | parent: 5:4409d547b708
442 | | | | user: test
442 | | | | user: test
443 | | | | date: Thu Jan 01 00:00:06 1970 +0000
443 | | | | date: Thu Jan 01 00:00:06 1970 +0000
444 | | | | summary: (6) merge two known; one immediate left, one far left
444 | | | | summary: (6) merge two known; one immediate left, one far left
445 | | | |
445 | | | |
446 | o | | changeset: 5:4409d547b708
446 | o | | changeset: 5:4409d547b708
447 | |\ \ \ parent: 3:27eef8ed80b4
447 | |\ \ \ parent: 3:27eef8ed80b4
448 | | | | | parent: 4:26a8bac39d9f
448 | | | | | parent: 4:26a8bac39d9f
449 | | | | | user: test
449 | | | | | user: test
450 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
450 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
451 | | | | | summary: (5) expand
451 | | | | | summary: (5) expand
452 | | | | |
452 | | | | |
453 | | o | | changeset: 4:26a8bac39d9f
453 | | o | | changeset: 4:26a8bac39d9f
454 | |/|/ / parent: 1:6db2ef61d156
454 | |/|/ / parent: 1:6db2ef61d156
455 | | | | parent: 3:27eef8ed80b4
455 | | | | parent: 3:27eef8ed80b4
456 | | | | user: test
456 | | | | user: test
457 | | | | date: Thu Jan 01 00:00:04 1970 +0000
457 | | | | date: Thu Jan 01 00:00:04 1970 +0000
458 | | | | summary: (4) merge two known; one immediate left, one immediate right
458 | | | | summary: (4) merge two known; one immediate left, one immediate right
459 | | | |
459 | | | |
460 | o | | changeset: 3:27eef8ed80b4
460 | o | | changeset: 3:27eef8ed80b4
461 |/ / / user: test
461 |/ / / user: test
462 | | | date: Thu Jan 01 00:00:03 1970 +0000
462 | | | date: Thu Jan 01 00:00:03 1970 +0000
463 | | | summary: (3) collapse
463 | | | summary: (3) collapse
464 | | |
464 | | |
465 o | | changeset: 2:3d9a33b8d1e1
465 o | | changeset: 2:3d9a33b8d1e1
466 |/ / user: test
466 |/ / user: test
467 | | date: Thu Jan 01 00:00:02 1970 +0000
467 | | date: Thu Jan 01 00:00:02 1970 +0000
468 | | summary: (2) collapse
468 | | summary: (2) collapse
469 | |
469 | |
470 o | changeset: 1:6db2ef61d156
470 o | changeset: 1:6db2ef61d156
471 |/ user: test
471 |/ user: test
472 | date: Thu Jan 01 00:00:01 1970 +0000
472 | date: Thu Jan 01 00:00:01 1970 +0000
473 | summary: (1) collapse
473 | summary: (1) collapse
474 |
474 |
475 o changeset: 0:e6eb3150255d
475 o changeset: 0:e6eb3150255d
476 user: test
476 user: test
477 date: Thu Jan 01 00:00:00 1970 +0000
477 date: Thu Jan 01 00:00:00 1970 +0000
478 summary: (0) root
478 summary: (0) root
479
479
480
480
481 File glog:
481 File glog:
482 $ hg log -G a
482 $ hg log -G a
483 @ changeset: 34:fea3ac5810e0
483 @ changeset: 34:fea3ac5810e0
484 | tag: tip
484 | tag: tip
485 | parent: 32:d06dffa21a31
485 | parent: 32:d06dffa21a31
486 | user: test
486 | user: test
487 | date: Thu Jan 01 00:00:34 1970 +0000
487 | date: Thu Jan 01 00:00:34 1970 +0000
488 | summary: (34) head
488 | summary: (34) head
489 |
489 |
490 | o changeset: 33:68608f5145f9
490 | o changeset: 33:68608f5145f9
491 | | parent: 18:1aa84d96232a
491 | | parent: 18:1aa84d96232a
492 | | user: test
492 | | user: test
493 | | date: Thu Jan 01 00:00:33 1970 +0000
493 | | date: Thu Jan 01 00:00:33 1970 +0000
494 | | summary: (33) head
494 | | summary: (33) head
495 | |
495 | |
496 o | changeset: 32:d06dffa21a31
496 o | changeset: 32:d06dffa21a31
497 |\ \ parent: 27:886ed638191b
497 |\ \ parent: 27:886ed638191b
498 | | | parent: 31:621d83e11f67
498 | | | parent: 31:621d83e11f67
499 | | | user: test
499 | | | user: test
500 | | | date: Thu Jan 01 00:00:32 1970 +0000
500 | | | date: Thu Jan 01 00:00:32 1970 +0000
501 | | | summary: (32) expand
501 | | | summary: (32) expand
502 | | |
502 | | |
503 | o | changeset: 31:621d83e11f67
503 | o | changeset: 31:621d83e11f67
504 | |\ \ parent: 21:d42a756af44d
504 | |\ \ parent: 21:d42a756af44d
505 | | | | parent: 30:6e11cd4b648f
505 | | | | parent: 30:6e11cd4b648f
506 | | | | user: test
506 | | | | user: test
507 | | | | date: Thu Jan 01 00:00:31 1970 +0000
507 | | | | date: Thu Jan 01 00:00:31 1970 +0000
508 | | | | summary: (31) expand
508 | | | | summary: (31) expand
509 | | | |
509 | | | |
510 | | o | changeset: 30:6e11cd4b648f
510 | | o | changeset: 30:6e11cd4b648f
511 | | |\ \ parent: 28:44ecd0b9ae99
511 | | |\ \ parent: 28:44ecd0b9ae99
512 | | | | | parent: 29:cd9bb2be7593
512 | | | | | parent: 29:cd9bb2be7593
513 | | | | | user: test
513 | | | | | user: test
514 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
514 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
515 | | | | | summary: (30) expand
515 | | | | | summary: (30) expand
516 | | | | |
516 | | | | |
517 | | | o | changeset: 29:cd9bb2be7593
517 | | | o | changeset: 29:cd9bb2be7593
518 | | | | | parent: 0:e6eb3150255d
518 | | | | | parent: 0:e6eb3150255d
519 | | | | | user: test
519 | | | | | user: test
520 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
520 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
521 | | | | | summary: (29) regular commit
521 | | | | | summary: (29) regular commit
522 | | | | |
522 | | | | |
523 | | o | | changeset: 28:44ecd0b9ae99
523 | | o | | changeset: 28:44ecd0b9ae99
524 | | |\ \ \ parent: 1:6db2ef61d156
524 | | |\ \ \ parent: 1:6db2ef61d156
525 | | | | | | parent: 26:7f25b6c2f0b9
525 | | | | | | parent: 26:7f25b6c2f0b9
526 | | | | | | user: test
526 | | | | | | user: test
527 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
527 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
528 | | | | | | summary: (28) merge zero known
528 | | | | | | summary: (28) merge zero known
529 | | | | | |
529 | | | | | |
530 o | | | | | changeset: 27:886ed638191b
530 o | | | | | changeset: 27:886ed638191b
531 |/ / / / / parent: 21:d42a756af44d
531 |/ / / / / parent: 21:d42a756af44d
532 | | | | | user: test
532 | | | | | user: test
533 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
533 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
534 | | | | | summary: (27) collapse
534 | | | | | summary: (27) collapse
535 | | | | |
535 | | | | |
536 | | o---+ changeset: 26:7f25b6c2f0b9
536 | | o---+ changeset: 26:7f25b6c2f0b9
537 | | | | | parent: 18:1aa84d96232a
537 | | | | | parent: 18:1aa84d96232a
538 | | | | | parent: 25:91da8ed57247
538 | | | | | parent: 25:91da8ed57247
539 | | | | | user: test
539 | | | | | user: test
540 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
540 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
541 | | | | | summary: (26) merge one known; far right
541 | | | | | summary: (26) merge one known; far right
542 | | | | |
542 | | | | |
543 +---o | | changeset: 25:91da8ed57247
543 +---o | | changeset: 25:91da8ed57247
544 | | | | | parent: 21:d42a756af44d
544 | | | | | parent: 21:d42a756af44d
545 | | | | | parent: 24:a9c19a3d96b7
545 | | | | | parent: 24:a9c19a3d96b7
546 | | | | | user: test
546 | | | | | user: test
547 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
547 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
548 | | | | | summary: (25) merge one known; far left
548 | | | | | summary: (25) merge one known; far left
549 | | | | |
549 | | | | |
550 | | o | | changeset: 24:a9c19a3d96b7
550 | | o | | changeset: 24:a9c19a3d96b7
551 | | |\| | parent: 0:e6eb3150255d
551 | | |\| | parent: 0:e6eb3150255d
552 | | | | | parent: 23:a01cddf0766d
552 | | | | | parent: 23:a01cddf0766d
553 | | | | | user: test
553 | | | | | user: test
554 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
554 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
555 | | | | | summary: (24) merge one known; immediate right
555 | | | | | summary: (24) merge one known; immediate right
556 | | | | |
556 | | | | |
557 | | o | | changeset: 23:a01cddf0766d
557 | | o | | changeset: 23:a01cddf0766d
558 | |/| | | parent: 1:6db2ef61d156
558 | |/| | | parent: 1:6db2ef61d156
559 | | | | | parent: 22:e0d9cccacb5d
559 | | | | | parent: 22:e0d9cccacb5d
560 | | | | | user: test
560 | | | | | user: test
561 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
561 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
562 | | | | | summary: (23) merge one known; immediate left
562 | | | | | summary: (23) merge one known; immediate left
563 | | | | |
563 | | | | |
564 +---o---+ changeset: 22:e0d9cccacb5d
564 +---o---+ changeset: 22:e0d9cccacb5d
565 | | | | parent: 18:1aa84d96232a
565 | | | | parent: 18:1aa84d96232a
566 | | / / parent: 21:d42a756af44d
566 | | / / parent: 21:d42a756af44d
567 | | | | user: test
567 | | | | user: test
568 | | | | date: Thu Jan 01 00:00:22 1970 +0000
568 | | | | date: Thu Jan 01 00:00:22 1970 +0000
569 | | | | summary: (22) merge two known; one far left, one far right
569 | | | | summary: (22) merge two known; one far left, one far right
570 | | | |
570 | | | |
571 o | | | changeset: 21:d42a756af44d
571 o | | | changeset: 21:d42a756af44d
572 |\ \ \ \ parent: 19:31ddc2c1573b
572 |\ \ \ \ parent: 19:31ddc2c1573b
573 | | | | | parent: 20:d30ed6450e32
573 | | | | | parent: 20:d30ed6450e32
574 | | | | | user: test
574 | | | | | user: test
575 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
575 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
576 | | | | | summary: (21) expand
576 | | | | | summary: (21) expand
577 | | | | |
577 | | | | |
578 | o---+-+ changeset: 20:d30ed6450e32
578 | o---+-+ changeset: 20:d30ed6450e32
579 | | | | parent: 0:e6eb3150255d
579 | | | | parent: 0:e6eb3150255d
580 | / / / parent: 18:1aa84d96232a
580 | / / / parent: 18:1aa84d96232a
581 | | | | user: test
581 | | | | user: test
582 | | | | date: Thu Jan 01 00:00:20 1970 +0000
582 | | | | date: Thu Jan 01 00:00:20 1970 +0000
583 | | | | summary: (20) merge two known; two far right
583 | | | | summary: (20) merge two known; two far right
584 | | | |
584 | | | |
585 o | | | changeset: 19:31ddc2c1573b
585 o | | | changeset: 19:31ddc2c1573b
586 |\ \ \ \ parent: 15:1dda3f72782d
586 |\ \ \ \ parent: 15:1dda3f72782d
587 | | | | | parent: 17:44765d7c06e0
587 | | | | | parent: 17:44765d7c06e0
588 | | | | | user: test
588 | | | | | user: test
589 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
589 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
590 | | | | | summary: (19) expand
590 | | | | | summary: (19) expand
591 | | | | |
591 | | | | |
592 +---+---o changeset: 18:1aa84d96232a
592 +---+---o changeset: 18:1aa84d96232a
593 | | | | parent: 1:6db2ef61d156
593 | | | | parent: 1:6db2ef61d156
594 | | | | parent: 15:1dda3f72782d
594 | | | | parent: 15:1dda3f72782d
595 | | | | user: test
595 | | | | user: test
596 | | | | date: Thu Jan 01 00:00:18 1970 +0000
596 | | | | date: Thu Jan 01 00:00:18 1970 +0000
597 | | | | summary: (18) merge two known; two far left
597 | | | | summary: (18) merge two known; two far left
598 | | | |
598 | | | |
599 | o | | changeset: 17:44765d7c06e0
599 | o | | changeset: 17:44765d7c06e0
600 | |\ \ \ parent: 12:86b91144a6e9
600 | |\ \ \ parent: 12:86b91144a6e9
601 | | | | | parent: 16:3677d192927d
601 | | | | | parent: 16:3677d192927d
602 | | | | | user: test
602 | | | | | user: test
603 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
603 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
604 | | | | | summary: (17) expand
604 | | | | | summary: (17) expand
605 | | | | |
605 | | | | |
606 | | o---+ changeset: 16:3677d192927d
606 | | o---+ changeset: 16:3677d192927d
607 | | | | | parent: 0:e6eb3150255d
607 | | | | | parent: 0:e6eb3150255d
608 | | |/ / parent: 1:6db2ef61d156
608 | | |/ / parent: 1:6db2ef61d156
609 | | | | user: test
609 | | | | user: test
610 | | | | date: Thu Jan 01 00:00:16 1970 +0000
610 | | | | date: Thu Jan 01 00:00:16 1970 +0000
611 | | | | summary: (16) merge two known; one immediate right, one near right
611 | | | | summary: (16) merge two known; one immediate right, one near right
612 | | | |
612 | | | |
613 o | | | changeset: 15:1dda3f72782d
613 o | | | changeset: 15:1dda3f72782d
614 |\ \ \ \ parent: 13:22d8966a97e3
614 |\ \ \ \ parent: 13:22d8966a97e3
615 | | | | | parent: 14:8eac370358ef
615 | | | | | parent: 14:8eac370358ef
616 | | | | | user: test
616 | | | | | user: test
617 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
617 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
618 | | | | | summary: (15) expand
618 | | | | | summary: (15) expand
619 | | | | |
619 | | | | |
620 | o-----+ changeset: 14:8eac370358ef
620 | o-----+ changeset: 14:8eac370358ef
621 | | | | | parent: 0:e6eb3150255d
621 | | | | | parent: 0:e6eb3150255d
622 | |/ / / parent: 12:86b91144a6e9
622 | |/ / / parent: 12:86b91144a6e9
623 | | | | user: test
623 | | | | user: test
624 | | | | date: Thu Jan 01 00:00:14 1970 +0000
624 | | | | date: Thu Jan 01 00:00:14 1970 +0000
625 | | | | summary: (14) merge two known; one immediate right, one far right
625 | | | | summary: (14) merge two known; one immediate right, one far right
626 | | | |
626 | | | |
627 o | | | changeset: 13:22d8966a97e3
627 o | | | changeset: 13:22d8966a97e3
628 |\ \ \ \ parent: 9:7010c0af0a35
628 |\ \ \ \ parent: 9:7010c0af0a35
629 | | | | | parent: 11:832d76e6bdf2
629 | | | | | parent: 11:832d76e6bdf2
630 | | | | | user: test
630 | | | | | user: test
631 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
631 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
632 | | | | | summary: (13) expand
632 | | | | | summary: (13) expand
633 | | | | |
633 | | | | |
634 +---o | | changeset: 12:86b91144a6e9
634 +---o | | changeset: 12:86b91144a6e9
635 | | |/ / parent: 1:6db2ef61d156
635 | | |/ / parent: 1:6db2ef61d156
636 | | | | parent: 9:7010c0af0a35
636 | | | | parent: 9:7010c0af0a35
637 | | | | user: test
637 | | | | user: test
638 | | | | date: Thu Jan 01 00:00:12 1970 +0000
638 | | | | date: Thu Jan 01 00:00:12 1970 +0000
639 | | | | summary: (12) merge two known; one immediate right, one far left
639 | | | | summary: (12) merge two known; one immediate right, one far left
640 | | | |
640 | | | |
641 | o | | changeset: 11:832d76e6bdf2
641 | o | | changeset: 11:832d76e6bdf2
642 | |\ \ \ parent: 6:b105a072e251
642 | |\ \ \ parent: 6:b105a072e251
643 | | | | | parent: 10:74c64d036d72
643 | | | | | parent: 10:74c64d036d72
644 | | | | | user: test
644 | | | | | user: test
645 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
645 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
646 | | | | | summary: (11) expand
646 | | | | | summary: (11) expand
647 | | | | |
647 | | | | |
648 | | o---+ changeset: 10:74c64d036d72
648 | | o---+ changeset: 10:74c64d036d72
649 | | | | | parent: 0:e6eb3150255d
649 | | | | | parent: 0:e6eb3150255d
650 | |/ / / parent: 6:b105a072e251
650 | |/ / / parent: 6:b105a072e251
651 | | | | user: test
651 | | | | user: test
652 | | | | date: Thu Jan 01 00:00:10 1970 +0000
652 | | | | date: Thu Jan 01 00:00:10 1970 +0000
653 | | | | summary: (10) merge two known; one immediate left, one near right
653 | | | | summary: (10) merge two known; one immediate left, one near right
654 | | | |
654 | | | |
655 o | | | changeset: 9:7010c0af0a35
655 o | | | changeset: 9:7010c0af0a35
656 |\ \ \ \ parent: 7:b632bb1b1224
656 |\ \ \ \ parent: 7:b632bb1b1224
657 | | | | | parent: 8:7a0b11f71937
657 | | | | | parent: 8:7a0b11f71937
658 | | | | | user: test
658 | | | | | user: test
659 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
659 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
660 | | | | | summary: (9) expand
660 | | | | | summary: (9) expand
661 | | | | |
661 | | | | |
662 | o-----+ changeset: 8:7a0b11f71937
662 | o-----+ changeset: 8:7a0b11f71937
663 | | | | | parent: 0:e6eb3150255d
663 | | | | | parent: 0:e6eb3150255d
664 |/ / / / parent: 7:b632bb1b1224
664 |/ / / / parent: 7:b632bb1b1224
665 | | | | user: test
665 | | | | user: test
666 | | | | date: Thu Jan 01 00:00:08 1970 +0000
666 | | | | date: Thu Jan 01 00:00:08 1970 +0000
667 | | | | summary: (8) merge two known; one immediate left, one far right
667 | | | | summary: (8) merge two known; one immediate left, one far right
668 | | | |
668 | | | |
669 o | | | changeset: 7:b632bb1b1224
669 o | | | changeset: 7:b632bb1b1224
670 |\ \ \ \ parent: 2:3d9a33b8d1e1
670 |\ \ \ \ parent: 2:3d9a33b8d1e1
671 | | | | | parent: 5:4409d547b708
671 | | | | | parent: 5:4409d547b708
672 | | | | | user: test
672 | | | | | user: test
673 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
673 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
674 | | | | | summary: (7) expand
674 | | | | | summary: (7) expand
675 | | | | |
675 | | | | |
676 +---o | | changeset: 6:b105a072e251
676 +---o | | changeset: 6:b105a072e251
677 | |/ / / parent: 2:3d9a33b8d1e1
677 | |/ / / parent: 2:3d9a33b8d1e1
678 | | | | parent: 5:4409d547b708
678 | | | | parent: 5:4409d547b708
679 | | | | user: test
679 | | | | user: test
680 | | | | date: Thu Jan 01 00:00:06 1970 +0000
680 | | | | date: Thu Jan 01 00:00:06 1970 +0000
681 | | | | summary: (6) merge two known; one immediate left, one far left
681 | | | | summary: (6) merge two known; one immediate left, one far left
682 | | | |
682 | | | |
683 | o | | changeset: 5:4409d547b708
683 | o | | changeset: 5:4409d547b708
684 | |\ \ \ parent: 3:27eef8ed80b4
684 | |\ \ \ parent: 3:27eef8ed80b4
685 | | | | | parent: 4:26a8bac39d9f
685 | | | | | parent: 4:26a8bac39d9f
686 | | | | | user: test
686 | | | | | user: test
687 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
687 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
688 | | | | | summary: (5) expand
688 | | | | | summary: (5) expand
689 | | | | |
689 | | | | |
690 | | o | | changeset: 4:26a8bac39d9f
690 | | o | | changeset: 4:26a8bac39d9f
691 | |/|/ / parent: 1:6db2ef61d156
691 | |/|/ / parent: 1:6db2ef61d156
692 | | | | parent: 3:27eef8ed80b4
692 | | | | parent: 3:27eef8ed80b4
693 | | | | user: test
693 | | | | user: test
694 | | | | date: Thu Jan 01 00:00:04 1970 +0000
694 | | | | date: Thu Jan 01 00:00:04 1970 +0000
695 | | | | summary: (4) merge two known; one immediate left, one immediate right
695 | | | | summary: (4) merge two known; one immediate left, one immediate right
696 | | | |
696 | | | |
697 | o | | changeset: 3:27eef8ed80b4
697 | o | | changeset: 3:27eef8ed80b4
698 |/ / / user: test
698 |/ / / user: test
699 | | | date: Thu Jan 01 00:00:03 1970 +0000
699 | | | date: Thu Jan 01 00:00:03 1970 +0000
700 | | | summary: (3) collapse
700 | | | summary: (3) collapse
701 | | |
701 | | |
702 o | | changeset: 2:3d9a33b8d1e1
702 o | | changeset: 2:3d9a33b8d1e1
703 |/ / user: test
703 |/ / user: test
704 | | date: Thu Jan 01 00:00:02 1970 +0000
704 | | date: Thu Jan 01 00:00:02 1970 +0000
705 | | summary: (2) collapse
705 | | summary: (2) collapse
706 | |
706 | |
707 o | changeset: 1:6db2ef61d156
707 o | changeset: 1:6db2ef61d156
708 |/ user: test
708 |/ user: test
709 | date: Thu Jan 01 00:00:01 1970 +0000
709 | date: Thu Jan 01 00:00:01 1970 +0000
710 | summary: (1) collapse
710 | summary: (1) collapse
711 |
711 |
712 o changeset: 0:e6eb3150255d
712 o changeset: 0:e6eb3150255d
713 user: test
713 user: test
714 date: Thu Jan 01 00:00:00 1970 +0000
714 date: Thu Jan 01 00:00:00 1970 +0000
715 summary: (0) root
715 summary: (0) root
716
716
717
717
718 File glog per revset:
718 File glog per revset:
719
719
720 $ hg log -G -r 'file("a")'
720 $ hg log -G -r 'file("a")'
721 @ changeset: 34:fea3ac5810e0
721 @ changeset: 34:fea3ac5810e0
722 | tag: tip
722 | tag: tip
723 | parent: 32:d06dffa21a31
723 | parent: 32:d06dffa21a31
724 | user: test
724 | user: test
725 | date: Thu Jan 01 00:00:34 1970 +0000
725 | date: Thu Jan 01 00:00:34 1970 +0000
726 | summary: (34) head
726 | summary: (34) head
727 |
727 |
728 | o changeset: 33:68608f5145f9
728 | o changeset: 33:68608f5145f9
729 | | parent: 18:1aa84d96232a
729 | | parent: 18:1aa84d96232a
730 | | user: test
730 | | user: test
731 | | date: Thu Jan 01 00:00:33 1970 +0000
731 | | date: Thu Jan 01 00:00:33 1970 +0000
732 | | summary: (33) head
732 | | summary: (33) head
733 | |
733 | |
734 o | changeset: 32:d06dffa21a31
734 o | changeset: 32:d06dffa21a31
735 |\ \ parent: 27:886ed638191b
735 |\ \ parent: 27:886ed638191b
736 | | | parent: 31:621d83e11f67
736 | | | parent: 31:621d83e11f67
737 | | | user: test
737 | | | user: test
738 | | | date: Thu Jan 01 00:00:32 1970 +0000
738 | | | date: Thu Jan 01 00:00:32 1970 +0000
739 | | | summary: (32) expand
739 | | | summary: (32) expand
740 | | |
740 | | |
741 | o | changeset: 31:621d83e11f67
741 | o | changeset: 31:621d83e11f67
742 | |\ \ parent: 21:d42a756af44d
742 | |\ \ parent: 21:d42a756af44d
743 | | | | parent: 30:6e11cd4b648f
743 | | | | parent: 30:6e11cd4b648f
744 | | | | user: test
744 | | | | user: test
745 | | | | date: Thu Jan 01 00:00:31 1970 +0000
745 | | | | date: Thu Jan 01 00:00:31 1970 +0000
746 | | | | summary: (31) expand
746 | | | | summary: (31) expand
747 | | | |
747 | | | |
748 | | o | changeset: 30:6e11cd4b648f
748 | | o | changeset: 30:6e11cd4b648f
749 | | |\ \ parent: 28:44ecd0b9ae99
749 | | |\ \ parent: 28:44ecd0b9ae99
750 | | | | | parent: 29:cd9bb2be7593
750 | | | | | parent: 29:cd9bb2be7593
751 | | | | | user: test
751 | | | | | user: test
752 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
752 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
753 | | | | | summary: (30) expand
753 | | | | | summary: (30) expand
754 | | | | |
754 | | | | |
755 | | | o | changeset: 29:cd9bb2be7593
755 | | | o | changeset: 29:cd9bb2be7593
756 | | | | | parent: 0:e6eb3150255d
756 | | | | | parent: 0:e6eb3150255d
757 | | | | | user: test
757 | | | | | user: test
758 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
758 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
759 | | | | | summary: (29) regular commit
759 | | | | | summary: (29) regular commit
760 | | | | |
760 | | | | |
761 | | o | | changeset: 28:44ecd0b9ae99
761 | | o | | changeset: 28:44ecd0b9ae99
762 | | |\ \ \ parent: 1:6db2ef61d156
762 | | |\ \ \ parent: 1:6db2ef61d156
763 | | | | | | parent: 26:7f25b6c2f0b9
763 | | | | | | parent: 26:7f25b6c2f0b9
764 | | | | | | user: test
764 | | | | | | user: test
765 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
765 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
766 | | | | | | summary: (28) merge zero known
766 | | | | | | summary: (28) merge zero known
767 | | | | | |
767 | | | | | |
768 o | | | | | changeset: 27:886ed638191b
768 o | | | | | changeset: 27:886ed638191b
769 |/ / / / / parent: 21:d42a756af44d
769 |/ / / / / parent: 21:d42a756af44d
770 | | | | | user: test
770 | | | | | user: test
771 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
771 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
772 | | | | | summary: (27) collapse
772 | | | | | summary: (27) collapse
773 | | | | |
773 | | | | |
774 | | o---+ changeset: 26:7f25b6c2f0b9
774 | | o---+ changeset: 26:7f25b6c2f0b9
775 | | | | | parent: 18:1aa84d96232a
775 | | | | | parent: 18:1aa84d96232a
776 | | | | | parent: 25:91da8ed57247
776 | | | | | parent: 25:91da8ed57247
777 | | | | | user: test
777 | | | | | user: test
778 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
778 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
779 | | | | | summary: (26) merge one known; far right
779 | | | | | summary: (26) merge one known; far right
780 | | | | |
780 | | | | |
781 +---o | | changeset: 25:91da8ed57247
781 +---o | | changeset: 25:91da8ed57247
782 | | | | | parent: 21:d42a756af44d
782 | | | | | parent: 21:d42a756af44d
783 | | | | | parent: 24:a9c19a3d96b7
783 | | | | | parent: 24:a9c19a3d96b7
784 | | | | | user: test
784 | | | | | user: test
785 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
785 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
786 | | | | | summary: (25) merge one known; far left
786 | | | | | summary: (25) merge one known; far left
787 | | | | |
787 | | | | |
788 | | o | | changeset: 24:a9c19a3d96b7
788 | | o | | changeset: 24:a9c19a3d96b7
789 | | |\| | parent: 0:e6eb3150255d
789 | | |\| | parent: 0:e6eb3150255d
790 | | | | | parent: 23:a01cddf0766d
790 | | | | | parent: 23:a01cddf0766d
791 | | | | | user: test
791 | | | | | user: test
792 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
792 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
793 | | | | | summary: (24) merge one known; immediate right
793 | | | | | summary: (24) merge one known; immediate right
794 | | | | |
794 | | | | |
795 | | o | | changeset: 23:a01cddf0766d
795 | | o | | changeset: 23:a01cddf0766d
796 | |/| | | parent: 1:6db2ef61d156
796 | |/| | | parent: 1:6db2ef61d156
797 | | | | | parent: 22:e0d9cccacb5d
797 | | | | | parent: 22:e0d9cccacb5d
798 | | | | | user: test
798 | | | | | user: test
799 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
799 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
800 | | | | | summary: (23) merge one known; immediate left
800 | | | | | summary: (23) merge one known; immediate left
801 | | | | |
801 | | | | |
802 +---o---+ changeset: 22:e0d9cccacb5d
802 +---o---+ changeset: 22:e0d9cccacb5d
803 | | | | parent: 18:1aa84d96232a
803 | | | | parent: 18:1aa84d96232a
804 | | / / parent: 21:d42a756af44d
804 | | / / parent: 21:d42a756af44d
805 | | | | user: test
805 | | | | user: test
806 | | | | date: Thu Jan 01 00:00:22 1970 +0000
806 | | | | date: Thu Jan 01 00:00:22 1970 +0000
807 | | | | summary: (22) merge two known; one far left, one far right
807 | | | | summary: (22) merge two known; one far left, one far right
808 | | | |
808 | | | |
809 o | | | changeset: 21:d42a756af44d
809 o | | | changeset: 21:d42a756af44d
810 |\ \ \ \ parent: 19:31ddc2c1573b
810 |\ \ \ \ parent: 19:31ddc2c1573b
811 | | | | | parent: 20:d30ed6450e32
811 | | | | | parent: 20:d30ed6450e32
812 | | | | | user: test
812 | | | | | user: test
813 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
813 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
814 | | | | | summary: (21) expand
814 | | | | | summary: (21) expand
815 | | | | |
815 | | | | |
816 | o---+-+ changeset: 20:d30ed6450e32
816 | o---+-+ changeset: 20:d30ed6450e32
817 | | | | parent: 0:e6eb3150255d
817 | | | | parent: 0:e6eb3150255d
818 | / / / parent: 18:1aa84d96232a
818 | / / / parent: 18:1aa84d96232a
819 | | | | user: test
819 | | | | user: test
820 | | | | date: Thu Jan 01 00:00:20 1970 +0000
820 | | | | date: Thu Jan 01 00:00:20 1970 +0000
821 | | | | summary: (20) merge two known; two far right
821 | | | | summary: (20) merge two known; two far right
822 | | | |
822 | | | |
823 o | | | changeset: 19:31ddc2c1573b
823 o | | | changeset: 19:31ddc2c1573b
824 |\ \ \ \ parent: 15:1dda3f72782d
824 |\ \ \ \ parent: 15:1dda3f72782d
825 | | | | | parent: 17:44765d7c06e0
825 | | | | | parent: 17:44765d7c06e0
826 | | | | | user: test
826 | | | | | user: test
827 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
827 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
828 | | | | | summary: (19) expand
828 | | | | | summary: (19) expand
829 | | | | |
829 | | | | |
830 +---+---o changeset: 18:1aa84d96232a
830 +---+---o changeset: 18:1aa84d96232a
831 | | | | parent: 1:6db2ef61d156
831 | | | | parent: 1:6db2ef61d156
832 | | | | parent: 15:1dda3f72782d
832 | | | | parent: 15:1dda3f72782d
833 | | | | user: test
833 | | | | user: test
834 | | | | date: Thu Jan 01 00:00:18 1970 +0000
834 | | | | date: Thu Jan 01 00:00:18 1970 +0000
835 | | | | summary: (18) merge two known; two far left
835 | | | | summary: (18) merge two known; two far left
836 | | | |
836 | | | |
837 | o | | changeset: 17:44765d7c06e0
837 | o | | changeset: 17:44765d7c06e0
838 | |\ \ \ parent: 12:86b91144a6e9
838 | |\ \ \ parent: 12:86b91144a6e9
839 | | | | | parent: 16:3677d192927d
839 | | | | | parent: 16:3677d192927d
840 | | | | | user: test
840 | | | | | user: test
841 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
841 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
842 | | | | | summary: (17) expand
842 | | | | | summary: (17) expand
843 | | | | |
843 | | | | |
844 | | o---+ changeset: 16:3677d192927d
844 | | o---+ changeset: 16:3677d192927d
845 | | | | | parent: 0:e6eb3150255d
845 | | | | | parent: 0:e6eb3150255d
846 | | |/ / parent: 1:6db2ef61d156
846 | | |/ / parent: 1:6db2ef61d156
847 | | | | user: test
847 | | | | user: test
848 | | | | date: Thu Jan 01 00:00:16 1970 +0000
848 | | | | date: Thu Jan 01 00:00:16 1970 +0000
849 | | | | summary: (16) merge two known; one immediate right, one near right
849 | | | | summary: (16) merge two known; one immediate right, one near right
850 | | | |
850 | | | |
851 o | | | changeset: 15:1dda3f72782d
851 o | | | changeset: 15:1dda3f72782d
852 |\ \ \ \ parent: 13:22d8966a97e3
852 |\ \ \ \ parent: 13:22d8966a97e3
853 | | | | | parent: 14:8eac370358ef
853 | | | | | parent: 14:8eac370358ef
854 | | | | | user: test
854 | | | | | user: test
855 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
855 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
856 | | | | | summary: (15) expand
856 | | | | | summary: (15) expand
857 | | | | |
857 | | | | |
858 | o-----+ changeset: 14:8eac370358ef
858 | o-----+ changeset: 14:8eac370358ef
859 | | | | | parent: 0:e6eb3150255d
859 | | | | | parent: 0:e6eb3150255d
860 | |/ / / parent: 12:86b91144a6e9
860 | |/ / / parent: 12:86b91144a6e9
861 | | | | user: test
861 | | | | user: test
862 | | | | date: Thu Jan 01 00:00:14 1970 +0000
862 | | | | date: Thu Jan 01 00:00:14 1970 +0000
863 | | | | summary: (14) merge two known; one immediate right, one far right
863 | | | | summary: (14) merge two known; one immediate right, one far right
864 | | | |
864 | | | |
865 o | | | changeset: 13:22d8966a97e3
865 o | | | changeset: 13:22d8966a97e3
866 |\ \ \ \ parent: 9:7010c0af0a35
866 |\ \ \ \ parent: 9:7010c0af0a35
867 | | | | | parent: 11:832d76e6bdf2
867 | | | | | parent: 11:832d76e6bdf2
868 | | | | | user: test
868 | | | | | user: test
869 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
869 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
870 | | | | | summary: (13) expand
870 | | | | | summary: (13) expand
871 | | | | |
871 | | | | |
872 +---o | | changeset: 12:86b91144a6e9
872 +---o | | changeset: 12:86b91144a6e9
873 | | |/ / parent: 1:6db2ef61d156
873 | | |/ / parent: 1:6db2ef61d156
874 | | | | parent: 9:7010c0af0a35
874 | | | | parent: 9:7010c0af0a35
875 | | | | user: test
875 | | | | user: test
876 | | | | date: Thu Jan 01 00:00:12 1970 +0000
876 | | | | date: Thu Jan 01 00:00:12 1970 +0000
877 | | | | summary: (12) merge two known; one immediate right, one far left
877 | | | | summary: (12) merge two known; one immediate right, one far left
878 | | | |
878 | | | |
879 | o | | changeset: 11:832d76e6bdf2
879 | o | | changeset: 11:832d76e6bdf2
880 | |\ \ \ parent: 6:b105a072e251
880 | |\ \ \ parent: 6:b105a072e251
881 | | | | | parent: 10:74c64d036d72
881 | | | | | parent: 10:74c64d036d72
882 | | | | | user: test
882 | | | | | user: test
883 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
883 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
884 | | | | | summary: (11) expand
884 | | | | | summary: (11) expand
885 | | | | |
885 | | | | |
886 | | o---+ changeset: 10:74c64d036d72
886 | | o---+ changeset: 10:74c64d036d72
887 | | | | | parent: 0:e6eb3150255d
887 | | | | | parent: 0:e6eb3150255d
888 | |/ / / parent: 6:b105a072e251
888 | |/ / / parent: 6:b105a072e251
889 | | | | user: test
889 | | | | user: test
890 | | | | date: Thu Jan 01 00:00:10 1970 +0000
890 | | | | date: Thu Jan 01 00:00:10 1970 +0000
891 | | | | summary: (10) merge two known; one immediate left, one near right
891 | | | | summary: (10) merge two known; one immediate left, one near right
892 | | | |
892 | | | |
893 o | | | changeset: 9:7010c0af0a35
893 o | | | changeset: 9:7010c0af0a35
894 |\ \ \ \ parent: 7:b632bb1b1224
894 |\ \ \ \ parent: 7:b632bb1b1224
895 | | | | | parent: 8:7a0b11f71937
895 | | | | | parent: 8:7a0b11f71937
896 | | | | | user: test
896 | | | | | user: test
897 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
897 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
898 | | | | | summary: (9) expand
898 | | | | | summary: (9) expand
899 | | | | |
899 | | | | |
900 | o-----+ changeset: 8:7a0b11f71937
900 | o-----+ changeset: 8:7a0b11f71937
901 | | | | | parent: 0:e6eb3150255d
901 | | | | | parent: 0:e6eb3150255d
902 |/ / / / parent: 7:b632bb1b1224
902 |/ / / / parent: 7:b632bb1b1224
903 | | | | user: test
903 | | | | user: test
904 | | | | date: Thu Jan 01 00:00:08 1970 +0000
904 | | | | date: Thu Jan 01 00:00:08 1970 +0000
905 | | | | summary: (8) merge two known; one immediate left, one far right
905 | | | | summary: (8) merge two known; one immediate left, one far right
906 | | | |
906 | | | |
907 o | | | changeset: 7:b632bb1b1224
907 o | | | changeset: 7:b632bb1b1224
908 |\ \ \ \ parent: 2:3d9a33b8d1e1
908 |\ \ \ \ parent: 2:3d9a33b8d1e1
909 | | | | | parent: 5:4409d547b708
909 | | | | | parent: 5:4409d547b708
910 | | | | | user: test
910 | | | | | user: test
911 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
911 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
912 | | | | | summary: (7) expand
912 | | | | | summary: (7) expand
913 | | | | |
913 | | | | |
914 +---o | | changeset: 6:b105a072e251
914 +---o | | changeset: 6:b105a072e251
915 | |/ / / parent: 2:3d9a33b8d1e1
915 | |/ / / parent: 2:3d9a33b8d1e1
916 | | | | parent: 5:4409d547b708
916 | | | | parent: 5:4409d547b708
917 | | | | user: test
917 | | | | user: test
918 | | | | date: Thu Jan 01 00:00:06 1970 +0000
918 | | | | date: Thu Jan 01 00:00:06 1970 +0000
919 | | | | summary: (6) merge two known; one immediate left, one far left
919 | | | | summary: (6) merge two known; one immediate left, one far left
920 | | | |
920 | | | |
921 | o | | changeset: 5:4409d547b708
921 | o | | changeset: 5:4409d547b708
922 | |\ \ \ parent: 3:27eef8ed80b4
922 | |\ \ \ parent: 3:27eef8ed80b4
923 | | | | | parent: 4:26a8bac39d9f
923 | | | | | parent: 4:26a8bac39d9f
924 | | | | | user: test
924 | | | | | user: test
925 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
925 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
926 | | | | | summary: (5) expand
926 | | | | | summary: (5) expand
927 | | | | |
927 | | | | |
928 | | o | | changeset: 4:26a8bac39d9f
928 | | o | | changeset: 4:26a8bac39d9f
929 | |/|/ / parent: 1:6db2ef61d156
929 | |/|/ / parent: 1:6db2ef61d156
930 | | | | parent: 3:27eef8ed80b4
930 | | | | parent: 3:27eef8ed80b4
931 | | | | user: test
931 | | | | user: test
932 | | | | date: Thu Jan 01 00:00:04 1970 +0000
932 | | | | date: Thu Jan 01 00:00:04 1970 +0000
933 | | | | summary: (4) merge two known; one immediate left, one immediate right
933 | | | | summary: (4) merge two known; one immediate left, one immediate right
934 | | | |
934 | | | |
935 | o | | changeset: 3:27eef8ed80b4
935 | o | | changeset: 3:27eef8ed80b4
936 |/ / / user: test
936 |/ / / user: test
937 | | | date: Thu Jan 01 00:00:03 1970 +0000
937 | | | date: Thu Jan 01 00:00:03 1970 +0000
938 | | | summary: (3) collapse
938 | | | summary: (3) collapse
939 | | |
939 | | |
940 o | | changeset: 2:3d9a33b8d1e1
940 o | | changeset: 2:3d9a33b8d1e1
941 |/ / user: test
941 |/ / user: test
942 | | date: Thu Jan 01 00:00:02 1970 +0000
942 | | date: Thu Jan 01 00:00:02 1970 +0000
943 | | summary: (2) collapse
943 | | summary: (2) collapse
944 | |
944 | |
945 o | changeset: 1:6db2ef61d156
945 o | changeset: 1:6db2ef61d156
946 |/ user: test
946 |/ user: test
947 | date: Thu Jan 01 00:00:01 1970 +0000
947 | date: Thu Jan 01 00:00:01 1970 +0000
948 | summary: (1) collapse
948 | summary: (1) collapse
949 |
949 |
950 o changeset: 0:e6eb3150255d
950 o changeset: 0:e6eb3150255d
951 user: test
951 user: test
952 date: Thu Jan 01 00:00:00 1970 +0000
952 date: Thu Jan 01 00:00:00 1970 +0000
953 summary: (0) root
953 summary: (0) root
954
954
955
955
956
956
957 File glog per revset (only merges):
957 File glog per revset (only merges):
958
958
959 $ hg log -G -r 'file("a")' -m
959 $ hg log -G -r 'file("a")' -m
960 o changeset: 32:d06dffa21a31
960 o changeset: 32:d06dffa21a31
961 |\ parent: 27:886ed638191b
961 |\ parent: 27:886ed638191b
962 | : parent: 31:621d83e11f67
962 | : parent: 31:621d83e11f67
963 | : user: test
963 | : user: test
964 | : date: Thu Jan 01 00:00:32 1970 +0000
964 | : date: Thu Jan 01 00:00:32 1970 +0000
965 | : summary: (32) expand
965 | : summary: (32) expand
966 | :
966 | :
967 o : changeset: 31:621d83e11f67
967 o : changeset: 31:621d83e11f67
968 |\: parent: 21:d42a756af44d
968 |\: parent: 21:d42a756af44d
969 | : parent: 30:6e11cd4b648f
969 | : parent: 30:6e11cd4b648f
970 | : user: test
970 | : user: test
971 | : date: Thu Jan 01 00:00:31 1970 +0000
971 | : date: Thu Jan 01 00:00:31 1970 +0000
972 | : summary: (31) expand
972 | : summary: (31) expand
973 | :
973 | :
974 o : changeset: 30:6e11cd4b648f
974 o : changeset: 30:6e11cd4b648f
975 |\ \ parent: 28:44ecd0b9ae99
975 |\ \ parent: 28:44ecd0b9ae99
976 | ~ : parent: 29:cd9bb2be7593
976 | ~ : parent: 29:cd9bb2be7593
977 | : user: test
977 | : user: test
978 | : date: Thu Jan 01 00:00:30 1970 +0000
978 | : date: Thu Jan 01 00:00:30 1970 +0000
979 | : summary: (30) expand
979 | : summary: (30) expand
980 | /
980 | /
981 o : changeset: 28:44ecd0b9ae99
981 o : changeset: 28:44ecd0b9ae99
982 |\ \ parent: 1:6db2ef61d156
982 |\ \ parent: 1:6db2ef61d156
983 | ~ : parent: 26:7f25b6c2f0b9
983 | ~ : parent: 26:7f25b6c2f0b9
984 | : user: test
984 | : user: test
985 | : date: Thu Jan 01 00:00:28 1970 +0000
985 | : date: Thu Jan 01 00:00:28 1970 +0000
986 | : summary: (28) merge zero known
986 | : summary: (28) merge zero known
987 | /
987 | /
988 o : changeset: 26:7f25b6c2f0b9
988 o : changeset: 26:7f25b6c2f0b9
989 |\ \ parent: 18:1aa84d96232a
989 |\ \ parent: 18:1aa84d96232a
990 | | : parent: 25:91da8ed57247
990 | | : parent: 25:91da8ed57247
991 | | : user: test
991 | | : user: test
992 | | : date: Thu Jan 01 00:00:26 1970 +0000
992 | | : date: Thu Jan 01 00:00:26 1970 +0000
993 | | : summary: (26) merge one known; far right
993 | | : summary: (26) merge one known; far right
994 | | :
994 | | :
995 | o : changeset: 25:91da8ed57247
995 | o : changeset: 25:91da8ed57247
996 | |\: parent: 21:d42a756af44d
996 | |\: parent: 21:d42a756af44d
997 | | : parent: 24:a9c19a3d96b7
997 | | : parent: 24:a9c19a3d96b7
998 | | : user: test
998 | | : user: test
999 | | : date: Thu Jan 01 00:00:25 1970 +0000
999 | | : date: Thu Jan 01 00:00:25 1970 +0000
1000 | | : summary: (25) merge one known; far left
1000 | | : summary: (25) merge one known; far left
1001 | | :
1001 | | :
1002 | o : changeset: 24:a9c19a3d96b7
1002 | o : changeset: 24:a9c19a3d96b7
1003 | |\ \ parent: 0:e6eb3150255d
1003 | |\ \ parent: 0:e6eb3150255d
1004 | | ~ : parent: 23:a01cddf0766d
1004 | | ~ : parent: 23:a01cddf0766d
1005 | | : user: test
1005 | | : user: test
1006 | | : date: Thu Jan 01 00:00:24 1970 +0000
1006 | | : date: Thu Jan 01 00:00:24 1970 +0000
1007 | | : summary: (24) merge one known; immediate right
1007 | | : summary: (24) merge one known; immediate right
1008 | | /
1008 | | /
1009 | o : changeset: 23:a01cddf0766d
1009 | o : changeset: 23:a01cddf0766d
1010 | |\ \ parent: 1:6db2ef61d156
1010 | |\ \ parent: 1:6db2ef61d156
1011 | | ~ : parent: 22:e0d9cccacb5d
1011 | | ~ : parent: 22:e0d9cccacb5d
1012 | | : user: test
1012 | | : user: test
1013 | | : date: Thu Jan 01 00:00:23 1970 +0000
1013 | | : date: Thu Jan 01 00:00:23 1970 +0000
1014 | | : summary: (23) merge one known; immediate left
1014 | | : summary: (23) merge one known; immediate left
1015 | | /
1015 | | /
1016 | o : changeset: 22:e0d9cccacb5d
1016 | o : changeset: 22:e0d9cccacb5d
1017 |/:/ parent: 18:1aa84d96232a
1017 |/:/ parent: 18:1aa84d96232a
1018 | : parent: 21:d42a756af44d
1018 | : parent: 21:d42a756af44d
1019 | : user: test
1019 | : user: test
1020 | : date: Thu Jan 01 00:00:22 1970 +0000
1020 | : date: Thu Jan 01 00:00:22 1970 +0000
1021 | : summary: (22) merge two known; one far left, one far right
1021 | : summary: (22) merge two known; one far left, one far right
1022 | :
1022 | :
1023 | o changeset: 21:d42a756af44d
1023 | o changeset: 21:d42a756af44d
1024 | |\ parent: 19:31ddc2c1573b
1024 | |\ parent: 19:31ddc2c1573b
1025 | | | parent: 20:d30ed6450e32
1025 | | | parent: 20:d30ed6450e32
1026 | | | user: test
1026 | | | user: test
1027 | | | date: Thu Jan 01 00:00:21 1970 +0000
1027 | | | date: Thu Jan 01 00:00:21 1970 +0000
1028 | | | summary: (21) expand
1028 | | | summary: (21) expand
1029 | | |
1029 | | |
1030 +---o changeset: 20:d30ed6450e32
1030 +---o changeset: 20:d30ed6450e32
1031 | | | parent: 0:e6eb3150255d
1031 | | | parent: 0:e6eb3150255d
1032 | | ~ parent: 18:1aa84d96232a
1032 | | ~ parent: 18:1aa84d96232a
1033 | | user: test
1033 | | user: test
1034 | | date: Thu Jan 01 00:00:20 1970 +0000
1034 | | date: Thu Jan 01 00:00:20 1970 +0000
1035 | | summary: (20) merge two known; two far right
1035 | | summary: (20) merge two known; two far right
1036 | |
1036 | |
1037 | o changeset: 19:31ddc2c1573b
1037 | o changeset: 19:31ddc2c1573b
1038 | |\ parent: 15:1dda3f72782d
1038 | |\ parent: 15:1dda3f72782d
1039 | | | parent: 17:44765d7c06e0
1039 | | | parent: 17:44765d7c06e0
1040 | | | user: test
1040 | | | user: test
1041 | | | date: Thu Jan 01 00:00:19 1970 +0000
1041 | | | date: Thu Jan 01 00:00:19 1970 +0000
1042 | | | summary: (19) expand
1042 | | | summary: (19) expand
1043 | | |
1043 | | |
1044 o | | changeset: 18:1aa84d96232a
1044 o | | changeset: 18:1aa84d96232a
1045 |\| | parent: 1:6db2ef61d156
1045 |\| | parent: 1:6db2ef61d156
1046 ~ | | parent: 15:1dda3f72782d
1046 ~ | | parent: 15:1dda3f72782d
1047 | | user: test
1047 | | user: test
1048 | | date: Thu Jan 01 00:00:18 1970 +0000
1048 | | date: Thu Jan 01 00:00:18 1970 +0000
1049 | | summary: (18) merge two known; two far left
1049 | | summary: (18) merge two known; two far left
1050 / /
1050 / /
1051 | o changeset: 17:44765d7c06e0
1051 | o changeset: 17:44765d7c06e0
1052 | |\ parent: 12:86b91144a6e9
1052 | |\ parent: 12:86b91144a6e9
1053 | | | parent: 16:3677d192927d
1053 | | | parent: 16:3677d192927d
1054 | | | user: test
1054 | | | user: test
1055 | | | date: Thu Jan 01 00:00:17 1970 +0000
1055 | | | date: Thu Jan 01 00:00:17 1970 +0000
1056 | | | summary: (17) expand
1056 | | | summary: (17) expand
1057 | | |
1057 | | |
1058 | | o changeset: 16:3677d192927d
1058 | | o changeset: 16:3677d192927d
1059 | | |\ parent: 0:e6eb3150255d
1059 | | |\ parent: 0:e6eb3150255d
1060 | | ~ ~ parent: 1:6db2ef61d156
1060 | | ~ ~ parent: 1:6db2ef61d156
1061 | | user: test
1061 | | user: test
1062 | | date: Thu Jan 01 00:00:16 1970 +0000
1062 | | date: Thu Jan 01 00:00:16 1970 +0000
1063 | | summary: (16) merge two known; one immediate right, one near right
1063 | | summary: (16) merge two known; one immediate right, one near right
1064 | |
1064 | |
1065 o | changeset: 15:1dda3f72782d
1065 o | changeset: 15:1dda3f72782d
1066 |\ \ parent: 13:22d8966a97e3
1066 |\ \ parent: 13:22d8966a97e3
1067 | | | parent: 14:8eac370358ef
1067 | | | parent: 14:8eac370358ef
1068 | | | user: test
1068 | | | user: test
1069 | | | date: Thu Jan 01 00:00:15 1970 +0000
1069 | | | date: Thu Jan 01 00:00:15 1970 +0000
1070 | | | summary: (15) expand
1070 | | | summary: (15) expand
1071 | | |
1071 | | |
1072 | o | changeset: 14:8eac370358ef
1072 | o | changeset: 14:8eac370358ef
1073 | |\| parent: 0:e6eb3150255d
1073 | |\| parent: 0:e6eb3150255d
1074 | ~ | parent: 12:86b91144a6e9
1074 | ~ | parent: 12:86b91144a6e9
1075 | | user: test
1075 | | user: test
1076 | | date: Thu Jan 01 00:00:14 1970 +0000
1076 | | date: Thu Jan 01 00:00:14 1970 +0000
1077 | | summary: (14) merge two known; one immediate right, one far right
1077 | | summary: (14) merge two known; one immediate right, one far right
1078 | /
1078 | /
1079 o | changeset: 13:22d8966a97e3
1079 o | changeset: 13:22d8966a97e3
1080 |\ \ parent: 9:7010c0af0a35
1080 |\ \ parent: 9:7010c0af0a35
1081 | | | parent: 11:832d76e6bdf2
1081 | | | parent: 11:832d76e6bdf2
1082 | | | user: test
1082 | | | user: test
1083 | | | date: Thu Jan 01 00:00:13 1970 +0000
1083 | | | date: Thu Jan 01 00:00:13 1970 +0000
1084 | | | summary: (13) expand
1084 | | | summary: (13) expand
1085 | | |
1085 | | |
1086 +---o changeset: 12:86b91144a6e9
1086 +---o changeset: 12:86b91144a6e9
1087 | | | parent: 1:6db2ef61d156
1087 | | | parent: 1:6db2ef61d156
1088 | | ~ parent: 9:7010c0af0a35
1088 | | ~ parent: 9:7010c0af0a35
1089 | | user: test
1089 | | user: test
1090 | | date: Thu Jan 01 00:00:12 1970 +0000
1090 | | date: Thu Jan 01 00:00:12 1970 +0000
1091 | | summary: (12) merge two known; one immediate right, one far left
1091 | | summary: (12) merge two known; one immediate right, one far left
1092 | |
1092 | |
1093 | o changeset: 11:832d76e6bdf2
1093 | o changeset: 11:832d76e6bdf2
1094 | |\ parent: 6:b105a072e251
1094 | |\ parent: 6:b105a072e251
1095 | | | parent: 10:74c64d036d72
1095 | | | parent: 10:74c64d036d72
1096 | | | user: test
1096 | | | user: test
1097 | | | date: Thu Jan 01 00:00:11 1970 +0000
1097 | | | date: Thu Jan 01 00:00:11 1970 +0000
1098 | | | summary: (11) expand
1098 | | | summary: (11) expand
1099 | | |
1099 | | |
1100 | | o changeset: 10:74c64d036d72
1100 | | o changeset: 10:74c64d036d72
1101 | |/| parent: 0:e6eb3150255d
1101 | |/| parent: 0:e6eb3150255d
1102 | | ~ parent: 6:b105a072e251
1102 | | ~ parent: 6:b105a072e251
1103 | | user: test
1103 | | user: test
1104 | | date: Thu Jan 01 00:00:10 1970 +0000
1104 | | date: Thu Jan 01 00:00:10 1970 +0000
1105 | | summary: (10) merge two known; one immediate left, one near right
1105 | | summary: (10) merge two known; one immediate left, one near right
1106 | |
1106 | |
1107 o | changeset: 9:7010c0af0a35
1107 o | changeset: 9:7010c0af0a35
1108 |\ \ parent: 7:b632bb1b1224
1108 |\ \ parent: 7:b632bb1b1224
1109 | | | parent: 8:7a0b11f71937
1109 | | | parent: 8:7a0b11f71937
1110 | | | user: test
1110 | | | user: test
1111 | | | date: Thu Jan 01 00:00:09 1970 +0000
1111 | | | date: Thu Jan 01 00:00:09 1970 +0000
1112 | | | summary: (9) expand
1112 | | | summary: (9) expand
1113 | | |
1113 | | |
1114 | o | changeset: 8:7a0b11f71937
1114 | o | changeset: 8:7a0b11f71937
1115 |/| | parent: 0:e6eb3150255d
1115 |/| | parent: 0:e6eb3150255d
1116 | ~ | parent: 7:b632bb1b1224
1116 | ~ | parent: 7:b632bb1b1224
1117 | | user: test
1117 | | user: test
1118 | | date: Thu Jan 01 00:00:08 1970 +0000
1118 | | date: Thu Jan 01 00:00:08 1970 +0000
1119 | | summary: (8) merge two known; one immediate left, one far right
1119 | | summary: (8) merge two known; one immediate left, one far right
1120 | /
1120 | /
1121 o | changeset: 7:b632bb1b1224
1121 o | changeset: 7:b632bb1b1224
1122 |\ \ parent: 2:3d9a33b8d1e1
1122 |\ \ parent: 2:3d9a33b8d1e1
1123 | ~ | parent: 5:4409d547b708
1123 | ~ | parent: 5:4409d547b708
1124 | | user: test
1124 | | user: test
1125 | | date: Thu Jan 01 00:00:07 1970 +0000
1125 | | date: Thu Jan 01 00:00:07 1970 +0000
1126 | | summary: (7) expand
1126 | | summary: (7) expand
1127 | /
1127 | /
1128 | o changeset: 6:b105a072e251
1128 | o changeset: 6:b105a072e251
1129 |/| parent: 2:3d9a33b8d1e1
1129 |/| parent: 2:3d9a33b8d1e1
1130 | ~ parent: 5:4409d547b708
1130 | ~ parent: 5:4409d547b708
1131 | user: test
1131 | user: test
1132 | date: Thu Jan 01 00:00:06 1970 +0000
1132 | date: Thu Jan 01 00:00:06 1970 +0000
1133 | summary: (6) merge two known; one immediate left, one far left
1133 | summary: (6) merge two known; one immediate left, one far left
1134 |
1134 |
1135 o changeset: 5:4409d547b708
1135 o changeset: 5:4409d547b708
1136 |\ parent: 3:27eef8ed80b4
1136 |\ parent: 3:27eef8ed80b4
1137 | ~ parent: 4:26a8bac39d9f
1137 | ~ parent: 4:26a8bac39d9f
1138 | user: test
1138 | user: test
1139 | date: Thu Jan 01 00:00:05 1970 +0000
1139 | date: Thu Jan 01 00:00:05 1970 +0000
1140 | summary: (5) expand
1140 | summary: (5) expand
1141 |
1141 |
1142 o changeset: 4:26a8bac39d9f
1142 o changeset: 4:26a8bac39d9f
1143 |\ parent: 1:6db2ef61d156
1143 |\ parent: 1:6db2ef61d156
1144 ~ ~ parent: 3:27eef8ed80b4
1144 ~ ~ parent: 3:27eef8ed80b4
1145 user: test
1145 user: test
1146 date: Thu Jan 01 00:00:04 1970 +0000
1146 date: Thu Jan 01 00:00:04 1970 +0000
1147 summary: (4) merge two known; one immediate left, one immediate right
1147 summary: (4) merge two known; one immediate left, one immediate right
1148
1148
1149
1149
1150
1150
1151 Empty revision range - display nothing:
1151 Empty revision range - display nothing:
1152 $ hg log -G -r 1..0
1152 $ hg log -G -r 1..0
1153
1153
1154 $ cd ..
1154 $ cd ..
1155
1155
1156 #if no-outer-repo
1156 #if no-outer-repo
1157
1157
1158 From outer space:
1158 From outer space:
1159 $ hg log -G -l1 repo
1159 $ hg log -G -l1 repo
1160 @ changeset: 34:fea3ac5810e0
1160 @ changeset: 34:fea3ac5810e0
1161 | tag: tip
1161 | tag: tip
1162 ~ parent: 32:d06dffa21a31
1162 ~ parent: 32:d06dffa21a31
1163 user: test
1163 user: test
1164 date: Thu Jan 01 00:00:34 1970 +0000
1164 date: Thu Jan 01 00:00:34 1970 +0000
1165 summary: (34) head
1165 summary: (34) head
1166
1166
1167 $ hg log -G -l1 repo/a
1167 $ hg log -G -l1 repo/a
1168 @ changeset: 34:fea3ac5810e0
1168 @ changeset: 34:fea3ac5810e0
1169 | tag: tip
1169 | tag: tip
1170 ~ parent: 32:d06dffa21a31
1170 ~ parent: 32:d06dffa21a31
1171 user: test
1171 user: test
1172 date: Thu Jan 01 00:00:34 1970 +0000
1172 date: Thu Jan 01 00:00:34 1970 +0000
1173 summary: (34) head
1173 summary: (34) head
1174
1174
1175 $ hg log -G -l1 repo/missing
1175 $ hg log -G -l1 repo/missing
1176
1176
1177 #endif
1177 #endif
1178
1178
1179 File log with revs != cset revs:
1179 File log with revs != cset revs:
1180 $ hg init flog
1180 $ hg init flog
1181 $ cd flog
1181 $ cd flog
1182 $ echo one >one
1182 $ echo one >one
1183 $ hg add one
1183 $ hg add one
1184 $ hg commit -mone
1184 $ hg commit -mone
1185 $ echo two >two
1185 $ echo two >two
1186 $ hg add two
1186 $ hg add two
1187 $ hg commit -mtwo
1187 $ hg commit -mtwo
1188 $ echo more >two
1188 $ echo more >two
1189 $ hg commit -mmore
1189 $ hg commit -mmore
1190 $ hg log -G two
1190 $ hg log -G two
1191 @ changeset: 2:12c28321755b
1191 @ changeset: 2:12c28321755b
1192 | tag: tip
1192 | tag: tip
1193 | user: test
1193 | user: test
1194 | date: Thu Jan 01 00:00:00 1970 +0000
1194 | date: Thu Jan 01 00:00:00 1970 +0000
1195 | summary: more
1195 | summary: more
1196 |
1196 |
1197 o changeset: 1:5ac72c0599bf
1197 o changeset: 1:5ac72c0599bf
1198 | user: test
1198 | user: test
1199 ~ date: Thu Jan 01 00:00:00 1970 +0000
1199 ~ date: Thu Jan 01 00:00:00 1970 +0000
1200 summary: two
1200 summary: two
1201
1201
1202
1202
1203 Issue1896: File log with explicit style
1203 Issue1896: File log with explicit style
1204 $ hg log -G --style=default one
1204 $ hg log -G --style=default one
1205 o changeset: 0:3d578b4a1f53
1205 o changeset: 0:3d578b4a1f53
1206 user: test
1206 user: test
1207 date: Thu Jan 01 00:00:00 1970 +0000
1207 date: Thu Jan 01 00:00:00 1970 +0000
1208 summary: one
1208 summary: one
1209
1209
1210 Issue2395: glog --style header and footer
1210 Issue2395: glog --style header and footer
1211 $ hg log -G --style=xml one
1211 $ hg log -G --style=xml one
1212 <?xml version="1.0"?>
1212 <?xml version="1.0"?>
1213 <log>
1213 <log>
1214 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1214 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1215 <author email="test">test</author>
1215 <author email="test">test</author>
1216 <date>1970-01-01T00:00:00+00:00</date>
1216 <date>1970-01-01T00:00:00+00:00</date>
1217 <msg xml:space="preserve">one</msg>
1217 <msg xml:space="preserve">one</msg>
1218 </logentry>
1218 </logentry>
1219 </log>
1219 </log>
1220
1220
1221 $ cd ..
1221 $ cd ..
1222
1222
1223 Incoming and outgoing:
1223 Incoming and outgoing:
1224
1224
1225 $ hg clone -U -r31 repo repo2
1225 $ hg clone -U -r31 repo repo2
1226 adding changesets
1226 adding changesets
1227 adding manifests
1227 adding manifests
1228 adding file changes
1228 adding file changes
1229 added 31 changesets with 31 changes to 1 files
1229 added 31 changesets with 31 changes to 1 files
1230 new changesets e6eb3150255d:621d83e11f67
1230 new changesets e6eb3150255d:621d83e11f67
1231 $ cd repo2
1231 $ cd repo2
1232
1232
1233 $ hg incoming --graph ../repo
1233 $ hg incoming --graph ../repo
1234 comparing with ../repo
1234 comparing with ../repo
1235 searching for changes
1235 searching for changes
1236 o changeset: 34:fea3ac5810e0
1236 o changeset: 34:fea3ac5810e0
1237 | tag: tip
1237 | tag: tip
1238 | parent: 32:d06dffa21a31
1238 | parent: 32:d06dffa21a31
1239 | user: test
1239 | user: test
1240 | date: Thu Jan 01 00:00:34 1970 +0000
1240 | date: Thu Jan 01 00:00:34 1970 +0000
1241 | summary: (34) head
1241 | summary: (34) head
1242 |
1242 |
1243 | o changeset: 33:68608f5145f9
1243 | o changeset: 33:68608f5145f9
1244 | parent: 18:1aa84d96232a
1244 | parent: 18:1aa84d96232a
1245 | user: test
1245 | user: test
1246 | date: Thu Jan 01 00:00:33 1970 +0000
1246 | date: Thu Jan 01 00:00:33 1970 +0000
1247 | summary: (33) head
1247 | summary: (33) head
1248 |
1248 |
1249 o changeset: 32:d06dffa21a31
1249 o changeset: 32:d06dffa21a31
1250 | parent: 27:886ed638191b
1250 | parent: 27:886ed638191b
1251 | parent: 31:621d83e11f67
1251 | parent: 31:621d83e11f67
1252 | user: test
1252 | user: test
1253 | date: Thu Jan 01 00:00:32 1970 +0000
1253 | date: Thu Jan 01 00:00:32 1970 +0000
1254 | summary: (32) expand
1254 | summary: (32) expand
1255 |
1255 |
1256 o changeset: 27:886ed638191b
1256 o changeset: 27:886ed638191b
1257 parent: 21:d42a756af44d
1257 parent: 21:d42a756af44d
1258 user: test
1258 user: test
1259 date: Thu Jan 01 00:00:27 1970 +0000
1259 date: Thu Jan 01 00:00:27 1970 +0000
1260 summary: (27) collapse
1260 summary: (27) collapse
1261
1261
1262 $ cd ..
1262 $ cd ..
1263
1263
1264 $ hg -R repo outgoing --graph repo2
1264 $ hg -R repo outgoing --graph repo2
1265 comparing with repo2
1265 comparing with repo2
1266 searching for changes
1266 searching for changes
1267 @ changeset: 34:fea3ac5810e0
1267 @ changeset: 34:fea3ac5810e0
1268 | tag: tip
1268 | tag: tip
1269 | parent: 32:d06dffa21a31
1269 | parent: 32:d06dffa21a31
1270 | user: test
1270 | user: test
1271 | date: Thu Jan 01 00:00:34 1970 +0000
1271 | date: Thu Jan 01 00:00:34 1970 +0000
1272 | summary: (34) head
1272 | summary: (34) head
1273 |
1273 |
1274 | o changeset: 33:68608f5145f9
1274 | o changeset: 33:68608f5145f9
1275 | parent: 18:1aa84d96232a
1275 | parent: 18:1aa84d96232a
1276 | user: test
1276 | user: test
1277 | date: Thu Jan 01 00:00:33 1970 +0000
1277 | date: Thu Jan 01 00:00:33 1970 +0000
1278 | summary: (33) head
1278 | summary: (33) head
1279 |
1279 |
1280 o changeset: 32:d06dffa21a31
1280 o changeset: 32:d06dffa21a31
1281 | parent: 27:886ed638191b
1281 | parent: 27:886ed638191b
1282 | parent: 31:621d83e11f67
1282 | parent: 31:621d83e11f67
1283 | user: test
1283 | user: test
1284 | date: Thu Jan 01 00:00:32 1970 +0000
1284 | date: Thu Jan 01 00:00:32 1970 +0000
1285 | summary: (32) expand
1285 | summary: (32) expand
1286 |
1286 |
1287 o changeset: 27:886ed638191b
1287 o changeset: 27:886ed638191b
1288 parent: 21:d42a756af44d
1288 parent: 21:d42a756af44d
1289 user: test
1289 user: test
1290 date: Thu Jan 01 00:00:27 1970 +0000
1290 date: Thu Jan 01 00:00:27 1970 +0000
1291 summary: (27) collapse
1291 summary: (27) collapse
1292
1292
1293
1293
1294 File + limit with revs != cset revs:
1294 File + limit with revs != cset revs:
1295 $ cd repo
1295 $ cd repo
1296 $ touch b
1296 $ touch b
1297 $ hg ci -Aqm0
1297 $ hg ci -Aqm0
1298 $ hg log -G -l2 a
1298 $ hg log -G -l2 a
1299 o changeset: 34:fea3ac5810e0
1299 o changeset: 34:fea3ac5810e0
1300 | parent: 32:d06dffa21a31
1300 | parent: 32:d06dffa21a31
1301 ~ user: test
1301 ~ user: test
1302 date: Thu Jan 01 00:00:34 1970 +0000
1302 date: Thu Jan 01 00:00:34 1970 +0000
1303 summary: (34) head
1303 summary: (34) head
1304
1304
1305 o changeset: 33:68608f5145f9
1305 o changeset: 33:68608f5145f9
1306 | parent: 18:1aa84d96232a
1306 | parent: 18:1aa84d96232a
1307 ~ user: test
1307 ~ user: test
1308 date: Thu Jan 01 00:00:33 1970 +0000
1308 date: Thu Jan 01 00:00:33 1970 +0000
1309 summary: (33) head
1309 summary: (33) head
1310
1310
1311
1311
1312 File + limit + -ra:b, (b - a) < limit:
1312 File + limit + -ra:b, (b - a) < limit:
1313 $ hg log -G -l3000 -r32:tip a
1313 $ hg log -G -l3000 -r32:tip a
1314 o changeset: 34:fea3ac5810e0
1314 o changeset: 34:fea3ac5810e0
1315 | parent: 32:d06dffa21a31
1315 | parent: 32:d06dffa21a31
1316 | user: test
1316 | user: test
1317 | date: Thu Jan 01 00:00:34 1970 +0000
1317 | date: Thu Jan 01 00:00:34 1970 +0000
1318 | summary: (34) head
1318 | summary: (34) head
1319 |
1319 |
1320 | o changeset: 33:68608f5145f9
1320 | o changeset: 33:68608f5145f9
1321 | | parent: 18:1aa84d96232a
1321 | | parent: 18:1aa84d96232a
1322 | ~ user: test
1322 | ~ user: test
1323 | date: Thu Jan 01 00:00:33 1970 +0000
1323 | date: Thu Jan 01 00:00:33 1970 +0000
1324 | summary: (33) head
1324 | summary: (33) head
1325 |
1325 |
1326 o changeset: 32:d06dffa21a31
1326 o changeset: 32:d06dffa21a31
1327 |\ parent: 27:886ed638191b
1327 |\ parent: 27:886ed638191b
1328 ~ ~ parent: 31:621d83e11f67
1328 ~ ~ parent: 31:621d83e11f67
1329 user: test
1329 user: test
1330 date: Thu Jan 01 00:00:32 1970 +0000
1330 date: Thu Jan 01 00:00:32 1970 +0000
1331 summary: (32) expand
1331 summary: (32) expand
1332
1332
1333
1333
1334 Point out a common and an uncommon unshown parent
1334 Point out a common and an uncommon unshown parent
1335
1335
1336 $ hg log -G -r 'rev(8) or rev(9)'
1336 $ hg log -G -r 'rev(8) or rev(9)'
1337 o changeset: 9:7010c0af0a35
1337 o changeset: 9:7010c0af0a35
1338 |\ parent: 7:b632bb1b1224
1338 |\ parent: 7:b632bb1b1224
1339 | ~ parent: 8:7a0b11f71937
1339 | ~ parent: 8:7a0b11f71937
1340 | user: test
1340 | user: test
1341 | date: Thu Jan 01 00:00:09 1970 +0000
1341 | date: Thu Jan 01 00:00:09 1970 +0000
1342 | summary: (9) expand
1342 | summary: (9) expand
1343 |
1343 |
1344 o changeset: 8:7a0b11f71937
1344 o changeset: 8:7a0b11f71937
1345 |\ parent: 0:e6eb3150255d
1345 |\ parent: 0:e6eb3150255d
1346 ~ ~ parent: 7:b632bb1b1224
1346 ~ ~ parent: 7:b632bb1b1224
1347 user: test
1347 user: test
1348 date: Thu Jan 01 00:00:08 1970 +0000
1348 date: Thu Jan 01 00:00:08 1970 +0000
1349 summary: (8) merge two known; one immediate left, one far right
1349 summary: (8) merge two known; one immediate left, one far right
1350
1350
1351
1351
1352 File + limit + -ra:b, b < tip:
1352 File + limit + -ra:b, b < tip:
1353
1353
1354 $ hg log -G -l1 -r32:34 a
1354 $ hg log -G -l1 -r32:34 a
1355 o changeset: 34:fea3ac5810e0
1355 o changeset: 34:fea3ac5810e0
1356 | parent: 32:d06dffa21a31
1356 | parent: 32:d06dffa21a31
1357 ~ user: test
1357 ~ user: test
1358 date: Thu Jan 01 00:00:34 1970 +0000
1358 date: Thu Jan 01 00:00:34 1970 +0000
1359 summary: (34) head
1359 summary: (34) head
1360
1360
1361
1361
1362 file(File) + limit + -ra:b, b < tip:
1362 file(File) + limit + -ra:b, b < tip:
1363
1363
1364 $ hg log -G -l1 -r32:34 -r 'file("a")'
1364 $ hg log -G -l1 -r32:34 -r 'file("a")'
1365 o changeset: 34:fea3ac5810e0
1365 o changeset: 34:fea3ac5810e0
1366 | parent: 32:d06dffa21a31
1366 | parent: 32:d06dffa21a31
1367 ~ user: test
1367 ~ user: test
1368 date: Thu Jan 01 00:00:34 1970 +0000
1368 date: Thu Jan 01 00:00:34 1970 +0000
1369 summary: (34) head
1369 summary: (34) head
1370
1370
1371
1371
1372 limit(file(File) and a::b), b < tip:
1372 limit(file(File) and a::b), b < tip:
1373
1373
1374 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1374 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1375 o changeset: 32:d06dffa21a31
1375 o changeset: 32:d06dffa21a31
1376 |\ parent: 27:886ed638191b
1376 |\ parent: 27:886ed638191b
1377 ~ ~ parent: 31:621d83e11f67
1377 ~ ~ parent: 31:621d83e11f67
1378 user: test
1378 user: test
1379 date: Thu Jan 01 00:00:32 1970 +0000
1379 date: Thu Jan 01 00:00:32 1970 +0000
1380 summary: (32) expand
1380 summary: (32) expand
1381
1381
1382
1382
1383 File + limit + -ra:b, b < tip:
1383 File + limit + -ra:b, b < tip:
1384
1384
1385 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1385 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1386
1386
1387 File + limit + -ra:b, b < tip, (b - a) < limit:
1387 File + limit + -ra:b, b < tip, (b - a) < limit:
1388
1388
1389 $ hg log -G -l10 -r33:34 a
1389 $ hg log -G -l10 -r33:34 a
1390 o changeset: 34:fea3ac5810e0
1390 o changeset: 34:fea3ac5810e0
1391 | parent: 32:d06dffa21a31
1391 | parent: 32:d06dffa21a31
1392 ~ user: test
1392 ~ user: test
1393 date: Thu Jan 01 00:00:34 1970 +0000
1393 date: Thu Jan 01 00:00:34 1970 +0000
1394 summary: (34) head
1394 summary: (34) head
1395
1395
1396 o changeset: 33:68608f5145f9
1396 o changeset: 33:68608f5145f9
1397 | parent: 18:1aa84d96232a
1397 | parent: 18:1aa84d96232a
1398 ~ user: test
1398 ~ user: test
1399 date: Thu Jan 01 00:00:33 1970 +0000
1399 date: Thu Jan 01 00:00:33 1970 +0000
1400 summary: (33) head
1400 summary: (33) head
1401
1401
1402
1402
1403 Do not crash or produce strange graphs if history is buggy
1403 Do not crash or produce strange graphs if history is buggy
1404
1404
1405 $ hg branch branch
1405 $ hg branch branch
1406 marked working directory as branch branch
1406 marked working directory as branch branch
1407 (branches are permanent and global, did you want a bookmark?)
1407 (branches are permanent and global, did you want a bookmark?)
1408 $ commit 36 "buggy merge: identical parents" 35 35
1408 $ commit 36 "buggy merge: identical parents" 35 35
1409 $ hg log -G -l5
1409 $ hg log -G -l5
1410 @ changeset: 36:08a19a744424
1410 @ changeset: 36:08a19a744424
1411 | branch: branch
1411 | branch: branch
1412 | tag: tip
1412 | tag: tip
1413 | parent: 35:9159c3644c5e
1413 | parent: 35:9159c3644c5e
1414 | parent: 35:9159c3644c5e
1414 | parent: 35:9159c3644c5e
1415 | user: test
1415 | user: test
1416 | date: Thu Jan 01 00:00:36 1970 +0000
1416 | date: Thu Jan 01 00:00:36 1970 +0000
1417 | summary: (36) buggy merge: identical parents
1417 | summary: (36) buggy merge: identical parents
1418 |
1418 |
1419 o changeset: 35:9159c3644c5e
1419 o changeset: 35:9159c3644c5e
1420 | user: test
1420 | user: test
1421 | date: Thu Jan 01 00:00:00 1970 +0000
1421 | date: Thu Jan 01 00:00:00 1970 +0000
1422 | summary: 0
1422 | summary: 0
1423 |
1423 |
1424 o changeset: 34:fea3ac5810e0
1424 o changeset: 34:fea3ac5810e0
1425 | parent: 32:d06dffa21a31
1425 | parent: 32:d06dffa21a31
1426 | user: test
1426 | user: test
1427 | date: Thu Jan 01 00:00:34 1970 +0000
1427 | date: Thu Jan 01 00:00:34 1970 +0000
1428 | summary: (34) head
1428 | summary: (34) head
1429 |
1429 |
1430 | o changeset: 33:68608f5145f9
1430 | o changeset: 33:68608f5145f9
1431 | | parent: 18:1aa84d96232a
1431 | | parent: 18:1aa84d96232a
1432 | ~ user: test
1432 | ~ user: test
1433 | date: Thu Jan 01 00:00:33 1970 +0000
1433 | date: Thu Jan 01 00:00:33 1970 +0000
1434 | summary: (33) head
1434 | summary: (33) head
1435 |
1435 |
1436 o changeset: 32:d06dffa21a31
1436 o changeset: 32:d06dffa21a31
1437 |\ parent: 27:886ed638191b
1437 |\ parent: 27:886ed638191b
1438 ~ ~ parent: 31:621d83e11f67
1438 ~ ~ parent: 31:621d83e11f67
1439 user: test
1439 user: test
1440 date: Thu Jan 01 00:00:32 1970 +0000
1440 date: Thu Jan 01 00:00:32 1970 +0000
1441 summary: (32) expand
1441 summary: (32) expand
1442
1442
1443
1443
1444 Test log -G options
1444 Test log -G options
1445
1445
1446 $ testlog() {
1446 $ testlog() {
1447 > hg log -G --print-revset "$@"
1447 > hg log -G --print-revset "$@"
1448 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1448 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1449 > | sed 's/.*nodetag/nodetag/' > log.nodes
1449 > | sed 's/.*nodetag/nodetag/' > log.nodes
1450 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1450 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1451 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1451 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1452 > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \
1452 > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \
1453 > | grep '^[-+@ ]' || :
1453 > | grep '^[-+@ ]' || :
1454 > }
1454 > }
1455
1455
1456 glog always reorders nodes which explains the difference with log
1456 glog always reorders nodes which explains the difference with log
1457
1457
1458 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1458 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1459 ['27', '25', '21', '34', '32', '31']
1459 ['27', '25', '21', '34', '32', '31']
1460 []
1460 []
1461 <baseset- [21, 25, 27, 31, 32, 34]>
1461 <baseset- [21, 25, 27, 31, 32, 34]>
1462 --- log.nodes * (glob)
1462 --- log.nodes * (glob)
1463 +++ glog.nodes * (glob)
1463 +++ glog.nodes * (glob)
1464 @@ -1,6 +1,6 @@
1464 @@ -1,6 +1,6 @@
1465 -nodetag 27
1465 -nodetag 27
1466 -nodetag 25
1466 -nodetag 25
1467 -nodetag 21
1467 -nodetag 21
1468 nodetag 34
1468 nodetag 34
1469 nodetag 32
1469 nodetag 32
1470 nodetag 31
1470 nodetag 31
1471 +nodetag 27
1471 +nodetag 27
1472 +nodetag 25
1472 +nodetag 25
1473 +nodetag 21
1473 +nodetag 21
1474 $ testlog -u test -u not-a-user
1474 $ testlog -u test -u not-a-user
1475 []
1475 []
1476 (or
1476 (or
1477 (list
1477 (list
1478 (func
1478 (func
1479 (symbol 'user')
1479 (symbol 'user')
1480 (string 'test'))
1480 (string 'test'))
1481 (func
1481 (func
1482 (symbol 'user')
1482 (symbol 'user')
1483 (string 'not-a-user'))))
1483 (string 'not-a-user'))))
1484 <filteredset
1484 <filteredset
1485 <spanset- 0:37>,
1485 <spanset- 0:37>,
1486 <addset
1486 <addset
1487 <filteredset
1487 <filteredset
1488 <fullreposet+ 0:37>,
1488 <fullreposet+ 0:37>,
1489 <user 'test'>>,
1489 <user 'test'>>,
1490 <filteredset
1490 <filteredset
1491 <fullreposet+ 0:37>,
1491 <fullreposet+ 0:37>,
1492 <user 'not-a-user'>>>>
1492 <user 'not-a-user'>>>>
1493 $ testlog -b not-a-branch
1493 $ testlog -b not-a-branch
1494 abort: unknown revision 'not-a-branch'!
1494 abort: unknown revision 'not-a-branch'!
1495 abort: unknown revision 'not-a-branch'!
1495 abort: unknown revision 'not-a-branch'!
1496 abort: unknown revision 'not-a-branch'!
1496 abort: unknown revision 'not-a-branch'!
1497 $ testlog -b 35 -b 36 --only-branch branch
1497 $ testlog -b 35 -b 36 --only-branch branch
1498 []
1498 []
1499 (or
1499 (or
1500 (list
1500 (list
1501 (func
1501 (func
1502 (symbol 'branch')
1502 (symbol 'branch')
1503 (string 'default'))
1503 (string 'default'))
1504 (or
1504 (or
1505 (list
1505 (list
1506 (func
1506 (func
1507 (symbol 'branch')
1507 (symbol 'branch')
1508 (string 'branch'))
1508 (string 'branch'))
1509 (func
1509 (func
1510 (symbol 'branch')
1510 (symbol 'branch')
1511 (string 'branch'))))))
1511 (string 'branch'))))))
1512 <filteredset
1512 <filteredset
1513 <spanset- 0:37>,
1513 <spanset- 0:37>,
1514 <addset
1514 <addset
1515 <filteredset
1515 <filteredset
1516 <fullreposet+ 0:37>,
1516 <fullreposet+ 0:37>,
1517 <branch 'default'>>,
1517 <branch 'default'>>,
1518 <addset
1518 <addset
1519 <filteredset
1519 <filteredset
1520 <fullreposet+ 0:37>,
1520 <fullreposet+ 0:37>,
1521 <branch 'branch'>>,
1521 <branch 'branch'>>,
1522 <filteredset
1522 <filteredset
1523 <fullreposet+ 0:37>,
1523 <fullreposet+ 0:37>,
1524 <branch 'branch'>>>>>
1524 <branch 'branch'>>>>>
1525 $ testlog -k expand -k merge
1525 $ testlog -k expand -k merge
1526 []
1526 []
1527 (or
1527 (or
1528 (list
1528 (list
1529 (func
1529 (func
1530 (symbol 'keyword')
1530 (symbol 'keyword')
1531 (string 'expand'))
1531 (string 'expand'))
1532 (func
1532 (func
1533 (symbol 'keyword')
1533 (symbol 'keyword')
1534 (string 'merge'))))
1534 (string 'merge'))))
1535 <filteredset
1535 <filteredset
1536 <spanset- 0:37>,
1536 <spanset- 0:37>,
1537 <addset
1537 <addset
1538 <filteredset
1538 <filteredset
1539 <fullreposet+ 0:37>,
1539 <fullreposet+ 0:37>,
1540 <keyword 'expand'>>,
1540 <keyword 'expand'>>,
1541 <filteredset
1541 <filteredset
1542 <fullreposet+ 0:37>,
1542 <fullreposet+ 0:37>,
1543 <keyword 'merge'>>>>
1543 <keyword 'merge'>>>>
1544 $ testlog --only-merges
1544 $ testlog --only-merges
1545 []
1545 []
1546 (func
1546 (func
1547 (symbol 'merge')
1547 (symbol 'merge')
1548 None)
1548 None)
1549 <filteredset
1549 <filteredset
1550 <spanset- 0:37>,
1550 <spanset- 0:37>,
1551 <merge>>
1551 <merge>>
1552 $ testlog --no-merges
1552 $ testlog --no-merges
1553 []
1553 []
1554 (not
1554 (not
1555 (func
1555 (func
1556 (symbol 'merge')
1556 (symbol 'merge')
1557 None))
1557 None))
1558 <filteredset
1558 <filteredset
1559 <spanset- 0:37>,
1559 <spanset- 0:37>,
1560 <not
1560 <not
1561 <filteredset
1561 <filteredset
1562 <spanset- 0:37>,
1562 <spanset- 0:37>,
1563 <merge>>>>
1563 <merge>>>>
1564 $ testlog --date '2 0 to 4 0'
1564 $ testlog --date '2 0 to 4 0'
1565 []
1565 []
1566 (func
1566 (func
1567 (symbol 'date')
1567 (symbol 'date')
1568 (string '2 0 to 4 0'))
1568 (string '2 0 to 4 0'))
1569 <filteredset
1569 <filteredset
1570 <spanset- 0:37>,
1570 <spanset- 0:37>,
1571 <date '2 0 to 4 0'>>
1571 <date '2 0 to 4 0'>>
1572 $ hg log -G -d 'brace ) in a date'
1572 $ hg log -G -d 'brace ) in a date'
1573 hg: parse error: invalid date: 'brace ) in a date'
1573 hg: parse error: invalid date: 'brace ) in a date'
1574 [255]
1574 [255]
1575 $ testlog --prune 31 --prune 32
1575 $ testlog --prune 31 --prune 32
1576 []
1576 []
1577 (not
1577 (not
1578 (or
1578 (or
1579 (list
1579 (list
1580 (func
1580 (func
1581 (symbol 'ancestors')
1581 (symbol 'ancestors')
1582 (string '31'))
1582 (string '31'))
1583 (func
1583 (func
1584 (symbol 'ancestors')
1584 (symbol 'ancestors')
1585 (string '32')))))
1585 (string '32')))))
1586 <filteredset
1586 <filteredset
1587 <spanset- 0:37>,
1587 <spanset- 0:37>,
1588 <not
1588 <not
1589 <addset
1589 <addset
1590 <filteredset
1590 <filteredset
1591 <spanset- 0:37>,
1591 <spanset- 0:37>,
1592 <generatorsetdesc+>>,
1592 <generatorsetdesc+>>,
1593 <filteredset
1593 <filteredset
1594 <spanset- 0:37>,
1594 <spanset- 0:37>,
1595 <generatorsetdesc+>>>>>
1595 <generatorsetdesc+>>>>>
1596
1596
1597 Dedicated repo for --follow and paths filtering. The g is crafted to
1597 Dedicated repo for --follow and paths filtering. The g is crafted to
1598 have 2 filelog topological heads in a linear changeset graph.
1598 have 2 filelog topological heads in a linear changeset graph.
1599
1599
1600 $ cd ..
1600 $ cd ..
1601 $ hg init follow
1601 $ hg init follow
1602 $ cd follow
1602 $ cd follow
1603 $ testlog --follow
1603 $ testlog --follow
1604 []
1604 []
1605 []
1605 []
1606 <baseset []>
1606 <baseset []>
1607 $ testlog -rnull
1607 $ testlog -rnull
1608 ['null']
1608 ['null']
1609 []
1609 []
1610 <baseset [-1]>
1610 <baseset [-1]>
1611 $ echo a > a
1611 $ echo a > a
1612 $ echo aa > aa
1612 $ echo aa > aa
1613 $ echo f > f
1613 $ echo f > f
1614 $ hg ci -Am "add a" a aa f
1614 $ hg ci -Am "add a" a aa f
1615 $ hg cp a b
1615 $ hg cp a b
1616 $ hg cp f g
1616 $ hg cp f g
1617 $ hg ci -m "copy a b"
1617 $ hg ci -m "copy a b"
1618 $ mkdir dir
1618 $ mkdir dir
1619 $ hg mv b dir
1619 $ hg mv b dir
1620 $ echo g >> g
1620 $ echo g >> g
1621 $ echo f >> f
1621 $ echo f >> f
1622 $ hg ci -m "mv b dir/b"
1622 $ hg ci -m "mv b dir/b"
1623 $ hg mv a b
1623 $ hg mv a b
1624 $ hg cp -f f g
1624 $ hg cp -f f g
1625 $ echo a > d
1625 $ echo a > d
1626 $ hg add d
1626 $ hg add d
1627 $ hg ci -m "mv a b; add d"
1627 $ hg ci -m "mv a b; add d"
1628 $ hg mv dir/b e
1628 $ hg mv dir/b e
1629 $ hg ci -m "mv dir/b e"
1629 $ hg ci -m "mv dir/b e"
1630 $ hg log -G --template '({rev}) {desc|firstline}\n'
1630 $ hg log -G --template '({rev}) {desc|firstline}\n'
1631 @ (4) mv dir/b e
1631 @ (4) mv dir/b e
1632 |
1632 |
1633 o (3) mv a b; add d
1633 o (3) mv a b; add d
1634 |
1634 |
1635 o (2) mv b dir/b
1635 o (2) mv b dir/b
1636 |
1636 |
1637 o (1) copy a b
1637 o (1) copy a b
1638 |
1638 |
1639 o (0) add a
1639 o (0) add a
1640
1640
1641
1641
1642 $ testlog a
1642 $ testlog a
1643 []
1643 []
1644 (func
1644 (func
1645 (symbol 'filelog')
1645 (symbol 'filelog')
1646 (string 'a'))
1646 (string 'a'))
1647 <filteredset
1647 <filteredset
1648 <spanset- 0:5>, set([0])>
1648 <spanset- 0:5>, set([0])>
1649 $ testlog a b
1649 $ testlog a b
1650 []
1650 []
1651 (or
1651 (or
1652 (list
1652 (list
1653 (func
1653 (func
1654 (symbol 'filelog')
1654 (symbol 'filelog')
1655 (string 'a'))
1655 (string 'a'))
1656 (func
1656 (func
1657 (symbol 'filelog')
1657 (symbol 'filelog')
1658 (string 'b'))))
1658 (string 'b'))))
1659 <filteredset
1659 <filteredset
1660 <spanset- 0:5>,
1660 <spanset- 0:5>,
1661 <addset
1661 <addset
1662 <baseset+ [0]>,
1662 <baseset+ [0]>,
1663 <baseset+ [1]>>>
1663 <baseset+ [1]>>>
1664
1664
1665 Test falling back to slow path for non-existing files
1665 Test falling back to slow path for non-existing files
1666
1666
1667 $ testlog a c
1667 $ testlog a c
1668 []
1668 []
1669 (func
1669 (func
1670 (symbol '_matchfiles')
1670 (symbol '_matchfiles')
1671 (list
1671 (list
1672 (string 'r:')
1672 (string 'r:')
1673 (string 'd:relpath')
1673 (string 'd:relpath')
1674 (string 'p:a')
1674 (string 'p:a')
1675 (string 'p:c')))
1675 (string 'p:c')))
1676 <filteredset
1676 <filteredset
1677 <spanset- 0:5>,
1677 <spanset- 0:5>,
1678 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=None>>
1678 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=None>>
1679
1679
1680 Test multiple --include/--exclude/paths
1680 Test multiple --include/--exclude/paths
1681
1681
1682 $ testlog --include a --include e --exclude b --exclude e a e
1682 $ testlog --include a --include e --exclude b --exclude e a e
1683 []
1683 []
1684 (func
1684 (func
1685 (symbol '_matchfiles')
1685 (symbol '_matchfiles')
1686 (list
1686 (list
1687 (string 'r:')
1687 (string 'r:')
1688 (string 'd:relpath')
1688 (string 'd:relpath')
1689 (string 'p:a')
1689 (string 'p:a')
1690 (string 'p:e')
1690 (string 'p:e')
1691 (string 'i:a')
1691 (string 'i:a')
1692 (string 'i:e')
1692 (string 'i:e')
1693 (string 'x:b')
1693 (string 'x:b')
1694 (string 'x:e')))
1694 (string 'x:e')))
1695 <filteredset
1695 <filteredset
1696 <spanset- 0:5>,
1696 <spanset- 0:5>,
1697 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=None>>
1697 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=None>>
1698
1698
1699 Test glob expansion of pats
1699 Test glob expansion of pats
1700
1700
1701 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1701 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1702 > print(mercurial.util.expandglobs and 'true' or 'false')"`
1702 > print(mercurial.util.expandglobs and 'true' or 'false')"`
1703 $ if [ $expandglobs = "true" ]; then
1703 $ if [ $expandglobs = "true" ]; then
1704 > testlog 'a*';
1704 > testlog 'a*';
1705 > else
1705 > else
1706 > testlog a*;
1706 > testlog a*;
1707 > fi;
1707 > fi;
1708 []
1708 []
1709 (func
1709 (func
1710 (symbol 'filelog')
1710 (symbol 'filelog')
1711 (string 'aa'))
1711 (string 'aa'))
1712 <filteredset
1712 <filteredset
1713 <spanset- 0:5>, set([0])>
1713 <spanset- 0:5>, set([0])>
1714
1714
1715 Test --follow on a non-existent directory
1715 Test --follow on a non-existent directory
1716
1716
1717 $ testlog -f dir
1717 $ testlog -f dir
1718 abort: cannot follow file not in parent revision: "dir"
1718 abort: cannot follow file not in parent revision: "dir"
1719 abort: cannot follow file not in parent revision: "dir"
1719 abort: cannot follow file not in parent revision: "dir"
1720 abort: cannot follow file not in parent revision: "dir"
1720 abort: cannot follow file not in parent revision: "dir"
1721
1721
1722 Test --follow on a directory
1722 Test --follow on a directory
1723
1723
1724 $ hg up -q '.^'
1724 $ hg up -q '.^'
1725 $ testlog -f dir
1725 $ testlog -f dir
1726 []
1726 []
1727 (func
1727 (func
1728 (symbol '_matchfiles')
1728 (symbol '_matchfiles')
1729 (list
1729 (list
1730 (string 'r:')
1730 (string 'r:')
1731 (string 'd:relpath')
1731 (string 'd:relpath')
1732 (string 'p:dir')))
1732 (string 'p:dir')))
1733 <filteredset
1733 <filteredset
1734 <generatorsetdesc->,
1734 <generatorsetdesc->,
1735 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=None>>
1735 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=None>>
1736 $ hg up -q tip
1736 $ hg up -q tip
1737
1737
1738 Test --follow on file not in parent revision
1738 Test --follow on file not in parent revision
1739
1739
1740 $ testlog -f a
1740 $ testlog -f a
1741 abort: cannot follow file not in parent revision: "a"
1741 abort: cannot follow file not in parent revision: "a"
1742 abort: cannot follow file not in parent revision: "a"
1742 abort: cannot follow file not in parent revision: "a"
1743 abort: cannot follow file not in parent revision: "a"
1743 abort: cannot follow file not in parent revision: "a"
1744
1744
1745 Test --follow and patterns
1745 Test --follow and patterns
1746
1746
1747 $ testlog -f 'glob:*'
1747 $ testlog -f 'glob:*'
1748 []
1748 []
1749 (func
1749 (func
1750 (symbol '_matchfiles')
1750 (symbol '_matchfiles')
1751 (list
1751 (list
1752 (string 'r:')
1752 (string 'r:')
1753 (string 'd:relpath')
1753 (string 'd:relpath')
1754 (string 'p:glob:*')))
1754 (string 'p:glob:*')))
1755 <filteredset
1755 <filteredset
1756 <generatorsetdesc->,
1756 <generatorsetdesc->,
1757 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=None>>
1757 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=None>>
1758
1758
1759 Test --follow on a single rename
1759 Test --follow on a single rename
1760
1760
1761 $ hg up -q 2
1761 $ hg up -q 2
1762 $ testlog -f a
1762 $ testlog -f a
1763 []
1763 []
1764 []
1764 []
1765 <generatorsetdesc->
1765 <generatorsetdesc->
1766
1766
1767 Test --follow and multiple renames
1767 Test --follow and multiple renames
1768
1768
1769 $ hg up -q tip
1769 $ hg up -q tip
1770 $ testlog -f e
1770 $ testlog -f e
1771 []
1771 []
1772 []
1772 []
1773 <generatorsetdesc->
1773 <generatorsetdesc->
1774
1774
1775 Test --follow and multiple filelog heads
1775 Test --follow and multiple filelog heads
1776
1776
1777 $ hg up -q 2
1777 $ hg up -q 2
1778 $ testlog -f g
1778 $ testlog -f g
1779 []
1779 []
1780 []
1780 []
1781 <generatorsetdesc->
1781 <generatorsetdesc->
1782 $ cat log.nodes
1782 $ cat log.nodes
1783 nodetag 2
1783 nodetag 2
1784 nodetag 1
1784 nodetag 1
1785 nodetag 0
1785 nodetag 0
1786 $ hg up -q tip
1786 $ hg up -q tip
1787 $ testlog -f g
1787 $ testlog -f g
1788 []
1788 []
1789 []
1789 []
1790 <generatorsetdesc->
1790 <generatorsetdesc->
1791 $ cat log.nodes
1791 $ cat log.nodes
1792 nodetag 3
1792 nodetag 3
1793 nodetag 2
1793 nodetag 2
1794 nodetag 0
1794 nodetag 0
1795
1795
1796 Test --follow and multiple files
1796 Test --follow and multiple files
1797
1797
1798 $ testlog -f g e
1798 $ testlog -f g e
1799 []
1799 []
1800 []
1800 []
1801 <generatorsetdesc->
1801 <generatorsetdesc->
1802 $ cat log.nodes
1802 $ cat log.nodes
1803 nodetag 4
1803 nodetag 4
1804 nodetag 3
1804 nodetag 3
1805 nodetag 2
1805 nodetag 2
1806 nodetag 1
1806 nodetag 1
1807 nodetag 0
1807 nodetag 0
1808
1808
1809 Test --follow null parent
1809 Test --follow null parent
1810
1810
1811 $ hg up -q null
1811 $ hg up -q null
1812 $ testlog -f
1812 $ testlog -f
1813 []
1813 []
1814 []
1814 []
1815 <baseset []>
1815 <baseset []>
1816
1816
1817 Test --follow-first
1817 Test --follow-first
1818
1818
1819 $ hg up -q 3
1819 $ hg up -q 3
1820 $ echo ee > e
1820 $ echo ee > e
1821 $ hg ci -Am "add another e" e
1821 $ hg ci -Am "add another e" e
1822 created new head
1822 created new head
1823 $ hg merge --tool internal:other 4
1823 $ hg merge --tool internal:other 4
1824 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1824 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1825 (branch merge, don't forget to commit)
1825 (branch merge, don't forget to commit)
1826 $ echo merge > e
1826 $ echo merge > e
1827 $ hg ci -m "merge 5 and 4"
1827 $ hg ci -m "merge 5 and 4"
1828 $ testlog --follow-first
1828 $ testlog --follow-first
1829 []
1829 []
1830 []
1830 []
1831 <generatorsetdesc->
1831 <generatorsetdesc->
1832
1832
1833 Cannot compare with log --follow-first FILE as it never worked
1833 Cannot compare with log --follow-first FILE as it never worked
1834
1834
1835 $ hg log -G --print-revset --follow-first e
1835 $ hg log -G --print-revset --follow-first e
1836 []
1836 []
1837 []
1837 []
1838 <generatorsetdesc->
1838 <generatorsetdesc->
1839 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1839 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1840 @ 6 merge 5 and 4
1840 @ 6 merge 5 and 4
1841 |\
1841 |\
1842 | ~
1842 | ~
1843 o 5 add another e
1843 o 5 add another e
1844 |
1844 |
1845 ~
1845 ~
1846
1846
1847 Test --copies
1847 Test --copies
1848
1848
1849 $ hg log -G --copies --template "{rev} {desc|firstline} \
1849 $ hg log -G --copies --template "{rev} {desc|firstline} \
1850 > copies: {file_copies_switch}\n"
1850 > copies: {file_copies_switch}\n"
1851 @ 6 merge 5 and 4 copies:
1851 @ 6 merge 5 and 4 copies:
1852 |\
1852 |\
1853 | o 5 add another e copies:
1853 | o 5 add another e copies:
1854 | |
1854 | |
1855 o | 4 mv dir/b e copies: e (dir/b)
1855 o | 4 mv dir/b e copies: e (dir/b)
1856 |/
1856 |/
1857 o 3 mv a b; add d copies: b (a)g (f)
1857 o 3 mv a b; add d copies: b (a)g (f)
1858 |
1858 |
1859 o 2 mv b dir/b copies: dir/b (b)
1859 o 2 mv b dir/b copies: dir/b (b)
1860 |
1860 |
1861 o 1 copy a b copies: b (a)g (f)
1861 o 1 copy a b copies: b (a)g (f)
1862 |
1862 |
1863 o 0 add a copies:
1863 o 0 add a copies:
1864
1864
1865 Test "set:..." and parent revision
1865 Test "set:..." and parent revision
1866
1866
1867 $ hg up -q 4
1867 $ hg up -q 4
1868 $ testlog "set:copied()"
1868 $ testlog "set:copied()"
1869 []
1869 []
1870 (func
1870 (func
1871 (symbol '_matchfiles')
1871 (symbol '_matchfiles')
1872 (list
1872 (list
1873 (string 'r:')
1873 (string 'r:')
1874 (string 'd:relpath')
1874 (string 'd:relpath')
1875 (string 'p:set:copied()')))
1875 (string 'p:set:copied()')))
1876 <filteredset
1876 <filteredset
1877 <spanset- 0:7>,
1877 <spanset- 0:7>,
1878 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=None>>
1878 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=None>>
1879 $ testlog --include "set:copied()"
1879 $ testlog --include "set:copied()"
1880 []
1880 []
1881 (func
1881 (func
1882 (symbol '_matchfiles')
1882 (symbol '_matchfiles')
1883 (list
1883 (list
1884 (string 'r:')
1884 (string 'r:')
1885 (string 'd:relpath')
1885 (string 'd:relpath')
1886 (string 'i:set:copied()')))
1886 (string 'i:set:copied()')))
1887 <filteredset
1887 <filteredset
1888 <spanset- 0:7>,
1888 <spanset- 0:7>,
1889 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=None>>
1889 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=None>>
1890 $ testlog -r "sort(file('set:copied()'), -rev)"
1890 $ testlog -r "sort(file('set:copied()'), -rev)"
1891 ["sort(file('set:copied()'), -rev)"]
1891 ["sort(file('set:copied()'), -rev)"]
1892 []
1892 []
1893 <baseset []>
1893 <baseset []>
1894
1894
1895 Test --removed
1895 Test --removed
1896
1896
1897 $ testlog --removed
1897 $ testlog --removed
1898 []
1898 []
1899 []
1899 []
1900 <spanset- 0:7>
1900 <spanset- 0:7>
1901 $ testlog --removed a
1901 $ testlog --removed a
1902 []
1902 []
1903 (func
1903 (func
1904 (symbol '_matchfiles')
1904 (symbol '_matchfiles')
1905 (list
1905 (list
1906 (string 'r:')
1906 (string 'r:')
1907 (string 'd:relpath')
1907 (string 'd:relpath')
1908 (string 'p:a')))
1908 (string 'p:a')))
1909 <filteredset
1909 <filteredset
1910 <spanset- 0:7>,
1910 <spanset- 0:7>,
1911 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1911 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1912 $ testlog --removed --follow a
1912 $ testlog --removed --follow a
1913 []
1913 []
1914 (func
1914 (func
1915 (symbol '_matchfiles')
1915 (symbol '_matchfiles')
1916 (list
1916 (list
1917 (string 'r:')
1917 (string 'r:')
1918 (string 'd:relpath')
1918 (string 'd:relpath')
1919 (string 'p:a')))
1919 (string 'p:a')))
1920 <filteredset
1920 <filteredset
1921 <generatorsetdesc->,
1921 <generatorsetdesc->,
1922 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1922 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1923
1923
1924 Test --patch and --stat with --follow and --follow-first
1924 Test --patch and --stat with --follow and --follow-first
1925
1925
1926 $ hg up -q 3
1926 $ hg up -q 3
1927 $ hg log -G --git --patch b
1927 $ hg log -G --git --patch b
1928 o changeset: 1:216d4c92cf98
1928 o changeset: 1:216d4c92cf98
1929 | user: test
1929 | user: test
1930 ~ date: Thu Jan 01 00:00:00 1970 +0000
1930 ~ date: Thu Jan 01 00:00:00 1970 +0000
1931 summary: copy a b
1931 summary: copy a b
1932
1932
1933 diff --git a/a b/b
1933 diff --git a/a b/b
1934 copy from a
1934 copy from a
1935 copy to b
1935 copy to b
1936
1936
1937
1937
1938 $ hg log -G --git --stat b
1938 $ hg log -G --git --stat b
1939 o changeset: 1:216d4c92cf98
1939 o changeset: 1:216d4c92cf98
1940 | user: test
1940 | user: test
1941 ~ date: Thu Jan 01 00:00:00 1970 +0000
1941 ~ date: Thu Jan 01 00:00:00 1970 +0000
1942 summary: copy a b
1942 summary: copy a b
1943
1943
1944 b | 0
1944 b | 0
1945 1 files changed, 0 insertions(+), 0 deletions(-)
1945 1 files changed, 0 insertions(+), 0 deletions(-)
1946
1946
1947
1947
1948 $ hg log -G --git --patch --follow b
1948 $ hg log -G --git --patch --follow b
1949 o changeset: 1:216d4c92cf98
1949 o changeset: 1:216d4c92cf98
1950 | user: test
1950 | user: test
1951 | date: Thu Jan 01 00:00:00 1970 +0000
1951 | date: Thu Jan 01 00:00:00 1970 +0000
1952 | summary: copy a b
1952 | summary: copy a b
1953 |
1953 |
1954 | diff --git a/a b/b
1954 | diff --git a/a b/b
1955 | copy from a
1955 | copy from a
1956 | copy to b
1956 | copy to b
1957 |
1957 |
1958 o changeset: 0:f8035bb17114
1958 o changeset: 0:f8035bb17114
1959 user: test
1959 user: test
1960 date: Thu Jan 01 00:00:00 1970 +0000
1960 date: Thu Jan 01 00:00:00 1970 +0000
1961 summary: add a
1961 summary: add a
1962
1962
1963 diff --git a/a b/a
1963 diff --git a/a b/a
1964 new file mode 100644
1964 new file mode 100644
1965 --- /dev/null
1965 --- /dev/null
1966 +++ b/a
1966 +++ b/a
1967 @@ -0,0 +1,1 @@
1967 @@ -0,0 +1,1 @@
1968 +a
1968 +a
1969
1969
1970
1970
1971 $ hg log -G --git --stat --follow b
1971 $ hg log -G --git --stat --follow b
1972 o changeset: 1:216d4c92cf98
1972 o changeset: 1:216d4c92cf98
1973 | user: test
1973 | user: test
1974 | date: Thu Jan 01 00:00:00 1970 +0000
1974 | date: Thu Jan 01 00:00:00 1970 +0000
1975 | summary: copy a b
1975 | summary: copy a b
1976 |
1976 |
1977 | b | 0
1977 | b | 0
1978 | 1 files changed, 0 insertions(+), 0 deletions(-)
1978 | 1 files changed, 0 insertions(+), 0 deletions(-)
1979 |
1979 |
1980 o changeset: 0:f8035bb17114
1980 o changeset: 0:f8035bb17114
1981 user: test
1981 user: test
1982 date: Thu Jan 01 00:00:00 1970 +0000
1982 date: Thu Jan 01 00:00:00 1970 +0000
1983 summary: add a
1983 summary: add a
1984
1984
1985 a | 1 +
1985 a | 1 +
1986 1 files changed, 1 insertions(+), 0 deletions(-)
1986 1 files changed, 1 insertions(+), 0 deletions(-)
1987
1987
1988
1988
1989 $ hg up -q 6
1989 $ hg up -q 6
1990 $ hg log -G --git --patch --follow-first e
1990 $ hg log -G --git --patch --follow-first e
1991 @ changeset: 6:fc281d8ff18d
1991 @ changeset: 6:fc281d8ff18d
1992 |\ tag: tip
1992 |\ tag: tip
1993 | ~ parent: 5:99b31f1c2782
1993 | ~ parent: 5:99b31f1c2782
1994 | parent: 4:17d952250a9d
1994 | parent: 4:17d952250a9d
1995 | user: test
1995 | user: test
1996 | date: Thu Jan 01 00:00:00 1970 +0000
1996 | date: Thu Jan 01 00:00:00 1970 +0000
1997 | summary: merge 5 and 4
1997 | summary: merge 5 and 4
1998 |
1998 |
1999 | diff --git a/e b/e
1999 | diff --git a/e b/e
2000 | --- a/e
2000 | --- a/e
2001 | +++ b/e
2001 | +++ b/e
2002 | @@ -1,1 +1,1 @@
2002 | @@ -1,1 +1,1 @@
2003 | -ee
2003 | -ee
2004 | +merge
2004 | +merge
2005 |
2005 |
2006 o changeset: 5:99b31f1c2782
2006 o changeset: 5:99b31f1c2782
2007 | parent: 3:5918b8d165d1
2007 | parent: 3:5918b8d165d1
2008 ~ user: test
2008 ~ user: test
2009 date: Thu Jan 01 00:00:00 1970 +0000
2009 date: Thu Jan 01 00:00:00 1970 +0000
2010 summary: add another e
2010 summary: add another e
2011
2011
2012 diff --git a/e b/e
2012 diff --git a/e b/e
2013 new file mode 100644
2013 new file mode 100644
2014 --- /dev/null
2014 --- /dev/null
2015 +++ b/e
2015 +++ b/e
2016 @@ -0,0 +1,1 @@
2016 @@ -0,0 +1,1 @@
2017 +ee
2017 +ee
2018
2018
2019
2019
2020 Test old-style --rev
2020 Test old-style --rev
2021
2021
2022 $ hg tag 'foo-bar'
2022 $ hg tag 'foo-bar'
2023 $ testlog -r 'foo-bar'
2023 $ testlog -r 'foo-bar'
2024 ['foo-bar']
2024 ['foo-bar']
2025 []
2025 []
2026 <baseset [6]>
2026 <baseset [6]>
2027
2027
2028 Test --follow and forward --rev
2028 Test --follow and forward --rev
2029
2029
2030 $ hg up -q 6
2030 $ hg up -q 6
2031 $ echo g > g
2031 $ echo g > g
2032 $ hg ci -Am 'add g' g
2032 $ hg ci -Am 'add g' g
2033 created new head
2033 created new head
2034 $ hg up -q 2
2034 $ hg up -q 2
2035 $ hg log -G --template "{rev} {desc|firstline}\n"
2035 $ hg log -G --template "{rev} {desc|firstline}\n"
2036 o 8 add g
2036 o 8 add g
2037 |
2037 |
2038 | o 7 Added tag foo-bar for changeset fc281d8ff18d
2038 | o 7 Added tag foo-bar for changeset fc281d8ff18d
2039 |/
2039 |/
2040 o 6 merge 5 and 4
2040 o 6 merge 5 and 4
2041 |\
2041 |\
2042 | o 5 add another e
2042 | o 5 add another e
2043 | |
2043 | |
2044 o | 4 mv dir/b e
2044 o | 4 mv dir/b e
2045 |/
2045 |/
2046 o 3 mv a b; add d
2046 o 3 mv a b; add d
2047 |
2047 |
2048 @ 2 mv b dir/b
2048 @ 2 mv b dir/b
2049 |
2049 |
2050 o 1 copy a b
2050 o 1 copy a b
2051 |
2051 |
2052 o 0 add a
2052 o 0 add a
2053
2053
2054 $ hg archive -r 7 archive
2054 $ hg archive -r 7 archive
2055 $ grep changessincelatesttag archive/.hg_archival.txt
2055 $ grep changessincelatesttag archive/.hg_archival.txt
2056 changessincelatesttag: 1
2056 changessincelatesttag: 1
2057 $ rm -r archive
2057 $ rm -r archive
2058
2058
2059 changessincelatesttag with no prior tag
2059 changessincelatesttag with no prior tag
2060 $ hg archive -r 4 archive
2060 $ hg archive -r 4 archive
2061 $ grep changessincelatesttag archive/.hg_archival.txt
2061 $ grep changessincelatesttag archive/.hg_archival.txt
2062 changessincelatesttag: 5
2062 changessincelatesttag: 5
2063
2063
2064 $ hg export 'all()'
2064 $ hg export 'all()'
2065 # HG changeset patch
2065 # HG changeset patch
2066 # User test
2066 # User test
2067 # Date 0 0
2067 # Date 0 0
2068 # Thu Jan 01 00:00:00 1970 +0000
2068 # Thu Jan 01 00:00:00 1970 +0000
2069 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2069 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2070 # Parent 0000000000000000000000000000000000000000
2070 # Parent 0000000000000000000000000000000000000000
2071 add a
2071 add a
2072
2072
2073 diff -r 000000000000 -r f8035bb17114 a
2073 diff -r 000000000000 -r f8035bb17114 a
2074 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2074 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2075 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2075 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2076 @@ -0,0 +1,1 @@
2076 @@ -0,0 +1,1 @@
2077 +a
2077 +a
2078 diff -r 000000000000 -r f8035bb17114 aa
2078 diff -r 000000000000 -r f8035bb17114 aa
2079 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2079 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2080 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2080 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2081 @@ -0,0 +1,1 @@
2081 @@ -0,0 +1,1 @@
2082 +aa
2082 +aa
2083 diff -r 000000000000 -r f8035bb17114 f
2083 diff -r 000000000000 -r f8035bb17114 f
2084 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2084 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2085 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2085 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2086 @@ -0,0 +1,1 @@
2086 @@ -0,0 +1,1 @@
2087 +f
2087 +f
2088 # HG changeset patch
2088 # HG changeset patch
2089 # User test
2089 # User test
2090 # Date 0 0
2090 # Date 0 0
2091 # Thu Jan 01 00:00:00 1970 +0000
2091 # Thu Jan 01 00:00:00 1970 +0000
2092 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2092 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2093 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2093 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2094 copy a b
2094 copy a b
2095
2095
2096 diff -r f8035bb17114 -r 216d4c92cf98 b
2096 diff -r f8035bb17114 -r 216d4c92cf98 b
2097 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2097 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2098 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2098 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2099 @@ -0,0 +1,1 @@
2099 @@ -0,0 +1,1 @@
2100 +a
2100 +a
2101 diff -r f8035bb17114 -r 216d4c92cf98 g
2101 diff -r f8035bb17114 -r 216d4c92cf98 g
2102 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2102 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2103 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2103 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2104 @@ -0,0 +1,1 @@
2104 @@ -0,0 +1,1 @@
2105 +f
2105 +f
2106 # HG changeset patch
2106 # HG changeset patch
2107 # User test
2107 # User test
2108 # Date 0 0
2108 # Date 0 0
2109 # Thu Jan 01 00:00:00 1970 +0000
2109 # Thu Jan 01 00:00:00 1970 +0000
2110 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2110 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2111 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2111 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2112 mv b dir/b
2112 mv b dir/b
2113
2113
2114 diff -r 216d4c92cf98 -r bb573313a9e8 b
2114 diff -r 216d4c92cf98 -r bb573313a9e8 b
2115 --- a/b Thu Jan 01 00:00:00 1970 +0000
2115 --- a/b Thu Jan 01 00:00:00 1970 +0000
2116 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2116 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2117 @@ -1,1 +0,0 @@
2117 @@ -1,1 +0,0 @@
2118 -a
2118 -a
2119 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2119 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2120 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2120 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2121 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2121 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2122 @@ -0,0 +1,1 @@
2122 @@ -0,0 +1,1 @@
2123 +a
2123 +a
2124 diff -r 216d4c92cf98 -r bb573313a9e8 f
2124 diff -r 216d4c92cf98 -r bb573313a9e8 f
2125 --- a/f Thu Jan 01 00:00:00 1970 +0000
2125 --- a/f Thu Jan 01 00:00:00 1970 +0000
2126 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2126 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2127 @@ -1,1 +1,2 @@
2127 @@ -1,1 +1,2 @@
2128 f
2128 f
2129 +f
2129 +f
2130 diff -r 216d4c92cf98 -r bb573313a9e8 g
2130 diff -r 216d4c92cf98 -r bb573313a9e8 g
2131 --- a/g Thu Jan 01 00:00:00 1970 +0000
2131 --- a/g Thu Jan 01 00:00:00 1970 +0000
2132 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2132 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2133 @@ -1,1 +1,2 @@
2133 @@ -1,1 +1,2 @@
2134 f
2134 f
2135 +g
2135 +g
2136 # HG changeset patch
2136 # HG changeset patch
2137 # User test
2137 # User test
2138 # Date 0 0
2138 # Date 0 0
2139 # Thu Jan 01 00:00:00 1970 +0000
2139 # Thu Jan 01 00:00:00 1970 +0000
2140 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2140 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2141 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2141 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2142 mv a b; add d
2142 mv a b; add d
2143
2143
2144 diff -r bb573313a9e8 -r 5918b8d165d1 a
2144 diff -r bb573313a9e8 -r 5918b8d165d1 a
2145 --- a/a Thu Jan 01 00:00:00 1970 +0000
2145 --- a/a Thu Jan 01 00:00:00 1970 +0000
2146 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2146 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2147 @@ -1,1 +0,0 @@
2147 @@ -1,1 +0,0 @@
2148 -a
2148 -a
2149 diff -r bb573313a9e8 -r 5918b8d165d1 b
2149 diff -r bb573313a9e8 -r 5918b8d165d1 b
2150 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2150 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2151 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2151 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2152 @@ -0,0 +1,1 @@
2152 @@ -0,0 +1,1 @@
2153 +a
2153 +a
2154 diff -r bb573313a9e8 -r 5918b8d165d1 d
2154 diff -r bb573313a9e8 -r 5918b8d165d1 d
2155 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2155 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2156 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2156 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2157 @@ -0,0 +1,1 @@
2157 @@ -0,0 +1,1 @@
2158 +a
2158 +a
2159 diff -r bb573313a9e8 -r 5918b8d165d1 g
2159 diff -r bb573313a9e8 -r 5918b8d165d1 g
2160 --- a/g Thu Jan 01 00:00:00 1970 +0000
2160 --- a/g Thu Jan 01 00:00:00 1970 +0000
2161 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2161 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2162 @@ -1,2 +1,2 @@
2162 @@ -1,2 +1,2 @@
2163 f
2163 f
2164 -g
2164 -g
2165 +f
2165 +f
2166 # HG changeset patch
2166 # HG changeset patch
2167 # User test
2167 # User test
2168 # Date 0 0
2168 # Date 0 0
2169 # Thu Jan 01 00:00:00 1970 +0000
2169 # Thu Jan 01 00:00:00 1970 +0000
2170 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2170 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2171 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2171 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2172 mv dir/b e
2172 mv dir/b e
2173
2173
2174 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2174 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2175 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2175 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2176 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2176 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2177 @@ -1,1 +0,0 @@
2177 @@ -1,1 +0,0 @@
2178 -a
2178 -a
2179 diff -r 5918b8d165d1 -r 17d952250a9d e
2179 diff -r 5918b8d165d1 -r 17d952250a9d e
2180 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2180 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2181 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2181 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2182 @@ -0,0 +1,1 @@
2182 @@ -0,0 +1,1 @@
2183 +a
2183 +a
2184 # HG changeset patch
2184 # HG changeset patch
2185 # User test
2185 # User test
2186 # Date 0 0
2186 # Date 0 0
2187 # Thu Jan 01 00:00:00 1970 +0000
2187 # Thu Jan 01 00:00:00 1970 +0000
2188 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2188 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2189 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2189 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2190 add another e
2190 add another e
2191
2191
2192 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2192 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2193 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2193 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2194 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2194 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2195 @@ -0,0 +1,1 @@
2195 @@ -0,0 +1,1 @@
2196 +ee
2196 +ee
2197 # HG changeset patch
2197 # HG changeset patch
2198 # User test
2198 # User test
2199 # Date 0 0
2199 # Date 0 0
2200 # Thu Jan 01 00:00:00 1970 +0000
2200 # Thu Jan 01 00:00:00 1970 +0000
2201 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2201 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2202 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2202 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2203 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2203 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2204 merge 5 and 4
2204 merge 5 and 4
2205
2205
2206 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2206 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2207 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2207 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2208 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2208 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2209 @@ -1,1 +0,0 @@
2209 @@ -1,1 +0,0 @@
2210 -a
2210 -a
2211 diff -r 99b31f1c2782 -r fc281d8ff18d e
2211 diff -r 99b31f1c2782 -r fc281d8ff18d e
2212 --- a/e Thu Jan 01 00:00:00 1970 +0000
2212 --- a/e Thu Jan 01 00:00:00 1970 +0000
2213 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2213 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2214 @@ -1,1 +1,1 @@
2214 @@ -1,1 +1,1 @@
2215 -ee
2215 -ee
2216 +merge
2216 +merge
2217 # HG changeset patch
2217 # HG changeset patch
2218 # User test
2218 # User test
2219 # Date 0 0
2219 # Date 0 0
2220 # Thu Jan 01 00:00:00 1970 +0000
2220 # Thu Jan 01 00:00:00 1970 +0000
2221 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2221 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2222 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2222 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2223 Added tag foo-bar for changeset fc281d8ff18d
2223 Added tag foo-bar for changeset fc281d8ff18d
2224
2224
2225 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2225 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2226 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2226 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2227 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2227 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2228 @@ -0,0 +1,1 @@
2228 @@ -0,0 +1,1 @@
2229 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2229 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2230 # HG changeset patch
2230 # HG changeset patch
2231 # User test
2231 # User test
2232 # Date 0 0
2232 # Date 0 0
2233 # Thu Jan 01 00:00:00 1970 +0000
2233 # Thu Jan 01 00:00:00 1970 +0000
2234 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2234 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2235 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2235 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2236 add g
2236 add g
2237
2237
2238 diff -r fc281d8ff18d -r 24c2e826ddeb g
2238 diff -r fc281d8ff18d -r 24c2e826ddeb g
2239 --- a/g Thu Jan 01 00:00:00 1970 +0000
2239 --- a/g Thu Jan 01 00:00:00 1970 +0000
2240 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2240 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2241 @@ -1,2 +1,1 @@
2241 @@ -1,2 +1,1 @@
2242 -f
2242 -f
2243 -f
2243 -f
2244 +g
2244 +g
2245 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2245 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2246 ['6', '8', '5', '7', '4']
2246 ['6', '8', '5', '7', '4']
2247 []
2247 []
2248 <generatorsetdesc->
2248 <generatorsetdesc->
2249
2249
2250 Test --follow-first and forward --rev
2250 Test --follow-first and forward --rev
2251
2251
2252 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2252 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2253 ['6', '8', '5', '7', '4']
2253 ['6', '8', '5', '7', '4']
2254 []
2254 []
2255 <generatorsetdesc->
2255 <generatorsetdesc->
2256
2256
2257 Test --follow and backward --rev
2257 Test --follow and backward --rev
2258
2258
2259 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2259 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2260 ['6', '5', '7', '8', '4']
2260 ['6', '5', '7', '8', '4']
2261 []
2261 []
2262 <generatorsetdesc->
2262 <generatorsetdesc->
2263
2263
2264 Test --follow-first and backward --rev
2264 Test --follow-first and backward --rev
2265
2265
2266 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2266 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2267 ['6', '5', '7', '8', '4']
2267 ['6', '5', '7', '8', '4']
2268 []
2268 []
2269 <generatorsetdesc->
2269 <generatorsetdesc->
2270
2270
2271 Test --follow with --rev of graphlog extension
2271 Test --follow with --rev of graphlog extension
2272
2272
2273 $ hg --config extensions.graphlog= glog -qfr1
2273 $ hg --config extensions.graphlog= glog -qfr1
2274 o 1:216d4c92cf98
2274 o 1:216d4c92cf98
2275 |
2275 |
2276 o 0:f8035bb17114
2276 o 0:f8035bb17114
2277
2277
2278
2278
2279 Test subdir
2279 Test subdir
2280
2280
2281 $ hg up -q 3
2281 $ hg up -q 3
2282 $ cd dir
2282 $ cd dir
2283 $ testlog .
2283 $ testlog .
2284 []
2284 []
2285 (func
2285 (func
2286 (symbol '_matchfiles')
2286 (symbol '_matchfiles')
2287 (list
2287 (list
2288 (string 'r:')
2288 (string 'r:')
2289 (string 'd:relpath')
2289 (string 'd:relpath')
2290 (string 'p:.')))
2290 (string 'p:.')))
2291 <filteredset
2291 <filteredset
2292 <spanset- 0:9>,
2292 <spanset- 0:9>,
2293 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=None>>
2293 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=None>>
2294 $ testlog ../b
2294 $ testlog ../b
2295 []
2295 []
2296 (func
2296 (func
2297 (symbol 'filelog')
2297 (symbol 'filelog')
2298 (string '../b'))
2298 (string '../b'))
2299 <filteredset
2299 <filteredset
2300 <spanset- 0:9>, set([1])>
2300 <spanset- 0:9>, set([1])>
2301 $ testlog -f ../b
2301 $ testlog -f ../b
2302 []
2302 []
2303 []
2303 []
2304 <generatorsetdesc->
2304 <generatorsetdesc->
2305 $ cd ..
2305 $ cd ..
2306
2306
2307 Test --hidden
2307 Test --hidden
2308 (enable obsolete)
2308 (enable obsolete)
2309
2309
2310 $ cat >> $HGRCPATH << EOF
2310 $ cat >> $HGRCPATH << EOF
2311 > [experimental]
2311 > [experimental]
2312 > evolution.createmarkers=True
2312 > evolution.createmarkers=True
2313 > EOF
2313 > EOF
2314
2314
2315 $ hg debugobsolete `hg id --debug -i -r 8`
2315 $ hg debugobsolete `hg id --debug -i -r 8`
2316 obsoleted 1 changesets
2316 obsoleted 1 changesets
2317 $ testlog
2317 $ testlog
2318 []
2318 []
2319 []
2319 []
2320 <spanset- 0:9>
2320 <spanset- 0:9>
2321 $ testlog --hidden
2321 $ testlog --hidden
2322 []
2322 []
2323 []
2323 []
2324 <spanset- 0:9>
2324 <spanset- 0:9>
2325 $ hg log -G --template '{rev} {desc}\n'
2325 $ hg log -G --template '{rev} {desc}\n'
2326 o 7 Added tag foo-bar for changeset fc281d8ff18d
2326 o 7 Added tag foo-bar for changeset fc281d8ff18d
2327 |
2327 |
2328 o 6 merge 5 and 4
2328 o 6 merge 5 and 4
2329 |\
2329 |\
2330 | o 5 add another e
2330 | o 5 add another e
2331 | |
2331 | |
2332 o | 4 mv dir/b e
2332 o | 4 mv dir/b e
2333 |/
2333 |/
2334 @ 3 mv a b; add d
2334 @ 3 mv a b; add d
2335 |
2335 |
2336 o 2 mv b dir/b
2336 o 2 mv b dir/b
2337 |
2337 |
2338 o 1 copy a b
2338 o 1 copy a b
2339 |
2339 |
2340 o 0 add a
2340 o 0 add a
2341
2341
2342
2342
2343 A template without trailing newline should do something sane
2343 A template without trailing newline should do something sane
2344
2344
2345 $ hg log -G -r ::2 --template '{rev} {desc}'
2345 $ hg log -G -r ::2 --template '{rev} {desc}'
2346 o 2 mv b dir/b
2346 o 2 mv b dir/b
2347 |
2347 |
2348 o 1 copy a b
2348 o 1 copy a b
2349 |
2349 |
2350 o 0 add a
2350 o 0 add a
2351
2351
2352
2352
2353 Extra newlines must be preserved
2353 Extra newlines must be preserved
2354
2354
2355 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2355 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2356 o
2356 o
2357 | 2 mv b dir/b
2357 | 2 mv b dir/b
2358 |
2358 |
2359 o
2359 o
2360 | 1 copy a b
2360 | 1 copy a b
2361 |
2361 |
2362 o
2362 o
2363 0 add a
2363 0 add a
2364
2364
2365
2365
2366 The almost-empty template should do something sane too ...
2366 The almost-empty template should do something sane too ...
2367
2367
2368 $ hg log -G -r ::2 --template '\n'
2368 $ hg log -G -r ::2 --template '\n'
2369 o
2369 o
2370 |
2370 |
2371 o
2371 o
2372 |
2372 |
2373 o
2373 o
2374
2374
2375
2375
2376 issue3772
2376 issue3772
2377
2377
2378 $ hg log -G -r :null
2378 $ hg log -G -r :null
2379 o changeset: 0:f8035bb17114
2379 o changeset: 0:f8035bb17114
2380 | user: test
2380 | user: test
2381 | date: Thu Jan 01 00:00:00 1970 +0000
2381 | date: Thu Jan 01 00:00:00 1970 +0000
2382 | summary: add a
2382 | summary: add a
2383 |
2383 |
2384 o changeset: -1:000000000000
2384 o changeset: -1:000000000000
2385 user:
2385 user:
2386 date: Thu Jan 01 00:00:00 1970 +0000
2386 date: Thu Jan 01 00:00:00 1970 +0000
2387
2387
2388 $ hg log -G -r null:null
2388 $ hg log -G -r null:null
2389 o changeset: -1:000000000000
2389 o changeset: -1:000000000000
2390 user:
2390 user:
2391 date: Thu Jan 01 00:00:00 1970 +0000
2391 date: Thu Jan 01 00:00:00 1970 +0000
2392
2392
2393
2393
2394 should not draw line down to null due to the magic of fullreposet
2394 should not draw line down to null due to the magic of fullreposet
2395
2395
2396 $ hg log -G -r 'all()' | tail -6
2396 $ hg log -G -r 'all()' | tail -6
2397 |
2397 |
2398 o changeset: 0:f8035bb17114
2398 o changeset: 0:f8035bb17114
2399 user: test
2399 user: test
2400 date: Thu Jan 01 00:00:00 1970 +0000
2400 date: Thu Jan 01 00:00:00 1970 +0000
2401 summary: add a
2401 summary: add a
2402
2402
2403
2403
2404 $ hg log -G -r 'branch(default)' | tail -6
2404 $ hg log -G -r 'branch(default)' | tail -6
2405 |
2405 |
2406 o changeset: 0:f8035bb17114
2406 o changeset: 0:f8035bb17114
2407 user: test
2407 user: test
2408 date: Thu Jan 01 00:00:00 1970 +0000
2408 date: Thu Jan 01 00:00:00 1970 +0000
2409 summary: add a
2409 summary: add a
2410
2410
2411
2411
2412 working-directory revision
2412 working-directory revision
2413
2413
2414 $ hg log -G -qr '. + wdir()'
2414 $ hg log -G -qr '. + wdir()'
2415 o 2147483647:ffffffffffff
2415 o 2147483647:ffffffffffff
2416 |
2416 |
2417 @ 3:5918b8d165d1
2417 @ 3:5918b8d165d1
2418 |
2418 |
2419 ~
2419 ~
2420
2420
2421 node template with changeset_printer:
2421 node template with changeset_printer:
2422
2422
2423 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2423 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2424 7 7:02dbb8e276b8
2424 7 7:02dbb8e276b8
2425 |
2425 |
2426 6 6:fc281d8ff18d
2426 6 6:fc281d8ff18d
2427 |\
2427 |\
2428 | ~
2428 | ~
2429 5 5:99b31f1c2782
2429 5 5:99b31f1c2782
2430 |
2430 |
2431 ~
2431 ~
2432
2432
2433 node template with changeset_templater (shared cache variable):
2433 node template with changeset_templater (shared cache variable):
2434
2434
2435 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2435 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2436 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2436 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2437 o 7 foo-bar+1
2437 o 7 foo-bar+1
2438 |
2438 |
2439 # 6 foo-bar+0
2439 # 6 foo-bar+0
2440 |\
2440 |\
2441 | ~
2441 | ~
2442 o 5 null+5
2442 o 5 null+5
2443 |
2443 |
2444 ~
2444 ~
2445
2445
2446 label() should just work in node template:
2446 label() should just work in node template:
2447
2447
2448 $ hg log -Gqr 7 --config extensions.color= --color=debug \
2448 $ hg log -Gqr 7 --config extensions.color= --color=debug \
2449 > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
2449 > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
2450 [branch.default|7] [log.node|7:02dbb8e276b8]
2450 [branch.default|7] [log.node|7:02dbb8e276b8]
2451 |
2451 |
2452 ~
2452 ~
2453
2453
2454 $ cd ..
2454 $ cd ..
2455
2455
2456 change graph edge styling
2456 change graph edge styling
2457
2457
2458 $ cd repo
2458 $ cd repo
2459 $ cat << EOF >> $HGRCPATH
2459 $ cat << EOF >> $HGRCPATH
2460 > [experimental]
2460 > [experimental]
2461 > graphstyle.parent = |
2461 > graphstyle.parent = |
2462 > graphstyle.grandparent = :
2462 > graphstyle.grandparent = :
2463 > graphstyle.missing =
2463 > graphstyle.missing =
2464 > EOF
2464 > EOF
2465 $ hg log -G -r 'file("a")' -m
2465 $ hg log -G -r 'file("a")' -m
2466 @ changeset: 36:08a19a744424
2466 @ changeset: 36:08a19a744424
2467 : branch: branch
2467 : branch: branch
2468 : tag: tip
2468 : tag: tip
2469 : parent: 35:9159c3644c5e
2469 : parent: 35:9159c3644c5e
2470 : parent: 35:9159c3644c5e
2470 : parent: 35:9159c3644c5e
2471 : user: test
2471 : user: test
2472 : date: Thu Jan 01 00:00:36 1970 +0000
2472 : date: Thu Jan 01 00:00:36 1970 +0000
2473 : summary: (36) buggy merge: identical parents
2473 : summary: (36) buggy merge: identical parents
2474 :
2474 :
2475 o changeset: 32:d06dffa21a31
2475 o changeset: 32:d06dffa21a31
2476 |\ parent: 27:886ed638191b
2476 |\ parent: 27:886ed638191b
2477 | : parent: 31:621d83e11f67
2477 | : parent: 31:621d83e11f67
2478 | : user: test
2478 | : user: test
2479 | : date: Thu Jan 01 00:00:32 1970 +0000
2479 | : date: Thu Jan 01 00:00:32 1970 +0000
2480 | : summary: (32) expand
2480 | : summary: (32) expand
2481 | :
2481 | :
2482 o : changeset: 31:621d83e11f67
2482 o : changeset: 31:621d83e11f67
2483 |\: parent: 21:d42a756af44d
2483 |\: parent: 21:d42a756af44d
2484 | : parent: 30:6e11cd4b648f
2484 | : parent: 30:6e11cd4b648f
2485 | : user: test
2485 | : user: test
2486 | : date: Thu Jan 01 00:00:31 1970 +0000
2486 | : date: Thu Jan 01 00:00:31 1970 +0000
2487 | : summary: (31) expand
2487 | : summary: (31) expand
2488 | :
2488 | :
2489 o : changeset: 30:6e11cd4b648f
2489 o : changeset: 30:6e11cd4b648f
2490 |\ \ parent: 28:44ecd0b9ae99
2490 |\ \ parent: 28:44ecd0b9ae99
2491 | ~ : parent: 29:cd9bb2be7593
2491 | ~ : parent: 29:cd9bb2be7593
2492 | : user: test
2492 | : user: test
2493 | : date: Thu Jan 01 00:00:30 1970 +0000
2493 | : date: Thu Jan 01 00:00:30 1970 +0000
2494 | : summary: (30) expand
2494 | : summary: (30) expand
2495 | /
2495 | /
2496 o : changeset: 28:44ecd0b9ae99
2496 o : changeset: 28:44ecd0b9ae99
2497 |\ \ parent: 1:6db2ef61d156
2497 |\ \ parent: 1:6db2ef61d156
2498 | ~ : parent: 26:7f25b6c2f0b9
2498 | ~ : parent: 26:7f25b6c2f0b9
2499 | : user: test
2499 | : user: test
2500 | : date: Thu Jan 01 00:00:28 1970 +0000
2500 | : date: Thu Jan 01 00:00:28 1970 +0000
2501 | : summary: (28) merge zero known
2501 | : summary: (28) merge zero known
2502 | /
2502 | /
2503 o : changeset: 26:7f25b6c2f0b9
2503 o : changeset: 26:7f25b6c2f0b9
2504 |\ \ parent: 18:1aa84d96232a
2504 |\ \ parent: 18:1aa84d96232a
2505 | | : parent: 25:91da8ed57247
2505 | | : parent: 25:91da8ed57247
2506 | | : user: test
2506 | | : user: test
2507 | | : date: Thu Jan 01 00:00:26 1970 +0000
2507 | | : date: Thu Jan 01 00:00:26 1970 +0000
2508 | | : summary: (26) merge one known; far right
2508 | | : summary: (26) merge one known; far right
2509 | | :
2509 | | :
2510 | o : changeset: 25:91da8ed57247
2510 | o : changeset: 25:91da8ed57247
2511 | |\: parent: 21:d42a756af44d
2511 | |\: parent: 21:d42a756af44d
2512 | | : parent: 24:a9c19a3d96b7
2512 | | : parent: 24:a9c19a3d96b7
2513 | | : user: test
2513 | | : user: test
2514 | | : date: Thu Jan 01 00:00:25 1970 +0000
2514 | | : date: Thu Jan 01 00:00:25 1970 +0000
2515 | | : summary: (25) merge one known; far left
2515 | | : summary: (25) merge one known; far left
2516 | | :
2516 | | :
2517 | o : changeset: 24:a9c19a3d96b7
2517 | o : changeset: 24:a9c19a3d96b7
2518 | |\ \ parent: 0:e6eb3150255d
2518 | |\ \ parent: 0:e6eb3150255d
2519 | | ~ : parent: 23:a01cddf0766d
2519 | | ~ : parent: 23:a01cddf0766d
2520 | | : user: test
2520 | | : user: test
2521 | | : date: Thu Jan 01 00:00:24 1970 +0000
2521 | | : date: Thu Jan 01 00:00:24 1970 +0000
2522 | | : summary: (24) merge one known; immediate right
2522 | | : summary: (24) merge one known; immediate right
2523 | | /
2523 | | /
2524 | o : changeset: 23:a01cddf0766d
2524 | o : changeset: 23:a01cddf0766d
2525 | |\ \ parent: 1:6db2ef61d156
2525 | |\ \ parent: 1:6db2ef61d156
2526 | | ~ : parent: 22:e0d9cccacb5d
2526 | | ~ : parent: 22:e0d9cccacb5d
2527 | | : user: test
2527 | | : user: test
2528 | | : date: Thu Jan 01 00:00:23 1970 +0000
2528 | | : date: Thu Jan 01 00:00:23 1970 +0000
2529 | | : summary: (23) merge one known; immediate left
2529 | | : summary: (23) merge one known; immediate left
2530 | | /
2530 | | /
2531 | o : changeset: 22:e0d9cccacb5d
2531 | o : changeset: 22:e0d9cccacb5d
2532 |/:/ parent: 18:1aa84d96232a
2532 |/:/ parent: 18:1aa84d96232a
2533 | : parent: 21:d42a756af44d
2533 | : parent: 21:d42a756af44d
2534 | : user: test
2534 | : user: test
2535 | : date: Thu Jan 01 00:00:22 1970 +0000
2535 | : date: Thu Jan 01 00:00:22 1970 +0000
2536 | : summary: (22) merge two known; one far left, one far right
2536 | : summary: (22) merge two known; one far left, one far right
2537 | :
2537 | :
2538 | o changeset: 21:d42a756af44d
2538 | o changeset: 21:d42a756af44d
2539 | |\ parent: 19:31ddc2c1573b
2539 | |\ parent: 19:31ddc2c1573b
2540 | | | parent: 20:d30ed6450e32
2540 | | | parent: 20:d30ed6450e32
2541 | | | user: test
2541 | | | user: test
2542 | | | date: Thu Jan 01 00:00:21 1970 +0000
2542 | | | date: Thu Jan 01 00:00:21 1970 +0000
2543 | | | summary: (21) expand
2543 | | | summary: (21) expand
2544 | | |
2544 | | |
2545 +---o changeset: 20:d30ed6450e32
2545 +---o changeset: 20:d30ed6450e32
2546 | | | parent: 0:e6eb3150255d
2546 | | | parent: 0:e6eb3150255d
2547 | | ~ parent: 18:1aa84d96232a
2547 | | ~ parent: 18:1aa84d96232a
2548 | | user: test
2548 | | user: test
2549 | | date: Thu Jan 01 00:00:20 1970 +0000
2549 | | date: Thu Jan 01 00:00:20 1970 +0000
2550 | | summary: (20) merge two known; two far right
2550 | | summary: (20) merge two known; two far right
2551 | |
2551 | |
2552 | o changeset: 19:31ddc2c1573b
2552 | o changeset: 19:31ddc2c1573b
2553 | |\ parent: 15:1dda3f72782d
2553 | |\ parent: 15:1dda3f72782d
2554 | | | parent: 17:44765d7c06e0
2554 | | | parent: 17:44765d7c06e0
2555 | | | user: test
2555 | | | user: test
2556 | | | date: Thu Jan 01 00:00:19 1970 +0000
2556 | | | date: Thu Jan 01 00:00:19 1970 +0000
2557 | | | summary: (19) expand
2557 | | | summary: (19) expand
2558 | | |
2558 | | |
2559 o | | changeset: 18:1aa84d96232a
2559 o | | changeset: 18:1aa84d96232a
2560 |\| | parent: 1:6db2ef61d156
2560 |\| | parent: 1:6db2ef61d156
2561 ~ | | parent: 15:1dda3f72782d
2561 ~ | | parent: 15:1dda3f72782d
2562 | | user: test
2562 | | user: test
2563 | | date: Thu Jan 01 00:00:18 1970 +0000
2563 | | date: Thu Jan 01 00:00:18 1970 +0000
2564 | | summary: (18) merge two known; two far left
2564 | | summary: (18) merge two known; two far left
2565 / /
2565 / /
2566 | o changeset: 17:44765d7c06e0
2566 | o changeset: 17:44765d7c06e0
2567 | |\ parent: 12:86b91144a6e9
2567 | |\ parent: 12:86b91144a6e9
2568 | | | parent: 16:3677d192927d
2568 | | | parent: 16:3677d192927d
2569 | | | user: test
2569 | | | user: test
2570 | | | date: Thu Jan 01 00:00:17 1970 +0000
2570 | | | date: Thu Jan 01 00:00:17 1970 +0000
2571 | | | summary: (17) expand
2571 | | | summary: (17) expand
2572 | | |
2572 | | |
2573 | | o changeset: 16:3677d192927d
2573 | | o changeset: 16:3677d192927d
2574 | | |\ parent: 0:e6eb3150255d
2574 | | |\ parent: 0:e6eb3150255d
2575 | | ~ ~ parent: 1:6db2ef61d156
2575 | | ~ ~ parent: 1:6db2ef61d156
2576 | | user: test
2576 | | user: test
2577 | | date: Thu Jan 01 00:00:16 1970 +0000
2577 | | date: Thu Jan 01 00:00:16 1970 +0000
2578 | | summary: (16) merge two known; one immediate right, one near right
2578 | | summary: (16) merge two known; one immediate right, one near right
2579 | |
2579 | |
2580 o | changeset: 15:1dda3f72782d
2580 o | changeset: 15:1dda3f72782d
2581 |\ \ parent: 13:22d8966a97e3
2581 |\ \ parent: 13:22d8966a97e3
2582 | | | parent: 14:8eac370358ef
2582 | | | parent: 14:8eac370358ef
2583 | | | user: test
2583 | | | user: test
2584 | | | date: Thu Jan 01 00:00:15 1970 +0000
2584 | | | date: Thu Jan 01 00:00:15 1970 +0000
2585 | | | summary: (15) expand
2585 | | | summary: (15) expand
2586 | | |
2586 | | |
2587 | o | changeset: 14:8eac370358ef
2587 | o | changeset: 14:8eac370358ef
2588 | |\| parent: 0:e6eb3150255d
2588 | |\| parent: 0:e6eb3150255d
2589 | ~ | parent: 12:86b91144a6e9
2589 | ~ | parent: 12:86b91144a6e9
2590 | | user: test
2590 | | user: test
2591 | | date: Thu Jan 01 00:00:14 1970 +0000
2591 | | date: Thu Jan 01 00:00:14 1970 +0000
2592 | | summary: (14) merge two known; one immediate right, one far right
2592 | | summary: (14) merge two known; one immediate right, one far right
2593 | /
2593 | /
2594 o | changeset: 13:22d8966a97e3
2594 o | changeset: 13:22d8966a97e3
2595 |\ \ parent: 9:7010c0af0a35
2595 |\ \ parent: 9:7010c0af0a35
2596 | | | parent: 11:832d76e6bdf2
2596 | | | parent: 11:832d76e6bdf2
2597 | | | user: test
2597 | | | user: test
2598 | | | date: Thu Jan 01 00:00:13 1970 +0000
2598 | | | date: Thu Jan 01 00:00:13 1970 +0000
2599 | | | summary: (13) expand
2599 | | | summary: (13) expand
2600 | | |
2600 | | |
2601 +---o changeset: 12:86b91144a6e9
2601 +---o changeset: 12:86b91144a6e9
2602 | | | parent: 1:6db2ef61d156
2602 | | | parent: 1:6db2ef61d156
2603 | | ~ parent: 9:7010c0af0a35
2603 | | ~ parent: 9:7010c0af0a35
2604 | | user: test
2604 | | user: test
2605 | | date: Thu Jan 01 00:00:12 1970 +0000
2605 | | date: Thu Jan 01 00:00:12 1970 +0000
2606 | | summary: (12) merge two known; one immediate right, one far left
2606 | | summary: (12) merge two known; one immediate right, one far left
2607 | |
2607 | |
2608 | o changeset: 11:832d76e6bdf2
2608 | o changeset: 11:832d76e6bdf2
2609 | |\ parent: 6:b105a072e251
2609 | |\ parent: 6:b105a072e251
2610 | | | parent: 10:74c64d036d72
2610 | | | parent: 10:74c64d036d72
2611 | | | user: test
2611 | | | user: test
2612 | | | date: Thu Jan 01 00:00:11 1970 +0000
2612 | | | date: Thu Jan 01 00:00:11 1970 +0000
2613 | | | summary: (11) expand
2613 | | | summary: (11) expand
2614 | | |
2614 | | |
2615 | | o changeset: 10:74c64d036d72
2615 | | o changeset: 10:74c64d036d72
2616 | |/| parent: 0:e6eb3150255d
2616 | |/| parent: 0:e6eb3150255d
2617 | | ~ parent: 6:b105a072e251
2617 | | ~ parent: 6:b105a072e251
2618 | | user: test
2618 | | user: test
2619 | | date: Thu Jan 01 00:00:10 1970 +0000
2619 | | date: Thu Jan 01 00:00:10 1970 +0000
2620 | | summary: (10) merge two known; one immediate left, one near right
2620 | | summary: (10) merge two known; one immediate left, one near right
2621 | |
2621 | |
2622 o | changeset: 9:7010c0af0a35
2622 o | changeset: 9:7010c0af0a35
2623 |\ \ parent: 7:b632bb1b1224
2623 |\ \ parent: 7:b632bb1b1224
2624 | | | parent: 8:7a0b11f71937
2624 | | | parent: 8:7a0b11f71937
2625 | | | user: test
2625 | | | user: test
2626 | | | date: Thu Jan 01 00:00:09 1970 +0000
2626 | | | date: Thu Jan 01 00:00:09 1970 +0000
2627 | | | summary: (9) expand
2627 | | | summary: (9) expand
2628 | | |
2628 | | |
2629 | o | changeset: 8:7a0b11f71937
2629 | o | changeset: 8:7a0b11f71937
2630 |/| | parent: 0:e6eb3150255d
2630 |/| | parent: 0:e6eb3150255d
2631 | ~ | parent: 7:b632bb1b1224
2631 | ~ | parent: 7:b632bb1b1224
2632 | | user: test
2632 | | user: test
2633 | | date: Thu Jan 01 00:00:08 1970 +0000
2633 | | date: Thu Jan 01 00:00:08 1970 +0000
2634 | | summary: (8) merge two known; one immediate left, one far right
2634 | | summary: (8) merge two known; one immediate left, one far right
2635 | /
2635 | /
2636 o | changeset: 7:b632bb1b1224
2636 o | changeset: 7:b632bb1b1224
2637 |\ \ parent: 2:3d9a33b8d1e1
2637 |\ \ parent: 2:3d9a33b8d1e1
2638 | ~ | parent: 5:4409d547b708
2638 | ~ | parent: 5:4409d547b708
2639 | | user: test
2639 | | user: test
2640 | | date: Thu Jan 01 00:00:07 1970 +0000
2640 | | date: Thu Jan 01 00:00:07 1970 +0000
2641 | | summary: (7) expand
2641 | | summary: (7) expand
2642 | /
2642 | /
2643 | o changeset: 6:b105a072e251
2643 | o changeset: 6:b105a072e251
2644 |/| parent: 2:3d9a33b8d1e1
2644 |/| parent: 2:3d9a33b8d1e1
2645 | ~ parent: 5:4409d547b708
2645 | ~ parent: 5:4409d547b708
2646 | user: test
2646 | user: test
2647 | date: Thu Jan 01 00:00:06 1970 +0000
2647 | date: Thu Jan 01 00:00:06 1970 +0000
2648 | summary: (6) merge two known; one immediate left, one far left
2648 | summary: (6) merge two known; one immediate left, one far left
2649 |
2649 |
2650 o changeset: 5:4409d547b708
2650 o changeset: 5:4409d547b708
2651 |\ parent: 3:27eef8ed80b4
2651 |\ parent: 3:27eef8ed80b4
2652 | ~ parent: 4:26a8bac39d9f
2652 | ~ parent: 4:26a8bac39d9f
2653 | user: test
2653 | user: test
2654 | date: Thu Jan 01 00:00:05 1970 +0000
2654 | date: Thu Jan 01 00:00:05 1970 +0000
2655 | summary: (5) expand
2655 | summary: (5) expand
2656 |
2656 |
2657 o changeset: 4:26a8bac39d9f
2657 o changeset: 4:26a8bac39d9f
2658 |\ parent: 1:6db2ef61d156
2658 |\ parent: 1:6db2ef61d156
2659 ~ ~ parent: 3:27eef8ed80b4
2659 ~ ~ parent: 3:27eef8ed80b4
2660 user: test
2660 user: test
2661 date: Thu Jan 01 00:00:04 1970 +0000
2661 date: Thu Jan 01 00:00:04 1970 +0000
2662 summary: (4) merge two known; one immediate left, one immediate right
2662 summary: (4) merge two known; one immediate left, one immediate right
2663
2663
2664
2664
2665 Setting HGPLAIN ignores graphmod styling:
2665 Setting HGPLAIN ignores graphmod styling:
2666
2666
2667 $ HGPLAIN=1 hg log -G -r 'file("a")' -m
2667 $ HGPLAIN=1 hg log -G -r 'file("a")' -m
2668 @ changeset: 36:08a19a744424
2668 @ changeset: 36:08a19a744424
2669 | branch: branch
2669 | branch: branch
2670 | tag: tip
2670 | tag: tip
2671 | parent: 35:9159c3644c5e
2671 | parent: 35:9159c3644c5e
2672 | parent: 35:9159c3644c5e
2672 | parent: 35:9159c3644c5e
2673 | user: test
2673 | user: test
2674 | date: Thu Jan 01 00:00:36 1970 +0000
2674 | date: Thu Jan 01 00:00:36 1970 +0000
2675 | summary: (36) buggy merge: identical parents
2675 | summary: (36) buggy merge: identical parents
2676 |
2676 |
2677 o changeset: 32:d06dffa21a31
2677 o changeset: 32:d06dffa21a31
2678 |\ parent: 27:886ed638191b
2678 |\ parent: 27:886ed638191b
2679 | | parent: 31:621d83e11f67
2679 | | parent: 31:621d83e11f67
2680 | | user: test
2680 | | user: test
2681 | | date: Thu Jan 01 00:00:32 1970 +0000
2681 | | date: Thu Jan 01 00:00:32 1970 +0000
2682 | | summary: (32) expand
2682 | | summary: (32) expand
2683 | |
2683 | |
2684 o | changeset: 31:621d83e11f67
2684 o | changeset: 31:621d83e11f67
2685 |\| parent: 21:d42a756af44d
2685 |\| parent: 21:d42a756af44d
2686 | | parent: 30:6e11cd4b648f
2686 | | parent: 30:6e11cd4b648f
2687 | | user: test
2687 | | user: test
2688 | | date: Thu Jan 01 00:00:31 1970 +0000
2688 | | date: Thu Jan 01 00:00:31 1970 +0000
2689 | | summary: (31) expand
2689 | | summary: (31) expand
2690 | |
2690 | |
2691 o | changeset: 30:6e11cd4b648f
2691 o | changeset: 30:6e11cd4b648f
2692 |\ \ parent: 28:44ecd0b9ae99
2692 |\ \ parent: 28:44ecd0b9ae99
2693 | | | parent: 29:cd9bb2be7593
2693 | | | parent: 29:cd9bb2be7593
2694 | | | user: test
2694 | | | user: test
2695 | | | date: Thu Jan 01 00:00:30 1970 +0000
2695 | | | date: Thu Jan 01 00:00:30 1970 +0000
2696 | | | summary: (30) expand
2696 | | | summary: (30) expand
2697 | | |
2697 | | |
2698 o | | changeset: 28:44ecd0b9ae99
2698 o | | changeset: 28:44ecd0b9ae99
2699 |\ \ \ parent: 1:6db2ef61d156
2699 |\ \ \ parent: 1:6db2ef61d156
2700 | | | | parent: 26:7f25b6c2f0b9
2700 | | | | parent: 26:7f25b6c2f0b9
2701 | | | | user: test
2701 | | | | user: test
2702 | | | | date: Thu Jan 01 00:00:28 1970 +0000
2702 | | | | date: Thu Jan 01 00:00:28 1970 +0000
2703 | | | | summary: (28) merge zero known
2703 | | | | summary: (28) merge zero known
2704 | | | |
2704 | | | |
2705 o | | | changeset: 26:7f25b6c2f0b9
2705 o | | | changeset: 26:7f25b6c2f0b9
2706 |\ \ \ \ parent: 18:1aa84d96232a
2706 |\ \ \ \ parent: 18:1aa84d96232a
2707 | | | | | parent: 25:91da8ed57247
2707 | | | | | parent: 25:91da8ed57247
2708 | | | | | user: test
2708 | | | | | user: test
2709 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
2709 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
2710 | | | | | summary: (26) merge one known; far right
2710 | | | | | summary: (26) merge one known; far right
2711 | | | | |
2711 | | | | |
2712 | o-----+ changeset: 25:91da8ed57247
2712 | o-----+ changeset: 25:91da8ed57247
2713 | | | | | parent: 21:d42a756af44d
2713 | | | | | parent: 21:d42a756af44d
2714 | | | | | parent: 24:a9c19a3d96b7
2714 | | | | | parent: 24:a9c19a3d96b7
2715 | | | | | user: test
2715 | | | | | user: test
2716 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
2716 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
2717 | | | | | summary: (25) merge one known; far left
2717 | | | | | summary: (25) merge one known; far left
2718 | | | | |
2718 | | | | |
2719 | o | | | changeset: 24:a9c19a3d96b7
2719 | o | | | changeset: 24:a9c19a3d96b7
2720 | |\ \ \ \ parent: 0:e6eb3150255d
2720 | |\ \ \ \ parent: 0:e6eb3150255d
2721 | | | | | | parent: 23:a01cddf0766d
2721 | | | | | | parent: 23:a01cddf0766d
2722 | | | | | | user: test
2722 | | | | | | user: test
2723 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
2723 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
2724 | | | | | | summary: (24) merge one known; immediate right
2724 | | | | | | summary: (24) merge one known; immediate right
2725 | | | | | |
2725 | | | | | |
2726 | o---+ | | changeset: 23:a01cddf0766d
2726 | o---+ | | changeset: 23:a01cddf0766d
2727 | | | | | | parent: 1:6db2ef61d156
2727 | | | | | | parent: 1:6db2ef61d156
2728 | | | | | | parent: 22:e0d9cccacb5d
2728 | | | | | | parent: 22:e0d9cccacb5d
2729 | | | | | | user: test
2729 | | | | | | user: test
2730 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
2730 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
2731 | | | | | | summary: (23) merge one known; immediate left
2731 | | | | | | summary: (23) merge one known; immediate left
2732 | | | | | |
2732 | | | | | |
2733 | o-------+ changeset: 22:e0d9cccacb5d
2733 | o-------+ changeset: 22:e0d9cccacb5d
2734 | | | | | | parent: 18:1aa84d96232a
2734 | | | | | | parent: 18:1aa84d96232a
2735 |/ / / / / parent: 21:d42a756af44d
2735 |/ / / / / parent: 21:d42a756af44d
2736 | | | | | user: test
2736 | | | | | user: test
2737 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
2737 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
2738 | | | | | summary: (22) merge two known; one far left, one far right
2738 | | | | | summary: (22) merge two known; one far left, one far right
2739 | | | | |
2739 | | | | |
2740 | | | | o changeset: 21:d42a756af44d
2740 | | | | o changeset: 21:d42a756af44d
2741 | | | | |\ parent: 19:31ddc2c1573b
2741 | | | | |\ parent: 19:31ddc2c1573b
2742 | | | | | | parent: 20:d30ed6450e32
2742 | | | | | | parent: 20:d30ed6450e32
2743 | | | | | | user: test
2743 | | | | | | user: test
2744 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
2744 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
2745 | | | | | | summary: (21) expand
2745 | | | | | | summary: (21) expand
2746 | | | | | |
2746 | | | | | |
2747 +-+-------o changeset: 20:d30ed6450e32
2747 +-+-------o changeset: 20:d30ed6450e32
2748 | | | | | parent: 0:e6eb3150255d
2748 | | | | | parent: 0:e6eb3150255d
2749 | | | | | parent: 18:1aa84d96232a
2749 | | | | | parent: 18:1aa84d96232a
2750 | | | | | user: test
2750 | | | | | user: test
2751 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
2751 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
2752 | | | | | summary: (20) merge two known; two far right
2752 | | | | | summary: (20) merge two known; two far right
2753 | | | | |
2753 | | | | |
2754 | | | | o changeset: 19:31ddc2c1573b
2754 | | | | o changeset: 19:31ddc2c1573b
2755 | | | | |\ parent: 15:1dda3f72782d
2755 | | | | |\ parent: 15:1dda3f72782d
2756 | | | | | | parent: 17:44765d7c06e0
2756 | | | | | | parent: 17:44765d7c06e0
2757 | | | | | | user: test
2757 | | | | | | user: test
2758 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
2758 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
2759 | | | | | | summary: (19) expand
2759 | | | | | | summary: (19) expand
2760 | | | | | |
2760 | | | | | |
2761 o---+---+ | changeset: 18:1aa84d96232a
2761 o---+---+ | changeset: 18:1aa84d96232a
2762 | | | | | parent: 1:6db2ef61d156
2762 | | | | | parent: 1:6db2ef61d156
2763 / / / / / parent: 15:1dda3f72782d
2763 / / / / / parent: 15:1dda3f72782d
2764 | | | | | user: test
2764 | | | | | user: test
2765 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
2765 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
2766 | | | | | summary: (18) merge two known; two far left
2766 | | | | | summary: (18) merge two known; two far left
2767 | | | | |
2767 | | | | |
2768 | | | | o changeset: 17:44765d7c06e0
2768 | | | | o changeset: 17:44765d7c06e0
2769 | | | | |\ parent: 12:86b91144a6e9
2769 | | | | |\ parent: 12:86b91144a6e9
2770 | | | | | | parent: 16:3677d192927d
2770 | | | | | | parent: 16:3677d192927d
2771 | | | | | | user: test
2771 | | | | | | user: test
2772 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
2772 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
2773 | | | | | | summary: (17) expand
2773 | | | | | | summary: (17) expand
2774 | | | | | |
2774 | | | | | |
2775 +-+-------o changeset: 16:3677d192927d
2775 +-+-------o changeset: 16:3677d192927d
2776 | | | | | parent: 0:e6eb3150255d
2776 | | | | | parent: 0:e6eb3150255d
2777 | | | | | parent: 1:6db2ef61d156
2777 | | | | | parent: 1:6db2ef61d156
2778 | | | | | user: test
2778 | | | | | user: test
2779 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
2779 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
2780 | | | | | summary: (16) merge two known; one immediate right, one near right
2780 | | | | | summary: (16) merge two known; one immediate right, one near right
2781 | | | | |
2781 | | | | |
2782 | | | o | changeset: 15:1dda3f72782d
2782 | | | o | changeset: 15:1dda3f72782d
2783 | | | |\ \ parent: 13:22d8966a97e3
2783 | | | |\ \ parent: 13:22d8966a97e3
2784 | | | | | | parent: 14:8eac370358ef
2784 | | | | | | parent: 14:8eac370358ef
2785 | | | | | | user: test
2785 | | | | | | user: test
2786 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
2786 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
2787 | | | | | | summary: (15) expand
2787 | | | | | | summary: (15) expand
2788 | | | | | |
2788 | | | | | |
2789 +-------o | changeset: 14:8eac370358ef
2789 +-------o | changeset: 14:8eac370358ef
2790 | | | | |/ parent: 0:e6eb3150255d
2790 | | | | |/ parent: 0:e6eb3150255d
2791 | | | | | parent: 12:86b91144a6e9
2791 | | | | | parent: 12:86b91144a6e9
2792 | | | | | user: test
2792 | | | | | user: test
2793 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
2793 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
2794 | | | | | summary: (14) merge two known; one immediate right, one far right
2794 | | | | | summary: (14) merge two known; one immediate right, one far right
2795 | | | | |
2795 | | | | |
2796 | | | o | changeset: 13:22d8966a97e3
2796 | | | o | changeset: 13:22d8966a97e3
2797 | | | |\ \ parent: 9:7010c0af0a35
2797 | | | |\ \ parent: 9:7010c0af0a35
2798 | | | | | | parent: 11:832d76e6bdf2
2798 | | | | | | parent: 11:832d76e6bdf2
2799 | | | | | | user: test
2799 | | | | | | user: test
2800 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
2800 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
2801 | | | | | | summary: (13) expand
2801 | | | | | | summary: (13) expand
2802 | | | | | |
2802 | | | | | |
2803 | +---+---o changeset: 12:86b91144a6e9
2803 | +---+---o changeset: 12:86b91144a6e9
2804 | | | | | parent: 1:6db2ef61d156
2804 | | | | | parent: 1:6db2ef61d156
2805 | | | | | parent: 9:7010c0af0a35
2805 | | | | | parent: 9:7010c0af0a35
2806 | | | | | user: test
2806 | | | | | user: test
2807 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
2807 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
2808 | | | | | summary: (12) merge two known; one immediate right, one far left
2808 | | | | | summary: (12) merge two known; one immediate right, one far left
2809 | | | | |
2809 | | | | |
2810 | | | | o changeset: 11:832d76e6bdf2
2810 | | | | o changeset: 11:832d76e6bdf2
2811 | | | | |\ parent: 6:b105a072e251
2811 | | | | |\ parent: 6:b105a072e251
2812 | | | | | | parent: 10:74c64d036d72
2812 | | | | | | parent: 10:74c64d036d72
2813 | | | | | | user: test
2813 | | | | | | user: test
2814 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
2814 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
2815 | | | | | | summary: (11) expand
2815 | | | | | | summary: (11) expand
2816 | | | | | |
2816 | | | | | |
2817 +---------o changeset: 10:74c64d036d72
2817 +---------o changeset: 10:74c64d036d72
2818 | | | | |/ parent: 0:e6eb3150255d
2818 | | | | |/ parent: 0:e6eb3150255d
2819 | | | | | parent: 6:b105a072e251
2819 | | | | | parent: 6:b105a072e251
2820 | | | | | user: test
2820 | | | | | user: test
2821 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
2821 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
2822 | | | | | summary: (10) merge two known; one immediate left, one near right
2822 | | | | | summary: (10) merge two known; one immediate left, one near right
2823 | | | | |
2823 | | | | |
2824 | | | o | changeset: 9:7010c0af0a35
2824 | | | o | changeset: 9:7010c0af0a35
2825 | | | |\ \ parent: 7:b632bb1b1224
2825 | | | |\ \ parent: 7:b632bb1b1224
2826 | | | | | | parent: 8:7a0b11f71937
2826 | | | | | | parent: 8:7a0b11f71937
2827 | | | | | | user: test
2827 | | | | | | user: test
2828 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
2828 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
2829 | | | | | | summary: (9) expand
2829 | | | | | | summary: (9) expand
2830 | | | | | |
2830 | | | | | |
2831 +-------o | changeset: 8:7a0b11f71937
2831 +-------o | changeset: 8:7a0b11f71937
2832 | | | |/ / parent: 0:e6eb3150255d
2832 | | | |/ / parent: 0:e6eb3150255d
2833 | | | | | parent: 7:b632bb1b1224
2833 | | | | | parent: 7:b632bb1b1224
2834 | | | | | user: test
2834 | | | | | user: test
2835 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
2835 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
2836 | | | | | summary: (8) merge two known; one immediate left, one far right
2836 | | | | | summary: (8) merge two known; one immediate left, one far right
2837 | | | | |
2837 | | | | |
2838 | | | o | changeset: 7:b632bb1b1224
2838 | | | o | changeset: 7:b632bb1b1224
2839 | | | |\ \ parent: 2:3d9a33b8d1e1
2839 | | | |\ \ parent: 2:3d9a33b8d1e1
2840 | | | | | | parent: 5:4409d547b708
2840 | | | | | | parent: 5:4409d547b708
2841 | | | | | | user: test
2841 | | | | | | user: test
2842 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
2842 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
2843 | | | | | | summary: (7) expand
2843 | | | | | | summary: (7) expand
2844 | | | | | |
2844 | | | | | |
2845 | | | +---o changeset: 6:b105a072e251
2845 | | | +---o changeset: 6:b105a072e251
2846 | | | | |/ parent: 2:3d9a33b8d1e1
2846 | | | | |/ parent: 2:3d9a33b8d1e1
2847 | | | | | parent: 5:4409d547b708
2847 | | | | | parent: 5:4409d547b708
2848 | | | | | user: test
2848 | | | | | user: test
2849 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
2849 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
2850 | | | | | summary: (6) merge two known; one immediate left, one far left
2850 | | | | | summary: (6) merge two known; one immediate left, one far left
2851 | | | | |
2851 | | | | |
2852 | | | o | changeset: 5:4409d547b708
2852 | | | o | changeset: 5:4409d547b708
2853 | | | |\ \ parent: 3:27eef8ed80b4
2853 | | | |\ \ parent: 3:27eef8ed80b4
2854 | | | | | | parent: 4:26a8bac39d9f
2854 | | | | | | parent: 4:26a8bac39d9f
2855 | | | | | | user: test
2855 | | | | | | user: test
2856 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
2856 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
2857 | | | | | | summary: (5) expand
2857 | | | | | | summary: (5) expand
2858 | | | | | |
2858 | | | | | |
2859 | +---o | | changeset: 4:26a8bac39d9f
2859 | +---o | | changeset: 4:26a8bac39d9f
2860 | | | |/ / parent: 1:6db2ef61d156
2860 | | | |/ / parent: 1:6db2ef61d156
2861 | | | | | parent: 3:27eef8ed80b4
2861 | | | | | parent: 3:27eef8ed80b4
2862 | | | | | user: test
2862 | | | | | user: test
2863 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
2863 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
2864 | | | | | summary: (4) merge two known; one immediate left, one immediate right
2864 | | | | | summary: (4) merge two known; one immediate left, one immediate right
2865 | | | | |
2865 | | | | |
2866
2866
2867 .. unless HGPLAINEXCEPT=graph is set:
2867 .. unless HGPLAINEXCEPT=graph is set:
2868
2868
2869 $ HGPLAIN=1 HGPLAINEXCEPT=graph hg log -G -r 'file("a")' -m
2869 $ HGPLAIN=1 HGPLAINEXCEPT=graph hg log -G -r 'file("a")' -m
2870 @ changeset: 36:08a19a744424
2870 @ changeset: 36:08a19a744424
2871 : branch: branch
2871 : branch: branch
2872 : tag: tip
2872 : tag: tip
2873 : parent: 35:9159c3644c5e
2873 : parent: 35:9159c3644c5e
2874 : parent: 35:9159c3644c5e
2874 : parent: 35:9159c3644c5e
2875 : user: test
2875 : user: test
2876 : date: Thu Jan 01 00:00:36 1970 +0000
2876 : date: Thu Jan 01 00:00:36 1970 +0000
2877 : summary: (36) buggy merge: identical parents
2877 : summary: (36) buggy merge: identical parents
2878 :
2878 :
2879 o changeset: 32:d06dffa21a31
2879 o changeset: 32:d06dffa21a31
2880 |\ parent: 27:886ed638191b
2880 |\ parent: 27:886ed638191b
2881 | : parent: 31:621d83e11f67
2881 | : parent: 31:621d83e11f67
2882 | : user: test
2882 | : user: test
2883 | : date: Thu Jan 01 00:00:32 1970 +0000
2883 | : date: Thu Jan 01 00:00:32 1970 +0000
2884 | : summary: (32) expand
2884 | : summary: (32) expand
2885 | :
2885 | :
2886 o : changeset: 31:621d83e11f67
2886 o : changeset: 31:621d83e11f67
2887 |\: parent: 21:d42a756af44d
2887 |\: parent: 21:d42a756af44d
2888 | : parent: 30:6e11cd4b648f
2888 | : parent: 30:6e11cd4b648f
2889 | : user: test
2889 | : user: test
2890 | : date: Thu Jan 01 00:00:31 1970 +0000
2890 | : date: Thu Jan 01 00:00:31 1970 +0000
2891 | : summary: (31) expand
2891 | : summary: (31) expand
2892 | :
2892 | :
2893 o : changeset: 30:6e11cd4b648f
2893 o : changeset: 30:6e11cd4b648f
2894 |\ \ parent: 28:44ecd0b9ae99
2894 |\ \ parent: 28:44ecd0b9ae99
2895 | ~ : parent: 29:cd9bb2be7593
2895 | ~ : parent: 29:cd9bb2be7593
2896 | : user: test
2896 | : user: test
2897 | : date: Thu Jan 01 00:00:30 1970 +0000
2897 | : date: Thu Jan 01 00:00:30 1970 +0000
2898 | : summary: (30) expand
2898 | : summary: (30) expand
2899 | /
2899 | /
2900 o : changeset: 28:44ecd0b9ae99
2900 o : changeset: 28:44ecd0b9ae99
2901 |\ \ parent: 1:6db2ef61d156
2901 |\ \ parent: 1:6db2ef61d156
2902 | ~ : parent: 26:7f25b6c2f0b9
2902 | ~ : parent: 26:7f25b6c2f0b9
2903 | : user: test
2903 | : user: test
2904 | : date: Thu Jan 01 00:00:28 1970 +0000
2904 | : date: Thu Jan 01 00:00:28 1970 +0000
2905 | : summary: (28) merge zero known
2905 | : summary: (28) merge zero known
2906 | /
2906 | /
2907 o : changeset: 26:7f25b6c2f0b9
2907 o : changeset: 26:7f25b6c2f0b9
2908 |\ \ parent: 18:1aa84d96232a
2908 |\ \ parent: 18:1aa84d96232a
2909 | | : parent: 25:91da8ed57247
2909 | | : parent: 25:91da8ed57247
2910 | | : user: test
2910 | | : user: test
2911 | | : date: Thu Jan 01 00:00:26 1970 +0000
2911 | | : date: Thu Jan 01 00:00:26 1970 +0000
2912 | | : summary: (26) merge one known; far right
2912 | | : summary: (26) merge one known; far right
2913 | | :
2913 | | :
2914 | o : changeset: 25:91da8ed57247
2914 | o : changeset: 25:91da8ed57247
2915 | |\: parent: 21:d42a756af44d
2915 | |\: parent: 21:d42a756af44d
2916 | | : parent: 24:a9c19a3d96b7
2916 | | : parent: 24:a9c19a3d96b7
2917 | | : user: test
2917 | | : user: test
2918 | | : date: Thu Jan 01 00:00:25 1970 +0000
2918 | | : date: Thu Jan 01 00:00:25 1970 +0000
2919 | | : summary: (25) merge one known; far left
2919 | | : summary: (25) merge one known; far left
2920 | | :
2920 | | :
2921 | o : changeset: 24:a9c19a3d96b7
2921 | o : changeset: 24:a9c19a3d96b7
2922 | |\ \ parent: 0:e6eb3150255d
2922 | |\ \ parent: 0:e6eb3150255d
2923 | | ~ : parent: 23:a01cddf0766d
2923 | | ~ : parent: 23:a01cddf0766d
2924 | | : user: test
2924 | | : user: test
2925 | | : date: Thu Jan 01 00:00:24 1970 +0000
2925 | | : date: Thu Jan 01 00:00:24 1970 +0000
2926 | | : summary: (24) merge one known; immediate right
2926 | | : summary: (24) merge one known; immediate right
2927 | | /
2927 | | /
2928 | o : changeset: 23:a01cddf0766d
2928 | o : changeset: 23:a01cddf0766d
2929 | |\ \ parent: 1:6db2ef61d156
2929 | |\ \ parent: 1:6db2ef61d156
2930 | | ~ : parent: 22:e0d9cccacb5d
2930 | | ~ : parent: 22:e0d9cccacb5d
2931 | | : user: test
2931 | | : user: test
2932 | | : date: Thu Jan 01 00:00:23 1970 +0000
2932 | | : date: Thu Jan 01 00:00:23 1970 +0000
2933 | | : summary: (23) merge one known; immediate left
2933 | | : summary: (23) merge one known; immediate left
2934 | | /
2934 | | /
2935 | o : changeset: 22:e0d9cccacb5d
2935 | o : changeset: 22:e0d9cccacb5d
2936 |/:/ parent: 18:1aa84d96232a
2936 |/:/ parent: 18:1aa84d96232a
2937 | : parent: 21:d42a756af44d
2937 | : parent: 21:d42a756af44d
2938 | : user: test
2938 | : user: test
2939 | : date: Thu Jan 01 00:00:22 1970 +0000
2939 | : date: Thu Jan 01 00:00:22 1970 +0000
2940 | : summary: (22) merge two known; one far left, one far right
2940 | : summary: (22) merge two known; one far left, one far right
2941 | :
2941 | :
2942 | o changeset: 21:d42a756af44d
2942 | o changeset: 21:d42a756af44d
2943 | |\ parent: 19:31ddc2c1573b
2943 | |\ parent: 19:31ddc2c1573b
2944 | | | parent: 20:d30ed6450e32
2944 | | | parent: 20:d30ed6450e32
2945 | | | user: test
2945 | | | user: test
2946 | | | date: Thu Jan 01 00:00:21 1970 +0000
2946 | | | date: Thu Jan 01 00:00:21 1970 +0000
2947 | | | summary: (21) expand
2947 | | | summary: (21) expand
2948 | | |
2948 | | |
2949 +---o changeset: 20:d30ed6450e32
2949 +---o changeset: 20:d30ed6450e32
2950 | | | parent: 0:e6eb3150255d
2950 | | | parent: 0:e6eb3150255d
2951 | | ~ parent: 18:1aa84d96232a
2951 | | ~ parent: 18:1aa84d96232a
2952 | | user: test
2952 | | user: test
2953 | | date: Thu Jan 01 00:00:20 1970 +0000
2953 | | date: Thu Jan 01 00:00:20 1970 +0000
2954 | | summary: (20) merge two known; two far right
2954 | | summary: (20) merge two known; two far right
2955 | |
2955 | |
2956 | o changeset: 19:31ddc2c1573b
2956 | o changeset: 19:31ddc2c1573b
2957 | |\ parent: 15:1dda3f72782d
2957 | |\ parent: 15:1dda3f72782d
2958 | | | parent: 17:44765d7c06e0
2958 | | | parent: 17:44765d7c06e0
2959 | | | user: test
2959 | | | user: test
2960 | | | date: Thu Jan 01 00:00:19 1970 +0000
2960 | | | date: Thu Jan 01 00:00:19 1970 +0000
2961 | | | summary: (19) expand
2961 | | | summary: (19) expand
2962 | | |
2962 | | |
2963 o | | changeset: 18:1aa84d96232a
2963 o | | changeset: 18:1aa84d96232a
2964 |\| | parent: 1:6db2ef61d156
2964 |\| | parent: 1:6db2ef61d156
2965 ~ | | parent: 15:1dda3f72782d
2965 ~ | | parent: 15:1dda3f72782d
2966 | | user: test
2966 | | user: test
2967 | | date: Thu Jan 01 00:00:18 1970 +0000
2967 | | date: Thu Jan 01 00:00:18 1970 +0000
2968 | | summary: (18) merge two known; two far left
2968 | | summary: (18) merge two known; two far left
2969 / /
2969 / /
2970 | o changeset: 17:44765d7c06e0
2970 | o changeset: 17:44765d7c06e0
2971 | |\ parent: 12:86b91144a6e9
2971 | |\ parent: 12:86b91144a6e9
2972 | | | parent: 16:3677d192927d
2972 | | | parent: 16:3677d192927d
2973 | | | user: test
2973 | | | user: test
2974 | | | date: Thu Jan 01 00:00:17 1970 +0000
2974 | | | date: Thu Jan 01 00:00:17 1970 +0000
2975 | | | summary: (17) expand
2975 | | | summary: (17) expand
2976 | | |
2976 | | |
2977 | | o changeset: 16:3677d192927d
2977 | | o changeset: 16:3677d192927d
2978 | | |\ parent: 0:e6eb3150255d
2978 | | |\ parent: 0:e6eb3150255d
2979 | | ~ ~ parent: 1:6db2ef61d156
2979 | | ~ ~ parent: 1:6db2ef61d156
2980 | | user: test
2980 | | user: test
2981 | | date: Thu Jan 01 00:00:16 1970 +0000
2981 | | date: Thu Jan 01 00:00:16 1970 +0000
2982 | | summary: (16) merge two known; one immediate right, one near right
2982 | | summary: (16) merge two known; one immediate right, one near right
2983 | |
2983 | |
2984 o | changeset: 15:1dda3f72782d
2984 o | changeset: 15:1dda3f72782d
2985 |\ \ parent: 13:22d8966a97e3
2985 |\ \ parent: 13:22d8966a97e3
2986 | | | parent: 14:8eac370358ef
2986 | | | parent: 14:8eac370358ef
2987 | | | user: test
2987 | | | user: test
2988 | | | date: Thu Jan 01 00:00:15 1970 +0000
2988 | | | date: Thu Jan 01 00:00:15 1970 +0000
2989 | | | summary: (15) expand
2989 | | | summary: (15) expand
2990 | | |
2990 | | |
2991 | o | changeset: 14:8eac370358ef
2991 | o | changeset: 14:8eac370358ef
2992 | |\| parent: 0:e6eb3150255d
2992 | |\| parent: 0:e6eb3150255d
2993 | ~ | parent: 12:86b91144a6e9
2993 | ~ | parent: 12:86b91144a6e9
2994 | | user: test
2994 | | user: test
2995 | | date: Thu Jan 01 00:00:14 1970 +0000
2995 | | date: Thu Jan 01 00:00:14 1970 +0000
2996 | | summary: (14) merge two known; one immediate right, one far right
2996 | | summary: (14) merge two known; one immediate right, one far right
2997 | /
2997 | /
2998 o | changeset: 13:22d8966a97e3
2998 o | changeset: 13:22d8966a97e3
2999 |\ \ parent: 9:7010c0af0a35
2999 |\ \ parent: 9:7010c0af0a35
3000 | | | parent: 11:832d76e6bdf2
3000 | | | parent: 11:832d76e6bdf2
3001 | | | user: test
3001 | | | user: test
3002 | | | date: Thu Jan 01 00:00:13 1970 +0000
3002 | | | date: Thu Jan 01 00:00:13 1970 +0000
3003 | | | summary: (13) expand
3003 | | | summary: (13) expand
3004 | | |
3004 | | |
3005 +---o changeset: 12:86b91144a6e9
3005 +---o changeset: 12:86b91144a6e9
3006 | | | parent: 1:6db2ef61d156
3006 | | | parent: 1:6db2ef61d156
3007 | | ~ parent: 9:7010c0af0a35
3007 | | ~ parent: 9:7010c0af0a35
3008 | | user: test
3008 | | user: test
3009 | | date: Thu Jan 01 00:00:12 1970 +0000
3009 | | date: Thu Jan 01 00:00:12 1970 +0000
3010 | | summary: (12) merge two known; one immediate right, one far left
3010 | | summary: (12) merge two known; one immediate right, one far left
3011 | |
3011 | |
3012 | o changeset: 11:832d76e6bdf2
3012 | o changeset: 11:832d76e6bdf2
3013 | |\ parent: 6:b105a072e251
3013 | |\ parent: 6:b105a072e251
3014 | | | parent: 10:74c64d036d72
3014 | | | parent: 10:74c64d036d72
3015 | | | user: test
3015 | | | user: test
3016 | | | date: Thu Jan 01 00:00:11 1970 +0000
3016 | | | date: Thu Jan 01 00:00:11 1970 +0000
3017 | | | summary: (11) expand
3017 | | | summary: (11) expand
3018 | | |
3018 | | |
3019 | | o changeset: 10:74c64d036d72
3019 | | o changeset: 10:74c64d036d72
3020 | |/| parent: 0:e6eb3150255d
3020 | |/| parent: 0:e6eb3150255d
3021 | | ~ parent: 6:b105a072e251
3021 | | ~ parent: 6:b105a072e251
3022 | | user: test
3022 | | user: test
3023 | | date: Thu Jan 01 00:00:10 1970 +0000
3023 | | date: Thu Jan 01 00:00:10 1970 +0000
3024 | | summary: (10) merge two known; one immediate left, one near right
3024 | | summary: (10) merge two known; one immediate left, one near right
3025 | |
3025 | |
3026 o | changeset: 9:7010c0af0a35
3026 o | changeset: 9:7010c0af0a35
3027 |\ \ parent: 7:b632bb1b1224
3027 |\ \ parent: 7:b632bb1b1224
3028 | | | parent: 8:7a0b11f71937
3028 | | | parent: 8:7a0b11f71937
3029 | | | user: test
3029 | | | user: test
3030 | | | date: Thu Jan 01 00:00:09 1970 +0000
3030 | | | date: Thu Jan 01 00:00:09 1970 +0000
3031 | | | summary: (9) expand
3031 | | | summary: (9) expand
3032 | | |
3032 | | |
3033 | o | changeset: 8:7a0b11f71937
3033 | o | changeset: 8:7a0b11f71937
3034 |/| | parent: 0:e6eb3150255d
3034 |/| | parent: 0:e6eb3150255d
3035 | ~ | parent: 7:b632bb1b1224
3035 | ~ | parent: 7:b632bb1b1224
3036 | | user: test
3036 | | user: test
3037 | | date: Thu Jan 01 00:00:08 1970 +0000
3037 | | date: Thu Jan 01 00:00:08 1970 +0000
3038 | | summary: (8) merge two known; one immediate left, one far right
3038 | | summary: (8) merge two known; one immediate left, one far right
3039 | /
3039 | /
3040 o | changeset: 7:b632bb1b1224
3040 o | changeset: 7:b632bb1b1224
3041 |\ \ parent: 2:3d9a33b8d1e1
3041 |\ \ parent: 2:3d9a33b8d1e1
3042 | ~ | parent: 5:4409d547b708
3042 | ~ | parent: 5:4409d547b708
3043 | | user: test
3043 | | user: test
3044 | | date: Thu Jan 01 00:00:07 1970 +0000
3044 | | date: Thu Jan 01 00:00:07 1970 +0000
3045 | | summary: (7) expand
3045 | | summary: (7) expand
3046 | /
3046 | /
3047 | o changeset: 6:b105a072e251
3047 | o changeset: 6:b105a072e251
3048 |/| parent: 2:3d9a33b8d1e1
3048 |/| parent: 2:3d9a33b8d1e1
3049 | ~ parent: 5:4409d547b708
3049 | ~ parent: 5:4409d547b708
3050 | user: test
3050 | user: test
3051 | date: Thu Jan 01 00:00:06 1970 +0000
3051 | date: Thu Jan 01 00:00:06 1970 +0000
3052 | summary: (6) merge two known; one immediate left, one far left
3052 | summary: (6) merge two known; one immediate left, one far left
3053 |
3053 |
3054 o changeset: 5:4409d547b708
3054 o changeset: 5:4409d547b708
3055 |\ parent: 3:27eef8ed80b4
3055 |\ parent: 3:27eef8ed80b4
3056 | ~ parent: 4:26a8bac39d9f
3056 | ~ parent: 4:26a8bac39d9f
3057 | user: test
3057 | user: test
3058 | date: Thu Jan 01 00:00:05 1970 +0000
3058 | date: Thu Jan 01 00:00:05 1970 +0000
3059 | summary: (5) expand
3059 | summary: (5) expand
3060 |
3060 |
3061 o changeset: 4:26a8bac39d9f
3061 o changeset: 4:26a8bac39d9f
3062 |\ parent: 1:6db2ef61d156
3062 |\ parent: 1:6db2ef61d156
3063 ~ ~ parent: 3:27eef8ed80b4
3063 ~ ~ parent: 3:27eef8ed80b4
3064 user: test
3064 user: test
3065 date: Thu Jan 01 00:00:04 1970 +0000
3065 date: Thu Jan 01 00:00:04 1970 +0000
3066 summary: (4) merge two known; one immediate left, one immediate right
3066 summary: (4) merge two known; one immediate left, one immediate right
3067
3067
3068 Draw only part of a grandparent line differently with "<N><char>"; only the
3068 Draw only part of a grandparent line differently with "<N><char>"; only the
3069 last N lines (for positive N) or everything but the first N lines (for
3069 last N lines (for positive N) or everything but the first N lines (for
3070 negative N) along the current node use the style, the rest of the edge uses
3070 negative N) along the current node use the style, the rest of the edge uses
3071 the parent edge styling.
3071 the parent edge styling.
3072
3072
3073 Last 3 lines:
3073 Last 3 lines:
3074
3074
3075 $ cat << EOF >> $HGRCPATH
3075 $ cat << EOF >> $HGRCPATH
3076 > [experimental]
3076 > [experimental]
3077 > graphstyle.parent = !
3077 > graphstyle.parent = !
3078 > graphstyle.grandparent = 3.
3078 > graphstyle.grandparent = 3.
3079 > graphstyle.missing =
3079 > graphstyle.missing =
3080 > EOF
3080 > EOF
3081 $ hg log -G -r '36:18 & file("a")' -m
3081 $ hg log -G -r '36:18 & file("a")' -m
3082 @ changeset: 36:08a19a744424
3082 @ changeset: 36:08a19a744424
3083 ! branch: branch
3083 ! branch: branch
3084 ! tag: tip
3084 ! tag: tip
3085 ! parent: 35:9159c3644c5e
3085 ! parent: 35:9159c3644c5e
3086 ! parent: 35:9159c3644c5e
3086 ! parent: 35:9159c3644c5e
3087 ! user: test
3087 ! user: test
3088 . date: Thu Jan 01 00:00:36 1970 +0000
3088 . date: Thu Jan 01 00:00:36 1970 +0000
3089 . summary: (36) buggy merge: identical parents
3089 . summary: (36) buggy merge: identical parents
3090 .
3090 .
3091 o changeset: 32:d06dffa21a31
3091 o changeset: 32:d06dffa21a31
3092 !\ parent: 27:886ed638191b
3092 !\ parent: 27:886ed638191b
3093 ! ! parent: 31:621d83e11f67
3093 ! ! parent: 31:621d83e11f67
3094 ! ! user: test
3094 ! ! user: test
3095 ! . date: Thu Jan 01 00:00:32 1970 +0000
3095 ! . date: Thu Jan 01 00:00:32 1970 +0000
3096 ! . summary: (32) expand
3096 ! . summary: (32) expand
3097 ! .
3097 ! .
3098 o ! changeset: 31:621d83e11f67
3098 o ! changeset: 31:621d83e11f67
3099 !\! parent: 21:d42a756af44d
3099 !\! parent: 21:d42a756af44d
3100 ! ! parent: 30:6e11cd4b648f
3100 ! ! parent: 30:6e11cd4b648f
3101 ! ! user: test
3101 ! ! user: test
3102 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3102 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3103 ! ! summary: (31) expand
3103 ! ! summary: (31) expand
3104 ! !
3104 ! !
3105 o ! changeset: 30:6e11cd4b648f
3105 o ! changeset: 30:6e11cd4b648f
3106 !\ \ parent: 28:44ecd0b9ae99
3106 !\ \ parent: 28:44ecd0b9ae99
3107 ! ~ ! parent: 29:cd9bb2be7593
3107 ! ~ ! parent: 29:cd9bb2be7593
3108 ! ! user: test
3108 ! ! user: test
3109 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3109 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3110 ! ! summary: (30) expand
3110 ! ! summary: (30) expand
3111 ! /
3111 ! /
3112 o ! changeset: 28:44ecd0b9ae99
3112 o ! changeset: 28:44ecd0b9ae99
3113 !\ \ parent: 1:6db2ef61d156
3113 !\ \ parent: 1:6db2ef61d156
3114 ! ~ ! parent: 26:7f25b6c2f0b9
3114 ! ~ ! parent: 26:7f25b6c2f0b9
3115 ! ! user: test
3115 ! ! user: test
3116 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3116 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3117 ! ! summary: (28) merge zero known
3117 ! ! summary: (28) merge zero known
3118 ! /
3118 ! /
3119 o ! changeset: 26:7f25b6c2f0b9
3119 o ! changeset: 26:7f25b6c2f0b9
3120 !\ \ parent: 18:1aa84d96232a
3120 !\ \ parent: 18:1aa84d96232a
3121 ! ! ! parent: 25:91da8ed57247
3121 ! ! ! parent: 25:91da8ed57247
3122 ! ! ! user: test
3122 ! ! ! user: test
3123 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3123 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3124 ! ! ! summary: (26) merge one known; far right
3124 ! ! ! summary: (26) merge one known; far right
3125 ! ! !
3125 ! ! !
3126 ! o ! changeset: 25:91da8ed57247
3126 ! o ! changeset: 25:91da8ed57247
3127 ! !\! parent: 21:d42a756af44d
3127 ! !\! parent: 21:d42a756af44d
3128 ! ! ! parent: 24:a9c19a3d96b7
3128 ! ! ! parent: 24:a9c19a3d96b7
3129 ! ! ! user: test
3129 ! ! ! user: test
3130 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3130 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3131 ! ! ! summary: (25) merge one known; far left
3131 ! ! ! summary: (25) merge one known; far left
3132 ! ! !
3132 ! ! !
3133 ! o ! changeset: 24:a9c19a3d96b7
3133 ! o ! changeset: 24:a9c19a3d96b7
3134 ! !\ \ parent: 0:e6eb3150255d
3134 ! !\ \ parent: 0:e6eb3150255d
3135 ! ! ~ ! parent: 23:a01cddf0766d
3135 ! ! ~ ! parent: 23:a01cddf0766d
3136 ! ! ! user: test
3136 ! ! ! user: test
3137 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3137 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3138 ! ! ! summary: (24) merge one known; immediate right
3138 ! ! ! summary: (24) merge one known; immediate right
3139 ! ! /
3139 ! ! /
3140 ! o ! changeset: 23:a01cddf0766d
3140 ! o ! changeset: 23:a01cddf0766d
3141 ! !\ \ parent: 1:6db2ef61d156
3141 ! !\ \ parent: 1:6db2ef61d156
3142 ! ! ~ ! parent: 22:e0d9cccacb5d
3142 ! ! ~ ! parent: 22:e0d9cccacb5d
3143 ! ! ! user: test
3143 ! ! ! user: test
3144 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3144 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3145 ! ! ! summary: (23) merge one known; immediate left
3145 ! ! ! summary: (23) merge one known; immediate left
3146 ! ! /
3146 ! ! /
3147 ! o ! changeset: 22:e0d9cccacb5d
3147 ! o ! changeset: 22:e0d9cccacb5d
3148 !/!/ parent: 18:1aa84d96232a
3148 !/!/ parent: 18:1aa84d96232a
3149 ! ! parent: 21:d42a756af44d
3149 ! ! parent: 21:d42a756af44d
3150 ! ! user: test
3150 ! ! user: test
3151 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3151 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3152 ! ! summary: (22) merge two known; one far left, one far right
3152 ! ! summary: (22) merge two known; one far left, one far right
3153 ! !
3153 ! !
3154 ! o changeset: 21:d42a756af44d
3154 ! o changeset: 21:d42a756af44d
3155 ! !\ parent: 19:31ddc2c1573b
3155 ! !\ parent: 19:31ddc2c1573b
3156 ! ! ! parent: 20:d30ed6450e32
3156 ! ! ! parent: 20:d30ed6450e32
3157 ! ! ! user: test
3157 ! ! ! user: test
3158 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3158 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3159 ! ! ! summary: (21) expand
3159 ! ! ! summary: (21) expand
3160 ! ! !
3160 ! ! !
3161 +---o changeset: 20:d30ed6450e32
3161 +---o changeset: 20:d30ed6450e32
3162 ! ! | parent: 0:e6eb3150255d
3162 ! ! | parent: 0:e6eb3150255d
3163 ! ! ~ parent: 18:1aa84d96232a
3163 ! ! ~ parent: 18:1aa84d96232a
3164 ! ! user: test
3164 ! ! user: test
3165 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3165 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3166 ! ! summary: (20) merge two known; two far right
3166 ! ! summary: (20) merge two known; two far right
3167 ! !
3167 ! !
3168 ! o changeset: 19:31ddc2c1573b
3168 ! o changeset: 19:31ddc2c1573b
3169 ! |\ parent: 15:1dda3f72782d
3169 ! |\ parent: 15:1dda3f72782d
3170 ! ~ ~ parent: 17:44765d7c06e0
3170 ! ~ ~ parent: 17:44765d7c06e0
3171 ! user: test
3171 ! user: test
3172 ! date: Thu Jan 01 00:00:19 1970 +0000
3172 ! date: Thu Jan 01 00:00:19 1970 +0000
3173 ! summary: (19) expand
3173 ! summary: (19) expand
3174 !
3174 !
3175 o changeset: 18:1aa84d96232a
3175 o changeset: 18:1aa84d96232a
3176 |\ parent: 1:6db2ef61d156
3176 |\ parent: 1:6db2ef61d156
3177 ~ ~ parent: 15:1dda3f72782d
3177 ~ ~ parent: 15:1dda3f72782d
3178 user: test
3178 user: test
3179 date: Thu Jan 01 00:00:18 1970 +0000
3179 date: Thu Jan 01 00:00:18 1970 +0000
3180 summary: (18) merge two known; two far left
3180 summary: (18) merge two known; two far left
3181
3181
3182 All but the first 3 lines:
3182 All but the first 3 lines:
3183
3183
3184 $ cat << EOF >> $HGRCPATH
3184 $ cat << EOF >> $HGRCPATH
3185 > [experimental]
3185 > [experimental]
3186 > graphstyle.parent = !
3186 > graphstyle.parent = !
3187 > graphstyle.grandparent = -3.
3187 > graphstyle.grandparent = -3.
3188 > graphstyle.missing =
3188 > graphstyle.missing =
3189 > EOF
3189 > EOF
3190 $ hg log -G -r '36:18 & file("a")' -m
3190 $ hg log -G -r '36:18 & file("a")' -m
3191 @ changeset: 36:08a19a744424
3191 @ changeset: 36:08a19a744424
3192 ! branch: branch
3192 ! branch: branch
3193 ! tag: tip
3193 ! tag: tip
3194 . parent: 35:9159c3644c5e
3194 . parent: 35:9159c3644c5e
3195 . parent: 35:9159c3644c5e
3195 . parent: 35:9159c3644c5e
3196 . user: test
3196 . user: test
3197 . date: Thu Jan 01 00:00:36 1970 +0000
3197 . date: Thu Jan 01 00:00:36 1970 +0000
3198 . summary: (36) buggy merge: identical parents
3198 . summary: (36) buggy merge: identical parents
3199 .
3199 .
3200 o changeset: 32:d06dffa21a31
3200 o changeset: 32:d06dffa21a31
3201 !\ parent: 27:886ed638191b
3201 !\ parent: 27:886ed638191b
3202 ! ! parent: 31:621d83e11f67
3202 ! ! parent: 31:621d83e11f67
3203 ! . user: test
3203 ! . user: test
3204 ! . date: Thu Jan 01 00:00:32 1970 +0000
3204 ! . date: Thu Jan 01 00:00:32 1970 +0000
3205 ! . summary: (32) expand
3205 ! . summary: (32) expand
3206 ! .
3206 ! .
3207 o ! changeset: 31:621d83e11f67
3207 o ! changeset: 31:621d83e11f67
3208 !\! parent: 21:d42a756af44d
3208 !\! parent: 21:d42a756af44d
3209 ! ! parent: 30:6e11cd4b648f
3209 ! ! parent: 30:6e11cd4b648f
3210 ! ! user: test
3210 ! ! user: test
3211 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3211 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3212 ! ! summary: (31) expand
3212 ! ! summary: (31) expand
3213 ! !
3213 ! !
3214 o ! changeset: 30:6e11cd4b648f
3214 o ! changeset: 30:6e11cd4b648f
3215 !\ \ parent: 28:44ecd0b9ae99
3215 !\ \ parent: 28:44ecd0b9ae99
3216 ! ~ ! parent: 29:cd9bb2be7593
3216 ! ~ ! parent: 29:cd9bb2be7593
3217 ! ! user: test
3217 ! ! user: test
3218 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3218 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3219 ! ! summary: (30) expand
3219 ! ! summary: (30) expand
3220 ! /
3220 ! /
3221 o ! changeset: 28:44ecd0b9ae99
3221 o ! changeset: 28:44ecd0b9ae99
3222 !\ \ parent: 1:6db2ef61d156
3222 !\ \ parent: 1:6db2ef61d156
3223 ! ~ ! parent: 26:7f25b6c2f0b9
3223 ! ~ ! parent: 26:7f25b6c2f0b9
3224 ! ! user: test
3224 ! ! user: test
3225 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3225 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3226 ! ! summary: (28) merge zero known
3226 ! ! summary: (28) merge zero known
3227 ! /
3227 ! /
3228 o ! changeset: 26:7f25b6c2f0b9
3228 o ! changeset: 26:7f25b6c2f0b9
3229 !\ \ parent: 18:1aa84d96232a
3229 !\ \ parent: 18:1aa84d96232a
3230 ! ! ! parent: 25:91da8ed57247
3230 ! ! ! parent: 25:91da8ed57247
3231 ! ! ! user: test
3231 ! ! ! user: test
3232 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3232 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3233 ! ! ! summary: (26) merge one known; far right
3233 ! ! ! summary: (26) merge one known; far right
3234 ! ! !
3234 ! ! !
3235 ! o ! changeset: 25:91da8ed57247
3235 ! o ! changeset: 25:91da8ed57247
3236 ! !\! parent: 21:d42a756af44d
3236 ! !\! parent: 21:d42a756af44d
3237 ! ! ! parent: 24:a9c19a3d96b7
3237 ! ! ! parent: 24:a9c19a3d96b7
3238 ! ! ! user: test
3238 ! ! ! user: test
3239 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3239 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3240 ! ! ! summary: (25) merge one known; far left
3240 ! ! ! summary: (25) merge one known; far left
3241 ! ! !
3241 ! ! !
3242 ! o ! changeset: 24:a9c19a3d96b7
3242 ! o ! changeset: 24:a9c19a3d96b7
3243 ! !\ \ parent: 0:e6eb3150255d
3243 ! !\ \ parent: 0:e6eb3150255d
3244 ! ! ~ ! parent: 23:a01cddf0766d
3244 ! ! ~ ! parent: 23:a01cddf0766d
3245 ! ! ! user: test
3245 ! ! ! user: test
3246 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3246 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3247 ! ! ! summary: (24) merge one known; immediate right
3247 ! ! ! summary: (24) merge one known; immediate right
3248 ! ! /
3248 ! ! /
3249 ! o ! changeset: 23:a01cddf0766d
3249 ! o ! changeset: 23:a01cddf0766d
3250 ! !\ \ parent: 1:6db2ef61d156
3250 ! !\ \ parent: 1:6db2ef61d156
3251 ! ! ~ ! parent: 22:e0d9cccacb5d
3251 ! ! ~ ! parent: 22:e0d9cccacb5d
3252 ! ! ! user: test
3252 ! ! ! user: test
3253 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3253 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3254 ! ! ! summary: (23) merge one known; immediate left
3254 ! ! ! summary: (23) merge one known; immediate left
3255 ! ! /
3255 ! ! /
3256 ! o ! changeset: 22:e0d9cccacb5d
3256 ! o ! changeset: 22:e0d9cccacb5d
3257 !/!/ parent: 18:1aa84d96232a
3257 !/!/ parent: 18:1aa84d96232a
3258 ! ! parent: 21:d42a756af44d
3258 ! ! parent: 21:d42a756af44d
3259 ! ! user: test
3259 ! ! user: test
3260 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3260 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3261 ! ! summary: (22) merge two known; one far left, one far right
3261 ! ! summary: (22) merge two known; one far left, one far right
3262 ! !
3262 ! !
3263 ! o changeset: 21:d42a756af44d
3263 ! o changeset: 21:d42a756af44d
3264 ! !\ parent: 19:31ddc2c1573b
3264 ! !\ parent: 19:31ddc2c1573b
3265 ! ! ! parent: 20:d30ed6450e32
3265 ! ! ! parent: 20:d30ed6450e32
3266 ! ! ! user: test
3266 ! ! ! user: test
3267 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3267 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3268 ! ! ! summary: (21) expand
3268 ! ! ! summary: (21) expand
3269 ! ! !
3269 ! ! !
3270 +---o changeset: 20:d30ed6450e32
3270 +---o changeset: 20:d30ed6450e32
3271 ! ! | parent: 0:e6eb3150255d
3271 ! ! | parent: 0:e6eb3150255d
3272 ! ! ~ parent: 18:1aa84d96232a
3272 ! ! ~ parent: 18:1aa84d96232a
3273 ! ! user: test
3273 ! ! user: test
3274 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3274 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3275 ! ! summary: (20) merge two known; two far right
3275 ! ! summary: (20) merge two known; two far right
3276 ! !
3276 ! !
3277 ! o changeset: 19:31ddc2c1573b
3277 ! o changeset: 19:31ddc2c1573b
3278 ! |\ parent: 15:1dda3f72782d
3278 ! |\ parent: 15:1dda3f72782d
3279 ! ~ ~ parent: 17:44765d7c06e0
3279 ! ~ ~ parent: 17:44765d7c06e0
3280 ! user: test
3280 ! user: test
3281 ! date: Thu Jan 01 00:00:19 1970 +0000
3281 ! date: Thu Jan 01 00:00:19 1970 +0000
3282 ! summary: (19) expand
3282 ! summary: (19) expand
3283 !
3283 !
3284 o changeset: 18:1aa84d96232a
3284 o changeset: 18:1aa84d96232a
3285 |\ parent: 1:6db2ef61d156
3285 |\ parent: 1:6db2ef61d156
3286 ~ ~ parent: 15:1dda3f72782d
3286 ~ ~ parent: 15:1dda3f72782d
3287 user: test
3287 user: test
3288 date: Thu Jan 01 00:00:18 1970 +0000
3288 date: Thu Jan 01 00:00:18 1970 +0000
3289 summary: (18) merge two known; two far left
3289 summary: (18) merge two known; two far left
3290
3290
3291 $ cd ..
3291 $ cd ..
3292
3292
3293 Change graph shorten, test better with graphstyle.missing not none
3293 Change graph shorten, test better with graphstyle.missing not none
3294
3294
3295 $ cd repo
3295 $ cd repo
3296 $ cat << EOF >> $HGRCPATH
3296 $ cat << EOF >> $HGRCPATH
3297 > [experimental]
3297 > [experimental]
3298 > graphstyle.parent = |
3298 > graphstyle.parent = |
3299 > graphstyle.grandparent = :
3299 > graphstyle.grandparent = :
3300 > graphstyle.missing = '
3300 > graphstyle.missing = '
3301 > graphshorten = true
3301 > graphshorten = true
3302 > EOF
3302 > EOF
3303 $ hg log -G -r 'file("a")' -m -T '{rev} {desc}'
3303 $ hg log -G -r 'file("a")' -m -T '{rev} {desc}'
3304 @ 36 (36) buggy merge: identical parents
3304 @ 36 (36) buggy merge: identical parents
3305 o 32 (32) expand
3305 o 32 (32) expand
3306 |\
3306 |\
3307 o : 31 (31) expand
3307 o : 31 (31) expand
3308 |\:
3308 |\:
3309 o : 30 (30) expand
3309 o : 30 (30) expand
3310 |\ \
3310 |\ \
3311 o \ \ 28 (28) merge zero known
3311 o \ \ 28 (28) merge zero known
3312 |\ \ \
3312 |\ \ \
3313 o \ \ \ 26 (26) merge one known; far right
3313 o \ \ \ 26 (26) merge one known; far right
3314 |\ \ \ \
3314 |\ \ \ \
3315 | o-----+ 25 (25) merge one known; far left
3315 | o-----+ 25 (25) merge one known; far left
3316 | o ' ' : 24 (24) merge one known; immediate right
3316 | o ' ' : 24 (24) merge one known; immediate right
3317 | |\ \ \ \
3317 | |\ \ \ \
3318 | o---+ ' : 23 (23) merge one known; immediate left
3318 | o---+ ' : 23 (23) merge one known; immediate left
3319 | o-------+ 22 (22) merge two known; one far left, one far right
3319 | o-------+ 22 (22) merge two known; one far left, one far right
3320 |/ / / / /
3320 |/ / / / /
3321 | ' ' ' o 21 (21) expand
3321 | ' ' ' o 21 (21) expand
3322 | ' ' ' |\
3322 | ' ' ' |\
3323 +-+-------o 20 (20) merge two known; two far right
3323 +-+-------o 20 (20) merge two known; two far right
3324 | ' ' ' o 19 (19) expand
3324 | ' ' ' o 19 (19) expand
3325 | ' ' ' |\
3325 | ' ' ' |\
3326 o---+---+ | 18 (18) merge two known; two far left
3326 o---+---+ | 18 (18) merge two known; two far left
3327 / / / / /
3327 / / / / /
3328 ' ' ' | o 17 (17) expand
3328 ' ' ' | o 17 (17) expand
3329 ' ' ' | |\
3329 ' ' ' | |\
3330 +-+-------o 16 (16) merge two known; one immediate right, one near right
3330 +-+-------o 16 (16) merge two known; one immediate right, one near right
3331 ' ' ' o | 15 (15) expand
3331 ' ' ' o | 15 (15) expand
3332 ' ' ' |\ \
3332 ' ' ' |\ \
3333 +-------o | 14 (14) merge two known; one immediate right, one far right
3333 +-------o | 14 (14) merge two known; one immediate right, one far right
3334 ' ' ' | |/
3334 ' ' ' | |/
3335 ' ' ' o | 13 (13) expand
3335 ' ' ' o | 13 (13) expand
3336 ' ' ' |\ \
3336 ' ' ' |\ \
3337 ' +---+---o 12 (12) merge two known; one immediate right, one far left
3337 ' +---+---o 12 (12) merge two known; one immediate right, one far left
3338 ' ' ' | o 11 (11) expand
3338 ' ' ' | o 11 (11) expand
3339 ' ' ' | |\
3339 ' ' ' | |\
3340 +---------o 10 (10) merge two known; one immediate left, one near right
3340 +---------o 10 (10) merge two known; one immediate left, one near right
3341 ' ' ' | |/
3341 ' ' ' | |/
3342 ' ' ' o | 9 (9) expand
3342 ' ' ' o | 9 (9) expand
3343 ' ' ' |\ \
3343 ' ' ' |\ \
3344 +-------o | 8 (8) merge two known; one immediate left, one far right
3344 +-------o | 8 (8) merge two known; one immediate left, one far right
3345 ' ' ' |/ /
3345 ' ' ' |/ /
3346 ' ' ' o | 7 (7) expand
3346 ' ' ' o | 7 (7) expand
3347 ' ' ' |\ \
3347 ' ' ' |\ \
3348 ' ' ' +---o 6 (6) merge two known; one immediate left, one far left
3348 ' ' ' +---o 6 (6) merge two known; one immediate left, one far left
3349 ' ' ' | '/
3349 ' ' ' | '/
3350 ' ' ' o ' 5 (5) expand
3350 ' ' ' o ' 5 (5) expand
3351 ' ' ' |\ \
3351 ' ' ' |\ \
3352 ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right
3352 ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right
3353 ' ' ' '/ /
3353 ' ' ' '/ /
3354
3354
3355 behavior with newlines
3355 behavior with newlines
3356
3356
3357 $ hg log -G -r ::2 -T '{rev} {desc}'
3357 $ hg log -G -r ::2 -T '{rev} {desc}'
3358 o 2 (2) collapse
3358 o 2 (2) collapse
3359 o 1 (1) collapse
3359 o 1 (1) collapse
3360 o 0 (0) root
3360 o 0 (0) root
3361
3361
3362 $ hg log -G -r ::2 -T '{rev} {desc}\n'
3362 $ hg log -G -r ::2 -T '{rev} {desc}\n'
3363 o 2 (2) collapse
3363 o 2 (2) collapse
3364 o 1 (1) collapse
3364 o 1 (1) collapse
3365 o 0 (0) root
3365 o 0 (0) root
3366
3366
3367 $ hg log -G -r ::2 -T '{rev} {desc}\n\n'
3367 $ hg log -G -r ::2 -T '{rev} {desc}\n\n'
3368 o 2 (2) collapse
3368 o 2 (2) collapse
3369 |
3369 |
3370 o 1 (1) collapse
3370 o 1 (1) collapse
3371 |
3371 |
3372 o 0 (0) root
3372 o 0 (0) root
3373
3373
3374
3374
3375 $ hg log -G -r ::2 -T '\n{rev} {desc}'
3375 $ hg log -G -r ::2 -T '\n{rev} {desc}'
3376 o
3376 o
3377 | 2 (2) collapse
3377 | 2 (2) collapse
3378 o
3378 o
3379 | 1 (1) collapse
3379 | 1 (1) collapse
3380 o
3380 o
3381 0 (0) root
3381 0 (0) root
3382
3382
3383 $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n'
3383 $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n'
3384 o 2 (2) collapse
3384 o 2 (2) collapse
3385 |
3385 |
3386 |
3386 |
3387 o 1 (1) collapse
3387 o 1 (1) collapse
3388 |
3388 |
3389 |
3389 |
3390 o 0 (0) root
3390 o 0 (0) root
3391
3391
3392
3392
3393 $ cd ..
3393 $ cd ..
3394
3394
3395 When inserting extra line nodes to handle more than 2 parents, ensure that
3395 When inserting extra line nodes to handle more than 2 parents, ensure that
3396 the right node styles are used (issue5174):
3396 the right node styles are used (issue5174):
3397
3397
3398 $ hg init repo-issue5174
3398 $ hg init repo-issue5174
3399 $ cd repo-issue5174
3399 $ cd repo-issue5174
3400 $ echo a > f0
3400 $ echo a > f0
3401 $ hg ci -Aqm 0
3401 $ hg ci -Aqm 0
3402 $ echo a > f1
3402 $ echo a > f1
3403 $ hg ci -Aqm 1
3403 $ hg ci -Aqm 1
3404 $ echo a > f2
3404 $ echo a > f2
3405 $ hg ci -Aqm 2
3405 $ hg ci -Aqm 2
3406 $ hg co ".^"
3406 $ hg co ".^"
3407 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3407 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3408 $ echo a > f3
3408 $ echo a > f3
3409 $ hg ci -Aqm 3
3409 $ hg ci -Aqm 3
3410 $ hg co ".^^"
3410 $ hg co ".^^"
3411 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
3411 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
3412 $ echo a > f4
3412 $ echo a > f4
3413 $ hg ci -Aqm 4
3413 $ hg ci -Aqm 4
3414 $ hg merge -r 2
3414 $ hg merge -r 2
3415 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3415 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3416 (branch merge, don't forget to commit)
3416 (branch merge, don't forget to commit)
3417 $ hg ci -qm 5
3417 $ hg ci -qm 5
3418 $ hg merge -r 3
3418 $ hg merge -r 3
3419 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3419 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3420 (branch merge, don't forget to commit)
3420 (branch merge, don't forget to commit)
3421 $ hg ci -qm 6
3421 $ hg ci -qm 6
3422 $ hg log -G -r '0 | 1 | 2 | 6'
3422 $ hg log -G -r '0 | 1 | 2 | 6'
3423 @ changeset: 6:851fe89689ad
3423 @ changeset: 6:851fe89689ad
3424 :\ tag: tip
3424 :\ tag: tip
3425 : : parent: 5:4f1e3cf15f5d
3425 : : parent: 5:4f1e3cf15f5d
3426 : : parent: 3:b74ba7084d2d
3426 : : parent: 3:b74ba7084d2d
3427 : : user: test
3427 : : user: test
3428 : : date: Thu Jan 01 00:00:00 1970 +0000
3428 : : date: Thu Jan 01 00:00:00 1970 +0000
3429 : : summary: 6
3429 : : summary: 6
3430 : :
3430 : :
3431 : \
3431 : \
3432 : :\
3432 : :\
3433 : o : changeset: 2:3e6599df4cce
3433 : o : changeset: 2:3e6599df4cce
3434 : :/ user: test
3434 : :/ user: test
3435 : : date: Thu Jan 01 00:00:00 1970 +0000
3435 : : date: Thu Jan 01 00:00:00 1970 +0000
3436 : : summary: 2
3436 : : summary: 2
3437 : :
3437 : :
3438 : o changeset: 1:bd9a55143933
3438 : o changeset: 1:bd9a55143933
3439 :/ user: test
3439 :/ user: test
3440 : date: Thu Jan 01 00:00:00 1970 +0000
3440 : date: Thu Jan 01 00:00:00 1970 +0000
3441 : summary: 1
3441 : summary: 1
3442 :
3442 :
3443 o changeset: 0:870a5edc339c
3443 o changeset: 0:870a5edc339c
3444 user: test
3444 user: test
3445 date: Thu Jan 01 00:00:00 1970 +0000
3445 date: Thu Jan 01 00:00:00 1970 +0000
3446 summary: 0
3446 summary: 0
3447
3447
3448
3448
3449 $ cd ..
3449 $ cd ..
3450
3450
3451 Multiple roots (issue5440):
3451 Multiple roots (issue5440):
3452
3452
3453 $ hg init multiroots
3453 $ hg init multiroots
3454 $ cd multiroots
3454 $ cd multiroots
3455 $ cat <<EOF > .hg/hgrc
3455 $ cat <<EOF > .hg/hgrc
3456 > [ui]
3456 > [ui]
3457 > logtemplate = '{rev} {desc}\n\n'
3457 > logtemplate = '{rev} {desc}\n\n'
3458 > EOF
3458 > EOF
3459
3459
3460 $ touch foo
3460 $ touch foo
3461 $ hg ci -Aqm foo
3461 $ hg ci -Aqm foo
3462 $ hg co -q null
3462 $ hg co -q null
3463 $ touch bar
3463 $ touch bar
3464 $ hg ci -Aqm bar
3464 $ hg ci -Aqm bar
3465
3465
3466 $ hg log -Gr null:
3466 $ hg log -Gr null:
3467 @ 1 bar
3467 @ 1 bar
3468 |
3468 |
3469 | o 0 foo
3469 | o 0 foo
3470 |/
3470 |/
3471 o -1
3471 o -1
3472
3472
3473 $ hg log -Gr null+0
3473 $ hg log -Gr null+0
3474 o 0 foo
3474 o 0 foo
3475 |
3475 |
3476 o -1
3476 o -1
3477
3477
3478 $ hg log -Gr null+1
3478 $ hg log -Gr null+1
3479 @ 1 bar
3479 @ 1 bar
3480 |
3480 |
3481 o -1
3481 o -1
3482
3482
3483
3483
3484 $ cd ..
3484 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now