##// END OF EJS Templates
log: simplify 'x or ancestors(x)' expression...
Yuya Nishihara -
r35661:668c5a52 default
parent child Browse files
Show More
@@ -1,3930 +1,3930 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 scmutil,
44 scmutil,
45 smartset,
45 smartset,
46 templatekw,
46 templatekw,
47 templater,
47 templater,
48 util,
48 util,
49 vfs as vfsmod,
49 vfs as vfsmod,
50 )
50 )
51 stringio = util.stringio
51 stringio = util.stringio
52
52
53 # templates of common command options
53 # templates of common command options
54
54
55 dryrunopts = [
55 dryrunopts = [
56 ('n', 'dry-run', None,
56 ('n', 'dry-run', None,
57 _('do not perform actions, just print output')),
57 _('do not perform actions, just print output')),
58 ]
58 ]
59
59
60 remoteopts = [
60 remoteopts = [
61 ('e', 'ssh', '',
61 ('e', 'ssh', '',
62 _('specify ssh command to use'), _('CMD')),
62 _('specify ssh command to use'), _('CMD')),
63 ('', 'remotecmd', '',
63 ('', 'remotecmd', '',
64 _('specify hg command to run on the remote side'), _('CMD')),
64 _('specify hg command to run on the remote side'), _('CMD')),
65 ('', 'insecure', None,
65 ('', 'insecure', None,
66 _('do not verify server certificate (ignoring web.cacerts config)')),
66 _('do not verify server certificate (ignoring web.cacerts config)')),
67 ]
67 ]
68
68
69 walkopts = [
69 walkopts = [
70 ('I', 'include', [],
70 ('I', 'include', [],
71 _('include names matching the given patterns'), _('PATTERN')),
71 _('include names matching the given patterns'), _('PATTERN')),
72 ('X', 'exclude', [],
72 ('X', 'exclude', [],
73 _('exclude names matching the given patterns'), _('PATTERN')),
73 _('exclude names matching the given patterns'), _('PATTERN')),
74 ]
74 ]
75
75
76 commitopts = [
76 commitopts = [
77 ('m', 'message', '',
77 ('m', 'message', '',
78 _('use text as commit message'), _('TEXT')),
78 _('use text as commit message'), _('TEXT')),
79 ('l', 'logfile', '',
79 ('l', 'logfile', '',
80 _('read commit message from file'), _('FILE')),
80 _('read commit message from file'), _('FILE')),
81 ]
81 ]
82
82
83 commitopts2 = [
83 commitopts2 = [
84 ('d', 'date', '',
84 ('d', 'date', '',
85 _('record the specified date as commit date'), _('DATE')),
85 _('record the specified date as commit date'), _('DATE')),
86 ('u', 'user', '',
86 ('u', 'user', '',
87 _('record the specified user as committer'), _('USER')),
87 _('record the specified user as committer'), _('USER')),
88 ]
88 ]
89
89
90 # hidden for now
90 # hidden for now
91 formatteropts = [
91 formatteropts = [
92 ('T', 'template', '',
92 ('T', 'template', '',
93 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
93 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
94 ]
94 ]
95
95
96 templateopts = [
96 templateopts = [
97 ('', 'style', '',
97 ('', 'style', '',
98 _('display using template map file (DEPRECATED)'), _('STYLE')),
98 _('display using template map file (DEPRECATED)'), _('STYLE')),
99 ('T', 'template', '',
99 ('T', 'template', '',
100 _('display with template'), _('TEMPLATE')),
100 _('display with template'), _('TEMPLATE')),
101 ]
101 ]
102
102
103 logopts = [
103 logopts = [
104 ('p', 'patch', None, _('show patch')),
104 ('p', 'patch', None, _('show patch')),
105 ('g', 'git', None, _('use git extended diff format')),
105 ('g', 'git', None, _('use git extended diff format')),
106 ('l', 'limit', '',
106 ('l', 'limit', '',
107 _('limit number of changes displayed'), _('NUM')),
107 _('limit number of changes displayed'), _('NUM')),
108 ('M', 'no-merges', None, _('do not show merges')),
108 ('M', 'no-merges', None, _('do not show merges')),
109 ('', 'stat', None, _('output diffstat-style summary of changes')),
109 ('', 'stat', None, _('output diffstat-style summary of changes')),
110 ('G', 'graph', None, _("show the revision DAG")),
110 ('G', 'graph', None, _("show the revision DAG")),
111 ] + templateopts
111 ] + templateopts
112
112
113 diffopts = [
113 diffopts = [
114 ('a', 'text', None, _('treat all files as text')),
114 ('a', 'text', None, _('treat all files as text')),
115 ('g', 'git', None, _('use git extended diff format')),
115 ('g', 'git', None, _('use git extended diff format')),
116 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
116 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
117 ('', 'nodates', None, _('omit dates from diff headers'))
117 ('', 'nodates', None, _('omit dates from diff headers'))
118 ]
118 ]
119
119
120 diffwsopts = [
120 diffwsopts = [
121 ('w', 'ignore-all-space', None,
121 ('w', 'ignore-all-space', None,
122 _('ignore white space when comparing lines')),
122 _('ignore white space when comparing lines')),
123 ('b', 'ignore-space-change', None,
123 ('b', 'ignore-space-change', None,
124 _('ignore changes in the amount of white space')),
124 _('ignore changes in the amount of white space')),
125 ('B', 'ignore-blank-lines', None,
125 ('B', 'ignore-blank-lines', None,
126 _('ignore changes whose lines are all blank')),
126 _('ignore changes whose lines are all blank')),
127 ('Z', 'ignore-space-at-eol', None,
127 ('Z', 'ignore-space-at-eol', None,
128 _('ignore changes in whitespace at EOL')),
128 _('ignore changes in whitespace at EOL')),
129 ]
129 ]
130
130
131 diffopts2 = [
131 diffopts2 = [
132 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
132 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
133 ('p', 'show-function', None, _('show which function each change is in')),
133 ('p', 'show-function', None, _('show which function each change is in')),
134 ('', 'reverse', None, _('produce a diff that undoes the changes')),
134 ('', 'reverse', None, _('produce a diff that undoes the changes')),
135 ] + diffwsopts + [
135 ] + diffwsopts + [
136 ('U', 'unified', '',
136 ('U', 'unified', '',
137 _('number of lines of context to show'), _('NUM')),
137 _('number of lines of context to show'), _('NUM')),
138 ('', 'stat', None, _('output diffstat-style summary of changes')),
138 ('', 'stat', None, _('output diffstat-style summary of changes')),
139 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
139 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
140 ]
140 ]
141
141
142 mergetoolopts = [
142 mergetoolopts = [
143 ('t', 'tool', '', _('specify merge tool')),
143 ('t', 'tool', '', _('specify merge tool')),
144 ]
144 ]
145
145
146 similarityopts = [
146 similarityopts = [
147 ('s', 'similarity', '',
147 ('s', 'similarity', '',
148 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
148 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
149 ]
149 ]
150
150
151 subrepoopts = [
151 subrepoopts = [
152 ('S', 'subrepos', None,
152 ('S', 'subrepos', None,
153 _('recurse into subrepositories'))
153 _('recurse into subrepositories'))
154 ]
154 ]
155
155
156 debugrevlogopts = [
156 debugrevlogopts = [
157 ('c', 'changelog', False, _('open changelog')),
157 ('c', 'changelog', False, _('open changelog')),
158 ('m', 'manifest', False, _('open manifest')),
158 ('m', 'manifest', False, _('open manifest')),
159 ('', 'dir', '', _('open directory manifest')),
159 ('', 'dir', '', _('open directory manifest')),
160 ]
160 ]
161
161
162 # special string such that everything below this line will be ingored in the
162 # special string such that everything below this line will be ingored in the
163 # editor text
163 # editor text
164 _linebelow = "^HG: ------------------------ >8 ------------------------$"
164 _linebelow = "^HG: ------------------------ >8 ------------------------$"
165
165
166 def ishunk(x):
166 def ishunk(x):
167 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
167 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
168 return isinstance(x, hunkclasses)
168 return isinstance(x, hunkclasses)
169
169
170 def newandmodified(chunks, originalchunks):
170 def newandmodified(chunks, originalchunks):
171 newlyaddedandmodifiedfiles = set()
171 newlyaddedandmodifiedfiles = set()
172 for chunk in chunks:
172 for chunk in chunks:
173 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
173 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
174 originalchunks:
174 originalchunks:
175 newlyaddedandmodifiedfiles.add(chunk.header.filename())
175 newlyaddedandmodifiedfiles.add(chunk.header.filename())
176 return newlyaddedandmodifiedfiles
176 return newlyaddedandmodifiedfiles
177
177
178 def parsealiases(cmd):
178 def parsealiases(cmd):
179 return cmd.lstrip("^").split("|")
179 return cmd.lstrip("^").split("|")
180
180
181 def setupwrapcolorwrite(ui):
181 def setupwrapcolorwrite(ui):
182 # wrap ui.write so diff output can be labeled/colorized
182 # wrap ui.write so diff output can be labeled/colorized
183 def wrapwrite(orig, *args, **kw):
183 def wrapwrite(orig, *args, **kw):
184 label = kw.pop(r'label', '')
184 label = kw.pop(r'label', '')
185 for chunk, l in patch.difflabel(lambda: args):
185 for chunk, l in patch.difflabel(lambda: args):
186 orig(chunk, label=label + l)
186 orig(chunk, label=label + l)
187
187
188 oldwrite = ui.write
188 oldwrite = ui.write
189 def wrap(*args, **kwargs):
189 def wrap(*args, **kwargs):
190 return wrapwrite(oldwrite, *args, **kwargs)
190 return wrapwrite(oldwrite, *args, **kwargs)
191 setattr(ui, 'write', wrap)
191 setattr(ui, 'write', wrap)
192 return oldwrite
192 return oldwrite
193
193
194 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
194 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
195 if usecurses:
195 if usecurses:
196 if testfile:
196 if testfile:
197 recordfn = crecordmod.testdecorator(testfile,
197 recordfn = crecordmod.testdecorator(testfile,
198 crecordmod.testchunkselector)
198 crecordmod.testchunkselector)
199 else:
199 else:
200 recordfn = crecordmod.chunkselector
200 recordfn = crecordmod.chunkselector
201
201
202 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
202 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
203
203
204 else:
204 else:
205 return patch.filterpatch(ui, originalhunks, operation)
205 return patch.filterpatch(ui, originalhunks, operation)
206
206
207 def recordfilter(ui, originalhunks, operation=None):
207 def recordfilter(ui, originalhunks, operation=None):
208 """ Prompts the user to filter the originalhunks and return a list of
208 """ Prompts the user to filter the originalhunks and return a list of
209 selected hunks.
209 selected hunks.
210 *operation* is used for to build ui messages to indicate the user what
210 *operation* is used for to build ui messages to indicate the user what
211 kind of filtering they are doing: reverting, committing, shelving, etc.
211 kind of filtering they are doing: reverting, committing, shelving, etc.
212 (see patch.filterpatch).
212 (see patch.filterpatch).
213 """
213 """
214 usecurses = crecordmod.checkcurses(ui)
214 usecurses = crecordmod.checkcurses(ui)
215 testfile = ui.config('experimental', 'crecordtest')
215 testfile = ui.config('experimental', 'crecordtest')
216 oldwrite = setupwrapcolorwrite(ui)
216 oldwrite = setupwrapcolorwrite(ui)
217 try:
217 try:
218 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
218 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
219 testfile, operation)
219 testfile, operation)
220 finally:
220 finally:
221 ui.write = oldwrite
221 ui.write = oldwrite
222 return newchunks, newopts
222 return newchunks, newopts
223
223
224 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
224 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
225 filterfn, *pats, **opts):
225 filterfn, *pats, **opts):
226 from . import merge as mergemod
226 from . import merge as mergemod
227 opts = pycompat.byteskwargs(opts)
227 opts = pycompat.byteskwargs(opts)
228 if not ui.interactive():
228 if not ui.interactive():
229 if cmdsuggest:
229 if cmdsuggest:
230 msg = _('running non-interactively, use %s instead') % cmdsuggest
230 msg = _('running non-interactively, use %s instead') % cmdsuggest
231 else:
231 else:
232 msg = _('running non-interactively')
232 msg = _('running non-interactively')
233 raise error.Abort(msg)
233 raise error.Abort(msg)
234
234
235 # make sure username is set before going interactive
235 # make sure username is set before going interactive
236 if not opts.get('user'):
236 if not opts.get('user'):
237 ui.username() # raise exception, username not provided
237 ui.username() # raise exception, username not provided
238
238
239 def recordfunc(ui, repo, message, match, opts):
239 def recordfunc(ui, repo, message, match, opts):
240 """This is generic record driver.
240 """This is generic record driver.
241
241
242 Its job is to interactively filter local changes, and
242 Its job is to interactively filter local changes, and
243 accordingly prepare working directory into a state in which the
243 accordingly prepare working directory into a state in which the
244 job can be delegated to a non-interactive commit command such as
244 job can be delegated to a non-interactive commit command such as
245 'commit' or 'qrefresh'.
245 'commit' or 'qrefresh'.
246
246
247 After the actual job is done by non-interactive command, the
247 After the actual job is done by non-interactive command, the
248 working directory is restored to its original state.
248 working directory is restored to its original state.
249
249
250 In the end we'll record interesting changes, and everything else
250 In the end we'll record interesting changes, and everything else
251 will be left in place, so the user can continue working.
251 will be left in place, so the user can continue working.
252 """
252 """
253
253
254 checkunfinished(repo, commit=True)
254 checkunfinished(repo, commit=True)
255 wctx = repo[None]
255 wctx = repo[None]
256 merge = len(wctx.parents()) > 1
256 merge = len(wctx.parents()) > 1
257 if merge:
257 if merge:
258 raise error.Abort(_('cannot partially commit a merge '
258 raise error.Abort(_('cannot partially commit a merge '
259 '(use "hg commit" instead)'))
259 '(use "hg commit" instead)'))
260
260
261 def fail(f, msg):
261 def fail(f, msg):
262 raise error.Abort('%s: %s' % (f, msg))
262 raise error.Abort('%s: %s' % (f, msg))
263
263
264 force = opts.get('force')
264 force = opts.get('force')
265 if not force:
265 if not force:
266 vdirs = []
266 vdirs = []
267 match.explicitdir = vdirs.append
267 match.explicitdir = vdirs.append
268 match.bad = fail
268 match.bad = fail
269
269
270 status = repo.status(match=match)
270 status = repo.status(match=match)
271 if not force:
271 if not force:
272 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
272 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
273 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
273 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
274 diffopts.nodates = True
274 diffopts.nodates = True
275 diffopts.git = True
275 diffopts.git = True
276 diffopts.showfunc = True
276 diffopts.showfunc = True
277 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
277 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
278 originalchunks = patch.parsepatch(originaldiff)
278 originalchunks = patch.parsepatch(originaldiff)
279
279
280 # 1. filter patch, since we are intending to apply subset of it
280 # 1. filter patch, since we are intending to apply subset of it
281 try:
281 try:
282 chunks, newopts = filterfn(ui, originalchunks)
282 chunks, newopts = filterfn(ui, originalchunks)
283 except error.PatchError as err:
283 except error.PatchError as err:
284 raise error.Abort(_('error parsing patch: %s') % err)
284 raise error.Abort(_('error parsing patch: %s') % err)
285 opts.update(newopts)
285 opts.update(newopts)
286
286
287 # We need to keep a backup of files that have been newly added and
287 # We need to keep a backup of files that have been newly added and
288 # modified during the recording process because there is a previous
288 # modified during the recording process because there is a previous
289 # version without the edit in the workdir
289 # version without the edit in the workdir
290 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
290 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
291 contenders = set()
291 contenders = set()
292 for h in chunks:
292 for h in chunks:
293 try:
293 try:
294 contenders.update(set(h.files()))
294 contenders.update(set(h.files()))
295 except AttributeError:
295 except AttributeError:
296 pass
296 pass
297
297
298 changed = status.modified + status.added + status.removed
298 changed = status.modified + status.added + status.removed
299 newfiles = [f for f in changed if f in contenders]
299 newfiles = [f for f in changed if f in contenders]
300 if not newfiles:
300 if not newfiles:
301 ui.status(_('no changes to record\n'))
301 ui.status(_('no changes to record\n'))
302 return 0
302 return 0
303
303
304 modified = set(status.modified)
304 modified = set(status.modified)
305
305
306 # 2. backup changed files, so we can restore them in the end
306 # 2. backup changed files, so we can restore them in the end
307
307
308 if backupall:
308 if backupall:
309 tobackup = changed
309 tobackup = changed
310 else:
310 else:
311 tobackup = [f for f in newfiles if f in modified or f in \
311 tobackup = [f for f in newfiles if f in modified or f in \
312 newlyaddedandmodifiedfiles]
312 newlyaddedandmodifiedfiles]
313 backups = {}
313 backups = {}
314 if tobackup:
314 if tobackup:
315 backupdir = repo.vfs.join('record-backups')
315 backupdir = repo.vfs.join('record-backups')
316 try:
316 try:
317 os.mkdir(backupdir)
317 os.mkdir(backupdir)
318 except OSError as err:
318 except OSError as err:
319 if err.errno != errno.EEXIST:
319 if err.errno != errno.EEXIST:
320 raise
320 raise
321 try:
321 try:
322 # backup continues
322 # backup continues
323 for f in tobackup:
323 for f in tobackup:
324 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
324 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
325 dir=backupdir)
325 dir=backupdir)
326 os.close(fd)
326 os.close(fd)
327 ui.debug('backup %r as %r\n' % (f, tmpname))
327 ui.debug('backup %r as %r\n' % (f, tmpname))
328 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
328 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
329 backups[f] = tmpname
329 backups[f] = tmpname
330
330
331 fp = stringio()
331 fp = stringio()
332 for c in chunks:
332 for c in chunks:
333 fname = c.filename()
333 fname = c.filename()
334 if fname in backups:
334 if fname in backups:
335 c.write(fp)
335 c.write(fp)
336 dopatch = fp.tell()
336 dopatch = fp.tell()
337 fp.seek(0)
337 fp.seek(0)
338
338
339 # 2.5 optionally review / modify patch in text editor
339 # 2.5 optionally review / modify patch in text editor
340 if opts.get('review', False):
340 if opts.get('review', False):
341 patchtext = (crecordmod.diffhelptext
341 patchtext = (crecordmod.diffhelptext
342 + crecordmod.patchhelptext
342 + crecordmod.patchhelptext
343 + fp.read())
343 + fp.read())
344 reviewedpatch = ui.edit(patchtext, "",
344 reviewedpatch = ui.edit(patchtext, "",
345 action="diff",
345 action="diff",
346 repopath=repo.path)
346 repopath=repo.path)
347 fp.truncate(0)
347 fp.truncate(0)
348 fp.write(reviewedpatch)
348 fp.write(reviewedpatch)
349 fp.seek(0)
349 fp.seek(0)
350
350
351 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
351 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
352 # 3a. apply filtered patch to clean repo (clean)
352 # 3a. apply filtered patch to clean repo (clean)
353 if backups:
353 if backups:
354 # Equivalent to hg.revert
354 # Equivalent to hg.revert
355 m = scmutil.matchfiles(repo, backups.keys())
355 m = scmutil.matchfiles(repo, backups.keys())
356 mergemod.update(repo, repo.dirstate.p1(),
356 mergemod.update(repo, repo.dirstate.p1(),
357 False, True, matcher=m)
357 False, True, matcher=m)
358
358
359 # 3b. (apply)
359 # 3b. (apply)
360 if dopatch:
360 if dopatch:
361 try:
361 try:
362 ui.debug('applying patch\n')
362 ui.debug('applying patch\n')
363 ui.debug(fp.getvalue())
363 ui.debug(fp.getvalue())
364 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
364 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
365 except error.PatchError as err:
365 except error.PatchError as err:
366 raise error.Abort(str(err))
366 raise error.Abort(str(err))
367 del fp
367 del fp
368
368
369 # 4. We prepared working directory according to filtered
369 # 4. We prepared working directory according to filtered
370 # patch. Now is the time to delegate the job to
370 # patch. Now is the time to delegate the job to
371 # commit/qrefresh or the like!
371 # commit/qrefresh or the like!
372
372
373 # Make all of the pathnames absolute.
373 # Make all of the pathnames absolute.
374 newfiles = [repo.wjoin(nf) for nf in newfiles]
374 newfiles = [repo.wjoin(nf) for nf in newfiles]
375 return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
375 return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
376 finally:
376 finally:
377 # 5. finally restore backed-up files
377 # 5. finally restore backed-up files
378 try:
378 try:
379 dirstate = repo.dirstate
379 dirstate = repo.dirstate
380 for realname, tmpname in backups.iteritems():
380 for realname, tmpname in backups.iteritems():
381 ui.debug('restoring %r to %r\n' % (tmpname, realname))
381 ui.debug('restoring %r to %r\n' % (tmpname, realname))
382
382
383 if dirstate[realname] == 'n':
383 if dirstate[realname] == 'n':
384 # without normallookup, restoring timestamp
384 # without normallookup, restoring timestamp
385 # may cause partially committed files
385 # may cause partially committed files
386 # to be treated as unmodified
386 # to be treated as unmodified
387 dirstate.normallookup(realname)
387 dirstate.normallookup(realname)
388
388
389 # copystat=True here and above are a hack to trick any
389 # copystat=True here and above are a hack to trick any
390 # editors that have f open that we haven't modified them.
390 # editors that have f open that we haven't modified them.
391 #
391 #
392 # Also note that this racy as an editor could notice the
392 # Also note that this racy as an editor could notice the
393 # file's mtime before we've finished writing it.
393 # file's mtime before we've finished writing it.
394 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
394 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
395 os.unlink(tmpname)
395 os.unlink(tmpname)
396 if tobackup:
396 if tobackup:
397 os.rmdir(backupdir)
397 os.rmdir(backupdir)
398 except OSError:
398 except OSError:
399 pass
399 pass
400
400
401 def recordinwlock(ui, repo, message, match, opts):
401 def recordinwlock(ui, repo, message, match, opts):
402 with repo.wlock():
402 with repo.wlock():
403 return recordfunc(ui, repo, message, match, opts)
403 return recordfunc(ui, repo, message, match, opts)
404
404
405 return commit(ui, repo, recordinwlock, pats, opts)
405 return commit(ui, repo, recordinwlock, pats, opts)
406
406
407 class dirnode(object):
407 class dirnode(object):
408 """
408 """
409 Represent a directory in user working copy with information required for
409 Represent a directory in user working copy with information required for
410 the purpose of tersing its status.
410 the purpose of tersing its status.
411
411
412 path is the path to the directory
412 path is the path to the directory
413
413
414 statuses is a set of statuses of all files in this directory (this includes
414 statuses is a set of statuses of all files in this directory (this includes
415 all the files in all the subdirectories too)
415 all the files in all the subdirectories too)
416
416
417 files is a list of files which are direct child of this directory
417 files is a list of files which are direct child of this directory
418
418
419 subdirs is a dictionary of sub-directory name as the key and it's own
419 subdirs is a dictionary of sub-directory name as the key and it's own
420 dirnode object as the value
420 dirnode object as the value
421 """
421 """
422
422
423 def __init__(self, dirpath):
423 def __init__(self, dirpath):
424 self.path = dirpath
424 self.path = dirpath
425 self.statuses = set([])
425 self.statuses = set([])
426 self.files = []
426 self.files = []
427 self.subdirs = {}
427 self.subdirs = {}
428
428
429 def _addfileindir(self, filename, status):
429 def _addfileindir(self, filename, status):
430 """Add a file in this directory as a direct child."""
430 """Add a file in this directory as a direct child."""
431 self.files.append((filename, status))
431 self.files.append((filename, status))
432
432
433 def addfile(self, filename, status):
433 def addfile(self, filename, status):
434 """
434 """
435 Add a file to this directory or to its direct parent directory.
435 Add a file to this directory or to its direct parent directory.
436
436
437 If the file is not direct child of this directory, we traverse to the
437 If the file is not direct child of this directory, we traverse to the
438 directory of which this file is a direct child of and add the file
438 directory of which this file is a direct child of and add the file
439 there.
439 there.
440 """
440 """
441
441
442 # the filename contains a path separator, it means it's not the direct
442 # the filename contains a path separator, it means it's not the direct
443 # child of this directory
443 # child of this directory
444 if '/' in filename:
444 if '/' in filename:
445 subdir, filep = filename.split('/', 1)
445 subdir, filep = filename.split('/', 1)
446
446
447 # does the dirnode object for subdir exists
447 # does the dirnode object for subdir exists
448 if subdir not in self.subdirs:
448 if subdir not in self.subdirs:
449 subdirpath = os.path.join(self.path, subdir)
449 subdirpath = os.path.join(self.path, subdir)
450 self.subdirs[subdir] = dirnode(subdirpath)
450 self.subdirs[subdir] = dirnode(subdirpath)
451
451
452 # try adding the file in subdir
452 # try adding the file in subdir
453 self.subdirs[subdir].addfile(filep, status)
453 self.subdirs[subdir].addfile(filep, status)
454
454
455 else:
455 else:
456 self._addfileindir(filename, status)
456 self._addfileindir(filename, status)
457
457
458 if status not in self.statuses:
458 if status not in self.statuses:
459 self.statuses.add(status)
459 self.statuses.add(status)
460
460
461 def iterfilepaths(self):
461 def iterfilepaths(self):
462 """Yield (status, path) for files directly under this directory."""
462 """Yield (status, path) for files directly under this directory."""
463 for f, st in self.files:
463 for f, st in self.files:
464 yield st, os.path.join(self.path, f)
464 yield st, os.path.join(self.path, f)
465
465
466 def tersewalk(self, terseargs):
466 def tersewalk(self, terseargs):
467 """
467 """
468 Yield (status, path) obtained by processing the status of this
468 Yield (status, path) obtained by processing the status of this
469 dirnode.
469 dirnode.
470
470
471 terseargs is the string of arguments passed by the user with `--terse`
471 terseargs is the string of arguments passed by the user with `--terse`
472 flag.
472 flag.
473
473
474 Following are the cases which can happen:
474 Following are the cases which can happen:
475
475
476 1) All the files in the directory (including all the files in its
476 1) All the files in the directory (including all the files in its
477 subdirectories) share the same status and the user has asked us to terse
477 subdirectories) share the same status and the user has asked us to terse
478 that status. -> yield (status, dirpath)
478 that status. -> yield (status, dirpath)
479
479
480 2) Otherwise, we do following:
480 2) Otherwise, we do following:
481
481
482 a) Yield (status, filepath) for all the files which are in this
482 a) Yield (status, filepath) for all the files which are in this
483 directory (only the ones in this directory, not the subdirs)
483 directory (only the ones in this directory, not the subdirs)
484
484
485 b) Recurse the function on all the subdirectories of this
485 b) Recurse the function on all the subdirectories of this
486 directory
486 directory
487 """
487 """
488
488
489 if len(self.statuses) == 1:
489 if len(self.statuses) == 1:
490 onlyst = self.statuses.pop()
490 onlyst = self.statuses.pop()
491
491
492 # Making sure we terse only when the status abbreviation is
492 # Making sure we terse only when the status abbreviation is
493 # passed as terse argument
493 # passed as terse argument
494 if onlyst in terseargs:
494 if onlyst in terseargs:
495 yield onlyst, self.path + pycompat.ossep
495 yield onlyst, self.path + pycompat.ossep
496 return
496 return
497
497
498 # add the files to status list
498 # add the files to status list
499 for st, fpath in self.iterfilepaths():
499 for st, fpath in self.iterfilepaths():
500 yield st, fpath
500 yield st, fpath
501
501
502 #recurse on the subdirs
502 #recurse on the subdirs
503 for dirobj in self.subdirs.values():
503 for dirobj in self.subdirs.values():
504 for st, fpath in dirobj.tersewalk(terseargs):
504 for st, fpath in dirobj.tersewalk(terseargs):
505 yield st, fpath
505 yield st, fpath
506
506
507 def tersedir(statuslist, terseargs):
507 def tersedir(statuslist, terseargs):
508 """
508 """
509 Terse the status if all the files in a directory shares the same status.
509 Terse the status if all the files in a directory shares the same status.
510
510
511 statuslist is scmutil.status() object which contains a list of files for
511 statuslist is scmutil.status() object which contains a list of files for
512 each status.
512 each status.
513 terseargs is string which is passed by the user as the argument to `--terse`
513 terseargs is string which is passed by the user as the argument to `--terse`
514 flag.
514 flag.
515
515
516 The function makes a tree of objects of dirnode class, and at each node it
516 The function makes a tree of objects of dirnode class, and at each node it
517 stores the information required to know whether we can terse a certain
517 stores the information required to know whether we can terse a certain
518 directory or not.
518 directory or not.
519 """
519 """
520 # the order matters here as that is used to produce final list
520 # the order matters here as that is used to produce final list
521 allst = ('m', 'a', 'r', 'd', 'u', 'i', 'c')
521 allst = ('m', 'a', 'r', 'd', 'u', 'i', 'c')
522
522
523 # checking the argument validity
523 # checking the argument validity
524 for s in pycompat.bytestr(terseargs):
524 for s in pycompat.bytestr(terseargs):
525 if s not in allst:
525 if s not in allst:
526 raise error.Abort(_("'%s' not recognized") % s)
526 raise error.Abort(_("'%s' not recognized") % s)
527
527
528 # creating a dirnode object for the root of the repo
528 # creating a dirnode object for the root of the repo
529 rootobj = dirnode('')
529 rootobj = dirnode('')
530 pstatus = ('modified', 'added', 'deleted', 'clean', 'unknown',
530 pstatus = ('modified', 'added', 'deleted', 'clean', 'unknown',
531 'ignored', 'removed')
531 'ignored', 'removed')
532
532
533 tersedict = {}
533 tersedict = {}
534 for attrname in pstatus:
534 for attrname in pstatus:
535 statuschar = attrname[0:1]
535 statuschar = attrname[0:1]
536 for f in getattr(statuslist, attrname):
536 for f in getattr(statuslist, attrname):
537 rootobj.addfile(f, statuschar)
537 rootobj.addfile(f, statuschar)
538 tersedict[statuschar] = []
538 tersedict[statuschar] = []
539
539
540 # we won't be tersing the root dir, so add files in it
540 # we won't be tersing the root dir, so add files in it
541 for st, fpath in rootobj.iterfilepaths():
541 for st, fpath in rootobj.iterfilepaths():
542 tersedict[st].append(fpath)
542 tersedict[st].append(fpath)
543
543
544 # process each sub-directory and build tersedict
544 # process each sub-directory and build tersedict
545 for subdir in rootobj.subdirs.values():
545 for subdir in rootobj.subdirs.values():
546 for st, f in subdir.tersewalk(terseargs):
546 for st, f in subdir.tersewalk(terseargs):
547 tersedict[st].append(f)
547 tersedict[st].append(f)
548
548
549 tersedlist = []
549 tersedlist = []
550 for st in allst:
550 for st in allst:
551 tersedict[st].sort()
551 tersedict[st].sort()
552 tersedlist.append(tersedict[st])
552 tersedlist.append(tersedict[st])
553
553
554 return tersedlist
554 return tersedlist
555
555
556 def _commentlines(raw):
556 def _commentlines(raw):
557 '''Surround lineswith a comment char and a new line'''
557 '''Surround lineswith a comment char and a new line'''
558 lines = raw.splitlines()
558 lines = raw.splitlines()
559 commentedlines = ['# %s' % line for line in lines]
559 commentedlines = ['# %s' % line for line in lines]
560 return '\n'.join(commentedlines) + '\n'
560 return '\n'.join(commentedlines) + '\n'
561
561
562 def _conflictsmsg(repo):
562 def _conflictsmsg(repo):
563 # avoid merge cycle
563 # avoid merge cycle
564 from . import merge as mergemod
564 from . import merge as mergemod
565 mergestate = mergemod.mergestate.read(repo)
565 mergestate = mergemod.mergestate.read(repo)
566 if not mergestate.active():
566 if not mergestate.active():
567 return
567 return
568
568
569 m = scmutil.match(repo[None])
569 m = scmutil.match(repo[None])
570 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
570 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
571 if unresolvedlist:
571 if unresolvedlist:
572 mergeliststr = '\n'.join(
572 mergeliststr = '\n'.join(
573 [' %s' % util.pathto(repo.root, pycompat.getcwd(), path)
573 [' %s' % util.pathto(repo.root, pycompat.getcwd(), path)
574 for path in unresolvedlist])
574 for path in unresolvedlist])
575 msg = _('''Unresolved merge conflicts:
575 msg = _('''Unresolved merge conflicts:
576
576
577 %s
577 %s
578
578
579 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
579 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
580 else:
580 else:
581 msg = _('No unresolved merge conflicts.')
581 msg = _('No unresolved merge conflicts.')
582
582
583 return _commentlines(msg)
583 return _commentlines(msg)
584
584
585 def _helpmessage(continuecmd, abortcmd):
585 def _helpmessage(continuecmd, abortcmd):
586 msg = _('To continue: %s\n'
586 msg = _('To continue: %s\n'
587 'To abort: %s') % (continuecmd, abortcmd)
587 'To abort: %s') % (continuecmd, abortcmd)
588 return _commentlines(msg)
588 return _commentlines(msg)
589
589
590 def _rebasemsg():
590 def _rebasemsg():
591 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
591 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
592
592
593 def _histeditmsg():
593 def _histeditmsg():
594 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
594 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
595
595
596 def _unshelvemsg():
596 def _unshelvemsg():
597 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
597 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
598
598
599 def _updatecleanmsg(dest=None):
599 def _updatecleanmsg(dest=None):
600 warning = _('warning: this will discard uncommitted changes')
600 warning = _('warning: this will discard uncommitted changes')
601 return 'hg update --clean %s (%s)' % (dest or '.', warning)
601 return 'hg update --clean %s (%s)' % (dest or '.', warning)
602
602
603 def _graftmsg():
603 def _graftmsg():
604 # tweakdefaults requires `update` to have a rev hence the `.`
604 # tweakdefaults requires `update` to have a rev hence the `.`
605 return _helpmessage('hg graft --continue', _updatecleanmsg())
605 return _helpmessage('hg graft --continue', _updatecleanmsg())
606
606
607 def _mergemsg():
607 def _mergemsg():
608 # tweakdefaults requires `update` to have a rev hence the `.`
608 # tweakdefaults requires `update` to have a rev hence the `.`
609 return _helpmessage('hg commit', _updatecleanmsg())
609 return _helpmessage('hg commit', _updatecleanmsg())
610
610
611 def _bisectmsg():
611 def _bisectmsg():
612 msg = _('To mark the changeset good: hg bisect --good\n'
612 msg = _('To mark the changeset good: hg bisect --good\n'
613 'To mark the changeset bad: hg bisect --bad\n'
613 'To mark the changeset bad: hg bisect --bad\n'
614 'To abort: hg bisect --reset\n')
614 'To abort: hg bisect --reset\n')
615 return _commentlines(msg)
615 return _commentlines(msg)
616
616
617 def fileexistspredicate(filename):
617 def fileexistspredicate(filename):
618 return lambda repo: repo.vfs.exists(filename)
618 return lambda repo: repo.vfs.exists(filename)
619
619
620 def _mergepredicate(repo):
620 def _mergepredicate(repo):
621 return len(repo[None].parents()) > 1
621 return len(repo[None].parents()) > 1
622
622
623 STATES = (
623 STATES = (
624 # (state, predicate to detect states, helpful message function)
624 # (state, predicate to detect states, helpful message function)
625 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
625 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
626 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
626 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
627 ('graft', fileexistspredicate('graftstate'), _graftmsg),
627 ('graft', fileexistspredicate('graftstate'), _graftmsg),
628 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
628 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
629 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
629 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
630 # The merge state is part of a list that will be iterated over.
630 # The merge state is part of a list that will be iterated over.
631 # They need to be last because some of the other unfinished states may also
631 # They need to be last because some of the other unfinished states may also
632 # be in a merge or update state (eg. rebase, histedit, graft, etc).
632 # be in a merge or update state (eg. rebase, histedit, graft, etc).
633 # We want those to have priority.
633 # We want those to have priority.
634 ('merge', _mergepredicate, _mergemsg),
634 ('merge', _mergepredicate, _mergemsg),
635 )
635 )
636
636
637 def _getrepostate(repo):
637 def _getrepostate(repo):
638 # experimental config: commands.status.skipstates
638 # experimental config: commands.status.skipstates
639 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
639 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
640 for state, statedetectionpredicate, msgfn in STATES:
640 for state, statedetectionpredicate, msgfn in STATES:
641 if state in skip:
641 if state in skip:
642 continue
642 continue
643 if statedetectionpredicate(repo):
643 if statedetectionpredicate(repo):
644 return (state, statedetectionpredicate, msgfn)
644 return (state, statedetectionpredicate, msgfn)
645
645
646 def morestatus(repo, fm):
646 def morestatus(repo, fm):
647 statetuple = _getrepostate(repo)
647 statetuple = _getrepostate(repo)
648 label = 'status.morestatus'
648 label = 'status.morestatus'
649 if statetuple:
649 if statetuple:
650 fm.startitem()
650 fm.startitem()
651 state, statedetectionpredicate, helpfulmsg = statetuple
651 state, statedetectionpredicate, helpfulmsg = statetuple
652 statemsg = _('The repository is in an unfinished *%s* state.') % state
652 statemsg = _('The repository is in an unfinished *%s* state.') % state
653 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
653 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
654 conmsg = _conflictsmsg(repo)
654 conmsg = _conflictsmsg(repo)
655 if conmsg:
655 if conmsg:
656 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
656 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
657 if helpfulmsg:
657 if helpfulmsg:
658 helpmsg = helpfulmsg()
658 helpmsg = helpfulmsg()
659 fm.write('helpmsg', '%s\n', helpmsg, label=label)
659 fm.write('helpmsg', '%s\n', helpmsg, label=label)
660
660
661 def findpossible(cmd, table, strict=False):
661 def findpossible(cmd, table, strict=False):
662 """
662 """
663 Return cmd -> (aliases, command table entry)
663 Return cmd -> (aliases, command table entry)
664 for each matching command.
664 for each matching command.
665 Return debug commands (or their aliases) only if no normal command matches.
665 Return debug commands (or their aliases) only if no normal command matches.
666 """
666 """
667 choice = {}
667 choice = {}
668 debugchoice = {}
668 debugchoice = {}
669
669
670 if cmd in table:
670 if cmd in table:
671 # short-circuit exact matches, "log" alias beats "^log|history"
671 # short-circuit exact matches, "log" alias beats "^log|history"
672 keys = [cmd]
672 keys = [cmd]
673 else:
673 else:
674 keys = table.keys()
674 keys = table.keys()
675
675
676 allcmds = []
676 allcmds = []
677 for e in keys:
677 for e in keys:
678 aliases = parsealiases(e)
678 aliases = parsealiases(e)
679 allcmds.extend(aliases)
679 allcmds.extend(aliases)
680 found = None
680 found = None
681 if cmd in aliases:
681 if cmd in aliases:
682 found = cmd
682 found = cmd
683 elif not strict:
683 elif not strict:
684 for a in aliases:
684 for a in aliases:
685 if a.startswith(cmd):
685 if a.startswith(cmd):
686 found = a
686 found = a
687 break
687 break
688 if found is not None:
688 if found is not None:
689 if aliases[0].startswith("debug") or found.startswith("debug"):
689 if aliases[0].startswith("debug") or found.startswith("debug"):
690 debugchoice[found] = (aliases, table[e])
690 debugchoice[found] = (aliases, table[e])
691 else:
691 else:
692 choice[found] = (aliases, table[e])
692 choice[found] = (aliases, table[e])
693
693
694 if not choice and debugchoice:
694 if not choice and debugchoice:
695 choice = debugchoice
695 choice = debugchoice
696
696
697 return choice, allcmds
697 return choice, allcmds
698
698
699 def findcmd(cmd, table, strict=True):
699 def findcmd(cmd, table, strict=True):
700 """Return (aliases, command table entry) for command string."""
700 """Return (aliases, command table entry) for command string."""
701 choice, allcmds = findpossible(cmd, table, strict)
701 choice, allcmds = findpossible(cmd, table, strict)
702
702
703 if cmd in choice:
703 if cmd in choice:
704 return choice[cmd]
704 return choice[cmd]
705
705
706 if len(choice) > 1:
706 if len(choice) > 1:
707 clist = sorted(choice)
707 clist = sorted(choice)
708 raise error.AmbiguousCommand(cmd, clist)
708 raise error.AmbiguousCommand(cmd, clist)
709
709
710 if choice:
710 if choice:
711 return list(choice.values())[0]
711 return list(choice.values())[0]
712
712
713 raise error.UnknownCommand(cmd, allcmds)
713 raise error.UnknownCommand(cmd, allcmds)
714
714
715 def findrepo(p):
715 def findrepo(p):
716 while not os.path.isdir(os.path.join(p, ".hg")):
716 while not os.path.isdir(os.path.join(p, ".hg")):
717 oldp, p = p, os.path.dirname(p)
717 oldp, p = p, os.path.dirname(p)
718 if p == oldp:
718 if p == oldp:
719 return None
719 return None
720
720
721 return p
721 return p
722
722
723 def bailifchanged(repo, merge=True, hint=None):
723 def bailifchanged(repo, merge=True, hint=None):
724 """ enforce the precondition that working directory must be clean.
724 """ enforce the precondition that working directory must be clean.
725
725
726 'merge' can be set to false if a pending uncommitted merge should be
726 'merge' can be set to false if a pending uncommitted merge should be
727 ignored (such as when 'update --check' runs).
727 ignored (such as when 'update --check' runs).
728
728
729 'hint' is the usual hint given to Abort exception.
729 'hint' is the usual hint given to Abort exception.
730 """
730 """
731
731
732 if merge and repo.dirstate.p2() != nullid:
732 if merge and repo.dirstate.p2() != nullid:
733 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
733 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
734 modified, added, removed, deleted = repo.status()[:4]
734 modified, added, removed, deleted = repo.status()[:4]
735 if modified or added or removed or deleted:
735 if modified or added or removed or deleted:
736 raise error.Abort(_('uncommitted changes'), hint=hint)
736 raise error.Abort(_('uncommitted changes'), hint=hint)
737 ctx = repo[None]
737 ctx = repo[None]
738 for s in sorted(ctx.substate):
738 for s in sorted(ctx.substate):
739 ctx.sub(s).bailifchanged(hint=hint)
739 ctx.sub(s).bailifchanged(hint=hint)
740
740
741 def logmessage(ui, opts):
741 def logmessage(ui, opts):
742 """ get the log message according to -m and -l option """
742 """ get the log message according to -m and -l option """
743 message = opts.get('message')
743 message = opts.get('message')
744 logfile = opts.get('logfile')
744 logfile = opts.get('logfile')
745
745
746 if message and logfile:
746 if message and logfile:
747 raise error.Abort(_('options --message and --logfile are mutually '
747 raise error.Abort(_('options --message and --logfile are mutually '
748 'exclusive'))
748 'exclusive'))
749 if not message and logfile:
749 if not message and logfile:
750 try:
750 try:
751 if isstdiofilename(logfile):
751 if isstdiofilename(logfile):
752 message = ui.fin.read()
752 message = ui.fin.read()
753 else:
753 else:
754 message = '\n'.join(util.readfile(logfile).splitlines())
754 message = '\n'.join(util.readfile(logfile).splitlines())
755 except IOError as inst:
755 except IOError as inst:
756 raise error.Abort(_("can't read commit message '%s': %s") %
756 raise error.Abort(_("can't read commit message '%s': %s") %
757 (logfile, encoding.strtolocal(inst.strerror)))
757 (logfile, encoding.strtolocal(inst.strerror)))
758 return message
758 return message
759
759
760 def mergeeditform(ctxorbool, baseformname):
760 def mergeeditform(ctxorbool, baseformname):
761 """return appropriate editform name (referencing a committemplate)
761 """return appropriate editform name (referencing a committemplate)
762
762
763 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
763 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
764 merging is committed.
764 merging is committed.
765
765
766 This returns baseformname with '.merge' appended if it is a merge,
766 This returns baseformname with '.merge' appended if it is a merge,
767 otherwise '.normal' is appended.
767 otherwise '.normal' is appended.
768 """
768 """
769 if isinstance(ctxorbool, bool):
769 if isinstance(ctxorbool, bool):
770 if ctxorbool:
770 if ctxorbool:
771 return baseformname + ".merge"
771 return baseformname + ".merge"
772 elif 1 < len(ctxorbool.parents()):
772 elif 1 < len(ctxorbool.parents()):
773 return baseformname + ".merge"
773 return baseformname + ".merge"
774
774
775 return baseformname + ".normal"
775 return baseformname + ".normal"
776
776
777 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
777 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
778 editform='', **opts):
778 editform='', **opts):
779 """get appropriate commit message editor according to '--edit' option
779 """get appropriate commit message editor according to '--edit' option
780
780
781 'finishdesc' is a function to be called with edited commit message
781 'finishdesc' is a function to be called with edited commit message
782 (= 'description' of the new changeset) just after editing, but
782 (= 'description' of the new changeset) just after editing, but
783 before checking empty-ness. It should return actual text to be
783 before checking empty-ness. It should return actual text to be
784 stored into history. This allows to change description before
784 stored into history. This allows to change description before
785 storing.
785 storing.
786
786
787 'extramsg' is a extra message to be shown in the editor instead of
787 'extramsg' is a extra message to be shown in the editor instead of
788 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
788 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
789 is automatically added.
789 is automatically added.
790
790
791 'editform' is a dot-separated list of names, to distinguish
791 'editform' is a dot-separated list of names, to distinguish
792 the purpose of commit text editing.
792 the purpose of commit text editing.
793
793
794 'getcommiteditor' returns 'commitforceeditor' regardless of
794 'getcommiteditor' returns 'commitforceeditor' regardless of
795 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
795 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
796 they are specific for usage in MQ.
796 they are specific for usage in MQ.
797 """
797 """
798 if edit or finishdesc or extramsg:
798 if edit or finishdesc or extramsg:
799 return lambda r, c, s: commitforceeditor(r, c, s,
799 return lambda r, c, s: commitforceeditor(r, c, s,
800 finishdesc=finishdesc,
800 finishdesc=finishdesc,
801 extramsg=extramsg,
801 extramsg=extramsg,
802 editform=editform)
802 editform=editform)
803 elif editform:
803 elif editform:
804 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
804 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
805 else:
805 else:
806 return commiteditor
806 return commiteditor
807
807
808 def loglimit(opts):
808 def loglimit(opts):
809 """get the log limit according to option -l/--limit"""
809 """get the log limit according to option -l/--limit"""
810 limit = opts.get('limit')
810 limit = opts.get('limit')
811 if limit:
811 if limit:
812 try:
812 try:
813 limit = int(limit)
813 limit = int(limit)
814 except ValueError:
814 except ValueError:
815 raise error.Abort(_('limit must be a positive integer'))
815 raise error.Abort(_('limit must be a positive integer'))
816 if limit <= 0:
816 if limit <= 0:
817 raise error.Abort(_('limit must be positive'))
817 raise error.Abort(_('limit must be positive'))
818 else:
818 else:
819 limit = None
819 limit = None
820 return limit
820 return limit
821
821
822 def makefilename(repo, pat, node, desc=None,
822 def makefilename(repo, pat, node, desc=None,
823 total=None, seqno=None, revwidth=None, pathname=None):
823 total=None, seqno=None, revwidth=None, pathname=None):
824 node_expander = {
824 node_expander = {
825 'H': lambda: hex(node),
825 'H': lambda: hex(node),
826 'R': lambda: '%d' % repo.changelog.rev(node),
826 'R': lambda: '%d' % repo.changelog.rev(node),
827 'h': lambda: short(node),
827 'h': lambda: short(node),
828 'm': lambda: re.sub('[^\w]', '_', desc or '')
828 'm': lambda: re.sub('[^\w]', '_', desc or '')
829 }
829 }
830 expander = {
830 expander = {
831 '%': lambda: '%',
831 '%': lambda: '%',
832 'b': lambda: os.path.basename(repo.root),
832 'b': lambda: os.path.basename(repo.root),
833 }
833 }
834
834
835 try:
835 try:
836 if node:
836 if node:
837 expander.update(node_expander)
837 expander.update(node_expander)
838 if node:
838 if node:
839 expander['r'] = (lambda:
839 expander['r'] = (lambda:
840 ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
840 ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
841 if total is not None:
841 if total is not None:
842 expander['N'] = lambda: '%d' % total
842 expander['N'] = lambda: '%d' % total
843 if seqno is not None:
843 if seqno is not None:
844 expander['n'] = lambda: '%d' % seqno
844 expander['n'] = lambda: '%d' % seqno
845 if total is not None and seqno is not None:
845 if total is not None and seqno is not None:
846 expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
846 expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
847 if pathname is not None:
847 if pathname is not None:
848 expander['s'] = lambda: os.path.basename(pathname)
848 expander['s'] = lambda: os.path.basename(pathname)
849 expander['d'] = lambda: os.path.dirname(pathname) or '.'
849 expander['d'] = lambda: os.path.dirname(pathname) or '.'
850 expander['p'] = lambda: pathname
850 expander['p'] = lambda: pathname
851
851
852 newname = []
852 newname = []
853 patlen = len(pat)
853 patlen = len(pat)
854 i = 0
854 i = 0
855 while i < patlen:
855 while i < patlen:
856 c = pat[i:i + 1]
856 c = pat[i:i + 1]
857 if c == '%':
857 if c == '%':
858 i += 1
858 i += 1
859 c = pat[i:i + 1]
859 c = pat[i:i + 1]
860 c = expander[c]()
860 c = expander[c]()
861 newname.append(c)
861 newname.append(c)
862 i += 1
862 i += 1
863 return ''.join(newname)
863 return ''.join(newname)
864 except KeyError as inst:
864 except KeyError as inst:
865 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
865 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
866 inst.args[0])
866 inst.args[0])
867
867
868 def isstdiofilename(pat):
868 def isstdiofilename(pat):
869 """True if the given pat looks like a filename denoting stdin/stdout"""
869 """True if the given pat looks like a filename denoting stdin/stdout"""
870 return not pat or pat == '-'
870 return not pat or pat == '-'
871
871
872 class _unclosablefile(object):
872 class _unclosablefile(object):
873 def __init__(self, fp):
873 def __init__(self, fp):
874 self._fp = fp
874 self._fp = fp
875
875
876 def close(self):
876 def close(self):
877 pass
877 pass
878
878
879 def __iter__(self):
879 def __iter__(self):
880 return iter(self._fp)
880 return iter(self._fp)
881
881
882 def __getattr__(self, attr):
882 def __getattr__(self, attr):
883 return getattr(self._fp, attr)
883 return getattr(self._fp, attr)
884
884
885 def __enter__(self):
885 def __enter__(self):
886 return self
886 return self
887
887
888 def __exit__(self, exc_type, exc_value, exc_tb):
888 def __exit__(self, exc_type, exc_value, exc_tb):
889 pass
889 pass
890
890
891 def makefileobj(repo, pat, node=None, desc=None, total=None,
891 def makefileobj(repo, pat, node=None, desc=None, total=None,
892 seqno=None, revwidth=None, mode='wb', modemap=None,
892 seqno=None, revwidth=None, mode='wb', modemap=None,
893 pathname=None):
893 pathname=None):
894
894
895 writable = mode not in ('r', 'rb')
895 writable = mode not in ('r', 'rb')
896
896
897 if isstdiofilename(pat):
897 if isstdiofilename(pat):
898 if writable:
898 if writable:
899 fp = repo.ui.fout
899 fp = repo.ui.fout
900 else:
900 else:
901 fp = repo.ui.fin
901 fp = repo.ui.fin
902 return _unclosablefile(fp)
902 return _unclosablefile(fp)
903 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
903 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
904 if modemap is not None:
904 if modemap is not None:
905 mode = modemap.get(fn, mode)
905 mode = modemap.get(fn, mode)
906 if mode == 'wb':
906 if mode == 'wb':
907 modemap[fn] = 'ab'
907 modemap[fn] = 'ab'
908 return open(fn, mode)
908 return open(fn, mode)
909
909
910 def openrevlog(repo, cmd, file_, opts):
910 def openrevlog(repo, cmd, file_, opts):
911 """opens the changelog, manifest, a filelog or a given revlog"""
911 """opens the changelog, manifest, a filelog or a given revlog"""
912 cl = opts['changelog']
912 cl = opts['changelog']
913 mf = opts['manifest']
913 mf = opts['manifest']
914 dir = opts['dir']
914 dir = opts['dir']
915 msg = None
915 msg = None
916 if cl and mf:
916 if cl and mf:
917 msg = _('cannot specify --changelog and --manifest at the same time')
917 msg = _('cannot specify --changelog and --manifest at the same time')
918 elif cl and dir:
918 elif cl and dir:
919 msg = _('cannot specify --changelog and --dir at the same time')
919 msg = _('cannot specify --changelog and --dir at the same time')
920 elif cl or mf or dir:
920 elif cl or mf or dir:
921 if file_:
921 if file_:
922 msg = _('cannot specify filename with --changelog or --manifest')
922 msg = _('cannot specify filename with --changelog or --manifest')
923 elif not repo:
923 elif not repo:
924 msg = _('cannot specify --changelog or --manifest or --dir '
924 msg = _('cannot specify --changelog or --manifest or --dir '
925 'without a repository')
925 'without a repository')
926 if msg:
926 if msg:
927 raise error.Abort(msg)
927 raise error.Abort(msg)
928
928
929 r = None
929 r = None
930 if repo:
930 if repo:
931 if cl:
931 if cl:
932 r = repo.unfiltered().changelog
932 r = repo.unfiltered().changelog
933 elif dir:
933 elif dir:
934 if 'treemanifest' not in repo.requirements:
934 if 'treemanifest' not in repo.requirements:
935 raise error.Abort(_("--dir can only be used on repos with "
935 raise error.Abort(_("--dir can only be used on repos with "
936 "treemanifest enabled"))
936 "treemanifest enabled"))
937 dirlog = repo.manifestlog._revlog.dirlog(dir)
937 dirlog = repo.manifestlog._revlog.dirlog(dir)
938 if len(dirlog):
938 if len(dirlog):
939 r = dirlog
939 r = dirlog
940 elif mf:
940 elif mf:
941 r = repo.manifestlog._revlog
941 r = repo.manifestlog._revlog
942 elif file_:
942 elif file_:
943 filelog = repo.file(file_)
943 filelog = repo.file(file_)
944 if len(filelog):
944 if len(filelog):
945 r = filelog
945 r = filelog
946 if not r:
946 if not r:
947 if not file_:
947 if not file_:
948 raise error.CommandError(cmd, _('invalid arguments'))
948 raise error.CommandError(cmd, _('invalid arguments'))
949 if not os.path.isfile(file_):
949 if not os.path.isfile(file_):
950 raise error.Abort(_("revlog '%s' not found") % file_)
950 raise error.Abort(_("revlog '%s' not found") % file_)
951 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
951 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
952 file_[:-2] + ".i")
952 file_[:-2] + ".i")
953 return r
953 return r
954
954
955 def copy(ui, repo, pats, opts, rename=False):
955 def copy(ui, repo, pats, opts, rename=False):
956 # called with the repo lock held
956 # called with the repo lock held
957 #
957 #
958 # hgsep => pathname that uses "/" to separate directories
958 # hgsep => pathname that uses "/" to separate directories
959 # ossep => pathname that uses os.sep to separate directories
959 # ossep => pathname that uses os.sep to separate directories
960 cwd = repo.getcwd()
960 cwd = repo.getcwd()
961 targets = {}
961 targets = {}
962 after = opts.get("after")
962 after = opts.get("after")
963 dryrun = opts.get("dry_run")
963 dryrun = opts.get("dry_run")
964 wctx = repo[None]
964 wctx = repo[None]
965
965
966 def walkpat(pat):
966 def walkpat(pat):
967 srcs = []
967 srcs = []
968 if after:
968 if after:
969 badstates = '?'
969 badstates = '?'
970 else:
970 else:
971 badstates = '?r'
971 badstates = '?r'
972 m = scmutil.match(wctx, [pat], opts, globbed=True)
972 m = scmutil.match(wctx, [pat], opts, globbed=True)
973 for abs in wctx.walk(m):
973 for abs in wctx.walk(m):
974 state = repo.dirstate[abs]
974 state = repo.dirstate[abs]
975 rel = m.rel(abs)
975 rel = m.rel(abs)
976 exact = m.exact(abs)
976 exact = m.exact(abs)
977 if state in badstates:
977 if state in badstates:
978 if exact and state == '?':
978 if exact and state == '?':
979 ui.warn(_('%s: not copying - file is not managed\n') % rel)
979 ui.warn(_('%s: not copying - file is not managed\n') % rel)
980 if exact and state == 'r':
980 if exact and state == 'r':
981 ui.warn(_('%s: not copying - file has been marked for'
981 ui.warn(_('%s: not copying - file has been marked for'
982 ' remove\n') % rel)
982 ' remove\n') % rel)
983 continue
983 continue
984 # abs: hgsep
984 # abs: hgsep
985 # rel: ossep
985 # rel: ossep
986 srcs.append((abs, rel, exact))
986 srcs.append((abs, rel, exact))
987 return srcs
987 return srcs
988
988
989 # abssrc: hgsep
989 # abssrc: hgsep
990 # relsrc: ossep
990 # relsrc: ossep
991 # otarget: ossep
991 # otarget: ossep
992 def copyfile(abssrc, relsrc, otarget, exact):
992 def copyfile(abssrc, relsrc, otarget, exact):
993 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
993 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
994 if '/' in abstarget:
994 if '/' in abstarget:
995 # We cannot normalize abstarget itself, this would prevent
995 # We cannot normalize abstarget itself, this would prevent
996 # case only renames, like a => A.
996 # case only renames, like a => A.
997 abspath, absname = abstarget.rsplit('/', 1)
997 abspath, absname = abstarget.rsplit('/', 1)
998 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
998 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
999 reltarget = repo.pathto(abstarget, cwd)
999 reltarget = repo.pathto(abstarget, cwd)
1000 target = repo.wjoin(abstarget)
1000 target = repo.wjoin(abstarget)
1001 src = repo.wjoin(abssrc)
1001 src = repo.wjoin(abssrc)
1002 state = repo.dirstate[abstarget]
1002 state = repo.dirstate[abstarget]
1003
1003
1004 scmutil.checkportable(ui, abstarget)
1004 scmutil.checkportable(ui, abstarget)
1005
1005
1006 # check for collisions
1006 # check for collisions
1007 prevsrc = targets.get(abstarget)
1007 prevsrc = targets.get(abstarget)
1008 if prevsrc is not None:
1008 if prevsrc is not None:
1009 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1009 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1010 (reltarget, repo.pathto(abssrc, cwd),
1010 (reltarget, repo.pathto(abssrc, cwd),
1011 repo.pathto(prevsrc, cwd)))
1011 repo.pathto(prevsrc, cwd)))
1012 return
1012 return
1013
1013
1014 # check for overwrites
1014 # check for overwrites
1015 exists = os.path.lexists(target)
1015 exists = os.path.lexists(target)
1016 samefile = False
1016 samefile = False
1017 if exists and abssrc != abstarget:
1017 if exists and abssrc != abstarget:
1018 if (repo.dirstate.normalize(abssrc) ==
1018 if (repo.dirstate.normalize(abssrc) ==
1019 repo.dirstate.normalize(abstarget)):
1019 repo.dirstate.normalize(abstarget)):
1020 if not rename:
1020 if not rename:
1021 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1021 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1022 return
1022 return
1023 exists = False
1023 exists = False
1024 samefile = True
1024 samefile = True
1025
1025
1026 if not after and exists or after and state in 'mn':
1026 if not after and exists or after and state in 'mn':
1027 if not opts['force']:
1027 if not opts['force']:
1028 if state in 'mn':
1028 if state in 'mn':
1029 msg = _('%s: not overwriting - file already committed\n')
1029 msg = _('%s: not overwriting - file already committed\n')
1030 if after:
1030 if after:
1031 flags = '--after --force'
1031 flags = '--after --force'
1032 else:
1032 else:
1033 flags = '--force'
1033 flags = '--force'
1034 if rename:
1034 if rename:
1035 hint = _('(hg rename %s to replace the file by '
1035 hint = _('(hg rename %s to replace the file by '
1036 'recording a rename)\n') % flags
1036 'recording a rename)\n') % flags
1037 else:
1037 else:
1038 hint = _('(hg copy %s to replace the file by '
1038 hint = _('(hg copy %s to replace the file by '
1039 'recording a copy)\n') % flags
1039 'recording a copy)\n') % flags
1040 else:
1040 else:
1041 msg = _('%s: not overwriting - file exists\n')
1041 msg = _('%s: not overwriting - file exists\n')
1042 if rename:
1042 if rename:
1043 hint = _('(hg rename --after to record the rename)\n')
1043 hint = _('(hg rename --after to record the rename)\n')
1044 else:
1044 else:
1045 hint = _('(hg copy --after to record the copy)\n')
1045 hint = _('(hg copy --after to record the copy)\n')
1046 ui.warn(msg % reltarget)
1046 ui.warn(msg % reltarget)
1047 ui.warn(hint)
1047 ui.warn(hint)
1048 return
1048 return
1049
1049
1050 if after:
1050 if after:
1051 if not exists:
1051 if not exists:
1052 if rename:
1052 if rename:
1053 ui.warn(_('%s: not recording move - %s does not exist\n') %
1053 ui.warn(_('%s: not recording move - %s does not exist\n') %
1054 (relsrc, reltarget))
1054 (relsrc, reltarget))
1055 else:
1055 else:
1056 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1056 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1057 (relsrc, reltarget))
1057 (relsrc, reltarget))
1058 return
1058 return
1059 elif not dryrun:
1059 elif not dryrun:
1060 try:
1060 try:
1061 if exists:
1061 if exists:
1062 os.unlink(target)
1062 os.unlink(target)
1063 targetdir = os.path.dirname(target) or '.'
1063 targetdir = os.path.dirname(target) or '.'
1064 if not os.path.isdir(targetdir):
1064 if not os.path.isdir(targetdir):
1065 os.makedirs(targetdir)
1065 os.makedirs(targetdir)
1066 if samefile:
1066 if samefile:
1067 tmp = target + "~hgrename"
1067 tmp = target + "~hgrename"
1068 os.rename(src, tmp)
1068 os.rename(src, tmp)
1069 os.rename(tmp, target)
1069 os.rename(tmp, target)
1070 else:
1070 else:
1071 util.copyfile(src, target)
1071 util.copyfile(src, target)
1072 srcexists = True
1072 srcexists = True
1073 except IOError as inst:
1073 except IOError as inst:
1074 if inst.errno == errno.ENOENT:
1074 if inst.errno == errno.ENOENT:
1075 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1075 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1076 srcexists = False
1076 srcexists = False
1077 else:
1077 else:
1078 ui.warn(_('%s: cannot copy - %s\n') %
1078 ui.warn(_('%s: cannot copy - %s\n') %
1079 (relsrc, encoding.strtolocal(inst.strerror)))
1079 (relsrc, encoding.strtolocal(inst.strerror)))
1080 return True # report a failure
1080 return True # report a failure
1081
1081
1082 if ui.verbose or not exact:
1082 if ui.verbose or not exact:
1083 if rename:
1083 if rename:
1084 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1084 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1085 else:
1085 else:
1086 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1086 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1087
1087
1088 targets[abstarget] = abssrc
1088 targets[abstarget] = abssrc
1089
1089
1090 # fix up dirstate
1090 # fix up dirstate
1091 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1091 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1092 dryrun=dryrun, cwd=cwd)
1092 dryrun=dryrun, cwd=cwd)
1093 if rename and not dryrun:
1093 if rename and not dryrun:
1094 if not after and srcexists and not samefile:
1094 if not after and srcexists and not samefile:
1095 repo.wvfs.unlinkpath(abssrc)
1095 repo.wvfs.unlinkpath(abssrc)
1096 wctx.forget([abssrc])
1096 wctx.forget([abssrc])
1097
1097
1098 # pat: ossep
1098 # pat: ossep
1099 # dest ossep
1099 # dest ossep
1100 # srcs: list of (hgsep, hgsep, ossep, bool)
1100 # srcs: list of (hgsep, hgsep, ossep, bool)
1101 # return: function that takes hgsep and returns ossep
1101 # return: function that takes hgsep and returns ossep
1102 def targetpathfn(pat, dest, srcs):
1102 def targetpathfn(pat, dest, srcs):
1103 if os.path.isdir(pat):
1103 if os.path.isdir(pat):
1104 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1104 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1105 abspfx = util.localpath(abspfx)
1105 abspfx = util.localpath(abspfx)
1106 if destdirexists:
1106 if destdirexists:
1107 striplen = len(os.path.split(abspfx)[0])
1107 striplen = len(os.path.split(abspfx)[0])
1108 else:
1108 else:
1109 striplen = len(abspfx)
1109 striplen = len(abspfx)
1110 if striplen:
1110 if striplen:
1111 striplen += len(pycompat.ossep)
1111 striplen += len(pycompat.ossep)
1112 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1112 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1113 elif destdirexists:
1113 elif destdirexists:
1114 res = lambda p: os.path.join(dest,
1114 res = lambda p: os.path.join(dest,
1115 os.path.basename(util.localpath(p)))
1115 os.path.basename(util.localpath(p)))
1116 else:
1116 else:
1117 res = lambda p: dest
1117 res = lambda p: dest
1118 return res
1118 return res
1119
1119
1120 # pat: ossep
1120 # pat: ossep
1121 # dest ossep
1121 # dest ossep
1122 # srcs: list of (hgsep, hgsep, ossep, bool)
1122 # srcs: list of (hgsep, hgsep, ossep, bool)
1123 # return: function that takes hgsep and returns ossep
1123 # return: function that takes hgsep and returns ossep
1124 def targetpathafterfn(pat, dest, srcs):
1124 def targetpathafterfn(pat, dest, srcs):
1125 if matchmod.patkind(pat):
1125 if matchmod.patkind(pat):
1126 # a mercurial pattern
1126 # a mercurial pattern
1127 res = lambda p: os.path.join(dest,
1127 res = lambda p: os.path.join(dest,
1128 os.path.basename(util.localpath(p)))
1128 os.path.basename(util.localpath(p)))
1129 else:
1129 else:
1130 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1130 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1131 if len(abspfx) < len(srcs[0][0]):
1131 if len(abspfx) < len(srcs[0][0]):
1132 # A directory. Either the target path contains the last
1132 # A directory. Either the target path contains the last
1133 # component of the source path or it does not.
1133 # component of the source path or it does not.
1134 def evalpath(striplen):
1134 def evalpath(striplen):
1135 score = 0
1135 score = 0
1136 for s in srcs:
1136 for s in srcs:
1137 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1137 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1138 if os.path.lexists(t):
1138 if os.path.lexists(t):
1139 score += 1
1139 score += 1
1140 return score
1140 return score
1141
1141
1142 abspfx = util.localpath(abspfx)
1142 abspfx = util.localpath(abspfx)
1143 striplen = len(abspfx)
1143 striplen = len(abspfx)
1144 if striplen:
1144 if striplen:
1145 striplen += len(pycompat.ossep)
1145 striplen += len(pycompat.ossep)
1146 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1146 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1147 score = evalpath(striplen)
1147 score = evalpath(striplen)
1148 striplen1 = len(os.path.split(abspfx)[0])
1148 striplen1 = len(os.path.split(abspfx)[0])
1149 if striplen1:
1149 if striplen1:
1150 striplen1 += len(pycompat.ossep)
1150 striplen1 += len(pycompat.ossep)
1151 if evalpath(striplen1) > score:
1151 if evalpath(striplen1) > score:
1152 striplen = striplen1
1152 striplen = striplen1
1153 res = lambda p: os.path.join(dest,
1153 res = lambda p: os.path.join(dest,
1154 util.localpath(p)[striplen:])
1154 util.localpath(p)[striplen:])
1155 else:
1155 else:
1156 # a file
1156 # a file
1157 if destdirexists:
1157 if destdirexists:
1158 res = lambda p: os.path.join(dest,
1158 res = lambda p: os.path.join(dest,
1159 os.path.basename(util.localpath(p)))
1159 os.path.basename(util.localpath(p)))
1160 else:
1160 else:
1161 res = lambda p: dest
1161 res = lambda p: dest
1162 return res
1162 return res
1163
1163
1164 pats = scmutil.expandpats(pats)
1164 pats = scmutil.expandpats(pats)
1165 if not pats:
1165 if not pats:
1166 raise error.Abort(_('no source or destination specified'))
1166 raise error.Abort(_('no source or destination specified'))
1167 if len(pats) == 1:
1167 if len(pats) == 1:
1168 raise error.Abort(_('no destination specified'))
1168 raise error.Abort(_('no destination specified'))
1169 dest = pats.pop()
1169 dest = pats.pop()
1170 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1170 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1171 if not destdirexists:
1171 if not destdirexists:
1172 if len(pats) > 1 or matchmod.patkind(pats[0]):
1172 if len(pats) > 1 or matchmod.patkind(pats[0]):
1173 raise error.Abort(_('with multiple sources, destination must be an '
1173 raise error.Abort(_('with multiple sources, destination must be an '
1174 'existing directory'))
1174 'existing directory'))
1175 if util.endswithsep(dest):
1175 if util.endswithsep(dest):
1176 raise error.Abort(_('destination %s is not a directory') % dest)
1176 raise error.Abort(_('destination %s is not a directory') % dest)
1177
1177
1178 tfn = targetpathfn
1178 tfn = targetpathfn
1179 if after:
1179 if after:
1180 tfn = targetpathafterfn
1180 tfn = targetpathafterfn
1181 copylist = []
1181 copylist = []
1182 for pat in pats:
1182 for pat in pats:
1183 srcs = walkpat(pat)
1183 srcs = walkpat(pat)
1184 if not srcs:
1184 if not srcs:
1185 continue
1185 continue
1186 copylist.append((tfn(pat, dest, srcs), srcs))
1186 copylist.append((tfn(pat, dest, srcs), srcs))
1187 if not copylist:
1187 if not copylist:
1188 raise error.Abort(_('no files to copy'))
1188 raise error.Abort(_('no files to copy'))
1189
1189
1190 errors = 0
1190 errors = 0
1191 for targetpath, srcs in copylist:
1191 for targetpath, srcs in copylist:
1192 for abssrc, relsrc, exact in srcs:
1192 for abssrc, relsrc, exact in srcs:
1193 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1193 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1194 errors += 1
1194 errors += 1
1195
1195
1196 if errors:
1196 if errors:
1197 ui.warn(_('(consider using --after)\n'))
1197 ui.warn(_('(consider using --after)\n'))
1198
1198
1199 return errors != 0
1199 return errors != 0
1200
1200
1201 ## facility to let extension process additional data into an import patch
1201 ## facility to let extension process additional data into an import patch
1202 # list of identifier to be executed in order
1202 # list of identifier to be executed in order
1203 extrapreimport = [] # run before commit
1203 extrapreimport = [] # run before commit
1204 extrapostimport = [] # run after commit
1204 extrapostimport = [] # run after commit
1205 # mapping from identifier to actual import function
1205 # mapping from identifier to actual import function
1206 #
1206 #
1207 # 'preimport' are run before the commit is made and are provided the following
1207 # 'preimport' are run before the commit is made and are provided the following
1208 # arguments:
1208 # arguments:
1209 # - repo: the localrepository instance,
1209 # - repo: the localrepository instance,
1210 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1210 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1211 # - extra: the future extra dictionary of the changeset, please mutate it,
1211 # - extra: the future extra dictionary of the changeset, please mutate it,
1212 # - opts: the import options.
1212 # - opts: the import options.
1213 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1213 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1214 # mutation of in memory commit and more. Feel free to rework the code to get
1214 # mutation of in memory commit and more. Feel free to rework the code to get
1215 # there.
1215 # there.
1216 extrapreimportmap = {}
1216 extrapreimportmap = {}
1217 # 'postimport' are run after the commit is made and are provided the following
1217 # 'postimport' are run after the commit is made and are provided the following
1218 # argument:
1218 # argument:
1219 # - ctx: the changectx created by import.
1219 # - ctx: the changectx created by import.
1220 extrapostimportmap = {}
1220 extrapostimportmap = {}
1221
1221
1222 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1222 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1223 """Utility function used by commands.import to import a single patch
1223 """Utility function used by commands.import to import a single patch
1224
1224
1225 This function is explicitly defined here to help the evolve extension to
1225 This function is explicitly defined here to help the evolve extension to
1226 wrap this part of the import logic.
1226 wrap this part of the import logic.
1227
1227
1228 The API is currently a bit ugly because it a simple code translation from
1228 The API is currently a bit ugly because it a simple code translation from
1229 the import command. Feel free to make it better.
1229 the import command. Feel free to make it better.
1230
1230
1231 :hunk: a patch (as a binary string)
1231 :hunk: a patch (as a binary string)
1232 :parents: nodes that will be parent of the created commit
1232 :parents: nodes that will be parent of the created commit
1233 :opts: the full dict of option passed to the import command
1233 :opts: the full dict of option passed to the import command
1234 :msgs: list to save commit message to.
1234 :msgs: list to save commit message to.
1235 (used in case we need to save it when failing)
1235 (used in case we need to save it when failing)
1236 :updatefunc: a function that update a repo to a given node
1236 :updatefunc: a function that update a repo to a given node
1237 updatefunc(<repo>, <node>)
1237 updatefunc(<repo>, <node>)
1238 """
1238 """
1239 # avoid cycle context -> subrepo -> cmdutil
1239 # avoid cycle context -> subrepo -> cmdutil
1240 from . import context
1240 from . import context
1241 extractdata = patch.extract(ui, hunk)
1241 extractdata = patch.extract(ui, hunk)
1242 tmpname = extractdata.get('filename')
1242 tmpname = extractdata.get('filename')
1243 message = extractdata.get('message')
1243 message = extractdata.get('message')
1244 user = opts.get('user') or extractdata.get('user')
1244 user = opts.get('user') or extractdata.get('user')
1245 date = opts.get('date') or extractdata.get('date')
1245 date = opts.get('date') or extractdata.get('date')
1246 branch = extractdata.get('branch')
1246 branch = extractdata.get('branch')
1247 nodeid = extractdata.get('nodeid')
1247 nodeid = extractdata.get('nodeid')
1248 p1 = extractdata.get('p1')
1248 p1 = extractdata.get('p1')
1249 p2 = extractdata.get('p2')
1249 p2 = extractdata.get('p2')
1250
1250
1251 nocommit = opts.get('no_commit')
1251 nocommit = opts.get('no_commit')
1252 importbranch = opts.get('import_branch')
1252 importbranch = opts.get('import_branch')
1253 update = not opts.get('bypass')
1253 update = not opts.get('bypass')
1254 strip = opts["strip"]
1254 strip = opts["strip"]
1255 prefix = opts["prefix"]
1255 prefix = opts["prefix"]
1256 sim = float(opts.get('similarity') or 0)
1256 sim = float(opts.get('similarity') or 0)
1257 if not tmpname:
1257 if not tmpname:
1258 return (None, None, False)
1258 return (None, None, False)
1259
1259
1260 rejects = False
1260 rejects = False
1261
1261
1262 try:
1262 try:
1263 cmdline_message = logmessage(ui, opts)
1263 cmdline_message = logmessage(ui, opts)
1264 if cmdline_message:
1264 if cmdline_message:
1265 # pickup the cmdline msg
1265 # pickup the cmdline msg
1266 message = cmdline_message
1266 message = cmdline_message
1267 elif message:
1267 elif message:
1268 # pickup the patch msg
1268 # pickup the patch msg
1269 message = message.strip()
1269 message = message.strip()
1270 else:
1270 else:
1271 # launch the editor
1271 # launch the editor
1272 message = None
1272 message = None
1273 ui.debug('message:\n%s\n' % message)
1273 ui.debug('message:\n%s\n' % message)
1274
1274
1275 if len(parents) == 1:
1275 if len(parents) == 1:
1276 parents.append(repo[nullid])
1276 parents.append(repo[nullid])
1277 if opts.get('exact'):
1277 if opts.get('exact'):
1278 if not nodeid or not p1:
1278 if not nodeid or not p1:
1279 raise error.Abort(_('not a Mercurial patch'))
1279 raise error.Abort(_('not a Mercurial patch'))
1280 p1 = repo[p1]
1280 p1 = repo[p1]
1281 p2 = repo[p2 or nullid]
1281 p2 = repo[p2 or nullid]
1282 elif p2:
1282 elif p2:
1283 try:
1283 try:
1284 p1 = repo[p1]
1284 p1 = repo[p1]
1285 p2 = repo[p2]
1285 p2 = repo[p2]
1286 # Without any options, consider p2 only if the
1286 # Without any options, consider p2 only if the
1287 # patch is being applied on top of the recorded
1287 # patch is being applied on top of the recorded
1288 # first parent.
1288 # first parent.
1289 if p1 != parents[0]:
1289 if p1 != parents[0]:
1290 p1 = parents[0]
1290 p1 = parents[0]
1291 p2 = repo[nullid]
1291 p2 = repo[nullid]
1292 except error.RepoError:
1292 except error.RepoError:
1293 p1, p2 = parents
1293 p1, p2 = parents
1294 if p2.node() == nullid:
1294 if p2.node() == nullid:
1295 ui.warn(_("warning: import the patch as a normal revision\n"
1295 ui.warn(_("warning: import the patch as a normal revision\n"
1296 "(use --exact to import the patch as a merge)\n"))
1296 "(use --exact to import the patch as a merge)\n"))
1297 else:
1297 else:
1298 p1, p2 = parents
1298 p1, p2 = parents
1299
1299
1300 n = None
1300 n = None
1301 if update:
1301 if update:
1302 if p1 != parents[0]:
1302 if p1 != parents[0]:
1303 updatefunc(repo, p1.node())
1303 updatefunc(repo, p1.node())
1304 if p2 != parents[1]:
1304 if p2 != parents[1]:
1305 repo.setparents(p1.node(), p2.node())
1305 repo.setparents(p1.node(), p2.node())
1306
1306
1307 if opts.get('exact') or importbranch:
1307 if opts.get('exact') or importbranch:
1308 repo.dirstate.setbranch(branch or 'default')
1308 repo.dirstate.setbranch(branch or 'default')
1309
1309
1310 partial = opts.get('partial', False)
1310 partial = opts.get('partial', False)
1311 files = set()
1311 files = set()
1312 try:
1312 try:
1313 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1313 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1314 files=files, eolmode=None, similarity=sim / 100.0)
1314 files=files, eolmode=None, similarity=sim / 100.0)
1315 except error.PatchError as e:
1315 except error.PatchError as e:
1316 if not partial:
1316 if not partial:
1317 raise error.Abort(str(e))
1317 raise error.Abort(str(e))
1318 if partial:
1318 if partial:
1319 rejects = True
1319 rejects = True
1320
1320
1321 files = list(files)
1321 files = list(files)
1322 if nocommit:
1322 if nocommit:
1323 if message:
1323 if message:
1324 msgs.append(message)
1324 msgs.append(message)
1325 else:
1325 else:
1326 if opts.get('exact') or p2:
1326 if opts.get('exact') or p2:
1327 # If you got here, you either use --force and know what
1327 # If you got here, you either use --force and know what
1328 # you are doing or used --exact or a merge patch while
1328 # you are doing or used --exact or a merge patch while
1329 # being updated to its first parent.
1329 # being updated to its first parent.
1330 m = None
1330 m = None
1331 else:
1331 else:
1332 m = scmutil.matchfiles(repo, files or [])
1332 m = scmutil.matchfiles(repo, files or [])
1333 editform = mergeeditform(repo[None], 'import.normal')
1333 editform = mergeeditform(repo[None], 'import.normal')
1334 if opts.get('exact'):
1334 if opts.get('exact'):
1335 editor = None
1335 editor = None
1336 else:
1336 else:
1337 editor = getcommiteditor(editform=editform,
1337 editor = getcommiteditor(editform=editform,
1338 **pycompat.strkwargs(opts))
1338 **pycompat.strkwargs(opts))
1339 extra = {}
1339 extra = {}
1340 for idfunc in extrapreimport:
1340 for idfunc in extrapreimport:
1341 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1341 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1342 overrides = {}
1342 overrides = {}
1343 if partial:
1343 if partial:
1344 overrides[('ui', 'allowemptycommit')] = True
1344 overrides[('ui', 'allowemptycommit')] = True
1345 with repo.ui.configoverride(overrides, 'import'):
1345 with repo.ui.configoverride(overrides, 'import'):
1346 n = repo.commit(message, user,
1346 n = repo.commit(message, user,
1347 date, match=m,
1347 date, match=m,
1348 editor=editor, extra=extra)
1348 editor=editor, extra=extra)
1349 for idfunc in extrapostimport:
1349 for idfunc in extrapostimport:
1350 extrapostimportmap[idfunc](repo[n])
1350 extrapostimportmap[idfunc](repo[n])
1351 else:
1351 else:
1352 if opts.get('exact') or importbranch:
1352 if opts.get('exact') or importbranch:
1353 branch = branch or 'default'
1353 branch = branch or 'default'
1354 else:
1354 else:
1355 branch = p1.branch()
1355 branch = p1.branch()
1356 store = patch.filestore()
1356 store = patch.filestore()
1357 try:
1357 try:
1358 files = set()
1358 files = set()
1359 try:
1359 try:
1360 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1360 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1361 files, eolmode=None)
1361 files, eolmode=None)
1362 except error.PatchError as e:
1362 except error.PatchError as e:
1363 raise error.Abort(str(e))
1363 raise error.Abort(str(e))
1364 if opts.get('exact'):
1364 if opts.get('exact'):
1365 editor = None
1365 editor = None
1366 else:
1366 else:
1367 editor = getcommiteditor(editform='import.bypass')
1367 editor = getcommiteditor(editform='import.bypass')
1368 memctx = context.memctx(repo, (p1.node(), p2.node()),
1368 memctx = context.memctx(repo, (p1.node(), p2.node()),
1369 message,
1369 message,
1370 files=files,
1370 files=files,
1371 filectxfn=store,
1371 filectxfn=store,
1372 user=user,
1372 user=user,
1373 date=date,
1373 date=date,
1374 branch=branch,
1374 branch=branch,
1375 editor=editor)
1375 editor=editor)
1376 n = memctx.commit()
1376 n = memctx.commit()
1377 finally:
1377 finally:
1378 store.close()
1378 store.close()
1379 if opts.get('exact') and nocommit:
1379 if opts.get('exact') and nocommit:
1380 # --exact with --no-commit is still useful in that it does merge
1380 # --exact with --no-commit is still useful in that it does merge
1381 # and branch bits
1381 # and branch bits
1382 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1382 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1383 elif opts.get('exact') and hex(n) != nodeid:
1383 elif opts.get('exact') and hex(n) != nodeid:
1384 raise error.Abort(_('patch is damaged or loses information'))
1384 raise error.Abort(_('patch is damaged or loses information'))
1385 msg = _('applied to working directory')
1385 msg = _('applied to working directory')
1386 if n:
1386 if n:
1387 # i18n: refers to a short changeset id
1387 # i18n: refers to a short changeset id
1388 msg = _('created %s') % short(n)
1388 msg = _('created %s') % short(n)
1389 return (msg, n, rejects)
1389 return (msg, n, rejects)
1390 finally:
1390 finally:
1391 os.unlink(tmpname)
1391 os.unlink(tmpname)
1392
1392
1393 # facility to let extensions include additional data in an exported patch
1393 # facility to let extensions include additional data in an exported patch
1394 # list of identifiers to be executed in order
1394 # list of identifiers to be executed in order
1395 extraexport = []
1395 extraexport = []
1396 # mapping from identifier to actual export function
1396 # mapping from identifier to actual export function
1397 # function as to return a string to be added to the header or None
1397 # function as to return a string to be added to the header or None
1398 # it is given two arguments (sequencenumber, changectx)
1398 # it is given two arguments (sequencenumber, changectx)
1399 extraexportmap = {}
1399 extraexportmap = {}
1400
1400
1401 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1401 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1402 node = scmutil.binnode(ctx)
1402 node = scmutil.binnode(ctx)
1403 parents = [p.node() for p in ctx.parents() if p]
1403 parents = [p.node() for p in ctx.parents() if p]
1404 branch = ctx.branch()
1404 branch = ctx.branch()
1405 if switch_parent:
1405 if switch_parent:
1406 parents.reverse()
1406 parents.reverse()
1407
1407
1408 if parents:
1408 if parents:
1409 prev = parents[0]
1409 prev = parents[0]
1410 else:
1410 else:
1411 prev = nullid
1411 prev = nullid
1412
1412
1413 write("# HG changeset patch\n")
1413 write("# HG changeset patch\n")
1414 write("# User %s\n" % ctx.user())
1414 write("# User %s\n" % ctx.user())
1415 write("# Date %d %d\n" % ctx.date())
1415 write("# Date %d %d\n" % ctx.date())
1416 write("# %s\n" % util.datestr(ctx.date()))
1416 write("# %s\n" % util.datestr(ctx.date()))
1417 if branch and branch != 'default':
1417 if branch and branch != 'default':
1418 write("# Branch %s\n" % branch)
1418 write("# Branch %s\n" % branch)
1419 write("# Node ID %s\n" % hex(node))
1419 write("# Node ID %s\n" % hex(node))
1420 write("# Parent %s\n" % hex(prev))
1420 write("# Parent %s\n" % hex(prev))
1421 if len(parents) > 1:
1421 if len(parents) > 1:
1422 write("# Parent %s\n" % hex(parents[1]))
1422 write("# Parent %s\n" % hex(parents[1]))
1423
1423
1424 for headerid in extraexport:
1424 for headerid in extraexport:
1425 header = extraexportmap[headerid](seqno, ctx)
1425 header = extraexportmap[headerid](seqno, ctx)
1426 if header is not None:
1426 if header is not None:
1427 write('# %s\n' % header)
1427 write('# %s\n' % header)
1428 write(ctx.description().rstrip())
1428 write(ctx.description().rstrip())
1429 write("\n\n")
1429 write("\n\n")
1430
1430
1431 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1431 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1432 write(chunk, label=label)
1432 write(chunk, label=label)
1433
1433
1434 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1434 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1435 opts=None, match=None):
1435 opts=None, match=None):
1436 '''export changesets as hg patches
1436 '''export changesets as hg patches
1437
1437
1438 Args:
1438 Args:
1439 repo: The repository from which we're exporting revisions.
1439 repo: The repository from which we're exporting revisions.
1440 revs: A list of revisions to export as revision numbers.
1440 revs: A list of revisions to export as revision numbers.
1441 fntemplate: An optional string to use for generating patch file names.
1441 fntemplate: An optional string to use for generating patch file names.
1442 fp: An optional file-like object to which patches should be written.
1442 fp: An optional file-like object to which patches should be written.
1443 switch_parent: If True, show diffs against second parent when not nullid.
1443 switch_parent: If True, show diffs against second parent when not nullid.
1444 Default is false, which always shows diff against p1.
1444 Default is false, which always shows diff against p1.
1445 opts: diff options to use for generating the patch.
1445 opts: diff options to use for generating the patch.
1446 match: If specified, only export changes to files matching this matcher.
1446 match: If specified, only export changes to files matching this matcher.
1447
1447
1448 Returns:
1448 Returns:
1449 Nothing.
1449 Nothing.
1450
1450
1451 Side Effect:
1451 Side Effect:
1452 "HG Changeset Patch" data is emitted to one of the following
1452 "HG Changeset Patch" data is emitted to one of the following
1453 destinations:
1453 destinations:
1454 fp is specified: All revs are written to the specified
1454 fp is specified: All revs are written to the specified
1455 file-like object.
1455 file-like object.
1456 fntemplate specified: Each rev is written to a unique file named using
1456 fntemplate specified: Each rev is written to a unique file named using
1457 the given template.
1457 the given template.
1458 Neither fp nor template specified: All revs written to repo.ui.write()
1458 Neither fp nor template specified: All revs written to repo.ui.write()
1459 '''
1459 '''
1460
1460
1461 total = len(revs)
1461 total = len(revs)
1462 revwidth = max(len(str(rev)) for rev in revs)
1462 revwidth = max(len(str(rev)) for rev in revs)
1463 filemode = {}
1463 filemode = {}
1464
1464
1465 write = None
1465 write = None
1466 dest = '<unnamed>'
1466 dest = '<unnamed>'
1467 if fp:
1467 if fp:
1468 dest = getattr(fp, 'name', dest)
1468 dest = getattr(fp, 'name', dest)
1469 def write(s, **kw):
1469 def write(s, **kw):
1470 fp.write(s)
1470 fp.write(s)
1471 elif not fntemplate:
1471 elif not fntemplate:
1472 write = repo.ui.write
1472 write = repo.ui.write
1473
1473
1474 for seqno, rev in enumerate(revs, 1):
1474 for seqno, rev in enumerate(revs, 1):
1475 ctx = repo[rev]
1475 ctx = repo[rev]
1476 fo = None
1476 fo = None
1477 if not fp and fntemplate:
1477 if not fp and fntemplate:
1478 desc_lines = ctx.description().rstrip().split('\n')
1478 desc_lines = ctx.description().rstrip().split('\n')
1479 desc = desc_lines[0] #Commit always has a first line.
1479 desc = desc_lines[0] #Commit always has a first line.
1480 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1480 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1481 total=total, seqno=seqno, revwidth=revwidth,
1481 total=total, seqno=seqno, revwidth=revwidth,
1482 mode='wb', modemap=filemode)
1482 mode='wb', modemap=filemode)
1483 dest = fo.name
1483 dest = fo.name
1484 def write(s, **kw):
1484 def write(s, **kw):
1485 fo.write(s)
1485 fo.write(s)
1486 if not dest.startswith('<'):
1486 if not dest.startswith('<'):
1487 repo.ui.note("%s\n" % dest)
1487 repo.ui.note("%s\n" % dest)
1488 _exportsingle(
1488 _exportsingle(
1489 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1489 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1490 if fo is not None:
1490 if fo is not None:
1491 fo.close()
1491 fo.close()
1492
1492
1493 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1493 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1494 changes=None, stat=False, fp=None, prefix='',
1494 changes=None, stat=False, fp=None, prefix='',
1495 root='', listsubrepos=False, hunksfilterfn=None):
1495 root='', listsubrepos=False, hunksfilterfn=None):
1496 '''show diff or diffstat.'''
1496 '''show diff or diffstat.'''
1497 if fp is None:
1497 if fp is None:
1498 write = ui.write
1498 write = ui.write
1499 else:
1499 else:
1500 def write(s, **kw):
1500 def write(s, **kw):
1501 fp.write(s)
1501 fp.write(s)
1502
1502
1503 if root:
1503 if root:
1504 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1504 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1505 else:
1505 else:
1506 relroot = ''
1506 relroot = ''
1507 if relroot != '':
1507 if relroot != '':
1508 # XXX relative roots currently don't work if the root is within a
1508 # XXX relative roots currently don't work if the root is within a
1509 # subrepo
1509 # subrepo
1510 uirelroot = match.uipath(relroot)
1510 uirelroot = match.uipath(relroot)
1511 relroot += '/'
1511 relroot += '/'
1512 for matchroot in match.files():
1512 for matchroot in match.files():
1513 if not matchroot.startswith(relroot):
1513 if not matchroot.startswith(relroot):
1514 ui.warn(_('warning: %s not inside relative root %s\n') % (
1514 ui.warn(_('warning: %s not inside relative root %s\n') % (
1515 match.uipath(matchroot), uirelroot))
1515 match.uipath(matchroot), uirelroot))
1516
1516
1517 if stat:
1517 if stat:
1518 diffopts = diffopts.copy(context=0, noprefix=False)
1518 diffopts = diffopts.copy(context=0, noprefix=False)
1519 width = 80
1519 width = 80
1520 if not ui.plain():
1520 if not ui.plain():
1521 width = ui.termwidth()
1521 width = ui.termwidth()
1522 chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
1522 chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
1523 prefix=prefix, relroot=relroot,
1523 prefix=prefix, relroot=relroot,
1524 hunksfilterfn=hunksfilterfn)
1524 hunksfilterfn=hunksfilterfn)
1525 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1525 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1526 width=width):
1526 width=width):
1527 write(chunk, label=label)
1527 write(chunk, label=label)
1528 else:
1528 else:
1529 for chunk, label in patch.diffui(repo, node1, node2, match,
1529 for chunk, label in patch.diffui(repo, node1, node2, match,
1530 changes, opts=diffopts, prefix=prefix,
1530 changes, opts=diffopts, prefix=prefix,
1531 relroot=relroot,
1531 relroot=relroot,
1532 hunksfilterfn=hunksfilterfn):
1532 hunksfilterfn=hunksfilterfn):
1533 write(chunk, label=label)
1533 write(chunk, label=label)
1534
1534
1535 if listsubrepos:
1535 if listsubrepos:
1536 ctx1 = repo[node1]
1536 ctx1 = repo[node1]
1537 ctx2 = repo[node2]
1537 ctx2 = repo[node2]
1538 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1538 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1539 tempnode2 = node2
1539 tempnode2 = node2
1540 try:
1540 try:
1541 if node2 is not None:
1541 if node2 is not None:
1542 tempnode2 = ctx2.substate[subpath][1]
1542 tempnode2 = ctx2.substate[subpath][1]
1543 except KeyError:
1543 except KeyError:
1544 # A subrepo that existed in node1 was deleted between node1 and
1544 # A subrepo that existed in node1 was deleted between node1 and
1545 # node2 (inclusive). Thus, ctx2's substate won't contain that
1545 # node2 (inclusive). Thus, ctx2's substate won't contain that
1546 # subpath. The best we can do is to ignore it.
1546 # subpath. The best we can do is to ignore it.
1547 tempnode2 = None
1547 tempnode2 = None
1548 submatch = matchmod.subdirmatcher(subpath, match)
1548 submatch = matchmod.subdirmatcher(subpath, match)
1549 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1549 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1550 stat=stat, fp=fp, prefix=prefix)
1550 stat=stat, fp=fp, prefix=prefix)
1551
1551
1552 def _changesetlabels(ctx):
1552 def _changesetlabels(ctx):
1553 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1553 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1554 if ctx.obsolete():
1554 if ctx.obsolete():
1555 labels.append('changeset.obsolete')
1555 labels.append('changeset.obsolete')
1556 if ctx.isunstable():
1556 if ctx.isunstable():
1557 labels.append('changeset.unstable')
1557 labels.append('changeset.unstable')
1558 for instability in ctx.instabilities():
1558 for instability in ctx.instabilities():
1559 labels.append('instability.%s' % instability)
1559 labels.append('instability.%s' % instability)
1560 return ' '.join(labels)
1560 return ' '.join(labels)
1561
1561
1562 class changeset_printer(object):
1562 class changeset_printer(object):
1563 '''show changeset information when templating not requested.'''
1563 '''show changeset information when templating not requested.'''
1564
1564
1565 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1565 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1566 self.ui = ui
1566 self.ui = ui
1567 self.repo = repo
1567 self.repo = repo
1568 self.buffered = buffered
1568 self.buffered = buffered
1569 self.matchfn = matchfn
1569 self.matchfn = matchfn
1570 self.diffopts = diffopts
1570 self.diffopts = diffopts
1571 self.header = {}
1571 self.header = {}
1572 self.hunk = {}
1572 self.hunk = {}
1573 self.lastheader = None
1573 self.lastheader = None
1574 self.footer = None
1574 self.footer = None
1575 self._columns = templatekw.getlogcolumns()
1575 self._columns = templatekw.getlogcolumns()
1576
1576
1577 def flush(self, ctx):
1577 def flush(self, ctx):
1578 rev = ctx.rev()
1578 rev = ctx.rev()
1579 if rev in self.header:
1579 if rev in self.header:
1580 h = self.header[rev]
1580 h = self.header[rev]
1581 if h != self.lastheader:
1581 if h != self.lastheader:
1582 self.lastheader = h
1582 self.lastheader = h
1583 self.ui.write(h)
1583 self.ui.write(h)
1584 del self.header[rev]
1584 del self.header[rev]
1585 if rev in self.hunk:
1585 if rev in self.hunk:
1586 self.ui.write(self.hunk[rev])
1586 self.ui.write(self.hunk[rev])
1587 del self.hunk[rev]
1587 del self.hunk[rev]
1588
1588
1589 def close(self):
1589 def close(self):
1590 if self.footer:
1590 if self.footer:
1591 self.ui.write(self.footer)
1591 self.ui.write(self.footer)
1592
1592
1593 def show(self, ctx, copies=None, matchfn=None, hunksfilterfn=None,
1593 def show(self, ctx, copies=None, matchfn=None, hunksfilterfn=None,
1594 **props):
1594 **props):
1595 props = pycompat.byteskwargs(props)
1595 props = pycompat.byteskwargs(props)
1596 if self.buffered:
1596 if self.buffered:
1597 self.ui.pushbuffer(labeled=True)
1597 self.ui.pushbuffer(labeled=True)
1598 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1598 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1599 self.hunk[ctx.rev()] = self.ui.popbuffer()
1599 self.hunk[ctx.rev()] = self.ui.popbuffer()
1600 else:
1600 else:
1601 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1601 self._show(ctx, copies, matchfn, hunksfilterfn, props)
1602
1602
1603 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1603 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1604 '''show a single changeset or file revision'''
1604 '''show a single changeset or file revision'''
1605 changenode = ctx.node()
1605 changenode = ctx.node()
1606 rev = ctx.rev()
1606 rev = ctx.rev()
1607
1607
1608 if self.ui.quiet:
1608 if self.ui.quiet:
1609 self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
1609 self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
1610 label='log.node')
1610 label='log.node')
1611 return
1611 return
1612
1612
1613 columns = self._columns
1613 columns = self._columns
1614 self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx),
1614 self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx),
1615 label=_changesetlabels(ctx))
1615 label=_changesetlabels(ctx))
1616
1616
1617 # branches are shown first before any other names due to backwards
1617 # branches are shown first before any other names due to backwards
1618 # compatibility
1618 # compatibility
1619 branch = ctx.branch()
1619 branch = ctx.branch()
1620 # don't show the default branch name
1620 # don't show the default branch name
1621 if branch != 'default':
1621 if branch != 'default':
1622 self.ui.write(columns['branch'] % branch, label='log.branch')
1622 self.ui.write(columns['branch'] % branch, label='log.branch')
1623
1623
1624 for nsname, ns in self.repo.names.iteritems():
1624 for nsname, ns in self.repo.names.iteritems():
1625 # branches has special logic already handled above, so here we just
1625 # branches has special logic already handled above, so here we just
1626 # skip it
1626 # skip it
1627 if nsname == 'branches':
1627 if nsname == 'branches':
1628 continue
1628 continue
1629 # we will use the templatename as the color name since those two
1629 # we will use the templatename as the color name since those two
1630 # should be the same
1630 # should be the same
1631 for name in ns.names(self.repo, changenode):
1631 for name in ns.names(self.repo, changenode):
1632 self.ui.write(ns.logfmt % name,
1632 self.ui.write(ns.logfmt % name,
1633 label='log.%s' % ns.colorname)
1633 label='log.%s' % ns.colorname)
1634 if self.ui.debugflag:
1634 if self.ui.debugflag:
1635 self.ui.write(columns['phase'] % ctx.phasestr(), label='log.phase')
1635 self.ui.write(columns['phase'] % ctx.phasestr(), label='log.phase')
1636 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1636 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1637 label = 'log.parent changeset.%s' % pctx.phasestr()
1637 label = 'log.parent changeset.%s' % pctx.phasestr()
1638 self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
1638 self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
1639 label=label)
1639 label=label)
1640
1640
1641 if self.ui.debugflag and rev is not None:
1641 if self.ui.debugflag and rev is not None:
1642 mnode = ctx.manifestnode()
1642 mnode = ctx.manifestnode()
1643 mrev = self.repo.manifestlog._revlog.rev(mnode)
1643 mrev = self.repo.manifestlog._revlog.rev(mnode)
1644 self.ui.write(columns['manifest']
1644 self.ui.write(columns['manifest']
1645 % scmutil.formatrevnode(self.ui, mrev, mnode),
1645 % scmutil.formatrevnode(self.ui, mrev, mnode),
1646 label='ui.debug log.manifest')
1646 label='ui.debug log.manifest')
1647 self.ui.write(columns['user'] % ctx.user(), label='log.user')
1647 self.ui.write(columns['user'] % ctx.user(), label='log.user')
1648 self.ui.write(columns['date'] % util.datestr(ctx.date()),
1648 self.ui.write(columns['date'] % util.datestr(ctx.date()),
1649 label='log.date')
1649 label='log.date')
1650
1650
1651 if ctx.isunstable():
1651 if ctx.isunstable():
1652 instabilities = ctx.instabilities()
1652 instabilities = ctx.instabilities()
1653 self.ui.write(columns['instability'] % ', '.join(instabilities),
1653 self.ui.write(columns['instability'] % ', '.join(instabilities),
1654 label='log.instability')
1654 label='log.instability')
1655
1655
1656 elif ctx.obsolete():
1656 elif ctx.obsolete():
1657 self._showobsfate(ctx)
1657 self._showobsfate(ctx)
1658
1658
1659 self._exthook(ctx)
1659 self._exthook(ctx)
1660
1660
1661 if self.ui.debugflag:
1661 if self.ui.debugflag:
1662 files = ctx.p1().status(ctx)[:3]
1662 files = ctx.p1().status(ctx)[:3]
1663 for key, value in zip(['files', 'files+', 'files-'], files):
1663 for key, value in zip(['files', 'files+', 'files-'], files):
1664 if value:
1664 if value:
1665 self.ui.write(columns[key] % " ".join(value),
1665 self.ui.write(columns[key] % " ".join(value),
1666 label='ui.debug log.files')
1666 label='ui.debug log.files')
1667 elif ctx.files() and self.ui.verbose:
1667 elif ctx.files() and self.ui.verbose:
1668 self.ui.write(columns['files'] % " ".join(ctx.files()),
1668 self.ui.write(columns['files'] % " ".join(ctx.files()),
1669 label='ui.note log.files')
1669 label='ui.note log.files')
1670 if copies and self.ui.verbose:
1670 if copies and self.ui.verbose:
1671 copies = ['%s (%s)' % c for c in copies]
1671 copies = ['%s (%s)' % c for c in copies]
1672 self.ui.write(columns['copies'] % ' '.join(copies),
1672 self.ui.write(columns['copies'] % ' '.join(copies),
1673 label='ui.note log.copies')
1673 label='ui.note log.copies')
1674
1674
1675 extra = ctx.extra()
1675 extra = ctx.extra()
1676 if extra and self.ui.debugflag:
1676 if extra and self.ui.debugflag:
1677 for key, value in sorted(extra.items()):
1677 for key, value in sorted(extra.items()):
1678 self.ui.write(columns['extra'] % (key, util.escapestr(value)),
1678 self.ui.write(columns['extra'] % (key, util.escapestr(value)),
1679 label='ui.debug log.extra')
1679 label='ui.debug log.extra')
1680
1680
1681 description = ctx.description().strip()
1681 description = ctx.description().strip()
1682 if description:
1682 if description:
1683 if self.ui.verbose:
1683 if self.ui.verbose:
1684 self.ui.write(_("description:\n"),
1684 self.ui.write(_("description:\n"),
1685 label='ui.note log.description')
1685 label='ui.note log.description')
1686 self.ui.write(description,
1686 self.ui.write(description,
1687 label='ui.note log.description')
1687 label='ui.note log.description')
1688 self.ui.write("\n\n")
1688 self.ui.write("\n\n")
1689 else:
1689 else:
1690 self.ui.write(columns['summary'] % description.splitlines()[0],
1690 self.ui.write(columns['summary'] % description.splitlines()[0],
1691 label='log.summary')
1691 label='log.summary')
1692 self.ui.write("\n")
1692 self.ui.write("\n")
1693
1693
1694 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1694 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1695
1695
1696 def _showobsfate(self, ctx):
1696 def _showobsfate(self, ctx):
1697 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui)
1697 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui)
1698
1698
1699 if obsfate:
1699 if obsfate:
1700 for obsfateline in obsfate:
1700 for obsfateline in obsfate:
1701 self.ui.write(self._columns['obsolete'] % obsfateline,
1701 self.ui.write(self._columns['obsolete'] % obsfateline,
1702 label='log.obsfate')
1702 label='log.obsfate')
1703
1703
1704 def _exthook(self, ctx):
1704 def _exthook(self, ctx):
1705 '''empty method used by extension as a hook point
1705 '''empty method used by extension as a hook point
1706 '''
1706 '''
1707
1707
1708 def showpatch(self, ctx, matchfn, hunksfilterfn=None):
1708 def showpatch(self, ctx, matchfn, hunksfilterfn=None):
1709 if not matchfn:
1709 if not matchfn:
1710 matchfn = self.matchfn
1710 matchfn = self.matchfn
1711 if matchfn:
1711 if matchfn:
1712 stat = self.diffopts.get('stat')
1712 stat = self.diffopts.get('stat')
1713 diff = self.diffopts.get('patch')
1713 diff = self.diffopts.get('patch')
1714 diffopts = patch.diffallopts(self.ui, self.diffopts)
1714 diffopts = patch.diffallopts(self.ui, self.diffopts)
1715 node = ctx.node()
1715 node = ctx.node()
1716 prev = ctx.p1().node()
1716 prev = ctx.p1().node()
1717 if stat:
1717 if stat:
1718 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1718 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1719 match=matchfn, stat=True,
1719 match=matchfn, stat=True,
1720 hunksfilterfn=hunksfilterfn)
1720 hunksfilterfn=hunksfilterfn)
1721 if diff:
1721 if diff:
1722 if stat:
1722 if stat:
1723 self.ui.write("\n")
1723 self.ui.write("\n")
1724 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1724 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1725 match=matchfn, stat=False,
1725 match=matchfn, stat=False,
1726 hunksfilterfn=hunksfilterfn)
1726 hunksfilterfn=hunksfilterfn)
1727 self.ui.write("\n")
1727 self.ui.write("\n")
1728
1728
1729 class jsonchangeset(changeset_printer):
1729 class jsonchangeset(changeset_printer):
1730 '''format changeset information.'''
1730 '''format changeset information.'''
1731
1731
1732 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1732 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1733 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1733 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1734 self.cache = {}
1734 self.cache = {}
1735 self._first = True
1735 self._first = True
1736
1736
1737 def close(self):
1737 def close(self):
1738 if not self._first:
1738 if not self._first:
1739 self.ui.write("\n]\n")
1739 self.ui.write("\n]\n")
1740 else:
1740 else:
1741 self.ui.write("[]\n")
1741 self.ui.write("[]\n")
1742
1742
1743 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1743 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1744 '''show a single changeset or file revision'''
1744 '''show a single changeset or file revision'''
1745 rev = ctx.rev()
1745 rev = ctx.rev()
1746 if rev is None:
1746 if rev is None:
1747 jrev = jnode = 'null'
1747 jrev = jnode = 'null'
1748 else:
1748 else:
1749 jrev = '%d' % rev
1749 jrev = '%d' % rev
1750 jnode = '"%s"' % hex(ctx.node())
1750 jnode = '"%s"' % hex(ctx.node())
1751 j = encoding.jsonescape
1751 j = encoding.jsonescape
1752
1752
1753 if self._first:
1753 if self._first:
1754 self.ui.write("[\n {")
1754 self.ui.write("[\n {")
1755 self._first = False
1755 self._first = False
1756 else:
1756 else:
1757 self.ui.write(",\n {")
1757 self.ui.write(",\n {")
1758
1758
1759 if self.ui.quiet:
1759 if self.ui.quiet:
1760 self.ui.write(('\n "rev": %s') % jrev)
1760 self.ui.write(('\n "rev": %s') % jrev)
1761 self.ui.write((',\n "node": %s') % jnode)
1761 self.ui.write((',\n "node": %s') % jnode)
1762 self.ui.write('\n }')
1762 self.ui.write('\n }')
1763 return
1763 return
1764
1764
1765 self.ui.write(('\n "rev": %s') % jrev)
1765 self.ui.write(('\n "rev": %s') % jrev)
1766 self.ui.write((',\n "node": %s') % jnode)
1766 self.ui.write((',\n "node": %s') % jnode)
1767 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1767 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1768 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1768 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1769 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1769 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1770 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1770 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1771 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1771 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1772
1772
1773 self.ui.write((',\n "bookmarks": [%s]') %
1773 self.ui.write((',\n "bookmarks": [%s]') %
1774 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1774 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1775 self.ui.write((',\n "tags": [%s]') %
1775 self.ui.write((',\n "tags": [%s]') %
1776 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1776 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1777 self.ui.write((',\n "parents": [%s]') %
1777 self.ui.write((',\n "parents": [%s]') %
1778 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1778 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1779
1779
1780 if self.ui.debugflag:
1780 if self.ui.debugflag:
1781 if rev is None:
1781 if rev is None:
1782 jmanifestnode = 'null'
1782 jmanifestnode = 'null'
1783 else:
1783 else:
1784 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1784 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1785 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1785 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1786
1786
1787 self.ui.write((',\n "extra": {%s}') %
1787 self.ui.write((',\n "extra": {%s}') %
1788 ", ".join('"%s": "%s"' % (j(k), j(v))
1788 ", ".join('"%s": "%s"' % (j(k), j(v))
1789 for k, v in ctx.extra().items()))
1789 for k, v in ctx.extra().items()))
1790
1790
1791 files = ctx.p1().status(ctx)
1791 files = ctx.p1().status(ctx)
1792 self.ui.write((',\n "modified": [%s]') %
1792 self.ui.write((',\n "modified": [%s]') %
1793 ", ".join('"%s"' % j(f) for f in files[0]))
1793 ", ".join('"%s"' % j(f) for f in files[0]))
1794 self.ui.write((',\n "added": [%s]') %
1794 self.ui.write((',\n "added": [%s]') %
1795 ", ".join('"%s"' % j(f) for f in files[1]))
1795 ", ".join('"%s"' % j(f) for f in files[1]))
1796 self.ui.write((',\n "removed": [%s]') %
1796 self.ui.write((',\n "removed": [%s]') %
1797 ", ".join('"%s"' % j(f) for f in files[2]))
1797 ", ".join('"%s"' % j(f) for f in files[2]))
1798
1798
1799 elif self.ui.verbose:
1799 elif self.ui.verbose:
1800 self.ui.write((',\n "files": [%s]') %
1800 self.ui.write((',\n "files": [%s]') %
1801 ", ".join('"%s"' % j(f) for f in ctx.files()))
1801 ", ".join('"%s"' % j(f) for f in ctx.files()))
1802
1802
1803 if copies:
1803 if copies:
1804 self.ui.write((',\n "copies": {%s}') %
1804 self.ui.write((',\n "copies": {%s}') %
1805 ", ".join('"%s": "%s"' % (j(k), j(v))
1805 ", ".join('"%s": "%s"' % (j(k), j(v))
1806 for k, v in copies))
1806 for k, v in copies))
1807
1807
1808 matchfn = self.matchfn
1808 matchfn = self.matchfn
1809 if matchfn:
1809 if matchfn:
1810 stat = self.diffopts.get('stat')
1810 stat = self.diffopts.get('stat')
1811 diff = self.diffopts.get('patch')
1811 diff = self.diffopts.get('patch')
1812 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1812 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1813 node, prev = ctx.node(), ctx.p1().node()
1813 node, prev = ctx.node(), ctx.p1().node()
1814 if stat:
1814 if stat:
1815 self.ui.pushbuffer()
1815 self.ui.pushbuffer()
1816 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1816 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1817 match=matchfn, stat=True)
1817 match=matchfn, stat=True)
1818 self.ui.write((',\n "diffstat": "%s"')
1818 self.ui.write((',\n "diffstat": "%s"')
1819 % j(self.ui.popbuffer()))
1819 % j(self.ui.popbuffer()))
1820 if diff:
1820 if diff:
1821 self.ui.pushbuffer()
1821 self.ui.pushbuffer()
1822 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1822 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1823 match=matchfn, stat=False)
1823 match=matchfn, stat=False)
1824 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1824 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1825
1825
1826 self.ui.write("\n }")
1826 self.ui.write("\n }")
1827
1827
1828 class changeset_templater(changeset_printer):
1828 class changeset_templater(changeset_printer):
1829 '''format changeset information.
1829 '''format changeset information.
1830
1830
1831 Note: there are a variety of convenience functions to build a
1831 Note: there are a variety of convenience functions to build a
1832 changeset_templater for common cases. See functions such as:
1832 changeset_templater for common cases. See functions such as:
1833 makelogtemplater, show_changeset, buildcommittemplate, or other
1833 makelogtemplater, show_changeset, buildcommittemplate, or other
1834 functions that use changesest_templater.
1834 functions that use changesest_templater.
1835 '''
1835 '''
1836
1836
1837 # Arguments before "buffered" used to be positional. Consider not
1837 # Arguments before "buffered" used to be positional. Consider not
1838 # adding/removing arguments before "buffered" to not break callers.
1838 # adding/removing arguments before "buffered" to not break callers.
1839 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1839 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1840 buffered=False):
1840 buffered=False):
1841 diffopts = diffopts or {}
1841 diffopts = diffopts or {}
1842
1842
1843 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1843 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1844 tres = formatter.templateresources(ui, repo)
1844 tres = formatter.templateresources(ui, repo)
1845 self.t = formatter.loadtemplater(ui, tmplspec,
1845 self.t = formatter.loadtemplater(ui, tmplspec,
1846 defaults=templatekw.keywords,
1846 defaults=templatekw.keywords,
1847 resources=tres,
1847 resources=tres,
1848 cache=templatekw.defaulttempl)
1848 cache=templatekw.defaulttempl)
1849 self._counter = itertools.count()
1849 self._counter = itertools.count()
1850 self.cache = tres['cache'] # shared with _graphnodeformatter()
1850 self.cache = tres['cache'] # shared with _graphnodeformatter()
1851
1851
1852 self._tref = tmplspec.ref
1852 self._tref = tmplspec.ref
1853 self._parts = {'header': '', 'footer': '',
1853 self._parts = {'header': '', 'footer': '',
1854 tmplspec.ref: tmplspec.ref,
1854 tmplspec.ref: tmplspec.ref,
1855 'docheader': '', 'docfooter': '',
1855 'docheader': '', 'docfooter': '',
1856 'separator': ''}
1856 'separator': ''}
1857 if tmplspec.mapfile:
1857 if tmplspec.mapfile:
1858 # find correct templates for current mode, for backward
1858 # find correct templates for current mode, for backward
1859 # compatibility with 'log -v/-q/--debug' using a mapfile
1859 # compatibility with 'log -v/-q/--debug' using a mapfile
1860 tmplmodes = [
1860 tmplmodes = [
1861 (True, ''),
1861 (True, ''),
1862 (self.ui.verbose, '_verbose'),
1862 (self.ui.verbose, '_verbose'),
1863 (self.ui.quiet, '_quiet'),
1863 (self.ui.quiet, '_quiet'),
1864 (self.ui.debugflag, '_debug'),
1864 (self.ui.debugflag, '_debug'),
1865 ]
1865 ]
1866 for mode, postfix in tmplmodes:
1866 for mode, postfix in tmplmodes:
1867 for t in self._parts:
1867 for t in self._parts:
1868 cur = t + postfix
1868 cur = t + postfix
1869 if mode and cur in self.t:
1869 if mode and cur in self.t:
1870 self._parts[t] = cur
1870 self._parts[t] = cur
1871 else:
1871 else:
1872 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1872 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1873 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1873 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1874 self._parts.update(m)
1874 self._parts.update(m)
1875
1875
1876 if self._parts['docheader']:
1876 if self._parts['docheader']:
1877 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1877 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1878
1878
1879 def close(self):
1879 def close(self):
1880 if self._parts['docfooter']:
1880 if self._parts['docfooter']:
1881 if not self.footer:
1881 if not self.footer:
1882 self.footer = ""
1882 self.footer = ""
1883 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1883 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1884 return super(changeset_templater, self).close()
1884 return super(changeset_templater, self).close()
1885
1885
1886 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1886 def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
1887 '''show a single changeset or file revision'''
1887 '''show a single changeset or file revision'''
1888 props = props.copy()
1888 props = props.copy()
1889 props['ctx'] = ctx
1889 props['ctx'] = ctx
1890 props['index'] = index = next(self._counter)
1890 props['index'] = index = next(self._counter)
1891 props['revcache'] = {'copies': copies}
1891 props['revcache'] = {'copies': copies}
1892 props = pycompat.strkwargs(props)
1892 props = pycompat.strkwargs(props)
1893
1893
1894 # write separator, which wouldn't work well with the header part below
1894 # write separator, which wouldn't work well with the header part below
1895 # since there's inherently a conflict between header (across items) and
1895 # since there's inherently a conflict between header (across items) and
1896 # separator (per item)
1896 # separator (per item)
1897 if self._parts['separator'] and index > 0:
1897 if self._parts['separator'] and index > 0:
1898 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1898 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1899
1899
1900 # write header
1900 # write header
1901 if self._parts['header']:
1901 if self._parts['header']:
1902 h = templater.stringify(self.t(self._parts['header'], **props))
1902 h = templater.stringify(self.t(self._parts['header'], **props))
1903 if self.buffered:
1903 if self.buffered:
1904 self.header[ctx.rev()] = h
1904 self.header[ctx.rev()] = h
1905 else:
1905 else:
1906 if self.lastheader != h:
1906 if self.lastheader != h:
1907 self.lastheader = h
1907 self.lastheader = h
1908 self.ui.write(h)
1908 self.ui.write(h)
1909
1909
1910 # write changeset metadata, then patch if requested
1910 # write changeset metadata, then patch if requested
1911 key = self._parts[self._tref]
1911 key = self._parts[self._tref]
1912 self.ui.write(templater.stringify(self.t(key, **props)))
1912 self.ui.write(templater.stringify(self.t(key, **props)))
1913 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1913 self.showpatch(ctx, matchfn, hunksfilterfn=hunksfilterfn)
1914
1914
1915 if self._parts['footer']:
1915 if self._parts['footer']:
1916 if not self.footer:
1916 if not self.footer:
1917 self.footer = templater.stringify(
1917 self.footer = templater.stringify(
1918 self.t(self._parts['footer'], **props))
1918 self.t(self._parts['footer'], **props))
1919
1919
1920 def logtemplatespec(tmpl, mapfile):
1920 def logtemplatespec(tmpl, mapfile):
1921 if mapfile:
1921 if mapfile:
1922 return formatter.templatespec('changeset', tmpl, mapfile)
1922 return formatter.templatespec('changeset', tmpl, mapfile)
1923 else:
1923 else:
1924 return formatter.templatespec('', tmpl, None)
1924 return formatter.templatespec('', tmpl, None)
1925
1925
1926 def _lookuplogtemplate(ui, tmpl, style):
1926 def _lookuplogtemplate(ui, tmpl, style):
1927 """Find the template matching the given template spec or style
1927 """Find the template matching the given template spec or style
1928
1928
1929 See formatter.lookuptemplate() for details.
1929 See formatter.lookuptemplate() for details.
1930 """
1930 """
1931
1931
1932 # ui settings
1932 # ui settings
1933 if not tmpl and not style: # template are stronger than style
1933 if not tmpl and not style: # template are stronger than style
1934 tmpl = ui.config('ui', 'logtemplate')
1934 tmpl = ui.config('ui', 'logtemplate')
1935 if tmpl:
1935 if tmpl:
1936 return logtemplatespec(templater.unquotestring(tmpl), None)
1936 return logtemplatespec(templater.unquotestring(tmpl), None)
1937 else:
1937 else:
1938 style = util.expandpath(ui.config('ui', 'style'))
1938 style = util.expandpath(ui.config('ui', 'style'))
1939
1939
1940 if not tmpl and style:
1940 if not tmpl and style:
1941 mapfile = style
1941 mapfile = style
1942 if not os.path.split(mapfile)[0]:
1942 if not os.path.split(mapfile)[0]:
1943 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1943 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1944 or templater.templatepath(mapfile))
1944 or templater.templatepath(mapfile))
1945 if mapname:
1945 if mapname:
1946 mapfile = mapname
1946 mapfile = mapname
1947 return logtemplatespec(None, mapfile)
1947 return logtemplatespec(None, mapfile)
1948
1948
1949 if not tmpl:
1949 if not tmpl:
1950 return logtemplatespec(None, None)
1950 return logtemplatespec(None, None)
1951
1951
1952 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1952 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1953
1953
1954 def makelogtemplater(ui, repo, tmpl, buffered=False):
1954 def makelogtemplater(ui, repo, tmpl, buffered=False):
1955 """Create a changeset_templater from a literal template 'tmpl'
1955 """Create a changeset_templater from a literal template 'tmpl'
1956 byte-string."""
1956 byte-string."""
1957 spec = logtemplatespec(tmpl, None)
1957 spec = logtemplatespec(tmpl, None)
1958 return changeset_templater(ui, repo, spec, buffered=buffered)
1958 return changeset_templater(ui, repo, spec, buffered=buffered)
1959
1959
1960 def show_changeset(ui, repo, opts, buffered=False):
1960 def show_changeset(ui, repo, opts, buffered=False):
1961 """show one changeset using template or regular display.
1961 """show one changeset using template or regular display.
1962
1962
1963 Display format will be the first non-empty hit of:
1963 Display format will be the first non-empty hit of:
1964 1. option 'template'
1964 1. option 'template'
1965 2. option 'style'
1965 2. option 'style'
1966 3. [ui] setting 'logtemplate'
1966 3. [ui] setting 'logtemplate'
1967 4. [ui] setting 'style'
1967 4. [ui] setting 'style'
1968 If all of these values are either the unset or the empty string,
1968 If all of these values are either the unset or the empty string,
1969 regular display via changeset_printer() is done.
1969 regular display via changeset_printer() is done.
1970 """
1970 """
1971 # options
1971 # options
1972 match = None
1972 match = None
1973 if opts.get('patch') or opts.get('stat'):
1973 if opts.get('patch') or opts.get('stat'):
1974 match = scmutil.matchall(repo)
1974 match = scmutil.matchall(repo)
1975
1975
1976 if opts.get('template') == 'json':
1976 if opts.get('template') == 'json':
1977 return jsonchangeset(ui, repo, match, opts, buffered)
1977 return jsonchangeset(ui, repo, match, opts, buffered)
1978
1978
1979 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
1979 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
1980
1980
1981 if not spec.ref and not spec.tmpl and not spec.mapfile:
1981 if not spec.ref and not spec.tmpl and not spec.mapfile:
1982 return changeset_printer(ui, repo, match, opts, buffered)
1982 return changeset_printer(ui, repo, match, opts, buffered)
1983
1983
1984 return changeset_templater(ui, repo, spec, match, opts, buffered)
1984 return changeset_templater(ui, repo, spec, match, opts, buffered)
1985
1985
1986 def showmarker(fm, marker, index=None):
1986 def showmarker(fm, marker, index=None):
1987 """utility function to display obsolescence marker in a readable way
1987 """utility function to display obsolescence marker in a readable way
1988
1988
1989 To be used by debug function."""
1989 To be used by debug function."""
1990 if index is not None:
1990 if index is not None:
1991 fm.write('index', '%i ', index)
1991 fm.write('index', '%i ', index)
1992 fm.write('prednode', '%s ', hex(marker.prednode()))
1992 fm.write('prednode', '%s ', hex(marker.prednode()))
1993 succs = marker.succnodes()
1993 succs = marker.succnodes()
1994 fm.condwrite(succs, 'succnodes', '%s ',
1994 fm.condwrite(succs, 'succnodes', '%s ',
1995 fm.formatlist(map(hex, succs), name='node'))
1995 fm.formatlist(map(hex, succs), name='node'))
1996 fm.write('flag', '%X ', marker.flags())
1996 fm.write('flag', '%X ', marker.flags())
1997 parents = marker.parentnodes()
1997 parents = marker.parentnodes()
1998 if parents is not None:
1998 if parents is not None:
1999 fm.write('parentnodes', '{%s} ',
1999 fm.write('parentnodes', '{%s} ',
2000 fm.formatlist(map(hex, parents), name='node', sep=', '))
2000 fm.formatlist(map(hex, parents), name='node', sep=', '))
2001 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2001 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2002 meta = marker.metadata().copy()
2002 meta = marker.metadata().copy()
2003 meta.pop('date', None)
2003 meta.pop('date', None)
2004 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2004 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2005 fm.plain('\n')
2005 fm.plain('\n')
2006
2006
2007 def finddate(ui, repo, date):
2007 def finddate(ui, repo, date):
2008 """Find the tipmost changeset that matches the given date spec"""
2008 """Find the tipmost changeset that matches the given date spec"""
2009
2009
2010 df = util.matchdate(date)
2010 df = util.matchdate(date)
2011 m = scmutil.matchall(repo)
2011 m = scmutil.matchall(repo)
2012 results = {}
2012 results = {}
2013
2013
2014 def prep(ctx, fns):
2014 def prep(ctx, fns):
2015 d = ctx.date()
2015 d = ctx.date()
2016 if df(d[0]):
2016 if df(d[0]):
2017 results[ctx.rev()] = d
2017 results[ctx.rev()] = d
2018
2018
2019 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2019 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2020 rev = ctx.rev()
2020 rev = ctx.rev()
2021 if rev in results:
2021 if rev in results:
2022 ui.status(_("found revision %s from %s\n") %
2022 ui.status(_("found revision %s from %s\n") %
2023 (rev, util.datestr(results[rev])))
2023 (rev, util.datestr(results[rev])))
2024 return '%d' % rev
2024 return '%d' % rev
2025
2025
2026 raise error.Abort(_("revision matching date not found"))
2026 raise error.Abort(_("revision matching date not found"))
2027
2027
2028 def increasingwindows(windowsize=8, sizelimit=512):
2028 def increasingwindows(windowsize=8, sizelimit=512):
2029 while True:
2029 while True:
2030 yield windowsize
2030 yield windowsize
2031 if windowsize < sizelimit:
2031 if windowsize < sizelimit:
2032 windowsize *= 2
2032 windowsize *= 2
2033
2033
2034 class FileWalkError(Exception):
2034 class FileWalkError(Exception):
2035 pass
2035 pass
2036
2036
2037 def walkfilerevs(repo, match, follow, revs, fncache):
2037 def walkfilerevs(repo, match, follow, revs, fncache):
2038 '''Walks the file history for the matched files.
2038 '''Walks the file history for the matched files.
2039
2039
2040 Returns the changeset revs that are involved in the file history.
2040 Returns the changeset revs that are involved in the file history.
2041
2041
2042 Throws FileWalkError if the file history can't be walked using
2042 Throws FileWalkError if the file history can't be walked using
2043 filelogs alone.
2043 filelogs alone.
2044 '''
2044 '''
2045 wanted = set()
2045 wanted = set()
2046 copies = []
2046 copies = []
2047 minrev, maxrev = min(revs), max(revs)
2047 minrev, maxrev = min(revs), max(revs)
2048 def filerevgen(filelog, last):
2048 def filerevgen(filelog, last):
2049 """
2049 """
2050 Only files, no patterns. Check the history of each file.
2050 Only files, no patterns. Check the history of each file.
2051
2051
2052 Examines filelog entries within minrev, maxrev linkrev range
2052 Examines filelog entries within minrev, maxrev linkrev range
2053 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2053 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2054 tuples in backwards order
2054 tuples in backwards order
2055 """
2055 """
2056 cl_count = len(repo)
2056 cl_count = len(repo)
2057 revs = []
2057 revs = []
2058 for j in xrange(0, last + 1):
2058 for j in xrange(0, last + 1):
2059 linkrev = filelog.linkrev(j)
2059 linkrev = filelog.linkrev(j)
2060 if linkrev < minrev:
2060 if linkrev < minrev:
2061 continue
2061 continue
2062 # only yield rev for which we have the changelog, it can
2062 # only yield rev for which we have the changelog, it can
2063 # happen while doing "hg log" during a pull or commit
2063 # happen while doing "hg log" during a pull or commit
2064 if linkrev >= cl_count:
2064 if linkrev >= cl_count:
2065 break
2065 break
2066
2066
2067 parentlinkrevs = []
2067 parentlinkrevs = []
2068 for p in filelog.parentrevs(j):
2068 for p in filelog.parentrevs(j):
2069 if p != nullrev:
2069 if p != nullrev:
2070 parentlinkrevs.append(filelog.linkrev(p))
2070 parentlinkrevs.append(filelog.linkrev(p))
2071 n = filelog.node(j)
2071 n = filelog.node(j)
2072 revs.append((linkrev, parentlinkrevs,
2072 revs.append((linkrev, parentlinkrevs,
2073 follow and filelog.renamed(n)))
2073 follow and filelog.renamed(n)))
2074
2074
2075 return reversed(revs)
2075 return reversed(revs)
2076 def iterfiles():
2076 def iterfiles():
2077 pctx = repo['.']
2077 pctx = repo['.']
2078 for filename in match.files():
2078 for filename in match.files():
2079 if follow:
2079 if follow:
2080 if filename not in pctx:
2080 if filename not in pctx:
2081 raise error.Abort(_('cannot follow file not in parent '
2081 raise error.Abort(_('cannot follow file not in parent '
2082 'revision: "%s"') % filename)
2082 'revision: "%s"') % filename)
2083 yield filename, pctx[filename].filenode()
2083 yield filename, pctx[filename].filenode()
2084 else:
2084 else:
2085 yield filename, None
2085 yield filename, None
2086 for filename_node in copies:
2086 for filename_node in copies:
2087 yield filename_node
2087 yield filename_node
2088
2088
2089 for file_, node in iterfiles():
2089 for file_, node in iterfiles():
2090 filelog = repo.file(file_)
2090 filelog = repo.file(file_)
2091 if not len(filelog):
2091 if not len(filelog):
2092 if node is None:
2092 if node is None:
2093 # A zero count may be a directory or deleted file, so
2093 # A zero count may be a directory or deleted file, so
2094 # try to find matching entries on the slow path.
2094 # try to find matching entries on the slow path.
2095 if follow:
2095 if follow:
2096 raise error.Abort(
2096 raise error.Abort(
2097 _('cannot follow nonexistent file: "%s"') % file_)
2097 _('cannot follow nonexistent file: "%s"') % file_)
2098 raise FileWalkError("Cannot walk via filelog")
2098 raise FileWalkError("Cannot walk via filelog")
2099 else:
2099 else:
2100 continue
2100 continue
2101
2101
2102 if node is None:
2102 if node is None:
2103 last = len(filelog) - 1
2103 last = len(filelog) - 1
2104 else:
2104 else:
2105 last = filelog.rev(node)
2105 last = filelog.rev(node)
2106
2106
2107 # keep track of all ancestors of the file
2107 # keep track of all ancestors of the file
2108 ancestors = {filelog.linkrev(last)}
2108 ancestors = {filelog.linkrev(last)}
2109
2109
2110 # iterate from latest to oldest revision
2110 # iterate from latest to oldest revision
2111 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2111 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2112 if not follow:
2112 if not follow:
2113 if rev > maxrev:
2113 if rev > maxrev:
2114 continue
2114 continue
2115 else:
2115 else:
2116 # Note that last might not be the first interesting
2116 # Note that last might not be the first interesting
2117 # rev to us:
2117 # rev to us:
2118 # if the file has been changed after maxrev, we'll
2118 # if the file has been changed after maxrev, we'll
2119 # have linkrev(last) > maxrev, and we still need
2119 # have linkrev(last) > maxrev, and we still need
2120 # to explore the file graph
2120 # to explore the file graph
2121 if rev not in ancestors:
2121 if rev not in ancestors:
2122 continue
2122 continue
2123 # XXX insert 1327 fix here
2123 # XXX insert 1327 fix here
2124 if flparentlinkrevs:
2124 if flparentlinkrevs:
2125 ancestors.update(flparentlinkrevs)
2125 ancestors.update(flparentlinkrevs)
2126
2126
2127 fncache.setdefault(rev, []).append(file_)
2127 fncache.setdefault(rev, []).append(file_)
2128 wanted.add(rev)
2128 wanted.add(rev)
2129 if copied:
2129 if copied:
2130 copies.append(copied)
2130 copies.append(copied)
2131
2131
2132 return wanted
2132 return wanted
2133
2133
2134 class _followfilter(object):
2134 class _followfilter(object):
2135 def __init__(self, repo, onlyfirst=False):
2135 def __init__(self, repo, onlyfirst=False):
2136 self.repo = repo
2136 self.repo = repo
2137 self.startrev = nullrev
2137 self.startrev = nullrev
2138 self.roots = set()
2138 self.roots = set()
2139 self.onlyfirst = onlyfirst
2139 self.onlyfirst = onlyfirst
2140
2140
2141 def match(self, rev):
2141 def match(self, rev):
2142 def realparents(rev):
2142 def realparents(rev):
2143 if self.onlyfirst:
2143 if self.onlyfirst:
2144 return self.repo.changelog.parentrevs(rev)[0:1]
2144 return self.repo.changelog.parentrevs(rev)[0:1]
2145 else:
2145 else:
2146 return filter(lambda x: x != nullrev,
2146 return filter(lambda x: x != nullrev,
2147 self.repo.changelog.parentrevs(rev))
2147 self.repo.changelog.parentrevs(rev))
2148
2148
2149 if self.startrev == nullrev:
2149 if self.startrev == nullrev:
2150 self.startrev = rev
2150 self.startrev = rev
2151 return True
2151 return True
2152
2152
2153 if rev > self.startrev:
2153 if rev > self.startrev:
2154 # forward: all descendants
2154 # forward: all descendants
2155 if not self.roots:
2155 if not self.roots:
2156 self.roots.add(self.startrev)
2156 self.roots.add(self.startrev)
2157 for parent in realparents(rev):
2157 for parent in realparents(rev):
2158 if parent in self.roots:
2158 if parent in self.roots:
2159 self.roots.add(rev)
2159 self.roots.add(rev)
2160 return True
2160 return True
2161 else:
2161 else:
2162 # backwards: all parents
2162 # backwards: all parents
2163 if not self.roots:
2163 if not self.roots:
2164 self.roots.update(realparents(self.startrev))
2164 self.roots.update(realparents(self.startrev))
2165 if rev in self.roots:
2165 if rev in self.roots:
2166 self.roots.remove(rev)
2166 self.roots.remove(rev)
2167 self.roots.update(realparents(rev))
2167 self.roots.update(realparents(rev))
2168 return True
2168 return True
2169
2169
2170 return False
2170 return False
2171
2171
2172 def walkchangerevs(repo, match, opts, prepare):
2172 def walkchangerevs(repo, match, opts, prepare):
2173 '''Iterate over files and the revs in which they changed.
2173 '''Iterate over files and the revs in which they changed.
2174
2174
2175 Callers most commonly need to iterate backwards over the history
2175 Callers most commonly need to iterate backwards over the history
2176 in which they are interested. Doing so has awful (quadratic-looking)
2176 in which they are interested. Doing so has awful (quadratic-looking)
2177 performance, so we use iterators in a "windowed" way.
2177 performance, so we use iterators in a "windowed" way.
2178
2178
2179 We walk a window of revisions in the desired order. Within the
2179 We walk a window of revisions in the desired order. Within the
2180 window, we first walk forwards to gather data, then in the desired
2180 window, we first walk forwards to gather data, then in the desired
2181 order (usually backwards) to display it.
2181 order (usually backwards) to display it.
2182
2182
2183 This function returns an iterator yielding contexts. Before
2183 This function returns an iterator yielding contexts. Before
2184 yielding each context, the iterator will first call the prepare
2184 yielding each context, the iterator will first call the prepare
2185 function on each context in the window in forward order.'''
2185 function on each context in the window in forward order.'''
2186
2186
2187 follow = opts.get('follow') or opts.get('follow_first')
2187 follow = opts.get('follow') or opts.get('follow_first')
2188 revs = _logrevs(repo, opts)
2188 revs = _logrevs(repo, opts)
2189 if not revs:
2189 if not revs:
2190 return []
2190 return []
2191 wanted = set()
2191 wanted = set()
2192 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2192 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2193 fncache = {}
2193 fncache = {}
2194 change = repo.changectx
2194 change = repo.changectx
2195
2195
2196 # First step is to fill wanted, the set of revisions that we want to yield.
2196 # First step is to fill wanted, the set of revisions that we want to yield.
2197 # When it does not induce extra cost, we also fill fncache for revisions in
2197 # When it does not induce extra cost, we also fill fncache for revisions in
2198 # wanted: a cache of filenames that were changed (ctx.files()) and that
2198 # wanted: a cache of filenames that were changed (ctx.files()) and that
2199 # match the file filtering conditions.
2199 # match the file filtering conditions.
2200
2200
2201 if match.always():
2201 if match.always():
2202 # No files, no patterns. Display all revs.
2202 # No files, no patterns. Display all revs.
2203 wanted = revs
2203 wanted = revs
2204 elif not slowpath:
2204 elif not slowpath:
2205 # We only have to read through the filelog to find wanted revisions
2205 # We only have to read through the filelog to find wanted revisions
2206
2206
2207 try:
2207 try:
2208 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2208 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2209 except FileWalkError:
2209 except FileWalkError:
2210 slowpath = True
2210 slowpath = True
2211
2211
2212 # We decided to fall back to the slowpath because at least one
2212 # We decided to fall back to the slowpath because at least one
2213 # of the paths was not a file. Check to see if at least one of them
2213 # of the paths was not a file. Check to see if at least one of them
2214 # existed in history, otherwise simply return
2214 # existed in history, otherwise simply return
2215 for path in match.files():
2215 for path in match.files():
2216 if path == '.' or path in repo.store:
2216 if path == '.' or path in repo.store:
2217 break
2217 break
2218 else:
2218 else:
2219 return []
2219 return []
2220
2220
2221 if slowpath:
2221 if slowpath:
2222 # We have to read the changelog to match filenames against
2222 # We have to read the changelog to match filenames against
2223 # changed files
2223 # changed files
2224
2224
2225 if follow:
2225 if follow:
2226 raise error.Abort(_('can only follow copies/renames for explicit '
2226 raise error.Abort(_('can only follow copies/renames for explicit '
2227 'filenames'))
2227 'filenames'))
2228
2228
2229 # The slow path checks files modified in every changeset.
2229 # The slow path checks files modified in every changeset.
2230 # This is really slow on large repos, so compute the set lazily.
2230 # This is really slow on large repos, so compute the set lazily.
2231 class lazywantedset(object):
2231 class lazywantedset(object):
2232 def __init__(self):
2232 def __init__(self):
2233 self.set = set()
2233 self.set = set()
2234 self.revs = set(revs)
2234 self.revs = set(revs)
2235
2235
2236 # No need to worry about locality here because it will be accessed
2236 # No need to worry about locality here because it will be accessed
2237 # in the same order as the increasing window below.
2237 # in the same order as the increasing window below.
2238 def __contains__(self, value):
2238 def __contains__(self, value):
2239 if value in self.set:
2239 if value in self.set:
2240 return True
2240 return True
2241 elif not value in self.revs:
2241 elif not value in self.revs:
2242 return False
2242 return False
2243 else:
2243 else:
2244 self.revs.discard(value)
2244 self.revs.discard(value)
2245 ctx = change(value)
2245 ctx = change(value)
2246 matches = filter(match, ctx.files())
2246 matches = filter(match, ctx.files())
2247 if matches:
2247 if matches:
2248 fncache[value] = matches
2248 fncache[value] = matches
2249 self.set.add(value)
2249 self.set.add(value)
2250 return True
2250 return True
2251 return False
2251 return False
2252
2252
2253 def discard(self, value):
2253 def discard(self, value):
2254 self.revs.discard(value)
2254 self.revs.discard(value)
2255 self.set.discard(value)
2255 self.set.discard(value)
2256
2256
2257 wanted = lazywantedset()
2257 wanted = lazywantedset()
2258
2258
2259 # it might be worthwhile to do this in the iterator if the rev range
2259 # it might be worthwhile to do this in the iterator if the rev range
2260 # is descending and the prune args are all within that range
2260 # is descending and the prune args are all within that range
2261 for rev in opts.get('prune', ()):
2261 for rev in opts.get('prune', ()):
2262 rev = repo[rev].rev()
2262 rev = repo[rev].rev()
2263 ff = _followfilter(repo)
2263 ff = _followfilter(repo)
2264 stop = min(revs[0], revs[-1])
2264 stop = min(revs[0], revs[-1])
2265 for x in xrange(rev, stop - 1, -1):
2265 for x in xrange(rev, stop - 1, -1):
2266 if ff.match(x):
2266 if ff.match(x):
2267 wanted = wanted - [x]
2267 wanted = wanted - [x]
2268
2268
2269 # Now that wanted is correctly initialized, we can iterate over the
2269 # Now that wanted is correctly initialized, we can iterate over the
2270 # revision range, yielding only revisions in wanted.
2270 # revision range, yielding only revisions in wanted.
2271 def iterate():
2271 def iterate():
2272 if follow and match.always():
2272 if follow and match.always():
2273 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2273 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2274 def want(rev):
2274 def want(rev):
2275 return ff.match(rev) and rev in wanted
2275 return ff.match(rev) and rev in wanted
2276 else:
2276 else:
2277 def want(rev):
2277 def want(rev):
2278 return rev in wanted
2278 return rev in wanted
2279
2279
2280 it = iter(revs)
2280 it = iter(revs)
2281 stopiteration = False
2281 stopiteration = False
2282 for windowsize in increasingwindows():
2282 for windowsize in increasingwindows():
2283 nrevs = []
2283 nrevs = []
2284 for i in xrange(windowsize):
2284 for i in xrange(windowsize):
2285 rev = next(it, None)
2285 rev = next(it, None)
2286 if rev is None:
2286 if rev is None:
2287 stopiteration = True
2287 stopiteration = True
2288 break
2288 break
2289 elif want(rev):
2289 elif want(rev):
2290 nrevs.append(rev)
2290 nrevs.append(rev)
2291 for rev in sorted(nrevs):
2291 for rev in sorted(nrevs):
2292 fns = fncache.get(rev)
2292 fns = fncache.get(rev)
2293 ctx = change(rev)
2293 ctx = change(rev)
2294 if not fns:
2294 if not fns:
2295 def fns_generator():
2295 def fns_generator():
2296 for f in ctx.files():
2296 for f in ctx.files():
2297 if match(f):
2297 if match(f):
2298 yield f
2298 yield f
2299 fns = fns_generator()
2299 fns = fns_generator()
2300 prepare(ctx, fns)
2300 prepare(ctx, fns)
2301 for rev in nrevs:
2301 for rev in nrevs:
2302 yield change(rev)
2302 yield change(rev)
2303
2303
2304 if stopiteration:
2304 if stopiteration:
2305 break
2305 break
2306
2306
2307 return iterate()
2307 return iterate()
2308
2308
2309 def _makefollowlogfilematcher(repo, files, followfirst):
2309 def _makefollowlogfilematcher(repo, files, followfirst):
2310 # When displaying a revision with --patch --follow FILE, we have
2310 # When displaying a revision with --patch --follow FILE, we have
2311 # to know which file of the revision must be diffed. With
2311 # to know which file of the revision must be diffed. With
2312 # --follow, we want the names of the ancestors of FILE in the
2312 # --follow, we want the names of the ancestors of FILE in the
2313 # revision, stored in "fcache". "fcache" is populated by
2313 # revision, stored in "fcache". "fcache" is populated by
2314 # reproducing the graph traversal already done by --follow revset
2314 # reproducing the graph traversal already done by --follow revset
2315 # and relating revs to file names (which is not "correct" but
2315 # and relating revs to file names (which is not "correct" but
2316 # good enough).
2316 # good enough).
2317 fcache = {}
2317 fcache = {}
2318 fcacheready = [False]
2318 fcacheready = [False]
2319 pctx = repo['.']
2319 pctx = repo['.']
2320
2320
2321 def populate():
2321 def populate():
2322 for fn in files:
2322 for fn in files:
2323 fctx = pctx[fn]
2323 fctx = pctx[fn]
2324 fcache.setdefault(fctx.introrev(), set()).add(fctx.path())
2324 fcache.setdefault(fctx.introrev(), set()).add(fctx.path())
2325 for c in fctx.ancestors(followfirst=followfirst):
2325 for c in fctx.ancestors(followfirst=followfirst):
2326 fcache.setdefault(c.rev(), set()).add(c.path())
2326 fcache.setdefault(c.rev(), set()).add(c.path())
2327
2327
2328 def filematcher(rev):
2328 def filematcher(rev):
2329 if not fcacheready[0]:
2329 if not fcacheready[0]:
2330 # Lazy initialization
2330 # Lazy initialization
2331 fcacheready[0] = True
2331 fcacheready[0] = True
2332 populate()
2332 populate()
2333 return scmutil.matchfiles(repo, fcache.get(rev, []))
2333 return scmutil.matchfiles(repo, fcache.get(rev, []))
2334
2334
2335 return filematcher
2335 return filematcher
2336
2336
2337 def _makenofollowlogfilematcher(repo, pats, opts):
2337 def _makenofollowlogfilematcher(repo, pats, opts):
2338 '''hook for extensions to override the filematcher for non-follow cases'''
2338 '''hook for extensions to override the filematcher for non-follow cases'''
2339 return None
2339 return None
2340
2340
2341 _opt2logrevset = {
2341 _opt2logrevset = {
2342 'no_merges': ('not merge()', None),
2342 'no_merges': ('not merge()', None),
2343 'only_merges': ('merge()', None),
2343 'only_merges': ('merge()', None),
2344 '_ancestors': ('ancestors(%(val)s)', None),
2344 '_ancestors': ('ancestors(%(val)s)', None),
2345 '_fancestors': ('_firstancestors(%(val)s)', None),
2345 '_fancestors': ('_firstancestors(%(val)s)', None),
2346 '_descendants': ('descendants(%(val)s)', None),
2346 '_descendants': ('descendants(%(val)s)', None),
2347 '_fdescendants': ('_firstdescendants(%(val)s)', None),
2347 '_fdescendants': ('_firstdescendants(%(val)s)', None),
2348 '_matchfiles': ('_matchfiles(%(val)s)', None),
2348 '_matchfiles': ('_matchfiles(%(val)s)', None),
2349 'date': ('date(%(val)r)', None),
2349 'date': ('date(%(val)r)', None),
2350 'branch': ('branch(%(val)r)', ' or '),
2350 'branch': ('branch(%(val)r)', ' or '),
2351 '_patslog': ('filelog(%(val)r)', ' or '),
2351 '_patslog': ('filelog(%(val)r)', ' or '),
2352 '_patsfollow': ('follow(%(val)r)', ' or '),
2352 '_patsfollow': ('follow(%(val)r)', ' or '),
2353 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
2353 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
2354 'keyword': ('keyword(%(val)r)', ' or '),
2354 'keyword': ('keyword(%(val)r)', ' or '),
2355 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
2355 'prune': ('not ancestors(%(val)r)', ' and '),
2356 'user': ('user(%(val)r)', ' or '),
2356 'user': ('user(%(val)r)', ' or '),
2357 }
2357 }
2358
2358
2359 def _makelogrevset(repo, pats, opts, revs):
2359 def _makelogrevset(repo, pats, opts, revs):
2360 """Return (expr, filematcher) where expr is a revset string built
2360 """Return (expr, filematcher) where expr is a revset string built
2361 from log options and file patterns or None. If --stat or --patch
2361 from log options and file patterns or None. If --stat or --patch
2362 are not passed filematcher is None. Otherwise it is a callable
2362 are not passed filematcher is None. Otherwise it is a callable
2363 taking a revision number and returning a match objects filtering
2363 taking a revision number and returning a match objects filtering
2364 the files to be detailed when displaying the revision.
2364 the files to be detailed when displaying the revision.
2365 """
2365 """
2366 opts = dict(opts)
2366 opts = dict(opts)
2367 # follow or not follow?
2367 # follow or not follow?
2368 follow = opts.get('follow') or opts.get('follow_first')
2368 follow = opts.get('follow') or opts.get('follow_first')
2369 if opts.get('follow_first'):
2369 if opts.get('follow_first'):
2370 followfirst = 1
2370 followfirst = 1
2371 else:
2371 else:
2372 followfirst = 0
2372 followfirst = 0
2373 # --follow with FILE behavior depends on revs...
2373 # --follow with FILE behavior depends on revs...
2374 it = iter(revs)
2374 it = iter(revs)
2375 startrev = next(it)
2375 startrev = next(it)
2376 followdescendants = startrev < next(it, startrev)
2376 followdescendants = startrev < next(it, startrev)
2377
2377
2378 # branch and only_branch are really aliases and must be handled at
2378 # branch and only_branch are really aliases and must be handled at
2379 # the same time
2379 # the same time
2380 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2380 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2381 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2381 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2382 # pats/include/exclude are passed to match.match() directly in
2382 # pats/include/exclude are passed to match.match() directly in
2383 # _matchfiles() revset but walkchangerevs() builds its matcher with
2383 # _matchfiles() revset but walkchangerevs() builds its matcher with
2384 # scmutil.match(). The difference is input pats are globbed on
2384 # scmutil.match(). The difference is input pats are globbed on
2385 # platforms without shell expansion (windows).
2385 # platforms without shell expansion (windows).
2386 wctx = repo[None]
2386 wctx = repo[None]
2387 match, pats = scmutil.matchandpats(wctx, pats, opts)
2387 match, pats = scmutil.matchandpats(wctx, pats, opts)
2388 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2388 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2389 if not slowpath:
2389 if not slowpath:
2390 for f in match.files():
2390 for f in match.files():
2391 if follow and f not in wctx:
2391 if follow and f not in wctx:
2392 # If the file exists, it may be a directory, so let it
2392 # If the file exists, it may be a directory, so let it
2393 # take the slow path.
2393 # take the slow path.
2394 if os.path.exists(repo.wjoin(f)):
2394 if os.path.exists(repo.wjoin(f)):
2395 slowpath = True
2395 slowpath = True
2396 continue
2396 continue
2397 else:
2397 else:
2398 raise error.Abort(_('cannot follow file not in parent '
2398 raise error.Abort(_('cannot follow file not in parent '
2399 'revision: "%s"') % f)
2399 'revision: "%s"') % f)
2400 filelog = repo.file(f)
2400 filelog = repo.file(f)
2401 if not filelog:
2401 if not filelog:
2402 # A zero count may be a directory or deleted file, so
2402 # A zero count may be a directory or deleted file, so
2403 # try to find matching entries on the slow path.
2403 # try to find matching entries on the slow path.
2404 if follow:
2404 if follow:
2405 raise error.Abort(
2405 raise error.Abort(
2406 _('cannot follow nonexistent file: "%s"') % f)
2406 _('cannot follow nonexistent file: "%s"') % f)
2407 slowpath = True
2407 slowpath = True
2408
2408
2409 # We decided to fall back to the slowpath because at least one
2409 # We decided to fall back to the slowpath because at least one
2410 # of the paths was not a file. Check to see if at least one of them
2410 # of the paths was not a file. Check to see if at least one of them
2411 # existed in history - in that case, we'll continue down the
2411 # existed in history - in that case, we'll continue down the
2412 # slowpath; otherwise, we can turn off the slowpath
2412 # slowpath; otherwise, we can turn off the slowpath
2413 if slowpath:
2413 if slowpath:
2414 for path in match.files():
2414 for path in match.files():
2415 if path == '.' or path in repo.store:
2415 if path == '.' or path in repo.store:
2416 break
2416 break
2417 else:
2417 else:
2418 slowpath = False
2418 slowpath = False
2419
2419
2420 fpats = ('_patsfollow', '_patsfollowfirst')
2420 fpats = ('_patsfollow', '_patsfollowfirst')
2421 fnopats = (('_ancestors', '_fancestors'),
2421 fnopats = (('_ancestors', '_fancestors'),
2422 ('_descendants', '_fdescendants'))
2422 ('_descendants', '_fdescendants'))
2423 if slowpath:
2423 if slowpath:
2424 # See walkchangerevs() slow path.
2424 # See walkchangerevs() slow path.
2425 #
2425 #
2426 # pats/include/exclude cannot be represented as separate
2426 # pats/include/exclude cannot be represented as separate
2427 # revset expressions as their filtering logic applies at file
2427 # revset expressions as their filtering logic applies at file
2428 # level. For instance "-I a -X a" matches a revision touching
2428 # level. For instance "-I a -X a" matches a revision touching
2429 # "a" and "b" while "file(a) and not file(b)" does
2429 # "a" and "b" while "file(a) and not file(b)" does
2430 # not. Besides, filesets are evaluated against the working
2430 # not. Besides, filesets are evaluated against the working
2431 # directory.
2431 # directory.
2432 matchargs = ['r:', 'd:relpath']
2432 matchargs = ['r:', 'd:relpath']
2433 for p in pats:
2433 for p in pats:
2434 matchargs.append('p:' + p)
2434 matchargs.append('p:' + p)
2435 for p in opts.get('include', []):
2435 for p in opts.get('include', []):
2436 matchargs.append('i:' + p)
2436 matchargs.append('i:' + p)
2437 for p in opts.get('exclude', []):
2437 for p in opts.get('exclude', []):
2438 matchargs.append('x:' + p)
2438 matchargs.append('x:' + p)
2439 matchargs = ','.join(('%r' % p) for p in matchargs)
2439 matchargs = ','.join(('%r' % p) for p in matchargs)
2440 opts['_matchfiles'] = matchargs
2440 opts['_matchfiles'] = matchargs
2441 if follow:
2441 if follow:
2442 opts[fnopats[0][followfirst]] = '.'
2442 opts[fnopats[0][followfirst]] = '.'
2443 else:
2443 else:
2444 if follow:
2444 if follow:
2445 if pats:
2445 if pats:
2446 # follow() revset interprets its file argument as a
2446 # follow() revset interprets its file argument as a
2447 # manifest entry, so use match.files(), not pats.
2447 # manifest entry, so use match.files(), not pats.
2448 opts[fpats[followfirst]] = list(match.files())
2448 opts[fpats[followfirst]] = list(match.files())
2449 else:
2449 else:
2450 op = fnopats[followdescendants][followfirst]
2450 op = fnopats[followdescendants][followfirst]
2451 opts[op] = 'rev(%d)' % startrev
2451 opts[op] = 'rev(%d)' % startrev
2452 else:
2452 else:
2453 opts['_patslog'] = list(pats)
2453 opts['_patslog'] = list(pats)
2454
2454
2455 filematcher = None
2455 filematcher = None
2456 if opts.get('patch') or opts.get('stat'):
2456 if opts.get('patch') or opts.get('stat'):
2457 # When following files, track renames via a special matcher.
2457 # When following files, track renames via a special matcher.
2458 # If we're forced to take the slowpath it means we're following
2458 # If we're forced to take the slowpath it means we're following
2459 # at least one pattern/directory, so don't bother with rename tracking.
2459 # at least one pattern/directory, so don't bother with rename tracking.
2460 if follow and not match.always() and not slowpath:
2460 if follow and not match.always() and not slowpath:
2461 # _makefollowlogfilematcher expects its files argument to be
2461 # _makefollowlogfilematcher expects its files argument to be
2462 # relative to the repo root, so use match.files(), not pats.
2462 # relative to the repo root, so use match.files(), not pats.
2463 filematcher = _makefollowlogfilematcher(repo, match.files(),
2463 filematcher = _makefollowlogfilematcher(repo, match.files(),
2464 followfirst)
2464 followfirst)
2465 else:
2465 else:
2466 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2466 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2467 if filematcher is None:
2467 if filematcher is None:
2468 filematcher = lambda rev: match
2468 filematcher = lambda rev: match
2469
2469
2470 expr = []
2470 expr = []
2471 for op, val in sorted(opts.iteritems()):
2471 for op, val in sorted(opts.iteritems()):
2472 if not val:
2472 if not val:
2473 continue
2473 continue
2474 if op not in _opt2logrevset:
2474 if op not in _opt2logrevset:
2475 continue
2475 continue
2476 revop, andor = _opt2logrevset[op]
2476 revop, andor = _opt2logrevset[op]
2477 if '%(val)' not in revop:
2477 if '%(val)' not in revop:
2478 expr.append(revop)
2478 expr.append(revop)
2479 else:
2479 else:
2480 if not isinstance(val, list):
2480 if not isinstance(val, list):
2481 e = revop % {'val': val}
2481 e = revop % {'val': val}
2482 else:
2482 else:
2483 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
2483 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
2484 expr.append(e)
2484 expr.append(e)
2485
2485
2486 if expr:
2486 if expr:
2487 expr = '(' + ' and '.join(expr) + ')'
2487 expr = '(' + ' and '.join(expr) + ')'
2488 else:
2488 else:
2489 expr = None
2489 expr = None
2490 return expr, filematcher
2490 return expr, filematcher
2491
2491
2492 def _logrevs(repo, opts):
2492 def _logrevs(repo, opts):
2493 # Default --rev value depends on --follow but --follow behavior
2493 # Default --rev value depends on --follow but --follow behavior
2494 # depends on revisions resolved from --rev...
2494 # depends on revisions resolved from --rev...
2495 follow = opts.get('follow') or opts.get('follow_first')
2495 follow = opts.get('follow') or opts.get('follow_first')
2496 if opts.get('rev'):
2496 if opts.get('rev'):
2497 revs = scmutil.revrange(repo, opts['rev'])
2497 revs = scmutil.revrange(repo, opts['rev'])
2498 elif follow and repo.dirstate.p1() == nullid:
2498 elif follow and repo.dirstate.p1() == nullid:
2499 revs = smartset.baseset()
2499 revs = smartset.baseset()
2500 elif follow:
2500 elif follow:
2501 revs = repo.revs('reverse(:.)')
2501 revs = repo.revs('reverse(:.)')
2502 else:
2502 else:
2503 revs = smartset.spanset(repo)
2503 revs = smartset.spanset(repo)
2504 revs.reverse()
2504 revs.reverse()
2505 return revs
2505 return revs
2506
2506
2507 def getlogrevs(repo, pats, opts):
2507 def getlogrevs(repo, pats, opts):
2508 """Return (revs, filematcher) where revs is a smartset
2508 """Return (revs, filematcher) where revs is a smartset
2509
2509
2510 If --stat or --patch is not passed, filematcher is None. Otherwise it
2510 If --stat or --patch is not passed, filematcher is None. Otherwise it
2511 is a callable taking a revision number and returning a match objects
2511 is a callable taking a revision number and returning a match objects
2512 filtering the files to be detailed when displaying the revision.
2512 filtering the files to be detailed when displaying the revision.
2513 """
2513 """
2514 limit = loglimit(opts)
2514 limit = loglimit(opts)
2515 revs = _logrevs(repo, opts)
2515 revs = _logrevs(repo, opts)
2516 if not revs:
2516 if not revs:
2517 return smartset.baseset(), None
2517 return smartset.baseset(), None
2518 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2518 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2519 if opts.get('graph') and opts.get('rev'):
2519 if opts.get('graph') and opts.get('rev'):
2520 # User-specified revs might be unsorted, but don't sort before
2520 # User-specified revs might be unsorted, but don't sort before
2521 # _makelogrevset because it might depend on the order of revs
2521 # _makelogrevset because it might depend on the order of revs
2522 if not (revs.isdescending() or revs.istopo()):
2522 if not (revs.isdescending() or revs.istopo()):
2523 revs.sort(reverse=True)
2523 revs.sort(reverse=True)
2524 if expr:
2524 if expr:
2525 matcher = revset.match(None, expr)
2525 matcher = revset.match(None, expr)
2526 revs = matcher(repo, revs)
2526 revs = matcher(repo, revs)
2527 if limit is not None:
2527 if limit is not None:
2528 revs = revs.slice(0, limit)
2528 revs = revs.slice(0, limit)
2529 return revs, filematcher
2529 return revs, filematcher
2530
2530
2531 def _parselinerangelogopt(repo, opts):
2531 def _parselinerangelogopt(repo, opts):
2532 """Parse --line-range log option and return a list of tuples (filename,
2532 """Parse --line-range log option and return a list of tuples (filename,
2533 (fromline, toline)).
2533 (fromline, toline)).
2534 """
2534 """
2535 linerangebyfname = []
2535 linerangebyfname = []
2536 for pat in opts.get('line_range', []):
2536 for pat in opts.get('line_range', []):
2537 try:
2537 try:
2538 pat, linerange = pat.rsplit(',', 1)
2538 pat, linerange = pat.rsplit(',', 1)
2539 except ValueError:
2539 except ValueError:
2540 raise error.Abort(_('malformatted line-range pattern %s') % pat)
2540 raise error.Abort(_('malformatted line-range pattern %s') % pat)
2541 try:
2541 try:
2542 fromline, toline = map(int, linerange.split(':'))
2542 fromline, toline = map(int, linerange.split(':'))
2543 except ValueError:
2543 except ValueError:
2544 raise error.Abort(_("invalid line range for %s") % pat)
2544 raise error.Abort(_("invalid line range for %s") % pat)
2545 msg = _("line range pattern '%s' must match exactly one file") % pat
2545 msg = _("line range pattern '%s' must match exactly one file") % pat
2546 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
2546 fname = scmutil.parsefollowlinespattern(repo, None, pat, msg)
2547 linerangebyfname.append(
2547 linerangebyfname.append(
2548 (fname, util.processlinerange(fromline, toline)))
2548 (fname, util.processlinerange(fromline, toline)))
2549 return linerangebyfname
2549 return linerangebyfname
2550
2550
2551 def getloglinerangerevs(repo, userrevs, opts):
2551 def getloglinerangerevs(repo, userrevs, opts):
2552 """Return (revs, filematcher, hunksfilter).
2552 """Return (revs, filematcher, hunksfilter).
2553
2553
2554 "revs" are revisions obtained by processing "line-range" log options and
2554 "revs" are revisions obtained by processing "line-range" log options and
2555 walking block ancestors of each specified file/line-range.
2555 walking block ancestors of each specified file/line-range.
2556
2556
2557 "filematcher(rev) -> match" is a factory function returning a match object
2557 "filematcher(rev) -> match" is a factory function returning a match object
2558 for a given revision for file patterns specified in --line-range option.
2558 for a given revision for file patterns specified in --line-range option.
2559 If neither --stat nor --patch options are passed, "filematcher" is None.
2559 If neither --stat nor --patch options are passed, "filematcher" is None.
2560
2560
2561 "hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function
2561 "hunksfilter(rev) -> filterfn(fctx, hunks)" is a factory function
2562 returning a hunks filtering function.
2562 returning a hunks filtering function.
2563 If neither --stat nor --patch options are passed, "filterhunks" is None.
2563 If neither --stat nor --patch options are passed, "filterhunks" is None.
2564 """
2564 """
2565 wctx = repo[None]
2565 wctx = repo[None]
2566
2566
2567 # Two-levels map of "rev -> file ctx -> [line range]".
2567 # Two-levels map of "rev -> file ctx -> [line range]".
2568 linerangesbyrev = {}
2568 linerangesbyrev = {}
2569 for fname, (fromline, toline) in _parselinerangelogopt(repo, opts):
2569 for fname, (fromline, toline) in _parselinerangelogopt(repo, opts):
2570 if fname not in wctx:
2570 if fname not in wctx:
2571 raise error.Abort(_('cannot follow file not in parent '
2571 raise error.Abort(_('cannot follow file not in parent '
2572 'revision: "%s"') % fname)
2572 'revision: "%s"') % fname)
2573 fctx = wctx.filectx(fname)
2573 fctx = wctx.filectx(fname)
2574 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
2574 for fctx, linerange in dagop.blockancestors(fctx, fromline, toline):
2575 rev = fctx.introrev()
2575 rev = fctx.introrev()
2576 if rev not in userrevs:
2576 if rev not in userrevs:
2577 continue
2577 continue
2578 linerangesbyrev.setdefault(
2578 linerangesbyrev.setdefault(
2579 rev, {}).setdefault(
2579 rev, {}).setdefault(
2580 fctx.path(), []).append(linerange)
2580 fctx.path(), []).append(linerange)
2581
2581
2582 filematcher = None
2582 filematcher = None
2583 hunksfilter = None
2583 hunksfilter = None
2584 if opts.get('patch') or opts.get('stat'):
2584 if opts.get('patch') or opts.get('stat'):
2585
2585
2586 def nofilterhunksfn(fctx, hunks):
2586 def nofilterhunksfn(fctx, hunks):
2587 return hunks
2587 return hunks
2588
2588
2589 def hunksfilter(rev):
2589 def hunksfilter(rev):
2590 fctxlineranges = linerangesbyrev.get(rev)
2590 fctxlineranges = linerangesbyrev.get(rev)
2591 if fctxlineranges is None:
2591 if fctxlineranges is None:
2592 return nofilterhunksfn
2592 return nofilterhunksfn
2593
2593
2594 def filterfn(fctx, hunks):
2594 def filterfn(fctx, hunks):
2595 lineranges = fctxlineranges.get(fctx.path())
2595 lineranges = fctxlineranges.get(fctx.path())
2596 if lineranges is not None:
2596 if lineranges is not None:
2597 for hr, lines in hunks:
2597 for hr, lines in hunks:
2598 if hr is None: # binary
2598 if hr is None: # binary
2599 yield hr, lines
2599 yield hr, lines
2600 continue
2600 continue
2601 if any(mdiff.hunkinrange(hr[2:], lr)
2601 if any(mdiff.hunkinrange(hr[2:], lr)
2602 for lr in lineranges):
2602 for lr in lineranges):
2603 yield hr, lines
2603 yield hr, lines
2604 else:
2604 else:
2605 for hunk in hunks:
2605 for hunk in hunks:
2606 yield hunk
2606 yield hunk
2607
2607
2608 return filterfn
2608 return filterfn
2609
2609
2610 def filematcher(rev):
2610 def filematcher(rev):
2611 files = list(linerangesbyrev.get(rev, []))
2611 files = list(linerangesbyrev.get(rev, []))
2612 return scmutil.matchfiles(repo, files)
2612 return scmutil.matchfiles(repo, files)
2613
2613
2614 revs = sorted(linerangesbyrev, reverse=True)
2614 revs = sorted(linerangesbyrev, reverse=True)
2615
2615
2616 return revs, filematcher, hunksfilter
2616 return revs, filematcher, hunksfilter
2617
2617
2618 def _graphnodeformatter(ui, displayer):
2618 def _graphnodeformatter(ui, displayer):
2619 spec = ui.config('ui', 'graphnodetemplate')
2619 spec = ui.config('ui', 'graphnodetemplate')
2620 if not spec:
2620 if not spec:
2621 return templatekw.showgraphnode # fast path for "{graphnode}"
2621 return templatekw.showgraphnode # fast path for "{graphnode}"
2622
2622
2623 spec = templater.unquotestring(spec)
2623 spec = templater.unquotestring(spec)
2624 tres = formatter.templateresources(ui)
2624 tres = formatter.templateresources(ui)
2625 if isinstance(displayer, changeset_templater):
2625 if isinstance(displayer, changeset_templater):
2626 tres['cache'] = displayer.cache # reuse cache of slow templates
2626 tres['cache'] = displayer.cache # reuse cache of slow templates
2627 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
2627 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
2628 resources=tres)
2628 resources=tres)
2629 def formatnode(repo, ctx):
2629 def formatnode(repo, ctx):
2630 props = {'ctx': ctx, 'repo': repo, 'revcache': {}}
2630 props = {'ctx': ctx, 'repo': repo, 'revcache': {}}
2631 return templ.render(props)
2631 return templ.render(props)
2632 return formatnode
2632 return formatnode
2633
2633
2634 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2634 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2635 filematcher=None, props=None):
2635 filematcher=None, props=None):
2636 props = props or {}
2636 props = props or {}
2637 formatnode = _graphnodeformatter(ui, displayer)
2637 formatnode = _graphnodeformatter(ui, displayer)
2638 state = graphmod.asciistate()
2638 state = graphmod.asciistate()
2639 styles = state['styles']
2639 styles = state['styles']
2640
2640
2641 # only set graph styling if HGPLAIN is not set.
2641 # only set graph styling if HGPLAIN is not set.
2642 if ui.plain('graph'):
2642 if ui.plain('graph'):
2643 # set all edge styles to |, the default pre-3.8 behaviour
2643 # set all edge styles to |, the default pre-3.8 behaviour
2644 styles.update(dict.fromkeys(styles, '|'))
2644 styles.update(dict.fromkeys(styles, '|'))
2645 else:
2645 else:
2646 edgetypes = {
2646 edgetypes = {
2647 'parent': graphmod.PARENT,
2647 'parent': graphmod.PARENT,
2648 'grandparent': graphmod.GRANDPARENT,
2648 'grandparent': graphmod.GRANDPARENT,
2649 'missing': graphmod.MISSINGPARENT
2649 'missing': graphmod.MISSINGPARENT
2650 }
2650 }
2651 for name, key in edgetypes.items():
2651 for name, key in edgetypes.items():
2652 # experimental config: experimental.graphstyle.*
2652 # experimental config: experimental.graphstyle.*
2653 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2653 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2654 styles[key])
2654 styles[key])
2655 if not styles[key]:
2655 if not styles[key]:
2656 styles[key] = None
2656 styles[key] = None
2657
2657
2658 # experimental config: experimental.graphshorten
2658 # experimental config: experimental.graphshorten
2659 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2659 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2660
2660
2661 for rev, type, ctx, parents in dag:
2661 for rev, type, ctx, parents in dag:
2662 char = formatnode(repo, ctx)
2662 char = formatnode(repo, ctx)
2663 copies = None
2663 copies = None
2664 if getrenamed and ctx.rev():
2664 if getrenamed and ctx.rev():
2665 copies = []
2665 copies = []
2666 for fn in ctx.files():
2666 for fn in ctx.files():
2667 rename = getrenamed(fn, ctx.rev())
2667 rename = getrenamed(fn, ctx.rev())
2668 if rename:
2668 if rename:
2669 copies.append((fn, rename[0]))
2669 copies.append((fn, rename[0]))
2670 revmatchfn = None
2670 revmatchfn = None
2671 if filematcher is not None:
2671 if filematcher is not None:
2672 revmatchfn = filematcher(ctx.rev())
2672 revmatchfn = filematcher(ctx.rev())
2673 edges = edgefn(type, char, state, rev, parents)
2673 edges = edgefn(type, char, state, rev, parents)
2674 firstedge = next(edges)
2674 firstedge = next(edges)
2675 width = firstedge[2]
2675 width = firstedge[2]
2676 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2676 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2677 _graphwidth=width, **pycompat.strkwargs(props))
2677 _graphwidth=width, **pycompat.strkwargs(props))
2678 lines = displayer.hunk.pop(rev).split('\n')
2678 lines = displayer.hunk.pop(rev).split('\n')
2679 if not lines[-1]:
2679 if not lines[-1]:
2680 del lines[-1]
2680 del lines[-1]
2681 displayer.flush(ctx)
2681 displayer.flush(ctx)
2682 for type, char, width, coldata in itertools.chain([firstedge], edges):
2682 for type, char, width, coldata in itertools.chain([firstedge], edges):
2683 graphmod.ascii(ui, state, type, char, lines, coldata)
2683 graphmod.ascii(ui, state, type, char, lines, coldata)
2684 lines = []
2684 lines = []
2685 displayer.close()
2685 displayer.close()
2686
2686
2687 def graphlog(ui, repo, revs, filematcher, opts):
2687 def graphlog(ui, repo, revs, filematcher, opts):
2688 # Parameters are identical to log command ones
2688 # Parameters are identical to log command ones
2689 revdag = graphmod.dagwalker(repo, revs)
2689 revdag = graphmod.dagwalker(repo, revs)
2690
2690
2691 getrenamed = None
2691 getrenamed = None
2692 if opts.get('copies'):
2692 if opts.get('copies'):
2693 endrev = None
2693 endrev = None
2694 if opts.get('rev'):
2694 if opts.get('rev'):
2695 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2695 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2696 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2696 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2697
2697
2698 ui.pager('log')
2698 ui.pager('log')
2699 displayer = show_changeset(ui, repo, opts, buffered=True)
2699 displayer = show_changeset(ui, repo, opts, buffered=True)
2700 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2700 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2701 filematcher)
2701 filematcher)
2702
2702
2703 def checkunsupportedgraphflags(pats, opts):
2703 def checkunsupportedgraphflags(pats, opts):
2704 for op in ["newest_first"]:
2704 for op in ["newest_first"]:
2705 if op in opts and opts[op]:
2705 if op in opts and opts[op]:
2706 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2706 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2707 % op.replace("_", "-"))
2707 % op.replace("_", "-"))
2708
2708
2709 def graphrevs(repo, nodes, opts):
2709 def graphrevs(repo, nodes, opts):
2710 limit = loglimit(opts)
2710 limit = loglimit(opts)
2711 nodes.reverse()
2711 nodes.reverse()
2712 if limit is not None:
2712 if limit is not None:
2713 nodes = nodes[:limit]
2713 nodes = nodes[:limit]
2714 return graphmod.nodes(repo, nodes)
2714 return graphmod.nodes(repo, nodes)
2715
2715
2716 def add(ui, repo, match, prefix, explicitonly, **opts):
2716 def add(ui, repo, match, prefix, explicitonly, **opts):
2717 join = lambda f: os.path.join(prefix, f)
2717 join = lambda f: os.path.join(prefix, f)
2718 bad = []
2718 bad = []
2719
2719
2720 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2720 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2721 names = []
2721 names = []
2722 wctx = repo[None]
2722 wctx = repo[None]
2723 cca = None
2723 cca = None
2724 abort, warn = scmutil.checkportabilityalert(ui)
2724 abort, warn = scmutil.checkportabilityalert(ui)
2725 if abort or warn:
2725 if abort or warn:
2726 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2726 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2727
2727
2728 badmatch = matchmod.badmatch(match, badfn)
2728 badmatch = matchmod.badmatch(match, badfn)
2729 dirstate = repo.dirstate
2729 dirstate = repo.dirstate
2730 # We don't want to just call wctx.walk here, since it would return a lot of
2730 # We don't want to just call wctx.walk here, since it would return a lot of
2731 # clean files, which we aren't interested in and takes time.
2731 # clean files, which we aren't interested in and takes time.
2732 for f in sorted(dirstate.walk(badmatch, subrepos=sorted(wctx.substate),
2732 for f in sorted(dirstate.walk(badmatch, subrepos=sorted(wctx.substate),
2733 unknown=True, ignored=False, full=False)):
2733 unknown=True, ignored=False, full=False)):
2734 exact = match.exact(f)
2734 exact = match.exact(f)
2735 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2735 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2736 if cca:
2736 if cca:
2737 cca(f)
2737 cca(f)
2738 names.append(f)
2738 names.append(f)
2739 if ui.verbose or not exact:
2739 if ui.verbose or not exact:
2740 ui.status(_('adding %s\n') % match.rel(f))
2740 ui.status(_('adding %s\n') % match.rel(f))
2741
2741
2742 for subpath in sorted(wctx.substate):
2742 for subpath in sorted(wctx.substate):
2743 sub = wctx.sub(subpath)
2743 sub = wctx.sub(subpath)
2744 try:
2744 try:
2745 submatch = matchmod.subdirmatcher(subpath, match)
2745 submatch = matchmod.subdirmatcher(subpath, match)
2746 if opts.get(r'subrepos'):
2746 if opts.get(r'subrepos'):
2747 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2747 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2748 else:
2748 else:
2749 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2749 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2750 except error.LookupError:
2750 except error.LookupError:
2751 ui.status(_("skipping missing subrepository: %s\n")
2751 ui.status(_("skipping missing subrepository: %s\n")
2752 % join(subpath))
2752 % join(subpath))
2753
2753
2754 if not opts.get(r'dry_run'):
2754 if not opts.get(r'dry_run'):
2755 rejected = wctx.add(names, prefix)
2755 rejected = wctx.add(names, prefix)
2756 bad.extend(f for f in rejected if f in match.files())
2756 bad.extend(f for f in rejected if f in match.files())
2757 return bad
2757 return bad
2758
2758
2759 def addwebdirpath(repo, serverpath, webconf):
2759 def addwebdirpath(repo, serverpath, webconf):
2760 webconf[serverpath] = repo.root
2760 webconf[serverpath] = repo.root
2761 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2761 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2762
2762
2763 for r in repo.revs('filelog("path:.hgsub")'):
2763 for r in repo.revs('filelog("path:.hgsub")'):
2764 ctx = repo[r]
2764 ctx = repo[r]
2765 for subpath in ctx.substate:
2765 for subpath in ctx.substate:
2766 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2766 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2767
2767
2768 def forget(ui, repo, match, prefix, explicitonly):
2768 def forget(ui, repo, match, prefix, explicitonly):
2769 join = lambda f: os.path.join(prefix, f)
2769 join = lambda f: os.path.join(prefix, f)
2770 bad = []
2770 bad = []
2771 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2771 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2772 wctx = repo[None]
2772 wctx = repo[None]
2773 forgot = []
2773 forgot = []
2774
2774
2775 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2775 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2776 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2776 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2777 if explicitonly:
2777 if explicitonly:
2778 forget = [f for f in forget if match.exact(f)]
2778 forget = [f for f in forget if match.exact(f)]
2779
2779
2780 for subpath in sorted(wctx.substate):
2780 for subpath in sorted(wctx.substate):
2781 sub = wctx.sub(subpath)
2781 sub = wctx.sub(subpath)
2782 try:
2782 try:
2783 submatch = matchmod.subdirmatcher(subpath, match)
2783 submatch = matchmod.subdirmatcher(subpath, match)
2784 subbad, subforgot = sub.forget(submatch, prefix)
2784 subbad, subforgot = sub.forget(submatch, prefix)
2785 bad.extend([subpath + '/' + f for f in subbad])
2785 bad.extend([subpath + '/' + f for f in subbad])
2786 forgot.extend([subpath + '/' + f for f in subforgot])
2786 forgot.extend([subpath + '/' + f for f in subforgot])
2787 except error.LookupError:
2787 except error.LookupError:
2788 ui.status(_("skipping missing subrepository: %s\n")
2788 ui.status(_("skipping missing subrepository: %s\n")
2789 % join(subpath))
2789 % join(subpath))
2790
2790
2791 if not explicitonly:
2791 if not explicitonly:
2792 for f in match.files():
2792 for f in match.files():
2793 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2793 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2794 if f not in forgot:
2794 if f not in forgot:
2795 if repo.wvfs.exists(f):
2795 if repo.wvfs.exists(f):
2796 # Don't complain if the exact case match wasn't given.
2796 # Don't complain if the exact case match wasn't given.
2797 # But don't do this until after checking 'forgot', so
2797 # But don't do this until after checking 'forgot', so
2798 # that subrepo files aren't normalized, and this op is
2798 # that subrepo files aren't normalized, and this op is
2799 # purely from data cached by the status walk above.
2799 # purely from data cached by the status walk above.
2800 if repo.dirstate.normalize(f) in repo.dirstate:
2800 if repo.dirstate.normalize(f) in repo.dirstate:
2801 continue
2801 continue
2802 ui.warn(_('not removing %s: '
2802 ui.warn(_('not removing %s: '
2803 'file is already untracked\n')
2803 'file is already untracked\n')
2804 % match.rel(f))
2804 % match.rel(f))
2805 bad.append(f)
2805 bad.append(f)
2806
2806
2807 for f in forget:
2807 for f in forget:
2808 if ui.verbose or not match.exact(f):
2808 if ui.verbose or not match.exact(f):
2809 ui.status(_('removing %s\n') % match.rel(f))
2809 ui.status(_('removing %s\n') % match.rel(f))
2810
2810
2811 rejected = wctx.forget(forget, prefix)
2811 rejected = wctx.forget(forget, prefix)
2812 bad.extend(f for f in rejected if f in match.files())
2812 bad.extend(f for f in rejected if f in match.files())
2813 forgot.extend(f for f in forget if f not in rejected)
2813 forgot.extend(f for f in forget if f not in rejected)
2814 return bad, forgot
2814 return bad, forgot
2815
2815
2816 def files(ui, ctx, m, fm, fmt, subrepos):
2816 def files(ui, ctx, m, fm, fmt, subrepos):
2817 rev = ctx.rev()
2817 rev = ctx.rev()
2818 ret = 1
2818 ret = 1
2819 ds = ctx.repo().dirstate
2819 ds = ctx.repo().dirstate
2820
2820
2821 for f in ctx.matches(m):
2821 for f in ctx.matches(m):
2822 if rev is None and ds[f] == 'r':
2822 if rev is None and ds[f] == 'r':
2823 continue
2823 continue
2824 fm.startitem()
2824 fm.startitem()
2825 if ui.verbose:
2825 if ui.verbose:
2826 fc = ctx[f]
2826 fc = ctx[f]
2827 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2827 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2828 fm.data(abspath=f)
2828 fm.data(abspath=f)
2829 fm.write('path', fmt, m.rel(f))
2829 fm.write('path', fmt, m.rel(f))
2830 ret = 0
2830 ret = 0
2831
2831
2832 for subpath in sorted(ctx.substate):
2832 for subpath in sorted(ctx.substate):
2833 submatch = matchmod.subdirmatcher(subpath, m)
2833 submatch = matchmod.subdirmatcher(subpath, m)
2834 if (subrepos or m.exact(subpath) or any(submatch.files())):
2834 if (subrepos or m.exact(subpath) or any(submatch.files())):
2835 sub = ctx.sub(subpath)
2835 sub = ctx.sub(subpath)
2836 try:
2836 try:
2837 recurse = m.exact(subpath) or subrepos
2837 recurse = m.exact(subpath) or subrepos
2838 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2838 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2839 ret = 0
2839 ret = 0
2840 except error.LookupError:
2840 except error.LookupError:
2841 ui.status(_("skipping missing subrepository: %s\n")
2841 ui.status(_("skipping missing subrepository: %s\n")
2842 % m.abs(subpath))
2842 % m.abs(subpath))
2843
2843
2844 return ret
2844 return ret
2845
2845
2846 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2846 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2847 join = lambda f: os.path.join(prefix, f)
2847 join = lambda f: os.path.join(prefix, f)
2848 ret = 0
2848 ret = 0
2849 s = repo.status(match=m, clean=True)
2849 s = repo.status(match=m, clean=True)
2850 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2850 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2851
2851
2852 wctx = repo[None]
2852 wctx = repo[None]
2853
2853
2854 if warnings is None:
2854 if warnings is None:
2855 warnings = []
2855 warnings = []
2856 warn = True
2856 warn = True
2857 else:
2857 else:
2858 warn = False
2858 warn = False
2859
2859
2860 subs = sorted(wctx.substate)
2860 subs = sorted(wctx.substate)
2861 total = len(subs)
2861 total = len(subs)
2862 count = 0
2862 count = 0
2863 for subpath in subs:
2863 for subpath in subs:
2864 count += 1
2864 count += 1
2865 submatch = matchmod.subdirmatcher(subpath, m)
2865 submatch = matchmod.subdirmatcher(subpath, m)
2866 if subrepos or m.exact(subpath) or any(submatch.files()):
2866 if subrepos or m.exact(subpath) or any(submatch.files()):
2867 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2867 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2868 sub = wctx.sub(subpath)
2868 sub = wctx.sub(subpath)
2869 try:
2869 try:
2870 if sub.removefiles(submatch, prefix, after, force, subrepos,
2870 if sub.removefiles(submatch, prefix, after, force, subrepos,
2871 warnings):
2871 warnings):
2872 ret = 1
2872 ret = 1
2873 except error.LookupError:
2873 except error.LookupError:
2874 warnings.append(_("skipping missing subrepository: %s\n")
2874 warnings.append(_("skipping missing subrepository: %s\n")
2875 % join(subpath))
2875 % join(subpath))
2876 ui.progress(_('searching'), None)
2876 ui.progress(_('searching'), None)
2877
2877
2878 # warn about failure to delete explicit files/dirs
2878 # warn about failure to delete explicit files/dirs
2879 deleteddirs = util.dirs(deleted)
2879 deleteddirs = util.dirs(deleted)
2880 files = m.files()
2880 files = m.files()
2881 total = len(files)
2881 total = len(files)
2882 count = 0
2882 count = 0
2883 for f in files:
2883 for f in files:
2884 def insubrepo():
2884 def insubrepo():
2885 for subpath in wctx.substate:
2885 for subpath in wctx.substate:
2886 if f.startswith(subpath + '/'):
2886 if f.startswith(subpath + '/'):
2887 return True
2887 return True
2888 return False
2888 return False
2889
2889
2890 count += 1
2890 count += 1
2891 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2891 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2892 isdir = f in deleteddirs or wctx.hasdir(f)
2892 isdir = f in deleteddirs or wctx.hasdir(f)
2893 if (f in repo.dirstate or isdir or f == '.'
2893 if (f in repo.dirstate or isdir or f == '.'
2894 or insubrepo() or f in subs):
2894 or insubrepo() or f in subs):
2895 continue
2895 continue
2896
2896
2897 if repo.wvfs.exists(f):
2897 if repo.wvfs.exists(f):
2898 if repo.wvfs.isdir(f):
2898 if repo.wvfs.isdir(f):
2899 warnings.append(_('not removing %s: no tracked files\n')
2899 warnings.append(_('not removing %s: no tracked files\n')
2900 % m.rel(f))
2900 % m.rel(f))
2901 else:
2901 else:
2902 warnings.append(_('not removing %s: file is untracked\n')
2902 warnings.append(_('not removing %s: file is untracked\n')
2903 % m.rel(f))
2903 % m.rel(f))
2904 # missing files will generate a warning elsewhere
2904 # missing files will generate a warning elsewhere
2905 ret = 1
2905 ret = 1
2906 ui.progress(_('deleting'), None)
2906 ui.progress(_('deleting'), None)
2907
2907
2908 if force:
2908 if force:
2909 list = modified + deleted + clean + added
2909 list = modified + deleted + clean + added
2910 elif after:
2910 elif after:
2911 list = deleted
2911 list = deleted
2912 remaining = modified + added + clean
2912 remaining = modified + added + clean
2913 total = len(remaining)
2913 total = len(remaining)
2914 count = 0
2914 count = 0
2915 for f in remaining:
2915 for f in remaining:
2916 count += 1
2916 count += 1
2917 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2917 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2918 if ui.verbose or (f in files):
2918 if ui.verbose or (f in files):
2919 warnings.append(_('not removing %s: file still exists\n')
2919 warnings.append(_('not removing %s: file still exists\n')
2920 % m.rel(f))
2920 % m.rel(f))
2921 ret = 1
2921 ret = 1
2922 ui.progress(_('skipping'), None)
2922 ui.progress(_('skipping'), None)
2923 else:
2923 else:
2924 list = deleted + clean
2924 list = deleted + clean
2925 total = len(modified) + len(added)
2925 total = len(modified) + len(added)
2926 count = 0
2926 count = 0
2927 for f in modified:
2927 for f in modified:
2928 count += 1
2928 count += 1
2929 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2929 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2930 warnings.append(_('not removing %s: file is modified (use -f'
2930 warnings.append(_('not removing %s: file is modified (use -f'
2931 ' to force removal)\n') % m.rel(f))
2931 ' to force removal)\n') % m.rel(f))
2932 ret = 1
2932 ret = 1
2933 for f in added:
2933 for f in added:
2934 count += 1
2934 count += 1
2935 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2935 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2936 warnings.append(_("not removing %s: file has been marked for add"
2936 warnings.append(_("not removing %s: file has been marked for add"
2937 " (use 'hg forget' to undo add)\n") % m.rel(f))
2937 " (use 'hg forget' to undo add)\n") % m.rel(f))
2938 ret = 1
2938 ret = 1
2939 ui.progress(_('skipping'), None)
2939 ui.progress(_('skipping'), None)
2940
2940
2941 list = sorted(list)
2941 list = sorted(list)
2942 total = len(list)
2942 total = len(list)
2943 count = 0
2943 count = 0
2944 for f in list:
2944 for f in list:
2945 count += 1
2945 count += 1
2946 if ui.verbose or not m.exact(f):
2946 if ui.verbose or not m.exact(f):
2947 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2947 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2948 ui.status(_('removing %s\n') % m.rel(f))
2948 ui.status(_('removing %s\n') % m.rel(f))
2949 ui.progress(_('deleting'), None)
2949 ui.progress(_('deleting'), None)
2950
2950
2951 with repo.wlock():
2951 with repo.wlock():
2952 if not after:
2952 if not after:
2953 for f in list:
2953 for f in list:
2954 if f in added:
2954 if f in added:
2955 continue # we never unlink added files on remove
2955 continue # we never unlink added files on remove
2956 repo.wvfs.unlinkpath(f, ignoremissing=True)
2956 repo.wvfs.unlinkpath(f, ignoremissing=True)
2957 repo[None].forget(list)
2957 repo[None].forget(list)
2958
2958
2959 if warn:
2959 if warn:
2960 for warning in warnings:
2960 for warning in warnings:
2961 ui.warn(warning)
2961 ui.warn(warning)
2962
2962
2963 return ret
2963 return ret
2964
2964
2965 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2965 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2966 err = 1
2966 err = 1
2967 opts = pycompat.byteskwargs(opts)
2967 opts = pycompat.byteskwargs(opts)
2968
2968
2969 def write(path):
2969 def write(path):
2970 filename = None
2970 filename = None
2971 if fntemplate:
2971 if fntemplate:
2972 filename = makefilename(repo, fntemplate, ctx.node(),
2972 filename = makefilename(repo, fntemplate, ctx.node(),
2973 pathname=os.path.join(prefix, path))
2973 pathname=os.path.join(prefix, path))
2974 # attempt to create the directory if it does not already exist
2974 # attempt to create the directory if it does not already exist
2975 try:
2975 try:
2976 os.makedirs(os.path.dirname(filename))
2976 os.makedirs(os.path.dirname(filename))
2977 except OSError:
2977 except OSError:
2978 pass
2978 pass
2979 with formatter.maybereopen(basefm, filename, opts) as fm:
2979 with formatter.maybereopen(basefm, filename, opts) as fm:
2980 data = ctx[path].data()
2980 data = ctx[path].data()
2981 if opts.get('decode'):
2981 if opts.get('decode'):
2982 data = repo.wwritedata(path, data)
2982 data = repo.wwritedata(path, data)
2983 fm.startitem()
2983 fm.startitem()
2984 fm.write('data', '%s', data)
2984 fm.write('data', '%s', data)
2985 fm.data(abspath=path, path=matcher.rel(path))
2985 fm.data(abspath=path, path=matcher.rel(path))
2986
2986
2987 # Automation often uses hg cat on single files, so special case it
2987 # Automation often uses hg cat on single files, so special case it
2988 # for performance to avoid the cost of parsing the manifest.
2988 # for performance to avoid the cost of parsing the manifest.
2989 if len(matcher.files()) == 1 and not matcher.anypats():
2989 if len(matcher.files()) == 1 and not matcher.anypats():
2990 file = matcher.files()[0]
2990 file = matcher.files()[0]
2991 mfl = repo.manifestlog
2991 mfl = repo.manifestlog
2992 mfnode = ctx.manifestnode()
2992 mfnode = ctx.manifestnode()
2993 try:
2993 try:
2994 if mfnode and mfl[mfnode].find(file)[0]:
2994 if mfnode and mfl[mfnode].find(file)[0]:
2995 write(file)
2995 write(file)
2996 return 0
2996 return 0
2997 except KeyError:
2997 except KeyError:
2998 pass
2998 pass
2999
2999
3000 for abs in ctx.walk(matcher):
3000 for abs in ctx.walk(matcher):
3001 write(abs)
3001 write(abs)
3002 err = 0
3002 err = 0
3003
3003
3004 for subpath in sorted(ctx.substate):
3004 for subpath in sorted(ctx.substate):
3005 sub = ctx.sub(subpath)
3005 sub = ctx.sub(subpath)
3006 try:
3006 try:
3007 submatch = matchmod.subdirmatcher(subpath, matcher)
3007 submatch = matchmod.subdirmatcher(subpath, matcher)
3008
3008
3009 if not sub.cat(submatch, basefm, fntemplate,
3009 if not sub.cat(submatch, basefm, fntemplate,
3010 os.path.join(prefix, sub._path),
3010 os.path.join(prefix, sub._path),
3011 **pycompat.strkwargs(opts)):
3011 **pycompat.strkwargs(opts)):
3012 err = 0
3012 err = 0
3013 except error.RepoLookupError:
3013 except error.RepoLookupError:
3014 ui.status(_("skipping missing subrepository: %s\n")
3014 ui.status(_("skipping missing subrepository: %s\n")
3015 % os.path.join(prefix, subpath))
3015 % os.path.join(prefix, subpath))
3016
3016
3017 return err
3017 return err
3018
3018
3019 def commit(ui, repo, commitfunc, pats, opts):
3019 def commit(ui, repo, commitfunc, pats, opts):
3020 '''commit the specified files or all outstanding changes'''
3020 '''commit the specified files or all outstanding changes'''
3021 date = opts.get('date')
3021 date = opts.get('date')
3022 if date:
3022 if date:
3023 opts['date'] = util.parsedate(date)
3023 opts['date'] = util.parsedate(date)
3024 message = logmessage(ui, opts)
3024 message = logmessage(ui, opts)
3025 matcher = scmutil.match(repo[None], pats, opts)
3025 matcher = scmutil.match(repo[None], pats, opts)
3026
3026
3027 dsguard = None
3027 dsguard = None
3028 # extract addremove carefully -- this function can be called from a command
3028 # extract addremove carefully -- this function can be called from a command
3029 # that doesn't support addremove
3029 # that doesn't support addremove
3030 if opts.get('addremove'):
3030 if opts.get('addremove'):
3031 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3031 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3032 with dsguard or util.nullcontextmanager():
3032 with dsguard or util.nullcontextmanager():
3033 if dsguard:
3033 if dsguard:
3034 if scmutil.addremove(repo, matcher, "", opts) != 0:
3034 if scmutil.addremove(repo, matcher, "", opts) != 0:
3035 raise error.Abort(
3035 raise error.Abort(
3036 _("failed to mark all new/missing files as added/removed"))
3036 _("failed to mark all new/missing files as added/removed"))
3037
3037
3038 return commitfunc(ui, repo, message, matcher, opts)
3038 return commitfunc(ui, repo, message, matcher, opts)
3039
3039
3040 def samefile(f, ctx1, ctx2):
3040 def samefile(f, ctx1, ctx2):
3041 if f in ctx1.manifest():
3041 if f in ctx1.manifest():
3042 a = ctx1.filectx(f)
3042 a = ctx1.filectx(f)
3043 if f in ctx2.manifest():
3043 if f in ctx2.manifest():
3044 b = ctx2.filectx(f)
3044 b = ctx2.filectx(f)
3045 return (not a.cmp(b)
3045 return (not a.cmp(b)
3046 and a.flags() == b.flags())
3046 and a.flags() == b.flags())
3047 else:
3047 else:
3048 return False
3048 return False
3049 else:
3049 else:
3050 return f not in ctx2.manifest()
3050 return f not in ctx2.manifest()
3051
3051
3052 def amend(ui, repo, old, extra, pats, opts):
3052 def amend(ui, repo, old, extra, pats, opts):
3053 # avoid cycle context -> subrepo -> cmdutil
3053 # avoid cycle context -> subrepo -> cmdutil
3054 from . import context
3054 from . import context
3055
3055
3056 # amend will reuse the existing user if not specified, but the obsolete
3056 # amend will reuse the existing user if not specified, but the obsolete
3057 # marker creation requires that the current user's name is specified.
3057 # marker creation requires that the current user's name is specified.
3058 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3058 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3059 ui.username() # raise exception if username not set
3059 ui.username() # raise exception if username not set
3060
3060
3061 ui.note(_('amending changeset %s\n') % old)
3061 ui.note(_('amending changeset %s\n') % old)
3062 base = old.p1()
3062 base = old.p1()
3063
3063
3064 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3064 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3065 # Participating changesets:
3065 # Participating changesets:
3066 #
3066 #
3067 # wctx o - workingctx that contains changes from working copy
3067 # wctx o - workingctx that contains changes from working copy
3068 # | to go into amending commit
3068 # | to go into amending commit
3069 # |
3069 # |
3070 # old o - changeset to amend
3070 # old o - changeset to amend
3071 # |
3071 # |
3072 # base o - first parent of the changeset to amend
3072 # base o - first parent of the changeset to amend
3073 wctx = repo[None]
3073 wctx = repo[None]
3074
3074
3075 # Copy to avoid mutating input
3075 # Copy to avoid mutating input
3076 extra = extra.copy()
3076 extra = extra.copy()
3077 # Update extra dict from amended commit (e.g. to preserve graft
3077 # Update extra dict from amended commit (e.g. to preserve graft
3078 # source)
3078 # source)
3079 extra.update(old.extra())
3079 extra.update(old.extra())
3080
3080
3081 # Also update it from the from the wctx
3081 # Also update it from the from the wctx
3082 extra.update(wctx.extra())
3082 extra.update(wctx.extra())
3083
3083
3084 user = opts.get('user') or old.user()
3084 user = opts.get('user') or old.user()
3085 date = opts.get('date') or old.date()
3085 date = opts.get('date') or old.date()
3086
3086
3087 # Parse the date to allow comparison between date and old.date()
3087 # Parse the date to allow comparison between date and old.date()
3088 date = util.parsedate(date)
3088 date = util.parsedate(date)
3089
3089
3090 if len(old.parents()) > 1:
3090 if len(old.parents()) > 1:
3091 # ctx.files() isn't reliable for merges, so fall back to the
3091 # ctx.files() isn't reliable for merges, so fall back to the
3092 # slower repo.status() method
3092 # slower repo.status() method
3093 files = set([fn for st in repo.status(base, old)[:3]
3093 files = set([fn for st in repo.status(base, old)[:3]
3094 for fn in st])
3094 for fn in st])
3095 else:
3095 else:
3096 files = set(old.files())
3096 files = set(old.files())
3097
3097
3098 # add/remove the files to the working copy if the "addremove" option
3098 # add/remove the files to the working copy if the "addremove" option
3099 # was specified.
3099 # was specified.
3100 matcher = scmutil.match(wctx, pats, opts)
3100 matcher = scmutil.match(wctx, pats, opts)
3101 if (opts.get('addremove')
3101 if (opts.get('addremove')
3102 and scmutil.addremove(repo, matcher, "", opts)):
3102 and scmutil.addremove(repo, matcher, "", opts)):
3103 raise error.Abort(
3103 raise error.Abort(
3104 _("failed to mark all new/missing files as added/removed"))
3104 _("failed to mark all new/missing files as added/removed"))
3105
3105
3106 # Check subrepos. This depends on in-place wctx._status update in
3106 # Check subrepos. This depends on in-place wctx._status update in
3107 # subrepo.precommit(). To minimize the risk of this hack, we do
3107 # subrepo.precommit(). To minimize the risk of this hack, we do
3108 # nothing if .hgsub does not exist.
3108 # nothing if .hgsub does not exist.
3109 if '.hgsub' in wctx or '.hgsub' in old:
3109 if '.hgsub' in wctx or '.hgsub' in old:
3110 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil
3110 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil
3111 subs, commitsubs, newsubstate = subrepo.precommit(
3111 subs, commitsubs, newsubstate = subrepo.precommit(
3112 ui, wctx, wctx._status, matcher)
3112 ui, wctx, wctx._status, matcher)
3113 # amend should abort if commitsubrepos is enabled
3113 # amend should abort if commitsubrepos is enabled
3114 assert not commitsubs
3114 assert not commitsubs
3115 if subs:
3115 if subs:
3116 subrepo.writestate(repo, newsubstate)
3116 subrepo.writestate(repo, newsubstate)
3117
3117
3118 filestoamend = set(f for f in wctx.files() if matcher(f))
3118 filestoamend = set(f for f in wctx.files() if matcher(f))
3119
3119
3120 changes = (len(filestoamend) > 0)
3120 changes = (len(filestoamend) > 0)
3121 if changes:
3121 if changes:
3122 # Recompute copies (avoid recording a -> b -> a)
3122 # Recompute copies (avoid recording a -> b -> a)
3123 copied = copies.pathcopies(base, wctx, matcher)
3123 copied = copies.pathcopies(base, wctx, matcher)
3124 if old.p2:
3124 if old.p2:
3125 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
3125 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
3126
3126
3127 # Prune files which were reverted by the updates: if old
3127 # Prune files which were reverted by the updates: if old
3128 # introduced file X and the file was renamed in the working
3128 # introduced file X and the file was renamed in the working
3129 # copy, then those two files are the same and
3129 # copy, then those two files are the same and
3130 # we can discard X from our list of files. Likewise if X
3130 # we can discard X from our list of files. Likewise if X
3131 # was removed, it's no longer relevant. If X is missing (aka
3131 # was removed, it's no longer relevant. If X is missing (aka
3132 # deleted), old X must be preserved.
3132 # deleted), old X must be preserved.
3133 files.update(filestoamend)
3133 files.update(filestoamend)
3134 files = [f for f in files if (not samefile(f, wctx, base)
3134 files = [f for f in files if (not samefile(f, wctx, base)
3135 or f in wctx.deleted())]
3135 or f in wctx.deleted())]
3136
3136
3137 def filectxfn(repo, ctx_, path):
3137 def filectxfn(repo, ctx_, path):
3138 try:
3138 try:
3139 # If the file being considered is not amongst the files
3139 # If the file being considered is not amongst the files
3140 # to be amended, we should return the file context from the
3140 # to be amended, we should return the file context from the
3141 # old changeset. This avoids issues when only some files in
3141 # old changeset. This avoids issues when only some files in
3142 # the working copy are being amended but there are also
3142 # the working copy are being amended but there are also
3143 # changes to other files from the old changeset.
3143 # changes to other files from the old changeset.
3144 if path not in filestoamend:
3144 if path not in filestoamend:
3145 return old.filectx(path)
3145 return old.filectx(path)
3146
3146
3147 # Return None for removed files.
3147 # Return None for removed files.
3148 if path in wctx.removed():
3148 if path in wctx.removed():
3149 return None
3149 return None
3150
3150
3151 fctx = wctx[path]
3151 fctx = wctx[path]
3152 flags = fctx.flags()
3152 flags = fctx.flags()
3153 mctx = context.memfilectx(repo, ctx_,
3153 mctx = context.memfilectx(repo, ctx_,
3154 fctx.path(), fctx.data(),
3154 fctx.path(), fctx.data(),
3155 islink='l' in flags,
3155 islink='l' in flags,
3156 isexec='x' in flags,
3156 isexec='x' in flags,
3157 copied=copied.get(path))
3157 copied=copied.get(path))
3158 return mctx
3158 return mctx
3159 except KeyError:
3159 except KeyError:
3160 return None
3160 return None
3161 else:
3161 else:
3162 ui.note(_('copying changeset %s to %s\n') % (old, base))
3162 ui.note(_('copying changeset %s to %s\n') % (old, base))
3163
3163
3164 # Use version of files as in the old cset
3164 # Use version of files as in the old cset
3165 def filectxfn(repo, ctx_, path):
3165 def filectxfn(repo, ctx_, path):
3166 try:
3166 try:
3167 return old.filectx(path)
3167 return old.filectx(path)
3168 except KeyError:
3168 except KeyError:
3169 return None
3169 return None
3170
3170
3171 # See if we got a message from -m or -l, if not, open the editor with
3171 # See if we got a message from -m or -l, if not, open the editor with
3172 # the message of the changeset to amend.
3172 # the message of the changeset to amend.
3173 message = logmessage(ui, opts)
3173 message = logmessage(ui, opts)
3174
3174
3175 editform = mergeeditform(old, 'commit.amend')
3175 editform = mergeeditform(old, 'commit.amend')
3176 editor = getcommiteditor(editform=editform,
3176 editor = getcommiteditor(editform=editform,
3177 **pycompat.strkwargs(opts))
3177 **pycompat.strkwargs(opts))
3178
3178
3179 if not message:
3179 if not message:
3180 editor = getcommiteditor(edit=True, editform=editform)
3180 editor = getcommiteditor(edit=True, editform=editform)
3181 message = old.description()
3181 message = old.description()
3182
3182
3183 pureextra = extra.copy()
3183 pureextra = extra.copy()
3184 extra['amend_source'] = old.hex()
3184 extra['amend_source'] = old.hex()
3185
3185
3186 new = context.memctx(repo,
3186 new = context.memctx(repo,
3187 parents=[base.node(), old.p2().node()],
3187 parents=[base.node(), old.p2().node()],
3188 text=message,
3188 text=message,
3189 files=files,
3189 files=files,
3190 filectxfn=filectxfn,
3190 filectxfn=filectxfn,
3191 user=user,
3191 user=user,
3192 date=date,
3192 date=date,
3193 extra=extra,
3193 extra=extra,
3194 editor=editor)
3194 editor=editor)
3195
3195
3196 newdesc = changelog.stripdesc(new.description())
3196 newdesc = changelog.stripdesc(new.description())
3197 if ((not changes)
3197 if ((not changes)
3198 and newdesc == old.description()
3198 and newdesc == old.description()
3199 and user == old.user()
3199 and user == old.user()
3200 and date == old.date()
3200 and date == old.date()
3201 and pureextra == old.extra()):
3201 and pureextra == old.extra()):
3202 # nothing changed. continuing here would create a new node
3202 # nothing changed. continuing here would create a new node
3203 # anyway because of the amend_source noise.
3203 # anyway because of the amend_source noise.
3204 #
3204 #
3205 # This not what we expect from amend.
3205 # This not what we expect from amend.
3206 return old.node()
3206 return old.node()
3207
3207
3208 if opts.get('secret'):
3208 if opts.get('secret'):
3209 commitphase = 'secret'
3209 commitphase = 'secret'
3210 else:
3210 else:
3211 commitphase = old.phase()
3211 commitphase = old.phase()
3212 overrides = {('phases', 'new-commit'): commitphase}
3212 overrides = {('phases', 'new-commit'): commitphase}
3213 with ui.configoverride(overrides, 'amend'):
3213 with ui.configoverride(overrides, 'amend'):
3214 newid = repo.commitctx(new)
3214 newid = repo.commitctx(new)
3215
3215
3216 # Reroute the working copy parent to the new changeset
3216 # Reroute the working copy parent to the new changeset
3217 repo.setparents(newid, nullid)
3217 repo.setparents(newid, nullid)
3218 mapping = {old.node(): (newid,)}
3218 mapping = {old.node(): (newid,)}
3219 obsmetadata = None
3219 obsmetadata = None
3220 if opts.get('note'):
3220 if opts.get('note'):
3221 obsmetadata = {'note': opts['note']}
3221 obsmetadata = {'note': opts['note']}
3222 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
3222 scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
3223
3223
3224 # Fixing the dirstate because localrepo.commitctx does not update
3224 # Fixing the dirstate because localrepo.commitctx does not update
3225 # it. This is rather convenient because we did not need to update
3225 # it. This is rather convenient because we did not need to update
3226 # the dirstate for all the files in the new commit which commitctx
3226 # the dirstate for all the files in the new commit which commitctx
3227 # could have done if it updated the dirstate. Now, we can
3227 # could have done if it updated the dirstate. Now, we can
3228 # selectively update the dirstate only for the amended files.
3228 # selectively update the dirstate only for the amended files.
3229 dirstate = repo.dirstate
3229 dirstate = repo.dirstate
3230
3230
3231 # Update the state of the files which were added and
3231 # Update the state of the files which were added and
3232 # and modified in the amend to "normal" in the dirstate.
3232 # and modified in the amend to "normal" in the dirstate.
3233 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend
3233 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend
3234 for f in normalfiles:
3234 for f in normalfiles:
3235 dirstate.normal(f)
3235 dirstate.normal(f)
3236
3236
3237 # Update the state of files which were removed in the amend
3237 # Update the state of files which were removed in the amend
3238 # to "removed" in the dirstate.
3238 # to "removed" in the dirstate.
3239 removedfiles = set(wctx.removed()) & filestoamend
3239 removedfiles = set(wctx.removed()) & filestoamend
3240 for f in removedfiles:
3240 for f in removedfiles:
3241 dirstate.drop(f)
3241 dirstate.drop(f)
3242
3242
3243 return newid
3243 return newid
3244
3244
3245 def commiteditor(repo, ctx, subs, editform=''):
3245 def commiteditor(repo, ctx, subs, editform=''):
3246 if ctx.description():
3246 if ctx.description():
3247 return ctx.description()
3247 return ctx.description()
3248 return commitforceeditor(repo, ctx, subs, editform=editform,
3248 return commitforceeditor(repo, ctx, subs, editform=editform,
3249 unchangedmessagedetection=True)
3249 unchangedmessagedetection=True)
3250
3250
3251 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3251 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3252 editform='', unchangedmessagedetection=False):
3252 editform='', unchangedmessagedetection=False):
3253 if not extramsg:
3253 if not extramsg:
3254 extramsg = _("Leave message empty to abort commit.")
3254 extramsg = _("Leave message empty to abort commit.")
3255
3255
3256 forms = [e for e in editform.split('.') if e]
3256 forms = [e for e in editform.split('.') if e]
3257 forms.insert(0, 'changeset')
3257 forms.insert(0, 'changeset')
3258 templatetext = None
3258 templatetext = None
3259 while forms:
3259 while forms:
3260 ref = '.'.join(forms)
3260 ref = '.'.join(forms)
3261 if repo.ui.config('committemplate', ref):
3261 if repo.ui.config('committemplate', ref):
3262 templatetext = committext = buildcommittemplate(
3262 templatetext = committext = buildcommittemplate(
3263 repo, ctx, subs, extramsg, ref)
3263 repo, ctx, subs, extramsg, ref)
3264 break
3264 break
3265 forms.pop()
3265 forms.pop()
3266 else:
3266 else:
3267 committext = buildcommittext(repo, ctx, subs, extramsg)
3267 committext = buildcommittext(repo, ctx, subs, extramsg)
3268
3268
3269 # run editor in the repository root
3269 # run editor in the repository root
3270 olddir = pycompat.getcwd()
3270 olddir = pycompat.getcwd()
3271 os.chdir(repo.root)
3271 os.chdir(repo.root)
3272
3272
3273 # make in-memory changes visible to external process
3273 # make in-memory changes visible to external process
3274 tr = repo.currenttransaction()
3274 tr = repo.currenttransaction()
3275 repo.dirstate.write(tr)
3275 repo.dirstate.write(tr)
3276 pending = tr and tr.writepending() and repo.root
3276 pending = tr and tr.writepending() and repo.root
3277
3277
3278 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3278 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3279 editform=editform, pending=pending,
3279 editform=editform, pending=pending,
3280 repopath=repo.path, action='commit')
3280 repopath=repo.path, action='commit')
3281 text = editortext
3281 text = editortext
3282
3282
3283 # strip away anything below this special string (used for editors that want
3283 # strip away anything below this special string (used for editors that want
3284 # to display the diff)
3284 # to display the diff)
3285 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3285 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3286 if stripbelow:
3286 if stripbelow:
3287 text = text[:stripbelow.start()]
3287 text = text[:stripbelow.start()]
3288
3288
3289 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3289 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3290 os.chdir(olddir)
3290 os.chdir(olddir)
3291
3291
3292 if finishdesc:
3292 if finishdesc:
3293 text = finishdesc(text)
3293 text = finishdesc(text)
3294 if not text.strip():
3294 if not text.strip():
3295 raise error.Abort(_("empty commit message"))
3295 raise error.Abort(_("empty commit message"))
3296 if unchangedmessagedetection and editortext == templatetext:
3296 if unchangedmessagedetection and editortext == templatetext:
3297 raise error.Abort(_("commit message unchanged"))
3297 raise error.Abort(_("commit message unchanged"))
3298
3298
3299 return text
3299 return text
3300
3300
3301 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3301 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3302 ui = repo.ui
3302 ui = repo.ui
3303 spec = formatter.templatespec(ref, None, None)
3303 spec = formatter.templatespec(ref, None, None)
3304 t = changeset_templater(ui, repo, spec, None, {}, False)
3304 t = changeset_templater(ui, repo, spec, None, {}, False)
3305 t.t.cache.update((k, templater.unquotestring(v))
3305 t.t.cache.update((k, templater.unquotestring(v))
3306 for k, v in repo.ui.configitems('committemplate'))
3306 for k, v in repo.ui.configitems('committemplate'))
3307
3307
3308 if not extramsg:
3308 if not extramsg:
3309 extramsg = '' # ensure that extramsg is string
3309 extramsg = '' # ensure that extramsg is string
3310
3310
3311 ui.pushbuffer()
3311 ui.pushbuffer()
3312 t.show(ctx, extramsg=extramsg)
3312 t.show(ctx, extramsg=extramsg)
3313 return ui.popbuffer()
3313 return ui.popbuffer()
3314
3314
3315 def hgprefix(msg):
3315 def hgprefix(msg):
3316 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3316 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3317
3317
3318 def buildcommittext(repo, ctx, subs, extramsg):
3318 def buildcommittext(repo, ctx, subs, extramsg):
3319 edittext = []
3319 edittext = []
3320 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3320 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3321 if ctx.description():
3321 if ctx.description():
3322 edittext.append(ctx.description())
3322 edittext.append(ctx.description())
3323 edittext.append("")
3323 edittext.append("")
3324 edittext.append("") # Empty line between message and comments.
3324 edittext.append("") # Empty line between message and comments.
3325 edittext.append(hgprefix(_("Enter commit message."
3325 edittext.append(hgprefix(_("Enter commit message."
3326 " Lines beginning with 'HG:' are removed.")))
3326 " Lines beginning with 'HG:' are removed.")))
3327 edittext.append(hgprefix(extramsg))
3327 edittext.append(hgprefix(extramsg))
3328 edittext.append("HG: --")
3328 edittext.append("HG: --")
3329 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3329 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3330 if ctx.p2():
3330 if ctx.p2():
3331 edittext.append(hgprefix(_("branch merge")))
3331 edittext.append(hgprefix(_("branch merge")))
3332 if ctx.branch():
3332 if ctx.branch():
3333 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3333 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3334 if bookmarks.isactivewdirparent(repo):
3334 if bookmarks.isactivewdirparent(repo):
3335 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3335 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3336 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3336 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3337 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3337 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3338 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3338 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3339 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3339 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3340 if not added and not modified and not removed:
3340 if not added and not modified and not removed:
3341 edittext.append(hgprefix(_("no files changed")))
3341 edittext.append(hgprefix(_("no files changed")))
3342 edittext.append("")
3342 edittext.append("")
3343
3343
3344 return "\n".join(edittext)
3344 return "\n".join(edittext)
3345
3345
3346 def commitstatus(repo, node, branch, bheads=None, opts=None):
3346 def commitstatus(repo, node, branch, bheads=None, opts=None):
3347 if opts is None:
3347 if opts is None:
3348 opts = {}
3348 opts = {}
3349 ctx = repo[node]
3349 ctx = repo[node]
3350 parents = ctx.parents()
3350 parents = ctx.parents()
3351
3351
3352 if (not opts.get('amend') and bheads and node not in bheads and not
3352 if (not opts.get('amend') and bheads and node not in bheads and not
3353 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3353 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3354 repo.ui.status(_('created new head\n'))
3354 repo.ui.status(_('created new head\n'))
3355 # The message is not printed for initial roots. For the other
3355 # The message is not printed for initial roots. For the other
3356 # changesets, it is printed in the following situations:
3356 # changesets, it is printed in the following situations:
3357 #
3357 #
3358 # Par column: for the 2 parents with ...
3358 # Par column: for the 2 parents with ...
3359 # N: null or no parent
3359 # N: null or no parent
3360 # B: parent is on another named branch
3360 # B: parent is on another named branch
3361 # C: parent is a regular non head changeset
3361 # C: parent is a regular non head changeset
3362 # H: parent was a branch head of the current branch
3362 # H: parent was a branch head of the current branch
3363 # Msg column: whether we print "created new head" message
3363 # Msg column: whether we print "created new head" message
3364 # In the following, it is assumed that there already exists some
3364 # In the following, it is assumed that there already exists some
3365 # initial branch heads of the current branch, otherwise nothing is
3365 # initial branch heads of the current branch, otherwise nothing is
3366 # printed anyway.
3366 # printed anyway.
3367 #
3367 #
3368 # Par Msg Comment
3368 # Par Msg Comment
3369 # N N y additional topo root
3369 # N N y additional topo root
3370 #
3370 #
3371 # B N y additional branch root
3371 # B N y additional branch root
3372 # C N y additional topo head
3372 # C N y additional topo head
3373 # H N n usual case
3373 # H N n usual case
3374 #
3374 #
3375 # B B y weird additional branch root
3375 # B B y weird additional branch root
3376 # C B y branch merge
3376 # C B y branch merge
3377 # H B n merge with named branch
3377 # H B n merge with named branch
3378 #
3378 #
3379 # C C y additional head from merge
3379 # C C y additional head from merge
3380 # C H n merge with a head
3380 # C H n merge with a head
3381 #
3381 #
3382 # H H n head merge: head count decreases
3382 # H H n head merge: head count decreases
3383
3383
3384 if not opts.get('close_branch'):
3384 if not opts.get('close_branch'):
3385 for r in parents:
3385 for r in parents:
3386 if r.closesbranch() and r.branch() == branch:
3386 if r.closesbranch() and r.branch() == branch:
3387 repo.ui.status(_('reopening closed branch head %d\n') % r)
3387 repo.ui.status(_('reopening closed branch head %d\n') % r)
3388
3388
3389 if repo.ui.debugflag:
3389 if repo.ui.debugflag:
3390 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3390 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3391 elif repo.ui.verbose:
3391 elif repo.ui.verbose:
3392 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3392 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3393
3393
3394 def postcommitstatus(repo, pats, opts):
3394 def postcommitstatus(repo, pats, opts):
3395 return repo.status(match=scmutil.match(repo[None], pats, opts))
3395 return repo.status(match=scmutil.match(repo[None], pats, opts))
3396
3396
3397 def revert(ui, repo, ctx, parents, *pats, **opts):
3397 def revert(ui, repo, ctx, parents, *pats, **opts):
3398 opts = pycompat.byteskwargs(opts)
3398 opts = pycompat.byteskwargs(opts)
3399 parent, p2 = parents
3399 parent, p2 = parents
3400 node = ctx.node()
3400 node = ctx.node()
3401
3401
3402 mf = ctx.manifest()
3402 mf = ctx.manifest()
3403 if node == p2:
3403 if node == p2:
3404 parent = p2
3404 parent = p2
3405
3405
3406 # need all matching names in dirstate and manifest of target rev,
3406 # need all matching names in dirstate and manifest of target rev,
3407 # so have to walk both. do not print errors if files exist in one
3407 # so have to walk both. do not print errors if files exist in one
3408 # but not other. in both cases, filesets should be evaluated against
3408 # but not other. in both cases, filesets should be evaluated against
3409 # workingctx to get consistent result (issue4497). this means 'set:**'
3409 # workingctx to get consistent result (issue4497). this means 'set:**'
3410 # cannot be used to select missing files from target rev.
3410 # cannot be used to select missing files from target rev.
3411
3411
3412 # `names` is a mapping for all elements in working copy and target revision
3412 # `names` is a mapping for all elements in working copy and target revision
3413 # The mapping is in the form:
3413 # The mapping is in the form:
3414 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3414 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3415 names = {}
3415 names = {}
3416
3416
3417 with repo.wlock():
3417 with repo.wlock():
3418 ## filling of the `names` mapping
3418 ## filling of the `names` mapping
3419 # walk dirstate to fill `names`
3419 # walk dirstate to fill `names`
3420
3420
3421 interactive = opts.get('interactive', False)
3421 interactive = opts.get('interactive', False)
3422 wctx = repo[None]
3422 wctx = repo[None]
3423 m = scmutil.match(wctx, pats, opts)
3423 m = scmutil.match(wctx, pats, opts)
3424
3424
3425 # we'll need this later
3425 # we'll need this later
3426 targetsubs = sorted(s for s in wctx.substate if m(s))
3426 targetsubs = sorted(s for s in wctx.substate if m(s))
3427
3427
3428 if not m.always():
3428 if not m.always():
3429 matcher = matchmod.badmatch(m, lambda x, y: False)
3429 matcher = matchmod.badmatch(m, lambda x, y: False)
3430 for abs in wctx.walk(matcher):
3430 for abs in wctx.walk(matcher):
3431 names[abs] = m.rel(abs), m.exact(abs)
3431 names[abs] = m.rel(abs), m.exact(abs)
3432
3432
3433 # walk target manifest to fill `names`
3433 # walk target manifest to fill `names`
3434
3434
3435 def badfn(path, msg):
3435 def badfn(path, msg):
3436 if path in names:
3436 if path in names:
3437 return
3437 return
3438 if path in ctx.substate:
3438 if path in ctx.substate:
3439 return
3439 return
3440 path_ = path + '/'
3440 path_ = path + '/'
3441 for f in names:
3441 for f in names:
3442 if f.startswith(path_):
3442 if f.startswith(path_):
3443 return
3443 return
3444 ui.warn("%s: %s\n" % (m.rel(path), msg))
3444 ui.warn("%s: %s\n" % (m.rel(path), msg))
3445
3445
3446 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3446 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3447 if abs not in names:
3447 if abs not in names:
3448 names[abs] = m.rel(abs), m.exact(abs)
3448 names[abs] = m.rel(abs), m.exact(abs)
3449
3449
3450 # Find status of all file in `names`.
3450 # Find status of all file in `names`.
3451 m = scmutil.matchfiles(repo, names)
3451 m = scmutil.matchfiles(repo, names)
3452
3452
3453 changes = repo.status(node1=node, match=m,
3453 changes = repo.status(node1=node, match=m,
3454 unknown=True, ignored=True, clean=True)
3454 unknown=True, ignored=True, clean=True)
3455 else:
3455 else:
3456 changes = repo.status(node1=node, match=m)
3456 changes = repo.status(node1=node, match=m)
3457 for kind in changes:
3457 for kind in changes:
3458 for abs in kind:
3458 for abs in kind:
3459 names[abs] = m.rel(abs), m.exact(abs)
3459 names[abs] = m.rel(abs), m.exact(abs)
3460
3460
3461 m = scmutil.matchfiles(repo, names)
3461 m = scmutil.matchfiles(repo, names)
3462
3462
3463 modified = set(changes.modified)
3463 modified = set(changes.modified)
3464 added = set(changes.added)
3464 added = set(changes.added)
3465 removed = set(changes.removed)
3465 removed = set(changes.removed)
3466 _deleted = set(changes.deleted)
3466 _deleted = set(changes.deleted)
3467 unknown = set(changes.unknown)
3467 unknown = set(changes.unknown)
3468 unknown.update(changes.ignored)
3468 unknown.update(changes.ignored)
3469 clean = set(changes.clean)
3469 clean = set(changes.clean)
3470 modadded = set()
3470 modadded = set()
3471
3471
3472 # We need to account for the state of the file in the dirstate,
3472 # We need to account for the state of the file in the dirstate,
3473 # even when we revert against something else than parent. This will
3473 # even when we revert against something else than parent. This will
3474 # slightly alter the behavior of revert (doing back up or not, delete
3474 # slightly alter the behavior of revert (doing back up or not, delete
3475 # or just forget etc).
3475 # or just forget etc).
3476 if parent == node:
3476 if parent == node:
3477 dsmodified = modified
3477 dsmodified = modified
3478 dsadded = added
3478 dsadded = added
3479 dsremoved = removed
3479 dsremoved = removed
3480 # store all local modifications, useful later for rename detection
3480 # store all local modifications, useful later for rename detection
3481 localchanges = dsmodified | dsadded
3481 localchanges = dsmodified | dsadded
3482 modified, added, removed = set(), set(), set()
3482 modified, added, removed = set(), set(), set()
3483 else:
3483 else:
3484 changes = repo.status(node1=parent, match=m)
3484 changes = repo.status(node1=parent, match=m)
3485 dsmodified = set(changes.modified)
3485 dsmodified = set(changes.modified)
3486 dsadded = set(changes.added)
3486 dsadded = set(changes.added)
3487 dsremoved = set(changes.removed)
3487 dsremoved = set(changes.removed)
3488 # store all local modifications, useful later for rename detection
3488 # store all local modifications, useful later for rename detection
3489 localchanges = dsmodified | dsadded
3489 localchanges = dsmodified | dsadded
3490
3490
3491 # only take into account for removes between wc and target
3491 # only take into account for removes between wc and target
3492 clean |= dsremoved - removed
3492 clean |= dsremoved - removed
3493 dsremoved &= removed
3493 dsremoved &= removed
3494 # distinct between dirstate remove and other
3494 # distinct between dirstate remove and other
3495 removed -= dsremoved
3495 removed -= dsremoved
3496
3496
3497 modadded = added & dsmodified
3497 modadded = added & dsmodified
3498 added -= modadded
3498 added -= modadded
3499
3499
3500 # tell newly modified apart.
3500 # tell newly modified apart.
3501 dsmodified &= modified
3501 dsmodified &= modified
3502 dsmodified |= modified & dsadded # dirstate added may need backup
3502 dsmodified |= modified & dsadded # dirstate added may need backup
3503 modified -= dsmodified
3503 modified -= dsmodified
3504
3504
3505 # We need to wait for some post-processing to update this set
3505 # We need to wait for some post-processing to update this set
3506 # before making the distinction. The dirstate will be used for
3506 # before making the distinction. The dirstate will be used for
3507 # that purpose.
3507 # that purpose.
3508 dsadded = added
3508 dsadded = added
3509
3509
3510 # in case of merge, files that are actually added can be reported as
3510 # in case of merge, files that are actually added can be reported as
3511 # modified, we need to post process the result
3511 # modified, we need to post process the result
3512 if p2 != nullid:
3512 if p2 != nullid:
3513 mergeadd = set(dsmodified)
3513 mergeadd = set(dsmodified)
3514 for path in dsmodified:
3514 for path in dsmodified:
3515 if path in mf:
3515 if path in mf:
3516 mergeadd.remove(path)
3516 mergeadd.remove(path)
3517 dsadded |= mergeadd
3517 dsadded |= mergeadd
3518 dsmodified -= mergeadd
3518 dsmodified -= mergeadd
3519
3519
3520 # if f is a rename, update `names` to also revert the source
3520 # if f is a rename, update `names` to also revert the source
3521 cwd = repo.getcwd()
3521 cwd = repo.getcwd()
3522 for f in localchanges:
3522 for f in localchanges:
3523 src = repo.dirstate.copied(f)
3523 src = repo.dirstate.copied(f)
3524 # XXX should we check for rename down to target node?
3524 # XXX should we check for rename down to target node?
3525 if src and src not in names and repo.dirstate[src] == 'r':
3525 if src and src not in names and repo.dirstate[src] == 'r':
3526 dsremoved.add(src)
3526 dsremoved.add(src)
3527 names[src] = (repo.pathto(src, cwd), True)
3527 names[src] = (repo.pathto(src, cwd), True)
3528
3528
3529 # determine the exact nature of the deleted changesets
3529 # determine the exact nature of the deleted changesets
3530 deladded = set(_deleted)
3530 deladded = set(_deleted)
3531 for path in _deleted:
3531 for path in _deleted:
3532 if path in mf:
3532 if path in mf:
3533 deladded.remove(path)
3533 deladded.remove(path)
3534 deleted = _deleted - deladded
3534 deleted = _deleted - deladded
3535
3535
3536 # distinguish between file to forget and the other
3536 # distinguish between file to forget and the other
3537 added = set()
3537 added = set()
3538 for abs in dsadded:
3538 for abs in dsadded:
3539 if repo.dirstate[abs] != 'a':
3539 if repo.dirstate[abs] != 'a':
3540 added.add(abs)
3540 added.add(abs)
3541 dsadded -= added
3541 dsadded -= added
3542
3542
3543 for abs in deladded:
3543 for abs in deladded:
3544 if repo.dirstate[abs] == 'a':
3544 if repo.dirstate[abs] == 'a':
3545 dsadded.add(abs)
3545 dsadded.add(abs)
3546 deladded -= dsadded
3546 deladded -= dsadded
3547
3547
3548 # For files marked as removed, we check if an unknown file is present at
3548 # For files marked as removed, we check if an unknown file is present at
3549 # the same path. If a such file exists it may need to be backed up.
3549 # the same path. If a such file exists it may need to be backed up.
3550 # Making the distinction at this stage helps have simpler backup
3550 # Making the distinction at this stage helps have simpler backup
3551 # logic.
3551 # logic.
3552 removunk = set()
3552 removunk = set()
3553 for abs in removed:
3553 for abs in removed:
3554 target = repo.wjoin(abs)
3554 target = repo.wjoin(abs)
3555 if os.path.lexists(target):
3555 if os.path.lexists(target):
3556 removunk.add(abs)
3556 removunk.add(abs)
3557 removed -= removunk
3557 removed -= removunk
3558
3558
3559 dsremovunk = set()
3559 dsremovunk = set()
3560 for abs in dsremoved:
3560 for abs in dsremoved:
3561 target = repo.wjoin(abs)
3561 target = repo.wjoin(abs)
3562 if os.path.lexists(target):
3562 if os.path.lexists(target):
3563 dsremovunk.add(abs)
3563 dsremovunk.add(abs)
3564 dsremoved -= dsremovunk
3564 dsremoved -= dsremovunk
3565
3565
3566 # action to be actually performed by revert
3566 # action to be actually performed by revert
3567 # (<list of file>, message>) tuple
3567 # (<list of file>, message>) tuple
3568 actions = {'revert': ([], _('reverting %s\n')),
3568 actions = {'revert': ([], _('reverting %s\n')),
3569 'add': ([], _('adding %s\n')),
3569 'add': ([], _('adding %s\n')),
3570 'remove': ([], _('removing %s\n')),
3570 'remove': ([], _('removing %s\n')),
3571 'drop': ([], _('removing %s\n')),
3571 'drop': ([], _('removing %s\n')),
3572 'forget': ([], _('forgetting %s\n')),
3572 'forget': ([], _('forgetting %s\n')),
3573 'undelete': ([], _('undeleting %s\n')),
3573 'undelete': ([], _('undeleting %s\n')),
3574 'noop': (None, _('no changes needed to %s\n')),
3574 'noop': (None, _('no changes needed to %s\n')),
3575 'unknown': (None, _('file not managed: %s\n')),
3575 'unknown': (None, _('file not managed: %s\n')),
3576 }
3576 }
3577
3577
3578 # "constant" that convey the backup strategy.
3578 # "constant" that convey the backup strategy.
3579 # All set to `discard` if `no-backup` is set do avoid checking
3579 # All set to `discard` if `no-backup` is set do avoid checking
3580 # no_backup lower in the code.
3580 # no_backup lower in the code.
3581 # These values are ordered for comparison purposes
3581 # These values are ordered for comparison purposes
3582 backupinteractive = 3 # do backup if interactively modified
3582 backupinteractive = 3 # do backup if interactively modified
3583 backup = 2 # unconditionally do backup
3583 backup = 2 # unconditionally do backup
3584 check = 1 # check if the existing file differs from target
3584 check = 1 # check if the existing file differs from target
3585 discard = 0 # never do backup
3585 discard = 0 # never do backup
3586 if opts.get('no_backup'):
3586 if opts.get('no_backup'):
3587 backupinteractive = backup = check = discard
3587 backupinteractive = backup = check = discard
3588 if interactive:
3588 if interactive:
3589 dsmodifiedbackup = backupinteractive
3589 dsmodifiedbackup = backupinteractive
3590 else:
3590 else:
3591 dsmodifiedbackup = backup
3591 dsmodifiedbackup = backup
3592 tobackup = set()
3592 tobackup = set()
3593
3593
3594 backupanddel = actions['remove']
3594 backupanddel = actions['remove']
3595 if not opts.get('no_backup'):
3595 if not opts.get('no_backup'):
3596 backupanddel = actions['drop']
3596 backupanddel = actions['drop']
3597
3597
3598 disptable = (
3598 disptable = (
3599 # dispatch table:
3599 # dispatch table:
3600 # file state
3600 # file state
3601 # action
3601 # action
3602 # make backup
3602 # make backup
3603
3603
3604 ## Sets that results that will change file on disk
3604 ## Sets that results that will change file on disk
3605 # Modified compared to target, no local change
3605 # Modified compared to target, no local change
3606 (modified, actions['revert'], discard),
3606 (modified, actions['revert'], discard),
3607 # Modified compared to target, but local file is deleted
3607 # Modified compared to target, but local file is deleted
3608 (deleted, actions['revert'], discard),
3608 (deleted, actions['revert'], discard),
3609 # Modified compared to target, local change
3609 # Modified compared to target, local change
3610 (dsmodified, actions['revert'], dsmodifiedbackup),
3610 (dsmodified, actions['revert'], dsmodifiedbackup),
3611 # Added since target
3611 # Added since target
3612 (added, actions['remove'], discard),
3612 (added, actions['remove'], discard),
3613 # Added in working directory
3613 # Added in working directory
3614 (dsadded, actions['forget'], discard),
3614 (dsadded, actions['forget'], discard),
3615 # Added since target, have local modification
3615 # Added since target, have local modification
3616 (modadded, backupanddel, backup),
3616 (modadded, backupanddel, backup),
3617 # Added since target but file is missing in working directory
3617 # Added since target but file is missing in working directory
3618 (deladded, actions['drop'], discard),
3618 (deladded, actions['drop'], discard),
3619 # Removed since target, before working copy parent
3619 # Removed since target, before working copy parent
3620 (removed, actions['add'], discard),
3620 (removed, actions['add'], discard),
3621 # Same as `removed` but an unknown file exists at the same path
3621 # Same as `removed` but an unknown file exists at the same path
3622 (removunk, actions['add'], check),
3622 (removunk, actions['add'], check),
3623 # Removed since targe, marked as such in working copy parent
3623 # Removed since targe, marked as such in working copy parent
3624 (dsremoved, actions['undelete'], discard),
3624 (dsremoved, actions['undelete'], discard),
3625 # Same as `dsremoved` but an unknown file exists at the same path
3625 # Same as `dsremoved` but an unknown file exists at the same path
3626 (dsremovunk, actions['undelete'], check),
3626 (dsremovunk, actions['undelete'], check),
3627 ## the following sets does not result in any file changes
3627 ## the following sets does not result in any file changes
3628 # File with no modification
3628 # File with no modification
3629 (clean, actions['noop'], discard),
3629 (clean, actions['noop'], discard),
3630 # Existing file, not tracked anywhere
3630 # Existing file, not tracked anywhere
3631 (unknown, actions['unknown'], discard),
3631 (unknown, actions['unknown'], discard),
3632 )
3632 )
3633
3633
3634 for abs, (rel, exact) in sorted(names.items()):
3634 for abs, (rel, exact) in sorted(names.items()):
3635 # target file to be touch on disk (relative to cwd)
3635 # target file to be touch on disk (relative to cwd)
3636 target = repo.wjoin(abs)
3636 target = repo.wjoin(abs)
3637 # search the entry in the dispatch table.
3637 # search the entry in the dispatch table.
3638 # if the file is in any of these sets, it was touched in the working
3638 # if the file is in any of these sets, it was touched in the working
3639 # directory parent and we are sure it needs to be reverted.
3639 # directory parent and we are sure it needs to be reverted.
3640 for table, (xlist, msg), dobackup in disptable:
3640 for table, (xlist, msg), dobackup in disptable:
3641 if abs not in table:
3641 if abs not in table:
3642 continue
3642 continue
3643 if xlist is not None:
3643 if xlist is not None:
3644 xlist.append(abs)
3644 xlist.append(abs)
3645 if dobackup:
3645 if dobackup:
3646 # If in interactive mode, don't automatically create
3646 # If in interactive mode, don't automatically create
3647 # .orig files (issue4793)
3647 # .orig files (issue4793)
3648 if dobackup == backupinteractive:
3648 if dobackup == backupinteractive:
3649 tobackup.add(abs)
3649 tobackup.add(abs)
3650 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3650 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3651 bakname = scmutil.origpath(ui, repo, rel)
3651 bakname = scmutil.origpath(ui, repo, rel)
3652 ui.note(_('saving current version of %s as %s\n') %
3652 ui.note(_('saving current version of %s as %s\n') %
3653 (rel, bakname))
3653 (rel, bakname))
3654 if not opts.get('dry_run'):
3654 if not opts.get('dry_run'):
3655 if interactive:
3655 if interactive:
3656 util.copyfile(target, bakname)
3656 util.copyfile(target, bakname)
3657 else:
3657 else:
3658 util.rename(target, bakname)
3658 util.rename(target, bakname)
3659 if ui.verbose or not exact:
3659 if ui.verbose or not exact:
3660 if not isinstance(msg, bytes):
3660 if not isinstance(msg, bytes):
3661 msg = msg(abs)
3661 msg = msg(abs)
3662 ui.status(msg % rel)
3662 ui.status(msg % rel)
3663 elif exact:
3663 elif exact:
3664 ui.warn(msg % rel)
3664 ui.warn(msg % rel)
3665 break
3665 break
3666
3666
3667 if not opts.get('dry_run'):
3667 if not opts.get('dry_run'):
3668 needdata = ('revert', 'add', 'undelete')
3668 needdata = ('revert', 'add', 'undelete')
3669 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3669 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3670 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3670 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3671
3671
3672 if targetsubs:
3672 if targetsubs:
3673 # Revert the subrepos on the revert list
3673 # Revert the subrepos on the revert list
3674 for sub in targetsubs:
3674 for sub in targetsubs:
3675 try:
3675 try:
3676 wctx.sub(sub).revert(ctx.substate[sub], *pats,
3676 wctx.sub(sub).revert(ctx.substate[sub], *pats,
3677 **pycompat.strkwargs(opts))
3677 **pycompat.strkwargs(opts))
3678 except KeyError:
3678 except KeyError:
3679 raise error.Abort("subrepository '%s' does not exist in %s!"
3679 raise error.Abort("subrepository '%s' does not exist in %s!"
3680 % (sub, short(ctx.node())))
3680 % (sub, short(ctx.node())))
3681
3681
3682 def _revertprefetch(repo, ctx, *files):
3682 def _revertprefetch(repo, ctx, *files):
3683 """Let extension changing the storage layer prefetch content"""
3683 """Let extension changing the storage layer prefetch content"""
3684
3684
3685 def _performrevert(repo, parents, ctx, actions, interactive=False,
3685 def _performrevert(repo, parents, ctx, actions, interactive=False,
3686 tobackup=None):
3686 tobackup=None):
3687 """function that actually perform all the actions computed for revert
3687 """function that actually perform all the actions computed for revert
3688
3688
3689 This is an independent function to let extension to plug in and react to
3689 This is an independent function to let extension to plug in and react to
3690 the imminent revert.
3690 the imminent revert.
3691
3691
3692 Make sure you have the working directory locked when calling this function.
3692 Make sure you have the working directory locked when calling this function.
3693 """
3693 """
3694 parent, p2 = parents
3694 parent, p2 = parents
3695 node = ctx.node()
3695 node = ctx.node()
3696 excluded_files = []
3696 excluded_files = []
3697 matcher_opts = {"exclude": excluded_files}
3697 matcher_opts = {"exclude": excluded_files}
3698
3698
3699 def checkout(f):
3699 def checkout(f):
3700 fc = ctx[f]
3700 fc = ctx[f]
3701 repo.wwrite(f, fc.data(), fc.flags())
3701 repo.wwrite(f, fc.data(), fc.flags())
3702
3702
3703 def doremove(f):
3703 def doremove(f):
3704 try:
3704 try:
3705 repo.wvfs.unlinkpath(f)
3705 repo.wvfs.unlinkpath(f)
3706 except OSError:
3706 except OSError:
3707 pass
3707 pass
3708 repo.dirstate.remove(f)
3708 repo.dirstate.remove(f)
3709
3709
3710 audit_path = pathutil.pathauditor(repo.root, cached=True)
3710 audit_path = pathutil.pathauditor(repo.root, cached=True)
3711 for f in actions['forget'][0]:
3711 for f in actions['forget'][0]:
3712 if interactive:
3712 if interactive:
3713 choice = repo.ui.promptchoice(
3713 choice = repo.ui.promptchoice(
3714 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3714 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3715 if choice == 0:
3715 if choice == 0:
3716 repo.dirstate.drop(f)
3716 repo.dirstate.drop(f)
3717 else:
3717 else:
3718 excluded_files.append(repo.wjoin(f))
3718 excluded_files.append(repo.wjoin(f))
3719 else:
3719 else:
3720 repo.dirstate.drop(f)
3720 repo.dirstate.drop(f)
3721 for f in actions['remove'][0]:
3721 for f in actions['remove'][0]:
3722 audit_path(f)
3722 audit_path(f)
3723 if interactive:
3723 if interactive:
3724 choice = repo.ui.promptchoice(
3724 choice = repo.ui.promptchoice(
3725 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3725 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3726 if choice == 0:
3726 if choice == 0:
3727 doremove(f)
3727 doremove(f)
3728 else:
3728 else:
3729 excluded_files.append(repo.wjoin(f))
3729 excluded_files.append(repo.wjoin(f))
3730 else:
3730 else:
3731 doremove(f)
3731 doremove(f)
3732 for f in actions['drop'][0]:
3732 for f in actions['drop'][0]:
3733 audit_path(f)
3733 audit_path(f)
3734 repo.dirstate.remove(f)
3734 repo.dirstate.remove(f)
3735
3735
3736 normal = None
3736 normal = None
3737 if node == parent:
3737 if node == parent:
3738 # We're reverting to our parent. If possible, we'd like status
3738 # We're reverting to our parent. If possible, we'd like status
3739 # to report the file as clean. We have to use normallookup for
3739 # to report the file as clean. We have to use normallookup for
3740 # merges to avoid losing information about merged/dirty files.
3740 # merges to avoid losing information about merged/dirty files.
3741 if p2 != nullid:
3741 if p2 != nullid:
3742 normal = repo.dirstate.normallookup
3742 normal = repo.dirstate.normallookup
3743 else:
3743 else:
3744 normal = repo.dirstate.normal
3744 normal = repo.dirstate.normal
3745
3745
3746 newlyaddedandmodifiedfiles = set()
3746 newlyaddedandmodifiedfiles = set()
3747 if interactive:
3747 if interactive:
3748 # Prompt the user for changes to revert
3748 # Prompt the user for changes to revert
3749 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3749 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3750 m = scmutil.match(ctx, torevert, matcher_opts)
3750 m = scmutil.match(ctx, torevert, matcher_opts)
3751 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3751 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3752 diffopts.nodates = True
3752 diffopts.nodates = True
3753 diffopts.git = True
3753 diffopts.git = True
3754 operation = 'discard'
3754 operation = 'discard'
3755 reversehunks = True
3755 reversehunks = True
3756 if node != parent:
3756 if node != parent:
3757 operation = 'apply'
3757 operation = 'apply'
3758 reversehunks = False
3758 reversehunks = False
3759 if reversehunks:
3759 if reversehunks:
3760 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3760 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3761 else:
3761 else:
3762 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3762 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3763 originalchunks = patch.parsepatch(diff)
3763 originalchunks = patch.parsepatch(diff)
3764
3764
3765 try:
3765 try:
3766
3766
3767 chunks, opts = recordfilter(repo.ui, originalchunks,
3767 chunks, opts = recordfilter(repo.ui, originalchunks,
3768 operation=operation)
3768 operation=operation)
3769 if reversehunks:
3769 if reversehunks:
3770 chunks = patch.reversehunks(chunks)
3770 chunks = patch.reversehunks(chunks)
3771
3771
3772 except error.PatchError as err:
3772 except error.PatchError as err:
3773 raise error.Abort(_('error parsing patch: %s') % err)
3773 raise error.Abort(_('error parsing patch: %s') % err)
3774
3774
3775 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3775 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3776 if tobackup is None:
3776 if tobackup is None:
3777 tobackup = set()
3777 tobackup = set()
3778 # Apply changes
3778 # Apply changes
3779 fp = stringio()
3779 fp = stringio()
3780 for c in chunks:
3780 for c in chunks:
3781 # Create a backup file only if this hunk should be backed up
3781 # Create a backup file only if this hunk should be backed up
3782 if ishunk(c) and c.header.filename() in tobackup:
3782 if ishunk(c) and c.header.filename() in tobackup:
3783 abs = c.header.filename()
3783 abs = c.header.filename()
3784 target = repo.wjoin(abs)
3784 target = repo.wjoin(abs)
3785 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3785 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3786 util.copyfile(target, bakname)
3786 util.copyfile(target, bakname)
3787 tobackup.remove(abs)
3787 tobackup.remove(abs)
3788 c.write(fp)
3788 c.write(fp)
3789 dopatch = fp.tell()
3789 dopatch = fp.tell()
3790 fp.seek(0)
3790 fp.seek(0)
3791 if dopatch:
3791 if dopatch:
3792 try:
3792 try:
3793 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3793 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3794 except error.PatchError as err:
3794 except error.PatchError as err:
3795 raise error.Abort(str(err))
3795 raise error.Abort(str(err))
3796 del fp
3796 del fp
3797 else:
3797 else:
3798 for f in actions['revert'][0]:
3798 for f in actions['revert'][0]:
3799 checkout(f)
3799 checkout(f)
3800 if normal:
3800 if normal:
3801 normal(f)
3801 normal(f)
3802
3802
3803 for f in actions['add'][0]:
3803 for f in actions['add'][0]:
3804 # Don't checkout modified files, they are already created by the diff
3804 # Don't checkout modified files, they are already created by the diff
3805 if f not in newlyaddedandmodifiedfiles:
3805 if f not in newlyaddedandmodifiedfiles:
3806 checkout(f)
3806 checkout(f)
3807 repo.dirstate.add(f)
3807 repo.dirstate.add(f)
3808
3808
3809 normal = repo.dirstate.normallookup
3809 normal = repo.dirstate.normallookup
3810 if node == parent and p2 == nullid:
3810 if node == parent and p2 == nullid:
3811 normal = repo.dirstate.normal
3811 normal = repo.dirstate.normal
3812 for f in actions['undelete'][0]:
3812 for f in actions['undelete'][0]:
3813 checkout(f)
3813 checkout(f)
3814 normal(f)
3814 normal(f)
3815
3815
3816 copied = copies.pathcopies(repo[parent], ctx)
3816 copied = copies.pathcopies(repo[parent], ctx)
3817
3817
3818 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3818 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3819 if f in copied:
3819 if f in copied:
3820 repo.dirstate.copy(copied[f], f)
3820 repo.dirstate.copy(copied[f], f)
3821
3821
3822 class command(registrar.command):
3822 class command(registrar.command):
3823 """deprecated: used registrar.command instead"""
3823 """deprecated: used registrar.command instead"""
3824 def _doregister(self, func, name, *args, **kwargs):
3824 def _doregister(self, func, name, *args, **kwargs):
3825 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3825 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3826 return super(command, self)._doregister(func, name, *args, **kwargs)
3826 return super(command, self)._doregister(func, name, *args, **kwargs)
3827
3827
3828 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3828 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3829 # commands.outgoing. "missing" is "missing" of the result of
3829 # commands.outgoing. "missing" is "missing" of the result of
3830 # "findcommonoutgoing()"
3830 # "findcommonoutgoing()"
3831 outgoinghooks = util.hooks()
3831 outgoinghooks = util.hooks()
3832
3832
3833 # a list of (ui, repo) functions called by commands.summary
3833 # a list of (ui, repo) functions called by commands.summary
3834 summaryhooks = util.hooks()
3834 summaryhooks = util.hooks()
3835
3835
3836 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3836 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3837 #
3837 #
3838 # functions should return tuple of booleans below, if 'changes' is None:
3838 # functions should return tuple of booleans below, if 'changes' is None:
3839 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3839 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3840 #
3840 #
3841 # otherwise, 'changes' is a tuple of tuples below:
3841 # otherwise, 'changes' is a tuple of tuples below:
3842 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3842 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3843 # - (desturl, destbranch, destpeer, outgoing)
3843 # - (desturl, destbranch, destpeer, outgoing)
3844 summaryremotehooks = util.hooks()
3844 summaryremotehooks = util.hooks()
3845
3845
3846 # A list of state files kept by multistep operations like graft.
3846 # A list of state files kept by multistep operations like graft.
3847 # Since graft cannot be aborted, it is considered 'clearable' by update.
3847 # Since graft cannot be aborted, it is considered 'clearable' by update.
3848 # note: bisect is intentionally excluded
3848 # note: bisect is intentionally excluded
3849 # (state file, clearable, allowcommit, error, hint)
3849 # (state file, clearable, allowcommit, error, hint)
3850 unfinishedstates = [
3850 unfinishedstates = [
3851 ('graftstate', True, False, _('graft in progress'),
3851 ('graftstate', True, False, _('graft in progress'),
3852 _("use 'hg graft --continue' or 'hg update' to abort")),
3852 _("use 'hg graft --continue' or 'hg update' to abort")),
3853 ('updatestate', True, False, _('last update was interrupted'),
3853 ('updatestate', True, False, _('last update was interrupted'),
3854 _("use 'hg update' to get a consistent checkout"))
3854 _("use 'hg update' to get a consistent checkout"))
3855 ]
3855 ]
3856
3856
3857 def checkunfinished(repo, commit=False):
3857 def checkunfinished(repo, commit=False):
3858 '''Look for an unfinished multistep operation, like graft, and abort
3858 '''Look for an unfinished multistep operation, like graft, and abort
3859 if found. It's probably good to check this right before
3859 if found. It's probably good to check this right before
3860 bailifchanged().
3860 bailifchanged().
3861 '''
3861 '''
3862 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3862 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3863 if commit and allowcommit:
3863 if commit and allowcommit:
3864 continue
3864 continue
3865 if repo.vfs.exists(f):
3865 if repo.vfs.exists(f):
3866 raise error.Abort(msg, hint=hint)
3866 raise error.Abort(msg, hint=hint)
3867
3867
3868 def clearunfinished(repo):
3868 def clearunfinished(repo):
3869 '''Check for unfinished operations (as above), and clear the ones
3869 '''Check for unfinished operations (as above), and clear the ones
3870 that are clearable.
3870 that are clearable.
3871 '''
3871 '''
3872 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3872 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3873 if not clearable and repo.vfs.exists(f):
3873 if not clearable and repo.vfs.exists(f):
3874 raise error.Abort(msg, hint=hint)
3874 raise error.Abort(msg, hint=hint)
3875 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3875 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3876 if clearable and repo.vfs.exists(f):
3876 if clearable and repo.vfs.exists(f):
3877 util.unlink(repo.vfs.join(f))
3877 util.unlink(repo.vfs.join(f))
3878
3878
3879 afterresolvedstates = [
3879 afterresolvedstates = [
3880 ('graftstate',
3880 ('graftstate',
3881 _('hg graft --continue')),
3881 _('hg graft --continue')),
3882 ]
3882 ]
3883
3883
3884 def howtocontinue(repo):
3884 def howtocontinue(repo):
3885 '''Check for an unfinished operation and return the command to finish
3885 '''Check for an unfinished operation and return the command to finish
3886 it.
3886 it.
3887
3887
3888 afterresolvedstates tuples define a .hg/{file} and the corresponding
3888 afterresolvedstates tuples define a .hg/{file} and the corresponding
3889 command needed to finish it.
3889 command needed to finish it.
3890
3890
3891 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3891 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3892 a boolean.
3892 a boolean.
3893 '''
3893 '''
3894 contmsg = _("continue: %s")
3894 contmsg = _("continue: %s")
3895 for f, msg in afterresolvedstates:
3895 for f, msg in afterresolvedstates:
3896 if repo.vfs.exists(f):
3896 if repo.vfs.exists(f):
3897 return contmsg % msg, True
3897 return contmsg % msg, True
3898 if repo[None].dirty(missing=True, merge=False, branch=False):
3898 if repo[None].dirty(missing=True, merge=False, branch=False):
3899 return contmsg % _("hg commit"), False
3899 return contmsg % _("hg commit"), False
3900 return None, None
3900 return None, None
3901
3901
3902 def checkafterresolved(repo):
3902 def checkafterresolved(repo):
3903 '''Inform the user about the next action after completing hg resolve
3903 '''Inform the user about the next action after completing hg resolve
3904
3904
3905 If there's a matching afterresolvedstates, howtocontinue will yield
3905 If there's a matching afterresolvedstates, howtocontinue will yield
3906 repo.ui.warn as the reporter.
3906 repo.ui.warn as the reporter.
3907
3907
3908 Otherwise, it will yield repo.ui.note.
3908 Otherwise, it will yield repo.ui.note.
3909 '''
3909 '''
3910 msg, warning = howtocontinue(repo)
3910 msg, warning = howtocontinue(repo)
3911 if msg is not None:
3911 if msg is not None:
3912 if warning:
3912 if warning:
3913 repo.ui.warn("%s\n" % msg)
3913 repo.ui.warn("%s\n" % msg)
3914 else:
3914 else:
3915 repo.ui.note("%s\n" % msg)
3915 repo.ui.note("%s\n" % msg)
3916
3916
3917 def wrongtooltocontinue(repo, task):
3917 def wrongtooltocontinue(repo, task):
3918 '''Raise an abort suggesting how to properly continue if there is an
3918 '''Raise an abort suggesting how to properly continue if there is an
3919 active task.
3919 active task.
3920
3920
3921 Uses howtocontinue() to find the active task.
3921 Uses howtocontinue() to find the active task.
3922
3922
3923 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3923 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3924 a hint.
3924 a hint.
3925 '''
3925 '''
3926 after = howtocontinue(repo)
3926 after = howtocontinue(repo)
3927 hint = None
3927 hint = None
3928 if after[1]:
3928 if after[1]:
3929 hint = after[0]
3929 hint = after[0]
3930 raise error.Abort(_('no %s in progress') % task, hint=hint)
3930 raise error.Abort(_('no %s in progress') % task, hint=hint)
@@ -1,3570 +1,3560 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 > return cmdutil._makelogrevset(repo, pats, opts, revs)[0]
98 > return cmdutil._makelogrevset(repo, pats, opts, revs)[0]
99 >
99 >
100 > def uisetup(ui):
100 > def uisetup(ui):
101 > def printrevset(orig, repo, pats, opts):
101 > def printrevset(orig, repo, pats, opts):
102 > revs, filematcher = orig(repo, pats, opts)
102 > revs, filematcher = orig(repo, pats, opts)
103 > if opts.get('print_revset'):
103 > if opts.get('print_revset'):
104 > expr = logrevset(repo, pats, opts)
104 > expr = logrevset(repo, pats, opts)
105 > if expr:
105 > if expr:
106 > tree = revsetlang.parse(expr)
106 > tree = revsetlang.parse(expr)
107 > tree = revsetlang.analyze(tree)
107 > tree = revsetlang.analyze(tree)
108 > else:
108 > else:
109 > tree = []
109 > tree = []
110 > ui = repo.ui
110 > ui = repo.ui
111 > ui.write('%r\n' % (opts.get('rev', []),))
111 > ui.write('%r\n' % (opts.get('rev', []),))
112 > ui.write(revsetlang.prettyformat(tree) + '\n')
112 > ui.write(revsetlang.prettyformat(tree) + '\n')
113 > ui.write(smartset.prettyformat(revs) + '\n')
113 > ui.write(smartset.prettyformat(revs) + '\n')
114 > revs = smartset.baseset() # display no revisions
114 > revs = smartset.baseset() # display no revisions
115 > return revs, filematcher
115 > return revs, filematcher
116 > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
116 > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
117 > aliases, entry = cmdutil.findcmd('log', commands.table)
117 > aliases, entry = cmdutil.findcmd('log', commands.table)
118 > entry[1].append(('', 'print-revset', False,
118 > entry[1].append(('', 'print-revset', False,
119 > 'print generated revset and exit (DEPRECATED)'))
119 > 'print generated revset and exit (DEPRECATED)'))
120 > EOF
120 > EOF
121
121
122 $ echo "[extensions]" >> $HGRCPATH
122 $ echo "[extensions]" >> $HGRCPATH
123 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
123 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
124
124
125 $ hg init repo
125 $ hg init repo
126 $ cd repo
126 $ cd repo
127
127
128 Empty repo:
128 Empty repo:
129
129
130 $ hg log -G
130 $ hg log -G
131
131
132
132
133 Building DAG:
133 Building DAG:
134
134
135 $ commit 0 "root"
135 $ commit 0 "root"
136 $ commit 1 "collapse" 0
136 $ commit 1 "collapse" 0
137 $ commit 2 "collapse" 1
137 $ commit 2 "collapse" 1
138 $ commit 3 "collapse" 2
138 $ commit 3 "collapse" 2
139 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
139 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
140 $ commit 5 "expand" 3 4
140 $ commit 5 "expand" 3 4
141 $ commit 6 "merge two known; one immediate left, one far left" 2 5
141 $ commit 6 "merge two known; one immediate left, one far left" 2 5
142 $ commit 7 "expand" 2 5
142 $ commit 7 "expand" 2 5
143 $ commit 8 "merge two known; one immediate left, one far right" 0 7
143 $ commit 8 "merge two known; one immediate left, one far right" 0 7
144 $ commit 9 "expand" 7 8
144 $ commit 9 "expand" 7 8
145 $ commit 10 "merge two known; one immediate left, one near right" 0 6
145 $ commit 10 "merge two known; one immediate left, one near right" 0 6
146 $ commit 11 "expand" 6 10
146 $ commit 11 "expand" 6 10
147 $ commit 12 "merge two known; one immediate right, one far left" 1 9
147 $ commit 12 "merge two known; one immediate right, one far left" 1 9
148 $ commit 13 "expand" 9 11
148 $ commit 13 "expand" 9 11
149 $ commit 14 "merge two known; one immediate right, one far right" 0 12
149 $ commit 14 "merge two known; one immediate right, one far right" 0 12
150 $ commit 15 "expand" 13 14
150 $ commit 15 "expand" 13 14
151 $ commit 16 "merge two known; one immediate right, one near right" 0 1
151 $ commit 16 "merge two known; one immediate right, one near right" 0 1
152 $ commit 17 "expand" 12 16
152 $ commit 17 "expand" 12 16
153 $ commit 18 "merge two known; two far left" 1 15
153 $ commit 18 "merge two known; two far left" 1 15
154 $ commit 19 "expand" 15 17
154 $ commit 19 "expand" 15 17
155 $ commit 20 "merge two known; two far right" 0 18
155 $ commit 20 "merge two known; two far right" 0 18
156 $ commit 21 "expand" 19 20
156 $ commit 21 "expand" 19 20
157 $ commit 22 "merge two known; one far left, one far right" 18 21
157 $ commit 22 "merge two known; one far left, one far right" 18 21
158 $ commit 23 "merge one known; immediate left" 1 22
158 $ commit 23 "merge one known; immediate left" 1 22
159 $ commit 24 "merge one known; immediate right" 0 23
159 $ commit 24 "merge one known; immediate right" 0 23
160 $ commit 25 "merge one known; far left" 21 24
160 $ commit 25 "merge one known; far left" 21 24
161 $ commit 26 "merge one known; far right" 18 25
161 $ commit 26 "merge one known; far right" 18 25
162 $ commit 27 "collapse" 21
162 $ commit 27 "collapse" 21
163 $ commit 28 "merge zero known" 1 26
163 $ commit 28 "merge zero known" 1 26
164 $ commit 29 "regular commit" 0
164 $ commit 29 "regular commit" 0
165 $ commit 30 "expand" 28 29
165 $ commit 30 "expand" 28 29
166 $ commit 31 "expand" 21 30
166 $ commit 31 "expand" 21 30
167 $ commit 32 "expand" 27 31
167 $ commit 32 "expand" 27 31
168 $ commit 33 "head" 18
168 $ commit 33 "head" 18
169 $ commit 34 "head" 32
169 $ commit 34 "head" 32
170
170
171
171
172 $ hg log -G -q
172 $ hg log -G -q
173 @ 34:fea3ac5810e0
173 @ 34:fea3ac5810e0
174 |
174 |
175 | o 33:68608f5145f9
175 | o 33:68608f5145f9
176 | |
176 | |
177 o | 32:d06dffa21a31
177 o | 32:d06dffa21a31
178 |\ \
178 |\ \
179 | o \ 31:621d83e11f67
179 | o \ 31:621d83e11f67
180 | |\ \
180 | |\ \
181 | | o \ 30:6e11cd4b648f
181 | | o \ 30:6e11cd4b648f
182 | | |\ \
182 | | |\ \
183 | | | o | 29:cd9bb2be7593
183 | | | o | 29:cd9bb2be7593
184 | | | | |
184 | | | | |
185 | | o | | 28:44ecd0b9ae99
185 | | o | | 28:44ecd0b9ae99
186 | | |\ \ \
186 | | |\ \ \
187 o | | | | | 27:886ed638191b
187 o | | | | | 27:886ed638191b
188 |/ / / / /
188 |/ / / / /
189 | | o---+ 26:7f25b6c2f0b9
189 | | o---+ 26:7f25b6c2f0b9
190 | | | | |
190 | | | | |
191 +---o | | 25:91da8ed57247
191 +---o | | 25:91da8ed57247
192 | | | | |
192 | | | | |
193 | | o | | 24:a9c19a3d96b7
193 | | o | | 24:a9c19a3d96b7
194 | | |\| |
194 | | |\| |
195 | | o | | 23:a01cddf0766d
195 | | o | | 23:a01cddf0766d
196 | |/| | |
196 | |/| | |
197 +---o---+ 22:e0d9cccacb5d
197 +---o---+ 22:e0d9cccacb5d
198 | | / /
198 | | / /
199 o | | | 21:d42a756af44d
199 o | | | 21:d42a756af44d
200 |\ \ \ \
200 |\ \ \ \
201 | o---+-+ 20:d30ed6450e32
201 | o---+-+ 20:d30ed6450e32
202 | / / /
202 | / / /
203 o | | | 19:31ddc2c1573b
203 o | | | 19:31ddc2c1573b
204 |\ \ \ \
204 |\ \ \ \
205 +---+---o 18:1aa84d96232a
205 +---+---o 18:1aa84d96232a
206 | | | |
206 | | | |
207 | o | | 17:44765d7c06e0
207 | o | | 17:44765d7c06e0
208 | |\ \ \
208 | |\ \ \
209 | | o---+ 16:3677d192927d
209 | | o---+ 16:3677d192927d
210 | | |/ /
210 | | |/ /
211 o | | | 15:1dda3f72782d
211 o | | | 15:1dda3f72782d
212 |\ \ \ \
212 |\ \ \ \
213 | o-----+ 14:8eac370358ef
213 | o-----+ 14:8eac370358ef
214 | |/ / /
214 | |/ / /
215 o | | | 13:22d8966a97e3
215 o | | | 13:22d8966a97e3
216 |\ \ \ \
216 |\ \ \ \
217 +---o | | 12:86b91144a6e9
217 +---o | | 12:86b91144a6e9
218 | | |/ /
218 | | |/ /
219 | o | | 11:832d76e6bdf2
219 | o | | 11:832d76e6bdf2
220 | |\ \ \
220 | |\ \ \
221 | | o---+ 10:74c64d036d72
221 | | o---+ 10:74c64d036d72
222 | |/ / /
222 | |/ / /
223 o | | | 9:7010c0af0a35
223 o | | | 9:7010c0af0a35
224 |\ \ \ \
224 |\ \ \ \
225 | o-----+ 8:7a0b11f71937
225 | o-----+ 8:7a0b11f71937
226 |/ / / /
226 |/ / / /
227 o | | | 7:b632bb1b1224
227 o | | | 7:b632bb1b1224
228 |\ \ \ \
228 |\ \ \ \
229 +---o | | 6:b105a072e251
229 +---o | | 6:b105a072e251
230 | |/ / /
230 | |/ / /
231 | o | | 5:4409d547b708
231 | o | | 5:4409d547b708
232 | |\ \ \
232 | |\ \ \
233 | | o | | 4:26a8bac39d9f
233 | | o | | 4:26a8bac39d9f
234 | |/|/ /
234 | |/|/ /
235 | o / / 3:27eef8ed80b4
235 | o / / 3:27eef8ed80b4
236 |/ / /
236 |/ / /
237 o / / 2:3d9a33b8d1e1
237 o / / 2:3d9a33b8d1e1
238 |/ /
238 |/ /
239 o / 1:6db2ef61d156
239 o / 1:6db2ef61d156
240 |/
240 |/
241 o 0:e6eb3150255d
241 o 0:e6eb3150255d
242
242
243
243
244 $ hg log -G
244 $ hg log -G
245 @ changeset: 34:fea3ac5810e0
245 @ changeset: 34:fea3ac5810e0
246 | tag: tip
246 | tag: tip
247 | parent: 32:d06dffa21a31
247 | parent: 32:d06dffa21a31
248 | user: test
248 | user: test
249 | date: Thu Jan 01 00:00:34 1970 +0000
249 | date: Thu Jan 01 00:00:34 1970 +0000
250 | summary: (34) head
250 | summary: (34) head
251 |
251 |
252 | o changeset: 33:68608f5145f9
252 | o changeset: 33:68608f5145f9
253 | | parent: 18:1aa84d96232a
253 | | parent: 18:1aa84d96232a
254 | | user: test
254 | | user: test
255 | | date: Thu Jan 01 00:00:33 1970 +0000
255 | | date: Thu Jan 01 00:00:33 1970 +0000
256 | | summary: (33) head
256 | | summary: (33) head
257 | |
257 | |
258 o | changeset: 32:d06dffa21a31
258 o | changeset: 32:d06dffa21a31
259 |\ \ parent: 27:886ed638191b
259 |\ \ parent: 27:886ed638191b
260 | | | parent: 31:621d83e11f67
260 | | | parent: 31:621d83e11f67
261 | | | user: test
261 | | | user: test
262 | | | date: Thu Jan 01 00:00:32 1970 +0000
262 | | | date: Thu Jan 01 00:00:32 1970 +0000
263 | | | summary: (32) expand
263 | | | summary: (32) expand
264 | | |
264 | | |
265 | o | changeset: 31:621d83e11f67
265 | o | changeset: 31:621d83e11f67
266 | |\ \ parent: 21:d42a756af44d
266 | |\ \ parent: 21:d42a756af44d
267 | | | | parent: 30:6e11cd4b648f
267 | | | | parent: 30:6e11cd4b648f
268 | | | | user: test
268 | | | | user: test
269 | | | | date: Thu Jan 01 00:00:31 1970 +0000
269 | | | | date: Thu Jan 01 00:00:31 1970 +0000
270 | | | | summary: (31) expand
270 | | | | summary: (31) expand
271 | | | |
271 | | | |
272 | | o | changeset: 30:6e11cd4b648f
272 | | o | changeset: 30:6e11cd4b648f
273 | | |\ \ parent: 28:44ecd0b9ae99
273 | | |\ \ parent: 28:44ecd0b9ae99
274 | | | | | parent: 29:cd9bb2be7593
274 | | | | | parent: 29:cd9bb2be7593
275 | | | | | user: test
275 | | | | | user: test
276 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
276 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
277 | | | | | summary: (30) expand
277 | | | | | summary: (30) expand
278 | | | | |
278 | | | | |
279 | | | o | changeset: 29:cd9bb2be7593
279 | | | o | changeset: 29:cd9bb2be7593
280 | | | | | parent: 0:e6eb3150255d
280 | | | | | parent: 0:e6eb3150255d
281 | | | | | user: test
281 | | | | | user: test
282 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
282 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
283 | | | | | summary: (29) regular commit
283 | | | | | summary: (29) regular commit
284 | | | | |
284 | | | | |
285 | | o | | changeset: 28:44ecd0b9ae99
285 | | o | | changeset: 28:44ecd0b9ae99
286 | | |\ \ \ parent: 1:6db2ef61d156
286 | | |\ \ \ parent: 1:6db2ef61d156
287 | | | | | | parent: 26:7f25b6c2f0b9
287 | | | | | | parent: 26:7f25b6c2f0b9
288 | | | | | | user: test
288 | | | | | | user: test
289 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
289 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
290 | | | | | | summary: (28) merge zero known
290 | | | | | | summary: (28) merge zero known
291 | | | | | |
291 | | | | | |
292 o | | | | | changeset: 27:886ed638191b
292 o | | | | | changeset: 27:886ed638191b
293 |/ / / / / parent: 21:d42a756af44d
293 |/ / / / / parent: 21:d42a756af44d
294 | | | | | user: test
294 | | | | | user: test
295 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
295 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
296 | | | | | summary: (27) collapse
296 | | | | | summary: (27) collapse
297 | | | | |
297 | | | | |
298 | | o---+ changeset: 26:7f25b6c2f0b9
298 | | o---+ changeset: 26:7f25b6c2f0b9
299 | | | | | parent: 18:1aa84d96232a
299 | | | | | parent: 18:1aa84d96232a
300 | | | | | parent: 25:91da8ed57247
300 | | | | | parent: 25:91da8ed57247
301 | | | | | user: test
301 | | | | | user: test
302 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
302 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
303 | | | | | summary: (26) merge one known; far right
303 | | | | | summary: (26) merge one known; far right
304 | | | | |
304 | | | | |
305 +---o | | changeset: 25:91da8ed57247
305 +---o | | changeset: 25:91da8ed57247
306 | | | | | parent: 21:d42a756af44d
306 | | | | | parent: 21:d42a756af44d
307 | | | | | parent: 24:a9c19a3d96b7
307 | | | | | parent: 24:a9c19a3d96b7
308 | | | | | user: test
308 | | | | | user: test
309 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
309 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
310 | | | | | summary: (25) merge one known; far left
310 | | | | | summary: (25) merge one known; far left
311 | | | | |
311 | | | | |
312 | | o | | changeset: 24:a9c19a3d96b7
312 | | o | | changeset: 24:a9c19a3d96b7
313 | | |\| | parent: 0:e6eb3150255d
313 | | |\| | parent: 0:e6eb3150255d
314 | | | | | parent: 23:a01cddf0766d
314 | | | | | parent: 23:a01cddf0766d
315 | | | | | user: test
315 | | | | | user: test
316 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
316 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
317 | | | | | summary: (24) merge one known; immediate right
317 | | | | | summary: (24) merge one known; immediate right
318 | | | | |
318 | | | | |
319 | | o | | changeset: 23:a01cddf0766d
319 | | o | | changeset: 23:a01cddf0766d
320 | |/| | | parent: 1:6db2ef61d156
320 | |/| | | parent: 1:6db2ef61d156
321 | | | | | parent: 22:e0d9cccacb5d
321 | | | | | parent: 22:e0d9cccacb5d
322 | | | | | user: test
322 | | | | | user: test
323 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
323 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
324 | | | | | summary: (23) merge one known; immediate left
324 | | | | | summary: (23) merge one known; immediate left
325 | | | | |
325 | | | | |
326 +---o---+ changeset: 22:e0d9cccacb5d
326 +---o---+ changeset: 22:e0d9cccacb5d
327 | | | | parent: 18:1aa84d96232a
327 | | | | parent: 18:1aa84d96232a
328 | | / / parent: 21:d42a756af44d
328 | | / / parent: 21:d42a756af44d
329 | | | | user: test
329 | | | | user: test
330 | | | | date: Thu Jan 01 00:00:22 1970 +0000
330 | | | | date: Thu Jan 01 00:00:22 1970 +0000
331 | | | | summary: (22) merge two known; one far left, one far right
331 | | | | summary: (22) merge two known; one far left, one far right
332 | | | |
332 | | | |
333 o | | | changeset: 21:d42a756af44d
333 o | | | changeset: 21:d42a756af44d
334 |\ \ \ \ parent: 19:31ddc2c1573b
334 |\ \ \ \ parent: 19:31ddc2c1573b
335 | | | | | parent: 20:d30ed6450e32
335 | | | | | parent: 20:d30ed6450e32
336 | | | | | user: test
336 | | | | | user: test
337 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
337 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
338 | | | | | summary: (21) expand
338 | | | | | summary: (21) expand
339 | | | | |
339 | | | | |
340 | o---+-+ changeset: 20:d30ed6450e32
340 | o---+-+ changeset: 20:d30ed6450e32
341 | | | | parent: 0:e6eb3150255d
341 | | | | parent: 0:e6eb3150255d
342 | / / / parent: 18:1aa84d96232a
342 | / / / parent: 18:1aa84d96232a
343 | | | | user: test
343 | | | | user: test
344 | | | | date: Thu Jan 01 00:00:20 1970 +0000
344 | | | | date: Thu Jan 01 00:00:20 1970 +0000
345 | | | | summary: (20) merge two known; two far right
345 | | | | summary: (20) merge two known; two far right
346 | | | |
346 | | | |
347 o | | | changeset: 19:31ddc2c1573b
347 o | | | changeset: 19:31ddc2c1573b
348 |\ \ \ \ parent: 15:1dda3f72782d
348 |\ \ \ \ parent: 15:1dda3f72782d
349 | | | | | parent: 17:44765d7c06e0
349 | | | | | parent: 17:44765d7c06e0
350 | | | | | user: test
350 | | | | | user: test
351 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
351 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
352 | | | | | summary: (19) expand
352 | | | | | summary: (19) expand
353 | | | | |
353 | | | | |
354 +---+---o changeset: 18:1aa84d96232a
354 +---+---o changeset: 18:1aa84d96232a
355 | | | | parent: 1:6db2ef61d156
355 | | | | parent: 1:6db2ef61d156
356 | | | | parent: 15:1dda3f72782d
356 | | | | parent: 15:1dda3f72782d
357 | | | | user: test
357 | | | | user: test
358 | | | | date: Thu Jan 01 00:00:18 1970 +0000
358 | | | | date: Thu Jan 01 00:00:18 1970 +0000
359 | | | | summary: (18) merge two known; two far left
359 | | | | summary: (18) merge two known; two far left
360 | | | |
360 | | | |
361 | o | | changeset: 17:44765d7c06e0
361 | o | | changeset: 17:44765d7c06e0
362 | |\ \ \ parent: 12:86b91144a6e9
362 | |\ \ \ parent: 12:86b91144a6e9
363 | | | | | parent: 16:3677d192927d
363 | | | | | parent: 16:3677d192927d
364 | | | | | user: test
364 | | | | | user: test
365 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
365 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
366 | | | | | summary: (17) expand
366 | | | | | summary: (17) expand
367 | | | | |
367 | | | | |
368 | | o---+ changeset: 16:3677d192927d
368 | | o---+ changeset: 16:3677d192927d
369 | | | | | parent: 0:e6eb3150255d
369 | | | | | parent: 0:e6eb3150255d
370 | | |/ / parent: 1:6db2ef61d156
370 | | |/ / parent: 1:6db2ef61d156
371 | | | | user: test
371 | | | | user: test
372 | | | | date: Thu Jan 01 00:00:16 1970 +0000
372 | | | | date: Thu Jan 01 00:00:16 1970 +0000
373 | | | | summary: (16) merge two known; one immediate right, one near right
373 | | | | summary: (16) merge two known; one immediate right, one near right
374 | | | |
374 | | | |
375 o | | | changeset: 15:1dda3f72782d
375 o | | | changeset: 15:1dda3f72782d
376 |\ \ \ \ parent: 13:22d8966a97e3
376 |\ \ \ \ parent: 13:22d8966a97e3
377 | | | | | parent: 14:8eac370358ef
377 | | | | | parent: 14:8eac370358ef
378 | | | | | user: test
378 | | | | | user: test
379 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
379 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
380 | | | | | summary: (15) expand
380 | | | | | summary: (15) expand
381 | | | | |
381 | | | | |
382 | o-----+ changeset: 14:8eac370358ef
382 | o-----+ changeset: 14:8eac370358ef
383 | | | | | parent: 0:e6eb3150255d
383 | | | | | parent: 0:e6eb3150255d
384 | |/ / / parent: 12:86b91144a6e9
384 | |/ / / parent: 12:86b91144a6e9
385 | | | | user: test
385 | | | | user: test
386 | | | | date: Thu Jan 01 00:00:14 1970 +0000
386 | | | | date: Thu Jan 01 00:00:14 1970 +0000
387 | | | | summary: (14) merge two known; one immediate right, one far right
387 | | | | summary: (14) merge two known; one immediate right, one far right
388 | | | |
388 | | | |
389 o | | | changeset: 13:22d8966a97e3
389 o | | | changeset: 13:22d8966a97e3
390 |\ \ \ \ parent: 9:7010c0af0a35
390 |\ \ \ \ parent: 9:7010c0af0a35
391 | | | | | parent: 11:832d76e6bdf2
391 | | | | | parent: 11:832d76e6bdf2
392 | | | | | user: test
392 | | | | | user: test
393 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
393 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
394 | | | | | summary: (13) expand
394 | | | | | summary: (13) expand
395 | | | | |
395 | | | | |
396 +---o | | changeset: 12:86b91144a6e9
396 +---o | | changeset: 12:86b91144a6e9
397 | | |/ / parent: 1:6db2ef61d156
397 | | |/ / parent: 1:6db2ef61d156
398 | | | | parent: 9:7010c0af0a35
398 | | | | parent: 9:7010c0af0a35
399 | | | | user: test
399 | | | | user: test
400 | | | | date: Thu Jan 01 00:00:12 1970 +0000
400 | | | | date: Thu Jan 01 00:00:12 1970 +0000
401 | | | | summary: (12) merge two known; one immediate right, one far left
401 | | | | summary: (12) merge two known; one immediate right, one far left
402 | | | |
402 | | | |
403 | o | | changeset: 11:832d76e6bdf2
403 | o | | changeset: 11:832d76e6bdf2
404 | |\ \ \ parent: 6:b105a072e251
404 | |\ \ \ parent: 6:b105a072e251
405 | | | | | parent: 10:74c64d036d72
405 | | | | | parent: 10:74c64d036d72
406 | | | | | user: test
406 | | | | | user: test
407 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
407 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
408 | | | | | summary: (11) expand
408 | | | | | summary: (11) expand
409 | | | | |
409 | | | | |
410 | | o---+ changeset: 10:74c64d036d72
410 | | o---+ changeset: 10:74c64d036d72
411 | | | | | parent: 0:e6eb3150255d
411 | | | | | parent: 0:e6eb3150255d
412 | |/ / / parent: 6:b105a072e251
412 | |/ / / parent: 6:b105a072e251
413 | | | | user: test
413 | | | | user: test
414 | | | | date: Thu Jan 01 00:00:10 1970 +0000
414 | | | | date: Thu Jan 01 00:00:10 1970 +0000
415 | | | | summary: (10) merge two known; one immediate left, one near right
415 | | | | summary: (10) merge two known; one immediate left, one near right
416 | | | |
416 | | | |
417 o | | | changeset: 9:7010c0af0a35
417 o | | | changeset: 9:7010c0af0a35
418 |\ \ \ \ parent: 7:b632bb1b1224
418 |\ \ \ \ parent: 7:b632bb1b1224
419 | | | | | parent: 8:7a0b11f71937
419 | | | | | parent: 8:7a0b11f71937
420 | | | | | user: test
420 | | | | | user: test
421 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
421 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
422 | | | | | summary: (9) expand
422 | | | | | summary: (9) expand
423 | | | | |
423 | | | | |
424 | o-----+ changeset: 8:7a0b11f71937
424 | o-----+ changeset: 8:7a0b11f71937
425 | | | | | parent: 0:e6eb3150255d
425 | | | | | parent: 0:e6eb3150255d
426 |/ / / / parent: 7:b632bb1b1224
426 |/ / / / parent: 7:b632bb1b1224
427 | | | | user: test
427 | | | | user: test
428 | | | | date: Thu Jan 01 00:00:08 1970 +0000
428 | | | | date: Thu Jan 01 00:00:08 1970 +0000
429 | | | | summary: (8) merge two known; one immediate left, one far right
429 | | | | summary: (8) merge two known; one immediate left, one far right
430 | | | |
430 | | | |
431 o | | | changeset: 7:b632bb1b1224
431 o | | | changeset: 7:b632bb1b1224
432 |\ \ \ \ parent: 2:3d9a33b8d1e1
432 |\ \ \ \ parent: 2:3d9a33b8d1e1
433 | | | | | parent: 5:4409d547b708
433 | | | | | parent: 5:4409d547b708
434 | | | | | user: test
434 | | | | | user: test
435 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
435 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
436 | | | | | summary: (7) expand
436 | | | | | summary: (7) expand
437 | | | | |
437 | | | | |
438 +---o | | changeset: 6:b105a072e251
438 +---o | | changeset: 6:b105a072e251
439 | |/ / / parent: 2:3d9a33b8d1e1
439 | |/ / / parent: 2:3d9a33b8d1e1
440 | | | | parent: 5:4409d547b708
440 | | | | parent: 5:4409d547b708
441 | | | | user: test
441 | | | | user: test
442 | | | | date: Thu Jan 01 00:00:06 1970 +0000
442 | | | | date: Thu Jan 01 00:00:06 1970 +0000
443 | | | | summary: (6) merge two known; one immediate left, one far left
443 | | | | summary: (6) merge two known; one immediate left, one far left
444 | | | |
444 | | | |
445 | o | | changeset: 5:4409d547b708
445 | o | | changeset: 5:4409d547b708
446 | |\ \ \ parent: 3:27eef8ed80b4
446 | |\ \ \ parent: 3:27eef8ed80b4
447 | | | | | parent: 4:26a8bac39d9f
447 | | | | | parent: 4:26a8bac39d9f
448 | | | | | user: test
448 | | | | | user: test
449 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
449 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
450 | | | | | summary: (5) expand
450 | | | | | summary: (5) expand
451 | | | | |
451 | | | | |
452 | | o | | changeset: 4:26a8bac39d9f
452 | | o | | changeset: 4:26a8bac39d9f
453 | |/|/ / parent: 1:6db2ef61d156
453 | |/|/ / parent: 1:6db2ef61d156
454 | | | | parent: 3:27eef8ed80b4
454 | | | | parent: 3:27eef8ed80b4
455 | | | | user: test
455 | | | | user: test
456 | | | | date: Thu Jan 01 00:00:04 1970 +0000
456 | | | | date: Thu Jan 01 00:00:04 1970 +0000
457 | | | | summary: (4) merge two known; one immediate left, one immediate right
457 | | | | summary: (4) merge two known; one immediate left, one immediate right
458 | | | |
458 | | | |
459 | o | | changeset: 3:27eef8ed80b4
459 | o | | changeset: 3:27eef8ed80b4
460 |/ / / user: test
460 |/ / / user: test
461 | | | date: Thu Jan 01 00:00:03 1970 +0000
461 | | | date: Thu Jan 01 00:00:03 1970 +0000
462 | | | summary: (3) collapse
462 | | | summary: (3) collapse
463 | | |
463 | | |
464 o | | changeset: 2:3d9a33b8d1e1
464 o | | changeset: 2:3d9a33b8d1e1
465 |/ / user: test
465 |/ / user: test
466 | | date: Thu Jan 01 00:00:02 1970 +0000
466 | | date: Thu Jan 01 00:00:02 1970 +0000
467 | | summary: (2) collapse
467 | | summary: (2) collapse
468 | |
468 | |
469 o | changeset: 1:6db2ef61d156
469 o | changeset: 1:6db2ef61d156
470 |/ user: test
470 |/ user: test
471 | date: Thu Jan 01 00:00:01 1970 +0000
471 | date: Thu Jan 01 00:00:01 1970 +0000
472 | summary: (1) collapse
472 | summary: (1) collapse
473 |
473 |
474 o changeset: 0:e6eb3150255d
474 o changeset: 0:e6eb3150255d
475 user: test
475 user: test
476 date: Thu Jan 01 00:00:00 1970 +0000
476 date: Thu Jan 01 00:00:00 1970 +0000
477 summary: (0) root
477 summary: (0) root
478
478
479
479
480 File glog:
480 File glog:
481 $ hg log -G a
481 $ hg log -G a
482 @ changeset: 34:fea3ac5810e0
482 @ changeset: 34:fea3ac5810e0
483 | tag: tip
483 | tag: tip
484 | parent: 32:d06dffa21a31
484 | parent: 32:d06dffa21a31
485 | user: test
485 | user: test
486 | date: Thu Jan 01 00:00:34 1970 +0000
486 | date: Thu Jan 01 00:00:34 1970 +0000
487 | summary: (34) head
487 | summary: (34) head
488 |
488 |
489 | o changeset: 33:68608f5145f9
489 | o changeset: 33:68608f5145f9
490 | | parent: 18:1aa84d96232a
490 | | parent: 18:1aa84d96232a
491 | | user: test
491 | | user: test
492 | | date: Thu Jan 01 00:00:33 1970 +0000
492 | | date: Thu Jan 01 00:00:33 1970 +0000
493 | | summary: (33) head
493 | | summary: (33) head
494 | |
494 | |
495 o | changeset: 32:d06dffa21a31
495 o | changeset: 32:d06dffa21a31
496 |\ \ parent: 27:886ed638191b
496 |\ \ parent: 27:886ed638191b
497 | | | parent: 31:621d83e11f67
497 | | | parent: 31:621d83e11f67
498 | | | user: test
498 | | | user: test
499 | | | date: Thu Jan 01 00:00:32 1970 +0000
499 | | | date: Thu Jan 01 00:00:32 1970 +0000
500 | | | summary: (32) expand
500 | | | summary: (32) expand
501 | | |
501 | | |
502 | o | changeset: 31:621d83e11f67
502 | o | changeset: 31:621d83e11f67
503 | |\ \ parent: 21:d42a756af44d
503 | |\ \ parent: 21:d42a756af44d
504 | | | | parent: 30:6e11cd4b648f
504 | | | | parent: 30:6e11cd4b648f
505 | | | | user: test
505 | | | | user: test
506 | | | | date: Thu Jan 01 00:00:31 1970 +0000
506 | | | | date: Thu Jan 01 00:00:31 1970 +0000
507 | | | | summary: (31) expand
507 | | | | summary: (31) expand
508 | | | |
508 | | | |
509 | | o | changeset: 30:6e11cd4b648f
509 | | o | changeset: 30:6e11cd4b648f
510 | | |\ \ parent: 28:44ecd0b9ae99
510 | | |\ \ parent: 28:44ecd0b9ae99
511 | | | | | parent: 29:cd9bb2be7593
511 | | | | | parent: 29:cd9bb2be7593
512 | | | | | user: test
512 | | | | | user: test
513 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
513 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
514 | | | | | summary: (30) expand
514 | | | | | summary: (30) expand
515 | | | | |
515 | | | | |
516 | | | o | changeset: 29:cd9bb2be7593
516 | | | o | changeset: 29:cd9bb2be7593
517 | | | | | parent: 0:e6eb3150255d
517 | | | | | parent: 0:e6eb3150255d
518 | | | | | user: test
518 | | | | | user: test
519 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
519 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
520 | | | | | summary: (29) regular commit
520 | | | | | summary: (29) regular commit
521 | | | | |
521 | | | | |
522 | | o | | changeset: 28:44ecd0b9ae99
522 | | o | | changeset: 28:44ecd0b9ae99
523 | | |\ \ \ parent: 1:6db2ef61d156
523 | | |\ \ \ parent: 1:6db2ef61d156
524 | | | | | | parent: 26:7f25b6c2f0b9
524 | | | | | | parent: 26:7f25b6c2f0b9
525 | | | | | | user: test
525 | | | | | | user: test
526 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
526 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
527 | | | | | | summary: (28) merge zero known
527 | | | | | | summary: (28) merge zero known
528 | | | | | |
528 | | | | | |
529 o | | | | | changeset: 27:886ed638191b
529 o | | | | | changeset: 27:886ed638191b
530 |/ / / / / parent: 21:d42a756af44d
530 |/ / / / / parent: 21:d42a756af44d
531 | | | | | user: test
531 | | | | | user: test
532 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
532 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
533 | | | | | summary: (27) collapse
533 | | | | | summary: (27) collapse
534 | | | | |
534 | | | | |
535 | | o---+ changeset: 26:7f25b6c2f0b9
535 | | o---+ changeset: 26:7f25b6c2f0b9
536 | | | | | parent: 18:1aa84d96232a
536 | | | | | parent: 18:1aa84d96232a
537 | | | | | parent: 25:91da8ed57247
537 | | | | | parent: 25:91da8ed57247
538 | | | | | user: test
538 | | | | | user: test
539 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
539 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
540 | | | | | summary: (26) merge one known; far right
540 | | | | | summary: (26) merge one known; far right
541 | | | | |
541 | | | | |
542 +---o | | changeset: 25:91da8ed57247
542 +---o | | changeset: 25:91da8ed57247
543 | | | | | parent: 21:d42a756af44d
543 | | | | | parent: 21:d42a756af44d
544 | | | | | parent: 24:a9c19a3d96b7
544 | | | | | parent: 24:a9c19a3d96b7
545 | | | | | user: test
545 | | | | | user: test
546 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
546 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
547 | | | | | summary: (25) merge one known; far left
547 | | | | | summary: (25) merge one known; far left
548 | | | | |
548 | | | | |
549 | | o | | changeset: 24:a9c19a3d96b7
549 | | o | | changeset: 24:a9c19a3d96b7
550 | | |\| | parent: 0:e6eb3150255d
550 | | |\| | parent: 0:e6eb3150255d
551 | | | | | parent: 23:a01cddf0766d
551 | | | | | parent: 23:a01cddf0766d
552 | | | | | user: test
552 | | | | | user: test
553 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
553 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
554 | | | | | summary: (24) merge one known; immediate right
554 | | | | | summary: (24) merge one known; immediate right
555 | | | | |
555 | | | | |
556 | | o | | changeset: 23:a01cddf0766d
556 | | o | | changeset: 23:a01cddf0766d
557 | |/| | | parent: 1:6db2ef61d156
557 | |/| | | parent: 1:6db2ef61d156
558 | | | | | parent: 22:e0d9cccacb5d
558 | | | | | parent: 22:e0d9cccacb5d
559 | | | | | user: test
559 | | | | | user: test
560 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
560 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
561 | | | | | summary: (23) merge one known; immediate left
561 | | | | | summary: (23) merge one known; immediate left
562 | | | | |
562 | | | | |
563 +---o---+ changeset: 22:e0d9cccacb5d
563 +---o---+ changeset: 22:e0d9cccacb5d
564 | | | | parent: 18:1aa84d96232a
564 | | | | parent: 18:1aa84d96232a
565 | | / / parent: 21:d42a756af44d
565 | | / / parent: 21:d42a756af44d
566 | | | | user: test
566 | | | | user: test
567 | | | | date: Thu Jan 01 00:00:22 1970 +0000
567 | | | | date: Thu Jan 01 00:00:22 1970 +0000
568 | | | | summary: (22) merge two known; one far left, one far right
568 | | | | summary: (22) merge two known; one far left, one far right
569 | | | |
569 | | | |
570 o | | | changeset: 21:d42a756af44d
570 o | | | changeset: 21:d42a756af44d
571 |\ \ \ \ parent: 19:31ddc2c1573b
571 |\ \ \ \ parent: 19:31ddc2c1573b
572 | | | | | parent: 20:d30ed6450e32
572 | | | | | parent: 20:d30ed6450e32
573 | | | | | user: test
573 | | | | | user: test
574 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
574 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
575 | | | | | summary: (21) expand
575 | | | | | summary: (21) expand
576 | | | | |
576 | | | | |
577 | o---+-+ changeset: 20:d30ed6450e32
577 | o---+-+ changeset: 20:d30ed6450e32
578 | | | | parent: 0:e6eb3150255d
578 | | | | parent: 0:e6eb3150255d
579 | / / / parent: 18:1aa84d96232a
579 | / / / parent: 18:1aa84d96232a
580 | | | | user: test
580 | | | | user: test
581 | | | | date: Thu Jan 01 00:00:20 1970 +0000
581 | | | | date: Thu Jan 01 00:00:20 1970 +0000
582 | | | | summary: (20) merge two known; two far right
582 | | | | summary: (20) merge two known; two far right
583 | | | |
583 | | | |
584 o | | | changeset: 19:31ddc2c1573b
584 o | | | changeset: 19:31ddc2c1573b
585 |\ \ \ \ parent: 15:1dda3f72782d
585 |\ \ \ \ parent: 15:1dda3f72782d
586 | | | | | parent: 17:44765d7c06e0
586 | | | | | parent: 17:44765d7c06e0
587 | | | | | user: test
587 | | | | | user: test
588 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
588 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
589 | | | | | summary: (19) expand
589 | | | | | summary: (19) expand
590 | | | | |
590 | | | | |
591 +---+---o changeset: 18:1aa84d96232a
591 +---+---o changeset: 18:1aa84d96232a
592 | | | | parent: 1:6db2ef61d156
592 | | | | parent: 1:6db2ef61d156
593 | | | | parent: 15:1dda3f72782d
593 | | | | parent: 15:1dda3f72782d
594 | | | | user: test
594 | | | | user: test
595 | | | | date: Thu Jan 01 00:00:18 1970 +0000
595 | | | | date: Thu Jan 01 00:00:18 1970 +0000
596 | | | | summary: (18) merge two known; two far left
596 | | | | summary: (18) merge two known; two far left
597 | | | |
597 | | | |
598 | o | | changeset: 17:44765d7c06e0
598 | o | | changeset: 17:44765d7c06e0
599 | |\ \ \ parent: 12:86b91144a6e9
599 | |\ \ \ parent: 12:86b91144a6e9
600 | | | | | parent: 16:3677d192927d
600 | | | | | parent: 16:3677d192927d
601 | | | | | user: test
601 | | | | | user: test
602 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
602 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
603 | | | | | summary: (17) expand
603 | | | | | summary: (17) expand
604 | | | | |
604 | | | | |
605 | | o---+ changeset: 16:3677d192927d
605 | | o---+ changeset: 16:3677d192927d
606 | | | | | parent: 0:e6eb3150255d
606 | | | | | parent: 0:e6eb3150255d
607 | | |/ / parent: 1:6db2ef61d156
607 | | |/ / parent: 1:6db2ef61d156
608 | | | | user: test
608 | | | | user: test
609 | | | | date: Thu Jan 01 00:00:16 1970 +0000
609 | | | | date: Thu Jan 01 00:00:16 1970 +0000
610 | | | | summary: (16) merge two known; one immediate right, one near right
610 | | | | summary: (16) merge two known; one immediate right, one near right
611 | | | |
611 | | | |
612 o | | | changeset: 15:1dda3f72782d
612 o | | | changeset: 15:1dda3f72782d
613 |\ \ \ \ parent: 13:22d8966a97e3
613 |\ \ \ \ parent: 13:22d8966a97e3
614 | | | | | parent: 14:8eac370358ef
614 | | | | | parent: 14:8eac370358ef
615 | | | | | user: test
615 | | | | | user: test
616 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
616 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
617 | | | | | summary: (15) expand
617 | | | | | summary: (15) expand
618 | | | | |
618 | | | | |
619 | o-----+ changeset: 14:8eac370358ef
619 | o-----+ changeset: 14:8eac370358ef
620 | | | | | parent: 0:e6eb3150255d
620 | | | | | parent: 0:e6eb3150255d
621 | |/ / / parent: 12:86b91144a6e9
621 | |/ / / parent: 12:86b91144a6e9
622 | | | | user: test
622 | | | | user: test
623 | | | | date: Thu Jan 01 00:00:14 1970 +0000
623 | | | | date: Thu Jan 01 00:00:14 1970 +0000
624 | | | | summary: (14) merge two known; one immediate right, one far right
624 | | | | summary: (14) merge two known; one immediate right, one far right
625 | | | |
625 | | | |
626 o | | | changeset: 13:22d8966a97e3
626 o | | | changeset: 13:22d8966a97e3
627 |\ \ \ \ parent: 9:7010c0af0a35
627 |\ \ \ \ parent: 9:7010c0af0a35
628 | | | | | parent: 11:832d76e6bdf2
628 | | | | | parent: 11:832d76e6bdf2
629 | | | | | user: test
629 | | | | | user: test
630 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
630 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
631 | | | | | summary: (13) expand
631 | | | | | summary: (13) expand
632 | | | | |
632 | | | | |
633 +---o | | changeset: 12:86b91144a6e9
633 +---o | | changeset: 12:86b91144a6e9
634 | | |/ / parent: 1:6db2ef61d156
634 | | |/ / parent: 1:6db2ef61d156
635 | | | | parent: 9:7010c0af0a35
635 | | | | parent: 9:7010c0af0a35
636 | | | | user: test
636 | | | | user: test
637 | | | | date: Thu Jan 01 00:00:12 1970 +0000
637 | | | | date: Thu Jan 01 00:00:12 1970 +0000
638 | | | | summary: (12) merge two known; one immediate right, one far left
638 | | | | summary: (12) merge two known; one immediate right, one far left
639 | | | |
639 | | | |
640 | o | | changeset: 11:832d76e6bdf2
640 | o | | changeset: 11:832d76e6bdf2
641 | |\ \ \ parent: 6:b105a072e251
641 | |\ \ \ parent: 6:b105a072e251
642 | | | | | parent: 10:74c64d036d72
642 | | | | | parent: 10:74c64d036d72
643 | | | | | user: test
643 | | | | | user: test
644 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
644 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
645 | | | | | summary: (11) expand
645 | | | | | summary: (11) expand
646 | | | | |
646 | | | | |
647 | | o---+ changeset: 10:74c64d036d72
647 | | o---+ changeset: 10:74c64d036d72
648 | | | | | parent: 0:e6eb3150255d
648 | | | | | parent: 0:e6eb3150255d
649 | |/ / / parent: 6:b105a072e251
649 | |/ / / parent: 6:b105a072e251
650 | | | | user: test
650 | | | | user: test
651 | | | | date: Thu Jan 01 00:00:10 1970 +0000
651 | | | | date: Thu Jan 01 00:00:10 1970 +0000
652 | | | | summary: (10) merge two known; one immediate left, one near right
652 | | | | summary: (10) merge two known; one immediate left, one near right
653 | | | |
653 | | | |
654 o | | | changeset: 9:7010c0af0a35
654 o | | | changeset: 9:7010c0af0a35
655 |\ \ \ \ parent: 7:b632bb1b1224
655 |\ \ \ \ parent: 7:b632bb1b1224
656 | | | | | parent: 8:7a0b11f71937
656 | | | | | parent: 8:7a0b11f71937
657 | | | | | user: test
657 | | | | | user: test
658 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
658 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
659 | | | | | summary: (9) expand
659 | | | | | summary: (9) expand
660 | | | | |
660 | | | | |
661 | o-----+ changeset: 8:7a0b11f71937
661 | o-----+ changeset: 8:7a0b11f71937
662 | | | | | parent: 0:e6eb3150255d
662 | | | | | parent: 0:e6eb3150255d
663 |/ / / / parent: 7:b632bb1b1224
663 |/ / / / parent: 7:b632bb1b1224
664 | | | | user: test
664 | | | | user: test
665 | | | | date: Thu Jan 01 00:00:08 1970 +0000
665 | | | | date: Thu Jan 01 00:00:08 1970 +0000
666 | | | | summary: (8) merge two known; one immediate left, one far right
666 | | | | summary: (8) merge two known; one immediate left, one far right
667 | | | |
667 | | | |
668 o | | | changeset: 7:b632bb1b1224
668 o | | | changeset: 7:b632bb1b1224
669 |\ \ \ \ parent: 2:3d9a33b8d1e1
669 |\ \ \ \ parent: 2:3d9a33b8d1e1
670 | | | | | parent: 5:4409d547b708
670 | | | | | parent: 5:4409d547b708
671 | | | | | user: test
671 | | | | | user: test
672 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
672 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
673 | | | | | summary: (7) expand
673 | | | | | summary: (7) expand
674 | | | | |
674 | | | | |
675 +---o | | changeset: 6:b105a072e251
675 +---o | | changeset: 6:b105a072e251
676 | |/ / / parent: 2:3d9a33b8d1e1
676 | |/ / / parent: 2:3d9a33b8d1e1
677 | | | | parent: 5:4409d547b708
677 | | | | parent: 5:4409d547b708
678 | | | | user: test
678 | | | | user: test
679 | | | | date: Thu Jan 01 00:00:06 1970 +0000
679 | | | | date: Thu Jan 01 00:00:06 1970 +0000
680 | | | | summary: (6) merge two known; one immediate left, one far left
680 | | | | summary: (6) merge two known; one immediate left, one far left
681 | | | |
681 | | | |
682 | o | | changeset: 5:4409d547b708
682 | o | | changeset: 5:4409d547b708
683 | |\ \ \ parent: 3:27eef8ed80b4
683 | |\ \ \ parent: 3:27eef8ed80b4
684 | | | | | parent: 4:26a8bac39d9f
684 | | | | | parent: 4:26a8bac39d9f
685 | | | | | user: test
685 | | | | | user: test
686 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
686 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
687 | | | | | summary: (5) expand
687 | | | | | summary: (5) expand
688 | | | | |
688 | | | | |
689 | | o | | changeset: 4:26a8bac39d9f
689 | | o | | changeset: 4:26a8bac39d9f
690 | |/|/ / parent: 1:6db2ef61d156
690 | |/|/ / parent: 1:6db2ef61d156
691 | | | | parent: 3:27eef8ed80b4
691 | | | | parent: 3:27eef8ed80b4
692 | | | | user: test
692 | | | | user: test
693 | | | | date: Thu Jan 01 00:00:04 1970 +0000
693 | | | | date: Thu Jan 01 00:00:04 1970 +0000
694 | | | | summary: (4) merge two known; one immediate left, one immediate right
694 | | | | summary: (4) merge two known; one immediate left, one immediate right
695 | | | |
695 | | | |
696 | o | | changeset: 3:27eef8ed80b4
696 | o | | changeset: 3:27eef8ed80b4
697 |/ / / user: test
697 |/ / / user: test
698 | | | date: Thu Jan 01 00:00:03 1970 +0000
698 | | | date: Thu Jan 01 00:00:03 1970 +0000
699 | | | summary: (3) collapse
699 | | | summary: (3) collapse
700 | | |
700 | | |
701 o | | changeset: 2:3d9a33b8d1e1
701 o | | changeset: 2:3d9a33b8d1e1
702 |/ / user: test
702 |/ / user: test
703 | | date: Thu Jan 01 00:00:02 1970 +0000
703 | | date: Thu Jan 01 00:00:02 1970 +0000
704 | | summary: (2) collapse
704 | | summary: (2) collapse
705 | |
705 | |
706 o | changeset: 1:6db2ef61d156
706 o | changeset: 1:6db2ef61d156
707 |/ user: test
707 |/ user: test
708 | date: Thu Jan 01 00:00:01 1970 +0000
708 | date: Thu Jan 01 00:00:01 1970 +0000
709 | summary: (1) collapse
709 | summary: (1) collapse
710 |
710 |
711 o changeset: 0:e6eb3150255d
711 o changeset: 0:e6eb3150255d
712 user: test
712 user: test
713 date: Thu Jan 01 00:00:00 1970 +0000
713 date: Thu Jan 01 00:00:00 1970 +0000
714 summary: (0) root
714 summary: (0) root
715
715
716
716
717 File glog per revset:
717 File glog per revset:
718
718
719 $ hg log -G -r 'file("a")'
719 $ hg log -G -r 'file("a")'
720 @ changeset: 34:fea3ac5810e0
720 @ changeset: 34:fea3ac5810e0
721 | tag: tip
721 | tag: tip
722 | parent: 32:d06dffa21a31
722 | parent: 32:d06dffa21a31
723 | user: test
723 | user: test
724 | date: Thu Jan 01 00:00:34 1970 +0000
724 | date: Thu Jan 01 00:00:34 1970 +0000
725 | summary: (34) head
725 | summary: (34) head
726 |
726 |
727 | o changeset: 33:68608f5145f9
727 | o changeset: 33:68608f5145f9
728 | | parent: 18:1aa84d96232a
728 | | parent: 18:1aa84d96232a
729 | | user: test
729 | | user: test
730 | | date: Thu Jan 01 00:00:33 1970 +0000
730 | | date: Thu Jan 01 00:00:33 1970 +0000
731 | | summary: (33) head
731 | | summary: (33) head
732 | |
732 | |
733 o | changeset: 32:d06dffa21a31
733 o | changeset: 32:d06dffa21a31
734 |\ \ parent: 27:886ed638191b
734 |\ \ parent: 27:886ed638191b
735 | | | parent: 31:621d83e11f67
735 | | | parent: 31:621d83e11f67
736 | | | user: test
736 | | | user: test
737 | | | date: Thu Jan 01 00:00:32 1970 +0000
737 | | | date: Thu Jan 01 00:00:32 1970 +0000
738 | | | summary: (32) expand
738 | | | summary: (32) expand
739 | | |
739 | | |
740 | o | changeset: 31:621d83e11f67
740 | o | changeset: 31:621d83e11f67
741 | |\ \ parent: 21:d42a756af44d
741 | |\ \ parent: 21:d42a756af44d
742 | | | | parent: 30:6e11cd4b648f
742 | | | | parent: 30:6e11cd4b648f
743 | | | | user: test
743 | | | | user: test
744 | | | | date: Thu Jan 01 00:00:31 1970 +0000
744 | | | | date: Thu Jan 01 00:00:31 1970 +0000
745 | | | | summary: (31) expand
745 | | | | summary: (31) expand
746 | | | |
746 | | | |
747 | | o | changeset: 30:6e11cd4b648f
747 | | o | changeset: 30:6e11cd4b648f
748 | | |\ \ parent: 28:44ecd0b9ae99
748 | | |\ \ parent: 28:44ecd0b9ae99
749 | | | | | parent: 29:cd9bb2be7593
749 | | | | | parent: 29:cd9bb2be7593
750 | | | | | user: test
750 | | | | | user: test
751 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
751 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
752 | | | | | summary: (30) expand
752 | | | | | summary: (30) expand
753 | | | | |
753 | | | | |
754 | | | o | changeset: 29:cd9bb2be7593
754 | | | o | changeset: 29:cd9bb2be7593
755 | | | | | parent: 0:e6eb3150255d
755 | | | | | parent: 0:e6eb3150255d
756 | | | | | user: test
756 | | | | | user: test
757 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
757 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
758 | | | | | summary: (29) regular commit
758 | | | | | summary: (29) regular commit
759 | | | | |
759 | | | | |
760 | | o | | changeset: 28:44ecd0b9ae99
760 | | o | | changeset: 28:44ecd0b9ae99
761 | | |\ \ \ parent: 1:6db2ef61d156
761 | | |\ \ \ parent: 1:6db2ef61d156
762 | | | | | | parent: 26:7f25b6c2f0b9
762 | | | | | | parent: 26:7f25b6c2f0b9
763 | | | | | | user: test
763 | | | | | | user: test
764 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
764 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
765 | | | | | | summary: (28) merge zero known
765 | | | | | | summary: (28) merge zero known
766 | | | | | |
766 | | | | | |
767 o | | | | | changeset: 27:886ed638191b
767 o | | | | | changeset: 27:886ed638191b
768 |/ / / / / parent: 21:d42a756af44d
768 |/ / / / / parent: 21:d42a756af44d
769 | | | | | user: test
769 | | | | | user: test
770 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
770 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
771 | | | | | summary: (27) collapse
771 | | | | | summary: (27) collapse
772 | | | | |
772 | | | | |
773 | | o---+ changeset: 26:7f25b6c2f0b9
773 | | o---+ changeset: 26:7f25b6c2f0b9
774 | | | | | parent: 18:1aa84d96232a
774 | | | | | parent: 18:1aa84d96232a
775 | | | | | parent: 25:91da8ed57247
775 | | | | | parent: 25:91da8ed57247
776 | | | | | user: test
776 | | | | | user: test
777 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
777 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
778 | | | | | summary: (26) merge one known; far right
778 | | | | | summary: (26) merge one known; far right
779 | | | | |
779 | | | | |
780 +---o | | changeset: 25:91da8ed57247
780 +---o | | changeset: 25:91da8ed57247
781 | | | | | parent: 21:d42a756af44d
781 | | | | | parent: 21:d42a756af44d
782 | | | | | parent: 24:a9c19a3d96b7
782 | | | | | parent: 24:a9c19a3d96b7
783 | | | | | user: test
783 | | | | | user: test
784 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
784 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
785 | | | | | summary: (25) merge one known; far left
785 | | | | | summary: (25) merge one known; far left
786 | | | | |
786 | | | | |
787 | | o | | changeset: 24:a9c19a3d96b7
787 | | o | | changeset: 24:a9c19a3d96b7
788 | | |\| | parent: 0:e6eb3150255d
788 | | |\| | parent: 0:e6eb3150255d
789 | | | | | parent: 23:a01cddf0766d
789 | | | | | parent: 23:a01cddf0766d
790 | | | | | user: test
790 | | | | | user: test
791 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
791 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
792 | | | | | summary: (24) merge one known; immediate right
792 | | | | | summary: (24) merge one known; immediate right
793 | | | | |
793 | | | | |
794 | | o | | changeset: 23:a01cddf0766d
794 | | o | | changeset: 23:a01cddf0766d
795 | |/| | | parent: 1:6db2ef61d156
795 | |/| | | parent: 1:6db2ef61d156
796 | | | | | parent: 22:e0d9cccacb5d
796 | | | | | parent: 22:e0d9cccacb5d
797 | | | | | user: test
797 | | | | | user: test
798 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
798 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
799 | | | | | summary: (23) merge one known; immediate left
799 | | | | | summary: (23) merge one known; immediate left
800 | | | | |
800 | | | | |
801 +---o---+ changeset: 22:e0d9cccacb5d
801 +---o---+ changeset: 22:e0d9cccacb5d
802 | | | | parent: 18:1aa84d96232a
802 | | | | parent: 18:1aa84d96232a
803 | | / / parent: 21:d42a756af44d
803 | | / / parent: 21:d42a756af44d
804 | | | | user: test
804 | | | | user: test
805 | | | | date: Thu Jan 01 00:00:22 1970 +0000
805 | | | | date: Thu Jan 01 00:00:22 1970 +0000
806 | | | | summary: (22) merge two known; one far left, one far right
806 | | | | summary: (22) merge two known; one far left, one far right
807 | | | |
807 | | | |
808 o | | | changeset: 21:d42a756af44d
808 o | | | changeset: 21:d42a756af44d
809 |\ \ \ \ parent: 19:31ddc2c1573b
809 |\ \ \ \ parent: 19:31ddc2c1573b
810 | | | | | parent: 20:d30ed6450e32
810 | | | | | parent: 20:d30ed6450e32
811 | | | | | user: test
811 | | | | | user: test
812 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
812 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
813 | | | | | summary: (21) expand
813 | | | | | summary: (21) expand
814 | | | | |
814 | | | | |
815 | o---+-+ changeset: 20:d30ed6450e32
815 | o---+-+ changeset: 20:d30ed6450e32
816 | | | | parent: 0:e6eb3150255d
816 | | | | parent: 0:e6eb3150255d
817 | / / / parent: 18:1aa84d96232a
817 | / / / parent: 18:1aa84d96232a
818 | | | | user: test
818 | | | | user: test
819 | | | | date: Thu Jan 01 00:00:20 1970 +0000
819 | | | | date: Thu Jan 01 00:00:20 1970 +0000
820 | | | | summary: (20) merge two known; two far right
820 | | | | summary: (20) merge two known; two far right
821 | | | |
821 | | | |
822 o | | | changeset: 19:31ddc2c1573b
822 o | | | changeset: 19:31ddc2c1573b
823 |\ \ \ \ parent: 15:1dda3f72782d
823 |\ \ \ \ parent: 15:1dda3f72782d
824 | | | | | parent: 17:44765d7c06e0
824 | | | | | parent: 17:44765d7c06e0
825 | | | | | user: test
825 | | | | | user: test
826 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
826 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
827 | | | | | summary: (19) expand
827 | | | | | summary: (19) expand
828 | | | | |
828 | | | | |
829 +---+---o changeset: 18:1aa84d96232a
829 +---+---o changeset: 18:1aa84d96232a
830 | | | | parent: 1:6db2ef61d156
830 | | | | parent: 1:6db2ef61d156
831 | | | | parent: 15:1dda3f72782d
831 | | | | parent: 15:1dda3f72782d
832 | | | | user: test
832 | | | | user: test
833 | | | | date: Thu Jan 01 00:00:18 1970 +0000
833 | | | | date: Thu Jan 01 00:00:18 1970 +0000
834 | | | | summary: (18) merge two known; two far left
834 | | | | summary: (18) merge two known; two far left
835 | | | |
835 | | | |
836 | o | | changeset: 17:44765d7c06e0
836 | o | | changeset: 17:44765d7c06e0
837 | |\ \ \ parent: 12:86b91144a6e9
837 | |\ \ \ parent: 12:86b91144a6e9
838 | | | | | parent: 16:3677d192927d
838 | | | | | parent: 16:3677d192927d
839 | | | | | user: test
839 | | | | | user: test
840 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
840 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
841 | | | | | summary: (17) expand
841 | | | | | summary: (17) expand
842 | | | | |
842 | | | | |
843 | | o---+ changeset: 16:3677d192927d
843 | | o---+ changeset: 16:3677d192927d
844 | | | | | parent: 0:e6eb3150255d
844 | | | | | parent: 0:e6eb3150255d
845 | | |/ / parent: 1:6db2ef61d156
845 | | |/ / parent: 1:6db2ef61d156
846 | | | | user: test
846 | | | | user: test
847 | | | | date: Thu Jan 01 00:00:16 1970 +0000
847 | | | | date: Thu Jan 01 00:00:16 1970 +0000
848 | | | | summary: (16) merge two known; one immediate right, one near right
848 | | | | summary: (16) merge two known; one immediate right, one near right
849 | | | |
849 | | | |
850 o | | | changeset: 15:1dda3f72782d
850 o | | | changeset: 15:1dda3f72782d
851 |\ \ \ \ parent: 13:22d8966a97e3
851 |\ \ \ \ parent: 13:22d8966a97e3
852 | | | | | parent: 14:8eac370358ef
852 | | | | | parent: 14:8eac370358ef
853 | | | | | user: test
853 | | | | | user: test
854 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
854 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
855 | | | | | summary: (15) expand
855 | | | | | summary: (15) expand
856 | | | | |
856 | | | | |
857 | o-----+ changeset: 14:8eac370358ef
857 | o-----+ changeset: 14:8eac370358ef
858 | | | | | parent: 0:e6eb3150255d
858 | | | | | parent: 0:e6eb3150255d
859 | |/ / / parent: 12:86b91144a6e9
859 | |/ / / parent: 12:86b91144a6e9
860 | | | | user: test
860 | | | | user: test
861 | | | | date: Thu Jan 01 00:00:14 1970 +0000
861 | | | | date: Thu Jan 01 00:00:14 1970 +0000
862 | | | | summary: (14) merge two known; one immediate right, one far right
862 | | | | summary: (14) merge two known; one immediate right, one far right
863 | | | |
863 | | | |
864 o | | | changeset: 13:22d8966a97e3
864 o | | | changeset: 13:22d8966a97e3
865 |\ \ \ \ parent: 9:7010c0af0a35
865 |\ \ \ \ parent: 9:7010c0af0a35
866 | | | | | parent: 11:832d76e6bdf2
866 | | | | | parent: 11:832d76e6bdf2
867 | | | | | user: test
867 | | | | | user: test
868 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
868 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
869 | | | | | summary: (13) expand
869 | | | | | summary: (13) expand
870 | | | | |
870 | | | | |
871 +---o | | changeset: 12:86b91144a6e9
871 +---o | | changeset: 12:86b91144a6e9
872 | | |/ / parent: 1:6db2ef61d156
872 | | |/ / parent: 1:6db2ef61d156
873 | | | | parent: 9:7010c0af0a35
873 | | | | parent: 9:7010c0af0a35
874 | | | | user: test
874 | | | | user: test
875 | | | | date: Thu Jan 01 00:00:12 1970 +0000
875 | | | | date: Thu Jan 01 00:00:12 1970 +0000
876 | | | | summary: (12) merge two known; one immediate right, one far left
876 | | | | summary: (12) merge two known; one immediate right, one far left
877 | | | |
877 | | | |
878 | o | | changeset: 11:832d76e6bdf2
878 | o | | changeset: 11:832d76e6bdf2
879 | |\ \ \ parent: 6:b105a072e251
879 | |\ \ \ parent: 6:b105a072e251
880 | | | | | parent: 10:74c64d036d72
880 | | | | | parent: 10:74c64d036d72
881 | | | | | user: test
881 | | | | | user: test
882 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
882 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
883 | | | | | summary: (11) expand
883 | | | | | summary: (11) expand
884 | | | | |
884 | | | | |
885 | | o---+ changeset: 10:74c64d036d72
885 | | o---+ changeset: 10:74c64d036d72
886 | | | | | parent: 0:e6eb3150255d
886 | | | | | parent: 0:e6eb3150255d
887 | |/ / / parent: 6:b105a072e251
887 | |/ / / parent: 6:b105a072e251
888 | | | | user: test
888 | | | | user: test
889 | | | | date: Thu Jan 01 00:00:10 1970 +0000
889 | | | | date: Thu Jan 01 00:00:10 1970 +0000
890 | | | | summary: (10) merge two known; one immediate left, one near right
890 | | | | summary: (10) merge two known; one immediate left, one near right
891 | | | |
891 | | | |
892 o | | | changeset: 9:7010c0af0a35
892 o | | | changeset: 9:7010c0af0a35
893 |\ \ \ \ parent: 7:b632bb1b1224
893 |\ \ \ \ parent: 7:b632bb1b1224
894 | | | | | parent: 8:7a0b11f71937
894 | | | | | parent: 8:7a0b11f71937
895 | | | | | user: test
895 | | | | | user: test
896 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
896 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
897 | | | | | summary: (9) expand
897 | | | | | summary: (9) expand
898 | | | | |
898 | | | | |
899 | o-----+ changeset: 8:7a0b11f71937
899 | o-----+ changeset: 8:7a0b11f71937
900 | | | | | parent: 0:e6eb3150255d
900 | | | | | parent: 0:e6eb3150255d
901 |/ / / / parent: 7:b632bb1b1224
901 |/ / / / parent: 7:b632bb1b1224
902 | | | | user: test
902 | | | | user: test
903 | | | | date: Thu Jan 01 00:00:08 1970 +0000
903 | | | | date: Thu Jan 01 00:00:08 1970 +0000
904 | | | | summary: (8) merge two known; one immediate left, one far right
904 | | | | summary: (8) merge two known; one immediate left, one far right
905 | | | |
905 | | | |
906 o | | | changeset: 7:b632bb1b1224
906 o | | | changeset: 7:b632bb1b1224
907 |\ \ \ \ parent: 2:3d9a33b8d1e1
907 |\ \ \ \ parent: 2:3d9a33b8d1e1
908 | | | | | parent: 5:4409d547b708
908 | | | | | parent: 5:4409d547b708
909 | | | | | user: test
909 | | | | | user: test
910 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
910 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
911 | | | | | summary: (7) expand
911 | | | | | summary: (7) expand
912 | | | | |
912 | | | | |
913 +---o | | changeset: 6:b105a072e251
913 +---o | | changeset: 6:b105a072e251
914 | |/ / / parent: 2:3d9a33b8d1e1
914 | |/ / / parent: 2:3d9a33b8d1e1
915 | | | | parent: 5:4409d547b708
915 | | | | parent: 5:4409d547b708
916 | | | | user: test
916 | | | | user: test
917 | | | | date: Thu Jan 01 00:00:06 1970 +0000
917 | | | | date: Thu Jan 01 00:00:06 1970 +0000
918 | | | | summary: (6) merge two known; one immediate left, one far left
918 | | | | summary: (6) merge two known; one immediate left, one far left
919 | | | |
919 | | | |
920 | o | | changeset: 5:4409d547b708
920 | o | | changeset: 5:4409d547b708
921 | |\ \ \ parent: 3:27eef8ed80b4
921 | |\ \ \ parent: 3:27eef8ed80b4
922 | | | | | parent: 4:26a8bac39d9f
922 | | | | | parent: 4:26a8bac39d9f
923 | | | | | user: test
923 | | | | | user: test
924 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
924 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
925 | | | | | summary: (5) expand
925 | | | | | summary: (5) expand
926 | | | | |
926 | | | | |
927 | | o | | changeset: 4:26a8bac39d9f
927 | | o | | changeset: 4:26a8bac39d9f
928 | |/|/ / parent: 1:6db2ef61d156
928 | |/|/ / parent: 1:6db2ef61d156
929 | | | | parent: 3:27eef8ed80b4
929 | | | | parent: 3:27eef8ed80b4
930 | | | | user: test
930 | | | | user: test
931 | | | | date: Thu Jan 01 00:00:04 1970 +0000
931 | | | | date: Thu Jan 01 00:00:04 1970 +0000
932 | | | | summary: (4) merge two known; one immediate left, one immediate right
932 | | | | summary: (4) merge two known; one immediate left, one immediate right
933 | | | |
933 | | | |
934 | o | | changeset: 3:27eef8ed80b4
934 | o | | changeset: 3:27eef8ed80b4
935 |/ / / user: test
935 |/ / / user: test
936 | | | date: Thu Jan 01 00:00:03 1970 +0000
936 | | | date: Thu Jan 01 00:00:03 1970 +0000
937 | | | summary: (3) collapse
937 | | | summary: (3) collapse
938 | | |
938 | | |
939 o | | changeset: 2:3d9a33b8d1e1
939 o | | changeset: 2:3d9a33b8d1e1
940 |/ / user: test
940 |/ / user: test
941 | | date: Thu Jan 01 00:00:02 1970 +0000
941 | | date: Thu Jan 01 00:00:02 1970 +0000
942 | | summary: (2) collapse
942 | | summary: (2) collapse
943 | |
943 | |
944 o | changeset: 1:6db2ef61d156
944 o | changeset: 1:6db2ef61d156
945 |/ user: test
945 |/ user: test
946 | date: Thu Jan 01 00:00:01 1970 +0000
946 | date: Thu Jan 01 00:00:01 1970 +0000
947 | summary: (1) collapse
947 | summary: (1) collapse
948 |
948 |
949 o changeset: 0:e6eb3150255d
949 o changeset: 0:e6eb3150255d
950 user: test
950 user: test
951 date: Thu Jan 01 00:00:00 1970 +0000
951 date: Thu Jan 01 00:00:00 1970 +0000
952 summary: (0) root
952 summary: (0) root
953
953
954
954
955
955
956 File glog per revset (only merges):
956 File glog per revset (only merges):
957
957
958 $ hg log -G -r 'file("a")' -m
958 $ hg log -G -r 'file("a")' -m
959 o changeset: 32:d06dffa21a31
959 o changeset: 32:d06dffa21a31
960 |\ parent: 27:886ed638191b
960 |\ parent: 27:886ed638191b
961 | : parent: 31:621d83e11f67
961 | : parent: 31:621d83e11f67
962 | : user: test
962 | : user: test
963 | : date: Thu Jan 01 00:00:32 1970 +0000
963 | : date: Thu Jan 01 00:00:32 1970 +0000
964 | : summary: (32) expand
964 | : summary: (32) expand
965 | :
965 | :
966 o : changeset: 31:621d83e11f67
966 o : changeset: 31:621d83e11f67
967 |\: parent: 21:d42a756af44d
967 |\: parent: 21:d42a756af44d
968 | : parent: 30:6e11cd4b648f
968 | : parent: 30:6e11cd4b648f
969 | : user: test
969 | : user: test
970 | : date: Thu Jan 01 00:00:31 1970 +0000
970 | : date: Thu Jan 01 00:00:31 1970 +0000
971 | : summary: (31) expand
971 | : summary: (31) expand
972 | :
972 | :
973 o : changeset: 30:6e11cd4b648f
973 o : changeset: 30:6e11cd4b648f
974 |\ \ parent: 28:44ecd0b9ae99
974 |\ \ parent: 28:44ecd0b9ae99
975 | ~ : parent: 29:cd9bb2be7593
975 | ~ : parent: 29:cd9bb2be7593
976 | : user: test
976 | : user: test
977 | : date: Thu Jan 01 00:00:30 1970 +0000
977 | : date: Thu Jan 01 00:00:30 1970 +0000
978 | : summary: (30) expand
978 | : summary: (30) expand
979 | /
979 | /
980 o : changeset: 28:44ecd0b9ae99
980 o : changeset: 28:44ecd0b9ae99
981 |\ \ parent: 1:6db2ef61d156
981 |\ \ parent: 1:6db2ef61d156
982 | ~ : parent: 26:7f25b6c2f0b9
982 | ~ : parent: 26:7f25b6c2f0b9
983 | : user: test
983 | : user: test
984 | : date: Thu Jan 01 00:00:28 1970 +0000
984 | : date: Thu Jan 01 00:00:28 1970 +0000
985 | : summary: (28) merge zero known
985 | : summary: (28) merge zero known
986 | /
986 | /
987 o : changeset: 26:7f25b6c2f0b9
987 o : changeset: 26:7f25b6c2f0b9
988 |\ \ parent: 18:1aa84d96232a
988 |\ \ parent: 18:1aa84d96232a
989 | | : parent: 25:91da8ed57247
989 | | : parent: 25:91da8ed57247
990 | | : user: test
990 | | : user: test
991 | | : date: Thu Jan 01 00:00:26 1970 +0000
991 | | : date: Thu Jan 01 00:00:26 1970 +0000
992 | | : summary: (26) merge one known; far right
992 | | : summary: (26) merge one known; far right
993 | | :
993 | | :
994 | o : changeset: 25:91da8ed57247
994 | o : changeset: 25:91da8ed57247
995 | |\: parent: 21:d42a756af44d
995 | |\: parent: 21:d42a756af44d
996 | | : parent: 24:a9c19a3d96b7
996 | | : parent: 24:a9c19a3d96b7
997 | | : user: test
997 | | : user: test
998 | | : date: Thu Jan 01 00:00:25 1970 +0000
998 | | : date: Thu Jan 01 00:00:25 1970 +0000
999 | | : summary: (25) merge one known; far left
999 | | : summary: (25) merge one known; far left
1000 | | :
1000 | | :
1001 | o : changeset: 24:a9c19a3d96b7
1001 | o : changeset: 24:a9c19a3d96b7
1002 | |\ \ parent: 0:e6eb3150255d
1002 | |\ \ parent: 0:e6eb3150255d
1003 | | ~ : parent: 23:a01cddf0766d
1003 | | ~ : parent: 23:a01cddf0766d
1004 | | : user: test
1004 | | : user: test
1005 | | : date: Thu Jan 01 00:00:24 1970 +0000
1005 | | : date: Thu Jan 01 00:00:24 1970 +0000
1006 | | : summary: (24) merge one known; immediate right
1006 | | : summary: (24) merge one known; immediate right
1007 | | /
1007 | | /
1008 | o : changeset: 23:a01cddf0766d
1008 | o : changeset: 23:a01cddf0766d
1009 | |\ \ parent: 1:6db2ef61d156
1009 | |\ \ parent: 1:6db2ef61d156
1010 | | ~ : parent: 22:e0d9cccacb5d
1010 | | ~ : parent: 22:e0d9cccacb5d
1011 | | : user: test
1011 | | : user: test
1012 | | : date: Thu Jan 01 00:00:23 1970 +0000
1012 | | : date: Thu Jan 01 00:00:23 1970 +0000
1013 | | : summary: (23) merge one known; immediate left
1013 | | : summary: (23) merge one known; immediate left
1014 | | /
1014 | | /
1015 | o : changeset: 22:e0d9cccacb5d
1015 | o : changeset: 22:e0d9cccacb5d
1016 |/:/ parent: 18:1aa84d96232a
1016 |/:/ parent: 18:1aa84d96232a
1017 | : parent: 21:d42a756af44d
1017 | : parent: 21:d42a756af44d
1018 | : user: test
1018 | : user: test
1019 | : date: Thu Jan 01 00:00:22 1970 +0000
1019 | : date: Thu Jan 01 00:00:22 1970 +0000
1020 | : summary: (22) merge two known; one far left, one far right
1020 | : summary: (22) merge two known; one far left, one far right
1021 | :
1021 | :
1022 | o changeset: 21:d42a756af44d
1022 | o changeset: 21:d42a756af44d
1023 | |\ parent: 19:31ddc2c1573b
1023 | |\ parent: 19:31ddc2c1573b
1024 | | | parent: 20:d30ed6450e32
1024 | | | parent: 20:d30ed6450e32
1025 | | | user: test
1025 | | | user: test
1026 | | | date: Thu Jan 01 00:00:21 1970 +0000
1026 | | | date: Thu Jan 01 00:00:21 1970 +0000
1027 | | | summary: (21) expand
1027 | | | summary: (21) expand
1028 | | |
1028 | | |
1029 +---o changeset: 20:d30ed6450e32
1029 +---o changeset: 20:d30ed6450e32
1030 | | | parent: 0:e6eb3150255d
1030 | | | parent: 0:e6eb3150255d
1031 | | ~ parent: 18:1aa84d96232a
1031 | | ~ parent: 18:1aa84d96232a
1032 | | user: test
1032 | | user: test
1033 | | date: Thu Jan 01 00:00:20 1970 +0000
1033 | | date: Thu Jan 01 00:00:20 1970 +0000
1034 | | summary: (20) merge two known; two far right
1034 | | summary: (20) merge two known; two far right
1035 | |
1035 | |
1036 | o changeset: 19:31ddc2c1573b
1036 | o changeset: 19:31ddc2c1573b
1037 | |\ parent: 15:1dda3f72782d
1037 | |\ parent: 15:1dda3f72782d
1038 | | | parent: 17:44765d7c06e0
1038 | | | parent: 17:44765d7c06e0
1039 | | | user: test
1039 | | | user: test
1040 | | | date: Thu Jan 01 00:00:19 1970 +0000
1040 | | | date: Thu Jan 01 00:00:19 1970 +0000
1041 | | | summary: (19) expand
1041 | | | summary: (19) expand
1042 | | |
1042 | | |
1043 o | | changeset: 18:1aa84d96232a
1043 o | | changeset: 18:1aa84d96232a
1044 |\| | parent: 1:6db2ef61d156
1044 |\| | parent: 1:6db2ef61d156
1045 ~ | | parent: 15:1dda3f72782d
1045 ~ | | parent: 15:1dda3f72782d
1046 | | user: test
1046 | | user: test
1047 | | date: Thu Jan 01 00:00:18 1970 +0000
1047 | | date: Thu Jan 01 00:00:18 1970 +0000
1048 | | summary: (18) merge two known; two far left
1048 | | summary: (18) merge two known; two far left
1049 / /
1049 / /
1050 | o changeset: 17:44765d7c06e0
1050 | o changeset: 17:44765d7c06e0
1051 | |\ parent: 12:86b91144a6e9
1051 | |\ parent: 12:86b91144a6e9
1052 | | | parent: 16:3677d192927d
1052 | | | parent: 16:3677d192927d
1053 | | | user: test
1053 | | | user: test
1054 | | | date: Thu Jan 01 00:00:17 1970 +0000
1054 | | | date: Thu Jan 01 00:00:17 1970 +0000
1055 | | | summary: (17) expand
1055 | | | summary: (17) expand
1056 | | |
1056 | | |
1057 | | o changeset: 16:3677d192927d
1057 | | o changeset: 16:3677d192927d
1058 | | |\ parent: 0:e6eb3150255d
1058 | | |\ parent: 0:e6eb3150255d
1059 | | ~ ~ parent: 1:6db2ef61d156
1059 | | ~ ~ parent: 1:6db2ef61d156
1060 | | user: test
1060 | | user: test
1061 | | date: Thu Jan 01 00:00:16 1970 +0000
1061 | | date: Thu Jan 01 00:00:16 1970 +0000
1062 | | summary: (16) merge two known; one immediate right, one near right
1062 | | summary: (16) merge two known; one immediate right, one near right
1063 | |
1063 | |
1064 o | changeset: 15:1dda3f72782d
1064 o | changeset: 15:1dda3f72782d
1065 |\ \ parent: 13:22d8966a97e3
1065 |\ \ parent: 13:22d8966a97e3
1066 | | | parent: 14:8eac370358ef
1066 | | | parent: 14:8eac370358ef
1067 | | | user: test
1067 | | | user: test
1068 | | | date: Thu Jan 01 00:00:15 1970 +0000
1068 | | | date: Thu Jan 01 00:00:15 1970 +0000
1069 | | | summary: (15) expand
1069 | | | summary: (15) expand
1070 | | |
1070 | | |
1071 | o | changeset: 14:8eac370358ef
1071 | o | changeset: 14:8eac370358ef
1072 | |\| parent: 0:e6eb3150255d
1072 | |\| parent: 0:e6eb3150255d
1073 | ~ | parent: 12:86b91144a6e9
1073 | ~ | parent: 12:86b91144a6e9
1074 | | user: test
1074 | | user: test
1075 | | date: Thu Jan 01 00:00:14 1970 +0000
1075 | | date: Thu Jan 01 00:00:14 1970 +0000
1076 | | summary: (14) merge two known; one immediate right, one far right
1076 | | summary: (14) merge two known; one immediate right, one far right
1077 | /
1077 | /
1078 o | changeset: 13:22d8966a97e3
1078 o | changeset: 13:22d8966a97e3
1079 |\ \ parent: 9:7010c0af0a35
1079 |\ \ parent: 9:7010c0af0a35
1080 | | | parent: 11:832d76e6bdf2
1080 | | | parent: 11:832d76e6bdf2
1081 | | | user: test
1081 | | | user: test
1082 | | | date: Thu Jan 01 00:00:13 1970 +0000
1082 | | | date: Thu Jan 01 00:00:13 1970 +0000
1083 | | | summary: (13) expand
1083 | | | summary: (13) expand
1084 | | |
1084 | | |
1085 +---o changeset: 12:86b91144a6e9
1085 +---o changeset: 12:86b91144a6e9
1086 | | | parent: 1:6db2ef61d156
1086 | | | parent: 1:6db2ef61d156
1087 | | ~ parent: 9:7010c0af0a35
1087 | | ~ parent: 9:7010c0af0a35
1088 | | user: test
1088 | | user: test
1089 | | date: Thu Jan 01 00:00:12 1970 +0000
1089 | | date: Thu Jan 01 00:00:12 1970 +0000
1090 | | summary: (12) merge two known; one immediate right, one far left
1090 | | summary: (12) merge two known; one immediate right, one far left
1091 | |
1091 | |
1092 | o changeset: 11:832d76e6bdf2
1092 | o changeset: 11:832d76e6bdf2
1093 | |\ parent: 6:b105a072e251
1093 | |\ parent: 6:b105a072e251
1094 | | | parent: 10:74c64d036d72
1094 | | | parent: 10:74c64d036d72
1095 | | | user: test
1095 | | | user: test
1096 | | | date: Thu Jan 01 00:00:11 1970 +0000
1096 | | | date: Thu Jan 01 00:00:11 1970 +0000
1097 | | | summary: (11) expand
1097 | | | summary: (11) expand
1098 | | |
1098 | | |
1099 | | o changeset: 10:74c64d036d72
1099 | | o changeset: 10:74c64d036d72
1100 | |/| parent: 0:e6eb3150255d
1100 | |/| parent: 0:e6eb3150255d
1101 | | ~ parent: 6:b105a072e251
1101 | | ~ parent: 6:b105a072e251
1102 | | user: test
1102 | | user: test
1103 | | date: Thu Jan 01 00:00:10 1970 +0000
1103 | | date: Thu Jan 01 00:00:10 1970 +0000
1104 | | summary: (10) merge two known; one immediate left, one near right
1104 | | summary: (10) merge two known; one immediate left, one near right
1105 | |
1105 | |
1106 o | changeset: 9:7010c0af0a35
1106 o | changeset: 9:7010c0af0a35
1107 |\ \ parent: 7:b632bb1b1224
1107 |\ \ parent: 7:b632bb1b1224
1108 | | | parent: 8:7a0b11f71937
1108 | | | parent: 8:7a0b11f71937
1109 | | | user: test
1109 | | | user: test
1110 | | | date: Thu Jan 01 00:00:09 1970 +0000
1110 | | | date: Thu Jan 01 00:00:09 1970 +0000
1111 | | | summary: (9) expand
1111 | | | summary: (9) expand
1112 | | |
1112 | | |
1113 | o | changeset: 8:7a0b11f71937
1113 | o | changeset: 8:7a0b11f71937
1114 |/| | parent: 0:e6eb3150255d
1114 |/| | parent: 0:e6eb3150255d
1115 | ~ | parent: 7:b632bb1b1224
1115 | ~ | parent: 7:b632bb1b1224
1116 | | user: test
1116 | | user: test
1117 | | date: Thu Jan 01 00:00:08 1970 +0000
1117 | | date: Thu Jan 01 00:00:08 1970 +0000
1118 | | summary: (8) merge two known; one immediate left, one far right
1118 | | summary: (8) merge two known; one immediate left, one far right
1119 | /
1119 | /
1120 o | changeset: 7:b632bb1b1224
1120 o | changeset: 7:b632bb1b1224
1121 |\ \ parent: 2:3d9a33b8d1e1
1121 |\ \ parent: 2:3d9a33b8d1e1
1122 | ~ | parent: 5:4409d547b708
1122 | ~ | parent: 5:4409d547b708
1123 | | user: test
1123 | | user: test
1124 | | date: Thu Jan 01 00:00:07 1970 +0000
1124 | | date: Thu Jan 01 00:00:07 1970 +0000
1125 | | summary: (7) expand
1125 | | summary: (7) expand
1126 | /
1126 | /
1127 | o changeset: 6:b105a072e251
1127 | o changeset: 6:b105a072e251
1128 |/| parent: 2:3d9a33b8d1e1
1128 |/| parent: 2:3d9a33b8d1e1
1129 | ~ parent: 5:4409d547b708
1129 | ~ parent: 5:4409d547b708
1130 | user: test
1130 | user: test
1131 | date: Thu Jan 01 00:00:06 1970 +0000
1131 | date: Thu Jan 01 00:00:06 1970 +0000
1132 | summary: (6) merge two known; one immediate left, one far left
1132 | summary: (6) merge two known; one immediate left, one far left
1133 |
1133 |
1134 o changeset: 5:4409d547b708
1134 o changeset: 5:4409d547b708
1135 |\ parent: 3:27eef8ed80b4
1135 |\ parent: 3:27eef8ed80b4
1136 | ~ parent: 4:26a8bac39d9f
1136 | ~ parent: 4:26a8bac39d9f
1137 | user: test
1137 | user: test
1138 | date: Thu Jan 01 00:00:05 1970 +0000
1138 | date: Thu Jan 01 00:00:05 1970 +0000
1139 | summary: (5) expand
1139 | summary: (5) expand
1140 |
1140 |
1141 o changeset: 4:26a8bac39d9f
1141 o changeset: 4:26a8bac39d9f
1142 |\ parent: 1:6db2ef61d156
1142 |\ parent: 1:6db2ef61d156
1143 ~ ~ parent: 3:27eef8ed80b4
1143 ~ ~ parent: 3:27eef8ed80b4
1144 user: test
1144 user: test
1145 date: Thu Jan 01 00:00:04 1970 +0000
1145 date: Thu Jan 01 00:00:04 1970 +0000
1146 summary: (4) merge two known; one immediate left, one immediate right
1146 summary: (4) merge two known; one immediate left, one immediate right
1147
1147
1148
1148
1149
1149
1150 Empty revision range - display nothing:
1150 Empty revision range - display nothing:
1151 $ hg log -G -r 1..0
1151 $ hg log -G -r 1..0
1152
1152
1153 $ cd ..
1153 $ cd ..
1154
1154
1155 #if no-outer-repo
1155 #if no-outer-repo
1156
1156
1157 From outer space:
1157 From outer space:
1158 $ hg log -G -l1 repo
1158 $ hg log -G -l1 repo
1159 @ changeset: 34:fea3ac5810e0
1159 @ changeset: 34:fea3ac5810e0
1160 | tag: tip
1160 | tag: tip
1161 ~ parent: 32:d06dffa21a31
1161 ~ parent: 32:d06dffa21a31
1162 user: test
1162 user: test
1163 date: Thu Jan 01 00:00:34 1970 +0000
1163 date: Thu Jan 01 00:00:34 1970 +0000
1164 summary: (34) head
1164 summary: (34) head
1165
1165
1166 $ hg log -G -l1 repo/a
1166 $ hg log -G -l1 repo/a
1167 @ changeset: 34:fea3ac5810e0
1167 @ changeset: 34:fea3ac5810e0
1168 | tag: tip
1168 | tag: tip
1169 ~ parent: 32:d06dffa21a31
1169 ~ parent: 32:d06dffa21a31
1170 user: test
1170 user: test
1171 date: Thu Jan 01 00:00:34 1970 +0000
1171 date: Thu Jan 01 00:00:34 1970 +0000
1172 summary: (34) head
1172 summary: (34) head
1173
1173
1174 $ hg log -G -l1 repo/missing
1174 $ hg log -G -l1 repo/missing
1175
1175
1176 #endif
1176 #endif
1177
1177
1178 File log with revs != cset revs:
1178 File log with revs != cset revs:
1179 $ hg init flog
1179 $ hg init flog
1180 $ cd flog
1180 $ cd flog
1181 $ echo one >one
1181 $ echo one >one
1182 $ hg add one
1182 $ hg add one
1183 $ hg commit -mone
1183 $ hg commit -mone
1184 $ echo two >two
1184 $ echo two >two
1185 $ hg add two
1185 $ hg add two
1186 $ hg commit -mtwo
1186 $ hg commit -mtwo
1187 $ echo more >two
1187 $ echo more >two
1188 $ hg commit -mmore
1188 $ hg commit -mmore
1189 $ hg log -G two
1189 $ hg log -G two
1190 @ changeset: 2:12c28321755b
1190 @ changeset: 2:12c28321755b
1191 | tag: tip
1191 | tag: tip
1192 | user: test
1192 | user: test
1193 | date: Thu Jan 01 00:00:00 1970 +0000
1193 | date: Thu Jan 01 00:00:00 1970 +0000
1194 | summary: more
1194 | summary: more
1195 |
1195 |
1196 o changeset: 1:5ac72c0599bf
1196 o changeset: 1:5ac72c0599bf
1197 | user: test
1197 | user: test
1198 ~ date: Thu Jan 01 00:00:00 1970 +0000
1198 ~ date: Thu Jan 01 00:00:00 1970 +0000
1199 summary: two
1199 summary: two
1200
1200
1201
1201
1202 Issue1896: File log with explicit style
1202 Issue1896: File log with explicit style
1203 $ hg log -G --style=default one
1203 $ hg log -G --style=default one
1204 o changeset: 0:3d578b4a1f53
1204 o changeset: 0:3d578b4a1f53
1205 user: test
1205 user: test
1206 date: Thu Jan 01 00:00:00 1970 +0000
1206 date: Thu Jan 01 00:00:00 1970 +0000
1207 summary: one
1207 summary: one
1208
1208
1209 Issue2395: glog --style header and footer
1209 Issue2395: glog --style header and footer
1210 $ hg log -G --style=xml one
1210 $ hg log -G --style=xml one
1211 <?xml version="1.0"?>
1211 <?xml version="1.0"?>
1212 <log>
1212 <log>
1213 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1213 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1214 <author email="test">test</author>
1214 <author email="test">test</author>
1215 <date>1970-01-01T00:00:00+00:00</date>
1215 <date>1970-01-01T00:00:00+00:00</date>
1216 <msg xml:space="preserve">one</msg>
1216 <msg xml:space="preserve">one</msg>
1217 </logentry>
1217 </logentry>
1218 </log>
1218 </log>
1219
1219
1220 $ cd ..
1220 $ cd ..
1221
1221
1222 Incoming and outgoing:
1222 Incoming and outgoing:
1223
1223
1224 $ hg clone -U -r31 repo repo2
1224 $ hg clone -U -r31 repo repo2
1225 adding changesets
1225 adding changesets
1226 adding manifests
1226 adding manifests
1227 adding file changes
1227 adding file changes
1228 added 31 changesets with 31 changes to 1 files
1228 added 31 changesets with 31 changes to 1 files
1229 new changesets e6eb3150255d:621d83e11f67
1229 new changesets e6eb3150255d:621d83e11f67
1230 $ cd repo2
1230 $ cd repo2
1231
1231
1232 $ hg incoming --graph ../repo
1232 $ hg incoming --graph ../repo
1233 comparing with ../repo
1233 comparing with ../repo
1234 searching for changes
1234 searching for changes
1235 o changeset: 34:fea3ac5810e0
1235 o changeset: 34:fea3ac5810e0
1236 | tag: tip
1236 | tag: tip
1237 | parent: 32:d06dffa21a31
1237 | parent: 32:d06dffa21a31
1238 | user: test
1238 | user: test
1239 | date: Thu Jan 01 00:00:34 1970 +0000
1239 | date: Thu Jan 01 00:00:34 1970 +0000
1240 | summary: (34) head
1240 | summary: (34) head
1241 |
1241 |
1242 | o changeset: 33:68608f5145f9
1242 | o changeset: 33:68608f5145f9
1243 | parent: 18:1aa84d96232a
1243 | parent: 18:1aa84d96232a
1244 | user: test
1244 | user: test
1245 | date: Thu Jan 01 00:00:33 1970 +0000
1245 | date: Thu Jan 01 00:00:33 1970 +0000
1246 | summary: (33) head
1246 | summary: (33) head
1247 |
1247 |
1248 o changeset: 32:d06dffa21a31
1248 o changeset: 32:d06dffa21a31
1249 | parent: 27:886ed638191b
1249 | parent: 27:886ed638191b
1250 | parent: 31:621d83e11f67
1250 | parent: 31:621d83e11f67
1251 | user: test
1251 | user: test
1252 | date: Thu Jan 01 00:00:32 1970 +0000
1252 | date: Thu Jan 01 00:00:32 1970 +0000
1253 | summary: (32) expand
1253 | summary: (32) expand
1254 |
1254 |
1255 o changeset: 27:886ed638191b
1255 o changeset: 27:886ed638191b
1256 parent: 21:d42a756af44d
1256 parent: 21:d42a756af44d
1257 user: test
1257 user: test
1258 date: Thu Jan 01 00:00:27 1970 +0000
1258 date: Thu Jan 01 00:00:27 1970 +0000
1259 summary: (27) collapse
1259 summary: (27) collapse
1260
1260
1261 $ cd ..
1261 $ cd ..
1262
1262
1263 $ hg -R repo outgoing --graph repo2
1263 $ hg -R repo outgoing --graph repo2
1264 comparing with repo2
1264 comparing with repo2
1265 searching for changes
1265 searching for changes
1266 @ changeset: 34:fea3ac5810e0
1266 @ changeset: 34:fea3ac5810e0
1267 | tag: tip
1267 | tag: tip
1268 | parent: 32:d06dffa21a31
1268 | parent: 32:d06dffa21a31
1269 | user: test
1269 | user: test
1270 | date: Thu Jan 01 00:00:34 1970 +0000
1270 | date: Thu Jan 01 00:00:34 1970 +0000
1271 | summary: (34) head
1271 | summary: (34) head
1272 |
1272 |
1273 | o changeset: 33:68608f5145f9
1273 | o changeset: 33:68608f5145f9
1274 | parent: 18:1aa84d96232a
1274 | parent: 18:1aa84d96232a
1275 | user: test
1275 | user: test
1276 | date: Thu Jan 01 00:00:33 1970 +0000
1276 | date: Thu Jan 01 00:00:33 1970 +0000
1277 | summary: (33) head
1277 | summary: (33) head
1278 |
1278 |
1279 o changeset: 32:d06dffa21a31
1279 o changeset: 32:d06dffa21a31
1280 | parent: 27:886ed638191b
1280 | parent: 27:886ed638191b
1281 | parent: 31:621d83e11f67
1281 | parent: 31:621d83e11f67
1282 | user: test
1282 | user: test
1283 | date: Thu Jan 01 00:00:32 1970 +0000
1283 | date: Thu Jan 01 00:00:32 1970 +0000
1284 | summary: (32) expand
1284 | summary: (32) expand
1285 |
1285 |
1286 o changeset: 27:886ed638191b
1286 o changeset: 27:886ed638191b
1287 parent: 21:d42a756af44d
1287 parent: 21:d42a756af44d
1288 user: test
1288 user: test
1289 date: Thu Jan 01 00:00:27 1970 +0000
1289 date: Thu Jan 01 00:00:27 1970 +0000
1290 summary: (27) collapse
1290 summary: (27) collapse
1291
1291
1292
1292
1293 File + limit with revs != cset revs:
1293 File + limit with revs != cset revs:
1294 $ cd repo
1294 $ cd repo
1295 $ touch b
1295 $ touch b
1296 $ hg ci -Aqm0
1296 $ hg ci -Aqm0
1297 $ hg log -G -l2 a
1297 $ hg log -G -l2 a
1298 o changeset: 34:fea3ac5810e0
1298 o changeset: 34:fea3ac5810e0
1299 | parent: 32:d06dffa21a31
1299 | parent: 32:d06dffa21a31
1300 ~ user: test
1300 ~ user: test
1301 date: Thu Jan 01 00:00:34 1970 +0000
1301 date: Thu Jan 01 00:00:34 1970 +0000
1302 summary: (34) head
1302 summary: (34) head
1303
1303
1304 o changeset: 33:68608f5145f9
1304 o changeset: 33:68608f5145f9
1305 | parent: 18:1aa84d96232a
1305 | parent: 18:1aa84d96232a
1306 ~ user: test
1306 ~ user: test
1307 date: Thu Jan 01 00:00:33 1970 +0000
1307 date: Thu Jan 01 00:00:33 1970 +0000
1308 summary: (33) head
1308 summary: (33) head
1309
1309
1310
1310
1311 File + limit + -ra:b, (b - a) < limit:
1311 File + limit + -ra:b, (b - a) < limit:
1312 $ hg log -G -l3000 -r32:tip a
1312 $ hg log -G -l3000 -r32:tip a
1313 o changeset: 34:fea3ac5810e0
1313 o changeset: 34:fea3ac5810e0
1314 | parent: 32:d06dffa21a31
1314 | parent: 32:d06dffa21a31
1315 | user: test
1315 | user: test
1316 | date: Thu Jan 01 00:00:34 1970 +0000
1316 | date: Thu Jan 01 00:00:34 1970 +0000
1317 | summary: (34) head
1317 | summary: (34) head
1318 |
1318 |
1319 | o changeset: 33:68608f5145f9
1319 | o changeset: 33:68608f5145f9
1320 | | parent: 18:1aa84d96232a
1320 | | parent: 18:1aa84d96232a
1321 | ~ user: test
1321 | ~ user: test
1322 | date: Thu Jan 01 00:00:33 1970 +0000
1322 | date: Thu Jan 01 00:00:33 1970 +0000
1323 | summary: (33) head
1323 | summary: (33) head
1324 |
1324 |
1325 o changeset: 32:d06dffa21a31
1325 o changeset: 32:d06dffa21a31
1326 |\ parent: 27:886ed638191b
1326 |\ parent: 27:886ed638191b
1327 ~ ~ parent: 31:621d83e11f67
1327 ~ ~ parent: 31:621d83e11f67
1328 user: test
1328 user: test
1329 date: Thu Jan 01 00:00:32 1970 +0000
1329 date: Thu Jan 01 00:00:32 1970 +0000
1330 summary: (32) expand
1330 summary: (32) expand
1331
1331
1332
1332
1333 Point out a common and an uncommon unshown parent
1333 Point out a common and an uncommon unshown parent
1334
1334
1335 $ hg log -G -r 'rev(8) or rev(9)'
1335 $ hg log -G -r 'rev(8) or rev(9)'
1336 o changeset: 9:7010c0af0a35
1336 o changeset: 9:7010c0af0a35
1337 |\ parent: 7:b632bb1b1224
1337 |\ parent: 7:b632bb1b1224
1338 | ~ parent: 8:7a0b11f71937
1338 | ~ parent: 8:7a0b11f71937
1339 | user: test
1339 | user: test
1340 | date: Thu Jan 01 00:00:09 1970 +0000
1340 | date: Thu Jan 01 00:00:09 1970 +0000
1341 | summary: (9) expand
1341 | summary: (9) expand
1342 |
1342 |
1343 o changeset: 8:7a0b11f71937
1343 o changeset: 8:7a0b11f71937
1344 |\ parent: 0:e6eb3150255d
1344 |\ parent: 0:e6eb3150255d
1345 ~ ~ parent: 7:b632bb1b1224
1345 ~ ~ parent: 7:b632bb1b1224
1346 user: test
1346 user: test
1347 date: Thu Jan 01 00:00:08 1970 +0000
1347 date: Thu Jan 01 00:00:08 1970 +0000
1348 summary: (8) merge two known; one immediate left, one far right
1348 summary: (8) merge two known; one immediate left, one far right
1349
1349
1350
1350
1351 File + limit + -ra:b, b < tip:
1351 File + limit + -ra:b, b < tip:
1352
1352
1353 $ hg log -G -l1 -r32:34 a
1353 $ hg log -G -l1 -r32:34 a
1354 o changeset: 34:fea3ac5810e0
1354 o changeset: 34:fea3ac5810e0
1355 | parent: 32:d06dffa21a31
1355 | parent: 32:d06dffa21a31
1356 ~ user: test
1356 ~ user: test
1357 date: Thu Jan 01 00:00:34 1970 +0000
1357 date: Thu Jan 01 00:00:34 1970 +0000
1358 summary: (34) head
1358 summary: (34) head
1359
1359
1360
1360
1361 file(File) + limit + -ra:b, b < tip:
1361 file(File) + limit + -ra:b, b < tip:
1362
1362
1363 $ hg log -G -l1 -r32:34 -r 'file("a")'
1363 $ hg log -G -l1 -r32:34 -r 'file("a")'
1364 o changeset: 34:fea3ac5810e0
1364 o changeset: 34:fea3ac5810e0
1365 | parent: 32:d06dffa21a31
1365 | parent: 32:d06dffa21a31
1366 ~ user: test
1366 ~ user: test
1367 date: Thu Jan 01 00:00:34 1970 +0000
1367 date: Thu Jan 01 00:00:34 1970 +0000
1368 summary: (34) head
1368 summary: (34) head
1369
1369
1370
1370
1371 limit(file(File) and a::b), b < tip:
1371 limit(file(File) and a::b), b < tip:
1372
1372
1373 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1373 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1374 o changeset: 32:d06dffa21a31
1374 o changeset: 32:d06dffa21a31
1375 |\ parent: 27:886ed638191b
1375 |\ parent: 27:886ed638191b
1376 ~ ~ parent: 31:621d83e11f67
1376 ~ ~ parent: 31:621d83e11f67
1377 user: test
1377 user: test
1378 date: Thu Jan 01 00:00:32 1970 +0000
1378 date: Thu Jan 01 00:00:32 1970 +0000
1379 summary: (32) expand
1379 summary: (32) expand
1380
1380
1381
1381
1382 File + limit + -ra:b, b < tip:
1382 File + limit + -ra:b, b < tip:
1383
1383
1384 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1384 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1385
1385
1386 File + limit + -ra:b, b < tip, (b - a) < limit:
1386 File + limit + -ra:b, b < tip, (b - a) < limit:
1387
1387
1388 $ hg log -G -l10 -r33:34 a
1388 $ hg log -G -l10 -r33:34 a
1389 o changeset: 34:fea3ac5810e0
1389 o changeset: 34:fea3ac5810e0
1390 | parent: 32:d06dffa21a31
1390 | parent: 32:d06dffa21a31
1391 ~ user: test
1391 ~ user: test
1392 date: Thu Jan 01 00:00:34 1970 +0000
1392 date: Thu Jan 01 00:00:34 1970 +0000
1393 summary: (34) head
1393 summary: (34) head
1394
1394
1395 o changeset: 33:68608f5145f9
1395 o changeset: 33:68608f5145f9
1396 | parent: 18:1aa84d96232a
1396 | parent: 18:1aa84d96232a
1397 ~ user: test
1397 ~ user: test
1398 date: Thu Jan 01 00:00:33 1970 +0000
1398 date: Thu Jan 01 00:00:33 1970 +0000
1399 summary: (33) head
1399 summary: (33) head
1400
1400
1401
1401
1402 Do not crash or produce strange graphs if history is buggy
1402 Do not crash or produce strange graphs if history is buggy
1403
1403
1404 $ hg branch branch
1404 $ hg branch branch
1405 marked working directory as branch branch
1405 marked working directory as branch branch
1406 (branches are permanent and global, did you want a bookmark?)
1406 (branches are permanent and global, did you want a bookmark?)
1407 $ commit 36 "buggy merge: identical parents" 35 35
1407 $ commit 36 "buggy merge: identical parents" 35 35
1408 $ hg log -G -l5
1408 $ hg log -G -l5
1409 @ changeset: 36:08a19a744424
1409 @ changeset: 36:08a19a744424
1410 | branch: branch
1410 | branch: branch
1411 | tag: tip
1411 | tag: tip
1412 | parent: 35:9159c3644c5e
1412 | parent: 35:9159c3644c5e
1413 | parent: 35:9159c3644c5e
1413 | parent: 35:9159c3644c5e
1414 | user: test
1414 | user: test
1415 | date: Thu Jan 01 00:00:36 1970 +0000
1415 | date: Thu Jan 01 00:00:36 1970 +0000
1416 | summary: (36) buggy merge: identical parents
1416 | summary: (36) buggy merge: identical parents
1417 |
1417 |
1418 o changeset: 35:9159c3644c5e
1418 o changeset: 35:9159c3644c5e
1419 | user: test
1419 | user: test
1420 | date: Thu Jan 01 00:00:00 1970 +0000
1420 | date: Thu Jan 01 00:00:00 1970 +0000
1421 | summary: 0
1421 | summary: 0
1422 |
1422 |
1423 o changeset: 34:fea3ac5810e0
1423 o changeset: 34:fea3ac5810e0
1424 | parent: 32:d06dffa21a31
1424 | parent: 32:d06dffa21a31
1425 | user: test
1425 | user: test
1426 | date: Thu Jan 01 00:00:34 1970 +0000
1426 | date: Thu Jan 01 00:00:34 1970 +0000
1427 | summary: (34) head
1427 | summary: (34) head
1428 |
1428 |
1429 | o changeset: 33:68608f5145f9
1429 | o changeset: 33:68608f5145f9
1430 | | parent: 18:1aa84d96232a
1430 | | parent: 18:1aa84d96232a
1431 | ~ user: test
1431 | ~ user: test
1432 | date: Thu Jan 01 00:00:33 1970 +0000
1432 | date: Thu Jan 01 00:00:33 1970 +0000
1433 | summary: (33) head
1433 | summary: (33) head
1434 |
1434 |
1435 o changeset: 32:d06dffa21a31
1435 o changeset: 32:d06dffa21a31
1436 |\ parent: 27:886ed638191b
1436 |\ parent: 27:886ed638191b
1437 ~ ~ parent: 31:621d83e11f67
1437 ~ ~ parent: 31:621d83e11f67
1438 user: test
1438 user: test
1439 date: Thu Jan 01 00:00:32 1970 +0000
1439 date: Thu Jan 01 00:00:32 1970 +0000
1440 summary: (32) expand
1440 summary: (32) expand
1441
1441
1442
1442
1443 Test log -G options
1443 Test log -G options
1444
1444
1445 $ testlog() {
1445 $ testlog() {
1446 > hg log -G --print-revset "$@"
1446 > hg log -G --print-revset "$@"
1447 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1447 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1448 > | sed 's/.*nodetag/nodetag/' > log.nodes
1448 > | sed 's/.*nodetag/nodetag/' > log.nodes
1449 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1449 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1450 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1450 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1451 > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \
1451 > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \
1452 > | grep '^[-+@ ]' || :
1452 > | grep '^[-+@ ]' || :
1453 > }
1453 > }
1454
1454
1455 glog always reorders nodes which explains the difference with log
1455 glog always reorders nodes which explains the difference with log
1456
1456
1457 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1457 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1458 ['27', '25', '21', '34', '32', '31']
1458 ['27', '25', '21', '34', '32', '31']
1459 []
1459 []
1460 <baseset- [21, 25, 27, 31, 32, 34]>
1460 <baseset- [21, 25, 27, 31, 32, 34]>
1461 --- log.nodes * (glob)
1461 --- log.nodes * (glob)
1462 +++ glog.nodes * (glob)
1462 +++ glog.nodes * (glob)
1463 @@ -1,6 +1,6 @@
1463 @@ -1,6 +1,6 @@
1464 -nodetag 27
1464 -nodetag 27
1465 -nodetag 25
1465 -nodetag 25
1466 -nodetag 21
1466 -nodetag 21
1467 nodetag 34
1467 nodetag 34
1468 nodetag 32
1468 nodetag 32
1469 nodetag 31
1469 nodetag 31
1470 +nodetag 27
1470 +nodetag 27
1471 +nodetag 25
1471 +nodetag 25
1472 +nodetag 21
1472 +nodetag 21
1473 $ testlog -u test -u not-a-user
1473 $ testlog -u test -u not-a-user
1474 []
1474 []
1475 (or
1475 (or
1476 (list
1476 (list
1477 (func
1477 (func
1478 (symbol 'user')
1478 (symbol 'user')
1479 (string 'test'))
1479 (string 'test'))
1480 (func
1480 (func
1481 (symbol 'user')
1481 (symbol 'user')
1482 (string 'not-a-user'))))
1482 (string 'not-a-user'))))
1483 <filteredset
1483 <filteredset
1484 <spanset- 0:37>,
1484 <spanset- 0:37>,
1485 <addset
1485 <addset
1486 <filteredset
1486 <filteredset
1487 <fullreposet+ 0:37>,
1487 <fullreposet+ 0:37>,
1488 <user 'test'>>,
1488 <user 'test'>>,
1489 <filteredset
1489 <filteredset
1490 <fullreposet+ 0:37>,
1490 <fullreposet+ 0:37>,
1491 <user 'not-a-user'>>>>
1491 <user 'not-a-user'>>>>
1492 $ testlog -b not-a-branch
1492 $ testlog -b not-a-branch
1493 abort: unknown revision 'not-a-branch'!
1493 abort: unknown revision '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 $ testlog -b 35 -b 36 --only-branch branch
1496 $ testlog -b 35 -b 36 --only-branch branch
1497 []
1497 []
1498 (or
1498 (or
1499 (list
1499 (list
1500 (func
1500 (func
1501 (symbol 'branch')
1501 (symbol 'branch')
1502 (string 'default'))
1502 (string 'default'))
1503 (func
1503 (func
1504 (symbol 'branch')
1504 (symbol 'branch')
1505 (string 'branch'))
1505 (string 'branch'))
1506 (func
1506 (func
1507 (symbol 'branch')
1507 (symbol 'branch')
1508 (string 'branch'))))
1508 (string 'branch'))))
1509 <filteredset
1509 <filteredset
1510 <spanset- 0:37>,
1510 <spanset- 0:37>,
1511 <addset
1511 <addset
1512 <filteredset
1512 <filteredset
1513 <fullreposet+ 0:37>,
1513 <fullreposet+ 0:37>,
1514 <branch 'default'>>,
1514 <branch 'default'>>,
1515 <addset
1515 <addset
1516 <filteredset
1516 <filteredset
1517 <fullreposet+ 0:37>,
1517 <fullreposet+ 0:37>,
1518 <branch 'branch'>>,
1518 <branch 'branch'>>,
1519 <filteredset
1519 <filteredset
1520 <fullreposet+ 0:37>,
1520 <fullreposet+ 0:37>,
1521 <branch 'branch'>>>>>
1521 <branch 'branch'>>>>>
1522 $ testlog -k expand -k merge
1522 $ testlog -k expand -k merge
1523 []
1523 []
1524 (or
1524 (or
1525 (list
1525 (list
1526 (func
1526 (func
1527 (symbol 'keyword')
1527 (symbol 'keyword')
1528 (string 'expand'))
1528 (string 'expand'))
1529 (func
1529 (func
1530 (symbol 'keyword')
1530 (symbol 'keyword')
1531 (string 'merge'))))
1531 (string 'merge'))))
1532 <filteredset
1532 <filteredset
1533 <spanset- 0:37>,
1533 <spanset- 0:37>,
1534 <addset
1534 <addset
1535 <filteredset
1535 <filteredset
1536 <fullreposet+ 0:37>,
1536 <fullreposet+ 0:37>,
1537 <keyword 'expand'>>,
1537 <keyword 'expand'>>,
1538 <filteredset
1538 <filteredset
1539 <fullreposet+ 0:37>,
1539 <fullreposet+ 0:37>,
1540 <keyword 'merge'>>>>
1540 <keyword 'merge'>>>>
1541 $ testlog --only-merges
1541 $ testlog --only-merges
1542 []
1542 []
1543 (func
1543 (func
1544 (symbol 'merge')
1544 (symbol 'merge')
1545 None)
1545 None)
1546 <filteredset
1546 <filteredset
1547 <spanset- 0:37>,
1547 <spanset- 0:37>,
1548 <merge>>
1548 <merge>>
1549 $ testlog --no-merges
1549 $ testlog --no-merges
1550 []
1550 []
1551 (not
1551 (not
1552 (func
1552 (func
1553 (symbol 'merge')
1553 (symbol 'merge')
1554 None))
1554 None))
1555 <filteredset
1555 <filteredset
1556 <spanset- 0:37>,
1556 <spanset- 0:37>,
1557 <not
1557 <not
1558 <filteredset
1558 <filteredset
1559 <spanset- 0:37>,
1559 <spanset- 0:37>,
1560 <merge>>>>
1560 <merge>>>>
1561 $ testlog --date '2 0 to 4 0'
1561 $ testlog --date '2 0 to 4 0'
1562 []
1562 []
1563 (func
1563 (func
1564 (symbol 'date')
1564 (symbol 'date')
1565 (string '2 0 to 4 0'))
1565 (string '2 0 to 4 0'))
1566 <filteredset
1566 <filteredset
1567 <spanset- 0:37>,
1567 <spanset- 0:37>,
1568 <date '2 0 to 4 0'>>
1568 <date '2 0 to 4 0'>>
1569 $ hg log -G -d 'brace ) in a date'
1569 $ hg log -G -d 'brace ) in a date'
1570 hg: parse error: invalid date: 'brace ) in a date'
1570 hg: parse error: invalid date: 'brace ) in a date'
1571 [255]
1571 [255]
1572 $ testlog --prune 31 --prune 32
1572 $ testlog --prune 31 --prune 32
1573 []
1573 []
1574 (and
1574 (and
1575 (not
1575 (not
1576 (or
1576 (func
1577 (list
1577 (symbol 'ancestors')
1578 (string '31')
1578 (string '31')))
1579 (func
1580 (symbol 'ancestors')
1581 (string '31')))))
1582 (not
1579 (not
1583 (or
1580 (func
1584 (list
1581 (symbol 'ancestors')
1585 (string '32')
1582 (string '32'))))
1586 (func
1587 (symbol 'ancestors')
1588 (string '32'))))))
1589 <filteredset
1583 <filteredset
1590 <filteredset
1584 <filteredset
1591 <spanset- 0:37>,
1585 <spanset- 0:37>,
1592 <not
1586 <not
1593 <addset
1594 <baseset [31]>,
1595 <filteredset
1596 <spanset- 0:37>,
1597 <generatorsetdesc+>>>>>,
1598 <not
1599 <addset
1600 <baseset [32]>,
1601 <filteredset
1587 <filteredset
1602 <spanset- 0:37>,
1588 <spanset- 0:37>,
1603 <generatorsetdesc+>>>>>
1589 <generatorsetdesc+>>>>,
1590 <not
1591 <filteredset
1592 <spanset- 0:37>,
1593 <generatorsetdesc+>>>>
1604
1594
1605 Dedicated repo for --follow and paths filtering. The g is crafted to
1595 Dedicated repo for --follow and paths filtering. The g is crafted to
1606 have 2 filelog topological heads in a linear changeset graph.
1596 have 2 filelog topological heads in a linear changeset graph.
1607
1597
1608 $ cd ..
1598 $ cd ..
1609 $ hg init follow
1599 $ hg init follow
1610 $ cd follow
1600 $ cd follow
1611 $ testlog --follow
1601 $ testlog --follow
1612 []
1602 []
1613 []
1603 []
1614 <baseset []>
1604 <baseset []>
1615 $ testlog -rnull
1605 $ testlog -rnull
1616 ['null']
1606 ['null']
1617 []
1607 []
1618 <baseset [-1]>
1608 <baseset [-1]>
1619 $ echo a > a
1609 $ echo a > a
1620 $ echo aa > aa
1610 $ echo aa > aa
1621 $ echo f > f
1611 $ echo f > f
1622 $ hg ci -Am "add a" a aa f
1612 $ hg ci -Am "add a" a aa f
1623 $ hg cp a b
1613 $ hg cp a b
1624 $ hg cp f g
1614 $ hg cp f g
1625 $ hg ci -m "copy a b"
1615 $ hg ci -m "copy a b"
1626 $ mkdir dir
1616 $ mkdir dir
1627 $ hg mv b dir
1617 $ hg mv b dir
1628 $ echo g >> g
1618 $ echo g >> g
1629 $ echo f >> f
1619 $ echo f >> f
1630 $ hg ci -m "mv b dir/b"
1620 $ hg ci -m "mv b dir/b"
1631 $ hg mv a b
1621 $ hg mv a b
1632 $ hg cp -f f g
1622 $ hg cp -f f g
1633 $ echo a > d
1623 $ echo a > d
1634 $ hg add d
1624 $ hg add d
1635 $ hg ci -m "mv a b; add d"
1625 $ hg ci -m "mv a b; add d"
1636 $ hg mv dir/b e
1626 $ hg mv dir/b e
1637 $ hg ci -m "mv dir/b e"
1627 $ hg ci -m "mv dir/b e"
1638 $ hg log -G --template '({rev}) {desc|firstline}\n'
1628 $ hg log -G --template '({rev}) {desc|firstline}\n'
1639 @ (4) mv dir/b e
1629 @ (4) mv dir/b e
1640 |
1630 |
1641 o (3) mv a b; add d
1631 o (3) mv a b; add d
1642 |
1632 |
1643 o (2) mv b dir/b
1633 o (2) mv b dir/b
1644 |
1634 |
1645 o (1) copy a b
1635 o (1) copy a b
1646 |
1636 |
1647 o (0) add a
1637 o (0) add a
1648
1638
1649
1639
1650 $ testlog a
1640 $ testlog a
1651 []
1641 []
1652 (func
1642 (func
1653 (symbol 'filelog')
1643 (symbol 'filelog')
1654 (string 'a'))
1644 (string 'a'))
1655 <filteredset
1645 <filteredset
1656 <spanset- 0:5>, set([0])>
1646 <spanset- 0:5>, set([0])>
1657 $ testlog a b
1647 $ testlog a b
1658 []
1648 []
1659 (or
1649 (or
1660 (list
1650 (list
1661 (func
1651 (func
1662 (symbol 'filelog')
1652 (symbol 'filelog')
1663 (string 'a'))
1653 (string 'a'))
1664 (func
1654 (func
1665 (symbol 'filelog')
1655 (symbol 'filelog')
1666 (string 'b'))))
1656 (string 'b'))))
1667 <filteredset
1657 <filteredset
1668 <spanset- 0:5>,
1658 <spanset- 0:5>,
1669 <addset
1659 <addset
1670 <baseset+ [0]>,
1660 <baseset+ [0]>,
1671 <baseset+ [1]>>>
1661 <baseset+ [1]>>>
1672
1662
1673 Test falling back to slow path for non-existing files
1663 Test falling back to slow path for non-existing files
1674
1664
1675 $ testlog a c
1665 $ testlog a c
1676 []
1666 []
1677 (func
1667 (func
1678 (symbol '_matchfiles')
1668 (symbol '_matchfiles')
1679 (list
1669 (list
1680 (string 'r:')
1670 (string 'r:')
1681 (string 'd:relpath')
1671 (string 'd:relpath')
1682 (string 'p:a')
1672 (string 'p:a')
1683 (string 'p:c')))
1673 (string 'p:c')))
1684 <filteredset
1674 <filteredset
1685 <spanset- 0:5>,
1675 <spanset- 0:5>,
1686 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=None>>
1676 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=None>>
1687
1677
1688 Test multiple --include/--exclude/paths
1678 Test multiple --include/--exclude/paths
1689
1679
1690 $ testlog --include a --include e --exclude b --exclude e a e
1680 $ testlog --include a --include e --exclude b --exclude e a e
1691 []
1681 []
1692 (func
1682 (func
1693 (symbol '_matchfiles')
1683 (symbol '_matchfiles')
1694 (list
1684 (list
1695 (string 'r:')
1685 (string 'r:')
1696 (string 'd:relpath')
1686 (string 'd:relpath')
1697 (string 'p:a')
1687 (string 'p:a')
1698 (string 'p:e')
1688 (string 'p:e')
1699 (string 'i:a')
1689 (string 'i:a')
1700 (string 'i:e')
1690 (string 'i:e')
1701 (string 'x:b')
1691 (string 'x:b')
1702 (string 'x:e')))
1692 (string 'x:e')))
1703 <filteredset
1693 <filteredset
1704 <spanset- 0:5>,
1694 <spanset- 0:5>,
1705 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=None>>
1695 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=None>>
1706
1696
1707 Test glob expansion of pats
1697 Test glob expansion of pats
1708
1698
1709 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1699 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1710 > print(mercurial.util.expandglobs and 'true' or 'false')"`
1700 > print(mercurial.util.expandglobs and 'true' or 'false')"`
1711 $ if [ $expandglobs = "true" ]; then
1701 $ if [ $expandglobs = "true" ]; then
1712 > testlog 'a*';
1702 > testlog 'a*';
1713 > else
1703 > else
1714 > testlog a*;
1704 > testlog a*;
1715 > fi;
1705 > fi;
1716 []
1706 []
1717 (func
1707 (func
1718 (symbol 'filelog')
1708 (symbol 'filelog')
1719 (string 'aa'))
1709 (string 'aa'))
1720 <filteredset
1710 <filteredset
1721 <spanset- 0:5>, set([0])>
1711 <spanset- 0:5>, set([0])>
1722
1712
1723 Test --follow on a non-existent directory
1713 Test --follow on a non-existent directory
1724
1714
1725 $ testlog -f dir
1715 $ testlog -f dir
1726 abort: cannot follow file not in parent revision: "dir"
1716 abort: cannot follow file not in parent revision: "dir"
1727 abort: cannot follow file not in parent revision: "dir"
1717 abort: cannot follow file not in parent revision: "dir"
1728 abort: cannot follow file not in parent revision: "dir"
1718 abort: cannot follow file not in parent revision: "dir"
1729
1719
1730 Test --follow on a directory
1720 Test --follow on a directory
1731
1721
1732 $ hg up -q '.^'
1722 $ hg up -q '.^'
1733 $ testlog -f dir
1723 $ testlog -f dir
1734 []
1724 []
1735 (and
1725 (and
1736 (func
1726 (func
1737 (symbol 'ancestors')
1727 (symbol 'ancestors')
1738 (symbol '.'))
1728 (symbol '.'))
1739 (func
1729 (func
1740 (symbol '_matchfiles')
1730 (symbol '_matchfiles')
1741 (list
1731 (list
1742 (string 'r:')
1732 (string 'r:')
1743 (string 'd:relpath')
1733 (string 'd:relpath')
1744 (string 'p:dir'))))
1734 (string 'p:dir'))))
1745 <filteredset
1735 <filteredset
1746 <filteredset
1736 <filteredset
1747 <spanset- 0:4>,
1737 <spanset- 0:4>,
1748 <generatorsetdesc+>>,
1738 <generatorsetdesc+>>,
1749 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=None>>
1739 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=None>>
1750 $ hg up -q tip
1740 $ hg up -q tip
1751
1741
1752 Test --follow on file not in parent revision
1742 Test --follow on file not in parent revision
1753
1743
1754 $ testlog -f a
1744 $ testlog -f a
1755 abort: cannot follow file not in parent revision: "a"
1745 abort: cannot follow file not in parent revision: "a"
1756 abort: cannot follow file not in parent revision: "a"
1746 abort: cannot follow file not in parent revision: "a"
1757 abort: cannot follow file not in parent revision: "a"
1747 abort: cannot follow file not in parent revision: "a"
1758
1748
1759 Test --follow and patterns
1749 Test --follow and patterns
1760
1750
1761 $ testlog -f 'glob:*'
1751 $ testlog -f 'glob:*'
1762 []
1752 []
1763 (and
1753 (and
1764 (func
1754 (func
1765 (symbol 'ancestors')
1755 (symbol 'ancestors')
1766 (symbol '.'))
1756 (symbol '.'))
1767 (func
1757 (func
1768 (symbol '_matchfiles')
1758 (symbol '_matchfiles')
1769 (list
1759 (list
1770 (string 'r:')
1760 (string 'r:')
1771 (string 'd:relpath')
1761 (string 'd:relpath')
1772 (string 'p:glob:*'))))
1762 (string 'p:glob:*'))))
1773 <filteredset
1763 <filteredset
1774 <filteredset
1764 <filteredset
1775 <spanset- 0:5>,
1765 <spanset- 0:5>,
1776 <generatorsetdesc+>>,
1766 <generatorsetdesc+>>,
1777 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=None>>
1767 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=None>>
1778
1768
1779 Test --follow on a single rename
1769 Test --follow on a single rename
1780
1770
1781 $ hg up -q 2
1771 $ hg up -q 2
1782 $ testlog -f a
1772 $ testlog -f a
1783 []
1773 []
1784 (func
1774 (func
1785 (symbol 'follow')
1775 (symbol 'follow')
1786 (string 'a'))
1776 (string 'a'))
1787 <filteredset
1777 <filteredset
1788 <spanset- 0:3>,
1778 <spanset- 0:3>,
1789 <generatorsetdesc+>>
1779 <generatorsetdesc+>>
1790
1780
1791 Test --follow and multiple renames
1781 Test --follow and multiple renames
1792
1782
1793 $ hg up -q tip
1783 $ hg up -q tip
1794 $ testlog -f e
1784 $ testlog -f e
1795 []
1785 []
1796 (func
1786 (func
1797 (symbol 'follow')
1787 (symbol 'follow')
1798 (string 'e'))
1788 (string 'e'))
1799 <filteredset
1789 <filteredset
1800 <spanset- 0:5>,
1790 <spanset- 0:5>,
1801 <generatorsetdesc+>>
1791 <generatorsetdesc+>>
1802
1792
1803 Test --follow and multiple filelog heads
1793 Test --follow and multiple filelog heads
1804
1794
1805 $ hg up -q 2
1795 $ hg up -q 2
1806 $ testlog -f g
1796 $ testlog -f g
1807 []
1797 []
1808 (func
1798 (func
1809 (symbol 'follow')
1799 (symbol 'follow')
1810 (string 'g'))
1800 (string 'g'))
1811 <filteredset
1801 <filteredset
1812 <spanset- 0:3>,
1802 <spanset- 0:3>,
1813 <generatorsetdesc+>>
1803 <generatorsetdesc+>>
1814 $ cat log.nodes
1804 $ cat log.nodes
1815 nodetag 2
1805 nodetag 2
1816 nodetag 1
1806 nodetag 1
1817 nodetag 0
1807 nodetag 0
1818 $ hg up -q tip
1808 $ hg up -q tip
1819 $ testlog -f g
1809 $ testlog -f g
1820 []
1810 []
1821 (func
1811 (func
1822 (symbol 'follow')
1812 (symbol 'follow')
1823 (string 'g'))
1813 (string 'g'))
1824 <filteredset
1814 <filteredset
1825 <spanset- 0:5>,
1815 <spanset- 0:5>,
1826 <generatorsetdesc+>>
1816 <generatorsetdesc+>>
1827 $ cat log.nodes
1817 $ cat log.nodes
1828 nodetag 3
1818 nodetag 3
1829 nodetag 2
1819 nodetag 2
1830 nodetag 0
1820 nodetag 0
1831
1821
1832 Test --follow and multiple files
1822 Test --follow and multiple files
1833
1823
1834 $ testlog -f g e
1824 $ testlog -f g e
1835 []
1825 []
1836 (or
1826 (or
1837 (list
1827 (list
1838 (func
1828 (func
1839 (symbol 'follow')
1829 (symbol 'follow')
1840 (string 'g'))
1830 (string 'g'))
1841 (func
1831 (func
1842 (symbol 'follow')
1832 (symbol 'follow')
1843 (string 'e'))))
1833 (string 'e'))))
1844 <filteredset
1834 <filteredset
1845 <spanset- 0:5>,
1835 <spanset- 0:5>,
1846 <addset
1836 <addset
1847 <generatorsetdesc+>,
1837 <generatorsetdesc+>,
1848 <generatorsetdesc+>>>
1838 <generatorsetdesc+>>>
1849 $ cat log.nodes
1839 $ cat log.nodes
1850 nodetag 4
1840 nodetag 4
1851 nodetag 3
1841 nodetag 3
1852 nodetag 2
1842 nodetag 2
1853 nodetag 1
1843 nodetag 1
1854 nodetag 0
1844 nodetag 0
1855
1845
1856 Test --follow null parent
1846 Test --follow null parent
1857
1847
1858 $ hg up -q null
1848 $ hg up -q null
1859 $ testlog -f
1849 $ testlog -f
1860 []
1850 []
1861 []
1851 []
1862 <baseset []>
1852 <baseset []>
1863
1853
1864 Test --follow-first
1854 Test --follow-first
1865
1855
1866 $ hg up -q 3
1856 $ hg up -q 3
1867 $ echo ee > e
1857 $ echo ee > e
1868 $ hg ci -Am "add another e" e
1858 $ hg ci -Am "add another e" e
1869 created new head
1859 created new head
1870 $ hg merge --tool internal:other 4
1860 $ hg merge --tool internal:other 4
1871 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1861 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1872 (branch merge, don't forget to commit)
1862 (branch merge, don't forget to commit)
1873 $ echo merge > e
1863 $ echo merge > e
1874 $ hg ci -m "merge 5 and 4"
1864 $ hg ci -m "merge 5 and 4"
1875 $ testlog --follow-first
1865 $ testlog --follow-first
1876 []
1866 []
1877 (func
1867 (func
1878 (symbol '_firstancestors')
1868 (symbol '_firstancestors')
1879 (func
1869 (func
1880 (symbol 'rev')
1870 (symbol 'rev')
1881 (symbol '6')))
1871 (symbol '6')))
1882 <filteredset
1872 <filteredset
1883 <spanset- 0:7>,
1873 <spanset- 0:7>,
1884 <generatorsetdesc+>>
1874 <generatorsetdesc+>>
1885
1875
1886 Cannot compare with log --follow-first FILE as it never worked
1876 Cannot compare with log --follow-first FILE as it never worked
1887
1877
1888 $ hg log -G --print-revset --follow-first e
1878 $ hg log -G --print-revset --follow-first e
1889 []
1879 []
1890 (func
1880 (func
1891 (symbol '_followfirst')
1881 (symbol '_followfirst')
1892 (string 'e'))
1882 (string 'e'))
1893 <filteredset
1883 <filteredset
1894 <spanset- 0:7>,
1884 <spanset- 0:7>,
1895 <generatorsetdesc+>>
1885 <generatorsetdesc+>>
1896 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1886 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1897 @ 6 merge 5 and 4
1887 @ 6 merge 5 and 4
1898 |\
1888 |\
1899 | ~
1889 | ~
1900 o 5 add another e
1890 o 5 add another e
1901 |
1891 |
1902 ~
1892 ~
1903
1893
1904 Test --copies
1894 Test --copies
1905
1895
1906 $ hg log -G --copies --template "{rev} {desc|firstline} \
1896 $ hg log -G --copies --template "{rev} {desc|firstline} \
1907 > copies: {file_copies_switch}\n"
1897 > copies: {file_copies_switch}\n"
1908 @ 6 merge 5 and 4 copies:
1898 @ 6 merge 5 and 4 copies:
1909 |\
1899 |\
1910 | o 5 add another e copies:
1900 | o 5 add another e copies:
1911 | |
1901 | |
1912 o | 4 mv dir/b e copies: e (dir/b)
1902 o | 4 mv dir/b e copies: e (dir/b)
1913 |/
1903 |/
1914 o 3 mv a b; add d copies: b (a)g (f)
1904 o 3 mv a b; add d copies: b (a)g (f)
1915 |
1905 |
1916 o 2 mv b dir/b copies: dir/b (b)
1906 o 2 mv b dir/b copies: dir/b (b)
1917 |
1907 |
1918 o 1 copy a b copies: b (a)g (f)
1908 o 1 copy a b copies: b (a)g (f)
1919 |
1909 |
1920 o 0 add a copies:
1910 o 0 add a copies:
1921
1911
1922 Test "set:..." and parent revision
1912 Test "set:..." and parent revision
1923
1913
1924 $ hg up -q 4
1914 $ hg up -q 4
1925 $ testlog "set:copied()"
1915 $ testlog "set:copied()"
1926 []
1916 []
1927 (func
1917 (func
1928 (symbol '_matchfiles')
1918 (symbol '_matchfiles')
1929 (list
1919 (list
1930 (string 'r:')
1920 (string 'r:')
1931 (string 'd:relpath')
1921 (string 'd:relpath')
1932 (string 'p:set:copied()')))
1922 (string 'p:set:copied()')))
1933 <filteredset
1923 <filteredset
1934 <spanset- 0:7>,
1924 <spanset- 0:7>,
1935 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=None>>
1925 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=None>>
1936 $ testlog --include "set:copied()"
1926 $ testlog --include "set:copied()"
1937 []
1927 []
1938 (func
1928 (func
1939 (symbol '_matchfiles')
1929 (symbol '_matchfiles')
1940 (list
1930 (list
1941 (string 'r:')
1931 (string 'r:')
1942 (string 'd:relpath')
1932 (string 'd:relpath')
1943 (string 'i:set:copied()')))
1933 (string 'i:set:copied()')))
1944 <filteredset
1934 <filteredset
1945 <spanset- 0:7>,
1935 <spanset- 0:7>,
1946 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=None>>
1936 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=None>>
1947 $ testlog -r "sort(file('set:copied()'), -rev)"
1937 $ testlog -r "sort(file('set:copied()'), -rev)"
1948 ["sort(file('set:copied()'), -rev)"]
1938 ["sort(file('set:copied()'), -rev)"]
1949 []
1939 []
1950 <baseset []>
1940 <baseset []>
1951
1941
1952 Test --removed
1942 Test --removed
1953
1943
1954 $ testlog --removed
1944 $ testlog --removed
1955 []
1945 []
1956 []
1946 []
1957 <spanset- 0:7>
1947 <spanset- 0:7>
1958 $ testlog --removed a
1948 $ testlog --removed a
1959 []
1949 []
1960 (func
1950 (func
1961 (symbol '_matchfiles')
1951 (symbol '_matchfiles')
1962 (list
1952 (list
1963 (string 'r:')
1953 (string 'r:')
1964 (string 'd:relpath')
1954 (string 'd:relpath')
1965 (string 'p:a')))
1955 (string 'p:a')))
1966 <filteredset
1956 <filteredset
1967 <spanset- 0:7>,
1957 <spanset- 0:7>,
1968 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1958 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1969 $ testlog --removed --follow a
1959 $ testlog --removed --follow a
1970 []
1960 []
1971 (and
1961 (and
1972 (func
1962 (func
1973 (symbol 'ancestors')
1963 (symbol 'ancestors')
1974 (symbol '.'))
1964 (symbol '.'))
1975 (func
1965 (func
1976 (symbol '_matchfiles')
1966 (symbol '_matchfiles')
1977 (list
1967 (list
1978 (string 'r:')
1968 (string 'r:')
1979 (string 'd:relpath')
1969 (string 'd:relpath')
1980 (string 'p:a'))))
1970 (string 'p:a'))))
1981 <filteredset
1971 <filteredset
1982 <filteredset
1972 <filteredset
1983 <spanset- 0:5>,
1973 <spanset- 0:5>,
1984 <generatorsetdesc+>>,
1974 <generatorsetdesc+>>,
1985 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1975 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1986
1976
1987 Test --patch and --stat with --follow and --follow-first
1977 Test --patch and --stat with --follow and --follow-first
1988
1978
1989 $ hg up -q 3
1979 $ hg up -q 3
1990 $ hg log -G --git --patch b
1980 $ hg log -G --git --patch b
1991 o changeset: 1:216d4c92cf98
1981 o changeset: 1:216d4c92cf98
1992 | user: test
1982 | user: test
1993 ~ date: Thu Jan 01 00:00:00 1970 +0000
1983 ~ date: Thu Jan 01 00:00:00 1970 +0000
1994 summary: copy a b
1984 summary: copy a b
1995
1985
1996 diff --git a/a b/b
1986 diff --git a/a b/b
1997 copy from a
1987 copy from a
1998 copy to b
1988 copy to b
1999
1989
2000
1990
2001 $ hg log -G --git --stat b
1991 $ hg log -G --git --stat b
2002 o changeset: 1:216d4c92cf98
1992 o changeset: 1:216d4c92cf98
2003 | user: test
1993 | user: test
2004 ~ date: Thu Jan 01 00:00:00 1970 +0000
1994 ~ date: Thu Jan 01 00:00:00 1970 +0000
2005 summary: copy a b
1995 summary: copy a b
2006
1996
2007 b | 0
1997 b | 0
2008 1 files changed, 0 insertions(+), 0 deletions(-)
1998 1 files changed, 0 insertions(+), 0 deletions(-)
2009
1999
2010
2000
2011 $ hg log -G --git --patch --follow b
2001 $ hg log -G --git --patch --follow b
2012 o changeset: 1:216d4c92cf98
2002 o changeset: 1:216d4c92cf98
2013 | user: test
2003 | user: test
2014 | date: Thu Jan 01 00:00:00 1970 +0000
2004 | date: Thu Jan 01 00:00:00 1970 +0000
2015 | summary: copy a b
2005 | summary: copy a b
2016 |
2006 |
2017 | diff --git a/a b/b
2007 | diff --git a/a b/b
2018 | copy from a
2008 | copy from a
2019 | copy to b
2009 | copy to b
2020 |
2010 |
2021 o changeset: 0:f8035bb17114
2011 o changeset: 0:f8035bb17114
2022 user: test
2012 user: test
2023 date: Thu Jan 01 00:00:00 1970 +0000
2013 date: Thu Jan 01 00:00:00 1970 +0000
2024 summary: add a
2014 summary: add a
2025
2015
2026 diff --git a/a b/a
2016 diff --git a/a b/a
2027 new file mode 100644
2017 new file mode 100644
2028 --- /dev/null
2018 --- /dev/null
2029 +++ b/a
2019 +++ b/a
2030 @@ -0,0 +1,1 @@
2020 @@ -0,0 +1,1 @@
2031 +a
2021 +a
2032
2022
2033
2023
2034 $ hg log -G --git --stat --follow b
2024 $ hg log -G --git --stat --follow b
2035 o changeset: 1:216d4c92cf98
2025 o changeset: 1:216d4c92cf98
2036 | user: test
2026 | user: test
2037 | date: Thu Jan 01 00:00:00 1970 +0000
2027 | date: Thu Jan 01 00:00:00 1970 +0000
2038 | summary: copy a b
2028 | summary: copy a b
2039 |
2029 |
2040 | b | 0
2030 | b | 0
2041 | 1 files changed, 0 insertions(+), 0 deletions(-)
2031 | 1 files changed, 0 insertions(+), 0 deletions(-)
2042 |
2032 |
2043 o changeset: 0:f8035bb17114
2033 o changeset: 0:f8035bb17114
2044 user: test
2034 user: test
2045 date: Thu Jan 01 00:00:00 1970 +0000
2035 date: Thu Jan 01 00:00:00 1970 +0000
2046 summary: add a
2036 summary: add a
2047
2037
2048 a | 1 +
2038 a | 1 +
2049 1 files changed, 1 insertions(+), 0 deletions(-)
2039 1 files changed, 1 insertions(+), 0 deletions(-)
2050
2040
2051
2041
2052 $ hg up -q 6
2042 $ hg up -q 6
2053 $ hg log -G --git --patch --follow-first e
2043 $ hg log -G --git --patch --follow-first e
2054 @ changeset: 6:fc281d8ff18d
2044 @ changeset: 6:fc281d8ff18d
2055 |\ tag: tip
2045 |\ tag: tip
2056 | ~ parent: 5:99b31f1c2782
2046 | ~ parent: 5:99b31f1c2782
2057 | parent: 4:17d952250a9d
2047 | parent: 4:17d952250a9d
2058 | user: test
2048 | user: test
2059 | date: Thu Jan 01 00:00:00 1970 +0000
2049 | date: Thu Jan 01 00:00:00 1970 +0000
2060 | summary: merge 5 and 4
2050 | summary: merge 5 and 4
2061 |
2051 |
2062 | diff --git a/e b/e
2052 | diff --git a/e b/e
2063 | --- a/e
2053 | --- a/e
2064 | +++ b/e
2054 | +++ b/e
2065 | @@ -1,1 +1,1 @@
2055 | @@ -1,1 +1,1 @@
2066 | -ee
2056 | -ee
2067 | +merge
2057 | +merge
2068 |
2058 |
2069 o changeset: 5:99b31f1c2782
2059 o changeset: 5:99b31f1c2782
2070 | parent: 3:5918b8d165d1
2060 | parent: 3:5918b8d165d1
2071 ~ user: test
2061 ~ user: test
2072 date: Thu Jan 01 00:00:00 1970 +0000
2062 date: Thu Jan 01 00:00:00 1970 +0000
2073 summary: add another e
2063 summary: add another e
2074
2064
2075 diff --git a/e b/e
2065 diff --git a/e b/e
2076 new file mode 100644
2066 new file mode 100644
2077 --- /dev/null
2067 --- /dev/null
2078 +++ b/e
2068 +++ b/e
2079 @@ -0,0 +1,1 @@
2069 @@ -0,0 +1,1 @@
2080 +ee
2070 +ee
2081
2071
2082
2072
2083 Test old-style --rev
2073 Test old-style --rev
2084
2074
2085 $ hg tag 'foo-bar'
2075 $ hg tag 'foo-bar'
2086 $ testlog -r 'foo-bar'
2076 $ testlog -r 'foo-bar'
2087 ['foo-bar']
2077 ['foo-bar']
2088 []
2078 []
2089 <baseset [6]>
2079 <baseset [6]>
2090
2080
2091 Test --follow and forward --rev
2081 Test --follow and forward --rev
2092
2082
2093 $ hg up -q 6
2083 $ hg up -q 6
2094 $ echo g > g
2084 $ echo g > g
2095 $ hg ci -Am 'add g' g
2085 $ hg ci -Am 'add g' g
2096 created new head
2086 created new head
2097 $ hg up -q 2
2087 $ hg up -q 2
2098 $ hg log -G --template "{rev} {desc|firstline}\n"
2088 $ hg log -G --template "{rev} {desc|firstline}\n"
2099 o 8 add g
2089 o 8 add g
2100 |
2090 |
2101 | o 7 Added tag foo-bar for changeset fc281d8ff18d
2091 | o 7 Added tag foo-bar for changeset fc281d8ff18d
2102 |/
2092 |/
2103 o 6 merge 5 and 4
2093 o 6 merge 5 and 4
2104 |\
2094 |\
2105 | o 5 add another e
2095 | o 5 add another e
2106 | |
2096 | |
2107 o | 4 mv dir/b e
2097 o | 4 mv dir/b e
2108 |/
2098 |/
2109 o 3 mv a b; add d
2099 o 3 mv a b; add d
2110 |
2100 |
2111 @ 2 mv b dir/b
2101 @ 2 mv b dir/b
2112 |
2102 |
2113 o 1 copy a b
2103 o 1 copy a b
2114 |
2104 |
2115 o 0 add a
2105 o 0 add a
2116
2106
2117 $ hg archive -r 7 archive
2107 $ hg archive -r 7 archive
2118 $ grep changessincelatesttag archive/.hg_archival.txt
2108 $ grep changessincelatesttag archive/.hg_archival.txt
2119 changessincelatesttag: 1
2109 changessincelatesttag: 1
2120 $ rm -r archive
2110 $ rm -r archive
2121
2111
2122 changessincelatesttag with no prior tag
2112 changessincelatesttag with no prior tag
2123 $ hg archive -r 4 archive
2113 $ hg archive -r 4 archive
2124 $ grep changessincelatesttag archive/.hg_archival.txt
2114 $ grep changessincelatesttag archive/.hg_archival.txt
2125 changessincelatesttag: 5
2115 changessincelatesttag: 5
2126
2116
2127 $ hg export 'all()'
2117 $ hg export 'all()'
2128 # HG changeset patch
2118 # HG changeset patch
2129 # User test
2119 # User test
2130 # Date 0 0
2120 # Date 0 0
2131 # Thu Jan 01 00:00:00 1970 +0000
2121 # Thu Jan 01 00:00:00 1970 +0000
2132 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2122 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2133 # Parent 0000000000000000000000000000000000000000
2123 # Parent 0000000000000000000000000000000000000000
2134 add a
2124 add a
2135
2125
2136 diff -r 000000000000 -r f8035bb17114 a
2126 diff -r 000000000000 -r f8035bb17114 a
2137 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2127 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2138 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2128 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2139 @@ -0,0 +1,1 @@
2129 @@ -0,0 +1,1 @@
2140 +a
2130 +a
2141 diff -r 000000000000 -r f8035bb17114 aa
2131 diff -r 000000000000 -r f8035bb17114 aa
2142 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2132 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2143 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2133 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2144 @@ -0,0 +1,1 @@
2134 @@ -0,0 +1,1 @@
2145 +aa
2135 +aa
2146 diff -r 000000000000 -r f8035bb17114 f
2136 diff -r 000000000000 -r f8035bb17114 f
2147 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2137 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2148 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2138 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2149 @@ -0,0 +1,1 @@
2139 @@ -0,0 +1,1 @@
2150 +f
2140 +f
2151 # HG changeset patch
2141 # HG changeset patch
2152 # User test
2142 # User test
2153 # Date 0 0
2143 # Date 0 0
2154 # Thu Jan 01 00:00:00 1970 +0000
2144 # Thu Jan 01 00:00:00 1970 +0000
2155 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2145 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2156 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2146 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2157 copy a b
2147 copy a b
2158
2148
2159 diff -r f8035bb17114 -r 216d4c92cf98 b
2149 diff -r f8035bb17114 -r 216d4c92cf98 b
2160 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2150 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2161 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2151 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2162 @@ -0,0 +1,1 @@
2152 @@ -0,0 +1,1 @@
2163 +a
2153 +a
2164 diff -r f8035bb17114 -r 216d4c92cf98 g
2154 diff -r f8035bb17114 -r 216d4c92cf98 g
2165 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2155 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2166 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2156 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2167 @@ -0,0 +1,1 @@
2157 @@ -0,0 +1,1 @@
2168 +f
2158 +f
2169 # HG changeset patch
2159 # HG changeset patch
2170 # User test
2160 # User test
2171 # Date 0 0
2161 # Date 0 0
2172 # Thu Jan 01 00:00:00 1970 +0000
2162 # Thu Jan 01 00:00:00 1970 +0000
2173 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2163 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2174 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2164 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2175 mv b dir/b
2165 mv b dir/b
2176
2166
2177 diff -r 216d4c92cf98 -r bb573313a9e8 b
2167 diff -r 216d4c92cf98 -r bb573313a9e8 b
2178 --- a/b Thu Jan 01 00:00:00 1970 +0000
2168 --- a/b Thu Jan 01 00:00:00 1970 +0000
2179 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2169 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2180 @@ -1,1 +0,0 @@
2170 @@ -1,1 +0,0 @@
2181 -a
2171 -a
2182 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2172 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2183 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2173 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2184 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2174 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2185 @@ -0,0 +1,1 @@
2175 @@ -0,0 +1,1 @@
2186 +a
2176 +a
2187 diff -r 216d4c92cf98 -r bb573313a9e8 f
2177 diff -r 216d4c92cf98 -r bb573313a9e8 f
2188 --- a/f Thu Jan 01 00:00:00 1970 +0000
2178 --- a/f Thu Jan 01 00:00:00 1970 +0000
2189 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2179 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2190 @@ -1,1 +1,2 @@
2180 @@ -1,1 +1,2 @@
2191 f
2181 f
2192 +f
2182 +f
2193 diff -r 216d4c92cf98 -r bb573313a9e8 g
2183 diff -r 216d4c92cf98 -r bb573313a9e8 g
2194 --- a/g Thu Jan 01 00:00:00 1970 +0000
2184 --- a/g Thu Jan 01 00:00:00 1970 +0000
2195 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2185 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2196 @@ -1,1 +1,2 @@
2186 @@ -1,1 +1,2 @@
2197 f
2187 f
2198 +g
2188 +g
2199 # HG changeset patch
2189 # HG changeset patch
2200 # User test
2190 # User test
2201 # Date 0 0
2191 # Date 0 0
2202 # Thu Jan 01 00:00:00 1970 +0000
2192 # Thu Jan 01 00:00:00 1970 +0000
2203 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2193 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2204 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2194 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2205 mv a b; add d
2195 mv a b; add d
2206
2196
2207 diff -r bb573313a9e8 -r 5918b8d165d1 a
2197 diff -r bb573313a9e8 -r 5918b8d165d1 a
2208 --- a/a Thu Jan 01 00:00:00 1970 +0000
2198 --- a/a Thu Jan 01 00:00:00 1970 +0000
2209 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2199 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2210 @@ -1,1 +0,0 @@
2200 @@ -1,1 +0,0 @@
2211 -a
2201 -a
2212 diff -r bb573313a9e8 -r 5918b8d165d1 b
2202 diff -r bb573313a9e8 -r 5918b8d165d1 b
2213 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2203 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2214 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2204 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2215 @@ -0,0 +1,1 @@
2205 @@ -0,0 +1,1 @@
2216 +a
2206 +a
2217 diff -r bb573313a9e8 -r 5918b8d165d1 d
2207 diff -r bb573313a9e8 -r 5918b8d165d1 d
2218 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2208 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2219 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2209 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2220 @@ -0,0 +1,1 @@
2210 @@ -0,0 +1,1 @@
2221 +a
2211 +a
2222 diff -r bb573313a9e8 -r 5918b8d165d1 g
2212 diff -r bb573313a9e8 -r 5918b8d165d1 g
2223 --- a/g Thu Jan 01 00:00:00 1970 +0000
2213 --- a/g Thu Jan 01 00:00:00 1970 +0000
2224 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2214 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2225 @@ -1,2 +1,2 @@
2215 @@ -1,2 +1,2 @@
2226 f
2216 f
2227 -g
2217 -g
2228 +f
2218 +f
2229 # HG changeset patch
2219 # HG changeset patch
2230 # User test
2220 # User test
2231 # Date 0 0
2221 # Date 0 0
2232 # Thu Jan 01 00:00:00 1970 +0000
2222 # Thu Jan 01 00:00:00 1970 +0000
2233 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2223 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2234 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2224 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2235 mv dir/b e
2225 mv dir/b e
2236
2226
2237 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2227 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2238 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2228 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2239 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2229 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2240 @@ -1,1 +0,0 @@
2230 @@ -1,1 +0,0 @@
2241 -a
2231 -a
2242 diff -r 5918b8d165d1 -r 17d952250a9d e
2232 diff -r 5918b8d165d1 -r 17d952250a9d e
2243 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2233 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2244 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2234 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2245 @@ -0,0 +1,1 @@
2235 @@ -0,0 +1,1 @@
2246 +a
2236 +a
2247 # HG changeset patch
2237 # HG changeset patch
2248 # User test
2238 # User test
2249 # Date 0 0
2239 # Date 0 0
2250 # Thu Jan 01 00:00:00 1970 +0000
2240 # Thu Jan 01 00:00:00 1970 +0000
2251 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2241 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2252 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2242 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2253 add another e
2243 add another e
2254
2244
2255 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2245 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2256 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2246 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2257 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2247 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2258 @@ -0,0 +1,1 @@
2248 @@ -0,0 +1,1 @@
2259 +ee
2249 +ee
2260 # HG changeset patch
2250 # HG changeset patch
2261 # User test
2251 # User test
2262 # Date 0 0
2252 # Date 0 0
2263 # Thu Jan 01 00:00:00 1970 +0000
2253 # Thu Jan 01 00:00:00 1970 +0000
2264 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2254 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2265 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2255 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2266 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2256 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2267 merge 5 and 4
2257 merge 5 and 4
2268
2258
2269 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2259 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2270 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2260 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2271 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2261 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2272 @@ -1,1 +0,0 @@
2262 @@ -1,1 +0,0 @@
2273 -a
2263 -a
2274 diff -r 99b31f1c2782 -r fc281d8ff18d e
2264 diff -r 99b31f1c2782 -r fc281d8ff18d e
2275 --- a/e Thu Jan 01 00:00:00 1970 +0000
2265 --- a/e Thu Jan 01 00:00:00 1970 +0000
2276 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2266 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2277 @@ -1,1 +1,1 @@
2267 @@ -1,1 +1,1 @@
2278 -ee
2268 -ee
2279 +merge
2269 +merge
2280 # HG changeset patch
2270 # HG changeset patch
2281 # User test
2271 # User test
2282 # Date 0 0
2272 # Date 0 0
2283 # Thu Jan 01 00:00:00 1970 +0000
2273 # Thu Jan 01 00:00:00 1970 +0000
2284 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2274 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2285 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2275 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2286 Added tag foo-bar for changeset fc281d8ff18d
2276 Added tag foo-bar for changeset fc281d8ff18d
2287
2277
2288 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2278 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2289 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2279 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2290 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2280 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2291 @@ -0,0 +1,1 @@
2281 @@ -0,0 +1,1 @@
2292 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2282 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2293 # HG changeset patch
2283 # HG changeset patch
2294 # User test
2284 # User test
2295 # Date 0 0
2285 # Date 0 0
2296 # Thu Jan 01 00:00:00 1970 +0000
2286 # Thu Jan 01 00:00:00 1970 +0000
2297 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2287 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2298 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2288 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2299 add g
2289 add g
2300
2290
2301 diff -r fc281d8ff18d -r 24c2e826ddeb g
2291 diff -r fc281d8ff18d -r 24c2e826ddeb g
2302 --- a/g Thu Jan 01 00:00:00 1970 +0000
2292 --- a/g Thu Jan 01 00:00:00 1970 +0000
2303 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2293 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2304 @@ -1,2 +1,1 @@
2294 @@ -1,2 +1,1 @@
2305 -f
2295 -f
2306 -f
2296 -f
2307 +g
2297 +g
2308 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2298 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2309 ['reverse(::(((6) or (8)) or ((5) or ((7) or (4)))))']
2299 ['reverse(::(((6) or (8)) or ((5) or ((7) or (4)))))']
2310 []
2300 []
2311 <generatorsetdesc->
2301 <generatorsetdesc->
2312
2302
2313 Test --follow-first and forward --rev
2303 Test --follow-first and forward --rev
2314
2304
2315 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2305 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2316 ['6', '8', '5', '7', '4']
2306 ['6', '8', '5', '7', '4']
2317 (func
2307 (func
2318 (symbol '_firstdescendants')
2308 (symbol '_firstdescendants')
2319 (func
2309 (func
2320 (symbol 'rev')
2310 (symbol 'rev')
2321 (symbol '6')))
2311 (symbol '6')))
2322 <filteredset
2312 <filteredset
2323 <baseset- [4, 5, 6, 7, 8]>,
2313 <baseset- [4, 5, 6, 7, 8]>,
2324 <generatorsetasc+>>
2314 <generatorsetasc+>>
2325 --- log.nodes * (glob)
2315 --- log.nodes * (glob)
2326 +++ glog.nodes * (glob)
2316 +++ glog.nodes * (glob)
2327 @@ -1,3 +1,3 @@
2317 @@ -1,3 +1,3 @@
2328 -nodetag 6
2318 -nodetag 6
2329 nodetag 8
2319 nodetag 8
2330 nodetag 7
2320 nodetag 7
2331 +nodetag 6
2321 +nodetag 6
2332
2322
2333 Test --follow and backward --rev
2323 Test --follow and backward --rev
2334
2324
2335 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2325 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2336 ['reverse(::(((6) or (5)) or ((7) or ((8) or (4)))))']
2326 ['reverse(::(((6) or (5)) or ((7) or ((8) or (4)))))']
2337 []
2327 []
2338 <generatorsetdesc->
2328 <generatorsetdesc->
2339
2329
2340 Test --follow-first and backward --rev
2330 Test --follow-first and backward --rev
2341
2331
2342 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2332 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2343 ['6', '5', '7', '8', '4']
2333 ['6', '5', '7', '8', '4']
2344 (func
2334 (func
2345 (symbol '_firstancestors')
2335 (symbol '_firstancestors')
2346 (func
2336 (func
2347 (symbol 'rev')
2337 (symbol 'rev')
2348 (symbol '6')))
2338 (symbol '6')))
2349 <filteredset
2339 <filteredset
2350 <baseset- [4, 5, 6, 7, 8]>,
2340 <baseset- [4, 5, 6, 7, 8]>,
2351 <generatorsetdesc+>>
2341 <generatorsetdesc+>>
2352
2342
2353 Test --follow with --rev of graphlog extension
2343 Test --follow with --rev of graphlog extension
2354
2344
2355 $ hg --config extensions.graphlog= glog -qfr1
2345 $ hg --config extensions.graphlog= glog -qfr1
2356 o 1:216d4c92cf98
2346 o 1:216d4c92cf98
2357 |
2347 |
2358 o 0:f8035bb17114
2348 o 0:f8035bb17114
2359
2349
2360
2350
2361 Test subdir
2351 Test subdir
2362
2352
2363 $ hg up -q 3
2353 $ hg up -q 3
2364 $ cd dir
2354 $ cd dir
2365 $ testlog .
2355 $ testlog .
2366 []
2356 []
2367 (func
2357 (func
2368 (symbol '_matchfiles')
2358 (symbol '_matchfiles')
2369 (list
2359 (list
2370 (string 'r:')
2360 (string 'r:')
2371 (string 'd:relpath')
2361 (string 'd:relpath')
2372 (string 'p:.')))
2362 (string 'p:.')))
2373 <filteredset
2363 <filteredset
2374 <spanset- 0:9>,
2364 <spanset- 0:9>,
2375 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=None>>
2365 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=None>>
2376 $ testlog ../b
2366 $ testlog ../b
2377 []
2367 []
2378 (func
2368 (func
2379 (symbol 'filelog')
2369 (symbol 'filelog')
2380 (string '../b'))
2370 (string '../b'))
2381 <filteredset
2371 <filteredset
2382 <spanset- 0:9>, set([1])>
2372 <spanset- 0:9>, set([1])>
2383 $ testlog -f ../b
2373 $ testlog -f ../b
2384 []
2374 []
2385 (func
2375 (func
2386 (symbol 'follow')
2376 (symbol 'follow')
2387 (string 'b'))
2377 (string 'b'))
2388 <filteredset
2378 <filteredset
2389 <spanset- 0:4>,
2379 <spanset- 0:4>,
2390 <generatorsetdesc+>>
2380 <generatorsetdesc+>>
2391 $ cd ..
2381 $ cd ..
2392
2382
2393 Test --hidden
2383 Test --hidden
2394 (enable obsolete)
2384 (enable obsolete)
2395
2385
2396 $ cat >> $HGRCPATH << EOF
2386 $ cat >> $HGRCPATH << EOF
2397 > [experimental]
2387 > [experimental]
2398 > evolution.createmarkers=True
2388 > evolution.createmarkers=True
2399 > EOF
2389 > EOF
2400
2390
2401 $ hg debugobsolete `hg id --debug -i -r 8`
2391 $ hg debugobsolete `hg id --debug -i -r 8`
2402 obsoleted 1 changesets
2392 obsoleted 1 changesets
2403 $ testlog
2393 $ testlog
2404 []
2394 []
2405 []
2395 []
2406 <spanset- 0:9>
2396 <spanset- 0:9>
2407 $ testlog --hidden
2397 $ testlog --hidden
2408 []
2398 []
2409 []
2399 []
2410 <spanset- 0:9>
2400 <spanset- 0:9>
2411 $ hg log -G --template '{rev} {desc}\n'
2401 $ hg log -G --template '{rev} {desc}\n'
2412 o 7 Added tag foo-bar for changeset fc281d8ff18d
2402 o 7 Added tag foo-bar for changeset fc281d8ff18d
2413 |
2403 |
2414 o 6 merge 5 and 4
2404 o 6 merge 5 and 4
2415 |\
2405 |\
2416 | o 5 add another e
2406 | o 5 add another e
2417 | |
2407 | |
2418 o | 4 mv dir/b e
2408 o | 4 mv dir/b e
2419 |/
2409 |/
2420 @ 3 mv a b; add d
2410 @ 3 mv a b; add d
2421 |
2411 |
2422 o 2 mv b dir/b
2412 o 2 mv b dir/b
2423 |
2413 |
2424 o 1 copy a b
2414 o 1 copy a b
2425 |
2415 |
2426 o 0 add a
2416 o 0 add a
2427
2417
2428
2418
2429 A template without trailing newline should do something sane
2419 A template without trailing newline should do something sane
2430
2420
2431 $ hg log -G -r ::2 --template '{rev} {desc}'
2421 $ hg log -G -r ::2 --template '{rev} {desc}'
2432 o 2 mv b dir/b
2422 o 2 mv b dir/b
2433 |
2423 |
2434 o 1 copy a b
2424 o 1 copy a b
2435 |
2425 |
2436 o 0 add a
2426 o 0 add a
2437
2427
2438
2428
2439 Extra newlines must be preserved
2429 Extra newlines must be preserved
2440
2430
2441 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2431 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2442 o
2432 o
2443 | 2 mv b dir/b
2433 | 2 mv b dir/b
2444 |
2434 |
2445 o
2435 o
2446 | 1 copy a b
2436 | 1 copy a b
2447 |
2437 |
2448 o
2438 o
2449 0 add a
2439 0 add a
2450
2440
2451
2441
2452 The almost-empty template should do something sane too ...
2442 The almost-empty template should do something sane too ...
2453
2443
2454 $ hg log -G -r ::2 --template '\n'
2444 $ hg log -G -r ::2 --template '\n'
2455 o
2445 o
2456 |
2446 |
2457 o
2447 o
2458 |
2448 |
2459 o
2449 o
2460
2450
2461
2451
2462 issue3772
2452 issue3772
2463
2453
2464 $ hg log -G -r :null
2454 $ hg log -G -r :null
2465 o changeset: 0:f8035bb17114
2455 o changeset: 0:f8035bb17114
2466 | user: test
2456 | user: test
2467 | date: Thu Jan 01 00:00:00 1970 +0000
2457 | date: Thu Jan 01 00:00:00 1970 +0000
2468 | summary: add a
2458 | summary: add a
2469 |
2459 |
2470 o changeset: -1:000000000000
2460 o changeset: -1:000000000000
2471 user:
2461 user:
2472 date: Thu Jan 01 00:00:00 1970 +0000
2462 date: Thu Jan 01 00:00:00 1970 +0000
2473
2463
2474 $ hg log -G -r null:null
2464 $ hg log -G -r null:null
2475 o changeset: -1:000000000000
2465 o changeset: -1:000000000000
2476 user:
2466 user:
2477 date: Thu Jan 01 00:00:00 1970 +0000
2467 date: Thu Jan 01 00:00:00 1970 +0000
2478
2468
2479
2469
2480 should not draw line down to null due to the magic of fullreposet
2470 should not draw line down to null due to the magic of fullreposet
2481
2471
2482 $ hg log -G -r 'all()' | tail -6
2472 $ hg log -G -r 'all()' | tail -6
2483 |
2473 |
2484 o changeset: 0:f8035bb17114
2474 o changeset: 0:f8035bb17114
2485 user: test
2475 user: test
2486 date: Thu Jan 01 00:00:00 1970 +0000
2476 date: Thu Jan 01 00:00:00 1970 +0000
2487 summary: add a
2477 summary: add a
2488
2478
2489
2479
2490 $ hg log -G -r 'branch(default)' | tail -6
2480 $ hg log -G -r 'branch(default)' | tail -6
2491 |
2481 |
2492 o changeset: 0:f8035bb17114
2482 o changeset: 0:f8035bb17114
2493 user: test
2483 user: test
2494 date: Thu Jan 01 00:00:00 1970 +0000
2484 date: Thu Jan 01 00:00:00 1970 +0000
2495 summary: add a
2485 summary: add a
2496
2486
2497
2487
2498 working-directory revision
2488 working-directory revision
2499
2489
2500 $ hg log -G -qr '. + wdir()'
2490 $ hg log -G -qr '. + wdir()'
2501 o 2147483647:ffffffffffff
2491 o 2147483647:ffffffffffff
2502 |
2492 |
2503 @ 3:5918b8d165d1
2493 @ 3:5918b8d165d1
2504 |
2494 |
2505 ~
2495 ~
2506
2496
2507 node template with changeset_printer:
2497 node template with changeset_printer:
2508
2498
2509 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2499 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2510 7 7:02dbb8e276b8
2500 7 7:02dbb8e276b8
2511 |
2501 |
2512 6 6:fc281d8ff18d
2502 6 6:fc281d8ff18d
2513 |\
2503 |\
2514 | ~
2504 | ~
2515 5 5:99b31f1c2782
2505 5 5:99b31f1c2782
2516 |
2506 |
2517 ~
2507 ~
2518
2508
2519 node template with changeset_templater (shared cache variable):
2509 node template with changeset_templater (shared cache variable):
2520
2510
2521 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2511 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2522 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2512 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
2523 o 7 foo-bar+1
2513 o 7 foo-bar+1
2524 |
2514 |
2525 # 6 foo-bar+0
2515 # 6 foo-bar+0
2526 |\
2516 |\
2527 | ~
2517 | ~
2528 o 5 null+5
2518 o 5 null+5
2529 |
2519 |
2530 ~
2520 ~
2531
2521
2532 label() should just work in node template:
2522 label() should just work in node template:
2533
2523
2534 $ hg log -Gqr 7 --config extensions.color= --color=debug \
2524 $ hg log -Gqr 7 --config extensions.color= --color=debug \
2535 > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
2525 > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
2536 [branch.default|7] [log.node|7:02dbb8e276b8]
2526 [branch.default|7] [log.node|7:02dbb8e276b8]
2537 |
2527 |
2538 ~
2528 ~
2539
2529
2540 $ cd ..
2530 $ cd ..
2541
2531
2542 change graph edge styling
2532 change graph edge styling
2543
2533
2544 $ cd repo
2534 $ cd repo
2545 $ cat << EOF >> $HGRCPATH
2535 $ cat << EOF >> $HGRCPATH
2546 > [experimental]
2536 > [experimental]
2547 > graphstyle.parent = |
2537 > graphstyle.parent = |
2548 > graphstyle.grandparent = :
2538 > graphstyle.grandparent = :
2549 > graphstyle.missing =
2539 > graphstyle.missing =
2550 > EOF
2540 > EOF
2551 $ hg log -G -r 'file("a")' -m
2541 $ hg log -G -r 'file("a")' -m
2552 @ changeset: 36:08a19a744424
2542 @ changeset: 36:08a19a744424
2553 : branch: branch
2543 : branch: branch
2554 : tag: tip
2544 : tag: tip
2555 : parent: 35:9159c3644c5e
2545 : parent: 35:9159c3644c5e
2556 : parent: 35:9159c3644c5e
2546 : parent: 35:9159c3644c5e
2557 : user: test
2547 : user: test
2558 : date: Thu Jan 01 00:00:36 1970 +0000
2548 : date: Thu Jan 01 00:00:36 1970 +0000
2559 : summary: (36) buggy merge: identical parents
2549 : summary: (36) buggy merge: identical parents
2560 :
2550 :
2561 o changeset: 32:d06dffa21a31
2551 o changeset: 32:d06dffa21a31
2562 |\ parent: 27:886ed638191b
2552 |\ parent: 27:886ed638191b
2563 | : parent: 31:621d83e11f67
2553 | : parent: 31:621d83e11f67
2564 | : user: test
2554 | : user: test
2565 | : date: Thu Jan 01 00:00:32 1970 +0000
2555 | : date: Thu Jan 01 00:00:32 1970 +0000
2566 | : summary: (32) expand
2556 | : summary: (32) expand
2567 | :
2557 | :
2568 o : changeset: 31:621d83e11f67
2558 o : changeset: 31:621d83e11f67
2569 |\: parent: 21:d42a756af44d
2559 |\: parent: 21:d42a756af44d
2570 | : parent: 30:6e11cd4b648f
2560 | : parent: 30:6e11cd4b648f
2571 | : user: test
2561 | : user: test
2572 | : date: Thu Jan 01 00:00:31 1970 +0000
2562 | : date: Thu Jan 01 00:00:31 1970 +0000
2573 | : summary: (31) expand
2563 | : summary: (31) expand
2574 | :
2564 | :
2575 o : changeset: 30:6e11cd4b648f
2565 o : changeset: 30:6e11cd4b648f
2576 |\ \ parent: 28:44ecd0b9ae99
2566 |\ \ parent: 28:44ecd0b9ae99
2577 | ~ : parent: 29:cd9bb2be7593
2567 | ~ : parent: 29:cd9bb2be7593
2578 | : user: test
2568 | : user: test
2579 | : date: Thu Jan 01 00:00:30 1970 +0000
2569 | : date: Thu Jan 01 00:00:30 1970 +0000
2580 | : summary: (30) expand
2570 | : summary: (30) expand
2581 | /
2571 | /
2582 o : changeset: 28:44ecd0b9ae99
2572 o : changeset: 28:44ecd0b9ae99
2583 |\ \ parent: 1:6db2ef61d156
2573 |\ \ parent: 1:6db2ef61d156
2584 | ~ : parent: 26:7f25b6c2f0b9
2574 | ~ : parent: 26:7f25b6c2f0b9
2585 | : user: test
2575 | : user: test
2586 | : date: Thu Jan 01 00:00:28 1970 +0000
2576 | : date: Thu Jan 01 00:00:28 1970 +0000
2587 | : summary: (28) merge zero known
2577 | : summary: (28) merge zero known
2588 | /
2578 | /
2589 o : changeset: 26:7f25b6c2f0b9
2579 o : changeset: 26:7f25b6c2f0b9
2590 |\ \ parent: 18:1aa84d96232a
2580 |\ \ parent: 18:1aa84d96232a
2591 | | : parent: 25:91da8ed57247
2581 | | : parent: 25:91da8ed57247
2592 | | : user: test
2582 | | : user: test
2593 | | : date: Thu Jan 01 00:00:26 1970 +0000
2583 | | : date: Thu Jan 01 00:00:26 1970 +0000
2594 | | : summary: (26) merge one known; far right
2584 | | : summary: (26) merge one known; far right
2595 | | :
2585 | | :
2596 | o : changeset: 25:91da8ed57247
2586 | o : changeset: 25:91da8ed57247
2597 | |\: parent: 21:d42a756af44d
2587 | |\: parent: 21:d42a756af44d
2598 | | : parent: 24:a9c19a3d96b7
2588 | | : parent: 24:a9c19a3d96b7
2599 | | : user: test
2589 | | : user: test
2600 | | : date: Thu Jan 01 00:00:25 1970 +0000
2590 | | : date: Thu Jan 01 00:00:25 1970 +0000
2601 | | : summary: (25) merge one known; far left
2591 | | : summary: (25) merge one known; far left
2602 | | :
2592 | | :
2603 | o : changeset: 24:a9c19a3d96b7
2593 | o : changeset: 24:a9c19a3d96b7
2604 | |\ \ parent: 0:e6eb3150255d
2594 | |\ \ parent: 0:e6eb3150255d
2605 | | ~ : parent: 23:a01cddf0766d
2595 | | ~ : parent: 23:a01cddf0766d
2606 | | : user: test
2596 | | : user: test
2607 | | : date: Thu Jan 01 00:00:24 1970 +0000
2597 | | : date: Thu Jan 01 00:00:24 1970 +0000
2608 | | : summary: (24) merge one known; immediate right
2598 | | : summary: (24) merge one known; immediate right
2609 | | /
2599 | | /
2610 | o : changeset: 23:a01cddf0766d
2600 | o : changeset: 23:a01cddf0766d
2611 | |\ \ parent: 1:6db2ef61d156
2601 | |\ \ parent: 1:6db2ef61d156
2612 | | ~ : parent: 22:e0d9cccacb5d
2602 | | ~ : parent: 22:e0d9cccacb5d
2613 | | : user: test
2603 | | : user: test
2614 | | : date: Thu Jan 01 00:00:23 1970 +0000
2604 | | : date: Thu Jan 01 00:00:23 1970 +0000
2615 | | : summary: (23) merge one known; immediate left
2605 | | : summary: (23) merge one known; immediate left
2616 | | /
2606 | | /
2617 | o : changeset: 22:e0d9cccacb5d
2607 | o : changeset: 22:e0d9cccacb5d
2618 |/:/ parent: 18:1aa84d96232a
2608 |/:/ parent: 18:1aa84d96232a
2619 | : parent: 21:d42a756af44d
2609 | : parent: 21:d42a756af44d
2620 | : user: test
2610 | : user: test
2621 | : date: Thu Jan 01 00:00:22 1970 +0000
2611 | : date: Thu Jan 01 00:00:22 1970 +0000
2622 | : summary: (22) merge two known; one far left, one far right
2612 | : summary: (22) merge two known; one far left, one far right
2623 | :
2613 | :
2624 | o changeset: 21:d42a756af44d
2614 | o changeset: 21:d42a756af44d
2625 | |\ parent: 19:31ddc2c1573b
2615 | |\ parent: 19:31ddc2c1573b
2626 | | | parent: 20:d30ed6450e32
2616 | | | parent: 20:d30ed6450e32
2627 | | | user: test
2617 | | | user: test
2628 | | | date: Thu Jan 01 00:00:21 1970 +0000
2618 | | | date: Thu Jan 01 00:00:21 1970 +0000
2629 | | | summary: (21) expand
2619 | | | summary: (21) expand
2630 | | |
2620 | | |
2631 +---o changeset: 20:d30ed6450e32
2621 +---o changeset: 20:d30ed6450e32
2632 | | | parent: 0:e6eb3150255d
2622 | | | parent: 0:e6eb3150255d
2633 | | ~ parent: 18:1aa84d96232a
2623 | | ~ parent: 18:1aa84d96232a
2634 | | user: test
2624 | | user: test
2635 | | date: Thu Jan 01 00:00:20 1970 +0000
2625 | | date: Thu Jan 01 00:00:20 1970 +0000
2636 | | summary: (20) merge two known; two far right
2626 | | summary: (20) merge two known; two far right
2637 | |
2627 | |
2638 | o changeset: 19:31ddc2c1573b
2628 | o changeset: 19:31ddc2c1573b
2639 | |\ parent: 15:1dda3f72782d
2629 | |\ parent: 15:1dda3f72782d
2640 | | | parent: 17:44765d7c06e0
2630 | | | parent: 17:44765d7c06e0
2641 | | | user: test
2631 | | | user: test
2642 | | | date: Thu Jan 01 00:00:19 1970 +0000
2632 | | | date: Thu Jan 01 00:00:19 1970 +0000
2643 | | | summary: (19) expand
2633 | | | summary: (19) expand
2644 | | |
2634 | | |
2645 o | | changeset: 18:1aa84d96232a
2635 o | | changeset: 18:1aa84d96232a
2646 |\| | parent: 1:6db2ef61d156
2636 |\| | parent: 1:6db2ef61d156
2647 ~ | | parent: 15:1dda3f72782d
2637 ~ | | parent: 15:1dda3f72782d
2648 | | user: test
2638 | | user: test
2649 | | date: Thu Jan 01 00:00:18 1970 +0000
2639 | | date: Thu Jan 01 00:00:18 1970 +0000
2650 | | summary: (18) merge two known; two far left
2640 | | summary: (18) merge two known; two far left
2651 / /
2641 / /
2652 | o changeset: 17:44765d7c06e0
2642 | o changeset: 17:44765d7c06e0
2653 | |\ parent: 12:86b91144a6e9
2643 | |\ parent: 12:86b91144a6e9
2654 | | | parent: 16:3677d192927d
2644 | | | parent: 16:3677d192927d
2655 | | | user: test
2645 | | | user: test
2656 | | | date: Thu Jan 01 00:00:17 1970 +0000
2646 | | | date: Thu Jan 01 00:00:17 1970 +0000
2657 | | | summary: (17) expand
2647 | | | summary: (17) expand
2658 | | |
2648 | | |
2659 | | o changeset: 16:3677d192927d
2649 | | o changeset: 16:3677d192927d
2660 | | |\ parent: 0:e6eb3150255d
2650 | | |\ parent: 0:e6eb3150255d
2661 | | ~ ~ parent: 1:6db2ef61d156
2651 | | ~ ~ parent: 1:6db2ef61d156
2662 | | user: test
2652 | | user: test
2663 | | date: Thu Jan 01 00:00:16 1970 +0000
2653 | | date: Thu Jan 01 00:00:16 1970 +0000
2664 | | summary: (16) merge two known; one immediate right, one near right
2654 | | summary: (16) merge two known; one immediate right, one near right
2665 | |
2655 | |
2666 o | changeset: 15:1dda3f72782d
2656 o | changeset: 15:1dda3f72782d
2667 |\ \ parent: 13:22d8966a97e3
2657 |\ \ parent: 13:22d8966a97e3
2668 | | | parent: 14:8eac370358ef
2658 | | | parent: 14:8eac370358ef
2669 | | | user: test
2659 | | | user: test
2670 | | | date: Thu Jan 01 00:00:15 1970 +0000
2660 | | | date: Thu Jan 01 00:00:15 1970 +0000
2671 | | | summary: (15) expand
2661 | | | summary: (15) expand
2672 | | |
2662 | | |
2673 | o | changeset: 14:8eac370358ef
2663 | o | changeset: 14:8eac370358ef
2674 | |\| parent: 0:e6eb3150255d
2664 | |\| parent: 0:e6eb3150255d
2675 | ~ | parent: 12:86b91144a6e9
2665 | ~ | parent: 12:86b91144a6e9
2676 | | user: test
2666 | | user: test
2677 | | date: Thu Jan 01 00:00:14 1970 +0000
2667 | | date: Thu Jan 01 00:00:14 1970 +0000
2678 | | summary: (14) merge two known; one immediate right, one far right
2668 | | summary: (14) merge two known; one immediate right, one far right
2679 | /
2669 | /
2680 o | changeset: 13:22d8966a97e3
2670 o | changeset: 13:22d8966a97e3
2681 |\ \ parent: 9:7010c0af0a35
2671 |\ \ parent: 9:7010c0af0a35
2682 | | | parent: 11:832d76e6bdf2
2672 | | | parent: 11:832d76e6bdf2
2683 | | | user: test
2673 | | | user: test
2684 | | | date: Thu Jan 01 00:00:13 1970 +0000
2674 | | | date: Thu Jan 01 00:00:13 1970 +0000
2685 | | | summary: (13) expand
2675 | | | summary: (13) expand
2686 | | |
2676 | | |
2687 +---o changeset: 12:86b91144a6e9
2677 +---o changeset: 12:86b91144a6e9
2688 | | | parent: 1:6db2ef61d156
2678 | | | parent: 1:6db2ef61d156
2689 | | ~ parent: 9:7010c0af0a35
2679 | | ~ parent: 9:7010c0af0a35
2690 | | user: test
2680 | | user: test
2691 | | date: Thu Jan 01 00:00:12 1970 +0000
2681 | | date: Thu Jan 01 00:00:12 1970 +0000
2692 | | summary: (12) merge two known; one immediate right, one far left
2682 | | summary: (12) merge two known; one immediate right, one far left
2693 | |
2683 | |
2694 | o changeset: 11:832d76e6bdf2
2684 | o changeset: 11:832d76e6bdf2
2695 | |\ parent: 6:b105a072e251
2685 | |\ parent: 6:b105a072e251
2696 | | | parent: 10:74c64d036d72
2686 | | | parent: 10:74c64d036d72
2697 | | | user: test
2687 | | | user: test
2698 | | | date: Thu Jan 01 00:00:11 1970 +0000
2688 | | | date: Thu Jan 01 00:00:11 1970 +0000
2699 | | | summary: (11) expand
2689 | | | summary: (11) expand
2700 | | |
2690 | | |
2701 | | o changeset: 10:74c64d036d72
2691 | | o changeset: 10:74c64d036d72
2702 | |/| parent: 0:e6eb3150255d
2692 | |/| parent: 0:e6eb3150255d
2703 | | ~ parent: 6:b105a072e251
2693 | | ~ parent: 6:b105a072e251
2704 | | user: test
2694 | | user: test
2705 | | date: Thu Jan 01 00:00:10 1970 +0000
2695 | | date: Thu Jan 01 00:00:10 1970 +0000
2706 | | summary: (10) merge two known; one immediate left, one near right
2696 | | summary: (10) merge two known; one immediate left, one near right
2707 | |
2697 | |
2708 o | changeset: 9:7010c0af0a35
2698 o | changeset: 9:7010c0af0a35
2709 |\ \ parent: 7:b632bb1b1224
2699 |\ \ parent: 7:b632bb1b1224
2710 | | | parent: 8:7a0b11f71937
2700 | | | parent: 8:7a0b11f71937
2711 | | | user: test
2701 | | | user: test
2712 | | | date: Thu Jan 01 00:00:09 1970 +0000
2702 | | | date: Thu Jan 01 00:00:09 1970 +0000
2713 | | | summary: (9) expand
2703 | | | summary: (9) expand
2714 | | |
2704 | | |
2715 | o | changeset: 8:7a0b11f71937
2705 | o | changeset: 8:7a0b11f71937
2716 |/| | parent: 0:e6eb3150255d
2706 |/| | parent: 0:e6eb3150255d
2717 | ~ | parent: 7:b632bb1b1224
2707 | ~ | parent: 7:b632bb1b1224
2718 | | user: test
2708 | | user: test
2719 | | date: Thu Jan 01 00:00:08 1970 +0000
2709 | | date: Thu Jan 01 00:00:08 1970 +0000
2720 | | summary: (8) merge two known; one immediate left, one far right
2710 | | summary: (8) merge two known; one immediate left, one far right
2721 | /
2711 | /
2722 o | changeset: 7:b632bb1b1224
2712 o | changeset: 7:b632bb1b1224
2723 |\ \ parent: 2:3d9a33b8d1e1
2713 |\ \ parent: 2:3d9a33b8d1e1
2724 | ~ | parent: 5:4409d547b708
2714 | ~ | parent: 5:4409d547b708
2725 | | user: test
2715 | | user: test
2726 | | date: Thu Jan 01 00:00:07 1970 +0000
2716 | | date: Thu Jan 01 00:00:07 1970 +0000
2727 | | summary: (7) expand
2717 | | summary: (7) expand
2728 | /
2718 | /
2729 | o changeset: 6:b105a072e251
2719 | o changeset: 6:b105a072e251
2730 |/| parent: 2:3d9a33b8d1e1
2720 |/| parent: 2:3d9a33b8d1e1
2731 | ~ parent: 5:4409d547b708
2721 | ~ parent: 5:4409d547b708
2732 | user: test
2722 | user: test
2733 | date: Thu Jan 01 00:00:06 1970 +0000
2723 | date: Thu Jan 01 00:00:06 1970 +0000
2734 | summary: (6) merge two known; one immediate left, one far left
2724 | summary: (6) merge two known; one immediate left, one far left
2735 |
2725 |
2736 o changeset: 5:4409d547b708
2726 o changeset: 5:4409d547b708
2737 |\ parent: 3:27eef8ed80b4
2727 |\ parent: 3:27eef8ed80b4
2738 | ~ parent: 4:26a8bac39d9f
2728 | ~ parent: 4:26a8bac39d9f
2739 | user: test
2729 | user: test
2740 | date: Thu Jan 01 00:00:05 1970 +0000
2730 | date: Thu Jan 01 00:00:05 1970 +0000
2741 | summary: (5) expand
2731 | summary: (5) expand
2742 |
2732 |
2743 o changeset: 4:26a8bac39d9f
2733 o changeset: 4:26a8bac39d9f
2744 |\ parent: 1:6db2ef61d156
2734 |\ parent: 1:6db2ef61d156
2745 ~ ~ parent: 3:27eef8ed80b4
2735 ~ ~ parent: 3:27eef8ed80b4
2746 user: test
2736 user: test
2747 date: Thu Jan 01 00:00:04 1970 +0000
2737 date: Thu Jan 01 00:00:04 1970 +0000
2748 summary: (4) merge two known; one immediate left, one immediate right
2738 summary: (4) merge two known; one immediate left, one immediate right
2749
2739
2750
2740
2751 Setting HGPLAIN ignores graphmod styling:
2741 Setting HGPLAIN ignores graphmod styling:
2752
2742
2753 $ HGPLAIN=1 hg log -G -r 'file("a")' -m
2743 $ HGPLAIN=1 hg log -G -r 'file("a")' -m
2754 @ changeset: 36:08a19a744424
2744 @ changeset: 36:08a19a744424
2755 | branch: branch
2745 | branch: branch
2756 | tag: tip
2746 | tag: tip
2757 | parent: 35:9159c3644c5e
2747 | parent: 35:9159c3644c5e
2758 | parent: 35:9159c3644c5e
2748 | parent: 35:9159c3644c5e
2759 | user: test
2749 | user: test
2760 | date: Thu Jan 01 00:00:36 1970 +0000
2750 | date: Thu Jan 01 00:00:36 1970 +0000
2761 | summary: (36) buggy merge: identical parents
2751 | summary: (36) buggy merge: identical parents
2762 |
2752 |
2763 o changeset: 32:d06dffa21a31
2753 o changeset: 32:d06dffa21a31
2764 |\ parent: 27:886ed638191b
2754 |\ parent: 27:886ed638191b
2765 | | parent: 31:621d83e11f67
2755 | | parent: 31:621d83e11f67
2766 | | user: test
2756 | | user: test
2767 | | date: Thu Jan 01 00:00:32 1970 +0000
2757 | | date: Thu Jan 01 00:00:32 1970 +0000
2768 | | summary: (32) expand
2758 | | summary: (32) expand
2769 | |
2759 | |
2770 o | changeset: 31:621d83e11f67
2760 o | changeset: 31:621d83e11f67
2771 |\| parent: 21:d42a756af44d
2761 |\| parent: 21:d42a756af44d
2772 | | parent: 30:6e11cd4b648f
2762 | | parent: 30:6e11cd4b648f
2773 | | user: test
2763 | | user: test
2774 | | date: Thu Jan 01 00:00:31 1970 +0000
2764 | | date: Thu Jan 01 00:00:31 1970 +0000
2775 | | summary: (31) expand
2765 | | summary: (31) expand
2776 | |
2766 | |
2777 o | changeset: 30:6e11cd4b648f
2767 o | changeset: 30:6e11cd4b648f
2778 |\ \ parent: 28:44ecd0b9ae99
2768 |\ \ parent: 28:44ecd0b9ae99
2779 | | | parent: 29:cd9bb2be7593
2769 | | | parent: 29:cd9bb2be7593
2780 | | | user: test
2770 | | | user: test
2781 | | | date: Thu Jan 01 00:00:30 1970 +0000
2771 | | | date: Thu Jan 01 00:00:30 1970 +0000
2782 | | | summary: (30) expand
2772 | | | summary: (30) expand
2783 | | |
2773 | | |
2784 o | | changeset: 28:44ecd0b9ae99
2774 o | | changeset: 28:44ecd0b9ae99
2785 |\ \ \ parent: 1:6db2ef61d156
2775 |\ \ \ parent: 1:6db2ef61d156
2786 | | | | parent: 26:7f25b6c2f0b9
2776 | | | | parent: 26:7f25b6c2f0b9
2787 | | | | user: test
2777 | | | | user: test
2788 | | | | date: Thu Jan 01 00:00:28 1970 +0000
2778 | | | | date: Thu Jan 01 00:00:28 1970 +0000
2789 | | | | summary: (28) merge zero known
2779 | | | | summary: (28) merge zero known
2790 | | | |
2780 | | | |
2791 o | | | changeset: 26:7f25b6c2f0b9
2781 o | | | changeset: 26:7f25b6c2f0b9
2792 |\ \ \ \ parent: 18:1aa84d96232a
2782 |\ \ \ \ parent: 18:1aa84d96232a
2793 | | | | | parent: 25:91da8ed57247
2783 | | | | | parent: 25:91da8ed57247
2794 | | | | | user: test
2784 | | | | | user: test
2795 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
2785 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
2796 | | | | | summary: (26) merge one known; far right
2786 | | | | | summary: (26) merge one known; far right
2797 | | | | |
2787 | | | | |
2798 | o-----+ changeset: 25:91da8ed57247
2788 | o-----+ changeset: 25:91da8ed57247
2799 | | | | | parent: 21:d42a756af44d
2789 | | | | | parent: 21:d42a756af44d
2800 | | | | | parent: 24:a9c19a3d96b7
2790 | | | | | parent: 24:a9c19a3d96b7
2801 | | | | | user: test
2791 | | | | | user: test
2802 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
2792 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
2803 | | | | | summary: (25) merge one known; far left
2793 | | | | | summary: (25) merge one known; far left
2804 | | | | |
2794 | | | | |
2805 | o | | | changeset: 24:a9c19a3d96b7
2795 | o | | | changeset: 24:a9c19a3d96b7
2806 | |\ \ \ \ parent: 0:e6eb3150255d
2796 | |\ \ \ \ parent: 0:e6eb3150255d
2807 | | | | | | parent: 23:a01cddf0766d
2797 | | | | | | parent: 23:a01cddf0766d
2808 | | | | | | user: test
2798 | | | | | | user: test
2809 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
2799 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
2810 | | | | | | summary: (24) merge one known; immediate right
2800 | | | | | | summary: (24) merge one known; immediate right
2811 | | | | | |
2801 | | | | | |
2812 | o---+ | | changeset: 23:a01cddf0766d
2802 | o---+ | | changeset: 23:a01cddf0766d
2813 | | | | | | parent: 1:6db2ef61d156
2803 | | | | | | parent: 1:6db2ef61d156
2814 | | | | | | parent: 22:e0d9cccacb5d
2804 | | | | | | parent: 22:e0d9cccacb5d
2815 | | | | | | user: test
2805 | | | | | | user: test
2816 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
2806 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
2817 | | | | | | summary: (23) merge one known; immediate left
2807 | | | | | | summary: (23) merge one known; immediate left
2818 | | | | | |
2808 | | | | | |
2819 | o-------+ changeset: 22:e0d9cccacb5d
2809 | o-------+ changeset: 22:e0d9cccacb5d
2820 | | | | | | parent: 18:1aa84d96232a
2810 | | | | | | parent: 18:1aa84d96232a
2821 |/ / / / / parent: 21:d42a756af44d
2811 |/ / / / / parent: 21:d42a756af44d
2822 | | | | | user: test
2812 | | | | | user: test
2823 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
2813 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
2824 | | | | | summary: (22) merge two known; one far left, one far right
2814 | | | | | summary: (22) merge two known; one far left, one far right
2825 | | | | |
2815 | | | | |
2826 | | | | o changeset: 21:d42a756af44d
2816 | | | | o changeset: 21:d42a756af44d
2827 | | | | |\ parent: 19:31ddc2c1573b
2817 | | | | |\ parent: 19:31ddc2c1573b
2828 | | | | | | parent: 20:d30ed6450e32
2818 | | | | | | parent: 20:d30ed6450e32
2829 | | | | | | user: test
2819 | | | | | | user: test
2830 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
2820 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
2831 | | | | | | summary: (21) expand
2821 | | | | | | summary: (21) expand
2832 | | | | | |
2822 | | | | | |
2833 +-+-------o changeset: 20:d30ed6450e32
2823 +-+-------o changeset: 20:d30ed6450e32
2834 | | | | | parent: 0:e6eb3150255d
2824 | | | | | parent: 0:e6eb3150255d
2835 | | | | | parent: 18:1aa84d96232a
2825 | | | | | parent: 18:1aa84d96232a
2836 | | | | | user: test
2826 | | | | | user: test
2837 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
2827 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
2838 | | | | | summary: (20) merge two known; two far right
2828 | | | | | summary: (20) merge two known; two far right
2839 | | | | |
2829 | | | | |
2840 | | | | o changeset: 19:31ddc2c1573b
2830 | | | | o changeset: 19:31ddc2c1573b
2841 | | | | |\ parent: 15:1dda3f72782d
2831 | | | | |\ parent: 15:1dda3f72782d
2842 | | | | | | parent: 17:44765d7c06e0
2832 | | | | | | parent: 17:44765d7c06e0
2843 | | | | | | user: test
2833 | | | | | | user: test
2844 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
2834 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
2845 | | | | | | summary: (19) expand
2835 | | | | | | summary: (19) expand
2846 | | | | | |
2836 | | | | | |
2847 o---+---+ | changeset: 18:1aa84d96232a
2837 o---+---+ | changeset: 18:1aa84d96232a
2848 | | | | | parent: 1:6db2ef61d156
2838 | | | | | parent: 1:6db2ef61d156
2849 / / / / / parent: 15:1dda3f72782d
2839 / / / / / parent: 15:1dda3f72782d
2850 | | | | | user: test
2840 | | | | | user: test
2851 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
2841 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
2852 | | | | | summary: (18) merge two known; two far left
2842 | | | | | summary: (18) merge two known; two far left
2853 | | | | |
2843 | | | | |
2854 | | | | o changeset: 17:44765d7c06e0
2844 | | | | o changeset: 17:44765d7c06e0
2855 | | | | |\ parent: 12:86b91144a6e9
2845 | | | | |\ parent: 12:86b91144a6e9
2856 | | | | | | parent: 16:3677d192927d
2846 | | | | | | parent: 16:3677d192927d
2857 | | | | | | user: test
2847 | | | | | | user: test
2858 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
2848 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
2859 | | | | | | summary: (17) expand
2849 | | | | | | summary: (17) expand
2860 | | | | | |
2850 | | | | | |
2861 +-+-------o changeset: 16:3677d192927d
2851 +-+-------o changeset: 16:3677d192927d
2862 | | | | | parent: 0:e6eb3150255d
2852 | | | | | parent: 0:e6eb3150255d
2863 | | | | | parent: 1:6db2ef61d156
2853 | | | | | parent: 1:6db2ef61d156
2864 | | | | | user: test
2854 | | | | | user: test
2865 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
2855 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
2866 | | | | | summary: (16) merge two known; one immediate right, one near right
2856 | | | | | summary: (16) merge two known; one immediate right, one near right
2867 | | | | |
2857 | | | | |
2868 | | | o | changeset: 15:1dda3f72782d
2858 | | | o | changeset: 15:1dda3f72782d
2869 | | | |\ \ parent: 13:22d8966a97e3
2859 | | | |\ \ parent: 13:22d8966a97e3
2870 | | | | | | parent: 14:8eac370358ef
2860 | | | | | | parent: 14:8eac370358ef
2871 | | | | | | user: test
2861 | | | | | | user: test
2872 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
2862 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
2873 | | | | | | summary: (15) expand
2863 | | | | | | summary: (15) expand
2874 | | | | | |
2864 | | | | | |
2875 +-------o | changeset: 14:8eac370358ef
2865 +-------o | changeset: 14:8eac370358ef
2876 | | | | |/ parent: 0:e6eb3150255d
2866 | | | | |/ parent: 0:e6eb3150255d
2877 | | | | | parent: 12:86b91144a6e9
2867 | | | | | parent: 12:86b91144a6e9
2878 | | | | | user: test
2868 | | | | | user: test
2879 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
2869 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
2880 | | | | | summary: (14) merge two known; one immediate right, one far right
2870 | | | | | summary: (14) merge two known; one immediate right, one far right
2881 | | | | |
2871 | | | | |
2882 | | | o | changeset: 13:22d8966a97e3
2872 | | | o | changeset: 13:22d8966a97e3
2883 | | | |\ \ parent: 9:7010c0af0a35
2873 | | | |\ \ parent: 9:7010c0af0a35
2884 | | | | | | parent: 11:832d76e6bdf2
2874 | | | | | | parent: 11:832d76e6bdf2
2885 | | | | | | user: test
2875 | | | | | | user: test
2886 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
2876 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
2887 | | | | | | summary: (13) expand
2877 | | | | | | summary: (13) expand
2888 | | | | | |
2878 | | | | | |
2889 | +---+---o changeset: 12:86b91144a6e9
2879 | +---+---o changeset: 12:86b91144a6e9
2890 | | | | | parent: 1:6db2ef61d156
2880 | | | | | parent: 1:6db2ef61d156
2891 | | | | | parent: 9:7010c0af0a35
2881 | | | | | parent: 9:7010c0af0a35
2892 | | | | | user: test
2882 | | | | | user: test
2893 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
2883 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
2894 | | | | | summary: (12) merge two known; one immediate right, one far left
2884 | | | | | summary: (12) merge two known; one immediate right, one far left
2895 | | | | |
2885 | | | | |
2896 | | | | o changeset: 11:832d76e6bdf2
2886 | | | | o changeset: 11:832d76e6bdf2
2897 | | | | |\ parent: 6:b105a072e251
2887 | | | | |\ parent: 6:b105a072e251
2898 | | | | | | parent: 10:74c64d036d72
2888 | | | | | | parent: 10:74c64d036d72
2899 | | | | | | user: test
2889 | | | | | | user: test
2900 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
2890 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
2901 | | | | | | summary: (11) expand
2891 | | | | | | summary: (11) expand
2902 | | | | | |
2892 | | | | | |
2903 +---------o changeset: 10:74c64d036d72
2893 +---------o changeset: 10:74c64d036d72
2904 | | | | |/ parent: 0:e6eb3150255d
2894 | | | | |/ parent: 0:e6eb3150255d
2905 | | | | | parent: 6:b105a072e251
2895 | | | | | parent: 6:b105a072e251
2906 | | | | | user: test
2896 | | | | | user: test
2907 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
2897 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
2908 | | | | | summary: (10) merge two known; one immediate left, one near right
2898 | | | | | summary: (10) merge two known; one immediate left, one near right
2909 | | | | |
2899 | | | | |
2910 | | | o | changeset: 9:7010c0af0a35
2900 | | | o | changeset: 9:7010c0af0a35
2911 | | | |\ \ parent: 7:b632bb1b1224
2901 | | | |\ \ parent: 7:b632bb1b1224
2912 | | | | | | parent: 8:7a0b11f71937
2902 | | | | | | parent: 8:7a0b11f71937
2913 | | | | | | user: test
2903 | | | | | | user: test
2914 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
2904 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
2915 | | | | | | summary: (9) expand
2905 | | | | | | summary: (9) expand
2916 | | | | | |
2906 | | | | | |
2917 +-------o | changeset: 8:7a0b11f71937
2907 +-------o | changeset: 8:7a0b11f71937
2918 | | | |/ / parent: 0:e6eb3150255d
2908 | | | |/ / parent: 0:e6eb3150255d
2919 | | | | | parent: 7:b632bb1b1224
2909 | | | | | parent: 7:b632bb1b1224
2920 | | | | | user: test
2910 | | | | | user: test
2921 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
2911 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
2922 | | | | | summary: (8) merge two known; one immediate left, one far right
2912 | | | | | summary: (8) merge two known; one immediate left, one far right
2923 | | | | |
2913 | | | | |
2924 | | | o | changeset: 7:b632bb1b1224
2914 | | | o | changeset: 7:b632bb1b1224
2925 | | | |\ \ parent: 2:3d9a33b8d1e1
2915 | | | |\ \ parent: 2:3d9a33b8d1e1
2926 | | | | | | parent: 5:4409d547b708
2916 | | | | | | parent: 5:4409d547b708
2927 | | | | | | user: test
2917 | | | | | | user: test
2928 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
2918 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
2929 | | | | | | summary: (7) expand
2919 | | | | | | summary: (7) expand
2930 | | | | | |
2920 | | | | | |
2931 | | | +---o changeset: 6:b105a072e251
2921 | | | +---o changeset: 6:b105a072e251
2932 | | | | |/ parent: 2:3d9a33b8d1e1
2922 | | | | |/ parent: 2:3d9a33b8d1e1
2933 | | | | | parent: 5:4409d547b708
2923 | | | | | parent: 5:4409d547b708
2934 | | | | | user: test
2924 | | | | | user: test
2935 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
2925 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
2936 | | | | | summary: (6) merge two known; one immediate left, one far left
2926 | | | | | summary: (6) merge two known; one immediate left, one far left
2937 | | | | |
2927 | | | | |
2938 | | | o | changeset: 5:4409d547b708
2928 | | | o | changeset: 5:4409d547b708
2939 | | | |\ \ parent: 3:27eef8ed80b4
2929 | | | |\ \ parent: 3:27eef8ed80b4
2940 | | | | | | parent: 4:26a8bac39d9f
2930 | | | | | | parent: 4:26a8bac39d9f
2941 | | | | | | user: test
2931 | | | | | | user: test
2942 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
2932 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
2943 | | | | | | summary: (5) expand
2933 | | | | | | summary: (5) expand
2944 | | | | | |
2934 | | | | | |
2945 | +---o | | changeset: 4:26a8bac39d9f
2935 | +---o | | changeset: 4:26a8bac39d9f
2946 | | | |/ / parent: 1:6db2ef61d156
2936 | | | |/ / parent: 1:6db2ef61d156
2947 | | | | | parent: 3:27eef8ed80b4
2937 | | | | | parent: 3:27eef8ed80b4
2948 | | | | | user: test
2938 | | | | | user: test
2949 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
2939 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
2950 | | | | | summary: (4) merge two known; one immediate left, one immediate right
2940 | | | | | summary: (4) merge two known; one immediate left, one immediate right
2951 | | | | |
2941 | | | | |
2952
2942
2953 .. unless HGPLAINEXCEPT=graph is set:
2943 .. unless HGPLAINEXCEPT=graph is set:
2954
2944
2955 $ HGPLAIN=1 HGPLAINEXCEPT=graph hg log -G -r 'file("a")' -m
2945 $ HGPLAIN=1 HGPLAINEXCEPT=graph hg log -G -r 'file("a")' -m
2956 @ changeset: 36:08a19a744424
2946 @ changeset: 36:08a19a744424
2957 : branch: branch
2947 : branch: branch
2958 : tag: tip
2948 : tag: tip
2959 : parent: 35:9159c3644c5e
2949 : parent: 35:9159c3644c5e
2960 : parent: 35:9159c3644c5e
2950 : parent: 35:9159c3644c5e
2961 : user: test
2951 : user: test
2962 : date: Thu Jan 01 00:00:36 1970 +0000
2952 : date: Thu Jan 01 00:00:36 1970 +0000
2963 : summary: (36) buggy merge: identical parents
2953 : summary: (36) buggy merge: identical parents
2964 :
2954 :
2965 o changeset: 32:d06dffa21a31
2955 o changeset: 32:d06dffa21a31
2966 |\ parent: 27:886ed638191b
2956 |\ parent: 27:886ed638191b
2967 | : parent: 31:621d83e11f67
2957 | : parent: 31:621d83e11f67
2968 | : user: test
2958 | : user: test
2969 | : date: Thu Jan 01 00:00:32 1970 +0000
2959 | : date: Thu Jan 01 00:00:32 1970 +0000
2970 | : summary: (32) expand
2960 | : summary: (32) expand
2971 | :
2961 | :
2972 o : changeset: 31:621d83e11f67
2962 o : changeset: 31:621d83e11f67
2973 |\: parent: 21:d42a756af44d
2963 |\: parent: 21:d42a756af44d
2974 | : parent: 30:6e11cd4b648f
2964 | : parent: 30:6e11cd4b648f
2975 | : user: test
2965 | : user: test
2976 | : date: Thu Jan 01 00:00:31 1970 +0000
2966 | : date: Thu Jan 01 00:00:31 1970 +0000
2977 | : summary: (31) expand
2967 | : summary: (31) expand
2978 | :
2968 | :
2979 o : changeset: 30:6e11cd4b648f
2969 o : changeset: 30:6e11cd4b648f
2980 |\ \ parent: 28:44ecd0b9ae99
2970 |\ \ parent: 28:44ecd0b9ae99
2981 | ~ : parent: 29:cd9bb2be7593
2971 | ~ : parent: 29:cd9bb2be7593
2982 | : user: test
2972 | : user: test
2983 | : date: Thu Jan 01 00:00:30 1970 +0000
2973 | : date: Thu Jan 01 00:00:30 1970 +0000
2984 | : summary: (30) expand
2974 | : summary: (30) expand
2985 | /
2975 | /
2986 o : changeset: 28:44ecd0b9ae99
2976 o : changeset: 28:44ecd0b9ae99
2987 |\ \ parent: 1:6db2ef61d156
2977 |\ \ parent: 1:6db2ef61d156
2988 | ~ : parent: 26:7f25b6c2f0b9
2978 | ~ : parent: 26:7f25b6c2f0b9
2989 | : user: test
2979 | : user: test
2990 | : date: Thu Jan 01 00:00:28 1970 +0000
2980 | : date: Thu Jan 01 00:00:28 1970 +0000
2991 | : summary: (28) merge zero known
2981 | : summary: (28) merge zero known
2992 | /
2982 | /
2993 o : changeset: 26:7f25b6c2f0b9
2983 o : changeset: 26:7f25b6c2f0b9
2994 |\ \ parent: 18:1aa84d96232a
2984 |\ \ parent: 18:1aa84d96232a
2995 | | : parent: 25:91da8ed57247
2985 | | : parent: 25:91da8ed57247
2996 | | : user: test
2986 | | : user: test
2997 | | : date: Thu Jan 01 00:00:26 1970 +0000
2987 | | : date: Thu Jan 01 00:00:26 1970 +0000
2998 | | : summary: (26) merge one known; far right
2988 | | : summary: (26) merge one known; far right
2999 | | :
2989 | | :
3000 | o : changeset: 25:91da8ed57247
2990 | o : changeset: 25:91da8ed57247
3001 | |\: parent: 21:d42a756af44d
2991 | |\: parent: 21:d42a756af44d
3002 | | : parent: 24:a9c19a3d96b7
2992 | | : parent: 24:a9c19a3d96b7
3003 | | : user: test
2993 | | : user: test
3004 | | : date: Thu Jan 01 00:00:25 1970 +0000
2994 | | : date: Thu Jan 01 00:00:25 1970 +0000
3005 | | : summary: (25) merge one known; far left
2995 | | : summary: (25) merge one known; far left
3006 | | :
2996 | | :
3007 | o : changeset: 24:a9c19a3d96b7
2997 | o : changeset: 24:a9c19a3d96b7
3008 | |\ \ parent: 0:e6eb3150255d
2998 | |\ \ parent: 0:e6eb3150255d
3009 | | ~ : parent: 23:a01cddf0766d
2999 | | ~ : parent: 23:a01cddf0766d
3010 | | : user: test
3000 | | : user: test
3011 | | : date: Thu Jan 01 00:00:24 1970 +0000
3001 | | : date: Thu Jan 01 00:00:24 1970 +0000
3012 | | : summary: (24) merge one known; immediate right
3002 | | : summary: (24) merge one known; immediate right
3013 | | /
3003 | | /
3014 | o : changeset: 23:a01cddf0766d
3004 | o : changeset: 23:a01cddf0766d
3015 | |\ \ parent: 1:6db2ef61d156
3005 | |\ \ parent: 1:6db2ef61d156
3016 | | ~ : parent: 22:e0d9cccacb5d
3006 | | ~ : parent: 22:e0d9cccacb5d
3017 | | : user: test
3007 | | : user: test
3018 | | : date: Thu Jan 01 00:00:23 1970 +0000
3008 | | : date: Thu Jan 01 00:00:23 1970 +0000
3019 | | : summary: (23) merge one known; immediate left
3009 | | : summary: (23) merge one known; immediate left
3020 | | /
3010 | | /
3021 | o : changeset: 22:e0d9cccacb5d
3011 | o : changeset: 22:e0d9cccacb5d
3022 |/:/ parent: 18:1aa84d96232a
3012 |/:/ parent: 18:1aa84d96232a
3023 | : parent: 21:d42a756af44d
3013 | : parent: 21:d42a756af44d
3024 | : user: test
3014 | : user: test
3025 | : date: Thu Jan 01 00:00:22 1970 +0000
3015 | : date: Thu Jan 01 00:00:22 1970 +0000
3026 | : summary: (22) merge two known; one far left, one far right
3016 | : summary: (22) merge two known; one far left, one far right
3027 | :
3017 | :
3028 | o changeset: 21:d42a756af44d
3018 | o changeset: 21:d42a756af44d
3029 | |\ parent: 19:31ddc2c1573b
3019 | |\ parent: 19:31ddc2c1573b
3030 | | | parent: 20:d30ed6450e32
3020 | | | parent: 20:d30ed6450e32
3031 | | | user: test
3021 | | | user: test
3032 | | | date: Thu Jan 01 00:00:21 1970 +0000
3022 | | | date: Thu Jan 01 00:00:21 1970 +0000
3033 | | | summary: (21) expand
3023 | | | summary: (21) expand
3034 | | |
3024 | | |
3035 +---o changeset: 20:d30ed6450e32
3025 +---o changeset: 20:d30ed6450e32
3036 | | | parent: 0:e6eb3150255d
3026 | | | parent: 0:e6eb3150255d
3037 | | ~ parent: 18:1aa84d96232a
3027 | | ~ parent: 18:1aa84d96232a
3038 | | user: test
3028 | | user: test
3039 | | date: Thu Jan 01 00:00:20 1970 +0000
3029 | | date: Thu Jan 01 00:00:20 1970 +0000
3040 | | summary: (20) merge two known; two far right
3030 | | summary: (20) merge two known; two far right
3041 | |
3031 | |
3042 | o changeset: 19:31ddc2c1573b
3032 | o changeset: 19:31ddc2c1573b
3043 | |\ parent: 15:1dda3f72782d
3033 | |\ parent: 15:1dda3f72782d
3044 | | | parent: 17:44765d7c06e0
3034 | | | parent: 17:44765d7c06e0
3045 | | | user: test
3035 | | | user: test
3046 | | | date: Thu Jan 01 00:00:19 1970 +0000
3036 | | | date: Thu Jan 01 00:00:19 1970 +0000
3047 | | | summary: (19) expand
3037 | | | summary: (19) expand
3048 | | |
3038 | | |
3049 o | | changeset: 18:1aa84d96232a
3039 o | | changeset: 18:1aa84d96232a
3050 |\| | parent: 1:6db2ef61d156
3040 |\| | parent: 1:6db2ef61d156
3051 ~ | | parent: 15:1dda3f72782d
3041 ~ | | parent: 15:1dda3f72782d
3052 | | user: test
3042 | | user: test
3053 | | date: Thu Jan 01 00:00:18 1970 +0000
3043 | | date: Thu Jan 01 00:00:18 1970 +0000
3054 | | summary: (18) merge two known; two far left
3044 | | summary: (18) merge two known; two far left
3055 / /
3045 / /
3056 | o changeset: 17:44765d7c06e0
3046 | o changeset: 17:44765d7c06e0
3057 | |\ parent: 12:86b91144a6e9
3047 | |\ parent: 12:86b91144a6e9
3058 | | | parent: 16:3677d192927d
3048 | | | parent: 16:3677d192927d
3059 | | | user: test
3049 | | | user: test
3060 | | | date: Thu Jan 01 00:00:17 1970 +0000
3050 | | | date: Thu Jan 01 00:00:17 1970 +0000
3061 | | | summary: (17) expand
3051 | | | summary: (17) expand
3062 | | |
3052 | | |
3063 | | o changeset: 16:3677d192927d
3053 | | o changeset: 16:3677d192927d
3064 | | |\ parent: 0:e6eb3150255d
3054 | | |\ parent: 0:e6eb3150255d
3065 | | ~ ~ parent: 1:6db2ef61d156
3055 | | ~ ~ parent: 1:6db2ef61d156
3066 | | user: test
3056 | | user: test
3067 | | date: Thu Jan 01 00:00:16 1970 +0000
3057 | | date: Thu Jan 01 00:00:16 1970 +0000
3068 | | summary: (16) merge two known; one immediate right, one near right
3058 | | summary: (16) merge two known; one immediate right, one near right
3069 | |
3059 | |
3070 o | changeset: 15:1dda3f72782d
3060 o | changeset: 15:1dda3f72782d
3071 |\ \ parent: 13:22d8966a97e3
3061 |\ \ parent: 13:22d8966a97e3
3072 | | | parent: 14:8eac370358ef
3062 | | | parent: 14:8eac370358ef
3073 | | | user: test
3063 | | | user: test
3074 | | | date: Thu Jan 01 00:00:15 1970 +0000
3064 | | | date: Thu Jan 01 00:00:15 1970 +0000
3075 | | | summary: (15) expand
3065 | | | summary: (15) expand
3076 | | |
3066 | | |
3077 | o | changeset: 14:8eac370358ef
3067 | o | changeset: 14:8eac370358ef
3078 | |\| parent: 0:e6eb3150255d
3068 | |\| parent: 0:e6eb3150255d
3079 | ~ | parent: 12:86b91144a6e9
3069 | ~ | parent: 12:86b91144a6e9
3080 | | user: test
3070 | | user: test
3081 | | date: Thu Jan 01 00:00:14 1970 +0000
3071 | | date: Thu Jan 01 00:00:14 1970 +0000
3082 | | summary: (14) merge two known; one immediate right, one far right
3072 | | summary: (14) merge two known; one immediate right, one far right
3083 | /
3073 | /
3084 o | changeset: 13:22d8966a97e3
3074 o | changeset: 13:22d8966a97e3
3085 |\ \ parent: 9:7010c0af0a35
3075 |\ \ parent: 9:7010c0af0a35
3086 | | | parent: 11:832d76e6bdf2
3076 | | | parent: 11:832d76e6bdf2
3087 | | | user: test
3077 | | | user: test
3088 | | | date: Thu Jan 01 00:00:13 1970 +0000
3078 | | | date: Thu Jan 01 00:00:13 1970 +0000
3089 | | | summary: (13) expand
3079 | | | summary: (13) expand
3090 | | |
3080 | | |
3091 +---o changeset: 12:86b91144a6e9
3081 +---o changeset: 12:86b91144a6e9
3092 | | | parent: 1:6db2ef61d156
3082 | | | parent: 1:6db2ef61d156
3093 | | ~ parent: 9:7010c0af0a35
3083 | | ~ parent: 9:7010c0af0a35
3094 | | user: test
3084 | | user: test
3095 | | date: Thu Jan 01 00:00:12 1970 +0000
3085 | | date: Thu Jan 01 00:00:12 1970 +0000
3096 | | summary: (12) merge two known; one immediate right, one far left
3086 | | summary: (12) merge two known; one immediate right, one far left
3097 | |
3087 | |
3098 | o changeset: 11:832d76e6bdf2
3088 | o changeset: 11:832d76e6bdf2
3099 | |\ parent: 6:b105a072e251
3089 | |\ parent: 6:b105a072e251
3100 | | | parent: 10:74c64d036d72
3090 | | | parent: 10:74c64d036d72
3101 | | | user: test
3091 | | | user: test
3102 | | | date: Thu Jan 01 00:00:11 1970 +0000
3092 | | | date: Thu Jan 01 00:00:11 1970 +0000
3103 | | | summary: (11) expand
3093 | | | summary: (11) expand
3104 | | |
3094 | | |
3105 | | o changeset: 10:74c64d036d72
3095 | | o changeset: 10:74c64d036d72
3106 | |/| parent: 0:e6eb3150255d
3096 | |/| parent: 0:e6eb3150255d
3107 | | ~ parent: 6:b105a072e251
3097 | | ~ parent: 6:b105a072e251
3108 | | user: test
3098 | | user: test
3109 | | date: Thu Jan 01 00:00:10 1970 +0000
3099 | | date: Thu Jan 01 00:00:10 1970 +0000
3110 | | summary: (10) merge two known; one immediate left, one near right
3100 | | summary: (10) merge two known; one immediate left, one near right
3111 | |
3101 | |
3112 o | changeset: 9:7010c0af0a35
3102 o | changeset: 9:7010c0af0a35
3113 |\ \ parent: 7:b632bb1b1224
3103 |\ \ parent: 7:b632bb1b1224
3114 | | | parent: 8:7a0b11f71937
3104 | | | parent: 8:7a0b11f71937
3115 | | | user: test
3105 | | | user: test
3116 | | | date: Thu Jan 01 00:00:09 1970 +0000
3106 | | | date: Thu Jan 01 00:00:09 1970 +0000
3117 | | | summary: (9) expand
3107 | | | summary: (9) expand
3118 | | |
3108 | | |
3119 | o | changeset: 8:7a0b11f71937
3109 | o | changeset: 8:7a0b11f71937
3120 |/| | parent: 0:e6eb3150255d
3110 |/| | parent: 0:e6eb3150255d
3121 | ~ | parent: 7:b632bb1b1224
3111 | ~ | parent: 7:b632bb1b1224
3122 | | user: test
3112 | | user: test
3123 | | date: Thu Jan 01 00:00:08 1970 +0000
3113 | | date: Thu Jan 01 00:00:08 1970 +0000
3124 | | summary: (8) merge two known; one immediate left, one far right
3114 | | summary: (8) merge two known; one immediate left, one far right
3125 | /
3115 | /
3126 o | changeset: 7:b632bb1b1224
3116 o | changeset: 7:b632bb1b1224
3127 |\ \ parent: 2:3d9a33b8d1e1
3117 |\ \ parent: 2:3d9a33b8d1e1
3128 | ~ | parent: 5:4409d547b708
3118 | ~ | parent: 5:4409d547b708
3129 | | user: test
3119 | | user: test
3130 | | date: Thu Jan 01 00:00:07 1970 +0000
3120 | | date: Thu Jan 01 00:00:07 1970 +0000
3131 | | summary: (7) expand
3121 | | summary: (7) expand
3132 | /
3122 | /
3133 | o changeset: 6:b105a072e251
3123 | o changeset: 6:b105a072e251
3134 |/| parent: 2:3d9a33b8d1e1
3124 |/| parent: 2:3d9a33b8d1e1
3135 | ~ parent: 5:4409d547b708
3125 | ~ parent: 5:4409d547b708
3136 | user: test
3126 | user: test
3137 | date: Thu Jan 01 00:00:06 1970 +0000
3127 | date: Thu Jan 01 00:00:06 1970 +0000
3138 | summary: (6) merge two known; one immediate left, one far left
3128 | summary: (6) merge two known; one immediate left, one far left
3139 |
3129 |
3140 o changeset: 5:4409d547b708
3130 o changeset: 5:4409d547b708
3141 |\ parent: 3:27eef8ed80b4
3131 |\ parent: 3:27eef8ed80b4
3142 | ~ parent: 4:26a8bac39d9f
3132 | ~ parent: 4:26a8bac39d9f
3143 | user: test
3133 | user: test
3144 | date: Thu Jan 01 00:00:05 1970 +0000
3134 | date: Thu Jan 01 00:00:05 1970 +0000
3145 | summary: (5) expand
3135 | summary: (5) expand
3146 |
3136 |
3147 o changeset: 4:26a8bac39d9f
3137 o changeset: 4:26a8bac39d9f
3148 |\ parent: 1:6db2ef61d156
3138 |\ parent: 1:6db2ef61d156
3149 ~ ~ parent: 3:27eef8ed80b4
3139 ~ ~ parent: 3:27eef8ed80b4
3150 user: test
3140 user: test
3151 date: Thu Jan 01 00:00:04 1970 +0000
3141 date: Thu Jan 01 00:00:04 1970 +0000
3152 summary: (4) merge two known; one immediate left, one immediate right
3142 summary: (4) merge two known; one immediate left, one immediate right
3153
3143
3154 Draw only part of a grandparent line differently with "<N><char>"; only the
3144 Draw only part of a grandparent line differently with "<N><char>"; only the
3155 last N lines (for positive N) or everything but the first N lines (for
3145 last N lines (for positive N) or everything but the first N lines (for
3156 negative N) along the current node use the style, the rest of the edge uses
3146 negative N) along the current node use the style, the rest of the edge uses
3157 the parent edge styling.
3147 the parent edge styling.
3158
3148
3159 Last 3 lines:
3149 Last 3 lines:
3160
3150
3161 $ cat << EOF >> $HGRCPATH
3151 $ cat << EOF >> $HGRCPATH
3162 > [experimental]
3152 > [experimental]
3163 > graphstyle.parent = !
3153 > graphstyle.parent = !
3164 > graphstyle.grandparent = 3.
3154 > graphstyle.grandparent = 3.
3165 > graphstyle.missing =
3155 > graphstyle.missing =
3166 > EOF
3156 > EOF
3167 $ hg log -G -r '36:18 & file("a")' -m
3157 $ hg log -G -r '36:18 & file("a")' -m
3168 @ changeset: 36:08a19a744424
3158 @ changeset: 36:08a19a744424
3169 ! branch: branch
3159 ! branch: branch
3170 ! tag: tip
3160 ! tag: tip
3171 ! parent: 35:9159c3644c5e
3161 ! parent: 35:9159c3644c5e
3172 ! parent: 35:9159c3644c5e
3162 ! parent: 35:9159c3644c5e
3173 ! user: test
3163 ! user: test
3174 . date: Thu Jan 01 00:00:36 1970 +0000
3164 . date: Thu Jan 01 00:00:36 1970 +0000
3175 . summary: (36) buggy merge: identical parents
3165 . summary: (36) buggy merge: identical parents
3176 .
3166 .
3177 o changeset: 32:d06dffa21a31
3167 o changeset: 32:d06dffa21a31
3178 !\ parent: 27:886ed638191b
3168 !\ parent: 27:886ed638191b
3179 ! ! parent: 31:621d83e11f67
3169 ! ! parent: 31:621d83e11f67
3180 ! ! user: test
3170 ! ! user: test
3181 ! . date: Thu Jan 01 00:00:32 1970 +0000
3171 ! . date: Thu Jan 01 00:00:32 1970 +0000
3182 ! . summary: (32) expand
3172 ! . summary: (32) expand
3183 ! .
3173 ! .
3184 o ! changeset: 31:621d83e11f67
3174 o ! changeset: 31:621d83e11f67
3185 !\! parent: 21:d42a756af44d
3175 !\! parent: 21:d42a756af44d
3186 ! ! parent: 30:6e11cd4b648f
3176 ! ! parent: 30:6e11cd4b648f
3187 ! ! user: test
3177 ! ! user: test
3188 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3178 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3189 ! ! summary: (31) expand
3179 ! ! summary: (31) expand
3190 ! !
3180 ! !
3191 o ! changeset: 30:6e11cd4b648f
3181 o ! changeset: 30:6e11cd4b648f
3192 !\ \ parent: 28:44ecd0b9ae99
3182 !\ \ parent: 28:44ecd0b9ae99
3193 ! ~ ! parent: 29:cd9bb2be7593
3183 ! ~ ! parent: 29:cd9bb2be7593
3194 ! ! user: test
3184 ! ! user: test
3195 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3185 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3196 ! ! summary: (30) expand
3186 ! ! summary: (30) expand
3197 ! /
3187 ! /
3198 o ! changeset: 28:44ecd0b9ae99
3188 o ! changeset: 28:44ecd0b9ae99
3199 !\ \ parent: 1:6db2ef61d156
3189 !\ \ parent: 1:6db2ef61d156
3200 ! ~ ! parent: 26:7f25b6c2f0b9
3190 ! ~ ! parent: 26:7f25b6c2f0b9
3201 ! ! user: test
3191 ! ! user: test
3202 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3192 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3203 ! ! summary: (28) merge zero known
3193 ! ! summary: (28) merge zero known
3204 ! /
3194 ! /
3205 o ! changeset: 26:7f25b6c2f0b9
3195 o ! changeset: 26:7f25b6c2f0b9
3206 !\ \ parent: 18:1aa84d96232a
3196 !\ \ parent: 18:1aa84d96232a
3207 ! ! ! parent: 25:91da8ed57247
3197 ! ! ! parent: 25:91da8ed57247
3208 ! ! ! user: test
3198 ! ! ! user: test
3209 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3199 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3210 ! ! ! summary: (26) merge one known; far right
3200 ! ! ! summary: (26) merge one known; far right
3211 ! ! !
3201 ! ! !
3212 ! o ! changeset: 25:91da8ed57247
3202 ! o ! changeset: 25:91da8ed57247
3213 ! !\! parent: 21:d42a756af44d
3203 ! !\! parent: 21:d42a756af44d
3214 ! ! ! parent: 24:a9c19a3d96b7
3204 ! ! ! parent: 24:a9c19a3d96b7
3215 ! ! ! user: test
3205 ! ! ! user: test
3216 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3206 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3217 ! ! ! summary: (25) merge one known; far left
3207 ! ! ! summary: (25) merge one known; far left
3218 ! ! !
3208 ! ! !
3219 ! o ! changeset: 24:a9c19a3d96b7
3209 ! o ! changeset: 24:a9c19a3d96b7
3220 ! !\ \ parent: 0:e6eb3150255d
3210 ! !\ \ parent: 0:e6eb3150255d
3221 ! ! ~ ! parent: 23:a01cddf0766d
3211 ! ! ~ ! parent: 23:a01cddf0766d
3222 ! ! ! user: test
3212 ! ! ! user: test
3223 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3213 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3224 ! ! ! summary: (24) merge one known; immediate right
3214 ! ! ! summary: (24) merge one known; immediate right
3225 ! ! /
3215 ! ! /
3226 ! o ! changeset: 23:a01cddf0766d
3216 ! o ! changeset: 23:a01cddf0766d
3227 ! !\ \ parent: 1:6db2ef61d156
3217 ! !\ \ parent: 1:6db2ef61d156
3228 ! ! ~ ! parent: 22:e0d9cccacb5d
3218 ! ! ~ ! parent: 22:e0d9cccacb5d
3229 ! ! ! user: test
3219 ! ! ! user: test
3230 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3220 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3231 ! ! ! summary: (23) merge one known; immediate left
3221 ! ! ! summary: (23) merge one known; immediate left
3232 ! ! /
3222 ! ! /
3233 ! o ! changeset: 22:e0d9cccacb5d
3223 ! o ! changeset: 22:e0d9cccacb5d
3234 !/!/ parent: 18:1aa84d96232a
3224 !/!/ parent: 18:1aa84d96232a
3235 ! ! parent: 21:d42a756af44d
3225 ! ! parent: 21:d42a756af44d
3236 ! ! user: test
3226 ! ! user: test
3237 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3227 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3238 ! ! summary: (22) merge two known; one far left, one far right
3228 ! ! summary: (22) merge two known; one far left, one far right
3239 ! !
3229 ! !
3240 ! o changeset: 21:d42a756af44d
3230 ! o changeset: 21:d42a756af44d
3241 ! !\ parent: 19:31ddc2c1573b
3231 ! !\ parent: 19:31ddc2c1573b
3242 ! ! ! parent: 20:d30ed6450e32
3232 ! ! ! parent: 20:d30ed6450e32
3243 ! ! ! user: test
3233 ! ! ! user: test
3244 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3234 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3245 ! ! ! summary: (21) expand
3235 ! ! ! summary: (21) expand
3246 ! ! !
3236 ! ! !
3247 +---o changeset: 20:d30ed6450e32
3237 +---o changeset: 20:d30ed6450e32
3248 ! ! | parent: 0:e6eb3150255d
3238 ! ! | parent: 0:e6eb3150255d
3249 ! ! ~ parent: 18:1aa84d96232a
3239 ! ! ~ parent: 18:1aa84d96232a
3250 ! ! user: test
3240 ! ! user: test
3251 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3241 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3252 ! ! summary: (20) merge two known; two far right
3242 ! ! summary: (20) merge two known; two far right
3253 ! !
3243 ! !
3254 ! o changeset: 19:31ddc2c1573b
3244 ! o changeset: 19:31ddc2c1573b
3255 ! |\ parent: 15:1dda3f72782d
3245 ! |\ parent: 15:1dda3f72782d
3256 ! ~ ~ parent: 17:44765d7c06e0
3246 ! ~ ~ parent: 17:44765d7c06e0
3257 ! user: test
3247 ! user: test
3258 ! date: Thu Jan 01 00:00:19 1970 +0000
3248 ! date: Thu Jan 01 00:00:19 1970 +0000
3259 ! summary: (19) expand
3249 ! summary: (19) expand
3260 !
3250 !
3261 o changeset: 18:1aa84d96232a
3251 o changeset: 18:1aa84d96232a
3262 |\ parent: 1:6db2ef61d156
3252 |\ parent: 1:6db2ef61d156
3263 ~ ~ parent: 15:1dda3f72782d
3253 ~ ~ parent: 15:1dda3f72782d
3264 user: test
3254 user: test
3265 date: Thu Jan 01 00:00:18 1970 +0000
3255 date: Thu Jan 01 00:00:18 1970 +0000
3266 summary: (18) merge two known; two far left
3256 summary: (18) merge two known; two far left
3267
3257
3268 All but the first 3 lines:
3258 All but the first 3 lines:
3269
3259
3270 $ cat << EOF >> $HGRCPATH
3260 $ cat << EOF >> $HGRCPATH
3271 > [experimental]
3261 > [experimental]
3272 > graphstyle.parent = !
3262 > graphstyle.parent = !
3273 > graphstyle.grandparent = -3.
3263 > graphstyle.grandparent = -3.
3274 > graphstyle.missing =
3264 > graphstyle.missing =
3275 > EOF
3265 > EOF
3276 $ hg log -G -r '36:18 & file("a")' -m
3266 $ hg log -G -r '36:18 & file("a")' -m
3277 @ changeset: 36:08a19a744424
3267 @ changeset: 36:08a19a744424
3278 ! branch: branch
3268 ! branch: branch
3279 ! tag: tip
3269 ! tag: tip
3280 . parent: 35:9159c3644c5e
3270 . parent: 35:9159c3644c5e
3281 . parent: 35:9159c3644c5e
3271 . parent: 35:9159c3644c5e
3282 . user: test
3272 . user: test
3283 . date: Thu Jan 01 00:00:36 1970 +0000
3273 . date: Thu Jan 01 00:00:36 1970 +0000
3284 . summary: (36) buggy merge: identical parents
3274 . summary: (36) buggy merge: identical parents
3285 .
3275 .
3286 o changeset: 32:d06dffa21a31
3276 o changeset: 32:d06dffa21a31
3287 !\ parent: 27:886ed638191b
3277 !\ parent: 27:886ed638191b
3288 ! ! parent: 31:621d83e11f67
3278 ! ! parent: 31:621d83e11f67
3289 ! . user: test
3279 ! . user: test
3290 ! . date: Thu Jan 01 00:00:32 1970 +0000
3280 ! . date: Thu Jan 01 00:00:32 1970 +0000
3291 ! . summary: (32) expand
3281 ! . summary: (32) expand
3292 ! .
3282 ! .
3293 o ! changeset: 31:621d83e11f67
3283 o ! changeset: 31:621d83e11f67
3294 !\! parent: 21:d42a756af44d
3284 !\! parent: 21:d42a756af44d
3295 ! ! parent: 30:6e11cd4b648f
3285 ! ! parent: 30:6e11cd4b648f
3296 ! ! user: test
3286 ! ! user: test
3297 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3287 ! ! date: Thu Jan 01 00:00:31 1970 +0000
3298 ! ! summary: (31) expand
3288 ! ! summary: (31) expand
3299 ! !
3289 ! !
3300 o ! changeset: 30:6e11cd4b648f
3290 o ! changeset: 30:6e11cd4b648f
3301 !\ \ parent: 28:44ecd0b9ae99
3291 !\ \ parent: 28:44ecd0b9ae99
3302 ! ~ ! parent: 29:cd9bb2be7593
3292 ! ~ ! parent: 29:cd9bb2be7593
3303 ! ! user: test
3293 ! ! user: test
3304 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3294 ! ! date: Thu Jan 01 00:00:30 1970 +0000
3305 ! ! summary: (30) expand
3295 ! ! summary: (30) expand
3306 ! /
3296 ! /
3307 o ! changeset: 28:44ecd0b9ae99
3297 o ! changeset: 28:44ecd0b9ae99
3308 !\ \ parent: 1:6db2ef61d156
3298 !\ \ parent: 1:6db2ef61d156
3309 ! ~ ! parent: 26:7f25b6c2f0b9
3299 ! ~ ! parent: 26:7f25b6c2f0b9
3310 ! ! user: test
3300 ! ! user: test
3311 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3301 ! ! date: Thu Jan 01 00:00:28 1970 +0000
3312 ! ! summary: (28) merge zero known
3302 ! ! summary: (28) merge zero known
3313 ! /
3303 ! /
3314 o ! changeset: 26:7f25b6c2f0b9
3304 o ! changeset: 26:7f25b6c2f0b9
3315 !\ \ parent: 18:1aa84d96232a
3305 !\ \ parent: 18:1aa84d96232a
3316 ! ! ! parent: 25:91da8ed57247
3306 ! ! ! parent: 25:91da8ed57247
3317 ! ! ! user: test
3307 ! ! ! user: test
3318 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3308 ! ! ! date: Thu Jan 01 00:00:26 1970 +0000
3319 ! ! ! summary: (26) merge one known; far right
3309 ! ! ! summary: (26) merge one known; far right
3320 ! ! !
3310 ! ! !
3321 ! o ! changeset: 25:91da8ed57247
3311 ! o ! changeset: 25:91da8ed57247
3322 ! !\! parent: 21:d42a756af44d
3312 ! !\! parent: 21:d42a756af44d
3323 ! ! ! parent: 24:a9c19a3d96b7
3313 ! ! ! parent: 24:a9c19a3d96b7
3324 ! ! ! user: test
3314 ! ! ! user: test
3325 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3315 ! ! ! date: Thu Jan 01 00:00:25 1970 +0000
3326 ! ! ! summary: (25) merge one known; far left
3316 ! ! ! summary: (25) merge one known; far left
3327 ! ! !
3317 ! ! !
3328 ! o ! changeset: 24:a9c19a3d96b7
3318 ! o ! changeset: 24:a9c19a3d96b7
3329 ! !\ \ parent: 0:e6eb3150255d
3319 ! !\ \ parent: 0:e6eb3150255d
3330 ! ! ~ ! parent: 23:a01cddf0766d
3320 ! ! ~ ! parent: 23:a01cddf0766d
3331 ! ! ! user: test
3321 ! ! ! user: test
3332 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3322 ! ! ! date: Thu Jan 01 00:00:24 1970 +0000
3333 ! ! ! summary: (24) merge one known; immediate right
3323 ! ! ! summary: (24) merge one known; immediate right
3334 ! ! /
3324 ! ! /
3335 ! o ! changeset: 23:a01cddf0766d
3325 ! o ! changeset: 23:a01cddf0766d
3336 ! !\ \ parent: 1:6db2ef61d156
3326 ! !\ \ parent: 1:6db2ef61d156
3337 ! ! ~ ! parent: 22:e0d9cccacb5d
3327 ! ! ~ ! parent: 22:e0d9cccacb5d
3338 ! ! ! user: test
3328 ! ! ! user: test
3339 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3329 ! ! ! date: Thu Jan 01 00:00:23 1970 +0000
3340 ! ! ! summary: (23) merge one known; immediate left
3330 ! ! ! summary: (23) merge one known; immediate left
3341 ! ! /
3331 ! ! /
3342 ! o ! changeset: 22:e0d9cccacb5d
3332 ! o ! changeset: 22:e0d9cccacb5d
3343 !/!/ parent: 18:1aa84d96232a
3333 !/!/ parent: 18:1aa84d96232a
3344 ! ! parent: 21:d42a756af44d
3334 ! ! parent: 21:d42a756af44d
3345 ! ! user: test
3335 ! ! user: test
3346 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3336 ! ! date: Thu Jan 01 00:00:22 1970 +0000
3347 ! ! summary: (22) merge two known; one far left, one far right
3337 ! ! summary: (22) merge two known; one far left, one far right
3348 ! !
3338 ! !
3349 ! o changeset: 21:d42a756af44d
3339 ! o changeset: 21:d42a756af44d
3350 ! !\ parent: 19:31ddc2c1573b
3340 ! !\ parent: 19:31ddc2c1573b
3351 ! ! ! parent: 20:d30ed6450e32
3341 ! ! ! parent: 20:d30ed6450e32
3352 ! ! ! user: test
3342 ! ! ! user: test
3353 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3343 ! ! ! date: Thu Jan 01 00:00:21 1970 +0000
3354 ! ! ! summary: (21) expand
3344 ! ! ! summary: (21) expand
3355 ! ! !
3345 ! ! !
3356 +---o changeset: 20:d30ed6450e32
3346 +---o changeset: 20:d30ed6450e32
3357 ! ! | parent: 0:e6eb3150255d
3347 ! ! | parent: 0:e6eb3150255d
3358 ! ! ~ parent: 18:1aa84d96232a
3348 ! ! ~ parent: 18:1aa84d96232a
3359 ! ! user: test
3349 ! ! user: test
3360 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3350 ! ! date: Thu Jan 01 00:00:20 1970 +0000
3361 ! ! summary: (20) merge two known; two far right
3351 ! ! summary: (20) merge two known; two far right
3362 ! !
3352 ! !
3363 ! o changeset: 19:31ddc2c1573b
3353 ! o changeset: 19:31ddc2c1573b
3364 ! |\ parent: 15:1dda3f72782d
3354 ! |\ parent: 15:1dda3f72782d
3365 ! ~ ~ parent: 17:44765d7c06e0
3355 ! ~ ~ parent: 17:44765d7c06e0
3366 ! user: test
3356 ! user: test
3367 ! date: Thu Jan 01 00:00:19 1970 +0000
3357 ! date: Thu Jan 01 00:00:19 1970 +0000
3368 ! summary: (19) expand
3358 ! summary: (19) expand
3369 !
3359 !
3370 o changeset: 18:1aa84d96232a
3360 o changeset: 18:1aa84d96232a
3371 |\ parent: 1:6db2ef61d156
3361 |\ parent: 1:6db2ef61d156
3372 ~ ~ parent: 15:1dda3f72782d
3362 ~ ~ parent: 15:1dda3f72782d
3373 user: test
3363 user: test
3374 date: Thu Jan 01 00:00:18 1970 +0000
3364 date: Thu Jan 01 00:00:18 1970 +0000
3375 summary: (18) merge two known; two far left
3365 summary: (18) merge two known; two far left
3376
3366
3377 $ cd ..
3367 $ cd ..
3378
3368
3379 Change graph shorten, test better with graphstyle.missing not none
3369 Change graph shorten, test better with graphstyle.missing not none
3380
3370
3381 $ cd repo
3371 $ cd repo
3382 $ cat << EOF >> $HGRCPATH
3372 $ cat << EOF >> $HGRCPATH
3383 > [experimental]
3373 > [experimental]
3384 > graphstyle.parent = |
3374 > graphstyle.parent = |
3385 > graphstyle.grandparent = :
3375 > graphstyle.grandparent = :
3386 > graphstyle.missing = '
3376 > graphstyle.missing = '
3387 > graphshorten = true
3377 > graphshorten = true
3388 > EOF
3378 > EOF
3389 $ hg log -G -r 'file("a")' -m -T '{rev} {desc}'
3379 $ hg log -G -r 'file("a")' -m -T '{rev} {desc}'
3390 @ 36 (36) buggy merge: identical parents
3380 @ 36 (36) buggy merge: identical parents
3391 o 32 (32) expand
3381 o 32 (32) expand
3392 |\
3382 |\
3393 o : 31 (31) expand
3383 o : 31 (31) expand
3394 |\:
3384 |\:
3395 o : 30 (30) expand
3385 o : 30 (30) expand
3396 |\ \
3386 |\ \
3397 o \ \ 28 (28) merge zero known
3387 o \ \ 28 (28) merge zero known
3398 |\ \ \
3388 |\ \ \
3399 o \ \ \ 26 (26) merge one known; far right
3389 o \ \ \ 26 (26) merge one known; far right
3400 |\ \ \ \
3390 |\ \ \ \
3401 | o-----+ 25 (25) merge one known; far left
3391 | o-----+ 25 (25) merge one known; far left
3402 | o ' ' : 24 (24) merge one known; immediate right
3392 | o ' ' : 24 (24) merge one known; immediate right
3403 | |\ \ \ \
3393 | |\ \ \ \
3404 | o---+ ' : 23 (23) merge one known; immediate left
3394 | o---+ ' : 23 (23) merge one known; immediate left
3405 | o-------+ 22 (22) merge two known; one far left, one far right
3395 | o-------+ 22 (22) merge two known; one far left, one far right
3406 |/ / / / /
3396 |/ / / / /
3407 | ' ' ' o 21 (21) expand
3397 | ' ' ' o 21 (21) expand
3408 | ' ' ' |\
3398 | ' ' ' |\
3409 +-+-------o 20 (20) merge two known; two far right
3399 +-+-------o 20 (20) merge two known; two far right
3410 | ' ' ' o 19 (19) expand
3400 | ' ' ' o 19 (19) expand
3411 | ' ' ' |\
3401 | ' ' ' |\
3412 o---+---+ | 18 (18) merge two known; two far left
3402 o---+---+ | 18 (18) merge two known; two far left
3413 / / / / /
3403 / / / / /
3414 ' ' ' | o 17 (17) expand
3404 ' ' ' | o 17 (17) expand
3415 ' ' ' | |\
3405 ' ' ' | |\
3416 +-+-------o 16 (16) merge two known; one immediate right, one near right
3406 +-+-------o 16 (16) merge two known; one immediate right, one near right
3417 ' ' ' o | 15 (15) expand
3407 ' ' ' o | 15 (15) expand
3418 ' ' ' |\ \
3408 ' ' ' |\ \
3419 +-------o | 14 (14) merge two known; one immediate right, one far right
3409 +-------o | 14 (14) merge two known; one immediate right, one far right
3420 ' ' ' | |/
3410 ' ' ' | |/
3421 ' ' ' o | 13 (13) expand
3411 ' ' ' o | 13 (13) expand
3422 ' ' ' |\ \
3412 ' ' ' |\ \
3423 ' +---+---o 12 (12) merge two known; one immediate right, one far left
3413 ' +---+---o 12 (12) merge two known; one immediate right, one far left
3424 ' ' ' | o 11 (11) expand
3414 ' ' ' | o 11 (11) expand
3425 ' ' ' | |\
3415 ' ' ' | |\
3426 +---------o 10 (10) merge two known; one immediate left, one near right
3416 +---------o 10 (10) merge two known; one immediate left, one near right
3427 ' ' ' | |/
3417 ' ' ' | |/
3428 ' ' ' o | 9 (9) expand
3418 ' ' ' o | 9 (9) expand
3429 ' ' ' |\ \
3419 ' ' ' |\ \
3430 +-------o | 8 (8) merge two known; one immediate left, one far right
3420 +-------o | 8 (8) merge two known; one immediate left, one far right
3431 ' ' ' |/ /
3421 ' ' ' |/ /
3432 ' ' ' o | 7 (7) expand
3422 ' ' ' o | 7 (7) expand
3433 ' ' ' |\ \
3423 ' ' ' |\ \
3434 ' ' ' +---o 6 (6) merge two known; one immediate left, one far left
3424 ' ' ' +---o 6 (6) merge two known; one immediate left, one far left
3435 ' ' ' | '/
3425 ' ' ' | '/
3436 ' ' ' o ' 5 (5) expand
3426 ' ' ' o ' 5 (5) expand
3437 ' ' ' |\ \
3427 ' ' ' |\ \
3438 ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right
3428 ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right
3439 ' ' ' '/ /
3429 ' ' ' '/ /
3440
3430
3441 behavior with newlines
3431 behavior with newlines
3442
3432
3443 $ hg log -G -r ::2 -T '{rev} {desc}'
3433 $ hg log -G -r ::2 -T '{rev} {desc}'
3444 o 2 (2) collapse
3434 o 2 (2) collapse
3445 o 1 (1) collapse
3435 o 1 (1) collapse
3446 o 0 (0) root
3436 o 0 (0) root
3447
3437
3448 $ hg log -G -r ::2 -T '{rev} {desc}\n'
3438 $ hg log -G -r ::2 -T '{rev} {desc}\n'
3449 o 2 (2) collapse
3439 o 2 (2) collapse
3450 o 1 (1) collapse
3440 o 1 (1) collapse
3451 o 0 (0) root
3441 o 0 (0) root
3452
3442
3453 $ hg log -G -r ::2 -T '{rev} {desc}\n\n'
3443 $ hg log -G -r ::2 -T '{rev} {desc}\n\n'
3454 o 2 (2) collapse
3444 o 2 (2) collapse
3455 |
3445 |
3456 o 1 (1) collapse
3446 o 1 (1) collapse
3457 |
3447 |
3458 o 0 (0) root
3448 o 0 (0) root
3459
3449
3460
3450
3461 $ hg log -G -r ::2 -T '\n{rev} {desc}'
3451 $ hg log -G -r ::2 -T '\n{rev} {desc}'
3462 o
3452 o
3463 | 2 (2) collapse
3453 | 2 (2) collapse
3464 o
3454 o
3465 | 1 (1) collapse
3455 | 1 (1) collapse
3466 o
3456 o
3467 0 (0) root
3457 0 (0) root
3468
3458
3469 $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n'
3459 $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n'
3470 o 2 (2) collapse
3460 o 2 (2) collapse
3471 |
3461 |
3472 |
3462 |
3473 o 1 (1) collapse
3463 o 1 (1) collapse
3474 |
3464 |
3475 |
3465 |
3476 o 0 (0) root
3466 o 0 (0) root
3477
3467
3478
3468
3479 $ cd ..
3469 $ cd ..
3480
3470
3481 When inserting extra line nodes to handle more than 2 parents, ensure that
3471 When inserting extra line nodes to handle more than 2 parents, ensure that
3482 the right node styles are used (issue5174):
3472 the right node styles are used (issue5174):
3483
3473
3484 $ hg init repo-issue5174
3474 $ hg init repo-issue5174
3485 $ cd repo-issue5174
3475 $ cd repo-issue5174
3486 $ echo a > f0
3476 $ echo a > f0
3487 $ hg ci -Aqm 0
3477 $ hg ci -Aqm 0
3488 $ echo a > f1
3478 $ echo a > f1
3489 $ hg ci -Aqm 1
3479 $ hg ci -Aqm 1
3490 $ echo a > f2
3480 $ echo a > f2
3491 $ hg ci -Aqm 2
3481 $ hg ci -Aqm 2
3492 $ hg co ".^"
3482 $ hg co ".^"
3493 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3483 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3494 $ echo a > f3
3484 $ echo a > f3
3495 $ hg ci -Aqm 3
3485 $ hg ci -Aqm 3
3496 $ hg co ".^^"
3486 $ hg co ".^^"
3497 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
3487 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
3498 $ echo a > f4
3488 $ echo a > f4
3499 $ hg ci -Aqm 4
3489 $ hg ci -Aqm 4
3500 $ hg merge -r 2
3490 $ hg merge -r 2
3501 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3491 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3502 (branch merge, don't forget to commit)
3492 (branch merge, don't forget to commit)
3503 $ hg ci -qm 5
3493 $ hg ci -qm 5
3504 $ hg merge -r 3
3494 $ hg merge -r 3
3505 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3495 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3506 (branch merge, don't forget to commit)
3496 (branch merge, don't forget to commit)
3507 $ hg ci -qm 6
3497 $ hg ci -qm 6
3508 $ hg log -G -r '0 | 1 | 2 | 6'
3498 $ hg log -G -r '0 | 1 | 2 | 6'
3509 @ changeset: 6:851fe89689ad
3499 @ changeset: 6:851fe89689ad
3510 :\ tag: tip
3500 :\ tag: tip
3511 : : parent: 5:4f1e3cf15f5d
3501 : : parent: 5:4f1e3cf15f5d
3512 : : parent: 3:b74ba7084d2d
3502 : : parent: 3:b74ba7084d2d
3513 : : user: test
3503 : : user: test
3514 : : date: Thu Jan 01 00:00:00 1970 +0000
3504 : : date: Thu Jan 01 00:00:00 1970 +0000
3515 : : summary: 6
3505 : : summary: 6
3516 : :
3506 : :
3517 : \
3507 : \
3518 : :\
3508 : :\
3519 : o : changeset: 2:3e6599df4cce
3509 : o : changeset: 2:3e6599df4cce
3520 : :/ user: test
3510 : :/ user: test
3521 : : date: Thu Jan 01 00:00:00 1970 +0000
3511 : : date: Thu Jan 01 00:00:00 1970 +0000
3522 : : summary: 2
3512 : : summary: 2
3523 : :
3513 : :
3524 : o changeset: 1:bd9a55143933
3514 : o changeset: 1:bd9a55143933
3525 :/ user: test
3515 :/ user: test
3526 : date: Thu Jan 01 00:00:00 1970 +0000
3516 : date: Thu Jan 01 00:00:00 1970 +0000
3527 : summary: 1
3517 : summary: 1
3528 :
3518 :
3529 o changeset: 0:870a5edc339c
3519 o changeset: 0:870a5edc339c
3530 user: test
3520 user: test
3531 date: Thu Jan 01 00:00:00 1970 +0000
3521 date: Thu Jan 01 00:00:00 1970 +0000
3532 summary: 0
3522 summary: 0
3533
3523
3534
3524
3535 $ cd ..
3525 $ cd ..
3536
3526
3537 Multiple roots (issue5440):
3527 Multiple roots (issue5440):
3538
3528
3539 $ hg init multiroots
3529 $ hg init multiroots
3540 $ cd multiroots
3530 $ cd multiroots
3541 $ cat <<EOF > .hg/hgrc
3531 $ cat <<EOF > .hg/hgrc
3542 > [ui]
3532 > [ui]
3543 > logtemplate = '{rev} {desc}\n\n'
3533 > logtemplate = '{rev} {desc}\n\n'
3544 > EOF
3534 > EOF
3545
3535
3546 $ touch foo
3536 $ touch foo
3547 $ hg ci -Aqm foo
3537 $ hg ci -Aqm foo
3548 $ hg co -q null
3538 $ hg co -q null
3549 $ touch bar
3539 $ touch bar
3550 $ hg ci -Aqm bar
3540 $ hg ci -Aqm bar
3551
3541
3552 $ hg log -Gr null:
3542 $ hg log -Gr null:
3553 @ 1 bar
3543 @ 1 bar
3554 |
3544 |
3555 | o 0 foo
3545 | o 0 foo
3556 |/
3546 |/
3557 o -1
3547 o -1
3558
3548
3559 $ hg log -Gr null+0
3549 $ hg log -Gr null+0
3560 o 0 foo
3550 o 0 foo
3561 |
3551 |
3562 o -1
3552 o -1
3563
3553
3564 $ hg log -Gr null+1
3554 $ hg log -Gr null+1
3565 @ 1 bar
3555 @ 1 bar
3566 |
3556 |
3567 o -1
3557 o -1
3568
3558
3569
3559
3570 $ cd ..
3560 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now