##// END OF EJS Templates
cmdutil: remove the redundant commit during amend...
Saurabh Singh -
r34087:e8a7c1a0 default
parent child Browse files
Show More
@@ -1,3865 +1,3886 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 dirstateguard,
29 dirstateguard,
30 encoding,
30 encoding,
31 error,
31 error,
32 formatter,
32 formatter,
33 graphmod,
33 graphmod,
34 match as matchmod,
34 match as matchmod,
35 obsolete,
35 obsolete,
36 patch,
36 patch,
37 pathutil,
37 pathutil,
38 pycompat,
38 pycompat,
39 registrar,
39 registrar,
40 revlog,
40 revlog,
41 revset,
41 revset,
42 scmutil,
42 scmutil,
43 smartset,
43 smartset,
44 templatekw,
44 templatekw,
45 templater,
45 templater,
46 util,
46 util,
47 vfs as vfsmod,
47 vfs as vfsmod,
48 )
48 )
49 stringio = util.stringio
49 stringio = util.stringio
50
50
51 # templates of common command options
51 # templates of common command options
52
52
53 dryrunopts = [
53 dryrunopts = [
54 ('n', 'dry-run', None,
54 ('n', 'dry-run', None,
55 _('do not perform actions, just print output')),
55 _('do not perform actions, just print output')),
56 ]
56 ]
57
57
58 remoteopts = [
58 remoteopts = [
59 ('e', 'ssh', '',
59 ('e', 'ssh', '',
60 _('specify ssh command to use'), _('CMD')),
60 _('specify ssh command to use'), _('CMD')),
61 ('', 'remotecmd', '',
61 ('', 'remotecmd', '',
62 _('specify hg command to run on the remote side'), _('CMD')),
62 _('specify hg command to run on the remote side'), _('CMD')),
63 ('', 'insecure', None,
63 ('', 'insecure', None,
64 _('do not verify server certificate (ignoring web.cacerts config)')),
64 _('do not verify server certificate (ignoring web.cacerts config)')),
65 ]
65 ]
66
66
67 walkopts = [
67 walkopts = [
68 ('I', 'include', [],
68 ('I', 'include', [],
69 _('include names matching the given patterns'), _('PATTERN')),
69 _('include names matching the given patterns'), _('PATTERN')),
70 ('X', 'exclude', [],
70 ('X', 'exclude', [],
71 _('exclude names matching the given patterns'), _('PATTERN')),
71 _('exclude names matching the given patterns'), _('PATTERN')),
72 ]
72 ]
73
73
74 commitopts = [
74 commitopts = [
75 ('m', 'message', '',
75 ('m', 'message', '',
76 _('use text as commit message'), _('TEXT')),
76 _('use text as commit message'), _('TEXT')),
77 ('l', 'logfile', '',
77 ('l', 'logfile', '',
78 _('read commit message from file'), _('FILE')),
78 _('read commit message from file'), _('FILE')),
79 ]
79 ]
80
80
81 commitopts2 = [
81 commitopts2 = [
82 ('d', 'date', '',
82 ('d', 'date', '',
83 _('record the specified date as commit date'), _('DATE')),
83 _('record the specified date as commit date'), _('DATE')),
84 ('u', 'user', '',
84 ('u', 'user', '',
85 _('record the specified user as committer'), _('USER')),
85 _('record the specified user as committer'), _('USER')),
86 ]
86 ]
87
87
88 # hidden for now
88 # hidden for now
89 formatteropts = [
89 formatteropts = [
90 ('T', 'template', '',
90 ('T', 'template', '',
91 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
91 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
92 ]
92 ]
93
93
94 templateopts = [
94 templateopts = [
95 ('', 'style', '',
95 ('', 'style', '',
96 _('display using template map file (DEPRECATED)'), _('STYLE')),
96 _('display using template map file (DEPRECATED)'), _('STYLE')),
97 ('T', 'template', '',
97 ('T', 'template', '',
98 _('display with template'), _('TEMPLATE')),
98 _('display with template'), _('TEMPLATE')),
99 ]
99 ]
100
100
101 logopts = [
101 logopts = [
102 ('p', 'patch', None, _('show patch')),
102 ('p', 'patch', None, _('show patch')),
103 ('g', 'git', None, _('use git extended diff format')),
103 ('g', 'git', None, _('use git extended diff format')),
104 ('l', 'limit', '',
104 ('l', 'limit', '',
105 _('limit number of changes displayed'), _('NUM')),
105 _('limit number of changes displayed'), _('NUM')),
106 ('M', 'no-merges', None, _('do not show merges')),
106 ('M', 'no-merges', None, _('do not show merges')),
107 ('', 'stat', None, _('output diffstat-style summary of changes')),
107 ('', 'stat', None, _('output diffstat-style summary of changes')),
108 ('G', 'graph', None, _("show the revision DAG")),
108 ('G', 'graph', None, _("show the revision DAG")),
109 ] + templateopts
109 ] + templateopts
110
110
111 diffopts = [
111 diffopts = [
112 ('a', 'text', None, _('treat all files as text')),
112 ('a', 'text', None, _('treat all files as text')),
113 ('g', 'git', None, _('use git extended diff format')),
113 ('g', 'git', None, _('use git extended diff format')),
114 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
114 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
115 ('', 'nodates', None, _('omit dates from diff headers'))
115 ('', 'nodates', None, _('omit dates from diff headers'))
116 ]
116 ]
117
117
118 diffwsopts = [
118 diffwsopts = [
119 ('w', 'ignore-all-space', None,
119 ('w', 'ignore-all-space', None,
120 _('ignore white space when comparing lines')),
120 _('ignore white space when comparing lines')),
121 ('b', 'ignore-space-change', None,
121 ('b', 'ignore-space-change', None,
122 _('ignore changes in the amount of white space')),
122 _('ignore changes in the amount of white space')),
123 ('B', 'ignore-blank-lines', None,
123 ('B', 'ignore-blank-lines', None,
124 _('ignore changes whose lines are all blank')),
124 _('ignore changes whose lines are all blank')),
125 ('Z', 'ignore-space-at-eol', None,
125 ('Z', 'ignore-space-at-eol', None,
126 _('ignore changes in whitespace at EOL')),
126 _('ignore changes in whitespace at EOL')),
127 ]
127 ]
128
128
129 diffopts2 = [
129 diffopts2 = [
130 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
130 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
131 ('p', 'show-function', None, _('show which function each change is in')),
131 ('p', 'show-function', None, _('show which function each change is in')),
132 ('', 'reverse', None, _('produce a diff that undoes the changes')),
132 ('', 'reverse', None, _('produce a diff that undoes the changes')),
133 ] + diffwsopts + [
133 ] + diffwsopts + [
134 ('U', 'unified', '',
134 ('U', 'unified', '',
135 _('number of lines of context to show'), _('NUM')),
135 _('number of lines of context to show'), _('NUM')),
136 ('', 'stat', None, _('output diffstat-style summary of changes')),
136 ('', 'stat', None, _('output diffstat-style summary of changes')),
137 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
137 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
138 ]
138 ]
139
139
140 mergetoolopts = [
140 mergetoolopts = [
141 ('t', 'tool', '', _('specify merge tool')),
141 ('t', 'tool', '', _('specify merge tool')),
142 ]
142 ]
143
143
144 similarityopts = [
144 similarityopts = [
145 ('s', 'similarity', '',
145 ('s', 'similarity', '',
146 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
146 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
147 ]
147 ]
148
148
149 subrepoopts = [
149 subrepoopts = [
150 ('S', 'subrepos', None,
150 ('S', 'subrepos', None,
151 _('recurse into subrepositories'))
151 _('recurse into subrepositories'))
152 ]
152 ]
153
153
154 debugrevlogopts = [
154 debugrevlogopts = [
155 ('c', 'changelog', False, _('open changelog')),
155 ('c', 'changelog', False, _('open changelog')),
156 ('m', 'manifest', False, _('open manifest')),
156 ('m', 'manifest', False, _('open manifest')),
157 ('', 'dir', '', _('open directory manifest')),
157 ('', 'dir', '', _('open directory manifest')),
158 ]
158 ]
159
159
160 # special string such that everything below this line will be ingored in the
160 # special string such that everything below this line will be ingored in the
161 # editor text
161 # editor text
162 _linebelow = "^HG: ------------------------ >8 ------------------------$"
162 _linebelow = "^HG: ------------------------ >8 ------------------------$"
163
163
164 def ishunk(x):
164 def ishunk(x):
165 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
165 hunkclasses = (crecordmod.uihunk, patch.recordhunk)
166 return isinstance(x, hunkclasses)
166 return isinstance(x, hunkclasses)
167
167
168 def newandmodified(chunks, originalchunks):
168 def newandmodified(chunks, originalchunks):
169 newlyaddedandmodifiedfiles = set()
169 newlyaddedandmodifiedfiles = set()
170 for chunk in chunks:
170 for chunk in chunks:
171 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
171 if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \
172 originalchunks:
172 originalchunks:
173 newlyaddedandmodifiedfiles.add(chunk.header.filename())
173 newlyaddedandmodifiedfiles.add(chunk.header.filename())
174 return newlyaddedandmodifiedfiles
174 return newlyaddedandmodifiedfiles
175
175
176 def parsealiases(cmd):
176 def parsealiases(cmd):
177 return cmd.lstrip("^").split("|")
177 return cmd.lstrip("^").split("|")
178
178
179 def setupwrapcolorwrite(ui):
179 def setupwrapcolorwrite(ui):
180 # wrap ui.write so diff output can be labeled/colorized
180 # wrap ui.write so diff output can be labeled/colorized
181 def wrapwrite(orig, *args, **kw):
181 def wrapwrite(orig, *args, **kw):
182 label = kw.pop('label', '')
182 label = kw.pop('label', '')
183 for chunk, l in patch.difflabel(lambda: args):
183 for chunk, l in patch.difflabel(lambda: args):
184 orig(chunk, label=label + l)
184 orig(chunk, label=label + l)
185
185
186 oldwrite = ui.write
186 oldwrite = ui.write
187 def wrap(*args, **kwargs):
187 def wrap(*args, **kwargs):
188 return wrapwrite(oldwrite, *args, **kwargs)
188 return wrapwrite(oldwrite, *args, **kwargs)
189 setattr(ui, 'write', wrap)
189 setattr(ui, 'write', wrap)
190 return oldwrite
190 return oldwrite
191
191
192 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
192 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
193 if usecurses:
193 if usecurses:
194 if testfile:
194 if testfile:
195 recordfn = crecordmod.testdecorator(testfile,
195 recordfn = crecordmod.testdecorator(testfile,
196 crecordmod.testchunkselector)
196 crecordmod.testchunkselector)
197 else:
197 else:
198 recordfn = crecordmod.chunkselector
198 recordfn = crecordmod.chunkselector
199
199
200 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
200 return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
201
201
202 else:
202 else:
203 return patch.filterpatch(ui, originalhunks, operation)
203 return patch.filterpatch(ui, originalhunks, operation)
204
204
205 def recordfilter(ui, originalhunks, operation=None):
205 def recordfilter(ui, originalhunks, operation=None):
206 """ Prompts the user to filter the originalhunks and return a list of
206 """ Prompts the user to filter the originalhunks and return a list of
207 selected hunks.
207 selected hunks.
208 *operation* is used for to build ui messages to indicate the user what
208 *operation* is used for to build ui messages to indicate the user what
209 kind of filtering they are doing: reverting, committing, shelving, etc.
209 kind of filtering they are doing: reverting, committing, shelving, etc.
210 (see patch.filterpatch).
210 (see patch.filterpatch).
211 """
211 """
212 usecurses = crecordmod.checkcurses(ui)
212 usecurses = crecordmod.checkcurses(ui)
213 testfile = ui.config('experimental', 'crecordtest')
213 testfile = ui.config('experimental', 'crecordtest')
214 oldwrite = setupwrapcolorwrite(ui)
214 oldwrite = setupwrapcolorwrite(ui)
215 try:
215 try:
216 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
216 newchunks, newopts = filterchunks(ui, originalhunks, usecurses,
217 testfile, operation)
217 testfile, operation)
218 finally:
218 finally:
219 ui.write = oldwrite
219 ui.write = oldwrite
220 return newchunks, newopts
220 return newchunks, newopts
221
221
222 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
222 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
223 filterfn, *pats, **opts):
223 filterfn, *pats, **opts):
224 from . import merge as mergemod
224 from . import merge as mergemod
225 opts = pycompat.byteskwargs(opts)
225 opts = pycompat.byteskwargs(opts)
226 if not ui.interactive():
226 if not ui.interactive():
227 if cmdsuggest:
227 if cmdsuggest:
228 msg = _('running non-interactively, use %s instead') % cmdsuggest
228 msg = _('running non-interactively, use %s instead') % cmdsuggest
229 else:
229 else:
230 msg = _('running non-interactively')
230 msg = _('running non-interactively')
231 raise error.Abort(msg)
231 raise error.Abort(msg)
232
232
233 # make sure username is set before going interactive
233 # make sure username is set before going interactive
234 if not opts.get('user'):
234 if not opts.get('user'):
235 ui.username() # raise exception, username not provided
235 ui.username() # raise exception, username not provided
236
236
237 def recordfunc(ui, repo, message, match, opts):
237 def recordfunc(ui, repo, message, match, opts):
238 """This is generic record driver.
238 """This is generic record driver.
239
239
240 Its job is to interactively filter local changes, and
240 Its job is to interactively filter local changes, and
241 accordingly prepare working directory into a state in which the
241 accordingly prepare working directory into a state in which the
242 job can be delegated to a non-interactive commit command such as
242 job can be delegated to a non-interactive commit command such as
243 'commit' or 'qrefresh'.
243 'commit' or 'qrefresh'.
244
244
245 After the actual job is done by non-interactive command, the
245 After the actual job is done by non-interactive command, the
246 working directory is restored to its original state.
246 working directory is restored to its original state.
247
247
248 In the end we'll record interesting changes, and everything else
248 In the end we'll record interesting changes, and everything else
249 will be left in place, so the user can continue working.
249 will be left in place, so the user can continue working.
250 """
250 """
251
251
252 checkunfinished(repo, commit=True)
252 checkunfinished(repo, commit=True)
253 wctx = repo[None]
253 wctx = repo[None]
254 merge = len(wctx.parents()) > 1
254 merge = len(wctx.parents()) > 1
255 if merge:
255 if merge:
256 raise error.Abort(_('cannot partially commit a merge '
256 raise error.Abort(_('cannot partially commit a merge '
257 '(use "hg commit" instead)'))
257 '(use "hg commit" instead)'))
258
258
259 def fail(f, msg):
259 def fail(f, msg):
260 raise error.Abort('%s: %s' % (f, msg))
260 raise error.Abort('%s: %s' % (f, msg))
261
261
262 force = opts.get('force')
262 force = opts.get('force')
263 if not force:
263 if not force:
264 vdirs = []
264 vdirs = []
265 match.explicitdir = vdirs.append
265 match.explicitdir = vdirs.append
266 match.bad = fail
266 match.bad = fail
267
267
268 status = repo.status(match=match)
268 status = repo.status(match=match)
269 if not force:
269 if not force:
270 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
270 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
271 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
271 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
272 diffopts.nodates = True
272 diffopts.nodates = True
273 diffopts.git = True
273 diffopts.git = True
274 diffopts.showfunc = True
274 diffopts.showfunc = True
275 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
275 originaldiff = patch.diff(repo, changes=status, opts=diffopts)
276 originalchunks = patch.parsepatch(originaldiff)
276 originalchunks = patch.parsepatch(originaldiff)
277
277
278 # 1. filter patch, since we are intending to apply subset of it
278 # 1. filter patch, since we are intending to apply subset of it
279 try:
279 try:
280 chunks, newopts = filterfn(ui, originalchunks)
280 chunks, newopts = filterfn(ui, originalchunks)
281 except patch.PatchError as err:
281 except patch.PatchError as err:
282 raise error.Abort(_('error parsing patch: %s') % err)
282 raise error.Abort(_('error parsing patch: %s') % err)
283 opts.update(newopts)
283 opts.update(newopts)
284
284
285 # We need to keep a backup of files that have been newly added and
285 # We need to keep a backup of files that have been newly added and
286 # modified during the recording process because there is a previous
286 # modified during the recording process because there is a previous
287 # version without the edit in the workdir
287 # version without the edit in the workdir
288 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
288 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
289 contenders = set()
289 contenders = set()
290 for h in chunks:
290 for h in chunks:
291 try:
291 try:
292 contenders.update(set(h.files()))
292 contenders.update(set(h.files()))
293 except AttributeError:
293 except AttributeError:
294 pass
294 pass
295
295
296 changed = status.modified + status.added + status.removed
296 changed = status.modified + status.added + status.removed
297 newfiles = [f for f in changed if f in contenders]
297 newfiles = [f for f in changed if f in contenders]
298 if not newfiles:
298 if not newfiles:
299 ui.status(_('no changes to record\n'))
299 ui.status(_('no changes to record\n'))
300 return 0
300 return 0
301
301
302 modified = set(status.modified)
302 modified = set(status.modified)
303
303
304 # 2. backup changed files, so we can restore them in the end
304 # 2. backup changed files, so we can restore them in the end
305
305
306 if backupall:
306 if backupall:
307 tobackup = changed
307 tobackup = changed
308 else:
308 else:
309 tobackup = [f for f in newfiles if f in modified or f in \
309 tobackup = [f for f in newfiles if f in modified or f in \
310 newlyaddedandmodifiedfiles]
310 newlyaddedandmodifiedfiles]
311 backups = {}
311 backups = {}
312 if tobackup:
312 if tobackup:
313 backupdir = repo.vfs.join('record-backups')
313 backupdir = repo.vfs.join('record-backups')
314 try:
314 try:
315 os.mkdir(backupdir)
315 os.mkdir(backupdir)
316 except OSError as err:
316 except OSError as err:
317 if err.errno != errno.EEXIST:
317 if err.errno != errno.EEXIST:
318 raise
318 raise
319 try:
319 try:
320 # backup continues
320 # backup continues
321 for f in tobackup:
321 for f in tobackup:
322 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
322 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
323 dir=backupdir)
323 dir=backupdir)
324 os.close(fd)
324 os.close(fd)
325 ui.debug('backup %r as %r\n' % (f, tmpname))
325 ui.debug('backup %r as %r\n' % (f, tmpname))
326 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
326 util.copyfile(repo.wjoin(f), tmpname, copystat=True)
327 backups[f] = tmpname
327 backups[f] = tmpname
328
328
329 fp = stringio()
329 fp = stringio()
330 for c in chunks:
330 for c in chunks:
331 fname = c.filename()
331 fname = c.filename()
332 if fname in backups:
332 if fname in backups:
333 c.write(fp)
333 c.write(fp)
334 dopatch = fp.tell()
334 dopatch = fp.tell()
335 fp.seek(0)
335 fp.seek(0)
336
336
337 # 2.5 optionally review / modify patch in text editor
337 # 2.5 optionally review / modify patch in text editor
338 if opts.get('review', False):
338 if opts.get('review', False):
339 patchtext = (crecordmod.diffhelptext
339 patchtext = (crecordmod.diffhelptext
340 + crecordmod.patchhelptext
340 + crecordmod.patchhelptext
341 + fp.read())
341 + fp.read())
342 reviewedpatch = ui.edit(patchtext, "",
342 reviewedpatch = ui.edit(patchtext, "",
343 action="diff",
343 action="diff",
344 repopath=repo.path)
344 repopath=repo.path)
345 fp.truncate(0)
345 fp.truncate(0)
346 fp.write(reviewedpatch)
346 fp.write(reviewedpatch)
347 fp.seek(0)
347 fp.seek(0)
348
348
349 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
349 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
350 # 3a. apply filtered patch to clean repo (clean)
350 # 3a. apply filtered patch to clean repo (clean)
351 if backups:
351 if backups:
352 # Equivalent to hg.revert
352 # Equivalent to hg.revert
353 m = scmutil.matchfiles(repo, backups.keys())
353 m = scmutil.matchfiles(repo, backups.keys())
354 mergemod.update(repo, repo.dirstate.p1(),
354 mergemod.update(repo, repo.dirstate.p1(),
355 False, True, matcher=m)
355 False, True, matcher=m)
356
356
357 # 3b. (apply)
357 # 3b. (apply)
358 if dopatch:
358 if dopatch:
359 try:
359 try:
360 ui.debug('applying patch\n')
360 ui.debug('applying patch\n')
361 ui.debug(fp.getvalue())
361 ui.debug(fp.getvalue())
362 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
362 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
363 except patch.PatchError as err:
363 except patch.PatchError as err:
364 raise error.Abort(str(err))
364 raise error.Abort(str(err))
365 del fp
365 del fp
366
366
367 # 4. We prepared working directory according to filtered
367 # 4. We prepared working directory according to filtered
368 # patch. Now is the time to delegate the job to
368 # patch. Now is the time to delegate the job to
369 # commit/qrefresh or the like!
369 # commit/qrefresh or the like!
370
370
371 # Make all of the pathnames absolute.
371 # Make all of the pathnames absolute.
372 newfiles = [repo.wjoin(nf) for nf in newfiles]
372 newfiles = [repo.wjoin(nf) for nf in newfiles]
373 return commitfunc(ui, repo, *newfiles, **opts)
373 return commitfunc(ui, repo, *newfiles, **opts)
374 finally:
374 finally:
375 # 5. finally restore backed-up files
375 # 5. finally restore backed-up files
376 try:
376 try:
377 dirstate = repo.dirstate
377 dirstate = repo.dirstate
378 for realname, tmpname in backups.iteritems():
378 for realname, tmpname in backups.iteritems():
379 ui.debug('restoring %r to %r\n' % (tmpname, realname))
379 ui.debug('restoring %r to %r\n' % (tmpname, realname))
380
380
381 if dirstate[realname] == 'n':
381 if dirstate[realname] == 'n':
382 # without normallookup, restoring timestamp
382 # without normallookup, restoring timestamp
383 # may cause partially committed files
383 # may cause partially committed files
384 # to be treated as unmodified
384 # to be treated as unmodified
385 dirstate.normallookup(realname)
385 dirstate.normallookup(realname)
386
386
387 # copystat=True here and above are a hack to trick any
387 # copystat=True here and above are a hack to trick any
388 # editors that have f open that we haven't modified them.
388 # editors that have f open that we haven't modified them.
389 #
389 #
390 # Also note that this racy as an editor could notice the
390 # Also note that this racy as an editor could notice the
391 # file's mtime before we've finished writing it.
391 # file's mtime before we've finished writing it.
392 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
392 util.copyfile(tmpname, repo.wjoin(realname), copystat=True)
393 os.unlink(tmpname)
393 os.unlink(tmpname)
394 if tobackup:
394 if tobackup:
395 os.rmdir(backupdir)
395 os.rmdir(backupdir)
396 except OSError:
396 except OSError:
397 pass
397 pass
398
398
399 def recordinwlock(ui, repo, message, match, opts):
399 def recordinwlock(ui, repo, message, match, opts):
400 with repo.wlock():
400 with repo.wlock():
401 return recordfunc(ui, repo, message, match, opts)
401 return recordfunc(ui, repo, message, match, opts)
402
402
403 return commit(ui, repo, recordinwlock, pats, opts)
403 return commit(ui, repo, recordinwlock, pats, opts)
404
404
405 def tersestatus(root, statlist, status, ignorefn, ignore):
405 def tersestatus(root, statlist, status, ignorefn, ignore):
406 """
406 """
407 Returns a list of statuses with directory collapsed if all the files in the
407 Returns a list of statuses with directory collapsed if all the files in the
408 directory has the same status.
408 directory has the same status.
409 """
409 """
410
410
411 def numfiles(dirname):
411 def numfiles(dirname):
412 """
412 """
413 Calculates the number of tracked files in a given directory which also
413 Calculates the number of tracked files in a given directory which also
414 includes files which were removed or deleted. Considers ignored files
414 includes files which were removed or deleted. Considers ignored files
415 if ignore argument is True or 'i' is present in status argument.
415 if ignore argument is True or 'i' is present in status argument.
416 """
416 """
417 if lencache.get(dirname):
417 if lencache.get(dirname):
418 return lencache[dirname]
418 return lencache[dirname]
419 if 'i' in status or ignore:
419 if 'i' in status or ignore:
420 def match(localpath):
420 def match(localpath):
421 absolutepath = os.path.join(root, localpath)
421 absolutepath = os.path.join(root, localpath)
422 if os.path.isdir(absolutepath) and isemptydir(absolutepath):
422 if os.path.isdir(absolutepath) and isemptydir(absolutepath):
423 return True
423 return True
424 return False
424 return False
425 else:
425 else:
426 def match(localpath):
426 def match(localpath):
427 # there can be directory whose all the files are ignored and
427 # there can be directory whose all the files are ignored and
428 # hence the drectory should also be ignored while counting
428 # hence the drectory should also be ignored while counting
429 # number of files or subdirs in it's parent directory. This
429 # number of files or subdirs in it's parent directory. This
430 # checks the same.
430 # checks the same.
431 # XXX: We need a better logic here.
431 # XXX: We need a better logic here.
432 if os.path.isdir(os.path.join(root, localpath)):
432 if os.path.isdir(os.path.join(root, localpath)):
433 return isignoreddir(localpath)
433 return isignoreddir(localpath)
434 else:
434 else:
435 # XXX: there can be files which have the ignored pattern but
435 # XXX: there can be files which have the ignored pattern but
436 # are not ignored. That leads to bug in counting number of
436 # are not ignored. That leads to bug in counting number of
437 # tracked files in the directory.
437 # tracked files in the directory.
438 return ignorefn(localpath)
438 return ignorefn(localpath)
439 lendir = 0
439 lendir = 0
440 abspath = os.path.join(root, dirname)
440 abspath = os.path.join(root, dirname)
441 # There might be cases when a directory does not exists as the whole
441 # There might be cases when a directory does not exists as the whole
442 # directory can be removed and/or deleted.
442 # directory can be removed and/or deleted.
443 try:
443 try:
444 for f in os.listdir(abspath):
444 for f in os.listdir(abspath):
445 localpath = os.path.join(dirname, f)
445 localpath = os.path.join(dirname, f)
446 if not match(localpath):
446 if not match(localpath):
447 lendir += 1
447 lendir += 1
448 except OSError:
448 except OSError:
449 pass
449 pass
450 lendir += len(absentdir.get(dirname, []))
450 lendir += len(absentdir.get(dirname, []))
451 lencache[dirname] = lendir
451 lencache[dirname] = lendir
452 return lendir
452 return lendir
453
453
454 def isemptydir(abspath):
454 def isemptydir(abspath):
455 """
455 """
456 Check whether a directory is empty or not, i.e. there is no files in the
456 Check whether a directory is empty or not, i.e. there is no files in the
457 directory and all its subdirectories.
457 directory and all its subdirectories.
458 """
458 """
459 for f in os.listdir(abspath):
459 for f in os.listdir(abspath):
460 fullpath = os.path.join(abspath, f)
460 fullpath = os.path.join(abspath, f)
461 if os.path.isdir(fullpath):
461 if os.path.isdir(fullpath):
462 # recursion here
462 # recursion here
463 ret = isemptydir(fullpath)
463 ret = isemptydir(fullpath)
464 if not ret:
464 if not ret:
465 return False
465 return False
466 else:
466 else:
467 return False
467 return False
468 return True
468 return True
469
469
470 def isignoreddir(localpath):
470 def isignoreddir(localpath):
471 """Return True if `localpath` directory is ignored or contains only
471 """Return True if `localpath` directory is ignored or contains only
472 ignored files and should hence be considered ignored.
472 ignored files and should hence be considered ignored.
473 """
473 """
474 dirpath = os.path.join(root, localpath)
474 dirpath = os.path.join(root, localpath)
475 if ignorefn(dirpath):
475 if ignorefn(dirpath):
476 return True
476 return True
477 for f in os.listdir(dirpath):
477 for f in os.listdir(dirpath):
478 filepath = os.path.join(dirpath, f)
478 filepath = os.path.join(dirpath, f)
479 if os.path.isdir(filepath):
479 if os.path.isdir(filepath):
480 # recursion here
480 # recursion here
481 ret = isignoreddir(os.path.join(localpath, f))
481 ret = isignoreddir(os.path.join(localpath, f))
482 if not ret:
482 if not ret:
483 return False
483 return False
484 else:
484 else:
485 if not ignorefn(os.path.join(localpath, f)):
485 if not ignorefn(os.path.join(localpath, f)):
486 return False
486 return False
487 return True
487 return True
488
488
489 def absentones(removedfiles, missingfiles):
489 def absentones(removedfiles, missingfiles):
490 """
490 """
491 Returns a dictionary of directories with files in it which are either
491 Returns a dictionary of directories with files in it which are either
492 removed or missing (deleted) in them.
492 removed or missing (deleted) in them.
493 """
493 """
494 absentdir = {}
494 absentdir = {}
495 absentfiles = removedfiles + missingfiles
495 absentfiles = removedfiles + missingfiles
496 while absentfiles:
496 while absentfiles:
497 f = absentfiles.pop()
497 f = absentfiles.pop()
498 par = os.path.dirname(f)
498 par = os.path.dirname(f)
499 if par == '':
499 if par == '':
500 continue
500 continue
501 # we need to store files rather than number of files as some files
501 # we need to store files rather than number of files as some files
502 # or subdirectories in a directory can be counted twice. This is
502 # or subdirectories in a directory can be counted twice. This is
503 # also we have used sets here.
503 # also we have used sets here.
504 try:
504 try:
505 absentdir[par].add(f)
505 absentdir[par].add(f)
506 except KeyError:
506 except KeyError:
507 absentdir[par] = set([f])
507 absentdir[par] = set([f])
508 absentfiles.append(par)
508 absentfiles.append(par)
509 return absentdir
509 return absentdir
510
510
511 indexes = {'m': 0, 'a': 1, 'r': 2, 'd': 3, 'u': 4, 'i': 5, 'c': 6}
511 indexes = {'m': 0, 'a': 1, 'r': 2, 'd': 3, 'u': 4, 'i': 5, 'c': 6}
512 # get a dictonary of directories and files which are missing as os.listdir()
512 # get a dictonary of directories and files which are missing as os.listdir()
513 # won't be able to list them.
513 # won't be able to list them.
514 absentdir = absentones(statlist[2], statlist[3])
514 absentdir = absentones(statlist[2], statlist[3])
515 finalrs = [[]] * len(indexes)
515 finalrs = [[]] * len(indexes)
516 didsomethingchanged = False
516 didsomethingchanged = False
517 # dictionary to store number of files and subdir in a directory so that we
517 # dictionary to store number of files and subdir in a directory so that we
518 # don't compute that again.
518 # don't compute that again.
519 lencache = {}
519 lencache = {}
520
520
521 for st in pycompat.bytestr(status):
521 for st in pycompat.bytestr(status):
522
522
523 try:
523 try:
524 ind = indexes[st]
524 ind = indexes[st]
525 except KeyError:
525 except KeyError:
526 # TODO: Need a better error message here
526 # TODO: Need a better error message here
527 raise error.Abort("'%s' not recognized" % st)
527 raise error.Abort("'%s' not recognized" % st)
528
528
529 sfiles = statlist[ind]
529 sfiles = statlist[ind]
530 if not sfiles:
530 if not sfiles:
531 continue
531 continue
532 pardict = {}
532 pardict = {}
533 for a in sfiles:
533 for a in sfiles:
534 par = os.path.dirname(a)
534 par = os.path.dirname(a)
535 pardict.setdefault(par, []).append(a)
535 pardict.setdefault(par, []).append(a)
536
536
537 rs = []
537 rs = []
538 newls = []
538 newls = []
539 for par, files in pardict.iteritems():
539 for par, files in pardict.iteritems():
540 lenpar = numfiles(par)
540 lenpar = numfiles(par)
541 if lenpar == len(files):
541 if lenpar == len(files):
542 newls.append(par)
542 newls.append(par)
543
543
544 if not newls:
544 if not newls:
545 continue
545 continue
546
546
547 while newls:
547 while newls:
548 newel = newls.pop()
548 newel = newls.pop()
549 if newel == '':
549 if newel == '':
550 continue
550 continue
551 parn = os.path.dirname(newel)
551 parn = os.path.dirname(newel)
552 pardict[newel] = []
552 pardict[newel] = []
553 # Adding pycompat.ossep as newel is a directory.
553 # Adding pycompat.ossep as newel is a directory.
554 pardict.setdefault(parn, []).append(newel + pycompat.ossep)
554 pardict.setdefault(parn, []).append(newel + pycompat.ossep)
555 lenpar = numfiles(parn)
555 lenpar = numfiles(parn)
556 if lenpar == len(pardict[parn]):
556 if lenpar == len(pardict[parn]):
557 newls.append(parn)
557 newls.append(parn)
558
558
559 # dict.values() for Py3 compatibility
559 # dict.values() for Py3 compatibility
560 for files in pardict.values():
560 for files in pardict.values():
561 rs.extend(files)
561 rs.extend(files)
562
562
563 rs.sort()
563 rs.sort()
564 finalrs[ind] = rs
564 finalrs[ind] = rs
565 didsomethingchanged = True
565 didsomethingchanged = True
566
566
567 # If nothing is changed, make sure the order of files is preserved.
567 # If nothing is changed, make sure the order of files is preserved.
568 if not didsomethingchanged:
568 if not didsomethingchanged:
569 return statlist
569 return statlist
570
570
571 for x in xrange(len(indexes)):
571 for x in xrange(len(indexes)):
572 if not finalrs[x]:
572 if not finalrs[x]:
573 finalrs[x] = statlist[x]
573 finalrs[x] = statlist[x]
574
574
575 return finalrs
575 return finalrs
576
576
577 def _commentlines(raw):
577 def _commentlines(raw):
578 '''Surround lineswith a comment char and a new line'''
578 '''Surround lineswith a comment char and a new line'''
579 lines = raw.splitlines()
579 lines = raw.splitlines()
580 commentedlines = ['# %s' % line for line in lines]
580 commentedlines = ['# %s' % line for line in lines]
581 return '\n'.join(commentedlines) + '\n'
581 return '\n'.join(commentedlines) + '\n'
582
582
583 def _conflictsmsg(repo):
583 def _conflictsmsg(repo):
584 # avoid merge cycle
584 # avoid merge cycle
585 from . import merge as mergemod
585 from . import merge as mergemod
586 mergestate = mergemod.mergestate.read(repo)
586 mergestate = mergemod.mergestate.read(repo)
587 if not mergestate.active():
587 if not mergestate.active():
588 return
588 return
589
589
590 m = scmutil.match(repo[None])
590 m = scmutil.match(repo[None])
591 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
591 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
592 if unresolvedlist:
592 if unresolvedlist:
593 mergeliststr = '\n'.join(
593 mergeliststr = '\n'.join(
594 [' %s' % os.path.relpath(
594 [' %s' % os.path.relpath(
595 os.path.join(repo.root, path),
595 os.path.join(repo.root, path),
596 pycompat.getcwd()) for path in unresolvedlist])
596 pycompat.getcwd()) for path in unresolvedlist])
597 msg = _('''Unresolved merge conflicts:
597 msg = _('''Unresolved merge conflicts:
598
598
599 %s
599 %s
600
600
601 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
601 To mark files as resolved: hg resolve --mark FILE''') % mergeliststr
602 else:
602 else:
603 msg = _('No unresolved merge conflicts.')
603 msg = _('No unresolved merge conflicts.')
604
604
605 return _commentlines(msg)
605 return _commentlines(msg)
606
606
607 def _helpmessage(continuecmd, abortcmd):
607 def _helpmessage(continuecmd, abortcmd):
608 msg = _('To continue: %s\n'
608 msg = _('To continue: %s\n'
609 'To abort: %s') % (continuecmd, abortcmd)
609 'To abort: %s') % (continuecmd, abortcmd)
610 return _commentlines(msg)
610 return _commentlines(msg)
611
611
612 def _rebasemsg():
612 def _rebasemsg():
613 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
613 return _helpmessage('hg rebase --continue', 'hg rebase --abort')
614
614
615 def _histeditmsg():
615 def _histeditmsg():
616 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
616 return _helpmessage('hg histedit --continue', 'hg histedit --abort')
617
617
618 def _unshelvemsg():
618 def _unshelvemsg():
619 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
619 return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
620
620
621 def _updatecleanmsg(dest=None):
621 def _updatecleanmsg(dest=None):
622 warning = _('warning: this will discard uncommitted changes')
622 warning = _('warning: this will discard uncommitted changes')
623 return 'hg update --clean %s (%s)' % (dest or '.', warning)
623 return 'hg update --clean %s (%s)' % (dest or '.', warning)
624
624
625 def _graftmsg():
625 def _graftmsg():
626 # tweakdefaults requires `update` to have a rev hence the `.`
626 # tweakdefaults requires `update` to have a rev hence the `.`
627 return _helpmessage('hg graft --continue', _updatecleanmsg())
627 return _helpmessage('hg graft --continue', _updatecleanmsg())
628
628
629 def _mergemsg():
629 def _mergemsg():
630 # tweakdefaults requires `update` to have a rev hence the `.`
630 # tweakdefaults requires `update` to have a rev hence the `.`
631 return _helpmessage('hg commit', _updatecleanmsg())
631 return _helpmessage('hg commit', _updatecleanmsg())
632
632
633 def _bisectmsg():
633 def _bisectmsg():
634 msg = _('To mark the changeset good: hg bisect --good\n'
634 msg = _('To mark the changeset good: hg bisect --good\n'
635 'To mark the changeset bad: hg bisect --bad\n'
635 'To mark the changeset bad: hg bisect --bad\n'
636 'To abort: hg bisect --reset\n')
636 'To abort: hg bisect --reset\n')
637 return _commentlines(msg)
637 return _commentlines(msg)
638
638
639 def fileexistspredicate(filename):
639 def fileexistspredicate(filename):
640 return lambda repo: repo.vfs.exists(filename)
640 return lambda repo: repo.vfs.exists(filename)
641
641
642 def _mergepredicate(repo):
642 def _mergepredicate(repo):
643 return len(repo[None].parents()) > 1
643 return len(repo[None].parents()) > 1
644
644
645 STATES = (
645 STATES = (
646 # (state, predicate to detect states, helpful message function)
646 # (state, predicate to detect states, helpful message function)
647 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
647 ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
648 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
648 ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
649 ('graft', fileexistspredicate('graftstate'), _graftmsg),
649 ('graft', fileexistspredicate('graftstate'), _graftmsg),
650 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
650 ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
651 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
651 ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
652 # The merge state is part of a list that will be iterated over.
652 # The merge state is part of a list that will be iterated over.
653 # They need to be last because some of the other unfinished states may also
653 # They need to be last because some of the other unfinished states may also
654 # be in a merge or update state (eg. rebase, histedit, graft, etc).
654 # be in a merge or update state (eg. rebase, histedit, graft, etc).
655 # We want those to have priority.
655 # We want those to have priority.
656 ('merge', _mergepredicate, _mergemsg),
656 ('merge', _mergepredicate, _mergemsg),
657 )
657 )
658
658
659 def _getrepostate(repo):
659 def _getrepostate(repo):
660 # experimental config: commands.status.skipstates
660 # experimental config: commands.status.skipstates
661 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
661 skip = set(repo.ui.configlist('commands', 'status.skipstates'))
662 for state, statedetectionpredicate, msgfn in STATES:
662 for state, statedetectionpredicate, msgfn in STATES:
663 if state in skip:
663 if state in skip:
664 continue
664 continue
665 if statedetectionpredicate(repo):
665 if statedetectionpredicate(repo):
666 return (state, statedetectionpredicate, msgfn)
666 return (state, statedetectionpredicate, msgfn)
667
667
668 def morestatus(repo, fm):
668 def morestatus(repo, fm):
669 statetuple = _getrepostate(repo)
669 statetuple = _getrepostate(repo)
670 label = 'status.morestatus'
670 label = 'status.morestatus'
671 if statetuple:
671 if statetuple:
672 fm.startitem()
672 fm.startitem()
673 state, statedetectionpredicate, helpfulmsg = statetuple
673 state, statedetectionpredicate, helpfulmsg = statetuple
674 statemsg = _('The repository is in an unfinished *%s* state.') % state
674 statemsg = _('The repository is in an unfinished *%s* state.') % state
675 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
675 fm.write('statemsg', '%s\n', _commentlines(statemsg), label=label)
676 conmsg = _conflictsmsg(repo)
676 conmsg = _conflictsmsg(repo)
677 if conmsg:
677 if conmsg:
678 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
678 fm.write('conflictsmsg', '%s\n', conmsg, label=label)
679 if helpfulmsg:
679 if helpfulmsg:
680 helpmsg = helpfulmsg()
680 helpmsg = helpfulmsg()
681 fm.write('helpmsg', '%s\n', helpmsg, label=label)
681 fm.write('helpmsg', '%s\n', helpmsg, label=label)
682
682
683 def findpossible(cmd, table, strict=False):
683 def findpossible(cmd, table, strict=False):
684 """
684 """
685 Return cmd -> (aliases, command table entry)
685 Return cmd -> (aliases, command table entry)
686 for each matching command.
686 for each matching command.
687 Return debug commands (or their aliases) only if no normal command matches.
687 Return debug commands (or their aliases) only if no normal command matches.
688 """
688 """
689 choice = {}
689 choice = {}
690 debugchoice = {}
690 debugchoice = {}
691
691
692 if cmd in table:
692 if cmd in table:
693 # short-circuit exact matches, "log" alias beats "^log|history"
693 # short-circuit exact matches, "log" alias beats "^log|history"
694 keys = [cmd]
694 keys = [cmd]
695 else:
695 else:
696 keys = table.keys()
696 keys = table.keys()
697
697
698 allcmds = []
698 allcmds = []
699 for e in keys:
699 for e in keys:
700 aliases = parsealiases(e)
700 aliases = parsealiases(e)
701 allcmds.extend(aliases)
701 allcmds.extend(aliases)
702 found = None
702 found = None
703 if cmd in aliases:
703 if cmd in aliases:
704 found = cmd
704 found = cmd
705 elif not strict:
705 elif not strict:
706 for a in aliases:
706 for a in aliases:
707 if a.startswith(cmd):
707 if a.startswith(cmd):
708 found = a
708 found = a
709 break
709 break
710 if found is not None:
710 if found is not None:
711 if aliases[0].startswith("debug") or found.startswith("debug"):
711 if aliases[0].startswith("debug") or found.startswith("debug"):
712 debugchoice[found] = (aliases, table[e])
712 debugchoice[found] = (aliases, table[e])
713 else:
713 else:
714 choice[found] = (aliases, table[e])
714 choice[found] = (aliases, table[e])
715
715
716 if not choice and debugchoice:
716 if not choice and debugchoice:
717 choice = debugchoice
717 choice = debugchoice
718
718
719 return choice, allcmds
719 return choice, allcmds
720
720
721 def findcmd(cmd, table, strict=True):
721 def findcmd(cmd, table, strict=True):
722 """Return (aliases, command table entry) for command string."""
722 """Return (aliases, command table entry) for command string."""
723 choice, allcmds = findpossible(cmd, table, strict)
723 choice, allcmds = findpossible(cmd, table, strict)
724
724
725 if cmd in choice:
725 if cmd in choice:
726 return choice[cmd]
726 return choice[cmd]
727
727
728 if len(choice) > 1:
728 if len(choice) > 1:
729 clist = sorted(choice)
729 clist = sorted(choice)
730 raise error.AmbiguousCommand(cmd, clist)
730 raise error.AmbiguousCommand(cmd, clist)
731
731
732 if choice:
732 if choice:
733 return list(choice.values())[0]
733 return list(choice.values())[0]
734
734
735 raise error.UnknownCommand(cmd, allcmds)
735 raise error.UnknownCommand(cmd, allcmds)
736
736
737 def findrepo(p):
737 def findrepo(p):
738 while not os.path.isdir(os.path.join(p, ".hg")):
738 while not os.path.isdir(os.path.join(p, ".hg")):
739 oldp, p = p, os.path.dirname(p)
739 oldp, p = p, os.path.dirname(p)
740 if p == oldp:
740 if p == oldp:
741 return None
741 return None
742
742
743 return p
743 return p
744
744
745 def bailifchanged(repo, merge=True, hint=None):
745 def bailifchanged(repo, merge=True, hint=None):
746 """ enforce the precondition that working directory must be clean.
746 """ enforce the precondition that working directory must be clean.
747
747
748 'merge' can be set to false if a pending uncommitted merge should be
748 'merge' can be set to false if a pending uncommitted merge should be
749 ignored (such as when 'update --check' runs).
749 ignored (such as when 'update --check' runs).
750
750
751 'hint' is the usual hint given to Abort exception.
751 'hint' is the usual hint given to Abort exception.
752 """
752 """
753
753
754 if merge and repo.dirstate.p2() != nullid:
754 if merge and repo.dirstate.p2() != nullid:
755 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
755 raise error.Abort(_('outstanding uncommitted merge'), hint=hint)
756 modified, added, removed, deleted = repo.status()[:4]
756 modified, added, removed, deleted = repo.status()[:4]
757 if modified or added or removed or deleted:
757 if modified or added or removed or deleted:
758 raise error.Abort(_('uncommitted changes'), hint=hint)
758 raise error.Abort(_('uncommitted changes'), hint=hint)
759 ctx = repo[None]
759 ctx = repo[None]
760 for s in sorted(ctx.substate):
760 for s in sorted(ctx.substate):
761 ctx.sub(s).bailifchanged(hint=hint)
761 ctx.sub(s).bailifchanged(hint=hint)
762
762
763 def logmessage(ui, opts):
763 def logmessage(ui, opts):
764 """ get the log message according to -m and -l option """
764 """ get the log message according to -m and -l option """
765 message = opts.get('message')
765 message = opts.get('message')
766 logfile = opts.get('logfile')
766 logfile = opts.get('logfile')
767
767
768 if message and logfile:
768 if message and logfile:
769 raise error.Abort(_('options --message and --logfile are mutually '
769 raise error.Abort(_('options --message and --logfile are mutually '
770 'exclusive'))
770 'exclusive'))
771 if not message and logfile:
771 if not message and logfile:
772 try:
772 try:
773 if isstdiofilename(logfile):
773 if isstdiofilename(logfile):
774 message = ui.fin.read()
774 message = ui.fin.read()
775 else:
775 else:
776 message = '\n'.join(util.readfile(logfile).splitlines())
776 message = '\n'.join(util.readfile(logfile).splitlines())
777 except IOError as inst:
777 except IOError as inst:
778 raise error.Abort(_("can't read commit message '%s': %s") %
778 raise error.Abort(_("can't read commit message '%s': %s") %
779 (logfile, encoding.strtolocal(inst.strerror)))
779 (logfile, encoding.strtolocal(inst.strerror)))
780 return message
780 return message
781
781
782 def mergeeditform(ctxorbool, baseformname):
782 def mergeeditform(ctxorbool, baseformname):
783 """return appropriate editform name (referencing a committemplate)
783 """return appropriate editform name (referencing a committemplate)
784
784
785 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
785 'ctxorbool' is either a ctx to be committed, or a bool indicating whether
786 merging is committed.
786 merging is committed.
787
787
788 This returns baseformname with '.merge' appended if it is a merge,
788 This returns baseformname with '.merge' appended if it is a merge,
789 otherwise '.normal' is appended.
789 otherwise '.normal' is appended.
790 """
790 """
791 if isinstance(ctxorbool, bool):
791 if isinstance(ctxorbool, bool):
792 if ctxorbool:
792 if ctxorbool:
793 return baseformname + ".merge"
793 return baseformname + ".merge"
794 elif 1 < len(ctxorbool.parents()):
794 elif 1 < len(ctxorbool.parents()):
795 return baseformname + ".merge"
795 return baseformname + ".merge"
796
796
797 return baseformname + ".normal"
797 return baseformname + ".normal"
798
798
799 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
799 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
800 editform='', **opts):
800 editform='', **opts):
801 """get appropriate commit message editor according to '--edit' option
801 """get appropriate commit message editor according to '--edit' option
802
802
803 'finishdesc' is a function to be called with edited commit message
803 'finishdesc' is a function to be called with edited commit message
804 (= 'description' of the new changeset) just after editing, but
804 (= 'description' of the new changeset) just after editing, but
805 before checking empty-ness. It should return actual text to be
805 before checking empty-ness. It should return actual text to be
806 stored into history. This allows to change description before
806 stored into history. This allows to change description before
807 storing.
807 storing.
808
808
809 'extramsg' is a extra message to be shown in the editor instead of
809 'extramsg' is a extra message to be shown in the editor instead of
810 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
810 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
811 is automatically added.
811 is automatically added.
812
812
813 'editform' is a dot-separated list of names, to distinguish
813 'editform' is a dot-separated list of names, to distinguish
814 the purpose of commit text editing.
814 the purpose of commit text editing.
815
815
816 'getcommiteditor' returns 'commitforceeditor' regardless of
816 'getcommiteditor' returns 'commitforceeditor' regardless of
817 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
817 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
818 they are specific for usage in MQ.
818 they are specific for usage in MQ.
819 """
819 """
820 if edit or finishdesc or extramsg:
820 if edit or finishdesc or extramsg:
821 return lambda r, c, s: commitforceeditor(r, c, s,
821 return lambda r, c, s: commitforceeditor(r, c, s,
822 finishdesc=finishdesc,
822 finishdesc=finishdesc,
823 extramsg=extramsg,
823 extramsg=extramsg,
824 editform=editform)
824 editform=editform)
825 elif editform:
825 elif editform:
826 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
826 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
827 else:
827 else:
828 return commiteditor
828 return commiteditor
829
829
830 def loglimit(opts):
830 def loglimit(opts):
831 """get the log limit according to option -l/--limit"""
831 """get the log limit according to option -l/--limit"""
832 limit = opts.get('limit')
832 limit = opts.get('limit')
833 if limit:
833 if limit:
834 try:
834 try:
835 limit = int(limit)
835 limit = int(limit)
836 except ValueError:
836 except ValueError:
837 raise error.Abort(_('limit must be a positive integer'))
837 raise error.Abort(_('limit must be a positive integer'))
838 if limit <= 0:
838 if limit <= 0:
839 raise error.Abort(_('limit must be positive'))
839 raise error.Abort(_('limit must be positive'))
840 else:
840 else:
841 limit = None
841 limit = None
842 return limit
842 return limit
843
843
844 def makefilename(repo, pat, node, desc=None,
844 def makefilename(repo, pat, node, desc=None,
845 total=None, seqno=None, revwidth=None, pathname=None):
845 total=None, seqno=None, revwidth=None, pathname=None):
846 node_expander = {
846 node_expander = {
847 'H': lambda: hex(node),
847 'H': lambda: hex(node),
848 'R': lambda: str(repo.changelog.rev(node)),
848 'R': lambda: str(repo.changelog.rev(node)),
849 'h': lambda: short(node),
849 'h': lambda: short(node),
850 'm': lambda: re.sub('[^\w]', '_', str(desc))
850 'm': lambda: re.sub('[^\w]', '_', str(desc))
851 }
851 }
852 expander = {
852 expander = {
853 '%': lambda: '%',
853 '%': lambda: '%',
854 'b': lambda: os.path.basename(repo.root),
854 'b': lambda: os.path.basename(repo.root),
855 }
855 }
856
856
857 try:
857 try:
858 if node:
858 if node:
859 expander.update(node_expander)
859 expander.update(node_expander)
860 if node:
860 if node:
861 expander['r'] = (lambda:
861 expander['r'] = (lambda:
862 str(repo.changelog.rev(node)).zfill(revwidth or 0))
862 str(repo.changelog.rev(node)).zfill(revwidth or 0))
863 if total is not None:
863 if total is not None:
864 expander['N'] = lambda: str(total)
864 expander['N'] = lambda: str(total)
865 if seqno is not None:
865 if seqno is not None:
866 expander['n'] = lambda: str(seqno)
866 expander['n'] = lambda: str(seqno)
867 if total is not None and seqno is not None:
867 if total is not None and seqno is not None:
868 expander['n'] = lambda: str(seqno).zfill(len(str(total)))
868 expander['n'] = lambda: str(seqno).zfill(len(str(total)))
869 if pathname is not None:
869 if pathname is not None:
870 expander['s'] = lambda: os.path.basename(pathname)
870 expander['s'] = lambda: os.path.basename(pathname)
871 expander['d'] = lambda: os.path.dirname(pathname) or '.'
871 expander['d'] = lambda: os.path.dirname(pathname) or '.'
872 expander['p'] = lambda: pathname
872 expander['p'] = lambda: pathname
873
873
874 newname = []
874 newname = []
875 patlen = len(pat)
875 patlen = len(pat)
876 i = 0
876 i = 0
877 while i < patlen:
877 while i < patlen:
878 c = pat[i:i + 1]
878 c = pat[i:i + 1]
879 if c == '%':
879 if c == '%':
880 i += 1
880 i += 1
881 c = pat[i:i + 1]
881 c = pat[i:i + 1]
882 c = expander[c]()
882 c = expander[c]()
883 newname.append(c)
883 newname.append(c)
884 i += 1
884 i += 1
885 return ''.join(newname)
885 return ''.join(newname)
886 except KeyError as inst:
886 except KeyError as inst:
887 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
887 raise error.Abort(_("invalid format spec '%%%s' in output filename") %
888 inst.args[0])
888 inst.args[0])
889
889
890 def isstdiofilename(pat):
890 def isstdiofilename(pat):
891 """True if the given pat looks like a filename denoting stdin/stdout"""
891 """True if the given pat looks like a filename denoting stdin/stdout"""
892 return not pat or pat == '-'
892 return not pat or pat == '-'
893
893
894 class _unclosablefile(object):
894 class _unclosablefile(object):
895 def __init__(self, fp):
895 def __init__(self, fp):
896 self._fp = fp
896 self._fp = fp
897
897
898 def close(self):
898 def close(self):
899 pass
899 pass
900
900
901 def __iter__(self):
901 def __iter__(self):
902 return iter(self._fp)
902 return iter(self._fp)
903
903
904 def __getattr__(self, attr):
904 def __getattr__(self, attr):
905 return getattr(self._fp, attr)
905 return getattr(self._fp, attr)
906
906
907 def __enter__(self):
907 def __enter__(self):
908 return self
908 return self
909
909
910 def __exit__(self, exc_type, exc_value, exc_tb):
910 def __exit__(self, exc_type, exc_value, exc_tb):
911 pass
911 pass
912
912
913 def makefileobj(repo, pat, node=None, desc=None, total=None,
913 def makefileobj(repo, pat, node=None, desc=None, total=None,
914 seqno=None, revwidth=None, mode='wb', modemap=None,
914 seqno=None, revwidth=None, mode='wb', modemap=None,
915 pathname=None):
915 pathname=None):
916
916
917 writable = mode not in ('r', 'rb')
917 writable = mode not in ('r', 'rb')
918
918
919 if isstdiofilename(pat):
919 if isstdiofilename(pat):
920 if writable:
920 if writable:
921 fp = repo.ui.fout
921 fp = repo.ui.fout
922 else:
922 else:
923 fp = repo.ui.fin
923 fp = repo.ui.fin
924 return _unclosablefile(fp)
924 return _unclosablefile(fp)
925 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
925 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
926 if modemap is not None:
926 if modemap is not None:
927 mode = modemap.get(fn, mode)
927 mode = modemap.get(fn, mode)
928 if mode == 'wb':
928 if mode == 'wb':
929 modemap[fn] = 'ab'
929 modemap[fn] = 'ab'
930 return open(fn, mode)
930 return open(fn, mode)
931
931
932 def openrevlog(repo, cmd, file_, opts):
932 def openrevlog(repo, cmd, file_, opts):
933 """opens the changelog, manifest, a filelog or a given revlog"""
933 """opens the changelog, manifest, a filelog or a given revlog"""
934 cl = opts['changelog']
934 cl = opts['changelog']
935 mf = opts['manifest']
935 mf = opts['manifest']
936 dir = opts['dir']
936 dir = opts['dir']
937 msg = None
937 msg = None
938 if cl and mf:
938 if cl and mf:
939 msg = _('cannot specify --changelog and --manifest at the same time')
939 msg = _('cannot specify --changelog and --manifest at the same time')
940 elif cl and dir:
940 elif cl and dir:
941 msg = _('cannot specify --changelog and --dir at the same time')
941 msg = _('cannot specify --changelog and --dir at the same time')
942 elif cl or mf or dir:
942 elif cl or mf or dir:
943 if file_:
943 if file_:
944 msg = _('cannot specify filename with --changelog or --manifest')
944 msg = _('cannot specify filename with --changelog or --manifest')
945 elif not repo:
945 elif not repo:
946 msg = _('cannot specify --changelog or --manifest or --dir '
946 msg = _('cannot specify --changelog or --manifest or --dir '
947 'without a repository')
947 'without a repository')
948 if msg:
948 if msg:
949 raise error.Abort(msg)
949 raise error.Abort(msg)
950
950
951 r = None
951 r = None
952 if repo:
952 if repo:
953 if cl:
953 if cl:
954 r = repo.unfiltered().changelog
954 r = repo.unfiltered().changelog
955 elif dir:
955 elif dir:
956 if 'treemanifest' not in repo.requirements:
956 if 'treemanifest' not in repo.requirements:
957 raise error.Abort(_("--dir can only be used on repos with "
957 raise error.Abort(_("--dir can only be used on repos with "
958 "treemanifest enabled"))
958 "treemanifest enabled"))
959 dirlog = repo.manifestlog._revlog.dirlog(dir)
959 dirlog = repo.manifestlog._revlog.dirlog(dir)
960 if len(dirlog):
960 if len(dirlog):
961 r = dirlog
961 r = dirlog
962 elif mf:
962 elif mf:
963 r = repo.manifestlog._revlog
963 r = repo.manifestlog._revlog
964 elif file_:
964 elif file_:
965 filelog = repo.file(file_)
965 filelog = repo.file(file_)
966 if len(filelog):
966 if len(filelog):
967 r = filelog
967 r = filelog
968 if not r:
968 if not r:
969 if not file_:
969 if not file_:
970 raise error.CommandError(cmd, _('invalid arguments'))
970 raise error.CommandError(cmd, _('invalid arguments'))
971 if not os.path.isfile(file_):
971 if not os.path.isfile(file_):
972 raise error.Abort(_("revlog '%s' not found") % file_)
972 raise error.Abort(_("revlog '%s' not found") % file_)
973 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
973 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
974 file_[:-2] + ".i")
974 file_[:-2] + ".i")
975 return r
975 return r
976
976
977 def copy(ui, repo, pats, opts, rename=False):
977 def copy(ui, repo, pats, opts, rename=False):
978 # called with the repo lock held
978 # called with the repo lock held
979 #
979 #
980 # hgsep => pathname that uses "/" to separate directories
980 # hgsep => pathname that uses "/" to separate directories
981 # ossep => pathname that uses os.sep to separate directories
981 # ossep => pathname that uses os.sep to separate directories
982 cwd = repo.getcwd()
982 cwd = repo.getcwd()
983 targets = {}
983 targets = {}
984 after = opts.get("after")
984 after = opts.get("after")
985 dryrun = opts.get("dry_run")
985 dryrun = opts.get("dry_run")
986 wctx = repo[None]
986 wctx = repo[None]
987
987
988 def walkpat(pat):
988 def walkpat(pat):
989 srcs = []
989 srcs = []
990 if after:
990 if after:
991 badstates = '?'
991 badstates = '?'
992 else:
992 else:
993 badstates = '?r'
993 badstates = '?r'
994 m = scmutil.match(wctx, [pat], opts, globbed=True)
994 m = scmutil.match(wctx, [pat], opts, globbed=True)
995 for abs in wctx.walk(m):
995 for abs in wctx.walk(m):
996 state = repo.dirstate[abs]
996 state = repo.dirstate[abs]
997 rel = m.rel(abs)
997 rel = m.rel(abs)
998 exact = m.exact(abs)
998 exact = m.exact(abs)
999 if state in badstates:
999 if state in badstates:
1000 if exact and state == '?':
1000 if exact and state == '?':
1001 ui.warn(_('%s: not copying - file is not managed\n') % rel)
1001 ui.warn(_('%s: not copying - file is not managed\n') % rel)
1002 if exact and state == 'r':
1002 if exact and state == 'r':
1003 ui.warn(_('%s: not copying - file has been marked for'
1003 ui.warn(_('%s: not copying - file has been marked for'
1004 ' remove\n') % rel)
1004 ' remove\n') % rel)
1005 continue
1005 continue
1006 # abs: hgsep
1006 # abs: hgsep
1007 # rel: ossep
1007 # rel: ossep
1008 srcs.append((abs, rel, exact))
1008 srcs.append((abs, rel, exact))
1009 return srcs
1009 return srcs
1010
1010
1011 # abssrc: hgsep
1011 # abssrc: hgsep
1012 # relsrc: ossep
1012 # relsrc: ossep
1013 # otarget: ossep
1013 # otarget: ossep
1014 def copyfile(abssrc, relsrc, otarget, exact):
1014 def copyfile(abssrc, relsrc, otarget, exact):
1015 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
1015 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
1016 if '/' in abstarget:
1016 if '/' in abstarget:
1017 # We cannot normalize abstarget itself, this would prevent
1017 # We cannot normalize abstarget itself, this would prevent
1018 # case only renames, like a => A.
1018 # case only renames, like a => A.
1019 abspath, absname = abstarget.rsplit('/', 1)
1019 abspath, absname = abstarget.rsplit('/', 1)
1020 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
1020 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
1021 reltarget = repo.pathto(abstarget, cwd)
1021 reltarget = repo.pathto(abstarget, cwd)
1022 target = repo.wjoin(abstarget)
1022 target = repo.wjoin(abstarget)
1023 src = repo.wjoin(abssrc)
1023 src = repo.wjoin(abssrc)
1024 state = repo.dirstate[abstarget]
1024 state = repo.dirstate[abstarget]
1025
1025
1026 scmutil.checkportable(ui, abstarget)
1026 scmutil.checkportable(ui, abstarget)
1027
1027
1028 # check for collisions
1028 # check for collisions
1029 prevsrc = targets.get(abstarget)
1029 prevsrc = targets.get(abstarget)
1030 if prevsrc is not None:
1030 if prevsrc is not None:
1031 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1031 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
1032 (reltarget, repo.pathto(abssrc, cwd),
1032 (reltarget, repo.pathto(abssrc, cwd),
1033 repo.pathto(prevsrc, cwd)))
1033 repo.pathto(prevsrc, cwd)))
1034 return
1034 return
1035
1035
1036 # check for overwrites
1036 # check for overwrites
1037 exists = os.path.lexists(target)
1037 exists = os.path.lexists(target)
1038 samefile = False
1038 samefile = False
1039 if exists and abssrc != abstarget:
1039 if exists and abssrc != abstarget:
1040 if (repo.dirstate.normalize(abssrc) ==
1040 if (repo.dirstate.normalize(abssrc) ==
1041 repo.dirstate.normalize(abstarget)):
1041 repo.dirstate.normalize(abstarget)):
1042 if not rename:
1042 if not rename:
1043 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1043 ui.warn(_("%s: can't copy - same file\n") % reltarget)
1044 return
1044 return
1045 exists = False
1045 exists = False
1046 samefile = True
1046 samefile = True
1047
1047
1048 if not after and exists or after and state in 'mn':
1048 if not after and exists or after and state in 'mn':
1049 if not opts['force']:
1049 if not opts['force']:
1050 if state in 'mn':
1050 if state in 'mn':
1051 msg = _('%s: not overwriting - file already committed\n')
1051 msg = _('%s: not overwriting - file already committed\n')
1052 if after:
1052 if after:
1053 flags = '--after --force'
1053 flags = '--after --force'
1054 else:
1054 else:
1055 flags = '--force'
1055 flags = '--force'
1056 if rename:
1056 if rename:
1057 hint = _('(hg rename %s to replace the file by '
1057 hint = _('(hg rename %s to replace the file by '
1058 'recording a rename)\n') % flags
1058 'recording a rename)\n') % flags
1059 else:
1059 else:
1060 hint = _('(hg copy %s to replace the file by '
1060 hint = _('(hg copy %s to replace the file by '
1061 'recording a copy)\n') % flags
1061 'recording a copy)\n') % flags
1062 else:
1062 else:
1063 msg = _('%s: not overwriting - file exists\n')
1063 msg = _('%s: not overwriting - file exists\n')
1064 if rename:
1064 if rename:
1065 hint = _('(hg rename --after to record the rename)\n')
1065 hint = _('(hg rename --after to record the rename)\n')
1066 else:
1066 else:
1067 hint = _('(hg copy --after to record the copy)\n')
1067 hint = _('(hg copy --after to record the copy)\n')
1068 ui.warn(msg % reltarget)
1068 ui.warn(msg % reltarget)
1069 ui.warn(hint)
1069 ui.warn(hint)
1070 return
1070 return
1071
1071
1072 if after:
1072 if after:
1073 if not exists:
1073 if not exists:
1074 if rename:
1074 if rename:
1075 ui.warn(_('%s: not recording move - %s does not exist\n') %
1075 ui.warn(_('%s: not recording move - %s does not exist\n') %
1076 (relsrc, reltarget))
1076 (relsrc, reltarget))
1077 else:
1077 else:
1078 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1078 ui.warn(_('%s: not recording copy - %s does not exist\n') %
1079 (relsrc, reltarget))
1079 (relsrc, reltarget))
1080 return
1080 return
1081 elif not dryrun:
1081 elif not dryrun:
1082 try:
1082 try:
1083 if exists:
1083 if exists:
1084 os.unlink(target)
1084 os.unlink(target)
1085 targetdir = os.path.dirname(target) or '.'
1085 targetdir = os.path.dirname(target) or '.'
1086 if not os.path.isdir(targetdir):
1086 if not os.path.isdir(targetdir):
1087 os.makedirs(targetdir)
1087 os.makedirs(targetdir)
1088 if samefile:
1088 if samefile:
1089 tmp = target + "~hgrename"
1089 tmp = target + "~hgrename"
1090 os.rename(src, tmp)
1090 os.rename(src, tmp)
1091 os.rename(tmp, target)
1091 os.rename(tmp, target)
1092 else:
1092 else:
1093 util.copyfile(src, target)
1093 util.copyfile(src, target)
1094 srcexists = True
1094 srcexists = True
1095 except IOError as inst:
1095 except IOError as inst:
1096 if inst.errno == errno.ENOENT:
1096 if inst.errno == errno.ENOENT:
1097 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1097 ui.warn(_('%s: deleted in working directory\n') % relsrc)
1098 srcexists = False
1098 srcexists = False
1099 else:
1099 else:
1100 ui.warn(_('%s: cannot copy - %s\n') %
1100 ui.warn(_('%s: cannot copy - %s\n') %
1101 (relsrc, encoding.strtolocal(inst.strerror)))
1101 (relsrc, encoding.strtolocal(inst.strerror)))
1102 return True # report a failure
1102 return True # report a failure
1103
1103
1104 if ui.verbose or not exact:
1104 if ui.verbose or not exact:
1105 if rename:
1105 if rename:
1106 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1106 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
1107 else:
1107 else:
1108 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1108 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
1109
1109
1110 targets[abstarget] = abssrc
1110 targets[abstarget] = abssrc
1111
1111
1112 # fix up dirstate
1112 # fix up dirstate
1113 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1113 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
1114 dryrun=dryrun, cwd=cwd)
1114 dryrun=dryrun, cwd=cwd)
1115 if rename and not dryrun:
1115 if rename and not dryrun:
1116 if not after and srcexists and not samefile:
1116 if not after and srcexists and not samefile:
1117 repo.wvfs.unlinkpath(abssrc)
1117 repo.wvfs.unlinkpath(abssrc)
1118 wctx.forget([abssrc])
1118 wctx.forget([abssrc])
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 targetpathfn(pat, dest, srcs):
1124 def targetpathfn(pat, dest, srcs):
1125 if os.path.isdir(pat):
1125 if os.path.isdir(pat):
1126 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1126 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1127 abspfx = util.localpath(abspfx)
1127 abspfx = util.localpath(abspfx)
1128 if destdirexists:
1128 if destdirexists:
1129 striplen = len(os.path.split(abspfx)[0])
1129 striplen = len(os.path.split(abspfx)[0])
1130 else:
1130 else:
1131 striplen = len(abspfx)
1131 striplen = len(abspfx)
1132 if striplen:
1132 if striplen:
1133 striplen += len(pycompat.ossep)
1133 striplen += len(pycompat.ossep)
1134 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1134 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
1135 elif destdirexists:
1135 elif destdirexists:
1136 res = lambda p: os.path.join(dest,
1136 res = lambda p: os.path.join(dest,
1137 os.path.basename(util.localpath(p)))
1137 os.path.basename(util.localpath(p)))
1138 else:
1138 else:
1139 res = lambda p: dest
1139 res = lambda p: dest
1140 return res
1140 return res
1141
1141
1142 # pat: ossep
1142 # pat: ossep
1143 # dest ossep
1143 # dest ossep
1144 # srcs: list of (hgsep, hgsep, ossep, bool)
1144 # srcs: list of (hgsep, hgsep, ossep, bool)
1145 # return: function that takes hgsep and returns ossep
1145 # return: function that takes hgsep and returns ossep
1146 def targetpathafterfn(pat, dest, srcs):
1146 def targetpathafterfn(pat, dest, srcs):
1147 if matchmod.patkind(pat):
1147 if matchmod.patkind(pat):
1148 # a mercurial pattern
1148 # a mercurial pattern
1149 res = lambda p: os.path.join(dest,
1149 res = lambda p: os.path.join(dest,
1150 os.path.basename(util.localpath(p)))
1150 os.path.basename(util.localpath(p)))
1151 else:
1151 else:
1152 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1152 abspfx = pathutil.canonpath(repo.root, cwd, pat)
1153 if len(abspfx) < len(srcs[0][0]):
1153 if len(abspfx) < len(srcs[0][0]):
1154 # A directory. Either the target path contains the last
1154 # A directory. Either the target path contains the last
1155 # component of the source path or it does not.
1155 # component of the source path or it does not.
1156 def evalpath(striplen):
1156 def evalpath(striplen):
1157 score = 0
1157 score = 0
1158 for s in srcs:
1158 for s in srcs:
1159 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1159 t = os.path.join(dest, util.localpath(s[0])[striplen:])
1160 if os.path.lexists(t):
1160 if os.path.lexists(t):
1161 score += 1
1161 score += 1
1162 return score
1162 return score
1163
1163
1164 abspfx = util.localpath(abspfx)
1164 abspfx = util.localpath(abspfx)
1165 striplen = len(abspfx)
1165 striplen = len(abspfx)
1166 if striplen:
1166 if striplen:
1167 striplen += len(pycompat.ossep)
1167 striplen += len(pycompat.ossep)
1168 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1168 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
1169 score = evalpath(striplen)
1169 score = evalpath(striplen)
1170 striplen1 = len(os.path.split(abspfx)[0])
1170 striplen1 = len(os.path.split(abspfx)[0])
1171 if striplen1:
1171 if striplen1:
1172 striplen1 += len(pycompat.ossep)
1172 striplen1 += len(pycompat.ossep)
1173 if evalpath(striplen1) > score:
1173 if evalpath(striplen1) > score:
1174 striplen = striplen1
1174 striplen = striplen1
1175 res = lambda p: os.path.join(dest,
1175 res = lambda p: os.path.join(dest,
1176 util.localpath(p)[striplen:])
1176 util.localpath(p)[striplen:])
1177 else:
1177 else:
1178 # a file
1178 # a file
1179 if destdirexists:
1179 if destdirexists:
1180 res = lambda p: os.path.join(dest,
1180 res = lambda p: os.path.join(dest,
1181 os.path.basename(util.localpath(p)))
1181 os.path.basename(util.localpath(p)))
1182 else:
1182 else:
1183 res = lambda p: dest
1183 res = lambda p: dest
1184 return res
1184 return res
1185
1185
1186 pats = scmutil.expandpats(pats)
1186 pats = scmutil.expandpats(pats)
1187 if not pats:
1187 if not pats:
1188 raise error.Abort(_('no source or destination specified'))
1188 raise error.Abort(_('no source or destination specified'))
1189 if len(pats) == 1:
1189 if len(pats) == 1:
1190 raise error.Abort(_('no destination specified'))
1190 raise error.Abort(_('no destination specified'))
1191 dest = pats.pop()
1191 dest = pats.pop()
1192 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1192 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
1193 if not destdirexists:
1193 if not destdirexists:
1194 if len(pats) > 1 or matchmod.patkind(pats[0]):
1194 if len(pats) > 1 or matchmod.patkind(pats[0]):
1195 raise error.Abort(_('with multiple sources, destination must be an '
1195 raise error.Abort(_('with multiple sources, destination must be an '
1196 'existing directory'))
1196 'existing directory'))
1197 if util.endswithsep(dest):
1197 if util.endswithsep(dest):
1198 raise error.Abort(_('destination %s is not a directory') % dest)
1198 raise error.Abort(_('destination %s is not a directory') % dest)
1199
1199
1200 tfn = targetpathfn
1200 tfn = targetpathfn
1201 if after:
1201 if after:
1202 tfn = targetpathafterfn
1202 tfn = targetpathafterfn
1203 copylist = []
1203 copylist = []
1204 for pat in pats:
1204 for pat in pats:
1205 srcs = walkpat(pat)
1205 srcs = walkpat(pat)
1206 if not srcs:
1206 if not srcs:
1207 continue
1207 continue
1208 copylist.append((tfn(pat, dest, srcs), srcs))
1208 copylist.append((tfn(pat, dest, srcs), srcs))
1209 if not copylist:
1209 if not copylist:
1210 raise error.Abort(_('no files to copy'))
1210 raise error.Abort(_('no files to copy'))
1211
1211
1212 errors = 0
1212 errors = 0
1213 for targetpath, srcs in copylist:
1213 for targetpath, srcs in copylist:
1214 for abssrc, relsrc, exact in srcs:
1214 for abssrc, relsrc, exact in srcs:
1215 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1215 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
1216 errors += 1
1216 errors += 1
1217
1217
1218 if errors:
1218 if errors:
1219 ui.warn(_('(consider using --after)\n'))
1219 ui.warn(_('(consider using --after)\n'))
1220
1220
1221 return errors != 0
1221 return errors != 0
1222
1222
1223 ## facility to let extension process additional data into an import patch
1223 ## facility to let extension process additional data into an import patch
1224 # list of identifier to be executed in order
1224 # list of identifier to be executed in order
1225 extrapreimport = [] # run before commit
1225 extrapreimport = [] # run before commit
1226 extrapostimport = [] # run after commit
1226 extrapostimport = [] # run after commit
1227 # mapping from identifier to actual import function
1227 # mapping from identifier to actual import function
1228 #
1228 #
1229 # 'preimport' are run before the commit is made and are provided the following
1229 # 'preimport' are run before the commit is made and are provided the following
1230 # arguments:
1230 # arguments:
1231 # - repo: the localrepository instance,
1231 # - repo: the localrepository instance,
1232 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1232 # - patchdata: data extracted from patch header (cf m.patch.patchheadermap),
1233 # - extra: the future extra dictionary of the changeset, please mutate it,
1233 # - extra: the future extra dictionary of the changeset, please mutate it,
1234 # - opts: the import options.
1234 # - opts: the import options.
1235 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1235 # XXX ideally, we would just pass an ctx ready to be computed, that would allow
1236 # mutation of in memory commit and more. Feel free to rework the code to get
1236 # mutation of in memory commit and more. Feel free to rework the code to get
1237 # there.
1237 # there.
1238 extrapreimportmap = {}
1238 extrapreimportmap = {}
1239 # 'postimport' are run after the commit is made and are provided the following
1239 # 'postimport' are run after the commit is made and are provided the following
1240 # argument:
1240 # argument:
1241 # - ctx: the changectx created by import.
1241 # - ctx: the changectx created by import.
1242 extrapostimportmap = {}
1242 extrapostimportmap = {}
1243
1243
1244 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1244 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
1245 """Utility function used by commands.import to import a single patch
1245 """Utility function used by commands.import to import a single patch
1246
1246
1247 This function is explicitly defined here to help the evolve extension to
1247 This function is explicitly defined here to help the evolve extension to
1248 wrap this part of the import logic.
1248 wrap this part of the import logic.
1249
1249
1250 The API is currently a bit ugly because it a simple code translation from
1250 The API is currently a bit ugly because it a simple code translation from
1251 the import command. Feel free to make it better.
1251 the import command. Feel free to make it better.
1252
1252
1253 :hunk: a patch (as a binary string)
1253 :hunk: a patch (as a binary string)
1254 :parents: nodes that will be parent of the created commit
1254 :parents: nodes that will be parent of the created commit
1255 :opts: the full dict of option passed to the import command
1255 :opts: the full dict of option passed to the import command
1256 :msgs: list to save commit message to.
1256 :msgs: list to save commit message to.
1257 (used in case we need to save it when failing)
1257 (used in case we need to save it when failing)
1258 :updatefunc: a function that update a repo to a given node
1258 :updatefunc: a function that update a repo to a given node
1259 updatefunc(<repo>, <node>)
1259 updatefunc(<repo>, <node>)
1260 """
1260 """
1261 # avoid cycle context -> subrepo -> cmdutil
1261 # avoid cycle context -> subrepo -> cmdutil
1262 from . import context
1262 from . import context
1263 extractdata = patch.extract(ui, hunk)
1263 extractdata = patch.extract(ui, hunk)
1264 tmpname = extractdata.get('filename')
1264 tmpname = extractdata.get('filename')
1265 message = extractdata.get('message')
1265 message = extractdata.get('message')
1266 user = opts.get('user') or extractdata.get('user')
1266 user = opts.get('user') or extractdata.get('user')
1267 date = opts.get('date') or extractdata.get('date')
1267 date = opts.get('date') or extractdata.get('date')
1268 branch = extractdata.get('branch')
1268 branch = extractdata.get('branch')
1269 nodeid = extractdata.get('nodeid')
1269 nodeid = extractdata.get('nodeid')
1270 p1 = extractdata.get('p1')
1270 p1 = extractdata.get('p1')
1271 p2 = extractdata.get('p2')
1271 p2 = extractdata.get('p2')
1272
1272
1273 nocommit = opts.get('no_commit')
1273 nocommit = opts.get('no_commit')
1274 importbranch = opts.get('import_branch')
1274 importbranch = opts.get('import_branch')
1275 update = not opts.get('bypass')
1275 update = not opts.get('bypass')
1276 strip = opts["strip"]
1276 strip = opts["strip"]
1277 prefix = opts["prefix"]
1277 prefix = opts["prefix"]
1278 sim = float(opts.get('similarity') or 0)
1278 sim = float(opts.get('similarity') or 0)
1279 if not tmpname:
1279 if not tmpname:
1280 return (None, None, False)
1280 return (None, None, False)
1281
1281
1282 rejects = False
1282 rejects = False
1283
1283
1284 try:
1284 try:
1285 cmdline_message = logmessage(ui, opts)
1285 cmdline_message = logmessage(ui, opts)
1286 if cmdline_message:
1286 if cmdline_message:
1287 # pickup the cmdline msg
1287 # pickup the cmdline msg
1288 message = cmdline_message
1288 message = cmdline_message
1289 elif message:
1289 elif message:
1290 # pickup the patch msg
1290 # pickup the patch msg
1291 message = message.strip()
1291 message = message.strip()
1292 else:
1292 else:
1293 # launch the editor
1293 # launch the editor
1294 message = None
1294 message = None
1295 ui.debug('message:\n%s\n' % message)
1295 ui.debug('message:\n%s\n' % message)
1296
1296
1297 if len(parents) == 1:
1297 if len(parents) == 1:
1298 parents.append(repo[nullid])
1298 parents.append(repo[nullid])
1299 if opts.get('exact'):
1299 if opts.get('exact'):
1300 if not nodeid or not p1:
1300 if not nodeid or not p1:
1301 raise error.Abort(_('not a Mercurial patch'))
1301 raise error.Abort(_('not a Mercurial patch'))
1302 p1 = repo[p1]
1302 p1 = repo[p1]
1303 p2 = repo[p2 or nullid]
1303 p2 = repo[p2 or nullid]
1304 elif p2:
1304 elif p2:
1305 try:
1305 try:
1306 p1 = repo[p1]
1306 p1 = repo[p1]
1307 p2 = repo[p2]
1307 p2 = repo[p2]
1308 # Without any options, consider p2 only if the
1308 # Without any options, consider p2 only if the
1309 # patch is being applied on top of the recorded
1309 # patch is being applied on top of the recorded
1310 # first parent.
1310 # first parent.
1311 if p1 != parents[0]:
1311 if p1 != parents[0]:
1312 p1 = parents[0]
1312 p1 = parents[0]
1313 p2 = repo[nullid]
1313 p2 = repo[nullid]
1314 except error.RepoError:
1314 except error.RepoError:
1315 p1, p2 = parents
1315 p1, p2 = parents
1316 if p2.node() == nullid:
1316 if p2.node() == nullid:
1317 ui.warn(_("warning: import the patch as a normal revision\n"
1317 ui.warn(_("warning: import the patch as a normal revision\n"
1318 "(use --exact to import the patch as a merge)\n"))
1318 "(use --exact to import the patch as a merge)\n"))
1319 else:
1319 else:
1320 p1, p2 = parents
1320 p1, p2 = parents
1321
1321
1322 n = None
1322 n = None
1323 if update:
1323 if update:
1324 if p1 != parents[0]:
1324 if p1 != parents[0]:
1325 updatefunc(repo, p1.node())
1325 updatefunc(repo, p1.node())
1326 if p2 != parents[1]:
1326 if p2 != parents[1]:
1327 repo.setparents(p1.node(), p2.node())
1327 repo.setparents(p1.node(), p2.node())
1328
1328
1329 if opts.get('exact') or importbranch:
1329 if opts.get('exact') or importbranch:
1330 repo.dirstate.setbranch(branch or 'default')
1330 repo.dirstate.setbranch(branch or 'default')
1331
1331
1332 partial = opts.get('partial', False)
1332 partial = opts.get('partial', False)
1333 files = set()
1333 files = set()
1334 try:
1334 try:
1335 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1335 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
1336 files=files, eolmode=None, similarity=sim / 100.0)
1336 files=files, eolmode=None, similarity=sim / 100.0)
1337 except patch.PatchError as e:
1337 except patch.PatchError as e:
1338 if not partial:
1338 if not partial:
1339 raise error.Abort(str(e))
1339 raise error.Abort(str(e))
1340 if partial:
1340 if partial:
1341 rejects = True
1341 rejects = True
1342
1342
1343 files = list(files)
1343 files = list(files)
1344 if nocommit:
1344 if nocommit:
1345 if message:
1345 if message:
1346 msgs.append(message)
1346 msgs.append(message)
1347 else:
1347 else:
1348 if opts.get('exact') or p2:
1348 if opts.get('exact') or p2:
1349 # If you got here, you either use --force and know what
1349 # If you got here, you either use --force and know what
1350 # you are doing or used --exact or a merge patch while
1350 # you are doing or used --exact or a merge patch while
1351 # being updated to its first parent.
1351 # being updated to its first parent.
1352 m = None
1352 m = None
1353 else:
1353 else:
1354 m = scmutil.matchfiles(repo, files or [])
1354 m = scmutil.matchfiles(repo, files or [])
1355 editform = mergeeditform(repo[None], 'import.normal')
1355 editform = mergeeditform(repo[None], 'import.normal')
1356 if opts.get('exact'):
1356 if opts.get('exact'):
1357 editor = None
1357 editor = None
1358 else:
1358 else:
1359 editor = getcommiteditor(editform=editform, **opts)
1359 editor = getcommiteditor(editform=editform, **opts)
1360 extra = {}
1360 extra = {}
1361 for idfunc in extrapreimport:
1361 for idfunc in extrapreimport:
1362 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1362 extrapreimportmap[idfunc](repo, extractdata, extra, opts)
1363 overrides = {}
1363 overrides = {}
1364 if partial:
1364 if partial:
1365 overrides[('ui', 'allowemptycommit')] = True
1365 overrides[('ui', 'allowemptycommit')] = True
1366 with repo.ui.configoverride(overrides, 'import'):
1366 with repo.ui.configoverride(overrides, 'import'):
1367 n = repo.commit(message, user,
1367 n = repo.commit(message, user,
1368 date, match=m,
1368 date, match=m,
1369 editor=editor, extra=extra)
1369 editor=editor, extra=extra)
1370 for idfunc in extrapostimport:
1370 for idfunc in extrapostimport:
1371 extrapostimportmap[idfunc](repo[n])
1371 extrapostimportmap[idfunc](repo[n])
1372 else:
1372 else:
1373 if opts.get('exact') or importbranch:
1373 if opts.get('exact') or importbranch:
1374 branch = branch or 'default'
1374 branch = branch or 'default'
1375 else:
1375 else:
1376 branch = p1.branch()
1376 branch = p1.branch()
1377 store = patch.filestore()
1377 store = patch.filestore()
1378 try:
1378 try:
1379 files = set()
1379 files = set()
1380 try:
1380 try:
1381 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1381 patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
1382 files, eolmode=None)
1382 files, eolmode=None)
1383 except patch.PatchError as e:
1383 except patch.PatchError as e:
1384 raise error.Abort(str(e))
1384 raise error.Abort(str(e))
1385 if opts.get('exact'):
1385 if opts.get('exact'):
1386 editor = None
1386 editor = None
1387 else:
1387 else:
1388 editor = getcommiteditor(editform='import.bypass')
1388 editor = getcommiteditor(editform='import.bypass')
1389 memctx = context.memctx(repo, (p1.node(), p2.node()),
1389 memctx = context.memctx(repo, (p1.node(), p2.node()),
1390 message,
1390 message,
1391 files=files,
1391 files=files,
1392 filectxfn=store,
1392 filectxfn=store,
1393 user=user,
1393 user=user,
1394 date=date,
1394 date=date,
1395 branch=branch,
1395 branch=branch,
1396 editor=editor)
1396 editor=editor)
1397 n = memctx.commit()
1397 n = memctx.commit()
1398 finally:
1398 finally:
1399 store.close()
1399 store.close()
1400 if opts.get('exact') and nocommit:
1400 if opts.get('exact') and nocommit:
1401 # --exact with --no-commit is still useful in that it does merge
1401 # --exact with --no-commit is still useful in that it does merge
1402 # and branch bits
1402 # and branch bits
1403 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1403 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1404 elif opts.get('exact') and hex(n) != nodeid:
1404 elif opts.get('exact') and hex(n) != nodeid:
1405 raise error.Abort(_('patch is damaged or loses information'))
1405 raise error.Abort(_('patch is damaged or loses information'))
1406 msg = _('applied to working directory')
1406 msg = _('applied to working directory')
1407 if n:
1407 if n:
1408 # i18n: refers to a short changeset id
1408 # i18n: refers to a short changeset id
1409 msg = _('created %s') % short(n)
1409 msg = _('created %s') % short(n)
1410 return (msg, n, rejects)
1410 return (msg, n, rejects)
1411 finally:
1411 finally:
1412 os.unlink(tmpname)
1412 os.unlink(tmpname)
1413
1413
1414 # facility to let extensions include additional data in an exported patch
1414 # facility to let extensions include additional data in an exported patch
1415 # list of identifiers to be executed in order
1415 # list of identifiers to be executed in order
1416 extraexport = []
1416 extraexport = []
1417 # mapping from identifier to actual export function
1417 # mapping from identifier to actual export function
1418 # function as to return a string to be added to the header or None
1418 # function as to return a string to be added to the header or None
1419 # it is given two arguments (sequencenumber, changectx)
1419 # it is given two arguments (sequencenumber, changectx)
1420 extraexportmap = {}
1420 extraexportmap = {}
1421
1421
1422 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1422 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
1423 node = scmutil.binnode(ctx)
1423 node = scmutil.binnode(ctx)
1424 parents = [p.node() for p in ctx.parents() if p]
1424 parents = [p.node() for p in ctx.parents() if p]
1425 branch = ctx.branch()
1425 branch = ctx.branch()
1426 if switch_parent:
1426 if switch_parent:
1427 parents.reverse()
1427 parents.reverse()
1428
1428
1429 if parents:
1429 if parents:
1430 prev = parents[0]
1430 prev = parents[0]
1431 else:
1431 else:
1432 prev = nullid
1432 prev = nullid
1433
1433
1434 write("# HG changeset patch\n")
1434 write("# HG changeset patch\n")
1435 write("# User %s\n" % ctx.user())
1435 write("# User %s\n" % ctx.user())
1436 write("# Date %d %d\n" % ctx.date())
1436 write("# Date %d %d\n" % ctx.date())
1437 write("# %s\n" % util.datestr(ctx.date()))
1437 write("# %s\n" % util.datestr(ctx.date()))
1438 if branch and branch != 'default':
1438 if branch and branch != 'default':
1439 write("# Branch %s\n" % branch)
1439 write("# Branch %s\n" % branch)
1440 write("# Node ID %s\n" % hex(node))
1440 write("# Node ID %s\n" % hex(node))
1441 write("# Parent %s\n" % hex(prev))
1441 write("# Parent %s\n" % hex(prev))
1442 if len(parents) > 1:
1442 if len(parents) > 1:
1443 write("# Parent %s\n" % hex(parents[1]))
1443 write("# Parent %s\n" % hex(parents[1]))
1444
1444
1445 for headerid in extraexport:
1445 for headerid in extraexport:
1446 header = extraexportmap[headerid](seqno, ctx)
1446 header = extraexportmap[headerid](seqno, ctx)
1447 if header is not None:
1447 if header is not None:
1448 write('# %s\n' % header)
1448 write('# %s\n' % header)
1449 write(ctx.description().rstrip())
1449 write(ctx.description().rstrip())
1450 write("\n\n")
1450 write("\n\n")
1451
1451
1452 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1452 for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts):
1453 write(chunk, label=label)
1453 write(chunk, label=label)
1454
1454
1455 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1455 def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False,
1456 opts=None, match=None):
1456 opts=None, match=None):
1457 '''export changesets as hg patches
1457 '''export changesets as hg patches
1458
1458
1459 Args:
1459 Args:
1460 repo: The repository from which we're exporting revisions.
1460 repo: The repository from which we're exporting revisions.
1461 revs: A list of revisions to export as revision numbers.
1461 revs: A list of revisions to export as revision numbers.
1462 fntemplate: An optional string to use for generating patch file names.
1462 fntemplate: An optional string to use for generating patch file names.
1463 fp: An optional file-like object to which patches should be written.
1463 fp: An optional file-like object to which patches should be written.
1464 switch_parent: If True, show diffs against second parent when not nullid.
1464 switch_parent: If True, show diffs against second parent when not nullid.
1465 Default is false, which always shows diff against p1.
1465 Default is false, which always shows diff against p1.
1466 opts: diff options to use for generating the patch.
1466 opts: diff options to use for generating the patch.
1467 match: If specified, only export changes to files matching this matcher.
1467 match: If specified, only export changes to files matching this matcher.
1468
1468
1469 Returns:
1469 Returns:
1470 Nothing.
1470 Nothing.
1471
1471
1472 Side Effect:
1472 Side Effect:
1473 "HG Changeset Patch" data is emitted to one of the following
1473 "HG Changeset Patch" data is emitted to one of the following
1474 destinations:
1474 destinations:
1475 fp is specified: All revs are written to the specified
1475 fp is specified: All revs are written to the specified
1476 file-like object.
1476 file-like object.
1477 fntemplate specified: Each rev is written to a unique file named using
1477 fntemplate specified: Each rev is written to a unique file named using
1478 the given template.
1478 the given template.
1479 Neither fp nor template specified: All revs written to repo.ui.write()
1479 Neither fp nor template specified: All revs written to repo.ui.write()
1480 '''
1480 '''
1481
1481
1482 total = len(revs)
1482 total = len(revs)
1483 revwidth = max(len(str(rev)) for rev in revs)
1483 revwidth = max(len(str(rev)) for rev in revs)
1484 filemode = {}
1484 filemode = {}
1485
1485
1486 write = None
1486 write = None
1487 dest = '<unnamed>'
1487 dest = '<unnamed>'
1488 if fp:
1488 if fp:
1489 dest = getattr(fp, 'name', dest)
1489 dest = getattr(fp, 'name', dest)
1490 def write(s, **kw):
1490 def write(s, **kw):
1491 fp.write(s)
1491 fp.write(s)
1492 elif not fntemplate:
1492 elif not fntemplate:
1493 write = repo.ui.write
1493 write = repo.ui.write
1494
1494
1495 for seqno, rev in enumerate(revs, 1):
1495 for seqno, rev in enumerate(revs, 1):
1496 ctx = repo[rev]
1496 ctx = repo[rev]
1497 fo = None
1497 fo = None
1498 if not fp and fntemplate:
1498 if not fp and fntemplate:
1499 desc_lines = ctx.description().rstrip().split('\n')
1499 desc_lines = ctx.description().rstrip().split('\n')
1500 desc = desc_lines[0] #Commit always has a first line.
1500 desc = desc_lines[0] #Commit always has a first line.
1501 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1501 fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc,
1502 total=total, seqno=seqno, revwidth=revwidth,
1502 total=total, seqno=seqno, revwidth=revwidth,
1503 mode='wb', modemap=filemode)
1503 mode='wb', modemap=filemode)
1504 dest = fo.name
1504 dest = fo.name
1505 def write(s, **kw):
1505 def write(s, **kw):
1506 fo.write(s)
1506 fo.write(s)
1507 if not dest.startswith('<'):
1507 if not dest.startswith('<'):
1508 repo.ui.note("%s\n" % dest)
1508 repo.ui.note("%s\n" % dest)
1509 _exportsingle(
1509 _exportsingle(
1510 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1510 repo, ctx, match, switch_parent, rev, seqno, write, opts)
1511 if fo is not None:
1511 if fo is not None:
1512 fo.close()
1512 fo.close()
1513
1513
1514 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1514 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
1515 changes=None, stat=False, fp=None, prefix='',
1515 changes=None, stat=False, fp=None, prefix='',
1516 root='', listsubrepos=False):
1516 root='', listsubrepos=False):
1517 '''show diff or diffstat.'''
1517 '''show diff or diffstat.'''
1518 if fp is None:
1518 if fp is None:
1519 write = ui.write
1519 write = ui.write
1520 else:
1520 else:
1521 def write(s, **kw):
1521 def write(s, **kw):
1522 fp.write(s)
1522 fp.write(s)
1523
1523
1524 if root:
1524 if root:
1525 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1525 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
1526 else:
1526 else:
1527 relroot = ''
1527 relroot = ''
1528 if relroot != '':
1528 if relroot != '':
1529 # XXX relative roots currently don't work if the root is within a
1529 # XXX relative roots currently don't work if the root is within a
1530 # subrepo
1530 # subrepo
1531 uirelroot = match.uipath(relroot)
1531 uirelroot = match.uipath(relroot)
1532 relroot += '/'
1532 relroot += '/'
1533 for matchroot in match.files():
1533 for matchroot in match.files():
1534 if not matchroot.startswith(relroot):
1534 if not matchroot.startswith(relroot):
1535 ui.warn(_('warning: %s not inside relative root %s\n') % (
1535 ui.warn(_('warning: %s not inside relative root %s\n') % (
1536 match.uipath(matchroot), uirelroot))
1536 match.uipath(matchroot), uirelroot))
1537
1537
1538 if stat:
1538 if stat:
1539 diffopts = diffopts.copy(context=0)
1539 diffopts = diffopts.copy(context=0)
1540 width = 80
1540 width = 80
1541 if not ui.plain():
1541 if not ui.plain():
1542 width = ui.termwidth()
1542 width = ui.termwidth()
1543 chunks = patch.diff(repo, node1, node2, match, changes, diffopts,
1543 chunks = patch.diff(repo, node1, node2, match, changes, diffopts,
1544 prefix=prefix, relroot=relroot)
1544 prefix=prefix, relroot=relroot)
1545 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1545 for chunk, label in patch.diffstatui(util.iterlines(chunks),
1546 width=width):
1546 width=width):
1547 write(chunk, label=label)
1547 write(chunk, label=label)
1548 else:
1548 else:
1549 for chunk, label in patch.diffui(repo, node1, node2, match,
1549 for chunk, label in patch.diffui(repo, node1, node2, match,
1550 changes, diffopts, prefix=prefix,
1550 changes, diffopts, prefix=prefix,
1551 relroot=relroot):
1551 relroot=relroot):
1552 write(chunk, label=label)
1552 write(chunk, label=label)
1553
1553
1554 if listsubrepos:
1554 if listsubrepos:
1555 ctx1 = repo[node1]
1555 ctx1 = repo[node1]
1556 ctx2 = repo[node2]
1556 ctx2 = repo[node2]
1557 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1557 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1558 tempnode2 = node2
1558 tempnode2 = node2
1559 try:
1559 try:
1560 if node2 is not None:
1560 if node2 is not None:
1561 tempnode2 = ctx2.substate[subpath][1]
1561 tempnode2 = ctx2.substate[subpath][1]
1562 except KeyError:
1562 except KeyError:
1563 # A subrepo that existed in node1 was deleted between node1 and
1563 # A subrepo that existed in node1 was deleted between node1 and
1564 # node2 (inclusive). Thus, ctx2's substate won't contain that
1564 # node2 (inclusive). Thus, ctx2's substate won't contain that
1565 # subpath. The best we can do is to ignore it.
1565 # subpath. The best we can do is to ignore it.
1566 tempnode2 = None
1566 tempnode2 = None
1567 submatch = matchmod.subdirmatcher(subpath, match)
1567 submatch = matchmod.subdirmatcher(subpath, match)
1568 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1568 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1569 stat=stat, fp=fp, prefix=prefix)
1569 stat=stat, fp=fp, prefix=prefix)
1570
1570
1571 def _changesetlabels(ctx):
1571 def _changesetlabels(ctx):
1572 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1572 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1573 if ctx.obsolete():
1573 if ctx.obsolete():
1574 labels.append('changeset.obsolete')
1574 labels.append('changeset.obsolete')
1575 if ctx.isunstable():
1575 if ctx.isunstable():
1576 labels.append('changeset.unstable')
1576 labels.append('changeset.unstable')
1577 for instability in ctx.instabilities():
1577 for instability in ctx.instabilities():
1578 labels.append('instability.%s' % instability)
1578 labels.append('instability.%s' % instability)
1579 return ' '.join(labels)
1579 return ' '.join(labels)
1580
1580
1581 class changeset_printer(object):
1581 class changeset_printer(object):
1582 '''show changeset information when templating not requested.'''
1582 '''show changeset information when templating not requested.'''
1583
1583
1584 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1584 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1585 self.ui = ui
1585 self.ui = ui
1586 self.repo = repo
1586 self.repo = repo
1587 self.buffered = buffered
1587 self.buffered = buffered
1588 self.matchfn = matchfn
1588 self.matchfn = matchfn
1589 self.diffopts = diffopts
1589 self.diffopts = diffopts
1590 self.header = {}
1590 self.header = {}
1591 self.hunk = {}
1591 self.hunk = {}
1592 self.lastheader = None
1592 self.lastheader = None
1593 self.footer = None
1593 self.footer = None
1594
1594
1595 def flush(self, ctx):
1595 def flush(self, ctx):
1596 rev = ctx.rev()
1596 rev = ctx.rev()
1597 if rev in self.header:
1597 if rev in self.header:
1598 h = self.header[rev]
1598 h = self.header[rev]
1599 if h != self.lastheader:
1599 if h != self.lastheader:
1600 self.lastheader = h
1600 self.lastheader = h
1601 self.ui.write(h)
1601 self.ui.write(h)
1602 del self.header[rev]
1602 del self.header[rev]
1603 if rev in self.hunk:
1603 if rev in self.hunk:
1604 self.ui.write(self.hunk[rev])
1604 self.ui.write(self.hunk[rev])
1605 del self.hunk[rev]
1605 del self.hunk[rev]
1606 return 1
1606 return 1
1607 return 0
1607 return 0
1608
1608
1609 def close(self):
1609 def close(self):
1610 if self.footer:
1610 if self.footer:
1611 self.ui.write(self.footer)
1611 self.ui.write(self.footer)
1612
1612
1613 def show(self, ctx, copies=None, matchfn=None, **props):
1613 def show(self, ctx, copies=None, matchfn=None, **props):
1614 props = pycompat.byteskwargs(props)
1614 props = pycompat.byteskwargs(props)
1615 if self.buffered:
1615 if self.buffered:
1616 self.ui.pushbuffer(labeled=True)
1616 self.ui.pushbuffer(labeled=True)
1617 self._show(ctx, copies, matchfn, props)
1617 self._show(ctx, copies, matchfn, props)
1618 self.hunk[ctx.rev()] = self.ui.popbuffer()
1618 self.hunk[ctx.rev()] = self.ui.popbuffer()
1619 else:
1619 else:
1620 self._show(ctx, copies, matchfn, props)
1620 self._show(ctx, copies, matchfn, props)
1621
1621
1622 def _show(self, ctx, copies, matchfn, props):
1622 def _show(self, ctx, copies, matchfn, props):
1623 '''show a single changeset or file revision'''
1623 '''show a single changeset or file revision'''
1624 changenode = ctx.node()
1624 changenode = ctx.node()
1625 rev = ctx.rev()
1625 rev = ctx.rev()
1626 if self.ui.debugflag:
1626 if self.ui.debugflag:
1627 hexfunc = hex
1627 hexfunc = hex
1628 else:
1628 else:
1629 hexfunc = short
1629 hexfunc = short
1630 # as of now, wctx.node() and wctx.rev() return None, but we want to
1630 # as of now, wctx.node() and wctx.rev() return None, but we want to
1631 # show the same values as {node} and {rev} templatekw
1631 # show the same values as {node} and {rev} templatekw
1632 revnode = (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
1632 revnode = (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
1633
1633
1634 if self.ui.quiet:
1634 if self.ui.quiet:
1635 self.ui.write("%d:%s\n" % revnode, label='log.node')
1635 self.ui.write("%d:%s\n" % revnode, label='log.node')
1636 return
1636 return
1637
1637
1638 date = util.datestr(ctx.date())
1638 date = util.datestr(ctx.date())
1639
1639
1640 # i18n: column positioning for "hg log"
1640 # i18n: column positioning for "hg log"
1641 self.ui.write(_("changeset: %d:%s\n") % revnode,
1641 self.ui.write(_("changeset: %d:%s\n") % revnode,
1642 label=_changesetlabels(ctx))
1642 label=_changesetlabels(ctx))
1643
1643
1644 # branches are shown first before any other names due to backwards
1644 # branches are shown first before any other names due to backwards
1645 # compatibility
1645 # compatibility
1646 branch = ctx.branch()
1646 branch = ctx.branch()
1647 # don't show the default branch name
1647 # don't show the default branch name
1648 if branch != 'default':
1648 if branch != 'default':
1649 # i18n: column positioning for "hg log"
1649 # i18n: column positioning for "hg log"
1650 self.ui.write(_("branch: %s\n") % branch,
1650 self.ui.write(_("branch: %s\n") % branch,
1651 label='log.branch')
1651 label='log.branch')
1652
1652
1653 for nsname, ns in self.repo.names.iteritems():
1653 for nsname, ns in self.repo.names.iteritems():
1654 # branches has special logic already handled above, so here we just
1654 # branches has special logic already handled above, so here we just
1655 # skip it
1655 # skip it
1656 if nsname == 'branches':
1656 if nsname == 'branches':
1657 continue
1657 continue
1658 # we will use the templatename as the color name since those two
1658 # we will use the templatename as the color name since those two
1659 # should be the same
1659 # should be the same
1660 for name in ns.names(self.repo, changenode):
1660 for name in ns.names(self.repo, changenode):
1661 self.ui.write(ns.logfmt % name,
1661 self.ui.write(ns.logfmt % name,
1662 label='log.%s' % ns.colorname)
1662 label='log.%s' % ns.colorname)
1663 if self.ui.debugflag:
1663 if self.ui.debugflag:
1664 # i18n: column positioning for "hg log"
1664 # i18n: column positioning for "hg log"
1665 self.ui.write(_("phase: %s\n") % ctx.phasestr(),
1665 self.ui.write(_("phase: %s\n") % ctx.phasestr(),
1666 label='log.phase')
1666 label='log.phase')
1667 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1667 for pctx in scmutil.meaningfulparents(self.repo, ctx):
1668 label = 'log.parent changeset.%s' % pctx.phasestr()
1668 label = 'log.parent changeset.%s' % pctx.phasestr()
1669 # i18n: column positioning for "hg log"
1669 # i18n: column positioning for "hg log"
1670 self.ui.write(_("parent: %d:%s\n")
1670 self.ui.write(_("parent: %d:%s\n")
1671 % (pctx.rev(), hexfunc(pctx.node())),
1671 % (pctx.rev(), hexfunc(pctx.node())),
1672 label=label)
1672 label=label)
1673
1673
1674 if self.ui.debugflag and rev is not None:
1674 if self.ui.debugflag and rev is not None:
1675 mnode = ctx.manifestnode()
1675 mnode = ctx.manifestnode()
1676 # i18n: column positioning for "hg log"
1676 # i18n: column positioning for "hg log"
1677 self.ui.write(_("manifest: %d:%s\n") %
1677 self.ui.write(_("manifest: %d:%s\n") %
1678 (self.repo.manifestlog._revlog.rev(mnode),
1678 (self.repo.manifestlog._revlog.rev(mnode),
1679 hex(mnode)),
1679 hex(mnode)),
1680 label='ui.debug log.manifest')
1680 label='ui.debug log.manifest')
1681 # i18n: column positioning for "hg log"
1681 # i18n: column positioning for "hg log"
1682 self.ui.write(_("user: %s\n") % ctx.user(),
1682 self.ui.write(_("user: %s\n") % ctx.user(),
1683 label='log.user')
1683 label='log.user')
1684 # i18n: column positioning for "hg log"
1684 # i18n: column positioning for "hg log"
1685 self.ui.write(_("date: %s\n") % date,
1685 self.ui.write(_("date: %s\n") % date,
1686 label='log.date')
1686 label='log.date')
1687
1687
1688 if ctx.isunstable():
1688 if ctx.isunstable():
1689 # i18n: column positioning for "hg log"
1689 # i18n: column positioning for "hg log"
1690 instabilities = ctx.instabilities()
1690 instabilities = ctx.instabilities()
1691 self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
1691 self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
1692 label='log.instability')
1692 label='log.instability')
1693
1693
1694 self._exthook(ctx)
1694 self._exthook(ctx)
1695
1695
1696 if self.ui.debugflag:
1696 if self.ui.debugflag:
1697 files = ctx.p1().status(ctx)[:3]
1697 files = ctx.p1().status(ctx)[:3]
1698 for key, value in zip([# i18n: column positioning for "hg log"
1698 for key, value in zip([# i18n: column positioning for "hg log"
1699 _("files:"),
1699 _("files:"),
1700 # i18n: column positioning for "hg log"
1700 # i18n: column positioning for "hg log"
1701 _("files+:"),
1701 _("files+:"),
1702 # i18n: column positioning for "hg log"
1702 # i18n: column positioning for "hg log"
1703 _("files-:")], files):
1703 _("files-:")], files):
1704 if value:
1704 if value:
1705 self.ui.write("%-12s %s\n" % (key, " ".join(value)),
1705 self.ui.write("%-12s %s\n" % (key, " ".join(value)),
1706 label='ui.debug log.files')
1706 label='ui.debug log.files')
1707 elif ctx.files() and self.ui.verbose:
1707 elif ctx.files() and self.ui.verbose:
1708 # i18n: column positioning for "hg log"
1708 # i18n: column positioning for "hg log"
1709 self.ui.write(_("files: %s\n") % " ".join(ctx.files()),
1709 self.ui.write(_("files: %s\n") % " ".join(ctx.files()),
1710 label='ui.note log.files')
1710 label='ui.note log.files')
1711 if copies and self.ui.verbose:
1711 if copies and self.ui.verbose:
1712 copies = ['%s (%s)' % c for c in copies]
1712 copies = ['%s (%s)' % c for c in copies]
1713 # i18n: column positioning for "hg log"
1713 # i18n: column positioning for "hg log"
1714 self.ui.write(_("copies: %s\n") % ' '.join(copies),
1714 self.ui.write(_("copies: %s\n") % ' '.join(copies),
1715 label='ui.note log.copies')
1715 label='ui.note log.copies')
1716
1716
1717 extra = ctx.extra()
1717 extra = ctx.extra()
1718 if extra and self.ui.debugflag:
1718 if extra and self.ui.debugflag:
1719 for key, value in sorted(extra.items()):
1719 for key, value in sorted(extra.items()):
1720 # i18n: column positioning for "hg log"
1720 # i18n: column positioning for "hg log"
1721 self.ui.write(_("extra: %s=%s\n")
1721 self.ui.write(_("extra: %s=%s\n")
1722 % (key, util.escapestr(value)),
1722 % (key, util.escapestr(value)),
1723 label='ui.debug log.extra')
1723 label='ui.debug log.extra')
1724
1724
1725 description = ctx.description().strip()
1725 description = ctx.description().strip()
1726 if description:
1726 if description:
1727 if self.ui.verbose:
1727 if self.ui.verbose:
1728 self.ui.write(_("description:\n"),
1728 self.ui.write(_("description:\n"),
1729 label='ui.note log.description')
1729 label='ui.note log.description')
1730 self.ui.write(description,
1730 self.ui.write(description,
1731 label='ui.note log.description')
1731 label='ui.note log.description')
1732 self.ui.write("\n\n")
1732 self.ui.write("\n\n")
1733 else:
1733 else:
1734 # i18n: column positioning for "hg log"
1734 # i18n: column positioning for "hg log"
1735 self.ui.write(_("summary: %s\n") %
1735 self.ui.write(_("summary: %s\n") %
1736 description.splitlines()[0],
1736 description.splitlines()[0],
1737 label='log.summary')
1737 label='log.summary')
1738 self.ui.write("\n")
1738 self.ui.write("\n")
1739
1739
1740 self.showpatch(ctx, matchfn)
1740 self.showpatch(ctx, matchfn)
1741
1741
1742 def _exthook(self, ctx):
1742 def _exthook(self, ctx):
1743 '''empty method used by extension as a hook point
1743 '''empty method used by extension as a hook point
1744 '''
1744 '''
1745 pass
1745 pass
1746
1746
1747 def showpatch(self, ctx, matchfn):
1747 def showpatch(self, ctx, matchfn):
1748 if not matchfn:
1748 if not matchfn:
1749 matchfn = self.matchfn
1749 matchfn = self.matchfn
1750 if matchfn:
1750 if matchfn:
1751 stat = self.diffopts.get('stat')
1751 stat = self.diffopts.get('stat')
1752 diff = self.diffopts.get('patch')
1752 diff = self.diffopts.get('patch')
1753 diffopts = patch.diffallopts(self.ui, self.diffopts)
1753 diffopts = patch.diffallopts(self.ui, self.diffopts)
1754 node = ctx.node()
1754 node = ctx.node()
1755 prev = ctx.p1().node()
1755 prev = ctx.p1().node()
1756 if stat:
1756 if stat:
1757 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1757 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1758 match=matchfn, stat=True)
1758 match=matchfn, stat=True)
1759 if diff:
1759 if diff:
1760 if stat:
1760 if stat:
1761 self.ui.write("\n")
1761 self.ui.write("\n")
1762 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1762 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1763 match=matchfn, stat=False)
1763 match=matchfn, stat=False)
1764 self.ui.write("\n")
1764 self.ui.write("\n")
1765
1765
1766 class jsonchangeset(changeset_printer):
1766 class jsonchangeset(changeset_printer):
1767 '''format changeset information.'''
1767 '''format changeset information.'''
1768
1768
1769 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1769 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1770 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1770 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1771 self.cache = {}
1771 self.cache = {}
1772 self._first = True
1772 self._first = True
1773
1773
1774 def close(self):
1774 def close(self):
1775 if not self._first:
1775 if not self._first:
1776 self.ui.write("\n]\n")
1776 self.ui.write("\n]\n")
1777 else:
1777 else:
1778 self.ui.write("[]\n")
1778 self.ui.write("[]\n")
1779
1779
1780 def _show(self, ctx, copies, matchfn, props):
1780 def _show(self, ctx, copies, matchfn, props):
1781 '''show a single changeset or file revision'''
1781 '''show a single changeset or file revision'''
1782 rev = ctx.rev()
1782 rev = ctx.rev()
1783 if rev is None:
1783 if rev is None:
1784 jrev = jnode = 'null'
1784 jrev = jnode = 'null'
1785 else:
1785 else:
1786 jrev = '%d' % rev
1786 jrev = '%d' % rev
1787 jnode = '"%s"' % hex(ctx.node())
1787 jnode = '"%s"' % hex(ctx.node())
1788 j = encoding.jsonescape
1788 j = encoding.jsonescape
1789
1789
1790 if self._first:
1790 if self._first:
1791 self.ui.write("[\n {")
1791 self.ui.write("[\n {")
1792 self._first = False
1792 self._first = False
1793 else:
1793 else:
1794 self.ui.write(",\n {")
1794 self.ui.write(",\n {")
1795
1795
1796 if self.ui.quiet:
1796 if self.ui.quiet:
1797 self.ui.write(('\n "rev": %s') % jrev)
1797 self.ui.write(('\n "rev": %s') % jrev)
1798 self.ui.write((',\n "node": %s') % jnode)
1798 self.ui.write((',\n "node": %s') % jnode)
1799 self.ui.write('\n }')
1799 self.ui.write('\n }')
1800 return
1800 return
1801
1801
1802 self.ui.write(('\n "rev": %s') % jrev)
1802 self.ui.write(('\n "rev": %s') % jrev)
1803 self.ui.write((',\n "node": %s') % jnode)
1803 self.ui.write((',\n "node": %s') % jnode)
1804 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1804 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
1805 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1805 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
1806 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1806 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
1807 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1807 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
1808 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1808 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
1809
1809
1810 self.ui.write((',\n "bookmarks": [%s]') %
1810 self.ui.write((',\n "bookmarks": [%s]') %
1811 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1811 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1812 self.ui.write((',\n "tags": [%s]') %
1812 self.ui.write((',\n "tags": [%s]') %
1813 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1813 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1814 self.ui.write((',\n "parents": [%s]') %
1814 self.ui.write((',\n "parents": [%s]') %
1815 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1815 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1816
1816
1817 if self.ui.debugflag:
1817 if self.ui.debugflag:
1818 if rev is None:
1818 if rev is None:
1819 jmanifestnode = 'null'
1819 jmanifestnode = 'null'
1820 else:
1820 else:
1821 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1821 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
1822 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1822 self.ui.write((',\n "manifest": %s') % jmanifestnode)
1823
1823
1824 self.ui.write((',\n "extra": {%s}') %
1824 self.ui.write((',\n "extra": {%s}') %
1825 ", ".join('"%s": "%s"' % (j(k), j(v))
1825 ", ".join('"%s": "%s"' % (j(k), j(v))
1826 for k, v in ctx.extra().items()))
1826 for k, v in ctx.extra().items()))
1827
1827
1828 files = ctx.p1().status(ctx)
1828 files = ctx.p1().status(ctx)
1829 self.ui.write((',\n "modified": [%s]') %
1829 self.ui.write((',\n "modified": [%s]') %
1830 ", ".join('"%s"' % j(f) for f in files[0]))
1830 ", ".join('"%s"' % j(f) for f in files[0]))
1831 self.ui.write((',\n "added": [%s]') %
1831 self.ui.write((',\n "added": [%s]') %
1832 ", ".join('"%s"' % j(f) for f in files[1]))
1832 ", ".join('"%s"' % j(f) for f in files[1]))
1833 self.ui.write((',\n "removed": [%s]') %
1833 self.ui.write((',\n "removed": [%s]') %
1834 ", ".join('"%s"' % j(f) for f in files[2]))
1834 ", ".join('"%s"' % j(f) for f in files[2]))
1835
1835
1836 elif self.ui.verbose:
1836 elif self.ui.verbose:
1837 self.ui.write((',\n "files": [%s]') %
1837 self.ui.write((',\n "files": [%s]') %
1838 ", ".join('"%s"' % j(f) for f in ctx.files()))
1838 ", ".join('"%s"' % j(f) for f in ctx.files()))
1839
1839
1840 if copies:
1840 if copies:
1841 self.ui.write((',\n "copies": {%s}') %
1841 self.ui.write((',\n "copies": {%s}') %
1842 ", ".join('"%s": "%s"' % (j(k), j(v))
1842 ", ".join('"%s": "%s"' % (j(k), j(v))
1843 for k, v in copies))
1843 for k, v in copies))
1844
1844
1845 matchfn = self.matchfn
1845 matchfn = self.matchfn
1846 if matchfn:
1846 if matchfn:
1847 stat = self.diffopts.get('stat')
1847 stat = self.diffopts.get('stat')
1848 diff = self.diffopts.get('patch')
1848 diff = self.diffopts.get('patch')
1849 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1849 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1850 node, prev = ctx.node(), ctx.p1().node()
1850 node, prev = ctx.node(), ctx.p1().node()
1851 if stat:
1851 if stat:
1852 self.ui.pushbuffer()
1852 self.ui.pushbuffer()
1853 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1853 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1854 match=matchfn, stat=True)
1854 match=matchfn, stat=True)
1855 self.ui.write((',\n "diffstat": "%s"')
1855 self.ui.write((',\n "diffstat": "%s"')
1856 % j(self.ui.popbuffer()))
1856 % j(self.ui.popbuffer()))
1857 if diff:
1857 if diff:
1858 self.ui.pushbuffer()
1858 self.ui.pushbuffer()
1859 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1859 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1860 match=matchfn, stat=False)
1860 match=matchfn, stat=False)
1861 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1861 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
1862
1862
1863 self.ui.write("\n }")
1863 self.ui.write("\n }")
1864
1864
1865 class changeset_templater(changeset_printer):
1865 class changeset_templater(changeset_printer):
1866 '''format changeset information.'''
1866 '''format changeset information.'''
1867
1867
1868 # Arguments before "buffered" used to be positional. Consider not
1868 # Arguments before "buffered" used to be positional. Consider not
1869 # adding/removing arguments before "buffered" to not break callers.
1869 # adding/removing arguments before "buffered" to not break callers.
1870 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1870 def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None,
1871 buffered=False):
1871 buffered=False):
1872 diffopts = diffopts or {}
1872 diffopts = diffopts or {}
1873
1873
1874 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1874 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1875 self.t = formatter.loadtemplater(ui, tmplspec,
1875 self.t = formatter.loadtemplater(ui, tmplspec,
1876 cache=templatekw.defaulttempl)
1876 cache=templatekw.defaulttempl)
1877 self._counter = itertools.count()
1877 self._counter = itertools.count()
1878 self.cache = {}
1878 self.cache = {}
1879
1879
1880 self._tref = tmplspec.ref
1880 self._tref = tmplspec.ref
1881 self._parts = {'header': '', 'footer': '',
1881 self._parts = {'header': '', 'footer': '',
1882 tmplspec.ref: tmplspec.ref,
1882 tmplspec.ref: tmplspec.ref,
1883 'docheader': '', 'docfooter': '',
1883 'docheader': '', 'docfooter': '',
1884 'separator': ''}
1884 'separator': ''}
1885 if tmplspec.mapfile:
1885 if tmplspec.mapfile:
1886 # find correct templates for current mode, for backward
1886 # find correct templates for current mode, for backward
1887 # compatibility with 'log -v/-q/--debug' using a mapfile
1887 # compatibility with 'log -v/-q/--debug' using a mapfile
1888 tmplmodes = [
1888 tmplmodes = [
1889 (True, ''),
1889 (True, ''),
1890 (self.ui.verbose, '_verbose'),
1890 (self.ui.verbose, '_verbose'),
1891 (self.ui.quiet, '_quiet'),
1891 (self.ui.quiet, '_quiet'),
1892 (self.ui.debugflag, '_debug'),
1892 (self.ui.debugflag, '_debug'),
1893 ]
1893 ]
1894 for mode, postfix in tmplmodes:
1894 for mode, postfix in tmplmodes:
1895 for t in self._parts:
1895 for t in self._parts:
1896 cur = t + postfix
1896 cur = t + postfix
1897 if mode and cur in self.t:
1897 if mode and cur in self.t:
1898 self._parts[t] = cur
1898 self._parts[t] = cur
1899 else:
1899 else:
1900 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1900 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1901 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1901 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1902 self._parts.update(m)
1902 self._parts.update(m)
1903
1903
1904 if self._parts['docheader']:
1904 if self._parts['docheader']:
1905 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1905 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1906
1906
1907 def close(self):
1907 def close(self):
1908 if self._parts['docfooter']:
1908 if self._parts['docfooter']:
1909 if not self.footer:
1909 if not self.footer:
1910 self.footer = ""
1910 self.footer = ""
1911 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1911 self.footer += templater.stringify(self.t(self._parts['docfooter']))
1912 return super(changeset_templater, self).close()
1912 return super(changeset_templater, self).close()
1913
1913
1914 def _show(self, ctx, copies, matchfn, props):
1914 def _show(self, ctx, copies, matchfn, props):
1915 '''show a single changeset or file revision'''
1915 '''show a single changeset or file revision'''
1916 props = props.copy()
1916 props = props.copy()
1917 props.update(templatekw.keywords)
1917 props.update(templatekw.keywords)
1918 props['templ'] = self.t
1918 props['templ'] = self.t
1919 props['ctx'] = ctx
1919 props['ctx'] = ctx
1920 props['repo'] = self.repo
1920 props['repo'] = self.repo
1921 props['ui'] = self.repo.ui
1921 props['ui'] = self.repo.ui
1922 props['index'] = index = next(self._counter)
1922 props['index'] = index = next(self._counter)
1923 props['revcache'] = {'copies': copies}
1923 props['revcache'] = {'copies': copies}
1924 props['cache'] = self.cache
1924 props['cache'] = self.cache
1925 props = pycompat.strkwargs(props)
1925 props = pycompat.strkwargs(props)
1926
1926
1927 # write separator, which wouldn't work well with the header part below
1927 # write separator, which wouldn't work well with the header part below
1928 # since there's inherently a conflict between header (across items) and
1928 # since there's inherently a conflict between header (across items) and
1929 # separator (per item)
1929 # separator (per item)
1930 if self._parts['separator'] and index > 0:
1930 if self._parts['separator'] and index > 0:
1931 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1931 self.ui.write(templater.stringify(self.t(self._parts['separator'])))
1932
1932
1933 # write header
1933 # write header
1934 if self._parts['header']:
1934 if self._parts['header']:
1935 h = templater.stringify(self.t(self._parts['header'], **props))
1935 h = templater.stringify(self.t(self._parts['header'], **props))
1936 if self.buffered:
1936 if self.buffered:
1937 self.header[ctx.rev()] = h
1937 self.header[ctx.rev()] = h
1938 else:
1938 else:
1939 if self.lastheader != h:
1939 if self.lastheader != h:
1940 self.lastheader = h
1940 self.lastheader = h
1941 self.ui.write(h)
1941 self.ui.write(h)
1942
1942
1943 # write changeset metadata, then patch if requested
1943 # write changeset metadata, then patch if requested
1944 key = self._parts[self._tref]
1944 key = self._parts[self._tref]
1945 self.ui.write(templater.stringify(self.t(key, **props)))
1945 self.ui.write(templater.stringify(self.t(key, **props)))
1946 self.showpatch(ctx, matchfn)
1946 self.showpatch(ctx, matchfn)
1947
1947
1948 if self._parts['footer']:
1948 if self._parts['footer']:
1949 if not self.footer:
1949 if not self.footer:
1950 self.footer = templater.stringify(
1950 self.footer = templater.stringify(
1951 self.t(self._parts['footer'], **props))
1951 self.t(self._parts['footer'], **props))
1952
1952
1953 def logtemplatespec(tmpl, mapfile):
1953 def logtemplatespec(tmpl, mapfile):
1954 if mapfile:
1954 if mapfile:
1955 return formatter.templatespec('changeset', tmpl, mapfile)
1955 return formatter.templatespec('changeset', tmpl, mapfile)
1956 else:
1956 else:
1957 return formatter.templatespec('', tmpl, None)
1957 return formatter.templatespec('', tmpl, None)
1958
1958
1959 def _lookuplogtemplate(ui, tmpl, style):
1959 def _lookuplogtemplate(ui, tmpl, style):
1960 """Find the template matching the given template spec or style
1960 """Find the template matching the given template spec or style
1961
1961
1962 See formatter.lookuptemplate() for details.
1962 See formatter.lookuptemplate() for details.
1963 """
1963 """
1964
1964
1965 # ui settings
1965 # ui settings
1966 if not tmpl and not style: # template are stronger than style
1966 if not tmpl and not style: # template are stronger than style
1967 tmpl = ui.config('ui', 'logtemplate')
1967 tmpl = ui.config('ui', 'logtemplate')
1968 if tmpl:
1968 if tmpl:
1969 return logtemplatespec(templater.unquotestring(tmpl), None)
1969 return logtemplatespec(templater.unquotestring(tmpl), None)
1970 else:
1970 else:
1971 style = util.expandpath(ui.config('ui', 'style'))
1971 style = util.expandpath(ui.config('ui', 'style'))
1972
1972
1973 if not tmpl and style:
1973 if not tmpl and style:
1974 mapfile = style
1974 mapfile = style
1975 if not os.path.split(mapfile)[0]:
1975 if not os.path.split(mapfile)[0]:
1976 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1976 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1977 or templater.templatepath(mapfile))
1977 or templater.templatepath(mapfile))
1978 if mapname:
1978 if mapname:
1979 mapfile = mapname
1979 mapfile = mapname
1980 return logtemplatespec(None, mapfile)
1980 return logtemplatespec(None, mapfile)
1981
1981
1982 if not tmpl:
1982 if not tmpl:
1983 return logtemplatespec(None, None)
1983 return logtemplatespec(None, None)
1984
1984
1985 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1985 return formatter.lookuptemplate(ui, 'changeset', tmpl)
1986
1986
1987 def makelogtemplater(ui, repo, tmpl, buffered=False):
1987 def makelogtemplater(ui, repo, tmpl, buffered=False):
1988 """Create a changeset_templater from a literal template 'tmpl'"""
1988 """Create a changeset_templater from a literal template 'tmpl'"""
1989 spec = logtemplatespec(tmpl, None)
1989 spec = logtemplatespec(tmpl, None)
1990 return changeset_templater(ui, repo, spec, buffered=buffered)
1990 return changeset_templater(ui, repo, spec, buffered=buffered)
1991
1991
1992 def show_changeset(ui, repo, opts, buffered=False):
1992 def show_changeset(ui, repo, opts, buffered=False):
1993 """show one changeset using template or regular display.
1993 """show one changeset using template or regular display.
1994
1994
1995 Display format will be the first non-empty hit of:
1995 Display format will be the first non-empty hit of:
1996 1. option 'template'
1996 1. option 'template'
1997 2. option 'style'
1997 2. option 'style'
1998 3. [ui] setting 'logtemplate'
1998 3. [ui] setting 'logtemplate'
1999 4. [ui] setting 'style'
1999 4. [ui] setting 'style'
2000 If all of these values are either the unset or the empty string,
2000 If all of these values are either the unset or the empty string,
2001 regular display via changeset_printer() is done.
2001 regular display via changeset_printer() is done.
2002 """
2002 """
2003 # options
2003 # options
2004 match = None
2004 match = None
2005 if opts.get('patch') or opts.get('stat'):
2005 if opts.get('patch') or opts.get('stat'):
2006 match = scmutil.matchall(repo)
2006 match = scmutil.matchall(repo)
2007
2007
2008 if opts.get('template') == 'json':
2008 if opts.get('template') == 'json':
2009 return jsonchangeset(ui, repo, match, opts, buffered)
2009 return jsonchangeset(ui, repo, match, opts, buffered)
2010
2010
2011 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
2011 spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
2012
2012
2013 if not spec.ref and not spec.tmpl and not spec.mapfile:
2013 if not spec.ref and not spec.tmpl and not spec.mapfile:
2014 return changeset_printer(ui, repo, match, opts, buffered)
2014 return changeset_printer(ui, repo, match, opts, buffered)
2015
2015
2016 return changeset_templater(ui, repo, spec, match, opts, buffered)
2016 return changeset_templater(ui, repo, spec, match, opts, buffered)
2017
2017
2018 def showmarker(fm, marker, index=None):
2018 def showmarker(fm, marker, index=None):
2019 """utility function to display obsolescence marker in a readable way
2019 """utility function to display obsolescence marker in a readable way
2020
2020
2021 To be used by debug function."""
2021 To be used by debug function."""
2022 if index is not None:
2022 if index is not None:
2023 fm.write('index', '%i ', index)
2023 fm.write('index', '%i ', index)
2024 fm.write('prednode', '%s ', hex(marker.prednode()))
2024 fm.write('prednode', '%s ', hex(marker.prednode()))
2025 succs = marker.succnodes()
2025 succs = marker.succnodes()
2026 fm.condwrite(succs, 'succnodes', '%s ',
2026 fm.condwrite(succs, 'succnodes', '%s ',
2027 fm.formatlist(map(hex, succs), name='node'))
2027 fm.formatlist(map(hex, succs), name='node'))
2028 fm.write('flag', '%X ', marker.flags())
2028 fm.write('flag', '%X ', marker.flags())
2029 parents = marker.parentnodes()
2029 parents = marker.parentnodes()
2030 if parents is not None:
2030 if parents is not None:
2031 fm.write('parentnodes', '{%s} ',
2031 fm.write('parentnodes', '{%s} ',
2032 fm.formatlist(map(hex, parents), name='node', sep=', '))
2032 fm.formatlist(map(hex, parents), name='node', sep=', '))
2033 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2033 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
2034 meta = marker.metadata().copy()
2034 meta = marker.metadata().copy()
2035 meta.pop('date', None)
2035 meta.pop('date', None)
2036 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2036 fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', '))
2037 fm.plain('\n')
2037 fm.plain('\n')
2038
2038
2039 def finddate(ui, repo, date):
2039 def finddate(ui, repo, date):
2040 """Find the tipmost changeset that matches the given date spec"""
2040 """Find the tipmost changeset that matches the given date spec"""
2041
2041
2042 df = util.matchdate(date)
2042 df = util.matchdate(date)
2043 m = scmutil.matchall(repo)
2043 m = scmutil.matchall(repo)
2044 results = {}
2044 results = {}
2045
2045
2046 def prep(ctx, fns):
2046 def prep(ctx, fns):
2047 d = ctx.date()
2047 d = ctx.date()
2048 if df(d[0]):
2048 if df(d[0]):
2049 results[ctx.rev()] = d
2049 results[ctx.rev()] = d
2050
2050
2051 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2051 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
2052 rev = ctx.rev()
2052 rev = ctx.rev()
2053 if rev in results:
2053 if rev in results:
2054 ui.status(_("found revision %s from %s\n") %
2054 ui.status(_("found revision %s from %s\n") %
2055 (rev, util.datestr(results[rev])))
2055 (rev, util.datestr(results[rev])))
2056 return '%d' % rev
2056 return '%d' % rev
2057
2057
2058 raise error.Abort(_("revision matching date not found"))
2058 raise error.Abort(_("revision matching date not found"))
2059
2059
2060 def increasingwindows(windowsize=8, sizelimit=512):
2060 def increasingwindows(windowsize=8, sizelimit=512):
2061 while True:
2061 while True:
2062 yield windowsize
2062 yield windowsize
2063 if windowsize < sizelimit:
2063 if windowsize < sizelimit:
2064 windowsize *= 2
2064 windowsize *= 2
2065
2065
2066 class FileWalkError(Exception):
2066 class FileWalkError(Exception):
2067 pass
2067 pass
2068
2068
2069 def walkfilerevs(repo, match, follow, revs, fncache):
2069 def walkfilerevs(repo, match, follow, revs, fncache):
2070 '''Walks the file history for the matched files.
2070 '''Walks the file history for the matched files.
2071
2071
2072 Returns the changeset revs that are involved in the file history.
2072 Returns the changeset revs that are involved in the file history.
2073
2073
2074 Throws FileWalkError if the file history can't be walked using
2074 Throws FileWalkError if the file history can't be walked using
2075 filelogs alone.
2075 filelogs alone.
2076 '''
2076 '''
2077 wanted = set()
2077 wanted = set()
2078 copies = []
2078 copies = []
2079 minrev, maxrev = min(revs), max(revs)
2079 minrev, maxrev = min(revs), max(revs)
2080 def filerevgen(filelog, last):
2080 def filerevgen(filelog, last):
2081 """
2081 """
2082 Only files, no patterns. Check the history of each file.
2082 Only files, no patterns. Check the history of each file.
2083
2083
2084 Examines filelog entries within minrev, maxrev linkrev range
2084 Examines filelog entries within minrev, maxrev linkrev range
2085 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2085 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
2086 tuples in backwards order
2086 tuples in backwards order
2087 """
2087 """
2088 cl_count = len(repo)
2088 cl_count = len(repo)
2089 revs = []
2089 revs = []
2090 for j in xrange(0, last + 1):
2090 for j in xrange(0, last + 1):
2091 linkrev = filelog.linkrev(j)
2091 linkrev = filelog.linkrev(j)
2092 if linkrev < minrev:
2092 if linkrev < minrev:
2093 continue
2093 continue
2094 # only yield rev for which we have the changelog, it can
2094 # only yield rev for which we have the changelog, it can
2095 # happen while doing "hg log" during a pull or commit
2095 # happen while doing "hg log" during a pull or commit
2096 if linkrev >= cl_count:
2096 if linkrev >= cl_count:
2097 break
2097 break
2098
2098
2099 parentlinkrevs = []
2099 parentlinkrevs = []
2100 for p in filelog.parentrevs(j):
2100 for p in filelog.parentrevs(j):
2101 if p != nullrev:
2101 if p != nullrev:
2102 parentlinkrevs.append(filelog.linkrev(p))
2102 parentlinkrevs.append(filelog.linkrev(p))
2103 n = filelog.node(j)
2103 n = filelog.node(j)
2104 revs.append((linkrev, parentlinkrevs,
2104 revs.append((linkrev, parentlinkrevs,
2105 follow and filelog.renamed(n)))
2105 follow and filelog.renamed(n)))
2106
2106
2107 return reversed(revs)
2107 return reversed(revs)
2108 def iterfiles():
2108 def iterfiles():
2109 pctx = repo['.']
2109 pctx = repo['.']
2110 for filename in match.files():
2110 for filename in match.files():
2111 if follow:
2111 if follow:
2112 if filename not in pctx:
2112 if filename not in pctx:
2113 raise error.Abort(_('cannot follow file not in parent '
2113 raise error.Abort(_('cannot follow file not in parent '
2114 'revision: "%s"') % filename)
2114 'revision: "%s"') % filename)
2115 yield filename, pctx[filename].filenode()
2115 yield filename, pctx[filename].filenode()
2116 else:
2116 else:
2117 yield filename, None
2117 yield filename, None
2118 for filename_node in copies:
2118 for filename_node in copies:
2119 yield filename_node
2119 yield filename_node
2120
2120
2121 for file_, node in iterfiles():
2121 for file_, node in iterfiles():
2122 filelog = repo.file(file_)
2122 filelog = repo.file(file_)
2123 if not len(filelog):
2123 if not len(filelog):
2124 if node is None:
2124 if node is None:
2125 # A zero count may be a directory or deleted file, so
2125 # A zero count may be a directory or deleted file, so
2126 # try to find matching entries on the slow path.
2126 # try to find matching entries on the slow path.
2127 if follow:
2127 if follow:
2128 raise error.Abort(
2128 raise error.Abort(
2129 _('cannot follow nonexistent file: "%s"') % file_)
2129 _('cannot follow nonexistent file: "%s"') % file_)
2130 raise FileWalkError("Cannot walk via filelog")
2130 raise FileWalkError("Cannot walk via filelog")
2131 else:
2131 else:
2132 continue
2132 continue
2133
2133
2134 if node is None:
2134 if node is None:
2135 last = len(filelog) - 1
2135 last = len(filelog) - 1
2136 else:
2136 else:
2137 last = filelog.rev(node)
2137 last = filelog.rev(node)
2138
2138
2139 # keep track of all ancestors of the file
2139 # keep track of all ancestors of the file
2140 ancestors = {filelog.linkrev(last)}
2140 ancestors = {filelog.linkrev(last)}
2141
2141
2142 # iterate from latest to oldest revision
2142 # iterate from latest to oldest revision
2143 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2143 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
2144 if not follow:
2144 if not follow:
2145 if rev > maxrev:
2145 if rev > maxrev:
2146 continue
2146 continue
2147 else:
2147 else:
2148 # Note that last might not be the first interesting
2148 # Note that last might not be the first interesting
2149 # rev to us:
2149 # rev to us:
2150 # if the file has been changed after maxrev, we'll
2150 # if the file has been changed after maxrev, we'll
2151 # have linkrev(last) > maxrev, and we still need
2151 # have linkrev(last) > maxrev, and we still need
2152 # to explore the file graph
2152 # to explore the file graph
2153 if rev not in ancestors:
2153 if rev not in ancestors:
2154 continue
2154 continue
2155 # XXX insert 1327 fix here
2155 # XXX insert 1327 fix here
2156 if flparentlinkrevs:
2156 if flparentlinkrevs:
2157 ancestors.update(flparentlinkrevs)
2157 ancestors.update(flparentlinkrevs)
2158
2158
2159 fncache.setdefault(rev, []).append(file_)
2159 fncache.setdefault(rev, []).append(file_)
2160 wanted.add(rev)
2160 wanted.add(rev)
2161 if copied:
2161 if copied:
2162 copies.append(copied)
2162 copies.append(copied)
2163
2163
2164 return wanted
2164 return wanted
2165
2165
2166 class _followfilter(object):
2166 class _followfilter(object):
2167 def __init__(self, repo, onlyfirst=False):
2167 def __init__(self, repo, onlyfirst=False):
2168 self.repo = repo
2168 self.repo = repo
2169 self.startrev = nullrev
2169 self.startrev = nullrev
2170 self.roots = set()
2170 self.roots = set()
2171 self.onlyfirst = onlyfirst
2171 self.onlyfirst = onlyfirst
2172
2172
2173 def match(self, rev):
2173 def match(self, rev):
2174 def realparents(rev):
2174 def realparents(rev):
2175 if self.onlyfirst:
2175 if self.onlyfirst:
2176 return self.repo.changelog.parentrevs(rev)[0:1]
2176 return self.repo.changelog.parentrevs(rev)[0:1]
2177 else:
2177 else:
2178 return filter(lambda x: x != nullrev,
2178 return filter(lambda x: x != nullrev,
2179 self.repo.changelog.parentrevs(rev))
2179 self.repo.changelog.parentrevs(rev))
2180
2180
2181 if self.startrev == nullrev:
2181 if self.startrev == nullrev:
2182 self.startrev = rev
2182 self.startrev = rev
2183 return True
2183 return True
2184
2184
2185 if rev > self.startrev:
2185 if rev > self.startrev:
2186 # forward: all descendants
2186 # forward: all descendants
2187 if not self.roots:
2187 if not self.roots:
2188 self.roots.add(self.startrev)
2188 self.roots.add(self.startrev)
2189 for parent in realparents(rev):
2189 for parent in realparents(rev):
2190 if parent in self.roots:
2190 if parent in self.roots:
2191 self.roots.add(rev)
2191 self.roots.add(rev)
2192 return True
2192 return True
2193 else:
2193 else:
2194 # backwards: all parents
2194 # backwards: all parents
2195 if not self.roots:
2195 if not self.roots:
2196 self.roots.update(realparents(self.startrev))
2196 self.roots.update(realparents(self.startrev))
2197 if rev in self.roots:
2197 if rev in self.roots:
2198 self.roots.remove(rev)
2198 self.roots.remove(rev)
2199 self.roots.update(realparents(rev))
2199 self.roots.update(realparents(rev))
2200 return True
2200 return True
2201
2201
2202 return False
2202 return False
2203
2203
2204 def walkchangerevs(repo, match, opts, prepare):
2204 def walkchangerevs(repo, match, opts, prepare):
2205 '''Iterate over files and the revs in which they changed.
2205 '''Iterate over files and the revs in which they changed.
2206
2206
2207 Callers most commonly need to iterate backwards over the history
2207 Callers most commonly need to iterate backwards over the history
2208 in which they are interested. Doing so has awful (quadratic-looking)
2208 in which they are interested. Doing so has awful (quadratic-looking)
2209 performance, so we use iterators in a "windowed" way.
2209 performance, so we use iterators in a "windowed" way.
2210
2210
2211 We walk a window of revisions in the desired order. Within the
2211 We walk a window of revisions in the desired order. Within the
2212 window, we first walk forwards to gather data, then in the desired
2212 window, we first walk forwards to gather data, then in the desired
2213 order (usually backwards) to display it.
2213 order (usually backwards) to display it.
2214
2214
2215 This function returns an iterator yielding contexts. Before
2215 This function returns an iterator yielding contexts. Before
2216 yielding each context, the iterator will first call the prepare
2216 yielding each context, the iterator will first call the prepare
2217 function on each context in the window in forward order.'''
2217 function on each context in the window in forward order.'''
2218
2218
2219 follow = opts.get('follow') or opts.get('follow_first')
2219 follow = opts.get('follow') or opts.get('follow_first')
2220 revs = _logrevs(repo, opts)
2220 revs = _logrevs(repo, opts)
2221 if not revs:
2221 if not revs:
2222 return []
2222 return []
2223 wanted = set()
2223 wanted = set()
2224 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
2224 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
2225 opts.get('removed'))
2225 opts.get('removed'))
2226 fncache = {}
2226 fncache = {}
2227 change = repo.changectx
2227 change = repo.changectx
2228
2228
2229 # First step is to fill wanted, the set of revisions that we want to yield.
2229 # First step is to fill wanted, the set of revisions that we want to yield.
2230 # When it does not induce extra cost, we also fill fncache for revisions in
2230 # When it does not induce extra cost, we also fill fncache for revisions in
2231 # wanted: a cache of filenames that were changed (ctx.files()) and that
2231 # wanted: a cache of filenames that were changed (ctx.files()) and that
2232 # match the file filtering conditions.
2232 # match the file filtering conditions.
2233
2233
2234 if match.always():
2234 if match.always():
2235 # No files, no patterns. Display all revs.
2235 # No files, no patterns. Display all revs.
2236 wanted = revs
2236 wanted = revs
2237 elif not slowpath:
2237 elif not slowpath:
2238 # We only have to read through the filelog to find wanted revisions
2238 # We only have to read through the filelog to find wanted revisions
2239
2239
2240 try:
2240 try:
2241 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2241 wanted = walkfilerevs(repo, match, follow, revs, fncache)
2242 except FileWalkError:
2242 except FileWalkError:
2243 slowpath = True
2243 slowpath = True
2244
2244
2245 # We decided to fall back to the slowpath because at least one
2245 # We decided to fall back to the slowpath because at least one
2246 # of the paths was not a file. Check to see if at least one of them
2246 # of the paths was not a file. Check to see if at least one of them
2247 # existed in history, otherwise simply return
2247 # existed in history, otherwise simply return
2248 for path in match.files():
2248 for path in match.files():
2249 if path == '.' or path in repo.store:
2249 if path == '.' or path in repo.store:
2250 break
2250 break
2251 else:
2251 else:
2252 return []
2252 return []
2253
2253
2254 if slowpath:
2254 if slowpath:
2255 # We have to read the changelog to match filenames against
2255 # We have to read the changelog to match filenames against
2256 # changed files
2256 # changed files
2257
2257
2258 if follow:
2258 if follow:
2259 raise error.Abort(_('can only follow copies/renames for explicit '
2259 raise error.Abort(_('can only follow copies/renames for explicit '
2260 'filenames'))
2260 'filenames'))
2261
2261
2262 # The slow path checks files modified in every changeset.
2262 # The slow path checks files modified in every changeset.
2263 # This is really slow on large repos, so compute the set lazily.
2263 # This is really slow on large repos, so compute the set lazily.
2264 class lazywantedset(object):
2264 class lazywantedset(object):
2265 def __init__(self):
2265 def __init__(self):
2266 self.set = set()
2266 self.set = set()
2267 self.revs = set(revs)
2267 self.revs = set(revs)
2268
2268
2269 # No need to worry about locality here because it will be accessed
2269 # No need to worry about locality here because it will be accessed
2270 # in the same order as the increasing window below.
2270 # in the same order as the increasing window below.
2271 def __contains__(self, value):
2271 def __contains__(self, value):
2272 if value in self.set:
2272 if value in self.set:
2273 return True
2273 return True
2274 elif not value in self.revs:
2274 elif not value in self.revs:
2275 return False
2275 return False
2276 else:
2276 else:
2277 self.revs.discard(value)
2277 self.revs.discard(value)
2278 ctx = change(value)
2278 ctx = change(value)
2279 matches = filter(match, ctx.files())
2279 matches = filter(match, ctx.files())
2280 if matches:
2280 if matches:
2281 fncache[value] = matches
2281 fncache[value] = matches
2282 self.set.add(value)
2282 self.set.add(value)
2283 return True
2283 return True
2284 return False
2284 return False
2285
2285
2286 def discard(self, value):
2286 def discard(self, value):
2287 self.revs.discard(value)
2287 self.revs.discard(value)
2288 self.set.discard(value)
2288 self.set.discard(value)
2289
2289
2290 wanted = lazywantedset()
2290 wanted = lazywantedset()
2291
2291
2292 # it might be worthwhile to do this in the iterator if the rev range
2292 # it might be worthwhile to do this in the iterator if the rev range
2293 # is descending and the prune args are all within that range
2293 # is descending and the prune args are all within that range
2294 for rev in opts.get('prune', ()):
2294 for rev in opts.get('prune', ()):
2295 rev = repo[rev].rev()
2295 rev = repo[rev].rev()
2296 ff = _followfilter(repo)
2296 ff = _followfilter(repo)
2297 stop = min(revs[0], revs[-1])
2297 stop = min(revs[0], revs[-1])
2298 for x in xrange(rev, stop - 1, -1):
2298 for x in xrange(rev, stop - 1, -1):
2299 if ff.match(x):
2299 if ff.match(x):
2300 wanted = wanted - [x]
2300 wanted = wanted - [x]
2301
2301
2302 # Now that wanted is correctly initialized, we can iterate over the
2302 # Now that wanted is correctly initialized, we can iterate over the
2303 # revision range, yielding only revisions in wanted.
2303 # revision range, yielding only revisions in wanted.
2304 def iterate():
2304 def iterate():
2305 if follow and match.always():
2305 if follow and match.always():
2306 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2306 ff = _followfilter(repo, onlyfirst=opts.get('follow_first'))
2307 def want(rev):
2307 def want(rev):
2308 return ff.match(rev) and rev in wanted
2308 return ff.match(rev) and rev in wanted
2309 else:
2309 else:
2310 def want(rev):
2310 def want(rev):
2311 return rev in wanted
2311 return rev in wanted
2312
2312
2313 it = iter(revs)
2313 it = iter(revs)
2314 stopiteration = False
2314 stopiteration = False
2315 for windowsize in increasingwindows():
2315 for windowsize in increasingwindows():
2316 nrevs = []
2316 nrevs = []
2317 for i in xrange(windowsize):
2317 for i in xrange(windowsize):
2318 rev = next(it, None)
2318 rev = next(it, None)
2319 if rev is None:
2319 if rev is None:
2320 stopiteration = True
2320 stopiteration = True
2321 break
2321 break
2322 elif want(rev):
2322 elif want(rev):
2323 nrevs.append(rev)
2323 nrevs.append(rev)
2324 for rev in sorted(nrevs):
2324 for rev in sorted(nrevs):
2325 fns = fncache.get(rev)
2325 fns = fncache.get(rev)
2326 ctx = change(rev)
2326 ctx = change(rev)
2327 if not fns:
2327 if not fns:
2328 def fns_generator():
2328 def fns_generator():
2329 for f in ctx.files():
2329 for f in ctx.files():
2330 if match(f):
2330 if match(f):
2331 yield f
2331 yield f
2332 fns = fns_generator()
2332 fns = fns_generator()
2333 prepare(ctx, fns)
2333 prepare(ctx, fns)
2334 for rev in nrevs:
2334 for rev in nrevs:
2335 yield change(rev)
2335 yield change(rev)
2336
2336
2337 if stopiteration:
2337 if stopiteration:
2338 break
2338 break
2339
2339
2340 return iterate()
2340 return iterate()
2341
2341
2342 def _makefollowlogfilematcher(repo, files, followfirst):
2342 def _makefollowlogfilematcher(repo, files, followfirst):
2343 # When displaying a revision with --patch --follow FILE, we have
2343 # When displaying a revision with --patch --follow FILE, we have
2344 # to know which file of the revision must be diffed. With
2344 # to know which file of the revision must be diffed. With
2345 # --follow, we want the names of the ancestors of FILE in the
2345 # --follow, we want the names of the ancestors of FILE in the
2346 # revision, stored in "fcache". "fcache" is populated by
2346 # revision, stored in "fcache". "fcache" is populated by
2347 # reproducing the graph traversal already done by --follow revset
2347 # reproducing the graph traversal already done by --follow revset
2348 # and relating revs to file names (which is not "correct" but
2348 # and relating revs to file names (which is not "correct" but
2349 # good enough).
2349 # good enough).
2350 fcache = {}
2350 fcache = {}
2351 fcacheready = [False]
2351 fcacheready = [False]
2352 pctx = repo['.']
2352 pctx = repo['.']
2353
2353
2354 def populate():
2354 def populate():
2355 for fn in files:
2355 for fn in files:
2356 fctx = pctx[fn]
2356 fctx = pctx[fn]
2357 fcache.setdefault(fctx.introrev(), set()).add(fctx.path())
2357 fcache.setdefault(fctx.introrev(), set()).add(fctx.path())
2358 for c in fctx.ancestors(followfirst=followfirst):
2358 for c in fctx.ancestors(followfirst=followfirst):
2359 fcache.setdefault(c.rev(), set()).add(c.path())
2359 fcache.setdefault(c.rev(), set()).add(c.path())
2360
2360
2361 def filematcher(rev):
2361 def filematcher(rev):
2362 if not fcacheready[0]:
2362 if not fcacheready[0]:
2363 # Lazy initialization
2363 # Lazy initialization
2364 fcacheready[0] = True
2364 fcacheready[0] = True
2365 populate()
2365 populate()
2366 return scmutil.matchfiles(repo, fcache.get(rev, []))
2366 return scmutil.matchfiles(repo, fcache.get(rev, []))
2367
2367
2368 return filematcher
2368 return filematcher
2369
2369
2370 def _makenofollowlogfilematcher(repo, pats, opts):
2370 def _makenofollowlogfilematcher(repo, pats, opts):
2371 '''hook for extensions to override the filematcher for non-follow cases'''
2371 '''hook for extensions to override the filematcher for non-follow cases'''
2372 return None
2372 return None
2373
2373
2374 def _makelogrevset(repo, pats, opts, revs):
2374 def _makelogrevset(repo, pats, opts, revs):
2375 """Return (expr, filematcher) where expr is a revset string built
2375 """Return (expr, filematcher) where expr is a revset string built
2376 from log options and file patterns or None. If --stat or --patch
2376 from log options and file patterns or None. If --stat or --patch
2377 are not passed filematcher is None. Otherwise it is a callable
2377 are not passed filematcher is None. Otherwise it is a callable
2378 taking a revision number and returning a match objects filtering
2378 taking a revision number and returning a match objects filtering
2379 the files to be detailed when displaying the revision.
2379 the files to be detailed when displaying the revision.
2380 """
2380 """
2381 opt2revset = {
2381 opt2revset = {
2382 'no_merges': ('not merge()', None),
2382 'no_merges': ('not merge()', None),
2383 'only_merges': ('merge()', None),
2383 'only_merges': ('merge()', None),
2384 '_ancestors': ('ancestors(%(val)s)', None),
2384 '_ancestors': ('ancestors(%(val)s)', None),
2385 '_fancestors': ('_firstancestors(%(val)s)', None),
2385 '_fancestors': ('_firstancestors(%(val)s)', None),
2386 '_descendants': ('descendants(%(val)s)', None),
2386 '_descendants': ('descendants(%(val)s)', None),
2387 '_fdescendants': ('_firstdescendants(%(val)s)', None),
2387 '_fdescendants': ('_firstdescendants(%(val)s)', None),
2388 '_matchfiles': ('_matchfiles(%(val)s)', None),
2388 '_matchfiles': ('_matchfiles(%(val)s)', None),
2389 'date': ('date(%(val)r)', None),
2389 'date': ('date(%(val)r)', None),
2390 'branch': ('branch(%(val)r)', ' or '),
2390 'branch': ('branch(%(val)r)', ' or '),
2391 '_patslog': ('filelog(%(val)r)', ' or '),
2391 '_patslog': ('filelog(%(val)r)', ' or '),
2392 '_patsfollow': ('follow(%(val)r)', ' or '),
2392 '_patsfollow': ('follow(%(val)r)', ' or '),
2393 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
2393 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
2394 'keyword': ('keyword(%(val)r)', ' or '),
2394 'keyword': ('keyword(%(val)r)', ' or '),
2395 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
2395 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
2396 'user': ('user(%(val)r)', ' or '),
2396 'user': ('user(%(val)r)', ' or '),
2397 }
2397 }
2398
2398
2399 opts = dict(opts)
2399 opts = dict(opts)
2400 # follow or not follow?
2400 # follow or not follow?
2401 follow = opts.get('follow') or opts.get('follow_first')
2401 follow = opts.get('follow') or opts.get('follow_first')
2402 if opts.get('follow_first'):
2402 if opts.get('follow_first'):
2403 followfirst = 1
2403 followfirst = 1
2404 else:
2404 else:
2405 followfirst = 0
2405 followfirst = 0
2406 # --follow with FILE behavior depends on revs...
2406 # --follow with FILE behavior depends on revs...
2407 it = iter(revs)
2407 it = iter(revs)
2408 startrev = next(it)
2408 startrev = next(it)
2409 followdescendants = startrev < next(it, startrev)
2409 followdescendants = startrev < next(it, startrev)
2410
2410
2411 # branch and only_branch are really aliases and must be handled at
2411 # branch and only_branch are really aliases and must be handled at
2412 # the same time
2412 # the same time
2413 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2413 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
2414 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2414 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2415 # pats/include/exclude are passed to match.match() directly in
2415 # pats/include/exclude are passed to match.match() directly in
2416 # _matchfiles() revset but walkchangerevs() builds its matcher with
2416 # _matchfiles() revset but walkchangerevs() builds its matcher with
2417 # scmutil.match(). The difference is input pats are globbed on
2417 # scmutil.match(). The difference is input pats are globbed on
2418 # platforms without shell expansion (windows).
2418 # platforms without shell expansion (windows).
2419 wctx = repo[None]
2419 wctx = repo[None]
2420 match, pats = scmutil.matchandpats(wctx, pats, opts)
2420 match, pats = scmutil.matchandpats(wctx, pats, opts)
2421 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
2421 slowpath = match.anypats() or ((match.isexact() or match.prefix()) and
2422 opts.get('removed'))
2422 opts.get('removed'))
2423 if not slowpath:
2423 if not slowpath:
2424 for f in match.files():
2424 for f in match.files():
2425 if follow and f not in wctx:
2425 if follow and f not in wctx:
2426 # If the file exists, it may be a directory, so let it
2426 # If the file exists, it may be a directory, so let it
2427 # take the slow path.
2427 # take the slow path.
2428 if os.path.exists(repo.wjoin(f)):
2428 if os.path.exists(repo.wjoin(f)):
2429 slowpath = True
2429 slowpath = True
2430 continue
2430 continue
2431 else:
2431 else:
2432 raise error.Abort(_('cannot follow file not in parent '
2432 raise error.Abort(_('cannot follow file not in parent '
2433 'revision: "%s"') % f)
2433 'revision: "%s"') % f)
2434 filelog = repo.file(f)
2434 filelog = repo.file(f)
2435 if not filelog:
2435 if not filelog:
2436 # A zero count may be a directory or deleted file, so
2436 # A zero count may be a directory or deleted file, so
2437 # try to find matching entries on the slow path.
2437 # try to find matching entries on the slow path.
2438 if follow:
2438 if follow:
2439 raise error.Abort(
2439 raise error.Abort(
2440 _('cannot follow nonexistent file: "%s"') % f)
2440 _('cannot follow nonexistent file: "%s"') % f)
2441 slowpath = True
2441 slowpath = True
2442
2442
2443 # We decided to fall back to the slowpath because at least one
2443 # We decided to fall back to the slowpath because at least one
2444 # of the paths was not a file. Check to see if at least one of them
2444 # of the paths was not a file. Check to see if at least one of them
2445 # existed in history - in that case, we'll continue down the
2445 # existed in history - in that case, we'll continue down the
2446 # slowpath; otherwise, we can turn off the slowpath
2446 # slowpath; otherwise, we can turn off the slowpath
2447 if slowpath:
2447 if slowpath:
2448 for path in match.files():
2448 for path in match.files():
2449 if path == '.' or path in repo.store:
2449 if path == '.' or path in repo.store:
2450 break
2450 break
2451 else:
2451 else:
2452 slowpath = False
2452 slowpath = False
2453
2453
2454 fpats = ('_patsfollow', '_patsfollowfirst')
2454 fpats = ('_patsfollow', '_patsfollowfirst')
2455 fnopats = (('_ancestors', '_fancestors'),
2455 fnopats = (('_ancestors', '_fancestors'),
2456 ('_descendants', '_fdescendants'))
2456 ('_descendants', '_fdescendants'))
2457 if slowpath:
2457 if slowpath:
2458 # See walkchangerevs() slow path.
2458 # See walkchangerevs() slow path.
2459 #
2459 #
2460 # pats/include/exclude cannot be represented as separate
2460 # pats/include/exclude cannot be represented as separate
2461 # revset expressions as their filtering logic applies at file
2461 # revset expressions as their filtering logic applies at file
2462 # level. For instance "-I a -X a" matches a revision touching
2462 # level. For instance "-I a -X a" matches a revision touching
2463 # "a" and "b" while "file(a) and not file(b)" does
2463 # "a" and "b" while "file(a) and not file(b)" does
2464 # not. Besides, filesets are evaluated against the working
2464 # not. Besides, filesets are evaluated against the working
2465 # directory.
2465 # directory.
2466 matchargs = ['r:', 'd:relpath']
2466 matchargs = ['r:', 'd:relpath']
2467 for p in pats:
2467 for p in pats:
2468 matchargs.append('p:' + p)
2468 matchargs.append('p:' + p)
2469 for p in opts.get('include', []):
2469 for p in opts.get('include', []):
2470 matchargs.append('i:' + p)
2470 matchargs.append('i:' + p)
2471 for p in opts.get('exclude', []):
2471 for p in opts.get('exclude', []):
2472 matchargs.append('x:' + p)
2472 matchargs.append('x:' + p)
2473 matchargs = ','.join(('%r' % p) for p in matchargs)
2473 matchargs = ','.join(('%r' % p) for p in matchargs)
2474 opts['_matchfiles'] = matchargs
2474 opts['_matchfiles'] = matchargs
2475 if follow:
2475 if follow:
2476 opts[fnopats[0][followfirst]] = '.'
2476 opts[fnopats[0][followfirst]] = '.'
2477 else:
2477 else:
2478 if follow:
2478 if follow:
2479 if pats:
2479 if pats:
2480 # follow() revset interprets its file argument as a
2480 # follow() revset interprets its file argument as a
2481 # manifest entry, so use match.files(), not pats.
2481 # manifest entry, so use match.files(), not pats.
2482 opts[fpats[followfirst]] = list(match.files())
2482 opts[fpats[followfirst]] = list(match.files())
2483 else:
2483 else:
2484 op = fnopats[followdescendants][followfirst]
2484 op = fnopats[followdescendants][followfirst]
2485 opts[op] = 'rev(%d)' % startrev
2485 opts[op] = 'rev(%d)' % startrev
2486 else:
2486 else:
2487 opts['_patslog'] = list(pats)
2487 opts['_patslog'] = list(pats)
2488
2488
2489 filematcher = None
2489 filematcher = None
2490 if opts.get('patch') or opts.get('stat'):
2490 if opts.get('patch') or opts.get('stat'):
2491 # When following files, track renames via a special matcher.
2491 # When following files, track renames via a special matcher.
2492 # If we're forced to take the slowpath it means we're following
2492 # If we're forced to take the slowpath it means we're following
2493 # at least one pattern/directory, so don't bother with rename tracking.
2493 # at least one pattern/directory, so don't bother with rename tracking.
2494 if follow and not match.always() and not slowpath:
2494 if follow and not match.always() and not slowpath:
2495 # _makefollowlogfilematcher expects its files argument to be
2495 # _makefollowlogfilematcher expects its files argument to be
2496 # relative to the repo root, so use match.files(), not pats.
2496 # relative to the repo root, so use match.files(), not pats.
2497 filematcher = _makefollowlogfilematcher(repo, match.files(),
2497 filematcher = _makefollowlogfilematcher(repo, match.files(),
2498 followfirst)
2498 followfirst)
2499 else:
2499 else:
2500 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2500 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
2501 if filematcher is None:
2501 if filematcher is None:
2502 filematcher = lambda rev: match
2502 filematcher = lambda rev: match
2503
2503
2504 expr = []
2504 expr = []
2505 for op, val in sorted(opts.iteritems()):
2505 for op, val in sorted(opts.iteritems()):
2506 if not val:
2506 if not val:
2507 continue
2507 continue
2508 if op not in opt2revset:
2508 if op not in opt2revset:
2509 continue
2509 continue
2510 revop, andor = opt2revset[op]
2510 revop, andor = opt2revset[op]
2511 if '%(val)' not in revop:
2511 if '%(val)' not in revop:
2512 expr.append(revop)
2512 expr.append(revop)
2513 else:
2513 else:
2514 if not isinstance(val, list):
2514 if not isinstance(val, list):
2515 e = revop % {'val': val}
2515 e = revop % {'val': val}
2516 else:
2516 else:
2517 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
2517 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
2518 expr.append(e)
2518 expr.append(e)
2519
2519
2520 if expr:
2520 if expr:
2521 expr = '(' + ' and '.join(expr) + ')'
2521 expr = '(' + ' and '.join(expr) + ')'
2522 else:
2522 else:
2523 expr = None
2523 expr = None
2524 return expr, filematcher
2524 return expr, filematcher
2525
2525
2526 def _logrevs(repo, opts):
2526 def _logrevs(repo, opts):
2527 # Default --rev value depends on --follow but --follow behavior
2527 # Default --rev value depends on --follow but --follow behavior
2528 # depends on revisions resolved from --rev...
2528 # depends on revisions resolved from --rev...
2529 follow = opts.get('follow') or opts.get('follow_first')
2529 follow = opts.get('follow') or opts.get('follow_first')
2530 if opts.get('rev'):
2530 if opts.get('rev'):
2531 revs = scmutil.revrange(repo, opts['rev'])
2531 revs = scmutil.revrange(repo, opts['rev'])
2532 elif follow and repo.dirstate.p1() == nullid:
2532 elif follow and repo.dirstate.p1() == nullid:
2533 revs = smartset.baseset()
2533 revs = smartset.baseset()
2534 elif follow:
2534 elif follow:
2535 revs = repo.revs('reverse(:.)')
2535 revs = repo.revs('reverse(:.)')
2536 else:
2536 else:
2537 revs = smartset.spanset(repo)
2537 revs = smartset.spanset(repo)
2538 revs.reverse()
2538 revs.reverse()
2539 return revs
2539 return revs
2540
2540
2541 def getgraphlogrevs(repo, pats, opts):
2541 def getgraphlogrevs(repo, pats, opts):
2542 """Return (revs, expr, filematcher) where revs is an iterable of
2542 """Return (revs, expr, filematcher) where revs is an iterable of
2543 revision numbers, expr is a revset string built from log options
2543 revision numbers, expr is a revset string built from log options
2544 and file patterns or None, and used to filter 'revs'. If --stat or
2544 and file patterns or None, and used to filter 'revs'. If --stat or
2545 --patch are not passed filematcher is None. Otherwise it is a
2545 --patch are not passed filematcher is None. Otherwise it is a
2546 callable taking a revision number and returning a match objects
2546 callable taking a revision number and returning a match objects
2547 filtering the files to be detailed when displaying the revision.
2547 filtering the files to be detailed when displaying the revision.
2548 """
2548 """
2549 limit = loglimit(opts)
2549 limit = loglimit(opts)
2550 revs = _logrevs(repo, opts)
2550 revs = _logrevs(repo, opts)
2551 if not revs:
2551 if not revs:
2552 return smartset.baseset(), None, None
2552 return smartset.baseset(), None, None
2553 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2553 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2554 if opts.get('rev'):
2554 if opts.get('rev'):
2555 # User-specified revs might be unsorted, but don't sort before
2555 # User-specified revs might be unsorted, but don't sort before
2556 # _makelogrevset because it might depend on the order of revs
2556 # _makelogrevset because it might depend on the order of revs
2557 if not (revs.isdescending() or revs.istopo()):
2557 if not (revs.isdescending() or revs.istopo()):
2558 revs.sort(reverse=True)
2558 revs.sort(reverse=True)
2559 if expr:
2559 if expr:
2560 matcher = revset.match(repo.ui, expr)
2560 matcher = revset.match(repo.ui, expr)
2561 revs = matcher(repo, revs)
2561 revs = matcher(repo, revs)
2562 if limit is not None:
2562 if limit is not None:
2563 limitedrevs = []
2563 limitedrevs = []
2564 for idx, rev in enumerate(revs):
2564 for idx, rev in enumerate(revs):
2565 if idx >= limit:
2565 if idx >= limit:
2566 break
2566 break
2567 limitedrevs.append(rev)
2567 limitedrevs.append(rev)
2568 revs = smartset.baseset(limitedrevs)
2568 revs = smartset.baseset(limitedrevs)
2569
2569
2570 return revs, expr, filematcher
2570 return revs, expr, filematcher
2571
2571
2572 def getlogrevs(repo, pats, opts):
2572 def getlogrevs(repo, pats, opts):
2573 """Return (revs, expr, filematcher) where revs is an iterable of
2573 """Return (revs, expr, filematcher) where revs is an iterable of
2574 revision numbers, expr is a revset string built from log options
2574 revision numbers, expr is a revset string built from log options
2575 and file patterns or None, and used to filter 'revs'. If --stat or
2575 and file patterns or None, and used to filter 'revs'. If --stat or
2576 --patch are not passed filematcher is None. Otherwise it is a
2576 --patch are not passed filematcher is None. Otherwise it is a
2577 callable taking a revision number and returning a match objects
2577 callable taking a revision number and returning a match objects
2578 filtering the files to be detailed when displaying the revision.
2578 filtering the files to be detailed when displaying the revision.
2579 """
2579 """
2580 limit = loglimit(opts)
2580 limit = loglimit(opts)
2581 revs = _logrevs(repo, opts)
2581 revs = _logrevs(repo, opts)
2582 if not revs:
2582 if not revs:
2583 return smartset.baseset([]), None, None
2583 return smartset.baseset([]), None, None
2584 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2584 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2585 if expr:
2585 if expr:
2586 matcher = revset.match(repo.ui, expr)
2586 matcher = revset.match(repo.ui, expr)
2587 revs = matcher(repo, revs)
2587 revs = matcher(repo, revs)
2588 if limit is not None:
2588 if limit is not None:
2589 limitedrevs = []
2589 limitedrevs = []
2590 for idx, r in enumerate(revs):
2590 for idx, r in enumerate(revs):
2591 if limit <= idx:
2591 if limit <= idx:
2592 break
2592 break
2593 limitedrevs.append(r)
2593 limitedrevs.append(r)
2594 revs = smartset.baseset(limitedrevs)
2594 revs = smartset.baseset(limitedrevs)
2595
2595
2596 return revs, expr, filematcher
2596 return revs, expr, filematcher
2597
2597
2598 def _graphnodeformatter(ui, displayer):
2598 def _graphnodeformatter(ui, displayer):
2599 spec = ui.config('ui', 'graphnodetemplate')
2599 spec = ui.config('ui', 'graphnodetemplate')
2600 if not spec:
2600 if not spec:
2601 return templatekw.showgraphnode # fast path for "{graphnode}"
2601 return templatekw.showgraphnode # fast path for "{graphnode}"
2602
2602
2603 spec = templater.unquotestring(spec)
2603 spec = templater.unquotestring(spec)
2604 templ = formatter.maketemplater(ui, spec)
2604 templ = formatter.maketemplater(ui, spec)
2605 cache = {}
2605 cache = {}
2606 if isinstance(displayer, changeset_templater):
2606 if isinstance(displayer, changeset_templater):
2607 cache = displayer.cache # reuse cache of slow templates
2607 cache = displayer.cache # reuse cache of slow templates
2608 props = templatekw.keywords.copy()
2608 props = templatekw.keywords.copy()
2609 props['templ'] = templ
2609 props['templ'] = templ
2610 props['cache'] = cache
2610 props['cache'] = cache
2611 def formatnode(repo, ctx):
2611 def formatnode(repo, ctx):
2612 props['ctx'] = ctx
2612 props['ctx'] = ctx
2613 props['repo'] = repo
2613 props['repo'] = repo
2614 props['ui'] = repo.ui
2614 props['ui'] = repo.ui
2615 props['revcache'] = {}
2615 props['revcache'] = {}
2616 return templ.render(props)
2616 return templ.render(props)
2617 return formatnode
2617 return formatnode
2618
2618
2619 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2619 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2620 filematcher=None):
2620 filematcher=None):
2621 formatnode = _graphnodeformatter(ui, displayer)
2621 formatnode = _graphnodeformatter(ui, displayer)
2622 state = graphmod.asciistate()
2622 state = graphmod.asciistate()
2623 styles = state['styles']
2623 styles = state['styles']
2624
2624
2625 # only set graph styling if HGPLAIN is not set.
2625 # only set graph styling if HGPLAIN is not set.
2626 if ui.plain('graph'):
2626 if ui.plain('graph'):
2627 # set all edge styles to |, the default pre-3.8 behaviour
2627 # set all edge styles to |, the default pre-3.8 behaviour
2628 styles.update(dict.fromkeys(styles, '|'))
2628 styles.update(dict.fromkeys(styles, '|'))
2629 else:
2629 else:
2630 edgetypes = {
2630 edgetypes = {
2631 'parent': graphmod.PARENT,
2631 'parent': graphmod.PARENT,
2632 'grandparent': graphmod.GRANDPARENT,
2632 'grandparent': graphmod.GRANDPARENT,
2633 'missing': graphmod.MISSINGPARENT
2633 'missing': graphmod.MISSINGPARENT
2634 }
2634 }
2635 for name, key in edgetypes.items():
2635 for name, key in edgetypes.items():
2636 # experimental config: experimental.graphstyle.*
2636 # experimental config: experimental.graphstyle.*
2637 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2637 styles[key] = ui.config('experimental', 'graphstyle.%s' % name,
2638 styles[key])
2638 styles[key])
2639 if not styles[key]:
2639 if not styles[key]:
2640 styles[key] = None
2640 styles[key] = None
2641
2641
2642 # experimental config: experimental.graphshorten
2642 # experimental config: experimental.graphshorten
2643 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2643 state['graphshorten'] = ui.configbool('experimental', 'graphshorten')
2644
2644
2645 for rev, type, ctx, parents in dag:
2645 for rev, type, ctx, parents in dag:
2646 char = formatnode(repo, ctx)
2646 char = formatnode(repo, ctx)
2647 copies = None
2647 copies = None
2648 if getrenamed and ctx.rev():
2648 if getrenamed and ctx.rev():
2649 copies = []
2649 copies = []
2650 for fn in ctx.files():
2650 for fn in ctx.files():
2651 rename = getrenamed(fn, ctx.rev())
2651 rename = getrenamed(fn, ctx.rev())
2652 if rename:
2652 if rename:
2653 copies.append((fn, rename[0]))
2653 copies.append((fn, rename[0]))
2654 revmatchfn = None
2654 revmatchfn = None
2655 if filematcher is not None:
2655 if filematcher is not None:
2656 revmatchfn = filematcher(ctx.rev())
2656 revmatchfn = filematcher(ctx.rev())
2657 edges = edgefn(type, char, state, rev, parents)
2657 edges = edgefn(type, char, state, rev, parents)
2658 firstedge = next(edges)
2658 firstedge = next(edges)
2659 width = firstedge[2]
2659 width = firstedge[2]
2660 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2660 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
2661 _graphwidth=width)
2661 _graphwidth=width)
2662 lines = displayer.hunk.pop(rev).split('\n')
2662 lines = displayer.hunk.pop(rev).split('\n')
2663 if not lines[-1]:
2663 if not lines[-1]:
2664 del lines[-1]
2664 del lines[-1]
2665 displayer.flush(ctx)
2665 displayer.flush(ctx)
2666 for type, char, width, coldata in itertools.chain([firstedge], edges):
2666 for type, char, width, coldata in itertools.chain([firstedge], edges):
2667 graphmod.ascii(ui, state, type, char, lines, coldata)
2667 graphmod.ascii(ui, state, type, char, lines, coldata)
2668 lines = []
2668 lines = []
2669 displayer.close()
2669 displayer.close()
2670
2670
2671 def graphlog(ui, repo, pats, opts):
2671 def graphlog(ui, repo, pats, opts):
2672 # Parameters are identical to log command ones
2672 # Parameters are identical to log command ones
2673 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
2673 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
2674 revdag = graphmod.dagwalker(repo, revs)
2674 revdag = graphmod.dagwalker(repo, revs)
2675
2675
2676 getrenamed = None
2676 getrenamed = None
2677 if opts.get('copies'):
2677 if opts.get('copies'):
2678 endrev = None
2678 endrev = None
2679 if opts.get('rev'):
2679 if opts.get('rev'):
2680 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2680 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
2681 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2681 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
2682
2682
2683 ui.pager('log')
2683 ui.pager('log')
2684 displayer = show_changeset(ui, repo, opts, buffered=True)
2684 displayer = show_changeset(ui, repo, opts, buffered=True)
2685 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2685 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed,
2686 filematcher)
2686 filematcher)
2687
2687
2688 def checkunsupportedgraphflags(pats, opts):
2688 def checkunsupportedgraphflags(pats, opts):
2689 for op in ["newest_first"]:
2689 for op in ["newest_first"]:
2690 if op in opts and opts[op]:
2690 if op in opts and opts[op]:
2691 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2691 raise error.Abort(_("-G/--graph option is incompatible with --%s")
2692 % op.replace("_", "-"))
2692 % op.replace("_", "-"))
2693
2693
2694 def graphrevs(repo, nodes, opts):
2694 def graphrevs(repo, nodes, opts):
2695 limit = loglimit(opts)
2695 limit = loglimit(opts)
2696 nodes.reverse()
2696 nodes.reverse()
2697 if limit is not None:
2697 if limit is not None:
2698 nodes = nodes[:limit]
2698 nodes = nodes[:limit]
2699 return graphmod.nodes(repo, nodes)
2699 return graphmod.nodes(repo, nodes)
2700
2700
2701 def add(ui, repo, match, prefix, explicitonly, **opts):
2701 def add(ui, repo, match, prefix, explicitonly, **opts):
2702 join = lambda f: os.path.join(prefix, f)
2702 join = lambda f: os.path.join(prefix, f)
2703 bad = []
2703 bad = []
2704
2704
2705 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2705 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2706 names = []
2706 names = []
2707 wctx = repo[None]
2707 wctx = repo[None]
2708 cca = None
2708 cca = None
2709 abort, warn = scmutil.checkportabilityalert(ui)
2709 abort, warn = scmutil.checkportabilityalert(ui)
2710 if abort or warn:
2710 if abort or warn:
2711 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2711 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
2712
2712
2713 badmatch = matchmod.badmatch(match, badfn)
2713 badmatch = matchmod.badmatch(match, badfn)
2714 dirstate = repo.dirstate
2714 dirstate = repo.dirstate
2715 # We don't want to just call wctx.walk here, since it would return a lot of
2715 # We don't want to just call wctx.walk here, since it would return a lot of
2716 # clean files, which we aren't interested in and takes time.
2716 # clean files, which we aren't interested in and takes time.
2717 for f in sorted(dirstate.walk(badmatch, sorted(wctx.substate),
2717 for f in sorted(dirstate.walk(badmatch, sorted(wctx.substate),
2718 True, False, full=False)):
2718 True, False, full=False)):
2719 exact = match.exact(f)
2719 exact = match.exact(f)
2720 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2720 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
2721 if cca:
2721 if cca:
2722 cca(f)
2722 cca(f)
2723 names.append(f)
2723 names.append(f)
2724 if ui.verbose or not exact:
2724 if ui.verbose or not exact:
2725 ui.status(_('adding %s\n') % match.rel(f))
2725 ui.status(_('adding %s\n') % match.rel(f))
2726
2726
2727 for subpath in sorted(wctx.substate):
2727 for subpath in sorted(wctx.substate):
2728 sub = wctx.sub(subpath)
2728 sub = wctx.sub(subpath)
2729 try:
2729 try:
2730 submatch = matchmod.subdirmatcher(subpath, match)
2730 submatch = matchmod.subdirmatcher(subpath, match)
2731 if opts.get(r'subrepos'):
2731 if opts.get(r'subrepos'):
2732 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2732 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2733 else:
2733 else:
2734 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2734 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2735 except error.LookupError:
2735 except error.LookupError:
2736 ui.status(_("skipping missing subrepository: %s\n")
2736 ui.status(_("skipping missing subrepository: %s\n")
2737 % join(subpath))
2737 % join(subpath))
2738
2738
2739 if not opts.get(r'dry_run'):
2739 if not opts.get(r'dry_run'):
2740 rejected = wctx.add(names, prefix)
2740 rejected = wctx.add(names, prefix)
2741 bad.extend(f for f in rejected if f in match.files())
2741 bad.extend(f for f in rejected if f in match.files())
2742 return bad
2742 return bad
2743
2743
2744 def addwebdirpath(repo, serverpath, webconf):
2744 def addwebdirpath(repo, serverpath, webconf):
2745 webconf[serverpath] = repo.root
2745 webconf[serverpath] = repo.root
2746 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2746 repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root))
2747
2747
2748 for r in repo.revs('filelog("path:.hgsub")'):
2748 for r in repo.revs('filelog("path:.hgsub")'):
2749 ctx = repo[r]
2749 ctx = repo[r]
2750 for subpath in ctx.substate:
2750 for subpath in ctx.substate:
2751 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2751 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2752
2752
2753 def forget(ui, repo, match, prefix, explicitonly):
2753 def forget(ui, repo, match, prefix, explicitonly):
2754 join = lambda f: os.path.join(prefix, f)
2754 join = lambda f: os.path.join(prefix, f)
2755 bad = []
2755 bad = []
2756 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2756 badfn = lambda x, y: bad.append(x) or match.bad(x, y)
2757 wctx = repo[None]
2757 wctx = repo[None]
2758 forgot = []
2758 forgot = []
2759
2759
2760 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2760 s = repo.status(match=matchmod.badmatch(match, badfn), clean=True)
2761 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2761 forget = sorted(s.modified + s.added + s.deleted + s.clean)
2762 if explicitonly:
2762 if explicitonly:
2763 forget = [f for f in forget if match.exact(f)]
2763 forget = [f for f in forget if match.exact(f)]
2764
2764
2765 for subpath in sorted(wctx.substate):
2765 for subpath in sorted(wctx.substate):
2766 sub = wctx.sub(subpath)
2766 sub = wctx.sub(subpath)
2767 try:
2767 try:
2768 submatch = matchmod.subdirmatcher(subpath, match)
2768 submatch = matchmod.subdirmatcher(subpath, match)
2769 subbad, subforgot = sub.forget(submatch, prefix)
2769 subbad, subforgot = sub.forget(submatch, prefix)
2770 bad.extend([subpath + '/' + f for f in subbad])
2770 bad.extend([subpath + '/' + f for f in subbad])
2771 forgot.extend([subpath + '/' + f for f in subforgot])
2771 forgot.extend([subpath + '/' + f for f in subforgot])
2772 except error.LookupError:
2772 except error.LookupError:
2773 ui.status(_("skipping missing subrepository: %s\n")
2773 ui.status(_("skipping missing subrepository: %s\n")
2774 % join(subpath))
2774 % join(subpath))
2775
2775
2776 if not explicitonly:
2776 if not explicitonly:
2777 for f in match.files():
2777 for f in match.files():
2778 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2778 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2779 if f not in forgot:
2779 if f not in forgot:
2780 if repo.wvfs.exists(f):
2780 if repo.wvfs.exists(f):
2781 # Don't complain if the exact case match wasn't given.
2781 # Don't complain if the exact case match wasn't given.
2782 # But don't do this until after checking 'forgot', so
2782 # But don't do this until after checking 'forgot', so
2783 # that subrepo files aren't normalized, and this op is
2783 # that subrepo files aren't normalized, and this op is
2784 # purely from data cached by the status walk above.
2784 # purely from data cached by the status walk above.
2785 if repo.dirstate.normalize(f) in repo.dirstate:
2785 if repo.dirstate.normalize(f) in repo.dirstate:
2786 continue
2786 continue
2787 ui.warn(_('not removing %s: '
2787 ui.warn(_('not removing %s: '
2788 'file is already untracked\n')
2788 'file is already untracked\n')
2789 % match.rel(f))
2789 % match.rel(f))
2790 bad.append(f)
2790 bad.append(f)
2791
2791
2792 for f in forget:
2792 for f in forget:
2793 if ui.verbose or not match.exact(f):
2793 if ui.verbose or not match.exact(f):
2794 ui.status(_('removing %s\n') % match.rel(f))
2794 ui.status(_('removing %s\n') % match.rel(f))
2795
2795
2796 rejected = wctx.forget(forget, prefix)
2796 rejected = wctx.forget(forget, prefix)
2797 bad.extend(f for f in rejected if f in match.files())
2797 bad.extend(f for f in rejected if f in match.files())
2798 forgot.extend(f for f in forget if f not in rejected)
2798 forgot.extend(f for f in forget if f not in rejected)
2799 return bad, forgot
2799 return bad, forgot
2800
2800
2801 def files(ui, ctx, m, fm, fmt, subrepos):
2801 def files(ui, ctx, m, fm, fmt, subrepos):
2802 rev = ctx.rev()
2802 rev = ctx.rev()
2803 ret = 1
2803 ret = 1
2804 ds = ctx.repo().dirstate
2804 ds = ctx.repo().dirstate
2805
2805
2806 for f in ctx.matches(m):
2806 for f in ctx.matches(m):
2807 if rev is None and ds[f] == 'r':
2807 if rev is None and ds[f] == 'r':
2808 continue
2808 continue
2809 fm.startitem()
2809 fm.startitem()
2810 if ui.verbose:
2810 if ui.verbose:
2811 fc = ctx[f]
2811 fc = ctx[f]
2812 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2812 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
2813 fm.data(abspath=f)
2813 fm.data(abspath=f)
2814 fm.write('path', fmt, m.rel(f))
2814 fm.write('path', fmt, m.rel(f))
2815 ret = 0
2815 ret = 0
2816
2816
2817 for subpath in sorted(ctx.substate):
2817 for subpath in sorted(ctx.substate):
2818 submatch = matchmod.subdirmatcher(subpath, m)
2818 submatch = matchmod.subdirmatcher(subpath, m)
2819 if (subrepos or m.exact(subpath) or any(submatch.files())):
2819 if (subrepos or m.exact(subpath) or any(submatch.files())):
2820 sub = ctx.sub(subpath)
2820 sub = ctx.sub(subpath)
2821 try:
2821 try:
2822 recurse = m.exact(subpath) or subrepos
2822 recurse = m.exact(subpath) or subrepos
2823 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2823 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
2824 ret = 0
2824 ret = 0
2825 except error.LookupError:
2825 except error.LookupError:
2826 ui.status(_("skipping missing subrepository: %s\n")
2826 ui.status(_("skipping missing subrepository: %s\n")
2827 % m.abs(subpath))
2827 % m.abs(subpath))
2828
2828
2829 return ret
2829 return ret
2830
2830
2831 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2831 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
2832 join = lambda f: os.path.join(prefix, f)
2832 join = lambda f: os.path.join(prefix, f)
2833 ret = 0
2833 ret = 0
2834 s = repo.status(match=m, clean=True)
2834 s = repo.status(match=m, clean=True)
2835 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2835 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2836
2836
2837 wctx = repo[None]
2837 wctx = repo[None]
2838
2838
2839 if warnings is None:
2839 if warnings is None:
2840 warnings = []
2840 warnings = []
2841 warn = True
2841 warn = True
2842 else:
2842 else:
2843 warn = False
2843 warn = False
2844
2844
2845 subs = sorted(wctx.substate)
2845 subs = sorted(wctx.substate)
2846 total = len(subs)
2846 total = len(subs)
2847 count = 0
2847 count = 0
2848 for subpath in subs:
2848 for subpath in subs:
2849 count += 1
2849 count += 1
2850 submatch = matchmod.subdirmatcher(subpath, m)
2850 submatch = matchmod.subdirmatcher(subpath, m)
2851 if subrepos or m.exact(subpath) or any(submatch.files()):
2851 if subrepos or m.exact(subpath) or any(submatch.files()):
2852 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2852 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2853 sub = wctx.sub(subpath)
2853 sub = wctx.sub(subpath)
2854 try:
2854 try:
2855 if sub.removefiles(submatch, prefix, after, force, subrepos,
2855 if sub.removefiles(submatch, prefix, after, force, subrepos,
2856 warnings):
2856 warnings):
2857 ret = 1
2857 ret = 1
2858 except error.LookupError:
2858 except error.LookupError:
2859 warnings.append(_("skipping missing subrepository: %s\n")
2859 warnings.append(_("skipping missing subrepository: %s\n")
2860 % join(subpath))
2860 % join(subpath))
2861 ui.progress(_('searching'), None)
2861 ui.progress(_('searching'), None)
2862
2862
2863 # warn about failure to delete explicit files/dirs
2863 # warn about failure to delete explicit files/dirs
2864 deleteddirs = util.dirs(deleted)
2864 deleteddirs = util.dirs(deleted)
2865 files = m.files()
2865 files = m.files()
2866 total = len(files)
2866 total = len(files)
2867 count = 0
2867 count = 0
2868 for f in files:
2868 for f in files:
2869 def insubrepo():
2869 def insubrepo():
2870 for subpath in wctx.substate:
2870 for subpath in wctx.substate:
2871 if f.startswith(subpath + '/'):
2871 if f.startswith(subpath + '/'):
2872 return True
2872 return True
2873 return False
2873 return False
2874
2874
2875 count += 1
2875 count += 1
2876 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2876 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2877 isdir = f in deleteddirs or wctx.hasdir(f)
2877 isdir = f in deleteddirs or wctx.hasdir(f)
2878 if (f in repo.dirstate or isdir or f == '.'
2878 if (f in repo.dirstate or isdir or f == '.'
2879 or insubrepo() or f in subs):
2879 or insubrepo() or f in subs):
2880 continue
2880 continue
2881
2881
2882 if repo.wvfs.exists(f):
2882 if repo.wvfs.exists(f):
2883 if repo.wvfs.isdir(f):
2883 if repo.wvfs.isdir(f):
2884 warnings.append(_('not removing %s: no tracked files\n')
2884 warnings.append(_('not removing %s: no tracked files\n')
2885 % m.rel(f))
2885 % m.rel(f))
2886 else:
2886 else:
2887 warnings.append(_('not removing %s: file is untracked\n')
2887 warnings.append(_('not removing %s: file is untracked\n')
2888 % m.rel(f))
2888 % m.rel(f))
2889 # missing files will generate a warning elsewhere
2889 # missing files will generate a warning elsewhere
2890 ret = 1
2890 ret = 1
2891 ui.progress(_('deleting'), None)
2891 ui.progress(_('deleting'), None)
2892
2892
2893 if force:
2893 if force:
2894 list = modified + deleted + clean + added
2894 list = modified + deleted + clean + added
2895 elif after:
2895 elif after:
2896 list = deleted
2896 list = deleted
2897 remaining = modified + added + clean
2897 remaining = modified + added + clean
2898 total = len(remaining)
2898 total = len(remaining)
2899 count = 0
2899 count = 0
2900 for f in remaining:
2900 for f in remaining:
2901 count += 1
2901 count += 1
2902 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2902 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2903 warnings.append(_('not removing %s: file still exists\n')
2903 warnings.append(_('not removing %s: file still exists\n')
2904 % m.rel(f))
2904 % m.rel(f))
2905 ret = 1
2905 ret = 1
2906 ui.progress(_('skipping'), None)
2906 ui.progress(_('skipping'), None)
2907 else:
2907 else:
2908 list = deleted + clean
2908 list = deleted + clean
2909 total = len(modified) + len(added)
2909 total = len(modified) + len(added)
2910 count = 0
2910 count = 0
2911 for f in modified:
2911 for f in modified:
2912 count += 1
2912 count += 1
2913 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2913 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2914 warnings.append(_('not removing %s: file is modified (use -f'
2914 warnings.append(_('not removing %s: file is modified (use -f'
2915 ' to force removal)\n') % m.rel(f))
2915 ' to force removal)\n') % m.rel(f))
2916 ret = 1
2916 ret = 1
2917 for f in added:
2917 for f in added:
2918 count += 1
2918 count += 1
2919 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2919 ui.progress(_('skipping'), count, total=total, unit=_('files'))
2920 warnings.append(_("not removing %s: file has been marked for add"
2920 warnings.append(_("not removing %s: file has been marked for add"
2921 " (use 'hg forget' to undo add)\n") % m.rel(f))
2921 " (use 'hg forget' to undo add)\n") % m.rel(f))
2922 ret = 1
2922 ret = 1
2923 ui.progress(_('skipping'), None)
2923 ui.progress(_('skipping'), None)
2924
2924
2925 list = sorted(list)
2925 list = sorted(list)
2926 total = len(list)
2926 total = len(list)
2927 count = 0
2927 count = 0
2928 for f in list:
2928 for f in list:
2929 count += 1
2929 count += 1
2930 if ui.verbose or not m.exact(f):
2930 if ui.verbose or not m.exact(f):
2931 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2931 ui.progress(_('deleting'), count, total=total, unit=_('files'))
2932 ui.status(_('removing %s\n') % m.rel(f))
2932 ui.status(_('removing %s\n') % m.rel(f))
2933 ui.progress(_('deleting'), None)
2933 ui.progress(_('deleting'), None)
2934
2934
2935 with repo.wlock():
2935 with repo.wlock():
2936 if not after:
2936 if not after:
2937 for f in list:
2937 for f in list:
2938 if f in added:
2938 if f in added:
2939 continue # we never unlink added files on remove
2939 continue # we never unlink added files on remove
2940 repo.wvfs.unlinkpath(f, ignoremissing=True)
2940 repo.wvfs.unlinkpath(f, ignoremissing=True)
2941 repo[None].forget(list)
2941 repo[None].forget(list)
2942
2942
2943 if warn:
2943 if warn:
2944 for warning in warnings:
2944 for warning in warnings:
2945 ui.warn(warning)
2945 ui.warn(warning)
2946
2946
2947 return ret
2947 return ret
2948
2948
2949 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2949 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
2950 err = 1
2950 err = 1
2951
2951
2952 def write(path):
2952 def write(path):
2953 filename = None
2953 filename = None
2954 if fntemplate:
2954 if fntemplate:
2955 filename = makefilename(repo, fntemplate, ctx.node(),
2955 filename = makefilename(repo, fntemplate, ctx.node(),
2956 pathname=os.path.join(prefix, path))
2956 pathname=os.path.join(prefix, path))
2957 with formatter.maybereopen(basefm, filename, opts) as fm:
2957 with formatter.maybereopen(basefm, filename, opts) as fm:
2958 data = ctx[path].data()
2958 data = ctx[path].data()
2959 if opts.get('decode'):
2959 if opts.get('decode'):
2960 data = repo.wwritedata(path, data)
2960 data = repo.wwritedata(path, data)
2961 fm.startitem()
2961 fm.startitem()
2962 fm.write('data', '%s', data)
2962 fm.write('data', '%s', data)
2963 fm.data(abspath=path, path=matcher.rel(path))
2963 fm.data(abspath=path, path=matcher.rel(path))
2964
2964
2965 # Automation often uses hg cat on single files, so special case it
2965 # Automation often uses hg cat on single files, so special case it
2966 # for performance to avoid the cost of parsing the manifest.
2966 # for performance to avoid the cost of parsing the manifest.
2967 if len(matcher.files()) == 1 and not matcher.anypats():
2967 if len(matcher.files()) == 1 and not matcher.anypats():
2968 file = matcher.files()[0]
2968 file = matcher.files()[0]
2969 mfl = repo.manifestlog
2969 mfl = repo.manifestlog
2970 mfnode = ctx.manifestnode()
2970 mfnode = ctx.manifestnode()
2971 try:
2971 try:
2972 if mfnode and mfl[mfnode].find(file)[0]:
2972 if mfnode and mfl[mfnode].find(file)[0]:
2973 write(file)
2973 write(file)
2974 return 0
2974 return 0
2975 except KeyError:
2975 except KeyError:
2976 pass
2976 pass
2977
2977
2978 for abs in ctx.walk(matcher):
2978 for abs in ctx.walk(matcher):
2979 write(abs)
2979 write(abs)
2980 err = 0
2980 err = 0
2981
2981
2982 for subpath in sorted(ctx.substate):
2982 for subpath in sorted(ctx.substate):
2983 sub = ctx.sub(subpath)
2983 sub = ctx.sub(subpath)
2984 try:
2984 try:
2985 submatch = matchmod.subdirmatcher(subpath, matcher)
2985 submatch = matchmod.subdirmatcher(subpath, matcher)
2986
2986
2987 if not sub.cat(submatch, basefm, fntemplate,
2987 if not sub.cat(submatch, basefm, fntemplate,
2988 os.path.join(prefix, sub._path), **opts):
2988 os.path.join(prefix, sub._path), **opts):
2989 err = 0
2989 err = 0
2990 except error.RepoLookupError:
2990 except error.RepoLookupError:
2991 ui.status(_("skipping missing subrepository: %s\n")
2991 ui.status(_("skipping missing subrepository: %s\n")
2992 % os.path.join(prefix, subpath))
2992 % os.path.join(prefix, subpath))
2993
2993
2994 return err
2994 return err
2995
2995
2996 def commit(ui, repo, commitfunc, pats, opts):
2996 def commit(ui, repo, commitfunc, pats, opts):
2997 '''commit the specified files or all outstanding changes'''
2997 '''commit the specified files or all outstanding changes'''
2998 date = opts.get('date')
2998 date = opts.get('date')
2999 if date:
2999 if date:
3000 opts['date'] = util.parsedate(date)
3000 opts['date'] = util.parsedate(date)
3001 message = logmessage(ui, opts)
3001 message = logmessage(ui, opts)
3002 matcher = scmutil.match(repo[None], pats, opts)
3002 matcher = scmutil.match(repo[None], pats, opts)
3003
3003
3004 dsguard = None
3004 dsguard = None
3005 # extract addremove carefully -- this function can be called from a command
3005 # extract addremove carefully -- this function can be called from a command
3006 # that doesn't support addremove
3006 # that doesn't support addremove
3007 if opts.get('addremove'):
3007 if opts.get('addremove'):
3008 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3008 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3009 with dsguard or util.nullcontextmanager():
3009 with dsguard or util.nullcontextmanager():
3010 if dsguard:
3010 if dsguard:
3011 if scmutil.addremove(repo, matcher, "", opts) != 0:
3011 if scmutil.addremove(repo, matcher, "", opts) != 0:
3012 raise error.Abort(
3012 raise error.Abort(
3013 _("failed to mark all new/missing files as added/removed"))
3013 _("failed to mark all new/missing files as added/removed"))
3014
3014
3015 return commitfunc(ui, repo, message, matcher, opts)
3015 return commitfunc(ui, repo, message, matcher, opts)
3016
3016
3017 def samefile(f, ctx1, ctx2):
3017 def samefile(f, ctx1, ctx2):
3018 if f in ctx1.manifest():
3018 if f in ctx1.manifest():
3019 a = ctx1.filectx(f)
3019 a = ctx1.filectx(f)
3020 if f in ctx2.manifest():
3020 if f in ctx2.manifest():
3021 b = ctx2.filectx(f)
3021 b = ctx2.filectx(f)
3022 return (not a.cmp(b)
3022 return (not a.cmp(b)
3023 and a.flags() == b.flags())
3023 and a.flags() == b.flags())
3024 else:
3024 else:
3025 return False
3025 return False
3026 else:
3026 else:
3027 return f not in ctx2.manifest()
3027 return f not in ctx2.manifest()
3028
3028
3029 # TODO: remove the commitfunc parameter because it is no longer used
3029 def amend(ui, repo, commitfunc, old, extra, pats, opts):
3030 def amend(ui, repo, commitfunc, old, extra, pats, opts):
3030 # avoid cycle context -> subrepo -> cmdutil
3031 # avoid cycle context -> subrepo -> cmdutil
3031 from . import context
3032 from . import context
3032
3033
3033 # amend will reuse the existing user if not specified, but the obsolete
3034 # amend will reuse the existing user if not specified, but the obsolete
3034 # marker creation requires that the current user's name is specified.
3035 # marker creation requires that the current user's name is specified.
3035 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3036 if obsolete.isenabled(repo, obsolete.createmarkersopt):
3036 ui.username() # raise exception if username not set
3037 ui.username() # raise exception if username not set
3037
3038
3038 ui.note(_('amending changeset %s\n') % old)
3039 ui.note(_('amending changeset %s\n') % old)
3039 base = old.p1()
3040 base = old.p1()
3040
3041
3041 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3042 with repo.wlock(), repo.lock(), repo.transaction('amend'):
3042 # See if we got a message from -m or -l, if not, open the editor
3043 # with the message of the changeset to amend
3044 message = logmessage(ui, opts)
3045 # ensure logfile does not conflict with later enforcement of the
3046 # message. potential logfile content has been processed by
3047 # `logmessage` anyway.
3048 opts.pop('logfile')
3049 # First, do a regular commit to record all changes in the working
3050 # directory (if there are any)
3051 ui.callhooks = False
3052 activebookmark = repo._bookmarks.active
3053 try:
3054 repo._bookmarks.active = None
3055 opts['message'] = 'temporary amend commit for %s' % old
3056 node = commit(ui, repo, commitfunc, pats, opts)
3057 finally:
3058 repo._bookmarks.active = activebookmark
3059 ui.callhooks = True
3060 ctx = repo[node]
3061
3062 # Participating changesets:
3043 # Participating changesets:
3063 #
3044 #
3064 # node/ctx o - new (intermediate) commit that contains changes
3045 # wctx o - workingctx that contains changes from working copy
3065 # | from working dir to go into amending commit
3046 # | to go into amending commit
3066 # | (or a workingctx if there were no changes)
3067 # |
3047 # |
3068 # old o - changeset to amend
3048 # old o - changeset to amend
3069 # |
3049 # |
3070 # base o - first parent of the changeset to amend
3050 # base o - first parent of the changeset to amend
3051 wctx = repo[None]
3071
3052
3072 # Update extra dict from amended commit (e.g. to preserve graft
3053 # Update extra dict from amended commit (e.g. to preserve graft
3073 # source)
3054 # source)
3074 extra.update(old.extra())
3055 extra.update(old.extra())
3075
3056
3076 # Also update it from the intermediate commit or from the wctx
3057 # Also update it from the from the wctx
3077 extra.update(ctx.extra())
3058 extra.update(wctx.extra())
3059
3060 user = opts.get('user') or old.user()
3061 date = opts.get('date') or old.date()
3078
3062
3079 if len(old.parents()) > 1:
3063 if len(old.parents()) > 1:
3080 # ctx.files() isn't reliable for merges, so fall back to the
3064 # ctx.files() isn't reliable for merges, so fall back to the
3081 # slower repo.status() method
3065 # slower repo.status() method
3082 files = set([fn for st in repo.status(base, old)[:3]
3066 files = set([fn for st in repo.status(base, old)[:3]
3083 for fn in st])
3067 for fn in st])
3084 else:
3068 else:
3085 files = set(old.files())
3069 files = set(old.files())
3086
3070
3087 # Second, we use either the commit we just did, or if there were no
3071 # add/remove the files to the working copy if the "addremove" option
3088 # changes the parent of the working directory as the version of the
3072 # was specified.
3089 # files in the final amend commit
3073 matcher = scmutil.match(wctx, pats, opts)
3090 if node:
3074 if (opts.get('addremove')
3091 ui.note(_('copying changeset %s to %s\n') % (ctx, base))
3075 and scmutil.addremove(repo, matcher, "", opts)):
3092
3076 raise error.Abort(
3093 user = ctx.user()
3077 _("failed to mark all new/missing files as added/removed"))
3094 date = ctx.date()
3078
3079 filestoamend = set(f for f in wctx.files() if matcher(f))
3080
3081 changes = (len(filestoamend) > 0)
3082 if changes:
3095 # Recompute copies (avoid recording a -> b -> a)
3083 # Recompute copies (avoid recording a -> b -> a)
3096 copied = copies.pathcopies(base, ctx)
3084 copied = copies.pathcopies(base, wctx, matcher)
3097 if old.p2:
3085 if old.p2:
3098 copied.update(copies.pathcopies(old.p2(), ctx))
3086 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
3099
3087
3100 # Prune files which were reverted by the updates: if old
3088 # Prune files which were reverted by the updates: if old
3101 # introduced file X and our intermediate commit, node,
3089 # introduced file X and the file was renamed in the working
3102 # renamed that file, then those two files are the same and
3090 # copy, then those two files are the same and
3103 # we can discard X from our list of files. Likewise if X
3091 # we can discard X from our list of files. Likewise if X
3104 # was deleted, it's no longer relevant
3092 # was deleted, it's no longer relevant
3105 files.update(ctx.files())
3093 files.update(filestoamend)
3106 files = [f for f in files if not samefile(f, ctx, base)]
3094 files = [f for f in files if not samefile(f, wctx, base)]
3107
3095
3108 def filectxfn(repo, ctx_, path):
3096 def filectxfn(repo, ctx_, path):
3109 try:
3097 try:
3110 fctx = ctx[path]
3098 # If the file being considered is not amongst the files
3099 # to be amended, we should return the file context from the
3100 # old changeset. This avoids issues when only some files in
3101 # the working copy are being amended but there are also
3102 # changes to other files from the old changeset.
3103 if path not in filestoamend:
3104 return old.filectx(path)
3105
3106 fctx = wctx[path]
3107
3108 # Return None for removed files.
3109 if not fctx.exists():
3110 return None
3111
3111 flags = fctx.flags()
3112 flags = fctx.flags()
3112 mctx = context.memfilectx(repo,
3113 mctx = context.memfilectx(repo,
3113 fctx.path(), fctx.data(),
3114 fctx.path(), fctx.data(),
3114 islink='l' in flags,
3115 islink='l' in flags,
3115 isexec='x' in flags,
3116 isexec='x' in flags,
3116 copied=copied.get(path))
3117 copied=copied.get(path))
3117 return mctx
3118 return mctx
3118 except KeyError:
3119 except KeyError:
3119 return None
3120 return None
3120 else:
3121 else:
3121 ui.note(_('copying changeset %s to %s\n') % (old, base))
3122 ui.note(_('copying changeset %s to %s\n') % (old, base))
3122
3123
3123 # Use version of files as in the old cset
3124 # Use version of files as in the old cset
3124 def filectxfn(repo, ctx_, path):
3125 def filectxfn(repo, ctx_, path):
3125 try:
3126 try:
3126 return old.filectx(path)
3127 return old.filectx(path)
3127 except KeyError:
3128 except KeyError:
3128 return None
3129 return None
3129
3130
3130 user = opts.get('user') or old.user()
3131 # See if we got a message from -m or -l, if not, open the editor with
3131 date = opts.get('date') or old.date()
3132 # the message of the changeset to amend.
3133 message = logmessage(ui, opts)
3134
3132 editform = mergeeditform(old, 'commit.amend')
3135 editform = mergeeditform(old, 'commit.amend')
3133 editor = getcommiteditor(editform=editform,
3136 editor = getcommiteditor(editform=editform,
3134 **pycompat.strkwargs(opts))
3137 **pycompat.strkwargs(opts))
3138
3135 if not message:
3139 if not message:
3136 editor = getcommiteditor(edit=True, editform=editform)
3140 editor = getcommiteditor(edit=True, editform=editform)
3137 message = old.description()
3141 message = old.description()
3138
3142
3139 pureextra = extra.copy()
3143 pureextra = extra.copy()
3140 extra['amend_source'] = old.hex()
3144 extra['amend_source'] = old.hex()
3141
3145
3142 new = context.memctx(repo,
3146 new = context.memctx(repo,
3143 parents=[base.node(), old.p2().node()],
3147 parents=[base.node(), old.p2().node()],
3144 text=message,
3148 text=message,
3145 files=files,
3149 files=files,
3146 filectxfn=filectxfn,
3150 filectxfn=filectxfn,
3147 user=user,
3151 user=user,
3148 date=date,
3152 date=date,
3149 extra=extra,
3153 extra=extra,
3150 editor=editor)
3154 editor=editor)
3151
3155
3152 newdesc = changelog.stripdesc(new.description())
3156 newdesc = changelog.stripdesc(new.description())
3153 if ((not node)
3157 if ((not changes)
3154 and newdesc == old.description()
3158 and newdesc == old.description()
3155 and user == old.user()
3159 and user == old.user()
3156 and date == old.date()
3160 and date == old.date()
3157 and pureextra == old.extra()):
3161 and pureextra == old.extra()):
3158 # nothing changed. continuing here would create a new node
3162 # nothing changed. continuing here would create a new node
3159 # anyway because of the amend_source noise.
3163 # anyway because of the amend_source noise.
3160 #
3164 #
3161 # This not what we expect from amend.
3165 # This not what we expect from amend.
3162 return old.node()
3166 return old.node()
3163
3167
3164 if opts.get('secret'):
3168 if opts.get('secret'):
3165 commitphase = 'secret'
3169 commitphase = 'secret'
3166 else:
3170 else:
3167 commitphase = old.phase()
3171 commitphase = old.phase()
3168 overrides = {('phases', 'new-commit'): commitphase}
3172 overrides = {('phases', 'new-commit'): commitphase}
3169 with ui.configoverride(overrides, 'amend'):
3173 with ui.configoverride(overrides, 'amend'):
3170 newid = repo.commitctx(new)
3174 newid = repo.commitctx(new)
3171
3175
3172 # Reroute the working copy parent to the new changeset
3176 # Reroute the working copy parent to the new changeset
3173 repo.setparents(newid, nullid)
3177 repo.setparents(newid, nullid)
3174 mapping = {old.node(): (newid,)}
3178 mapping = {old.node(): (newid,)}
3175 if node:
3176 mapping[node] = ()
3177 scmutil.cleanupnodes(repo, mapping, 'amend')
3179 scmutil.cleanupnodes(repo, mapping, 'amend')
3178
3180
3181 # Fixing the dirstate because localrepo.commitctx does not update
3182 # it. This is rather convenient because we did not need to update
3183 # the dirstate for all the files in the new commit which commitctx
3184 # could have done if it updated the dirstate. Now, we can
3185 # selectively update the dirstate only for the amended files.
3186 dirstate = repo.dirstate
3187
3188 # Update the state of the files which were added and
3189 # and modified in the amend to "normal" in the dirstate.
3190 normalfiles = set(wctx.modified() + wctx.added()) & filestoamend
3191 for f in normalfiles:
3192 dirstate.normal(f)
3193
3194 # Update the state of files which were removed in the amend
3195 # to "removed" in the dirstate.
3196 removedfiles = set(wctx.removed()) & filestoamend
3197 for f in removedfiles:
3198 dirstate.drop(f)
3199
3179 return newid
3200 return newid
3180
3201
3181 def commiteditor(repo, ctx, subs, editform=''):
3202 def commiteditor(repo, ctx, subs, editform=''):
3182 if ctx.description():
3203 if ctx.description():
3183 return ctx.description()
3204 return ctx.description()
3184 return commitforceeditor(repo, ctx, subs, editform=editform,
3205 return commitforceeditor(repo, ctx, subs, editform=editform,
3185 unchangedmessagedetection=True)
3206 unchangedmessagedetection=True)
3186
3207
3187 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3208 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
3188 editform='', unchangedmessagedetection=False):
3209 editform='', unchangedmessagedetection=False):
3189 if not extramsg:
3210 if not extramsg:
3190 extramsg = _("Leave message empty to abort commit.")
3211 extramsg = _("Leave message empty to abort commit.")
3191
3212
3192 forms = [e for e in editform.split('.') if e]
3213 forms = [e for e in editform.split('.') if e]
3193 forms.insert(0, 'changeset')
3214 forms.insert(0, 'changeset')
3194 templatetext = None
3215 templatetext = None
3195 while forms:
3216 while forms:
3196 ref = '.'.join(forms)
3217 ref = '.'.join(forms)
3197 if repo.ui.config('committemplate', ref):
3218 if repo.ui.config('committemplate', ref):
3198 templatetext = committext = buildcommittemplate(
3219 templatetext = committext = buildcommittemplate(
3199 repo, ctx, subs, extramsg, ref)
3220 repo, ctx, subs, extramsg, ref)
3200 break
3221 break
3201 forms.pop()
3222 forms.pop()
3202 else:
3223 else:
3203 committext = buildcommittext(repo, ctx, subs, extramsg)
3224 committext = buildcommittext(repo, ctx, subs, extramsg)
3204
3225
3205 # run editor in the repository root
3226 # run editor in the repository root
3206 olddir = pycompat.getcwd()
3227 olddir = pycompat.getcwd()
3207 os.chdir(repo.root)
3228 os.chdir(repo.root)
3208
3229
3209 # make in-memory changes visible to external process
3230 # make in-memory changes visible to external process
3210 tr = repo.currenttransaction()
3231 tr = repo.currenttransaction()
3211 repo.dirstate.write(tr)
3232 repo.dirstate.write(tr)
3212 pending = tr and tr.writepending() and repo.root
3233 pending = tr and tr.writepending() and repo.root
3213
3234
3214 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3235 editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
3215 editform=editform, pending=pending,
3236 editform=editform, pending=pending,
3216 repopath=repo.path, action='commit')
3237 repopath=repo.path, action='commit')
3217 text = editortext
3238 text = editortext
3218
3239
3219 # strip away anything below this special string (used for editors that want
3240 # strip away anything below this special string (used for editors that want
3220 # to display the diff)
3241 # to display the diff)
3221 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3242 stripbelow = re.search(_linebelow, text, flags=re.MULTILINE)
3222 if stripbelow:
3243 if stripbelow:
3223 text = text[:stripbelow.start()]
3244 text = text[:stripbelow.start()]
3224
3245
3225 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3246 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
3226 os.chdir(olddir)
3247 os.chdir(olddir)
3227
3248
3228 if finishdesc:
3249 if finishdesc:
3229 text = finishdesc(text)
3250 text = finishdesc(text)
3230 if not text.strip():
3251 if not text.strip():
3231 raise error.Abort(_("empty commit message"))
3252 raise error.Abort(_("empty commit message"))
3232 if unchangedmessagedetection and editortext == templatetext:
3253 if unchangedmessagedetection and editortext == templatetext:
3233 raise error.Abort(_("commit message unchanged"))
3254 raise error.Abort(_("commit message unchanged"))
3234
3255
3235 return text
3256 return text
3236
3257
3237 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3258 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
3238 ui = repo.ui
3259 ui = repo.ui
3239 spec = formatter.templatespec(ref, None, None)
3260 spec = formatter.templatespec(ref, None, None)
3240 t = changeset_templater(ui, repo, spec, None, {}, False)
3261 t = changeset_templater(ui, repo, spec, None, {}, False)
3241 t.t.cache.update((k, templater.unquotestring(v))
3262 t.t.cache.update((k, templater.unquotestring(v))
3242 for k, v in repo.ui.configitems('committemplate'))
3263 for k, v in repo.ui.configitems('committemplate'))
3243
3264
3244 if not extramsg:
3265 if not extramsg:
3245 extramsg = '' # ensure that extramsg is string
3266 extramsg = '' # ensure that extramsg is string
3246
3267
3247 ui.pushbuffer()
3268 ui.pushbuffer()
3248 t.show(ctx, extramsg=extramsg)
3269 t.show(ctx, extramsg=extramsg)
3249 return ui.popbuffer()
3270 return ui.popbuffer()
3250
3271
3251 def hgprefix(msg):
3272 def hgprefix(msg):
3252 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3273 return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
3253
3274
3254 def buildcommittext(repo, ctx, subs, extramsg):
3275 def buildcommittext(repo, ctx, subs, extramsg):
3255 edittext = []
3276 edittext = []
3256 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3277 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
3257 if ctx.description():
3278 if ctx.description():
3258 edittext.append(ctx.description())
3279 edittext.append(ctx.description())
3259 edittext.append("")
3280 edittext.append("")
3260 edittext.append("") # Empty line between message and comments.
3281 edittext.append("") # Empty line between message and comments.
3261 edittext.append(hgprefix(_("Enter commit message."
3282 edittext.append(hgprefix(_("Enter commit message."
3262 " Lines beginning with 'HG:' are removed.")))
3283 " Lines beginning with 'HG:' are removed.")))
3263 edittext.append(hgprefix(extramsg))
3284 edittext.append(hgprefix(extramsg))
3264 edittext.append("HG: --")
3285 edittext.append("HG: --")
3265 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3286 edittext.append(hgprefix(_("user: %s") % ctx.user()))
3266 if ctx.p2():
3287 if ctx.p2():
3267 edittext.append(hgprefix(_("branch merge")))
3288 edittext.append(hgprefix(_("branch merge")))
3268 if ctx.branch():
3289 if ctx.branch():
3269 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3290 edittext.append(hgprefix(_("branch '%s'") % ctx.branch()))
3270 if bookmarks.isactivewdirparent(repo):
3291 if bookmarks.isactivewdirparent(repo):
3271 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3292 edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark))
3272 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3293 edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs])
3273 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3294 edittext.extend([hgprefix(_("added %s") % f) for f in added])
3274 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3295 edittext.extend([hgprefix(_("changed %s") % f) for f in modified])
3275 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3296 edittext.extend([hgprefix(_("removed %s") % f) for f in removed])
3276 if not added and not modified and not removed:
3297 if not added and not modified and not removed:
3277 edittext.append(hgprefix(_("no files changed")))
3298 edittext.append(hgprefix(_("no files changed")))
3278 edittext.append("")
3299 edittext.append("")
3279
3300
3280 return "\n".join(edittext)
3301 return "\n".join(edittext)
3281
3302
3282 def commitstatus(repo, node, branch, bheads=None, opts=None):
3303 def commitstatus(repo, node, branch, bheads=None, opts=None):
3283 if opts is None:
3304 if opts is None:
3284 opts = {}
3305 opts = {}
3285 ctx = repo[node]
3306 ctx = repo[node]
3286 parents = ctx.parents()
3307 parents = ctx.parents()
3287
3308
3288 if (not opts.get('amend') and bheads and node not in bheads and not
3309 if (not opts.get('amend') and bheads and node not in bheads and not
3289 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3310 [x for x in parents if x.node() in bheads and x.branch() == branch]):
3290 repo.ui.status(_('created new head\n'))
3311 repo.ui.status(_('created new head\n'))
3291 # The message is not printed for initial roots. For the other
3312 # The message is not printed for initial roots. For the other
3292 # changesets, it is printed in the following situations:
3313 # changesets, it is printed in the following situations:
3293 #
3314 #
3294 # Par column: for the 2 parents with ...
3315 # Par column: for the 2 parents with ...
3295 # N: null or no parent
3316 # N: null or no parent
3296 # B: parent is on another named branch
3317 # B: parent is on another named branch
3297 # C: parent is a regular non head changeset
3318 # C: parent is a regular non head changeset
3298 # H: parent was a branch head of the current branch
3319 # H: parent was a branch head of the current branch
3299 # Msg column: whether we print "created new head" message
3320 # Msg column: whether we print "created new head" message
3300 # In the following, it is assumed that there already exists some
3321 # In the following, it is assumed that there already exists some
3301 # initial branch heads of the current branch, otherwise nothing is
3322 # initial branch heads of the current branch, otherwise nothing is
3302 # printed anyway.
3323 # printed anyway.
3303 #
3324 #
3304 # Par Msg Comment
3325 # Par Msg Comment
3305 # N N y additional topo root
3326 # N N y additional topo root
3306 #
3327 #
3307 # B N y additional branch root
3328 # B N y additional branch root
3308 # C N y additional topo head
3329 # C N y additional topo head
3309 # H N n usual case
3330 # H N n usual case
3310 #
3331 #
3311 # B B y weird additional branch root
3332 # B B y weird additional branch root
3312 # C B y branch merge
3333 # C B y branch merge
3313 # H B n merge with named branch
3334 # H B n merge with named branch
3314 #
3335 #
3315 # C C y additional head from merge
3336 # C C y additional head from merge
3316 # C H n merge with a head
3337 # C H n merge with a head
3317 #
3338 #
3318 # H H n head merge: head count decreases
3339 # H H n head merge: head count decreases
3319
3340
3320 if not opts.get('close_branch'):
3341 if not opts.get('close_branch'):
3321 for r in parents:
3342 for r in parents:
3322 if r.closesbranch() and r.branch() == branch:
3343 if r.closesbranch() and r.branch() == branch:
3323 repo.ui.status(_('reopening closed branch head %d\n') % r)
3344 repo.ui.status(_('reopening closed branch head %d\n') % r)
3324
3345
3325 if repo.ui.debugflag:
3346 if repo.ui.debugflag:
3326 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3347 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
3327 elif repo.ui.verbose:
3348 elif repo.ui.verbose:
3328 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3349 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
3329
3350
3330 def postcommitstatus(repo, pats, opts):
3351 def postcommitstatus(repo, pats, opts):
3331 return repo.status(match=scmutil.match(repo[None], pats, opts))
3352 return repo.status(match=scmutil.match(repo[None], pats, opts))
3332
3353
3333 def revert(ui, repo, ctx, parents, *pats, **opts):
3354 def revert(ui, repo, ctx, parents, *pats, **opts):
3334 parent, p2 = parents
3355 parent, p2 = parents
3335 node = ctx.node()
3356 node = ctx.node()
3336
3357
3337 mf = ctx.manifest()
3358 mf = ctx.manifest()
3338 if node == p2:
3359 if node == p2:
3339 parent = p2
3360 parent = p2
3340
3361
3341 # need all matching names in dirstate and manifest of target rev,
3362 # need all matching names in dirstate and manifest of target rev,
3342 # so have to walk both. do not print errors if files exist in one
3363 # so have to walk both. do not print errors if files exist in one
3343 # but not other. in both cases, filesets should be evaluated against
3364 # but not other. in both cases, filesets should be evaluated against
3344 # workingctx to get consistent result (issue4497). this means 'set:**'
3365 # workingctx to get consistent result (issue4497). this means 'set:**'
3345 # cannot be used to select missing files from target rev.
3366 # cannot be used to select missing files from target rev.
3346
3367
3347 # `names` is a mapping for all elements in working copy and target revision
3368 # `names` is a mapping for all elements in working copy and target revision
3348 # The mapping is in the form:
3369 # The mapping is in the form:
3349 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3370 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
3350 names = {}
3371 names = {}
3351
3372
3352 with repo.wlock():
3373 with repo.wlock():
3353 ## filling of the `names` mapping
3374 ## filling of the `names` mapping
3354 # walk dirstate to fill `names`
3375 # walk dirstate to fill `names`
3355
3376
3356 interactive = opts.get('interactive', False)
3377 interactive = opts.get('interactive', False)
3357 wctx = repo[None]
3378 wctx = repo[None]
3358 m = scmutil.match(wctx, pats, opts)
3379 m = scmutil.match(wctx, pats, opts)
3359
3380
3360 # we'll need this later
3381 # we'll need this later
3361 targetsubs = sorted(s for s in wctx.substate if m(s))
3382 targetsubs = sorted(s for s in wctx.substate if m(s))
3362
3383
3363 if not m.always():
3384 if not m.always():
3364 matcher = matchmod.badmatch(m, lambda x, y: False)
3385 matcher = matchmod.badmatch(m, lambda x, y: False)
3365 for abs in wctx.walk(matcher):
3386 for abs in wctx.walk(matcher):
3366 names[abs] = m.rel(abs), m.exact(abs)
3387 names[abs] = m.rel(abs), m.exact(abs)
3367
3388
3368 # walk target manifest to fill `names`
3389 # walk target manifest to fill `names`
3369
3390
3370 def badfn(path, msg):
3391 def badfn(path, msg):
3371 if path in names:
3392 if path in names:
3372 return
3393 return
3373 if path in ctx.substate:
3394 if path in ctx.substate:
3374 return
3395 return
3375 path_ = path + '/'
3396 path_ = path + '/'
3376 for f in names:
3397 for f in names:
3377 if f.startswith(path_):
3398 if f.startswith(path_):
3378 return
3399 return
3379 ui.warn("%s: %s\n" % (m.rel(path), msg))
3400 ui.warn("%s: %s\n" % (m.rel(path), msg))
3380
3401
3381 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3402 for abs in ctx.walk(matchmod.badmatch(m, badfn)):
3382 if abs not in names:
3403 if abs not in names:
3383 names[abs] = m.rel(abs), m.exact(abs)
3404 names[abs] = m.rel(abs), m.exact(abs)
3384
3405
3385 # Find status of all file in `names`.
3406 # Find status of all file in `names`.
3386 m = scmutil.matchfiles(repo, names)
3407 m = scmutil.matchfiles(repo, names)
3387
3408
3388 changes = repo.status(node1=node, match=m,
3409 changes = repo.status(node1=node, match=m,
3389 unknown=True, ignored=True, clean=True)
3410 unknown=True, ignored=True, clean=True)
3390 else:
3411 else:
3391 changes = repo.status(node1=node, match=m)
3412 changes = repo.status(node1=node, match=m)
3392 for kind in changes:
3413 for kind in changes:
3393 for abs in kind:
3414 for abs in kind:
3394 names[abs] = m.rel(abs), m.exact(abs)
3415 names[abs] = m.rel(abs), m.exact(abs)
3395
3416
3396 m = scmutil.matchfiles(repo, names)
3417 m = scmutil.matchfiles(repo, names)
3397
3418
3398 modified = set(changes.modified)
3419 modified = set(changes.modified)
3399 added = set(changes.added)
3420 added = set(changes.added)
3400 removed = set(changes.removed)
3421 removed = set(changes.removed)
3401 _deleted = set(changes.deleted)
3422 _deleted = set(changes.deleted)
3402 unknown = set(changes.unknown)
3423 unknown = set(changes.unknown)
3403 unknown.update(changes.ignored)
3424 unknown.update(changes.ignored)
3404 clean = set(changes.clean)
3425 clean = set(changes.clean)
3405 modadded = set()
3426 modadded = set()
3406
3427
3407 # We need to account for the state of the file in the dirstate,
3428 # We need to account for the state of the file in the dirstate,
3408 # even when we revert against something else than parent. This will
3429 # even when we revert against something else than parent. This will
3409 # slightly alter the behavior of revert (doing back up or not, delete
3430 # slightly alter the behavior of revert (doing back up or not, delete
3410 # or just forget etc).
3431 # or just forget etc).
3411 if parent == node:
3432 if parent == node:
3412 dsmodified = modified
3433 dsmodified = modified
3413 dsadded = added
3434 dsadded = added
3414 dsremoved = removed
3435 dsremoved = removed
3415 # store all local modifications, useful later for rename detection
3436 # store all local modifications, useful later for rename detection
3416 localchanges = dsmodified | dsadded
3437 localchanges = dsmodified | dsadded
3417 modified, added, removed = set(), set(), set()
3438 modified, added, removed = set(), set(), set()
3418 else:
3439 else:
3419 changes = repo.status(node1=parent, match=m)
3440 changes = repo.status(node1=parent, match=m)
3420 dsmodified = set(changes.modified)
3441 dsmodified = set(changes.modified)
3421 dsadded = set(changes.added)
3442 dsadded = set(changes.added)
3422 dsremoved = set(changes.removed)
3443 dsremoved = set(changes.removed)
3423 # store all local modifications, useful later for rename detection
3444 # store all local modifications, useful later for rename detection
3424 localchanges = dsmodified | dsadded
3445 localchanges = dsmodified | dsadded
3425
3446
3426 # only take into account for removes between wc and target
3447 # only take into account for removes between wc and target
3427 clean |= dsremoved - removed
3448 clean |= dsremoved - removed
3428 dsremoved &= removed
3449 dsremoved &= removed
3429 # distinct between dirstate remove and other
3450 # distinct between dirstate remove and other
3430 removed -= dsremoved
3451 removed -= dsremoved
3431
3452
3432 modadded = added & dsmodified
3453 modadded = added & dsmodified
3433 added -= modadded
3454 added -= modadded
3434
3455
3435 # tell newly modified apart.
3456 # tell newly modified apart.
3436 dsmodified &= modified
3457 dsmodified &= modified
3437 dsmodified |= modified & dsadded # dirstate added may need backup
3458 dsmodified |= modified & dsadded # dirstate added may need backup
3438 modified -= dsmodified
3459 modified -= dsmodified
3439
3460
3440 # We need to wait for some post-processing to update this set
3461 # We need to wait for some post-processing to update this set
3441 # before making the distinction. The dirstate will be used for
3462 # before making the distinction. The dirstate will be used for
3442 # that purpose.
3463 # that purpose.
3443 dsadded = added
3464 dsadded = added
3444
3465
3445 # in case of merge, files that are actually added can be reported as
3466 # in case of merge, files that are actually added can be reported as
3446 # modified, we need to post process the result
3467 # modified, we need to post process the result
3447 if p2 != nullid:
3468 if p2 != nullid:
3448 mergeadd = set(dsmodified)
3469 mergeadd = set(dsmodified)
3449 for path in dsmodified:
3470 for path in dsmodified:
3450 if path in mf:
3471 if path in mf:
3451 mergeadd.remove(path)
3472 mergeadd.remove(path)
3452 dsadded |= mergeadd
3473 dsadded |= mergeadd
3453 dsmodified -= mergeadd
3474 dsmodified -= mergeadd
3454
3475
3455 # if f is a rename, update `names` to also revert the source
3476 # if f is a rename, update `names` to also revert the source
3456 cwd = repo.getcwd()
3477 cwd = repo.getcwd()
3457 for f in localchanges:
3478 for f in localchanges:
3458 src = repo.dirstate.copied(f)
3479 src = repo.dirstate.copied(f)
3459 # XXX should we check for rename down to target node?
3480 # XXX should we check for rename down to target node?
3460 if src and src not in names and repo.dirstate[src] == 'r':
3481 if src and src not in names and repo.dirstate[src] == 'r':
3461 dsremoved.add(src)
3482 dsremoved.add(src)
3462 names[src] = (repo.pathto(src, cwd), True)
3483 names[src] = (repo.pathto(src, cwd), True)
3463
3484
3464 # determine the exact nature of the deleted changesets
3485 # determine the exact nature of the deleted changesets
3465 deladded = set(_deleted)
3486 deladded = set(_deleted)
3466 for path in _deleted:
3487 for path in _deleted:
3467 if path in mf:
3488 if path in mf:
3468 deladded.remove(path)
3489 deladded.remove(path)
3469 deleted = _deleted - deladded
3490 deleted = _deleted - deladded
3470
3491
3471 # distinguish between file to forget and the other
3492 # distinguish between file to forget and the other
3472 added = set()
3493 added = set()
3473 for abs in dsadded:
3494 for abs in dsadded:
3474 if repo.dirstate[abs] != 'a':
3495 if repo.dirstate[abs] != 'a':
3475 added.add(abs)
3496 added.add(abs)
3476 dsadded -= added
3497 dsadded -= added
3477
3498
3478 for abs in deladded:
3499 for abs in deladded:
3479 if repo.dirstate[abs] == 'a':
3500 if repo.dirstate[abs] == 'a':
3480 dsadded.add(abs)
3501 dsadded.add(abs)
3481 deladded -= dsadded
3502 deladded -= dsadded
3482
3503
3483 # For files marked as removed, we check if an unknown file is present at
3504 # For files marked as removed, we check if an unknown file is present at
3484 # the same path. If a such file exists it may need to be backed up.
3505 # the same path. If a such file exists it may need to be backed up.
3485 # Making the distinction at this stage helps have simpler backup
3506 # Making the distinction at this stage helps have simpler backup
3486 # logic.
3507 # logic.
3487 removunk = set()
3508 removunk = set()
3488 for abs in removed:
3509 for abs in removed:
3489 target = repo.wjoin(abs)
3510 target = repo.wjoin(abs)
3490 if os.path.lexists(target):
3511 if os.path.lexists(target):
3491 removunk.add(abs)
3512 removunk.add(abs)
3492 removed -= removunk
3513 removed -= removunk
3493
3514
3494 dsremovunk = set()
3515 dsremovunk = set()
3495 for abs in dsremoved:
3516 for abs in dsremoved:
3496 target = repo.wjoin(abs)
3517 target = repo.wjoin(abs)
3497 if os.path.lexists(target):
3518 if os.path.lexists(target):
3498 dsremovunk.add(abs)
3519 dsremovunk.add(abs)
3499 dsremoved -= dsremovunk
3520 dsremoved -= dsremovunk
3500
3521
3501 # action to be actually performed by revert
3522 # action to be actually performed by revert
3502 # (<list of file>, message>) tuple
3523 # (<list of file>, message>) tuple
3503 actions = {'revert': ([], _('reverting %s\n')),
3524 actions = {'revert': ([], _('reverting %s\n')),
3504 'add': ([], _('adding %s\n')),
3525 'add': ([], _('adding %s\n')),
3505 'remove': ([], _('removing %s\n')),
3526 'remove': ([], _('removing %s\n')),
3506 'drop': ([], _('removing %s\n')),
3527 'drop': ([], _('removing %s\n')),
3507 'forget': ([], _('forgetting %s\n')),
3528 'forget': ([], _('forgetting %s\n')),
3508 'undelete': ([], _('undeleting %s\n')),
3529 'undelete': ([], _('undeleting %s\n')),
3509 'noop': (None, _('no changes needed to %s\n')),
3530 'noop': (None, _('no changes needed to %s\n')),
3510 'unknown': (None, _('file not managed: %s\n')),
3531 'unknown': (None, _('file not managed: %s\n')),
3511 }
3532 }
3512
3533
3513 # "constant" that convey the backup strategy.
3534 # "constant" that convey the backup strategy.
3514 # All set to `discard` if `no-backup` is set do avoid checking
3535 # All set to `discard` if `no-backup` is set do avoid checking
3515 # no_backup lower in the code.
3536 # no_backup lower in the code.
3516 # These values are ordered for comparison purposes
3537 # These values are ordered for comparison purposes
3517 backupinteractive = 3 # do backup if interactively modified
3538 backupinteractive = 3 # do backup if interactively modified
3518 backup = 2 # unconditionally do backup
3539 backup = 2 # unconditionally do backup
3519 check = 1 # check if the existing file differs from target
3540 check = 1 # check if the existing file differs from target
3520 discard = 0 # never do backup
3541 discard = 0 # never do backup
3521 if opts.get('no_backup'):
3542 if opts.get('no_backup'):
3522 backupinteractive = backup = check = discard
3543 backupinteractive = backup = check = discard
3523 if interactive:
3544 if interactive:
3524 dsmodifiedbackup = backupinteractive
3545 dsmodifiedbackup = backupinteractive
3525 else:
3546 else:
3526 dsmodifiedbackup = backup
3547 dsmodifiedbackup = backup
3527 tobackup = set()
3548 tobackup = set()
3528
3549
3529 backupanddel = actions['remove']
3550 backupanddel = actions['remove']
3530 if not opts.get('no_backup'):
3551 if not opts.get('no_backup'):
3531 backupanddel = actions['drop']
3552 backupanddel = actions['drop']
3532
3553
3533 disptable = (
3554 disptable = (
3534 # dispatch table:
3555 # dispatch table:
3535 # file state
3556 # file state
3536 # action
3557 # action
3537 # make backup
3558 # make backup
3538
3559
3539 ## Sets that results that will change file on disk
3560 ## Sets that results that will change file on disk
3540 # Modified compared to target, no local change
3561 # Modified compared to target, no local change
3541 (modified, actions['revert'], discard),
3562 (modified, actions['revert'], discard),
3542 # Modified compared to target, but local file is deleted
3563 # Modified compared to target, but local file is deleted
3543 (deleted, actions['revert'], discard),
3564 (deleted, actions['revert'], discard),
3544 # Modified compared to target, local change
3565 # Modified compared to target, local change
3545 (dsmodified, actions['revert'], dsmodifiedbackup),
3566 (dsmodified, actions['revert'], dsmodifiedbackup),
3546 # Added since target
3567 # Added since target
3547 (added, actions['remove'], discard),
3568 (added, actions['remove'], discard),
3548 # Added in working directory
3569 # Added in working directory
3549 (dsadded, actions['forget'], discard),
3570 (dsadded, actions['forget'], discard),
3550 # Added since target, have local modification
3571 # Added since target, have local modification
3551 (modadded, backupanddel, backup),
3572 (modadded, backupanddel, backup),
3552 # Added since target but file is missing in working directory
3573 # Added since target but file is missing in working directory
3553 (deladded, actions['drop'], discard),
3574 (deladded, actions['drop'], discard),
3554 # Removed since target, before working copy parent
3575 # Removed since target, before working copy parent
3555 (removed, actions['add'], discard),
3576 (removed, actions['add'], discard),
3556 # Same as `removed` but an unknown file exists at the same path
3577 # Same as `removed` but an unknown file exists at the same path
3557 (removunk, actions['add'], check),
3578 (removunk, actions['add'], check),
3558 # Removed since targe, marked as such in working copy parent
3579 # Removed since targe, marked as such in working copy parent
3559 (dsremoved, actions['undelete'], discard),
3580 (dsremoved, actions['undelete'], discard),
3560 # Same as `dsremoved` but an unknown file exists at the same path
3581 # Same as `dsremoved` but an unknown file exists at the same path
3561 (dsremovunk, actions['undelete'], check),
3582 (dsremovunk, actions['undelete'], check),
3562 ## the following sets does not result in any file changes
3583 ## the following sets does not result in any file changes
3563 # File with no modification
3584 # File with no modification
3564 (clean, actions['noop'], discard),
3585 (clean, actions['noop'], discard),
3565 # Existing file, not tracked anywhere
3586 # Existing file, not tracked anywhere
3566 (unknown, actions['unknown'], discard),
3587 (unknown, actions['unknown'], discard),
3567 )
3588 )
3568
3589
3569 for abs, (rel, exact) in sorted(names.items()):
3590 for abs, (rel, exact) in sorted(names.items()):
3570 # target file to be touch on disk (relative to cwd)
3591 # target file to be touch on disk (relative to cwd)
3571 target = repo.wjoin(abs)
3592 target = repo.wjoin(abs)
3572 # search the entry in the dispatch table.
3593 # search the entry in the dispatch table.
3573 # if the file is in any of these sets, it was touched in the working
3594 # if the file is in any of these sets, it was touched in the working
3574 # directory parent and we are sure it needs to be reverted.
3595 # directory parent and we are sure it needs to be reverted.
3575 for table, (xlist, msg), dobackup in disptable:
3596 for table, (xlist, msg), dobackup in disptable:
3576 if abs not in table:
3597 if abs not in table:
3577 continue
3598 continue
3578 if xlist is not None:
3599 if xlist is not None:
3579 xlist.append(abs)
3600 xlist.append(abs)
3580 if dobackup:
3601 if dobackup:
3581 # If in interactive mode, don't automatically create
3602 # If in interactive mode, don't automatically create
3582 # .orig files (issue4793)
3603 # .orig files (issue4793)
3583 if dobackup == backupinteractive:
3604 if dobackup == backupinteractive:
3584 tobackup.add(abs)
3605 tobackup.add(abs)
3585 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3606 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3586 bakname = scmutil.origpath(ui, repo, rel)
3607 bakname = scmutil.origpath(ui, repo, rel)
3587 ui.note(_('saving current version of %s as %s\n') %
3608 ui.note(_('saving current version of %s as %s\n') %
3588 (rel, bakname))
3609 (rel, bakname))
3589 if not opts.get('dry_run'):
3610 if not opts.get('dry_run'):
3590 if interactive:
3611 if interactive:
3591 util.copyfile(target, bakname)
3612 util.copyfile(target, bakname)
3592 else:
3613 else:
3593 util.rename(target, bakname)
3614 util.rename(target, bakname)
3594 if ui.verbose or not exact:
3615 if ui.verbose or not exact:
3595 if not isinstance(msg, basestring):
3616 if not isinstance(msg, basestring):
3596 msg = msg(abs)
3617 msg = msg(abs)
3597 ui.status(msg % rel)
3618 ui.status(msg % rel)
3598 elif exact:
3619 elif exact:
3599 ui.warn(msg % rel)
3620 ui.warn(msg % rel)
3600 break
3621 break
3601
3622
3602 if not opts.get('dry_run'):
3623 if not opts.get('dry_run'):
3603 needdata = ('revert', 'add', 'undelete')
3624 needdata = ('revert', 'add', 'undelete')
3604 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3625 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3605 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3626 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
3606
3627
3607 if targetsubs:
3628 if targetsubs:
3608 # Revert the subrepos on the revert list
3629 # Revert the subrepos on the revert list
3609 for sub in targetsubs:
3630 for sub in targetsubs:
3610 try:
3631 try:
3611 wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
3632 wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
3612 except KeyError:
3633 except KeyError:
3613 raise error.Abort("subrepository '%s' does not exist in %s!"
3634 raise error.Abort("subrepository '%s' does not exist in %s!"
3614 % (sub, short(ctx.node())))
3635 % (sub, short(ctx.node())))
3615
3636
3616 def _revertprefetch(repo, ctx, *files):
3637 def _revertprefetch(repo, ctx, *files):
3617 """Let extension changing the storage layer prefetch content"""
3638 """Let extension changing the storage layer prefetch content"""
3618 pass
3639 pass
3619
3640
3620 def _performrevert(repo, parents, ctx, actions, interactive=False,
3641 def _performrevert(repo, parents, ctx, actions, interactive=False,
3621 tobackup=None):
3642 tobackup=None):
3622 """function that actually perform all the actions computed for revert
3643 """function that actually perform all the actions computed for revert
3623
3644
3624 This is an independent function to let extension to plug in and react to
3645 This is an independent function to let extension to plug in and react to
3625 the imminent revert.
3646 the imminent revert.
3626
3647
3627 Make sure you have the working directory locked when calling this function.
3648 Make sure you have the working directory locked when calling this function.
3628 """
3649 """
3629 parent, p2 = parents
3650 parent, p2 = parents
3630 node = ctx.node()
3651 node = ctx.node()
3631 excluded_files = []
3652 excluded_files = []
3632 matcher_opts = {"exclude": excluded_files}
3653 matcher_opts = {"exclude": excluded_files}
3633
3654
3634 def checkout(f):
3655 def checkout(f):
3635 fc = ctx[f]
3656 fc = ctx[f]
3636 repo.wwrite(f, fc.data(), fc.flags())
3657 repo.wwrite(f, fc.data(), fc.flags())
3637
3658
3638 def doremove(f):
3659 def doremove(f):
3639 try:
3660 try:
3640 repo.wvfs.unlinkpath(f)
3661 repo.wvfs.unlinkpath(f)
3641 except OSError:
3662 except OSError:
3642 pass
3663 pass
3643 repo.dirstate.remove(f)
3664 repo.dirstate.remove(f)
3644
3665
3645 audit_path = pathutil.pathauditor(repo.root, cached=True)
3666 audit_path = pathutil.pathauditor(repo.root, cached=True)
3646 for f in actions['forget'][0]:
3667 for f in actions['forget'][0]:
3647 if interactive:
3668 if interactive:
3648 choice = repo.ui.promptchoice(
3669 choice = repo.ui.promptchoice(
3649 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3670 _("forget added file %s (Yn)?$$ &Yes $$ &No") % f)
3650 if choice == 0:
3671 if choice == 0:
3651 repo.dirstate.drop(f)
3672 repo.dirstate.drop(f)
3652 else:
3673 else:
3653 excluded_files.append(repo.wjoin(f))
3674 excluded_files.append(repo.wjoin(f))
3654 else:
3675 else:
3655 repo.dirstate.drop(f)
3676 repo.dirstate.drop(f)
3656 for f in actions['remove'][0]:
3677 for f in actions['remove'][0]:
3657 audit_path(f)
3678 audit_path(f)
3658 if interactive:
3679 if interactive:
3659 choice = repo.ui.promptchoice(
3680 choice = repo.ui.promptchoice(
3660 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3681 _("remove added file %s (Yn)?$$ &Yes $$ &No") % f)
3661 if choice == 0:
3682 if choice == 0:
3662 doremove(f)
3683 doremove(f)
3663 else:
3684 else:
3664 excluded_files.append(repo.wjoin(f))
3685 excluded_files.append(repo.wjoin(f))
3665 else:
3686 else:
3666 doremove(f)
3687 doremove(f)
3667 for f in actions['drop'][0]:
3688 for f in actions['drop'][0]:
3668 audit_path(f)
3689 audit_path(f)
3669 repo.dirstate.remove(f)
3690 repo.dirstate.remove(f)
3670
3691
3671 normal = None
3692 normal = None
3672 if node == parent:
3693 if node == parent:
3673 # We're reverting to our parent. If possible, we'd like status
3694 # We're reverting to our parent. If possible, we'd like status
3674 # to report the file as clean. We have to use normallookup for
3695 # to report the file as clean. We have to use normallookup for
3675 # merges to avoid losing information about merged/dirty files.
3696 # merges to avoid losing information about merged/dirty files.
3676 if p2 != nullid:
3697 if p2 != nullid:
3677 normal = repo.dirstate.normallookup
3698 normal = repo.dirstate.normallookup
3678 else:
3699 else:
3679 normal = repo.dirstate.normal
3700 normal = repo.dirstate.normal
3680
3701
3681 newlyaddedandmodifiedfiles = set()
3702 newlyaddedandmodifiedfiles = set()
3682 if interactive:
3703 if interactive:
3683 # Prompt the user for changes to revert
3704 # Prompt the user for changes to revert
3684 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3705 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3685 m = scmutil.match(ctx, torevert, matcher_opts)
3706 m = scmutil.match(ctx, torevert, matcher_opts)
3686 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3707 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3687 diffopts.nodates = True
3708 diffopts.nodates = True
3688 diffopts.git = True
3709 diffopts.git = True
3689 operation = 'discard'
3710 operation = 'discard'
3690 reversehunks = True
3711 reversehunks = True
3691 if node != parent:
3712 if node != parent:
3692 operation = 'revert'
3713 operation = 'revert'
3693 reversehunks = repo.ui.configbool('experimental',
3714 reversehunks = repo.ui.configbool('experimental',
3694 'revertalternateinteractivemode')
3715 'revertalternateinteractivemode')
3695 if reversehunks:
3716 if reversehunks:
3696 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3717 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3697 else:
3718 else:
3698 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3719 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3699 originalchunks = patch.parsepatch(diff)
3720 originalchunks = patch.parsepatch(diff)
3700
3721
3701 try:
3722 try:
3702
3723
3703 chunks, opts = recordfilter(repo.ui, originalchunks,
3724 chunks, opts = recordfilter(repo.ui, originalchunks,
3704 operation=operation)
3725 operation=operation)
3705 if reversehunks:
3726 if reversehunks:
3706 chunks = patch.reversehunks(chunks)
3727 chunks = patch.reversehunks(chunks)
3707
3728
3708 except patch.PatchError as err:
3729 except patch.PatchError as err:
3709 raise error.Abort(_('error parsing patch: %s') % err)
3730 raise error.Abort(_('error parsing patch: %s') % err)
3710
3731
3711 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3732 newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks)
3712 if tobackup is None:
3733 if tobackup is None:
3713 tobackup = set()
3734 tobackup = set()
3714 # Apply changes
3735 # Apply changes
3715 fp = stringio()
3736 fp = stringio()
3716 for c in chunks:
3737 for c in chunks:
3717 # Create a backup file only if this hunk should be backed up
3738 # Create a backup file only if this hunk should be backed up
3718 if ishunk(c) and c.header.filename() in tobackup:
3739 if ishunk(c) and c.header.filename() in tobackup:
3719 abs = c.header.filename()
3740 abs = c.header.filename()
3720 target = repo.wjoin(abs)
3741 target = repo.wjoin(abs)
3721 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3742 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs))
3722 util.copyfile(target, bakname)
3743 util.copyfile(target, bakname)
3723 tobackup.remove(abs)
3744 tobackup.remove(abs)
3724 c.write(fp)
3745 c.write(fp)
3725 dopatch = fp.tell()
3746 dopatch = fp.tell()
3726 fp.seek(0)
3747 fp.seek(0)
3727 if dopatch:
3748 if dopatch:
3728 try:
3749 try:
3729 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3750 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
3730 except patch.PatchError as err:
3751 except patch.PatchError as err:
3731 raise error.Abort(str(err))
3752 raise error.Abort(str(err))
3732 del fp
3753 del fp
3733 else:
3754 else:
3734 for f in actions['revert'][0]:
3755 for f in actions['revert'][0]:
3735 checkout(f)
3756 checkout(f)
3736 if normal:
3757 if normal:
3737 normal(f)
3758 normal(f)
3738
3759
3739 for f in actions['add'][0]:
3760 for f in actions['add'][0]:
3740 # Don't checkout modified files, they are already created by the diff
3761 # Don't checkout modified files, they are already created by the diff
3741 if f not in newlyaddedandmodifiedfiles:
3762 if f not in newlyaddedandmodifiedfiles:
3742 checkout(f)
3763 checkout(f)
3743 repo.dirstate.add(f)
3764 repo.dirstate.add(f)
3744
3765
3745 normal = repo.dirstate.normallookup
3766 normal = repo.dirstate.normallookup
3746 if node == parent and p2 == nullid:
3767 if node == parent and p2 == nullid:
3747 normal = repo.dirstate.normal
3768 normal = repo.dirstate.normal
3748 for f in actions['undelete'][0]:
3769 for f in actions['undelete'][0]:
3749 checkout(f)
3770 checkout(f)
3750 normal(f)
3771 normal(f)
3751
3772
3752 copied = copies.pathcopies(repo[parent], ctx)
3773 copied = copies.pathcopies(repo[parent], ctx)
3753
3774
3754 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3775 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
3755 if f in copied:
3776 if f in copied:
3756 repo.dirstate.copy(copied[f], f)
3777 repo.dirstate.copy(copied[f], f)
3757
3778
3758 class command(registrar.command):
3779 class command(registrar.command):
3759 def _doregister(self, func, name, *args, **kwargs):
3780 def _doregister(self, func, name, *args, **kwargs):
3760 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3781 func._deprecatedregistrar = True # flag for deprecwarn in extensions.py
3761 return super(command, self)._doregister(func, name, *args, **kwargs)
3782 return super(command, self)._doregister(func, name, *args, **kwargs)
3762
3783
3763 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3784 # a list of (ui, repo, otherpeer, opts, missing) functions called by
3764 # commands.outgoing. "missing" is "missing" of the result of
3785 # commands.outgoing. "missing" is "missing" of the result of
3765 # "findcommonoutgoing()"
3786 # "findcommonoutgoing()"
3766 outgoinghooks = util.hooks()
3787 outgoinghooks = util.hooks()
3767
3788
3768 # a list of (ui, repo) functions called by commands.summary
3789 # a list of (ui, repo) functions called by commands.summary
3769 summaryhooks = util.hooks()
3790 summaryhooks = util.hooks()
3770
3791
3771 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3792 # a list of (ui, repo, opts, changes) functions called by commands.summary.
3772 #
3793 #
3773 # functions should return tuple of booleans below, if 'changes' is None:
3794 # functions should return tuple of booleans below, if 'changes' is None:
3774 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3795 # (whether-incomings-are-needed, whether-outgoings-are-needed)
3775 #
3796 #
3776 # otherwise, 'changes' is a tuple of tuples below:
3797 # otherwise, 'changes' is a tuple of tuples below:
3777 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3798 # - (sourceurl, sourcebranch, sourcepeer, incoming)
3778 # - (desturl, destbranch, destpeer, outgoing)
3799 # - (desturl, destbranch, destpeer, outgoing)
3779 summaryremotehooks = util.hooks()
3800 summaryremotehooks = util.hooks()
3780
3801
3781 # A list of state files kept by multistep operations like graft.
3802 # A list of state files kept by multistep operations like graft.
3782 # Since graft cannot be aborted, it is considered 'clearable' by update.
3803 # Since graft cannot be aborted, it is considered 'clearable' by update.
3783 # note: bisect is intentionally excluded
3804 # note: bisect is intentionally excluded
3784 # (state file, clearable, allowcommit, error, hint)
3805 # (state file, clearable, allowcommit, error, hint)
3785 unfinishedstates = [
3806 unfinishedstates = [
3786 ('graftstate', True, False, _('graft in progress'),
3807 ('graftstate', True, False, _('graft in progress'),
3787 _("use 'hg graft --continue' or 'hg update' to abort")),
3808 _("use 'hg graft --continue' or 'hg update' to abort")),
3788 ('updatestate', True, False, _('last update was interrupted'),
3809 ('updatestate', True, False, _('last update was interrupted'),
3789 _("use 'hg update' to get a consistent checkout"))
3810 _("use 'hg update' to get a consistent checkout"))
3790 ]
3811 ]
3791
3812
3792 def checkunfinished(repo, commit=False):
3813 def checkunfinished(repo, commit=False):
3793 '''Look for an unfinished multistep operation, like graft, and abort
3814 '''Look for an unfinished multistep operation, like graft, and abort
3794 if found. It's probably good to check this right before
3815 if found. It's probably good to check this right before
3795 bailifchanged().
3816 bailifchanged().
3796 '''
3817 '''
3797 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3818 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3798 if commit and allowcommit:
3819 if commit and allowcommit:
3799 continue
3820 continue
3800 if repo.vfs.exists(f):
3821 if repo.vfs.exists(f):
3801 raise error.Abort(msg, hint=hint)
3822 raise error.Abort(msg, hint=hint)
3802
3823
3803 def clearunfinished(repo):
3824 def clearunfinished(repo):
3804 '''Check for unfinished operations (as above), and clear the ones
3825 '''Check for unfinished operations (as above), and clear the ones
3805 that are clearable.
3826 that are clearable.
3806 '''
3827 '''
3807 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3828 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3808 if not clearable and repo.vfs.exists(f):
3829 if not clearable and repo.vfs.exists(f):
3809 raise error.Abort(msg, hint=hint)
3830 raise error.Abort(msg, hint=hint)
3810 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3831 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3811 if clearable and repo.vfs.exists(f):
3832 if clearable and repo.vfs.exists(f):
3812 util.unlink(repo.vfs.join(f))
3833 util.unlink(repo.vfs.join(f))
3813
3834
3814 afterresolvedstates = [
3835 afterresolvedstates = [
3815 ('graftstate',
3836 ('graftstate',
3816 _('hg graft --continue')),
3837 _('hg graft --continue')),
3817 ]
3838 ]
3818
3839
3819 def howtocontinue(repo):
3840 def howtocontinue(repo):
3820 '''Check for an unfinished operation and return the command to finish
3841 '''Check for an unfinished operation and return the command to finish
3821 it.
3842 it.
3822
3843
3823 afterresolvedstates tuples define a .hg/{file} and the corresponding
3844 afterresolvedstates tuples define a .hg/{file} and the corresponding
3824 command needed to finish it.
3845 command needed to finish it.
3825
3846
3826 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3847 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3827 a boolean.
3848 a boolean.
3828 '''
3849 '''
3829 contmsg = _("continue: %s")
3850 contmsg = _("continue: %s")
3830 for f, msg in afterresolvedstates:
3851 for f, msg in afterresolvedstates:
3831 if repo.vfs.exists(f):
3852 if repo.vfs.exists(f):
3832 return contmsg % msg, True
3853 return contmsg % msg, True
3833 if repo[None].dirty(missing=True, merge=False, branch=False):
3854 if repo[None].dirty(missing=True, merge=False, branch=False):
3834 return contmsg % _("hg commit"), False
3855 return contmsg % _("hg commit"), False
3835 return None, None
3856 return None, None
3836
3857
3837 def checkafterresolved(repo):
3858 def checkafterresolved(repo):
3838 '''Inform the user about the next action after completing hg resolve
3859 '''Inform the user about the next action after completing hg resolve
3839
3860
3840 If there's a matching afterresolvedstates, howtocontinue will yield
3861 If there's a matching afterresolvedstates, howtocontinue will yield
3841 repo.ui.warn as the reporter.
3862 repo.ui.warn as the reporter.
3842
3863
3843 Otherwise, it will yield repo.ui.note.
3864 Otherwise, it will yield repo.ui.note.
3844 '''
3865 '''
3845 msg, warning = howtocontinue(repo)
3866 msg, warning = howtocontinue(repo)
3846 if msg is not None:
3867 if msg is not None:
3847 if warning:
3868 if warning:
3848 repo.ui.warn("%s\n" % msg)
3869 repo.ui.warn("%s\n" % msg)
3849 else:
3870 else:
3850 repo.ui.note("%s\n" % msg)
3871 repo.ui.note("%s\n" % msg)
3851
3872
3852 def wrongtooltocontinue(repo, task):
3873 def wrongtooltocontinue(repo, task):
3853 '''Raise an abort suggesting how to properly continue if there is an
3874 '''Raise an abort suggesting how to properly continue if there is an
3854 active task.
3875 active task.
3855
3876
3856 Uses howtocontinue() to find the active task.
3877 Uses howtocontinue() to find the active task.
3857
3878
3858 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3879 If there's no task (repo.ui.note for 'hg commit'), it does not offer
3859 a hint.
3880 a hint.
3860 '''
3881 '''
3861 after = howtocontinue(repo)
3882 after = howtocontinue(repo)
3862 hint = None
3883 hint = None
3863 if after[1]:
3884 if after[1]:
3864 hint = after[0]
3885 hint = after[0]
3865 raise error.Abort(_('no %s in progress') % task, hint=hint)
3886 raise error.Abort(_('no %s in progress') % task, hint=hint)
@@ -1,226 +1,217 b''
1 #testcases obsstore-off obsstore-on
1 #testcases obsstore-off obsstore-on
2
2
3 $ cat << EOF >> $HGRCPATH
3 $ cat << EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > amend=
5 > amend=
6 > debugdrawdag=$TESTDIR/drawdag.py
6 > debugdrawdag=$TESTDIR/drawdag.py
7 > [diff]
7 > [diff]
8 > git=1
8 > git=1
9 > EOF
9 > EOF
10
10
11 #if obsstore-on
11 #if obsstore-on
12 $ cat << EOF >> $HGRCPATH
12 $ cat << EOF >> $HGRCPATH
13 > [experimental]
13 > [experimental]
14 > stabilization=createmarkers
14 > stabilization=createmarkers
15 > EOF
15 > EOF
16 #endif
16 #endif
17
17
18 Basic amend
18 Basic amend
19
19
20 $ hg init repo1
20 $ hg init repo1
21 $ cd repo1
21 $ cd repo1
22 $ hg debugdrawdag <<'EOS'
22 $ hg debugdrawdag <<'EOS'
23 > B
23 > B
24 > |
24 > |
25 > A
25 > A
26 > EOS
26 > EOS
27
27
28 $ hg update B -q
28 $ hg update B -q
29 $ echo 2 >> B
29 $ echo 2 >> B
30
30
31 $ hg amend
31 $ hg amend
32 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-af2c0941-amend.hg (glob) (obsstore-off !)
32 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !)
33 #if obsstore-off
33 #if obsstore-off
34 $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
34 $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
35 @ 1 be169c7e8dbe B
35 @ 1 be169c7e8dbe B
36 | diff --git a/B b/B
36 | diff --git a/B b/B
37 | new file mode 100644
37 | new file mode 100644
38 | --- /dev/null
38 | --- /dev/null
39 | +++ b/B
39 | +++ b/B
40 | @@ -0,0 +1,1 @@
40 | @@ -0,0 +1,1 @@
41 | +B2
41 | +B2
42 |
42 |
43 o 0 426bada5c675 A
43 o 0 426bada5c675 A
44 diff --git a/A b/A
44 diff --git a/A b/A
45 new file mode 100644
45 new file mode 100644
46 --- /dev/null
46 --- /dev/null
47 +++ b/A
47 +++ b/A
48 @@ -0,0 +1,1 @@
48 @@ -0,0 +1,1 @@
49 +A
49 +A
50 \ No newline at end of file
50 \ No newline at end of file
51
51
52 #else
52 #else
53 $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
53 $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
54 @ 3 be169c7e8dbe B
54 @ 2 be169c7e8dbe B
55 | diff --git a/B b/B
55 | diff --git a/B b/B
56 | new file mode 100644
56 | new file mode 100644
57 | --- /dev/null
57 | --- /dev/null
58 | +++ b/B
58 | +++ b/B
59 | @@ -0,0 +1,1 @@
59 | @@ -0,0 +1,1 @@
60 | +B2
60 | +B2
61 |
61 |
62 | x 2 edf08988b141 temporary amend commit for 112478962961
63 | | diff --git a/B b/B
64 | | --- a/B
65 | | +++ b/B
66 | | @@ -1,1 +1,1 @@
67 | | -B
68 | | \ No newline at end of file
69 | | +B2
70 | |
71 | x 1 112478962961 B
62 | x 1 112478962961 B
72 |/ diff --git a/B b/B
63 |/ diff --git a/B b/B
73 | new file mode 100644
64 | new file mode 100644
74 | --- /dev/null
65 | --- /dev/null
75 | +++ b/B
66 | +++ b/B
76 | @@ -0,0 +1,1 @@
67 | @@ -0,0 +1,1 @@
77 | +B
68 | +B
78 | \ No newline at end of file
69 | \ No newline at end of file
79 |
70 |
80 o 0 426bada5c675 A
71 o 0 426bada5c675 A
81 diff --git a/A b/A
72 diff --git a/A b/A
82 new file mode 100644
73 new file mode 100644
83 --- /dev/null
74 --- /dev/null
84 +++ b/A
75 +++ b/A
85 @@ -0,0 +1,1 @@
76 @@ -0,0 +1,1 @@
86 +A
77 +A
87 \ No newline at end of file
78 \ No newline at end of file
88
79
89 #endif
80 #endif
90
81
91 Nothing changed
82 Nothing changed
92
83
93 $ hg amend
84 $ hg amend
94 nothing changed
85 nothing changed
95 [1]
86 [1]
96
87
97 Matcher and metadata options
88 Matcher and metadata options
98
89
99 $ echo 3 > C
90 $ echo 3 > C
100 $ echo 4 > D
91 $ echo 4 > D
101 $ hg add C D
92 $ hg add C D
102 $ hg amend -m NEWMESSAGE -I C
93 $ hg amend -m NEWMESSAGE -I C
103 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-c24d73fe-amend.hg (glob) (obsstore-off !)
94 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !)
104 $ hg log -r . -T '{node|short} {desc} {files}\n'
95 $ hg log -r . -T '{node|short} {desc} {files}\n'
105 c7ba14d9075b NEWMESSAGE B C
96 c7ba14d9075b NEWMESSAGE B C
106 $ echo 5 > E
97 $ echo 5 > E
107 $ rm C
98 $ rm C
108 $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
99 $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
109 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b26ed45c-amend.hg (glob) (obsstore-off !)
100 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !)
110 $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
101 $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
111 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
102 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
112
103
113 Amend with editor
104 Amend with editor
114
105
115 $ cat > $TESTTMP/prefix.sh <<'EOF'
106 $ cat > $TESTTMP/prefix.sh <<'EOF'
116 > printf 'EDITED: ' > $TESTTMP/msg
107 > printf 'EDITED: ' > $TESTTMP/msg
117 > cat "$1" >> $TESTTMP/msg
108 > cat "$1" >> $TESTTMP/msg
118 > mv $TESTTMP/msg "$1"
109 > mv $TESTTMP/msg "$1"
119 > EOF
110 > EOF
120 $ chmod +x $TESTTMP/prefix.sh
111 $ chmod +x $TESTTMP/prefix.sh
121
112
122 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
113 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
123 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !)
114 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !)
124 $ hg log -r . -T '{node|short} {desc}\n'
115 $ hg log -r . -T '{node|short} {desc}\n'
125 298f085230c3 EDITED: NEWMESSAGE
116 298f085230c3 EDITED: NEWMESSAGE
126 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
117 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
127 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !)
118 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !)
128 $ hg log -r . -T '{node|short} {desc}\n'
119 $ hg log -r . -T '{node|short} {desc}\n'
129 974f07f28537 EDITED: MSG
120 974f07f28537 EDITED: MSG
130
121
131 $ echo FOO > $TESTTMP/msg
122 $ echo FOO > $TESTTMP/msg
132 $ hg amend -l $TESTTMP/msg -m BAR
123 $ hg amend -l $TESTTMP/msg -m BAR
133 abort: options --message and --logfile are mutually exclusive
124 abort: options --message and --logfile are mutually exclusive
134 [255]
125 [255]
135 $ hg amend -l $TESTTMP/msg
126 $ hg amend -l $TESTTMP/msg
136 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !)
127 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !)
137 $ hg log -r . -T '{node|short} {desc}\n'
128 $ hg log -r . -T '{node|short} {desc}\n'
138 507be9bdac71 FOO
129 507be9bdac71 FOO
139
130
140 Interactive mode
131 Interactive mode
141
132
142 $ touch F G
133 $ touch F G
143 $ hg add F G
134 $ hg add F G
144 $ cat <<EOS | hg amend -i --config ui.interactive=1
135 $ cat <<EOS | hg amend -i --config ui.interactive=1
145 > y
136 > y
146 > n
137 > n
147 > EOS
138 > EOS
148 diff --git a/F b/F
139 diff --git a/F b/F
149 new file mode 100644
140 new file mode 100644
150 examine changes to 'F'? [Ynesfdaq?] y
141 examine changes to 'F'? [Ynesfdaq?] y
151
142
152 diff --git a/G b/G
143 diff --git a/G b/G
153 new file mode 100644
144 new file mode 100644
154 examine changes to 'G'? [Ynesfdaq?] n
145 examine changes to 'G'? [Ynesfdaq?] n
155
146
156 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-7ae43d04-amend.hg (glob) (obsstore-off !)
147 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !)
157 $ hg log -r . -T '{files}\n'
148 $ hg log -r . -T '{files}\n'
158 B D F
149 B D F
159
150
160 Amend in the middle of a stack
151 Amend in the middle of a stack
161
152
162 $ hg init $TESTTMP/repo2
153 $ hg init $TESTTMP/repo2
163 $ cd $TESTTMP/repo2
154 $ cd $TESTTMP/repo2
164 $ hg debugdrawdag <<'EOS'
155 $ hg debugdrawdag <<'EOS'
165 > C
156 > C
166 > |
157 > |
167 > B
158 > B
168 > |
159 > |
169 > A
160 > A
170 > EOS
161 > EOS
171
162
172 $ hg update -q B
163 $ hg update -q B
173 $ echo 2 >> B
164 $ echo 2 >> B
174 $ hg amend
165 $ hg amend
175 abort: cannot amend changeset with children
166 abort: cannot amend changeset with children
176 [255]
167 [255]
177
168
178 #if obsstore-on
169 #if obsstore-on
179
170
180 With allowunstable, amend could work in the middle of a stack
171 With allowunstable, amend could work in the middle of a stack
181
172
182 $ cat >> $HGRCPATH <<EOF
173 $ cat >> $HGRCPATH <<EOF
183 > [experimental]
174 > [experimental]
184 > stabilization=createmarkers, allowunstable
175 > stabilization=createmarkers, allowunstable
185 > EOF
176 > EOF
186
177
187 $ hg amend
178 $ hg amend
188 $ hg log -T '{rev} {node|short} {desc}\n' -G
179 $ hg log -T '{rev} {node|short} {desc}\n' -G
189 @ 4 be169c7e8dbe B
180 @ 3 be169c7e8dbe B
190 |
181 |
191 | o 2 26805aba1e60 C
182 | o 2 26805aba1e60 C
192 | |
183 | |
193 | x 1 112478962961 B
184 | x 1 112478962961 B
194 |/
185 |/
195 o 0 426bada5c675 A
186 o 0 426bada5c675 A
196
187
197 #endif
188 #endif
198
189
199 Cannot amend public changeset
190 Cannot amend public changeset
200
191
201 $ hg phase -r A --public
192 $ hg phase -r A --public
202 $ hg update -C -q A
193 $ hg update -C -q A
203 $ hg amend -m AMEND
194 $ hg amend -m AMEND
204 abort: cannot amend public changesets
195 abort: cannot amend public changesets
205 [255]
196 [255]
206
197
207 Amend a merge changeset
198 Amend a merge changeset
208
199
209 $ hg init $TESTTMP/repo3
200 $ hg init $TESTTMP/repo3
210 $ cd $TESTTMP/repo3
201 $ cd $TESTTMP/repo3
211 $ hg debugdrawdag <<'EOS'
202 $ hg debugdrawdag <<'EOS'
212 > C
203 > C
213 > /|
204 > /|
214 > A B
205 > A B
215 > EOS
206 > EOS
216 $ hg update -q C
207 $ hg update -q C
217 $ hg amend -m FOO
208 $ hg amend -m FOO
218 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !)
209 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !)
219 $ rm .hg/localtags
210 $ rm .hg/localtags
220 $ hg log -G -T '{desc}\n'
211 $ hg log -G -T '{desc}\n'
221 @ FOO
212 @ FOO
222 |\
213 |\
223 | o B
214 | o B
224 |
215 |
225 o A
216 o A
226
217
@@ -1,1269 +1,1268 b''
1 $ cat << EOF >> $HGRCPATH
1 $ cat << EOF >> $HGRCPATH
2 > [format]
2 > [format]
3 > usegeneraldelta=yes
3 > usegeneraldelta=yes
4 > EOF
4 > EOF
5
5
6 $ hg init
6 $ hg init
7
7
8 Setup:
8 Setup:
9
9
10 $ echo a >> a
10 $ echo a >> a
11 $ hg ci -Am 'base'
11 $ hg ci -Am 'base'
12 adding a
12 adding a
13
13
14 Refuse to amend public csets:
14 Refuse to amend public csets:
15
15
16 $ hg phase -r . -p
16 $ hg phase -r . -p
17 $ hg ci --amend
17 $ hg ci --amend
18 abort: cannot amend public changesets
18 abort: cannot amend public changesets
19 [255]
19 [255]
20 $ hg phase -r . -f -d
20 $ hg phase -r . -f -d
21
21
22 $ echo a >> a
22 $ echo a >> a
23 $ hg ci -Am 'base1'
23 $ hg ci -Am 'base1'
24
24
25 Nothing to amend:
25 Nothing to amend:
26
26
27 $ hg ci --amend -m 'base1'
27 $ hg ci --amend -m 'base1'
28 nothing changed
28 nothing changed
29 [1]
29 [1]
30
30
31 $ cat >> $HGRCPATH <<EOF
31 $ cat >> $HGRCPATH <<EOF
32 > [hooks]
32 > [hooks]
33 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
33 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
34 > EOF
34 > EOF
35
35
36 Amending changeset with changes in working dir:
36 Amending changeset with changes in working dir:
37 (and check that --message does not trigger an editor)
37 (and check that --message does not trigger an editor)
38
38
39 $ echo a >> a
39 $ echo a >> a
40 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
40 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
41 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
41 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
42 43f1ba15f28a tip
42 43f1ba15f28a tip
43 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend.hg (glob)
43 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg (glob)
44 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
44 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
45 $ hg diff -c .
45 $ hg diff -c .
46 diff -r ad120869acf0 -r 43f1ba15f28a a
46 diff -r ad120869acf0 -r 43f1ba15f28a a
47 --- a/a Thu Jan 01 00:00:00 1970 +0000
47 --- a/a Thu Jan 01 00:00:00 1970 +0000
48 +++ b/a Thu Jan 01 00:00:00 1970 +0000
48 +++ b/a Thu Jan 01 00:00:00 1970 +0000
49 @@ -1,1 +1,3 @@
49 @@ -1,1 +1,3 @@
50 a
50 a
51 +a
51 +a
52 +a
52 +a
53 $ hg log
53 $ hg log
54 changeset: 1:43f1ba15f28a
54 changeset: 1:43f1ba15f28a
55 tag: tip
55 tag: tip
56 user: test
56 user: test
57 date: Thu Jan 01 00:00:00 1970 +0000
57 date: Thu Jan 01 00:00:00 1970 +0000
58 summary: amend base1
58 summary: amend base1
59
59
60 changeset: 0:ad120869acf0
60 changeset: 0:ad120869acf0
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: base
63 summary: base
64
64
65
65
66 Check proper abort for empty message
66 Check proper abort for empty message
67
67
68 $ cat > editor.sh << '__EOF__'
68 $ cat > editor.sh << '__EOF__'
69 > #!/bin/sh
69 > #!/bin/sh
70 > echo "" > "$1"
70 > echo "" > "$1"
71 > __EOF__
71 > __EOF__
72
73 Update the existing file to ensure that the dirstate is not in pending state
74 (where the status of some files in the working copy is not known yet). This in
75 turn ensures that when the transaction is aborted due to an empty message during
76 the amend, there should be no rollback.
77 $ echo a >> a
78
72 $ echo b > b
79 $ echo b > b
73 $ hg add b
80 $ hg add b
74 $ hg summary
81 $ hg summary
75 parent: 1:43f1ba15f28a tip
82 parent: 1:43f1ba15f28a tip
76 amend base1
83 amend base1
77 branch: default
84 branch: default
78 commit: 1 added, 1 unknown
85 commit: 1 modified, 1 added, 1 unknown
79 update: (current)
86 update: (current)
80 phases: 2 draft
87 phases: 2 draft
81 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
88 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
82 transaction abort!
83 rollback completed
84 abort: empty commit message
89 abort: empty commit message
85 [255]
90 [255]
86 $ hg summary
91 $ hg summary
87 parent: 1:43f1ba15f28a tip
92 parent: 1:43f1ba15f28a tip
88 amend base1
93 amend base1
89 branch: default
94 branch: default
90 commit: 1 added, 1 unknown
95 commit: 1 modified, 1 added, 1 unknown
91 update: (current)
96 update: (current)
92 phases: 2 draft
97 phases: 2 draft
93
98
94 Add new file:
99 Add new file along with modified existing file:
95 $ hg ci --amend -m 'amend base1 new file'
100 $ hg ci --amend -m 'amend base1 new file'
96 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend.hg (glob)
101 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg (glob)
97
102
98 Remove file that was added in amended commit:
103 Remove file that was added in amended commit:
99 (and test logfile option)
104 (and test logfile option)
100 (and test that logfile option do not trigger an editor)
105 (and test that logfile option do not trigger an editor)
101
106
102 $ hg rm b
107 $ hg rm b
103 $ echo 'amend base1 remove new file' > ../logfile
108 $ echo 'amend base1 remove new file' > ../logfile
104 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
109 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
105 saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend.hg (glob)
110 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg (glob)
106
111
107 $ hg cat b
112 $ hg cat b
108 b: no such file in rev 74609c7f506e
113 b: no such file in rev 47343646fa3d
109 [1]
114 [1]
110
115
111 No changes, just a different message:
116 No changes, just a different message:
112
117
113 $ hg ci -v --amend -m 'no changes, new message'
118 $ hg ci -v --amend -m 'no changes, new message'
114 amending changeset 74609c7f506e
119 amending changeset 47343646fa3d
115 copying changeset 74609c7f506e to ad120869acf0
120 copying changeset 47343646fa3d to ad120869acf0
116 committing files:
121 committing files:
117 a
122 a
118 committing manifest
123 committing manifest
119 committing changelog
124 committing changelog
120 1 changesets found
125 1 changesets found
121 uncompressed size of bundle content:
126 uncompressed size of bundle content:
122 254 (changelog)
127 254 (changelog)
123 163 (manifests)
128 163 (manifests)
124 129 a
129 131 a
125 saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend.hg (glob)
130 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg (glob)
126 1 changesets found
131 1 changesets found
127 uncompressed size of bundle content:
132 uncompressed size of bundle content:
128 250 (changelog)
133 250 (changelog)
129 163 (manifests)
134 163 (manifests)
130 129 a
135 131 a
131 adding branch
136 adding branch
132 adding changesets
137 adding changesets
133 adding manifests
138 adding manifests
134 adding file changes
139 adding file changes
135 added 1 changesets with 1 changes to 1 files
140 added 1 changesets with 1 changes to 1 files
136 committed changeset 1:1cd866679df8
141 committed changeset 1:401431e913a1
137 $ hg diff -c .
142 $ hg diff -c .
138 diff -r ad120869acf0 -r 1cd866679df8 a
143 diff -r ad120869acf0 -r 401431e913a1 a
139 --- a/a Thu Jan 01 00:00:00 1970 +0000
144 --- a/a Thu Jan 01 00:00:00 1970 +0000
140 +++ b/a Thu Jan 01 00:00:00 1970 +0000
145 +++ b/a Thu Jan 01 00:00:00 1970 +0000
141 @@ -1,1 +1,3 @@
146 @@ -1,1 +1,4 @@
142 a
147 a
143 +a
148 +a
144 +a
149 +a
150 +a
145 $ hg log
151 $ hg log
146 changeset: 1:1cd866679df8
152 changeset: 1:401431e913a1
147 tag: tip
153 tag: tip
148 user: test
154 user: test
149 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
150 summary: no changes, new message
156 summary: no changes, new message
151
157
152 changeset: 0:ad120869acf0
158 changeset: 0:ad120869acf0
153 user: test
159 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
160 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: base
161 summary: base
156
162
157
163
158 Disable default date on commit so when -d isn't given, the old date is preserved:
164 Disable default date on commit so when -d isn't given, the old date is preserved:
159
165
160 $ echo '[defaults]' >> $HGRCPATH
166 $ echo '[defaults]' >> $HGRCPATH
161 $ echo 'commit=' >> $HGRCPATH
167 $ echo 'commit=' >> $HGRCPATH
162
168
163 Test -u/-d:
169 Test -u/-d:
164
170
165 $ cat > .hg/checkeditform.sh <<EOF
171 $ cat > .hg/checkeditform.sh <<EOF
166 > env | grep HGEDITFORM
172 > env | grep HGEDITFORM
167 > true
173 > true
168 > EOF
174 > EOF
169 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
175 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
170 HGEDITFORM=commit.amend.normal
176 HGEDITFORM=commit.amend.normal
171 saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend.hg (glob)
177 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg (glob)
172 $ echo a >> a
178 $ echo a >> a
173 $ hg ci --amend -u foo -d '1 0'
179 $ hg ci --amend -u foo -d '1 0'
174 saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend.hg (glob)
180 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg (glob)
175 $ hg log -r .
181 $ hg log -r .
176 changeset: 1:5f357c7560ab
182 changeset: 1:a9a13940fc03
177 tag: tip
183 tag: tip
178 user: foo
184 user: foo
179 date: Thu Jan 01 00:00:01 1970 +0000
185 date: Thu Jan 01 00:00:01 1970 +0000
180 summary: no changes, new message
186 summary: no changes, new message
181
187
182
188
183 Open editor with old commit message if a message isn't given otherwise:
189 Open editor with old commit message if a message isn't given otherwise:
184
190
185 $ cat > editor.sh << '__EOF__'
191 $ cat > editor.sh << '__EOF__'
186 > #!/bin/sh
192 > #!/bin/sh
187 > cat $1
193 > cat $1
188 > echo "another precious commit message" > "$1"
194 > echo "another precious commit message" > "$1"
189 > __EOF__
195 > __EOF__
190
196
191 at first, test saving last-message.txt
197 at first, test saving last-message.txt
192
198
193 $ cat > .hg/hgrc << '__EOF__'
199 $ cat > .hg/hgrc << '__EOF__'
194 > [hooks]
200 > [hooks]
195 > pretxncommit.test-saving-last-message = false
201 > pretxncommit.test-saving-last-message = false
196 > __EOF__
202 > __EOF__
197
203
198 $ rm -f .hg/last-message.txt
204 $ rm -f .hg/last-message.txt
199 $ hg commit --amend -v -m "message given from command line"
205 $ hg commit --amend -v -m "message given from command line"
200 amending changeset 5f357c7560ab
206 amending changeset a9a13940fc03
201 copying changeset 5f357c7560ab to ad120869acf0
207 copying changeset a9a13940fc03 to ad120869acf0
202 committing files:
208 committing files:
203 a
209 a
204 committing manifest
210 committing manifest
205 committing changelog
211 committing changelog
206 running hook pretxncommit.test-saving-last-message: false
212 running hook pretxncommit.test-saving-last-message: false
207 transaction abort!
213 transaction abort!
208 rollback completed
214 rollback completed
209 abort: pretxncommit.test-saving-last-message hook exited with status 1
215 abort: pretxncommit.test-saving-last-message hook exited with status 1
210 [255]
216 [255]
211 $ cat .hg/last-message.txt
217 $ cat .hg/last-message.txt
212 message given from command line (no-eol)
218 message given from command line (no-eol)
213
219
214 $ rm -f .hg/last-message.txt
220 $ rm -f .hg/last-message.txt
215 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
221 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
216 amending changeset 5f357c7560ab
222 amending changeset a9a13940fc03
217 copying changeset 5f357c7560ab to ad120869acf0
223 copying changeset a9a13940fc03 to ad120869acf0
218 no changes, new message
224 no changes, new message
219
225
220
226
221 HG: Enter commit message. Lines beginning with 'HG:' are removed.
227 HG: Enter commit message. Lines beginning with 'HG:' are removed.
222 HG: Leave message empty to abort commit.
228 HG: Leave message empty to abort commit.
223 HG: --
229 HG: --
224 HG: user: foo
230 HG: user: foo
225 HG: branch 'default'
231 HG: branch 'default'
226 HG: changed a
232 HG: changed a
227 committing files:
233 committing files:
228 a
234 a
229 committing manifest
235 committing manifest
230 committing changelog
236 committing changelog
231 running hook pretxncommit.test-saving-last-message: false
237 running hook pretxncommit.test-saving-last-message: false
232 transaction abort!
238 transaction abort!
233 rollback completed
239 rollback completed
234 abort: pretxncommit.test-saving-last-message hook exited with status 1
240 abort: pretxncommit.test-saving-last-message hook exited with status 1
235 [255]
241 [255]
236
242
237 $ cat .hg/last-message.txt
243 $ cat .hg/last-message.txt
238 another precious commit message
244 another precious commit message
239
245
240 $ cat > .hg/hgrc << '__EOF__'
246 $ cat > .hg/hgrc << '__EOF__'
241 > [hooks]
247 > [hooks]
242 > pretxncommit.test-saving-last-message =
248 > pretxncommit.test-saving-last-message =
243 > __EOF__
249 > __EOF__
244
250
245 then, test editing custom commit message
251 then, test editing custom commit message
246
252
247 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
253 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
248 amending changeset 5f357c7560ab
254 amending changeset a9a13940fc03
249 copying changeset 5f357c7560ab to ad120869acf0
255 copying changeset a9a13940fc03 to ad120869acf0
250 no changes, new message
256 no changes, new message
251
257
252
258
253 HG: Enter commit message. Lines beginning with 'HG:' are removed.
259 HG: Enter commit message. Lines beginning with 'HG:' are removed.
254 HG: Leave message empty to abort commit.
260 HG: Leave message empty to abort commit.
255 HG: --
261 HG: --
256 HG: user: foo
262 HG: user: foo
257 HG: branch 'default'
263 HG: branch 'default'
258 HG: changed a
264 HG: changed a
259 committing files:
265 committing files:
260 a
266 a
261 committing manifest
267 committing manifest
262 committing changelog
268 committing changelog
263 1 changesets found
269 1 changesets found
264 uncompressed size of bundle content:
270 uncompressed size of bundle content:
265 249 (changelog)
271 249 (changelog)
266 163 (manifests)
272 163 (manifests)
267 131 a
273 133 a
268 saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend.hg (glob)
274 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg (glob)
269 1 changesets found
275 1 changesets found
270 uncompressed size of bundle content:
276 uncompressed size of bundle content:
271 257 (changelog)
277 257 (changelog)
272 163 (manifests)
278 163 (manifests)
273 131 a
279 133 a
274 adding branch
280 adding branch
275 adding changesets
281 adding changesets
276 adding manifests
282 adding manifests
277 adding file changes
283 adding file changes
278 added 1 changesets with 1 changes to 1 files
284 added 1 changesets with 1 changes to 1 files
279 committed changeset 1:7ab3bf440b54
285 committed changeset 1:64a124ba1b44
280
286
281 Same, but with changes in working dir (different code path):
287 Same, but with changes in working dir (different code path):
282
288
283 $ echo a >> a
289 $ echo a >> a
284 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
290 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
285 amending changeset 7ab3bf440b54
291 amending changeset 64a124ba1b44
286 committing files:
287 a
288 committing manifest
289 committing changelog
290 copying changeset a0ea9b1a4c8c to ad120869acf0
291 another precious commit message
292 another precious commit message
292
293
293
294
294 HG: Enter commit message. Lines beginning with 'HG:' are removed.
295 HG: Enter commit message. Lines beginning with 'HG:' are removed.
295 HG: Leave message empty to abort commit.
296 HG: Leave message empty to abort commit.
296 HG: --
297 HG: --
297 HG: user: foo
298 HG: user: foo
298 HG: branch 'default'
299 HG: branch 'default'
299 HG: changed a
300 HG: changed a
300 committing files:
301 committing files:
301 a
302 a
302 committing manifest
303 committing manifest
303 committing changelog
304 committing changelog
304 2 changesets found
305 uncompressed size of bundle content:
306 464 (changelog)
307 322 (manifests)
308 249 a
309 saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend.hg (glob)
310 1 changesets found
305 1 changesets found
311 uncompressed size of bundle content:
306 uncompressed size of bundle content:
312 257 (changelog)
307 257 (changelog)
313 163 (manifests)
308 163 (manifests)
314 133 a
309 133 a
310 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg (glob)
311 1 changesets found
312 uncompressed size of bundle content:
313 257 (changelog)
314 163 (manifests)
315 135 a
315 adding branch
316 adding branch
316 adding changesets
317 adding changesets
317 adding manifests
318 adding manifests
318 adding file changes
319 adding file changes
319 added 1 changesets with 1 changes to 1 files
320 added 1 changesets with 1 changes to 1 files
320 committed changeset 1:ea22a388757c
321 committed changeset 1:7892795b8e38
321
322
322 $ rm editor.sh
323 $ rm editor.sh
323 $ hg log -r .
324 $ hg log -r .
324 changeset: 1:ea22a388757c
325 changeset: 1:7892795b8e38
325 tag: tip
326 tag: tip
326 user: foo
327 user: foo
327 date: Thu Jan 01 00:00:01 1970 +0000
328 date: Thu Jan 01 00:00:01 1970 +0000
328 summary: another precious commit message
329 summary: another precious commit message
329
330
330
331
331 Moving bookmarks, preserve active bookmark:
332 Moving bookmarks, preserve active bookmark:
332
333
333 $ hg book book1
334 $ hg book book1
334 $ hg book book2
335 $ hg book book2
335 $ hg ci --amend -m 'move bookmarks'
336 $ hg ci --amend -m 'move bookmarks'
336 saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend.hg (glob)
337 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg (glob)
337 $ hg book
338 $ hg book
338 book1 1:6cec5aa930e2
339 book1 1:8311f17e2616
339 * book2 1:6cec5aa930e2
340 * book2 1:8311f17e2616
340 $ echo a >> a
341 $ echo a >> a
341 $ hg ci --amend -m 'move bookmarks'
342 $ hg ci --amend -m 'move bookmarks'
342 saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend.hg (glob)
343 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg (glob)
343 $ hg book
344 $ hg book
344 book1 1:48bb6e53a15f
345 book1 1:a3b65065808c
345 * book2 1:48bb6e53a15f
346 * book2 1:a3b65065808c
346
347
347 abort does not loose bookmarks
348 abort does not loose bookmarks
348
349
349 $ cat > editor.sh << '__EOF__'
350 $ cat > editor.sh << '__EOF__'
350 > #!/bin/sh
351 > #!/bin/sh
351 > echo "" > "$1"
352 > echo "" > "$1"
352 > __EOF__
353 > __EOF__
353 $ echo a >> a
354 $ echo a >> a
354 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
355 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
355 transaction abort!
356 rollback completed
357 abort: empty commit message
356 abort: empty commit message
358 [255]
357 [255]
359 $ hg book
358 $ hg book
360 book1 1:48bb6e53a15f
359 book1 1:a3b65065808c
361 * book2 1:48bb6e53a15f
360 * book2 1:a3b65065808c
362 $ hg revert -Caq
361 $ hg revert -Caq
363 $ rm editor.sh
362 $ rm editor.sh
364
363
365 $ echo '[defaults]' >> $HGRCPATH
364 $ echo '[defaults]' >> $HGRCPATH
366 $ echo "commit=-d '0 0'" >> $HGRCPATH
365 $ echo "commit=-d '0 0'" >> $HGRCPATH
367
366
368 Moving branches:
367 Moving branches:
369
368
370 $ hg branch foo
369 $ hg branch foo
371 marked working directory as branch foo
370 marked working directory as branch foo
372 (branches are permanent and global, did you want a bookmark?)
371 (branches are permanent and global, did you want a bookmark?)
373 $ echo a >> a
372 $ echo a >> a
374 $ hg ci -m 'branch foo'
373 $ hg ci -m 'branch foo'
375 $ hg branch default -f
374 $ hg branch default -f
376 marked working directory as branch default
375 marked working directory as branch default
377 $ hg ci --amend -m 'back to default'
376 $ hg ci --amend -m 'back to default'
378 saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend.hg (glob)
377 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg (glob)
379 $ hg branches
378 $ hg branches
380 default 2:ce12b0b57d46
379 default 2:9c07515f2650
381
380
382 Close branch:
381 Close branch:
383
382
384 $ hg up -q 0
383 $ hg up -q 0
385 $ echo b >> b
384 $ echo b >> b
386 $ hg branch foo
385 $ hg branch foo
387 marked working directory as branch foo
386 marked working directory as branch foo
388 (branches are permanent and global, did you want a bookmark?)
387 (branches are permanent and global, did you want a bookmark?)
389 $ hg ci -Am 'fork'
388 $ hg ci -Am 'fork'
390 adding b
389 adding b
391 $ echo b >> b
390 $ echo b >> b
392 $ hg ci -mb
391 $ hg ci -mb
393 $ hg ci --amend --close-branch -m 'closing branch foo'
392 $ hg ci --amend --close-branch -m 'closing branch foo'
394 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend.hg (glob)
393 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg (glob)
395
394
396 Same thing, different code path:
395 Same thing, different code path:
397
396
398 $ echo b >> b
397 $ echo b >> b
399 $ hg ci -m 'reopen branch'
398 $ hg ci -m 'reopen branch'
400 reopening closed branch head 4
399 reopening closed branch head 4
401 $ echo b >> b
400 $ echo b >> b
402 $ hg ci --amend --close-branch
401 $ hg ci --amend --close-branch
403 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend.hg (glob)
402 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg (glob)
404 $ hg branches
403 $ hg branches
405 default 2:ce12b0b57d46
404 default 2:9c07515f2650
406
405
407 Refuse to amend during a merge:
406 Refuse to amend during a merge:
408
407
409 $ hg up -q default
408 $ hg up -q default
410 $ hg merge foo
409 $ hg merge foo
411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 (branch merge, don't forget to commit)
411 (branch merge, don't forget to commit)
413 $ hg ci --amend
412 $ hg ci --amend
414 abort: cannot amend while merging
413 abort: cannot amend while merging
415 [255]
414 [255]
416 $ hg ci -m 'merge'
415 $ hg ci -m 'merge'
417
416
418 Follow copies/renames:
417 Follow copies/renames:
419
418
420 $ hg mv b c
419 $ hg mv b c
421 $ hg ci -m 'b -> c'
420 $ hg ci -m 'b -> c'
422 $ hg mv c d
421 $ hg mv c d
423 $ hg ci --amend -m 'b -> d'
422 $ hg ci --amend -m 'b -> d'
424 saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend.hg (glob)
423 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg (glob)
425 $ hg st --rev '.^' --copies d
424 $ hg st --rev '.^' --copies d
426 A d
425 A d
427 b
426 b
428 $ hg cp d e
427 $ hg cp d e
429 $ hg ci -m 'e = d'
428 $ hg ci -m 'e = d'
430 $ hg cp e f
429 $ hg cp e f
431 $ hg ci --amend -m 'f = d'
430 $ hg ci --amend -m 'f = d'
432 saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend.hg (glob)
431 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg (glob)
433 $ hg st --rev '.^' --copies f
432 $ hg st --rev '.^' --copies f
434 A f
433 A f
435 d
434 d
436
435
437 $ mv f f.orig
436 $ mv f f.orig
438 $ hg rm -A f
437 $ hg rm -A f
439 $ hg ci -m removef
438 $ hg ci -m removef
440 $ hg cp a f
439 $ hg cp a f
441 $ mv f.orig f
440 $ mv f.orig f
442 $ hg ci --amend -m replacef
441 $ hg ci --amend -m replacef
443 saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend.hg (glob)
442 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg (glob)
444 $ hg st --change . --copies
443 $ hg st --change . --copies
445 $ hg log -r . --template "{file_copies}\n"
444 $ hg log -r . --template "{file_copies}\n"
446
445
447
446
448 Move added file (issue3410):
447 Move added file (issue3410):
449
448
450 $ echo g >> g
449 $ echo g >> g
451 $ hg ci -Am g
450 $ hg ci -Am g
452 adding g
451 adding g
453 $ hg mv g h
452 $ hg mv g h
454 $ hg ci --amend
453 $ hg ci --amend
455 saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend.hg (glob)
454 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg (glob)
456 $ hg st --change . --copies h
455 $ hg st --change . --copies h
457 A h
456 A h
458 $ hg log -r . --template "{file_copies}\n"
457 $ hg log -r . --template "{file_copies}\n"
459
458
460
459
461 Can't rollback an amend:
460 Can't rollback an amend:
462
461
463 $ hg rollback
462 $ hg rollback
464 no rollback information available
463 no rollback information available
465 [1]
464 [1]
466
465
467 Preserve extra dict (issue3430):
466 Preserve extra dict (issue3430):
468
467
469 $ hg branch a
468 $ hg branch a
470 marked working directory as branch a
469 marked working directory as branch a
471 (branches are permanent and global, did you want a bookmark?)
470 (branches are permanent and global, did you want a bookmark?)
472 $ echo a >> a
471 $ echo a >> a
473 $ hg ci -ma
472 $ hg ci -ma
474 $ hg ci --amend -m "a'"
473 $ hg ci --amend -m "a'"
475 saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend.hg (glob)
474 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg (glob)
476 $ hg log -r . --template "{branch}\n"
475 $ hg log -r . --template "{branch}\n"
477 a
476 a
478 $ hg ci --amend -m "a''"
477 $ hg ci --amend -m "a''"
479 saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend.hg (glob)
478 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg (glob)
480 $ hg log -r . --template "{branch}\n"
479 $ hg log -r . --template "{branch}\n"
481 a
480 a
482
481
483 Also preserve other entries in the dict that are in the old commit,
482 Also preserve other entries in the dict that are in the old commit,
484 first graft something so there's an additional entry:
483 first graft something so there's an additional entry:
485
484
486 $ hg up 0 -q
485 $ hg up 0 -q
487 $ echo z > z
486 $ echo z > z
488 $ hg ci -Am 'fork'
487 $ hg ci -Am 'fork'
489 adding z
488 adding z
490 created new head
489 created new head
491 $ hg up 11
490 $ hg up 11
492 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
491 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
493 $ hg graft 12
492 $ hg graft 12
494 grafting 12:2647734878ef "fork" (tip)
493 grafting 12:2647734878ef "fork" (tip)
495 $ hg ci --amend -m 'graft amend'
494 $ hg ci --amend -m 'graft amend'
496 saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend.hg (glob)
495 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg (glob)
497 $ hg log -r . --debug | grep extra
496 $ hg log -r . --debug | grep extra
498 extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
497 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
499 extra: branch=a
498 extra: branch=a
500 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
499 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
501
500
502 Preserve phase
501 Preserve phase
503
502
504 $ hg phase '.^::.'
503 $ hg phase '.^::.'
505 11: draft
504 11: draft
506 13: draft
505 13: draft
507 $ hg phase --secret --force .
506 $ hg phase --secret --force .
508 $ hg phase '.^::.'
507 $ hg phase '.^::.'
509 11: draft
508 11: draft
510 13: secret
509 13: secret
511 $ hg commit --amend -m 'amend for phase' -q
510 $ hg commit --amend -m 'amend for phase' -q
512 $ hg phase '.^::.'
511 $ hg phase '.^::.'
513 11: draft
512 11: draft
514 13: secret
513 13: secret
515
514
516 Test amend with obsolete
515 Test amend with obsolete
517 ---------------------------
516 ---------------------------
518
517
519 Enable obsolete
518 Enable obsolete
520
519
521 $ cat >> $HGRCPATH << EOF
520 $ cat >> $HGRCPATH << EOF
522 > [experimental]
521 > [experimental]
523 > stabilization=createmarkers,allowunstable
522 > stabilization=createmarkers,allowunstable
524 > EOF
523 > EOF
525
524
526 Amend with no files changes
525 Amend with no files changes
527
526
528 $ hg id -n
527 $ hg id -n
529 13
528 13
530 $ hg ci --amend -m 'babar'
529 $ hg ci --amend -m 'babar'
531 $ hg id -n
530 $ hg id -n
532 14
531 14
533 $ hg log -Gl 3 --style=compact
532 $ hg log -Gl 3 --style=compact
534 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
533 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
535 | babar
534 | babar
536 |
535 |
537 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
536 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
538 | | fork
537 | | fork
539 | ~
538 | ~
540 o 11 3334b7925910 1970-01-01 00:00 +0000 test
539 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
541 | a''
540 | a''
542 ~
541 ~
543 $ hg log -Gl 4 --hidden --style=compact
542 $ hg log -Gl 4 --hidden --style=compact
544 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
543 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
545 | babar
544 | babar
546 |
545 |
547 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
546 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
548 |/ amend for phase
547 |/ amend for phase
549 |
548 |
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
549 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 | | fork
550 | | fork
552 | ~
551 | ~
553 o 11 3334b7925910 1970-01-01 00:00 +0000 test
552 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 | a''
553 | a''
555 ~
554 ~
556
555
557 Amend with files changes
556 Amend with files changes
558
557
559 (note: the extra commit over 15 is a temporary junk I would be happy to get
558 (note: the extra commit over 15 is a temporary junk I would be happy to get
560 ride of)
559 ride of)
561
560
562 $ echo 'babar' >> a
561 $ echo 'babar' >> a
563 $ hg commit --amend
562 $ hg commit --amend
564 $ hg log -Gl 6 --hidden --style=compact
563 $ hg log -Gl 6 --hidden --style=compact
565 @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test
564 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
566 | babar
565 | babar
567 |
566 |
568 | x 15 90fef497c56f 1970-01-01 00:00 +0000 test
567 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
569 | | temporary amend commit for b650e6ee8614
570 | |
571 | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test
572 |/ babar
568 |/ babar
573 |
569 |
574 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
570 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
575 |/ amend for phase
571 |/ amend for phase
576 |
572 |
577 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
573 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
578 | | fork
574 | | fork
579 | ~
575 | ~
580 o 11 3334b7925910 1970-01-01 00:00 +0000 test
576 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
581 | a''
577 | a''
578 |
579 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
580 | g
582 ~
581 ~
583
582
584
583
585 Test that amend does not make it easy to create obsolescence cycle
584 Test that amend does not make it easy to create obsolescence cycle
586 ---------------------------------------------------------------------
585 ---------------------------------------------------------------------
587
586
588 $ hg id -r 14 --hidden
587 $ hg id -r 14 --hidden
589 b650e6ee8614 (a)
588 682950e85999 (a)
590 $ hg revert -ar 14 --hidden
589 $ hg revert -ar 14 --hidden
591 reverting a
590 reverting a
592 $ hg commit --amend
591 $ hg commit --amend
593 $ hg id
592 $ hg id
594 b99e5df575f7 (a) tip
593 37973c7e0b61 (a) tip
595
594
596 Test that rewriting leaving instability behind is allowed
595 Test that rewriting leaving instability behind is allowed
597 ---------------------------------------------------------------------
596 ---------------------------------------------------------------------
598
597
599 $ hg up '.^'
598 $ hg up '.^'
600 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
599 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
601 $ echo 'b' >> a
600 $ echo 'b' >> a
602 $ hg log --style compact -r 'children(.)'
601 $ hg log --style compact -r 'children(.)'
603 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test
602 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
604 babar
603 babar
605
604
606 $ hg commit --amend
605 $ hg commit --amend
607 $ hg log -r 'orphan()'
606 $ hg log -r 'orphan()'
608 changeset: 18:b99e5df575f7
607 changeset: 16:37973c7e0b61
609 branch: a
608 branch: a
610 parent: 11:3334b7925910
609 parent: 11:0ddb275cfad1
611 user: test
610 user: test
612 date: Thu Jan 01 00:00:00 1970 +0000
611 date: Thu Jan 01 00:00:00 1970 +0000
613 instability: orphan
612 instability: orphan
614 summary: babar
613 summary: babar
615
614
616
615
617 Amend a merge changeset (with renames and conflicts from the second parent):
616 Amend a merge changeset (with renames and conflicts from the second parent):
618
617
619 $ hg up -q default
618 $ hg up -q default
620 $ hg branch -q bar
619 $ hg branch -q bar
621 $ hg cp a aa
620 $ hg cp a aa
622 $ hg mv z zz
621 $ hg mv z zz
623 $ echo cc > cc
622 $ echo cc > cc
624 $ hg add cc
623 $ hg add cc
625 $ hg ci -m aazzcc
624 $ hg ci -m aazzcc
626 $ hg up -q default
625 $ hg up -q default
627 $ echo a >> a
626 $ echo a >> a
628 $ echo dd > cc
627 $ echo dd > cc
629 $ hg add cc
628 $ hg add cc
630 $ hg ci -m aa
629 $ hg ci -m aa
631 $ hg merge -q bar
630 $ hg merge -q bar
632 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
631 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
633 [1]
632 [1]
634 $ hg resolve -m cc
633 $ hg resolve -m cc
635 (no more unresolved files)
634 (no more unresolved files)
636 $ hg ci -m 'merge bar'
635 $ hg ci -m 'merge bar'
637 $ hg log --config diff.git=1 -pr .
636 $ hg log --config diff.git=1 -pr .
638 changeset: 23:163cfd7219f7
637 changeset: 20:163cfd7219f7
639 tag: tip
638 tag: tip
640 parent: 22:30d96aeaf27b
639 parent: 19:30d96aeaf27b
641 parent: 21:1aa437659d19
640 parent: 18:1aa437659d19
642 user: test
641 user: test
643 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
644 summary: merge bar
643 summary: merge bar
645
644
646 diff --git a/a b/aa
645 diff --git a/a b/aa
647 copy from a
646 copy from a
648 copy to aa
647 copy to aa
649 diff --git a/cc b/cc
648 diff --git a/cc b/cc
650 --- a/cc
649 --- a/cc
651 +++ b/cc
650 +++ b/cc
652 @@ -1,1 +1,5 @@
651 @@ -1,1 +1,5 @@
653 +<<<<<<< working copy: 30d96aeaf27b - test: aa
652 +<<<<<<< working copy: 30d96aeaf27b - test: aa
654 dd
653 dd
655 +=======
654 +=======
656 +cc
655 +cc
657 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
656 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
658 diff --git a/z b/zz
657 diff --git a/z b/zz
659 rename from z
658 rename from z
660 rename to zz
659 rename to zz
661
660
662 $ hg debugrename aa
661 $ hg debugrename aa
663 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
662 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
664 $ hg debugrename zz
663 $ hg debugrename zz
665 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
664 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
666 $ hg debugrename cc
665 $ hg debugrename cc
667 cc not renamed
666 cc not renamed
668 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
667 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
669 HGEDITFORM=commit.amend.merge
668 HGEDITFORM=commit.amend.merge
670 $ hg log --config diff.git=1 -pr .
669 $ hg log --config diff.git=1 -pr .
671 changeset: 24:bca52d4ed186
670 changeset: 21:bca52d4ed186
672 tag: tip
671 tag: tip
673 parent: 22:30d96aeaf27b
672 parent: 19:30d96aeaf27b
674 parent: 21:1aa437659d19
673 parent: 18:1aa437659d19
675 user: test
674 user: test
676 date: Thu Jan 01 00:00:00 1970 +0000
675 date: Thu Jan 01 00:00:00 1970 +0000
677 summary: merge bar (amend message)
676 summary: merge bar (amend message)
678
677
679 diff --git a/a b/aa
678 diff --git a/a b/aa
680 copy from a
679 copy from a
681 copy to aa
680 copy to aa
682 diff --git a/cc b/cc
681 diff --git a/cc b/cc
683 --- a/cc
682 --- a/cc
684 +++ b/cc
683 +++ b/cc
685 @@ -1,1 +1,5 @@
684 @@ -1,1 +1,5 @@
686 +<<<<<<< working copy: 30d96aeaf27b - test: aa
685 +<<<<<<< working copy: 30d96aeaf27b - test: aa
687 dd
686 dd
688 +=======
687 +=======
689 +cc
688 +cc
690 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
689 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
691 diff --git a/z b/zz
690 diff --git a/z b/zz
692 rename from z
691 rename from z
693 rename to zz
692 rename to zz
694
693
695 $ hg debugrename aa
694 $ hg debugrename aa
696 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
695 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
697 $ hg debugrename zz
696 $ hg debugrename zz
698 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
697 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
699 $ hg debugrename cc
698 $ hg debugrename cc
700 cc not renamed
699 cc not renamed
701 $ hg mv zz z
700 $ hg mv zz z
702 $ hg ci --amend -m 'merge bar (undo rename)'
701 $ hg ci --amend -m 'merge bar (undo rename)'
703 $ hg log --config diff.git=1 -pr .
702 $ hg log --config diff.git=1 -pr .
704 changeset: 26:12594a98ca3f
703 changeset: 22:12594a98ca3f
705 tag: tip
704 tag: tip
706 parent: 22:30d96aeaf27b
705 parent: 19:30d96aeaf27b
707 parent: 21:1aa437659d19
706 parent: 18:1aa437659d19
708 user: test
707 user: test
709 date: Thu Jan 01 00:00:00 1970 +0000
708 date: Thu Jan 01 00:00:00 1970 +0000
710 summary: merge bar (undo rename)
709 summary: merge bar (undo rename)
711
710
712 diff --git a/a b/aa
711 diff --git a/a b/aa
713 copy from a
712 copy from a
714 copy to aa
713 copy to aa
715 diff --git a/cc b/cc
714 diff --git a/cc b/cc
716 --- a/cc
715 --- a/cc
717 +++ b/cc
716 +++ b/cc
718 @@ -1,1 +1,5 @@
717 @@ -1,1 +1,5 @@
719 +<<<<<<< working copy: 30d96aeaf27b - test: aa
718 +<<<<<<< working copy: 30d96aeaf27b - test: aa
720 dd
719 dd
721 +=======
720 +=======
722 +cc
721 +cc
723 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
722 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
724
723
725 $ hg debugrename z
724 $ hg debugrename z
726 z not renamed
725 z not renamed
727
726
728 Amend a merge changeset (with renames during the merge):
727 Amend a merge changeset (with renames during the merge):
729
728
730 $ hg up -q bar
729 $ hg up -q bar
731 $ echo x > x
730 $ echo x > x
732 $ hg add x
731 $ hg add x
733 $ hg ci -m x
732 $ hg ci -m x
734 $ hg up -q default
733 $ hg up -q default
735 $ hg merge -q bar
734 $ hg merge -q bar
736 $ hg mv aa aaa
735 $ hg mv aa aaa
737 $ echo aa >> aaa
736 $ echo aa >> aaa
738 $ hg ci -m 'merge bar again'
737 $ hg ci -m 'merge bar again'
739 $ hg log --config diff.git=1 -pr .
738 $ hg log --config diff.git=1 -pr .
740 changeset: 28:dffde028b388
739 changeset: 24:dffde028b388
741 tag: tip
740 tag: tip
742 parent: 26:12594a98ca3f
741 parent: 22:12594a98ca3f
743 parent: 27:4c94d5bc65f5
742 parent: 23:4c94d5bc65f5
744 user: test
743 user: test
745 date: Thu Jan 01 00:00:00 1970 +0000
744 date: Thu Jan 01 00:00:00 1970 +0000
746 summary: merge bar again
745 summary: merge bar again
747
746
748 diff --git a/aa b/aa
747 diff --git a/aa b/aa
749 deleted file mode 100644
748 deleted file mode 100644
750 --- a/aa
749 --- a/aa
751 +++ /dev/null
750 +++ /dev/null
752 @@ -1,2 +0,0 @@
751 @@ -1,2 +0,0 @@
753 -a
752 -a
754 -a
753 -a
755 diff --git a/aaa b/aaa
754 diff --git a/aaa b/aaa
756 new file mode 100644
755 new file mode 100644
757 --- /dev/null
756 --- /dev/null
758 +++ b/aaa
757 +++ b/aaa
759 @@ -0,0 +1,3 @@
758 @@ -0,0 +1,3 @@
760 +a
759 +a
761 +a
760 +a
762 +aa
761 +aa
763 diff --git a/x b/x
762 diff --git a/x b/x
764 new file mode 100644
763 new file mode 100644
765 --- /dev/null
764 --- /dev/null
766 +++ b/x
765 +++ b/x
767 @@ -0,0 +1,1 @@
766 @@ -0,0 +1,1 @@
768 +x
767 +x
769
768
770 $ hg debugrename aaa
769 $ hg debugrename aaa
771 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
770 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
772 $ hg mv aaa aa
771 $ hg mv aaa aa
773 $ hg ci --amend -m 'merge bar again (undo rename)'
772 $ hg ci --amend -m 'merge bar again (undo rename)'
774 $ hg log --config diff.git=1 -pr .
773 $ hg log --config diff.git=1 -pr .
775 changeset: 30:18e3ba160489
774 changeset: 25:18e3ba160489
776 tag: tip
775 tag: tip
777 parent: 26:12594a98ca3f
776 parent: 22:12594a98ca3f
778 parent: 27:4c94d5bc65f5
777 parent: 23:4c94d5bc65f5
779 user: test
778 user: test
780 date: Thu Jan 01 00:00:00 1970 +0000
779 date: Thu Jan 01 00:00:00 1970 +0000
781 summary: merge bar again (undo rename)
780 summary: merge bar again (undo rename)
782
781
783 diff --git a/aa b/aa
782 diff --git a/aa b/aa
784 --- a/aa
783 --- a/aa
785 +++ b/aa
784 +++ b/aa
786 @@ -1,2 +1,3 @@
785 @@ -1,2 +1,3 @@
787 a
786 a
788 a
787 a
789 +aa
788 +aa
790 diff --git a/x b/x
789 diff --git a/x b/x
791 new file mode 100644
790 new file mode 100644
792 --- /dev/null
791 --- /dev/null
793 +++ b/x
792 +++ b/x
794 @@ -0,0 +1,1 @@
793 @@ -0,0 +1,1 @@
795 +x
794 +x
796
795
797 $ hg debugrename aa
796 $ hg debugrename aa
798 aa not renamed
797 aa not renamed
799 $ hg debugrename -r '.^' aa
798 $ hg debugrename -r '.^' aa
800 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
799 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
801
800
802 Amend a merge changeset (with manifest-level conflicts):
801 Amend a merge changeset (with manifest-level conflicts):
803
802
804 $ hg up -q bar
803 $ hg up -q bar
805 $ hg rm aa
804 $ hg rm aa
806 $ hg ci -m 'rm aa'
805 $ hg ci -m 'rm aa'
807 $ hg up -q default
806 $ hg up -q default
808 $ echo aa >> aa
807 $ echo aa >> aa
809 $ hg ci -m aa
808 $ hg ci -m aa
810 $ hg merge -q bar --config ui.interactive=True << EOF
809 $ hg merge -q bar --config ui.interactive=True << EOF
811 > c
810 > c
812 > EOF
811 > EOF
813 local [working copy] changed aa which other [merge rev] deleted
812 local [working copy] changed aa which other [merge rev] deleted
814 use (c)hanged version, (d)elete, or leave (u)nresolved? c
813 use (c)hanged version, (d)elete, or leave (u)nresolved? c
815 $ hg ci -m 'merge bar (with conflicts)'
814 $ hg ci -m 'merge bar (with conflicts)'
816 $ hg log --config diff.git=1 -pr .
815 $ hg log --config diff.git=1 -pr .
817 changeset: 33:b4c3035e2544
816 changeset: 28:b4c3035e2544
818 tag: tip
817 tag: tip
819 parent: 32:4b216ca5ba97
818 parent: 27:4b216ca5ba97
820 parent: 31:67db8847a540
819 parent: 26:67db8847a540
821 user: test
820 user: test
822 date: Thu Jan 01 00:00:00 1970 +0000
821 date: Thu Jan 01 00:00:00 1970 +0000
823 summary: merge bar (with conflicts)
822 summary: merge bar (with conflicts)
824
823
825
824
826 $ hg rm aa
825 $ hg rm aa
827 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
826 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
828 $ hg log --config diff.git=1 -pr .
827 $ hg log --config diff.git=1 -pr .
829 changeset: 35:1205ed810051
828 changeset: 29:1205ed810051
830 tag: tip
829 tag: tip
831 parent: 32:4b216ca5ba97
830 parent: 27:4b216ca5ba97
832 parent: 31:67db8847a540
831 parent: 26:67db8847a540
833 user: test
832 user: test
834 date: Thu Jan 01 00:00:00 1970 +0000
833 date: Thu Jan 01 00:00:00 1970 +0000
835 summary: merge bar (with conflicts, amended)
834 summary: merge bar (with conflicts, amended)
836
835
837 diff --git a/aa b/aa
836 diff --git a/aa b/aa
838 deleted file mode 100644
837 deleted file mode 100644
839 --- a/aa
838 --- a/aa
840 +++ /dev/null
839 +++ /dev/null
841 @@ -1,4 +0,0 @@
840 @@ -1,4 +0,0 @@
842 -a
841 -a
843 -a
842 -a
844 -aa
843 -aa
845 -aa
844 -aa
846
845
847 Issue 3445: amending with --close-branch a commit that created a new head should fail
846 Issue 3445: amending with --close-branch a commit that created a new head should fail
848 This shouldn't be possible:
847 This shouldn't be possible:
849
848
850 $ hg up -q default
849 $ hg up -q default
851 $ hg branch closewithamend
850 $ hg branch closewithamend
852 marked working directory as branch closewithamend
851 marked working directory as branch closewithamend
853 $ echo foo > foo
852 $ echo foo > foo
854 $ hg add foo
853 $ hg add foo
855 $ hg ci -m..
854 $ hg ci -m..
856 $ hg ci --amend --close-branch -m 'closing'
855 $ hg ci --amend --close-branch -m 'closing'
857 abort: can only close branch heads
856 abort: can only close branch heads
858 [255]
857 [255]
859
858
860 This silliness fails:
859 This silliness fails:
861
860
862 $ hg branch silliness
861 $ hg branch silliness
863 marked working directory as branch silliness
862 marked working directory as branch silliness
864 $ echo b >> b
863 $ echo b >> b
865 $ hg ci --close-branch -m'open and close'
864 $ hg ci --close-branch -m'open and close'
866 abort: can only close branch heads
865 abort: can only close branch heads
867 [255]
866 [255]
868
867
869 Test that amend with --secret creates new secret changeset forcibly
868 Test that amend with --secret creates new secret changeset forcibly
870 ---------------------------------------------------------------------
869 ---------------------------------------------------------------------
871
870
872 $ hg phase '.^::.'
871 $ hg phase '.^::.'
873 35: draft
872 29: draft
874 36: draft
873 30: draft
875 $ hg commit --amend --secret -m 'amend as secret' -q
874 $ hg commit --amend --secret -m 'amend as secret' -q
876 $ hg phase '.^::.'
875 $ hg phase '.^::.'
877 35: draft
876 29: draft
878 38: secret
877 31: secret
879
878
880 Test that amend with --edit invokes editor forcibly
879 Test that amend with --edit invokes editor forcibly
881 ---------------------------------------------------
880 ---------------------------------------------------
882
881
883 $ hg parents --template "{desc}\n"
882 $ hg parents --template "{desc}\n"
884 amend as secret
883 amend as secret
885 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
884 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
886 $ hg parents --template "{desc}\n"
885 $ hg parents --template "{desc}\n"
887 editor should be suppressed
886 editor should be suppressed
888
887
889 $ hg status --rev '.^1::.'
888 $ hg status --rev '.^1::.'
890 A foo
889 A foo
891 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
890 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
892 editor should be invoked
891 editor should be invoked
893
892
894
893
895 HG: Enter commit message. Lines beginning with 'HG:' are removed.
894 HG: Enter commit message. Lines beginning with 'HG:' are removed.
896 HG: Leave message empty to abort commit.
895 HG: Leave message empty to abort commit.
897 HG: --
896 HG: --
898 HG: user: test
897 HG: user: test
899 HG: branch 'silliness'
898 HG: branch 'silliness'
900 HG: added foo
899 HG: added foo
901 $ hg parents --template "{desc}\n"
900 $ hg parents --template "{desc}\n"
902 editor should be invoked
901 editor should be invoked
903
902
904 Test that "diff()" in committemplate works correctly for amending
903 Test that "diff()" in committemplate works correctly for amending
905 -----------------------------------------------------------------
904 -----------------------------------------------------------------
906
905
907 $ cat >> .hg/hgrc <<EOF
906 $ cat >> .hg/hgrc <<EOF
908 > [committemplate]
907 > [committemplate]
909 > changeset.commit.amend = {desc}\n
908 > changeset.commit.amend = {desc}\n
910 > HG: M: {file_mods}
909 > HG: M: {file_mods}
911 > HG: A: {file_adds}
910 > HG: A: {file_adds}
912 > HG: R: {file_dels}
911 > HG: R: {file_dels}
913 > {splitlines(diff()) % 'HG: {line}\n'}
912 > {splitlines(diff()) % 'HG: {line}\n'}
914 > EOF
913 > EOF
915
914
916 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
915 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
917 M:
916 M:
918 A: foo
917 A: foo
919 R:
918 R:
920 $ hg status -amr
919 $ hg status -amr
921 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
920 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
922 expecting diff of foo
921 expecting diff of foo
923
922
924 HG: M:
923 HG: M:
925 HG: A: foo
924 HG: A: foo
926 HG: R:
925 HG: R:
927 HG: diff -r 1205ed810051 foo
926 HG: diff -r 1205ed810051 foo
928 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
927 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
929 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
928 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
930 HG: @@ -0,0 +1,1 @@
929 HG: @@ -0,0 +1,1 @@
931 HG: +foo
930 HG: +foo
932
931
933 $ echo y > y
932 $ echo y > y
934 $ hg add y
933 $ hg add y
935 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
934 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
936 expecting diff of foo and y
935 expecting diff of foo and y
937
936
938 HG: M:
937 HG: M:
939 HG: A: foo y
938 HG: A: foo y
940 HG: R:
939 HG: R:
941 HG: diff -r 1205ed810051 foo
940 HG: diff -r 1205ed810051 foo
942 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
941 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
943 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
942 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
944 HG: @@ -0,0 +1,1 @@
943 HG: @@ -0,0 +1,1 @@
945 HG: +foo
944 HG: +foo
946 HG: diff -r 1205ed810051 y
945 HG: diff -r 1205ed810051 y
947 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
946 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
948 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
947 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
949 HG: @@ -0,0 +1,1 @@
948 HG: @@ -0,0 +1,1 @@
950 HG: +y
949 HG: +y
951
950
952 $ hg rm a
951 $ hg rm a
953 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
952 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
954 expecting diff of a, foo and y
953 expecting diff of a, foo and y
955
954
956 HG: M:
955 HG: M:
957 HG: A: foo y
956 HG: A: foo y
958 HG: R: a
957 HG: R: a
959 HG: diff -r 1205ed810051 a
958 HG: diff -r 1205ed810051 a
960 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
959 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
961 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
960 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
962 HG: @@ -1,2 +0,0 @@
961 HG: @@ -1,2 +0,0 @@
963 HG: -a
962 HG: -a
964 HG: -a
963 HG: -a
965 HG: diff -r 1205ed810051 foo
964 HG: diff -r 1205ed810051 foo
966 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
965 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
967 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
966 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
968 HG: @@ -0,0 +1,1 @@
967 HG: @@ -0,0 +1,1 @@
969 HG: +foo
968 HG: +foo
970 HG: diff -r 1205ed810051 y
969 HG: diff -r 1205ed810051 y
971 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
970 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
972 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
971 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
973 HG: @@ -0,0 +1,1 @@
972 HG: @@ -0,0 +1,1 @@
974 HG: +y
973 HG: +y
975
974
976 $ hg rm x
975 $ hg rm x
977 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
976 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
978 expecting diff of a, foo, x and y
977 expecting diff of a, foo, x and y
979
978
980 HG: M:
979 HG: M:
981 HG: A: foo y
980 HG: A: foo y
982 HG: R: a x
981 HG: R: a x
983 HG: diff -r 1205ed810051 a
982 HG: diff -r 1205ed810051 a
984 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
983 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
985 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
984 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
986 HG: @@ -1,2 +0,0 @@
985 HG: @@ -1,2 +0,0 @@
987 HG: -a
986 HG: -a
988 HG: -a
987 HG: -a
989 HG: diff -r 1205ed810051 foo
988 HG: diff -r 1205ed810051 foo
990 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
989 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
991 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
990 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
992 HG: @@ -0,0 +1,1 @@
991 HG: @@ -0,0 +1,1 @@
993 HG: +foo
992 HG: +foo
994 HG: diff -r 1205ed810051 x
993 HG: diff -r 1205ed810051 x
995 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
994 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
996 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
995 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
997 HG: @@ -1,1 +0,0 @@
996 HG: @@ -1,1 +0,0 @@
998 HG: -x
997 HG: -x
999 HG: diff -r 1205ed810051 y
998 HG: diff -r 1205ed810051 y
1000 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
999 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1001 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1000 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1002 HG: @@ -0,0 +1,1 @@
1001 HG: @@ -0,0 +1,1 @@
1003 HG: +y
1002 HG: +y
1004
1003
1005 $ echo cccc >> cc
1004 $ echo cccc >> cc
1006 $ hg status -amr
1005 $ hg status -amr
1007 M cc
1006 M cc
1008 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1007 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1009 cc should be excluded
1008 cc should be excluded
1010
1009
1011 HG: M:
1010 HG: M:
1012 HG: A: foo y
1011 HG: A: foo y
1013 HG: R: a x
1012 HG: R: a x
1014 HG: diff -r 1205ed810051 a
1013 HG: diff -r 1205ed810051 a
1015 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1014 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1016 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1015 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1017 HG: @@ -1,2 +0,0 @@
1016 HG: @@ -1,2 +0,0 @@
1018 HG: -a
1017 HG: -a
1019 HG: -a
1018 HG: -a
1020 HG: diff -r 1205ed810051 foo
1019 HG: diff -r 1205ed810051 foo
1021 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1020 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1022 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1021 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1023 HG: @@ -0,0 +1,1 @@
1022 HG: @@ -0,0 +1,1 @@
1024 HG: +foo
1023 HG: +foo
1025 HG: diff -r 1205ed810051 x
1024 HG: diff -r 1205ed810051 x
1026 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1025 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1027 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1026 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1028 HG: @@ -1,1 +0,0 @@
1027 HG: @@ -1,1 +0,0 @@
1029 HG: -x
1028 HG: -x
1030 HG: diff -r 1205ed810051 y
1029 HG: diff -r 1205ed810051 y
1031 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1030 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1032 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1031 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1033 HG: @@ -0,0 +1,1 @@
1032 HG: @@ -0,0 +1,1 @@
1034 HG: +y
1033 HG: +y
1035
1034
1036 Check for issue4405
1035 Check for issue4405
1037 -------------------
1036 -------------------
1038
1037
1039 Setup the repo with a file that gets moved in a second commit.
1038 Setup the repo with a file that gets moved in a second commit.
1040 $ hg init repo
1039 $ hg init repo
1041 $ cd repo
1040 $ cd repo
1042 $ touch a0
1041 $ touch a0
1043 $ hg add a0
1042 $ hg add a0
1044 $ hg commit -m a0
1043 $ hg commit -m a0
1045 $ hg mv a0 a1
1044 $ hg mv a0 a1
1046 $ hg commit -m a1
1045 $ hg commit -m a1
1047 $ hg up -q 0
1046 $ hg up -q 0
1048 $ hg log -G --template '{rev} {desc}'
1047 $ hg log -G --template '{rev} {desc}'
1049 o 1 a1
1048 o 1 a1
1050 |
1049 |
1051 @ 0 a0
1050 @ 0 a0
1052
1051
1053
1052
1054 Now we branch the repro, but re-use the file contents, so we have a divergence
1053 Now we branch the repro, but re-use the file contents, so we have a divergence
1055 in the file revlog topology and the changelog topology.
1054 in the file revlog topology and the changelog topology.
1056 $ hg revert --rev 1 --all
1055 $ hg revert --rev 1 --all
1057 removing a0
1056 removing a0
1058 adding a1
1057 adding a1
1059 $ hg ci -qm 'a1-amend'
1058 $ hg ci -qm 'a1-amend'
1060 $ hg log -G --template '{rev} {desc}'
1059 $ hg log -G --template '{rev} {desc}'
1061 @ 2 a1-amend
1060 @ 2 a1-amend
1062 |
1061 |
1063 | o 1 a1
1062 | o 1 a1
1064 |/
1063 |/
1065 o 0 a0
1064 o 0 a0
1066
1065
1067
1066
1068 The way mercurial does amends is to create a temporary commit (rev 3) and then
1067 The way mercurial does amends is by folding the working copy and old commit
1069 fold the new and old commits together into another commit (rev 4). During this
1068 together into another commit (rev 3). During this process, _findlimit is called
1070 process, _findlimit is called to check how far back to look for the transitive
1069 to check how far back to look for the transitive closure of file copy
1071 closure of file copy information, but due to the divergence of the filelog
1070 information, but due to the divergence of the filelog and changelog graph
1072 and changelog graph topologies, before _findlimit was fixed, it returned a rev
1071 topologies, before _findlimit was fixed, it returned a rev which was not far
1073 which was not far enough back in this case.
1072 enough back in this case.
1074 $ hg mv a1 a2
1073 $ hg mv a1 a2
1075 $ hg status --copies --rev 0
1074 $ hg status --copies --rev 0
1076 A a2
1075 A a2
1077 a0
1076 a0
1078 R a0
1077 R a0
1079 $ hg ci --amend -q
1078 $ hg ci --amend -q
1080 $ hg log -G --template '{rev} {desc}'
1079 $ hg log -G --template '{rev} {desc}'
1081 @ 4 a1-amend
1080 @ 3 a1-amend
1082 |
1081 |
1083 | o 1 a1
1082 | o 1 a1
1084 |/
1083 |/
1085 o 0 a0
1084 o 0 a0
1086
1085
1087
1086
1088 Before the fix, the copy information was lost.
1087 Before the fix, the copy information was lost.
1089 $ hg status --copies --rev 0
1088 $ hg status --copies --rev 0
1090 A a2
1089 A a2
1091 a0
1090 a0
1092 R a0
1091 R a0
1093 $ cd ..
1092 $ cd ..
1094
1093
1095 Check that amend properly preserve rename from directory rename (issue-4516)
1094 Check that amend properly preserve rename from directory rename (issue-4516)
1096
1095
1097 If a parent of the merge renames a full directory, any files added to the old
1096 If a parent of the merge renames a full directory, any files added to the old
1098 directory in the other parent will be renamed to the new directory. For some
1097 directory in the other parent will be renamed to the new directory. For some
1099 reason, the rename metadata was when amending such merge. This test ensure we
1098 reason, the rename metadata was when amending such merge. This test ensure we
1100 do not regress. We have a dedicated repo because it needs a setup with renamed
1099 do not regress. We have a dedicated repo because it needs a setup with renamed
1101 directory)
1100 directory)
1102
1101
1103 $ hg init issue4516
1102 $ hg init issue4516
1104 $ cd issue4516
1103 $ cd issue4516
1105 $ mkdir olddirname
1104 $ mkdir olddirname
1106 $ echo line1 > olddirname/commonfile.py
1105 $ echo line1 > olddirname/commonfile.py
1107 $ hg add olddirname/commonfile.py
1106 $ hg add olddirname/commonfile.py
1108 $ hg ci -m first
1107 $ hg ci -m first
1109
1108
1110 $ hg branch newdirname
1109 $ hg branch newdirname
1111 marked working directory as branch newdirname
1110 marked working directory as branch newdirname
1112 (branches are permanent and global, did you want a bookmark?)
1111 (branches are permanent and global, did you want a bookmark?)
1113 $ hg mv olddirname newdirname
1112 $ hg mv olddirname newdirname
1114 moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
1113 moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
1115 $ hg ci -m rename
1114 $ hg ci -m rename
1116
1115
1117 $ hg update default
1116 $ hg update default
1118 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1117 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1119 $ echo line1 > olddirname/newfile.py
1118 $ echo line1 > olddirname/newfile.py
1120 $ hg add olddirname/newfile.py
1119 $ hg add olddirname/newfile.py
1121 $ hg ci -m log
1120 $ hg ci -m log
1122
1121
1123 $ hg up newdirname
1122 $ hg up newdirname
1124 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1123 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1125 $ # create newdirname/newfile.py
1124 $ # create newdirname/newfile.py
1126 $ hg merge default
1125 $ hg merge default
1127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1128 (branch merge, don't forget to commit)
1127 (branch merge, don't forget to commit)
1129 $ hg ci -m add
1128 $ hg ci -m add
1130 $
1129 $
1131 $ hg debugrename newdirname/newfile.py
1130 $ hg debugrename newdirname/newfile.py
1132 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1131 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1133 $ hg status -C --change .
1132 $ hg status -C --change .
1134 A newdirname/newfile.py
1133 A newdirname/newfile.py
1135 $ hg status -C --rev 1
1134 $ hg status -C --rev 1
1136 A newdirname/newfile.py
1135 A newdirname/newfile.py
1137 $ hg status -C --rev 2
1136 $ hg status -C --rev 2
1138 A newdirname/commonfile.py
1137 A newdirname/commonfile.py
1139 olddirname/commonfile.py
1138 olddirname/commonfile.py
1140 A newdirname/newfile.py
1139 A newdirname/newfile.py
1141 olddirname/newfile.py
1140 olddirname/newfile.py
1142 R olddirname/commonfile.py
1141 R olddirname/commonfile.py
1143 R olddirname/newfile.py
1142 R olddirname/newfile.py
1144 $ hg debugindex newdirname/newfile.py
1143 $ hg debugindex newdirname/newfile.py
1145 rev offset length delta linkrev nodeid p1 p2
1144 rev offset length delta linkrev nodeid p1 p2
1146 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
1145 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
1147
1146
1148 $ echo a >> newdirname/commonfile.py
1147 $ echo a >> newdirname/commonfile.py
1149 $ hg ci --amend -m bug
1148 $ hg ci --amend -m bug
1150 $ hg debugrename newdirname/newfile.py
1149 $ hg debugrename newdirname/newfile.py
1151 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1150 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1152 $ hg debugindex newdirname/newfile.py
1151 $ hg debugindex newdirname/newfile.py
1153 rev offset length delta linkrev nodeid p1 p2
1152 rev offset length delta linkrev nodeid p1 p2
1154 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
1153 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
1155
1154
1156 #if execbit
1155 #if execbit
1157
1156
1158 Test if amend preserves executable bit changes
1157 Test if amend preserves executable bit changes
1159 $ chmod +x newdirname/commonfile.py
1158 $ chmod +x newdirname/commonfile.py
1160 $ hg ci -m chmod
1159 $ hg ci -m chmod
1161 $ hg ci --amend -m "chmod amended"
1160 $ hg ci --amend -m "chmod amended"
1162 $ hg ci --amend -m "chmod amended second time"
1161 $ hg ci --amend -m "chmod amended second time"
1163 $ hg log -p --git -r .
1162 $ hg log -p --git -r .
1164 changeset: 8:b1326f52dddf
1163 changeset: 7:b1326f52dddf
1165 branch: newdirname
1164 branch: newdirname
1166 tag: tip
1165 tag: tip
1167 parent: 5:7fd235f7cb2f
1166 parent: 4:7fd235f7cb2f
1168 user: test
1167 user: test
1169 date: Thu Jan 01 00:00:00 1970 +0000
1168 date: Thu Jan 01 00:00:00 1970 +0000
1170 summary: chmod amended second time
1169 summary: chmod amended second time
1171
1170
1172 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1171 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1173 old mode 100644
1172 old mode 100644
1174 new mode 100755
1173 new mode 100755
1175
1174
1176 #endif
1175 #endif
1177
1176
1178 Test amend with file inclusion options
1177 Test amend with file inclusion options
1179 --------------------------------------
1178 --------------------------------------
1180
1179
1181 These tests ensure that we are always amending some files that were part of the
1180 These tests ensure that we are always amending some files that were part of the
1182 pre-amend commit. We want to test that the remaining files in the pre-amend
1181 pre-amend commit. We want to test that the remaining files in the pre-amend
1183 commit were not changed in the amended commit. We do so by performing a diff of
1182 commit were not changed in the amended commit. We do so by performing a diff of
1184 the amended commit against its parent commit.
1183 the amended commit against its parent commit.
1185 $ cd ..
1184 $ cd ..
1186 $ hg init testfileinclusions
1185 $ hg init testfileinclusions
1187 $ cd testfileinclusions
1186 $ cd testfileinclusions
1188 $ echo a > a
1187 $ echo a > a
1189 $ echo b > b
1188 $ echo b > b
1190 $ hg commit -Aqm "Adding a and b"
1189 $ hg commit -Aqm "Adding a and b"
1191
1190
1192 Only add changes to a particular file
1191 Only add changes to a particular file
1193 $ echo a >> a
1192 $ echo a >> a
1194 $ echo b >> b
1193 $ echo b >> b
1195 $ hg commit --amend -I a
1194 $ hg commit --amend -I a
1196 $ hg diff --git -r null -r .
1195 $ hg diff --git -r null -r .
1197 diff --git a/a b/a
1196 diff --git a/a b/a
1198 new file mode 100644
1197 new file mode 100644
1199 --- /dev/null
1198 --- /dev/null
1200 +++ b/a
1199 +++ b/a
1201 @@ -0,0 +1,2 @@
1200 @@ -0,0 +1,2 @@
1202 +a
1201 +a
1203 +a
1202 +a
1204 diff --git a/b b/b
1203 diff --git a/b b/b
1205 new file mode 100644
1204 new file mode 100644
1206 --- /dev/null
1205 --- /dev/null
1207 +++ b/b
1206 +++ b/b
1208 @@ -0,0 +1,1 @@
1207 @@ -0,0 +1,1 @@
1209 +b
1208 +b
1210
1209
1211 $ echo a >> a
1210 $ echo a >> a
1212 $ hg commit --amend b
1211 $ hg commit --amend b
1213 $ hg diff --git -r null -r .
1212 $ hg diff --git -r null -r .
1214 diff --git a/a b/a
1213 diff --git a/a b/a
1215 new file mode 100644
1214 new file mode 100644
1216 --- /dev/null
1215 --- /dev/null
1217 +++ b/a
1216 +++ b/a
1218 @@ -0,0 +1,2 @@
1217 @@ -0,0 +1,2 @@
1219 +a
1218 +a
1220 +a
1219 +a
1221 diff --git a/b b/b
1220 diff --git a/b b/b
1222 new file mode 100644
1221 new file mode 100644
1223 --- /dev/null
1222 --- /dev/null
1224 +++ b/b
1223 +++ b/b
1225 @@ -0,0 +1,2 @@
1224 @@ -0,0 +1,2 @@
1226 +b
1225 +b
1227 +b
1226 +b
1228
1227
1229 Exclude changes to a particular file
1228 Exclude changes to a particular file
1230 $ echo b >> b
1229 $ echo b >> b
1231 $ hg commit --amend -X a
1230 $ hg commit --amend -X a
1232 $ hg diff --git -r null -r .
1231 $ hg diff --git -r null -r .
1233 diff --git a/a b/a
1232 diff --git a/a b/a
1234 new file mode 100644
1233 new file mode 100644
1235 --- /dev/null
1234 --- /dev/null
1236 +++ b/a
1235 +++ b/a
1237 @@ -0,0 +1,2 @@
1236 @@ -0,0 +1,2 @@
1238 +a
1237 +a
1239 +a
1238 +a
1240 diff --git a/b b/b
1239 diff --git a/b b/b
1241 new file mode 100644
1240 new file mode 100644
1242 --- /dev/null
1241 --- /dev/null
1243 +++ b/b
1242 +++ b/b
1244 @@ -0,0 +1,3 @@
1243 @@ -0,0 +1,3 @@
1245 +b
1244 +b
1246 +b
1245 +b
1247 +b
1246 +b
1248
1247
1249 Check the addremove flag
1248 Check the addremove flag
1250 $ echo c > c
1249 $ echo c > c
1251 $ rm a
1250 $ rm a
1252 $ hg commit --amend -A
1251 $ hg commit --amend -A
1253 removing a
1252 removing a
1254 adding c
1253 adding c
1255 $ hg diff --git -r null -r .
1254 $ hg diff --git -r null -r .
1256 diff --git a/b b/b
1255 diff --git a/b b/b
1257 new file mode 100644
1256 new file mode 100644
1258 --- /dev/null
1257 --- /dev/null
1259 +++ b/b
1258 +++ b/b
1260 @@ -0,0 +1,3 @@
1259 @@ -0,0 +1,3 @@
1261 +b
1260 +b
1262 +b
1261 +b
1263 +b
1262 +b
1264 diff --git a/c b/c
1263 diff --git a/c b/c
1265 new file mode 100644
1264 new file mode 100644
1266 --- /dev/null
1265 --- /dev/null
1267 +++ b/c
1266 +++ b/c
1268 @@ -0,0 +1,1 @@
1267 @@ -0,0 +1,1 @@
1269 +c
1268 +c
@@ -1,426 +1,426 b''
1 #require tic
1 #require tic
2
2
3 Set up a repo
3 Set up a repo
4
4
5 $ cp $HGRCPATH $HGRCPATH.pretest
5 $ cp $HGRCPATH $HGRCPATH.pretest
6 $ cat <<EOF >> $HGRCPATH
6 $ cat <<EOF >> $HGRCPATH
7 > [ui]
7 > [ui]
8 > interactive = true
8 > interactive = true
9 > interface = curses
9 > interface = curses
10 > [experimental]
10 > [experimental]
11 > crecordtest = testModeCommands
11 > crecordtest = testModeCommands
12 > EOF
12 > EOF
13
13
14 Record with noeol at eof (issue5268)
14 Record with noeol at eof (issue5268)
15 $ hg init noeol
15 $ hg init noeol
16 $ cd noeol
16 $ cd noeol
17 $ printf '0' > a
17 $ printf '0' > a
18 $ printf '0\n' > b
18 $ printf '0\n' > b
19 $ hg ci -Aqm initial
19 $ hg ci -Aqm initial
20 $ printf '1\n0' > a
20 $ printf '1\n0' > a
21 $ printf '1\n0\n' > b
21 $ printf '1\n0\n' > b
22 $ cat <<EOF >testModeCommands
22 $ cat <<EOF >testModeCommands
23 > c
23 > c
24 > EOF
24 > EOF
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
26 $ cd ..
26 $ cd ..
27
27
28 Normal repo
28 Normal repo
29 $ hg init a
29 $ hg init a
30 $ cd a
30 $ cd a
31
31
32 Committing some changes but stopping on the way
32 Committing some changes but stopping on the way
33
33
34 $ echo "a" > a
34 $ echo "a" > a
35 $ hg add a
35 $ hg add a
36 $ cat <<EOF >testModeCommands
36 $ cat <<EOF >testModeCommands
37 > TOGGLE
37 > TOGGLE
38 > X
38 > X
39 > EOF
39 > EOF
40 $ hg commit -i -m "a" -d "0 0"
40 $ hg commit -i -m "a" -d "0 0"
41 no changes to record
41 no changes to record
42 [1]
42 [1]
43 $ hg tip
43 $ hg tip
44 changeset: -1:000000000000
44 changeset: -1:000000000000
45 tag: tip
45 tag: tip
46 user:
46 user:
47 date: Thu Jan 01 00:00:00 1970 +0000
47 date: Thu Jan 01 00:00:00 1970 +0000
48
48
49
49
50 Committing some changes
50 Committing some changes
51
51
52 $ cat <<EOF >testModeCommands
52 $ cat <<EOF >testModeCommands
53 > X
53 > X
54 > EOF
54 > EOF
55 $ hg commit -i -m "a" -d "0 0"
55 $ hg commit -i -m "a" -d "0 0"
56 $ hg tip
56 $ hg tip
57 changeset: 0:cb9a9f314b8b
57 changeset: 0:cb9a9f314b8b
58 tag: tip
58 tag: tip
59 user: test
59 user: test
60 date: Thu Jan 01 00:00:00 1970 +0000
60 date: Thu Jan 01 00:00:00 1970 +0000
61 summary: a
61 summary: a
62
62
63 Check that commit -i works with no changes
63 Check that commit -i works with no changes
64 $ hg commit -i
64 $ hg commit -i
65 no changes to record
65 no changes to record
66 [1]
66 [1]
67
67
68 Committing only one file
68 Committing only one file
69
69
70 $ echo "a" >> a
70 $ echo "a" >> a
71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
72 $ hg add b
72 $ hg add b
73 $ cat <<EOF >testModeCommands
73 $ cat <<EOF >testModeCommands
74 > TOGGLE
74 > TOGGLE
75 > KEY_DOWN
75 > KEY_DOWN
76 > X
76 > X
77 > EOF
77 > EOF
78 $ hg commit -i -m "one file" -d "0 0"
78 $ hg commit -i -m "one file" -d "0 0"
79 $ hg tip
79 $ hg tip
80 changeset: 1:fb2705a663ea
80 changeset: 1:fb2705a663ea
81 tag: tip
81 tag: tip
82 user: test
82 user: test
83 date: Thu Jan 01 00:00:00 1970 +0000
83 date: Thu Jan 01 00:00:00 1970 +0000
84 summary: one file
84 summary: one file
85
85
86 $ hg cat -r tip a
86 $ hg cat -r tip a
87 a
87 a
88 $ cat a
88 $ cat a
89 a
89 a
90 a
90 a
91
91
92 Committing only one hunk while aborting edition of hunk
92 Committing only one hunk while aborting edition of hunk
93
93
94 - Untoggle all the hunks, go down to the second file
94 - Untoggle all the hunks, go down to the second file
95 - unfold it
95 - unfold it
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
97 - toggle the second hunk
97 - toggle the second hunk
98 - toggle on and off the amend mode (to check that it toggles off)
98 - toggle on and off the amend mode (to check that it toggles off)
99 - edit the hunk and quit the editor immediately with non-zero status
99 - edit the hunk and quit the editor immediately with non-zero status
100 - commit
100 - commit
101
101
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
103 $ echo "x" > c
103 $ echo "x" > c
104 $ cat b >> c
104 $ cat b >> c
105 $ echo "y" >> c
105 $ echo "y" >> c
106 $ mv c b
106 $ mv c b
107 $ cat <<EOF >testModeCommands
107 $ cat <<EOF >testModeCommands
108 > A
108 > A
109 > KEY_DOWN
109 > KEY_DOWN
110 > f
110 > f
111 > KEY_DOWN
111 > KEY_DOWN
112 > KEY_DOWN
112 > KEY_DOWN
113 > KEY_DOWN
113 > KEY_DOWN
114 > KEY_DOWN
114 > KEY_DOWN
115 > TOGGLE
115 > TOGGLE
116 > a
116 > a
117 > a
117 > a
118 > e
118 > e
119 > X
119 > X
120 > EOF
120 > EOF
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
122 editor ran
122 editor ran
123 $ rm editor.sh
123 $ rm editor.sh
124 $ hg tip
124 $ hg tip
125 changeset: 2:7d10dfe755a8
125 changeset: 2:7d10dfe755a8
126 tag: tip
126 tag: tip
127 user: test
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: one hunk
129 summary: one hunk
130
130
131 $ hg cat -r tip b
131 $ hg cat -r tip b
132 1
132 1
133 2
133 2
134 3
134 3
135 4
135 4
136 5
136 5
137 6
137 6
138 7
138 7
139 8
139 8
140 9
140 9
141 10
141 10
142 y
142 y
143 $ cat b
143 $ cat b
144 x
144 x
145 1
145 1
146 2
146 2
147 3
147 3
148 4
148 4
149 5
149 5
150 6
150 6
151 7
151 7
152 8
152 8
153 9
153 9
154 10
154 10
155 y
155 y
156 $ hg commit -m "other hunks"
156 $ hg commit -m "other hunks"
157 $ hg tip
157 $ hg tip
158 changeset: 3:a6735021574d
158 changeset: 3:a6735021574d
159 tag: tip
159 tag: tip
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: other hunks
162 summary: other hunks
163
163
164 $ hg cat -r tip b
164 $ hg cat -r tip b
165 x
165 x
166 1
166 1
167 2
167 2
168 3
168 3
169 4
169 4
170 5
170 5
171 6
171 6
172 7
172 7
173 8
173 8
174 9
174 9
175 10
175 10
176 y
176 y
177
177
178 Newly added files can be selected with the curses interface
178 Newly added files can be selected with the curses interface
179
179
180 $ hg update -C .
180 $ hg update -C .
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 $ echo "hello" > x
182 $ echo "hello" > x
183 $ hg add x
183 $ hg add x
184 $ cat <<EOF >testModeCommands
184 $ cat <<EOF >testModeCommands
185 > TOGGLE
185 > TOGGLE
186 > TOGGLE
186 > TOGGLE
187 > X
187 > X
188 > EOF
188 > EOF
189 $ hg st
189 $ hg st
190 A x
190 A x
191 ? testModeCommands
191 ? testModeCommands
192 $ hg commit -i -m "newly added file" -d "0 0"
192 $ hg commit -i -m "newly added file" -d "0 0"
193 $ hg st
193 $ hg st
194 ? testModeCommands
194 ? testModeCommands
195
195
196 Amend option works
196 Amend option works
197 $ echo "hello world" > x
197 $ echo "hello world" > x
198 $ hg diff -c .
198 $ hg diff -c .
199 diff -r a6735021574d -r 2b0e9be4d336 x
199 diff -r a6735021574d -r 2b0e9be4d336 x
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
202 @@ -0,0 +1,1 @@
202 @@ -0,0 +1,1 @@
203 +hello
203 +hello
204 $ cat <<EOF >testModeCommands
204 $ cat <<EOF >testModeCommands
205 > a
205 > a
206 > X
206 > X
207 > EOF
207 > EOF
208 $ hg commit -i -m "newly added file" -d "0 0"
208 $ hg commit -i -m "newly added file" -d "0 0"
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend.hg (glob)
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg (glob)
210 $ hg diff -c .
210 $ hg diff -c .
211 diff -r a6735021574d -r c1d239d165ae x
211 diff -r a6735021574d -r c1d239d165ae x
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
214 @@ -0,0 +1,1 @@
214 @@ -0,0 +1,1 @@
215 +hello world
215 +hello world
216
216
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
218 To do that, we change two lines in a file, pretend to edit the second line,
218 To do that, we change two lines in a file, pretend to edit the second line,
219 exit, toggle the line selected at the end of the edit and commit.
219 exit, toggle the line selected at the end of the edit and commit.
220 The first line should be recorded if we were put on the second line at the end
220 The first line should be recorded if we were put on the second line at the end
221 of the edit.
221 of the edit.
222
222
223 $ hg update -C .
223 $ hg update -C .
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 $ echo "foo" > x
225 $ echo "foo" > x
226 $ echo "hello world" >> x
226 $ echo "hello world" >> x
227 $ echo "bar" >> x
227 $ echo "bar" >> x
228 $ cat <<EOF >testModeCommands
228 $ cat <<EOF >testModeCommands
229 > f
229 > f
230 > KEY_DOWN
230 > KEY_DOWN
231 > KEY_DOWN
231 > KEY_DOWN
232 > KEY_DOWN
232 > KEY_DOWN
233 > KEY_DOWN
233 > KEY_DOWN
234 > e
234 > e
235 > TOGGLE
235 > TOGGLE
236 > X
236 > X
237 > EOF
237 > EOF
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
240 editor ran
240 editor ran
241 $ hg cat -r . x
241 $ hg cat -r . x
242 foo
242 foo
243 hello world
243 hello world
244
244
245 Testing the review option. The entire final filtered patch should show
245 Testing the review option. The entire final filtered patch should show
246 up in the editor and be editable. We will unselect the second file and
246 up in the editor and be editable. We will unselect the second file and
247 the first hunk of the third file. During review, we will decide that
247 the first hunk of the third file. During review, we will decide that
248 "lower" sounds better than "bottom", and the final commit should
248 "lower" sounds better than "bottom", and the final commit should
249 reflect this edition.
249 reflect this edition.
250
250
251 $ hg update -C .
251 $ hg update -C .
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 $ echo "top" > c
253 $ echo "top" > c
254 $ cat x >> c
254 $ cat x >> c
255 $ echo "bottom" >> c
255 $ echo "bottom" >> c
256 $ mv c x
256 $ mv c x
257 $ echo "third a" >> a
257 $ echo "third a" >> a
258 $ echo "we will unselect this" >> b
258 $ echo "we will unselect this" >> b
259
259
260 $ cat > editor.sh <<EOF
260 $ cat > editor.sh <<EOF
261 > cat "\$1"
261 > cat "\$1"
262 > cat "\$1" | sed s/bottom/lower/ > tmp
262 > cat "\$1" | sed s/bottom/lower/ > tmp
263 > mv tmp "\$1"
263 > mv tmp "\$1"
264 > EOF
264 > EOF
265 $ cat > testModeCommands <<EOF
265 $ cat > testModeCommands <<EOF
266 > KEY_DOWN
266 > KEY_DOWN
267 > TOGGLE
267 > TOGGLE
268 > KEY_DOWN
268 > KEY_DOWN
269 > f
269 > f
270 > KEY_DOWN
270 > KEY_DOWN
271 > TOGGLE
271 > TOGGLE
272 > R
272 > R
273 > EOF
273 > EOF
274
274
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
276 # To remove '-' lines, make them ' ' lines (context).
276 # To remove '-' lines, make them ' ' lines (context).
277 # To remove '+' lines, delete them.
277 # To remove '+' lines, delete them.
278 # Lines starting with # will be removed from the patch.
278 # Lines starting with # will be removed from the patch.
279 #
279 #
280 # If the patch applies cleanly, the edited patch will immediately
280 # If the patch applies cleanly, the edited patch will immediately
281 # be finalised. If it does not apply cleanly, rejects files will be
281 # be finalised. If it does not apply cleanly, rejects files will be
282 # generated. You can use those when you try again.
282 # generated. You can use those when you try again.
283 diff --git a/a b/a
283 diff --git a/a b/a
284 --- a/a
284 --- a/a
285 +++ b/a
285 +++ b/a
286 @@ -1,2 +1,3 @@
286 @@ -1,2 +1,3 @@
287 a
287 a
288 a
288 a
289 +third a
289 +third a
290 diff --git a/x b/x
290 diff --git a/x b/x
291 --- a/x
291 --- a/x
292 +++ b/x
292 +++ b/x
293 @@ -1,2 +1,3 @@
293 @@ -1,2 +1,3 @@
294 foo
294 foo
295 hello world
295 hello world
296 +bottom
296 +bottom
297
297
298 $ hg cat -r . a
298 $ hg cat -r . a
299 a
299 a
300 a
300 a
301 third a
301 third a
302
302
303 $ hg cat -r . b
303 $ hg cat -r . b
304 x
304 x
305 1
305 1
306 2
306 2
307 3
307 3
308 4
308 4
309 5
309 5
310 6
310 6
311 7
311 7
312 8
312 8
313 9
313 9
314 10
314 10
315 y
315 y
316
316
317 $ hg cat -r . x
317 $ hg cat -r . x
318 foo
318 foo
319 hello world
319 hello world
320 lower
320 lower
321
321
322 Check spacemovesdown
322 Check spacemovesdown
323
323
324 $ cat <<EOF >> $HGRCPATH
324 $ cat <<EOF >> $HGRCPATH
325 > [experimental]
325 > [experimental]
326 > spacemovesdown = true
326 > spacemovesdown = true
327 > EOF
327 > EOF
328 $ cat <<EOF >testModeCommands
328 $ cat <<EOF >testModeCommands
329 > TOGGLE
329 > TOGGLE
330 > TOGGLE
330 > TOGGLE
331 > X
331 > X
332 > EOF
332 > EOF
333 $ hg status -q
333 $ hg status -q
334 M b
334 M b
335 M x
335 M x
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
337 no changes to record
337 no changes to record
338 [1]
338 [1]
339
339
340 Check ui.interface logic for the chunkselector
340 Check ui.interface logic for the chunkselector
341
341
342 The default interface is text
342 The default interface is text
343 $ cp $HGRCPATH.pretest $HGRCPATH
343 $ cp $HGRCPATH.pretest $HGRCPATH
344 $ chunkselectorinterface() {
344 $ chunkselectorinterface() {
345 > $PYTHON <<EOF
345 > $PYTHON <<EOF
346 > from mercurial import hg, ui;\
346 > from mercurial import hg, ui;\
347 > repo = hg.repository(ui.ui.load(), ".");\
347 > repo = hg.repository(ui.ui.load(), ".");\
348 > print(repo.ui.interface("chunkselector"))
348 > print(repo.ui.interface("chunkselector"))
349 > EOF
349 > EOF
350 > }
350 > }
351 $ chunkselectorinterface
351 $ chunkselectorinterface
352 text
352 text
353
353
354 If only the default is set, we'll use that for the feature, too
354 If only the default is set, we'll use that for the feature, too
355 $ cp $HGRCPATH.pretest $HGRCPATH
355 $ cp $HGRCPATH.pretest $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
357 > [ui]
357 > [ui]
358 > interface = curses
358 > interface = curses
359 > EOF
359 > EOF
360 $ chunkselectorinterface
360 $ chunkselectorinterface
361 curses
361 curses
362
362
363 It is possible to override the default interface with a feature specific
363 It is possible to override the default interface with a feature specific
364 interface
364 interface
365 $ cp $HGRCPATH.pretest $HGRCPATH
365 $ cp $HGRCPATH.pretest $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
367 > [ui]
367 > [ui]
368 > interface = text
368 > interface = text
369 > interface.chunkselector = curses
369 > interface.chunkselector = curses
370 > EOF
370 > EOF
371
371
372 $ chunkselectorinterface
372 $ chunkselectorinterface
373 curses
373 curses
374
374
375 $ cp $HGRCPATH.pretest $HGRCPATH
375 $ cp $HGRCPATH.pretest $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
377 > [ui]
377 > [ui]
378 > interface = curses
378 > interface = curses
379 > interface.chunkselector = text
379 > interface.chunkselector = text
380 > EOF
380 > EOF
381
381
382 $ chunkselectorinterface
382 $ chunkselectorinterface
383 text
383 text
384
384
385 If a bad interface name is given, we use the default value (with a nice
385 If a bad interface name is given, we use the default value (with a nice
386 error message to suggest that the configuration needs to be fixed)
386 error message to suggest that the configuration needs to be fixed)
387
387
388 $ cp $HGRCPATH.pretest $HGRCPATH
388 $ cp $HGRCPATH.pretest $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
390 > [ui]
390 > [ui]
391 > interface = blah
391 > interface = blah
392 > EOF
392 > EOF
393 $ chunkselectorinterface
393 $ chunkselectorinterface
394 invalid value for ui.interface: blah (using text)
394 invalid value for ui.interface: blah (using text)
395 text
395 text
396
396
397 $ cp $HGRCPATH.pretest $HGRCPATH
397 $ cp $HGRCPATH.pretest $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
399 > [ui]
399 > [ui]
400 > interface = curses
400 > interface = curses
401 > interface.chunkselector = blah
401 > interface.chunkselector = blah
402 > EOF
402 > EOF
403 $ chunkselectorinterface
403 $ chunkselectorinterface
404 invalid value for ui.interface.chunkselector: blah (using curses)
404 invalid value for ui.interface.chunkselector: blah (using curses)
405 curses
405 curses
406
406
407 $ cp $HGRCPATH.pretest $HGRCPATH
407 $ cp $HGRCPATH.pretest $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
409 > [ui]
409 > [ui]
410 > interface = blah
410 > interface = blah
411 > interface.chunkselector = curses
411 > interface.chunkselector = curses
412 > EOF
412 > EOF
413 $ chunkselectorinterface
413 $ chunkselectorinterface
414 invalid value for ui.interface: blah
414 invalid value for ui.interface: blah
415 curses
415 curses
416
416
417 $ cp $HGRCPATH.pretest $HGRCPATH
417 $ cp $HGRCPATH.pretest $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
419 > [ui]
419 > [ui]
420 > interface = blah
420 > interface = blah
421 > interface.chunkselector = blah
421 > interface.chunkselector = blah
422 > EOF
422 > EOF
423 $ chunkselectorinterface
423 $ chunkselectorinterface
424 invalid value for ui.interface: blah
424 invalid value for ui.interface: blah
425 invalid value for ui.interface.chunkselector: blah (using text)
425 invalid value for ui.interface.chunkselector: blah (using text)
426 text
426 text
@@ -1,578 +1,576 b''
1 $ . "$TESTDIR/histedit-helpers.sh"
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 Enable obsolete
3 Enable obsolete
4
4
5 $ cat >> $HGRCPATH << EOF
5 $ cat >> $HGRCPATH << EOF
6 > [ui]
6 > [ui]
7 > logtemplate= {rev}:{node|short} {desc|firstline}
7 > logtemplate= {rev}:{node|short} {desc|firstline}
8 > [phases]
8 > [phases]
9 > publish=False
9 > publish=False
10 > [experimental]
10 > [experimental]
11 > stabilization=createmarkers,allowunstable
11 > stabilization=createmarkers,allowunstable
12 > [extensions]
12 > [extensions]
13 > histedit=
13 > histedit=
14 > rebase=
14 > rebase=
15 > EOF
15 > EOF
16
16
17 Test that histedit learns about obsolescence not stored in histedit state
17 Test that histedit learns about obsolescence not stored in histedit state
18 $ hg init boo
18 $ hg init boo
19 $ cd boo
19 $ cd boo
20 $ echo a > a
20 $ echo a > a
21 $ hg ci -Am a
21 $ hg ci -Am a
22 adding a
22 adding a
23 $ echo a > b
23 $ echo a > b
24 $ echo a > c
24 $ echo a > c
25 $ echo a > c
25 $ echo a > c
26 $ hg ci -Am b
26 $ hg ci -Am b
27 adding b
27 adding b
28 adding c
28 adding c
29 $ echo a > d
29 $ echo a > d
30 $ hg ci -Am c
30 $ hg ci -Am c
31 adding d
31 adding d
32 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
32 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
33 $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan
33 $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan
34 $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
34 $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
35 $ hg histedit -r 'all()' --commands plan
35 $ hg histedit -r 'all()' --commands plan
36 Editing (1b2d564fad96), you may commit or record as needed now.
36 Editing (1b2d564fad96), you may commit or record as needed now.
37 (hg histedit --continue to resume)
37 (hg histedit --continue to resume)
38 [1]
38 [1]
39 $ hg st
39 $ hg st
40 A b
40 A b
41 A c
41 A c
42 ? plan
42 ? plan
43 $ hg commit --amend b
43 $ hg commit --amend b
44 $ hg histedit --continue
44 $ hg histedit --continue
45 $ hg log -G
45 $ hg log -G
46 @ 6:46abc7c4d873 b
46 @ 5:46abc7c4d873 b
47 |
47 |
48 o 5:49d44ab2be1b c
48 o 4:49d44ab2be1b c
49 |
49 |
50 o 0:cb9a9f314b8b a
50 o 0:cb9a9f314b8b a
51
51
52 $ hg debugobsolete
52 $ hg debugobsolete
53 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
53 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
54 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob)
55 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
54 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
56 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
55 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
57
56
58 With some node gone missing during the edit.
57 With some node gone missing during the edit.
59
58
60 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
59 $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan
61 $ echo "pick `hg log -r 6 -T '{node|short}'`" >> plan
60 $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan
62 $ echo "edit `hg log -r 5 -T '{node|short}'`" >> plan
61 $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan
63 $ hg histedit -r 'all()' --commands plan
62 $ hg histedit -r 'all()' --commands plan
64 Editing (49d44ab2be1b), you may commit or record as needed now.
63 Editing (49d44ab2be1b), you may commit or record as needed now.
65 (hg histedit --continue to resume)
64 (hg histedit --continue to resume)
66 [1]
65 [1]
67 $ hg st
66 $ hg st
68 A b
67 A b
69 A d
68 A d
70 ? plan
69 ? plan
71 $ hg commit --amend -X . -m XXXXXX
70 $ hg commit --amend -X . -m XXXXXX
72 $ hg commit --amend -X . -m b2
71 $ hg commit --amend -X . -m b2
73 $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
72 $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
74 $ hg histedit --continue
73 $ hg histedit --continue
75 $ hg log -G
74 $ hg log -G
76 @ 9:273c1f3b8626 c
75 @ 8:273c1f3b8626 c
77 |
76 |
78 o 8:aba7da937030 b2
77 o 7:aba7da937030 b2
79 |
78 |
80 o 0:cb9a9f314b8b a
79 o 0:cb9a9f314b8b a
81
80
82 $ hg debugobsolete
81 $ hg debugobsolete
83 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
82 e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
84 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob)
85 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
83 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob)
86 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
84 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob)
87 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (*) {'user': 'test'} (glob)
85 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (*) {'user': 'test'} (glob)
88 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
86 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
89 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (*) {'user': 'test'} (glob)
87 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (*) {'user': 'test'} (glob)
90 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
88 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (*) {'user': 'test'} (glob)
91 $ cd ..
89 $ cd ..
92
90
93 Base setup for the rest of the testing
91 Base setup for the rest of the testing
94 ======================================
92 ======================================
95
93
96 $ hg init base
94 $ hg init base
97 $ cd base
95 $ cd base
98
96
99 $ for x in a b c d e f ; do
97 $ for x in a b c d e f ; do
100 > echo $x > $x
98 > echo $x > $x
101 > hg add $x
99 > hg add $x
102 > hg ci -m $x
100 > hg ci -m $x
103 > done
101 > done
104
102
105 $ hg log --graph
103 $ hg log --graph
106 @ 5:652413bf663e f
104 @ 5:652413bf663e f
107 |
105 |
108 o 4:e860deea161a e
106 o 4:e860deea161a e
109 |
107 |
110 o 3:055a42cdd887 d
108 o 3:055a42cdd887 d
111 |
109 |
112 o 2:177f92b77385 c
110 o 2:177f92b77385 c
113 |
111 |
114 o 1:d2ae7f538514 b
112 o 1:d2ae7f538514 b
115 |
113 |
116 o 0:cb9a9f314b8b a
114 o 0:cb9a9f314b8b a
117
115
118
116
119 $ HGEDITOR=cat hg histedit 1
117 $ HGEDITOR=cat hg histedit 1
120 pick d2ae7f538514 1 b
118 pick d2ae7f538514 1 b
121 pick 177f92b77385 2 c
119 pick 177f92b77385 2 c
122 pick 055a42cdd887 3 d
120 pick 055a42cdd887 3 d
123 pick e860deea161a 4 e
121 pick e860deea161a 4 e
124 pick 652413bf663e 5 f
122 pick 652413bf663e 5 f
125
123
126 # Edit history between d2ae7f538514 and 652413bf663e
124 # Edit history between d2ae7f538514 and 652413bf663e
127 #
125 #
128 # Commits are listed from least to most recent
126 # Commits are listed from least to most recent
129 #
127 #
130 # You can reorder changesets by reordering the lines
128 # You can reorder changesets by reordering the lines
131 #
129 #
132 # Commands:
130 # Commands:
133 #
131 #
134 # e, edit = use commit, but stop for amending
132 # e, edit = use commit, but stop for amending
135 # m, mess = edit commit message without changing commit content
133 # m, mess = edit commit message without changing commit content
136 # p, pick = use commit
134 # p, pick = use commit
137 # d, drop = remove commit from history
135 # d, drop = remove commit from history
138 # f, fold = use commit, but combine it with the one above
136 # f, fold = use commit, but combine it with the one above
139 # r, roll = like fold, but discard this commit's description and date
137 # r, roll = like fold, but discard this commit's description and date
140 #
138 #
141 $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
139 $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
142 > pick 177f92b77385 2 c
140 > pick 177f92b77385 2 c
143 > drop d2ae7f538514 1 b
141 > drop d2ae7f538514 1 b
144 > pick 055a42cdd887 3 d
142 > pick 055a42cdd887 3 d
145 > fold e860deea161a 4 e
143 > fold e860deea161a 4 e
146 > pick 652413bf663e 5 f
144 > pick 652413bf663e 5 f
147 > EOF
145 > EOF
148 [1]
146 [1]
149 $ hg log --graph --hidden
147 $ hg log --graph --hidden
150 @ 10:cacdfd884a93 f
148 @ 10:cacdfd884a93 f
151 |
149 |
152 o 9:59d9f330561f d
150 o 9:59d9f330561f d
153 |
151 |
154 | x 8:b558abc46d09 fold-temp-revision e860deea161a
152 | x 8:b558abc46d09 fold-temp-revision e860deea161a
155 | |
153 | |
156 | x 7:96e494a2d553 d
154 | x 7:96e494a2d553 d
157 |/
155 |/
158 o 6:b346ab9a313d c
156 o 6:b346ab9a313d c
159 |
157 |
160 | x 5:652413bf663e f
158 | x 5:652413bf663e f
161 | |
159 | |
162 | x 4:e860deea161a e
160 | x 4:e860deea161a e
163 | |
161 | |
164 | x 3:055a42cdd887 d
162 | x 3:055a42cdd887 d
165 | |
163 | |
166 | x 2:177f92b77385 c
164 | x 2:177f92b77385 c
167 | |
165 | |
168 | x 1:d2ae7f538514 b
166 | x 1:d2ae7f538514 b
169 |/
167 |/
170 o 0:cb9a9f314b8b a
168 o 0:cb9a9f314b8b a
171
169
172 $ hg debugobsolete
170 $ hg debugobsolete
173 d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (*) {'user': 'test'} (glob)
171 d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (*) {'user': 'test'} (glob)
174 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (*) {'user': 'test'} (glob)
172 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (*) {'user': 'test'} (glob)
175 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
173 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
176 e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
174 e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (*) {'user': 'test'} (glob)
177 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob)
175 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (*) {'user': 'test'} (glob)
178 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
176 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (*) {'user': 'test'} (glob)
179 b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
177 b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (*) {'user': 'test'} (glob)
180
178
181
179
182 Ensure hidden revision does not prevent histedit
180 Ensure hidden revision does not prevent histedit
183 -------------------------------------------------
181 -------------------------------------------------
184
182
185 create an hidden revision
183 create an hidden revision
186
184
187 $ hg histedit 6 --commands - << EOF
185 $ hg histedit 6 --commands - << EOF
188 > pick b346ab9a313d 6 c
186 > pick b346ab9a313d 6 c
189 > drop 59d9f330561f 7 d
187 > drop 59d9f330561f 7 d
190 > pick cacdfd884a93 8 f
188 > pick cacdfd884a93 8 f
191 > EOF
189 > EOF
192 $ hg log --graph
190 $ hg log --graph
193 @ 11:c13eb81022ca f
191 @ 11:c13eb81022ca f
194 |
192 |
195 o 6:b346ab9a313d c
193 o 6:b346ab9a313d c
196 |
194 |
197 o 0:cb9a9f314b8b a
195 o 0:cb9a9f314b8b a
198
196
199 check hidden revision are ignored (6 have hidden children 7 and 8)
197 check hidden revision are ignored (6 have hidden children 7 and 8)
200
198
201 $ hg histedit 6 --commands - << EOF
199 $ hg histedit 6 --commands - << EOF
202 > pick b346ab9a313d 6 c
200 > pick b346ab9a313d 6 c
203 > pick c13eb81022ca 8 f
201 > pick c13eb81022ca 8 f
204 > EOF
202 > EOF
205
203
206
204
207
205
208 Test that rewriting leaving instability behind is allowed
206 Test that rewriting leaving instability behind is allowed
209 ---------------------------------------------------------------------
207 ---------------------------------------------------------------------
210
208
211 $ hg up '.^'
209 $ hg up '.^'
212 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
210 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
213 $ hg log -r 'children(.)'
211 $ hg log -r 'children(.)'
214 11:c13eb81022ca f (no-eol)
212 11:c13eb81022ca f (no-eol)
215 $ hg histedit -r '.' --commands - <<EOF
213 $ hg histedit -r '.' --commands - <<EOF
216 > edit b346ab9a313d 6 c
214 > edit b346ab9a313d 6 c
217 > EOF
215 > EOF
218 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
216 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
219 adding c
217 adding c
220 Editing (b346ab9a313d), you may commit or record as needed now.
218 Editing (b346ab9a313d), you may commit or record as needed now.
221 (hg histedit --continue to resume)
219 (hg histedit --continue to resume)
222 [1]
220 [1]
223 $ echo c >> c
221 $ echo c >> c
224 $ hg histedit --continue
222 $ hg histedit --continue
225
223
226 $ hg log -r 'orphan()'
224 $ hg log -r 'orphan()'
227 11:c13eb81022ca f (no-eol)
225 11:c13eb81022ca f (no-eol)
228
226
229 stabilise
227 stabilise
230
228
231 $ hg rebase -r 'orphan()' -d .
229 $ hg rebase -r 'orphan()' -d .
232 rebasing 11:c13eb81022ca "f"
230 rebasing 11:c13eb81022ca "f"
233 $ hg up tip -q
231 $ hg up tip -q
234
232
235 Test dropping of changeset on the top of the stack
233 Test dropping of changeset on the top of the stack
236 -------------------------------------------------------
234 -------------------------------------------------------
237
235
238 Nothing is rewritten below, the working directory parent must be change for the
236 Nothing is rewritten below, the working directory parent must be change for the
239 dropped changeset to be hidden.
237 dropped changeset to be hidden.
240
238
241 $ cd ..
239 $ cd ..
242 $ hg clone base droplast
240 $ hg clone base droplast
243 updating to branch default
241 updating to branch default
244 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 $ cd droplast
243 $ cd droplast
246 $ hg histedit -r '40db8afa467b' --commands - << EOF
244 $ hg histedit -r '40db8afa467b' --commands - << EOF
247 > pick 40db8afa467b 10 c
245 > pick 40db8afa467b 10 c
248 > drop b449568bf7fc 11 f
246 > drop b449568bf7fc 11 f
249 > EOF
247 > EOF
250 $ hg log -G
248 $ hg log -G
251 @ 12:40db8afa467b c
249 @ 12:40db8afa467b c
252 |
250 |
253 o 0:cb9a9f314b8b a
251 o 0:cb9a9f314b8b a
254
252
255
253
256 With rewritten ancestors
254 With rewritten ancestors
257
255
258 $ echo e > e
256 $ echo e > e
259 $ hg add e
257 $ hg add e
260 $ hg commit -m g
258 $ hg commit -m g
261 $ echo f > f
259 $ echo f > f
262 $ hg add f
260 $ hg add f
263 $ hg commit -m h
261 $ hg commit -m h
264 $ hg histedit -r '40db8afa467b' --commands - << EOF
262 $ hg histedit -r '40db8afa467b' --commands - << EOF
265 > pick 47a8561c0449 12 g
263 > pick 47a8561c0449 12 g
266 > pick 40db8afa467b 10 c
264 > pick 40db8afa467b 10 c
267 > drop 1b3b05f35ff0 13 h
265 > drop 1b3b05f35ff0 13 h
268 > EOF
266 > EOF
269 $ hg log -G
267 $ hg log -G
270 @ 17:ee6544123ab8 c
268 @ 17:ee6544123ab8 c
271 |
269 |
272 o 16:269e713e9eae g
270 o 16:269e713e9eae g
273 |
271 |
274 o 0:cb9a9f314b8b a
272 o 0:cb9a9f314b8b a
275
273
276 $ cd ../base
274 $ cd ../base
277
275
278
276
279
277
280 Test phases support
278 Test phases support
281 ===========================================
279 ===========================================
282
280
283 Check that histedit respect immutability
281 Check that histedit respect immutability
284 -------------------------------------------
282 -------------------------------------------
285
283
286 $ cat >> $HGRCPATH << EOF
284 $ cat >> $HGRCPATH << EOF
287 > [ui]
285 > [ui]
288 > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
286 > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
289 > EOF
287 > EOF
290
288
291 $ hg ph -pv '.^'
289 $ hg ph -pv '.^'
292 phase changed for 2 changesets
290 phase changed for 2 changesets
293 $ hg log -G
291 $ hg log -G
294 @ 13:b449568bf7fc (draft) f
292 @ 13:b449568bf7fc (draft) f
295 |
293 |
296 o 12:40db8afa467b (public) c
294 o 12:40db8afa467b (public) c
297 |
295 |
298 o 0:cb9a9f314b8b (public) a
296 o 0:cb9a9f314b8b (public) a
299
297
300 $ hg histedit -r '.~2'
298 $ hg histedit -r '.~2'
301 abort: cannot edit public changeset: cb9a9f314b8b
299 abort: cannot edit public changeset: cb9a9f314b8b
302 (see 'hg help phases' for details)
300 (see 'hg help phases' for details)
303 [255]
301 [255]
304
302
305
303
306 Prepare further testing
304 Prepare further testing
307 -------------------------------------------
305 -------------------------------------------
308
306
309 $ for x in g h i j k ; do
307 $ for x in g h i j k ; do
310 > echo $x > $x
308 > echo $x > $x
311 > hg add $x
309 > hg add $x
312 > hg ci -m $x
310 > hg ci -m $x
313 > done
311 > done
314 $ hg phase --force --secret .~2
312 $ hg phase --force --secret .~2
315 $ hg log -G
313 $ hg log -G
316 @ 18:ee118ab9fa44 (secret) k
314 @ 18:ee118ab9fa44 (secret) k
317 |
315 |
318 o 17:3a6c53ee7f3d (secret) j
316 o 17:3a6c53ee7f3d (secret) j
319 |
317 |
320 o 16:b605fb7503f2 (secret) i
318 o 16:b605fb7503f2 (secret) i
321 |
319 |
322 o 15:7395e1ff83bd (draft) h
320 o 15:7395e1ff83bd (draft) h
323 |
321 |
324 o 14:6b70183d2492 (draft) g
322 o 14:6b70183d2492 (draft) g
325 |
323 |
326 o 13:b449568bf7fc (draft) f
324 o 13:b449568bf7fc (draft) f
327 |
325 |
328 o 12:40db8afa467b (public) c
326 o 12:40db8afa467b (public) c
329 |
327 |
330 o 0:cb9a9f314b8b (public) a
328 o 0:cb9a9f314b8b (public) a
331
329
332 $ cd ..
330 $ cd ..
333
331
334 simple phase conservation
332 simple phase conservation
335 -------------------------------------------
333 -------------------------------------------
336
334
337 Resulting changeset should conserve the phase of the original one whatever the
335 Resulting changeset should conserve the phase of the original one whatever the
338 phases.new-commit option is.
336 phases.new-commit option is.
339
337
340 New-commit as draft (default)
338 New-commit as draft (default)
341
339
342 $ cp -R base simple-draft
340 $ cp -R base simple-draft
343 $ cd simple-draft
341 $ cd simple-draft
344 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
342 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
345 > edit b449568bf7fc 11 f
343 > edit b449568bf7fc 11 f
346 > pick 6b70183d2492 12 g
344 > pick 6b70183d2492 12 g
347 > pick 7395e1ff83bd 13 h
345 > pick 7395e1ff83bd 13 h
348 > pick b605fb7503f2 14 i
346 > pick b605fb7503f2 14 i
349 > pick 3a6c53ee7f3d 15 j
347 > pick 3a6c53ee7f3d 15 j
350 > pick ee118ab9fa44 16 k
348 > pick ee118ab9fa44 16 k
351 > EOF
349 > EOF
352 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
350 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
353 adding f
351 adding f
354 Editing (b449568bf7fc), you may commit or record as needed now.
352 Editing (b449568bf7fc), you may commit or record as needed now.
355 (hg histedit --continue to resume)
353 (hg histedit --continue to resume)
356 [1]
354 [1]
357 $ echo f >> f
355 $ echo f >> f
358 $ hg histedit --continue
356 $ hg histedit --continue
359 $ hg log -G
357 $ hg log -G
360 @ 24:12e89af74238 (secret) k
358 @ 24:12e89af74238 (secret) k
361 |
359 |
362 o 23:636a8687b22e (secret) j
360 o 23:636a8687b22e (secret) j
363 |
361 |
364 o 22:ccaf0a38653f (secret) i
362 o 22:ccaf0a38653f (secret) i
365 |
363 |
366 o 21:11a89d1c2613 (draft) h
364 o 21:11a89d1c2613 (draft) h
367 |
365 |
368 o 20:c1dec7ca82ea (draft) g
366 o 20:c1dec7ca82ea (draft) g
369 |
367 |
370 o 19:087281e68428 (draft) f
368 o 19:087281e68428 (draft) f
371 |
369 |
372 o 12:40db8afa467b (public) c
370 o 12:40db8afa467b (public) c
373 |
371 |
374 o 0:cb9a9f314b8b (public) a
372 o 0:cb9a9f314b8b (public) a
375
373
376 $ cd ..
374 $ cd ..
377
375
378
376
379 New-commit as secret (config)
377 New-commit as secret (config)
380
378
381 $ cp -R base simple-secret
379 $ cp -R base simple-secret
382 $ cd simple-secret
380 $ cd simple-secret
383 $ cat >> .hg/hgrc << EOF
381 $ cat >> .hg/hgrc << EOF
384 > [phases]
382 > [phases]
385 > new-commit=secret
383 > new-commit=secret
386 > EOF
384 > EOF
387 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
385 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
388 > edit b449568bf7fc 11 f
386 > edit b449568bf7fc 11 f
389 > pick 6b70183d2492 12 g
387 > pick 6b70183d2492 12 g
390 > pick 7395e1ff83bd 13 h
388 > pick 7395e1ff83bd 13 h
391 > pick b605fb7503f2 14 i
389 > pick b605fb7503f2 14 i
392 > pick 3a6c53ee7f3d 15 j
390 > pick 3a6c53ee7f3d 15 j
393 > pick ee118ab9fa44 16 k
391 > pick ee118ab9fa44 16 k
394 > EOF
392 > EOF
395 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
393 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
396 adding f
394 adding f
397 Editing (b449568bf7fc), you may commit or record as needed now.
395 Editing (b449568bf7fc), you may commit or record as needed now.
398 (hg histedit --continue to resume)
396 (hg histedit --continue to resume)
399 [1]
397 [1]
400 $ echo f >> f
398 $ echo f >> f
401 $ hg histedit --continue
399 $ hg histedit --continue
402 $ hg log -G
400 $ hg log -G
403 @ 24:12e89af74238 (secret) k
401 @ 24:12e89af74238 (secret) k
404 |
402 |
405 o 23:636a8687b22e (secret) j
403 o 23:636a8687b22e (secret) j
406 |
404 |
407 o 22:ccaf0a38653f (secret) i
405 o 22:ccaf0a38653f (secret) i
408 |
406 |
409 o 21:11a89d1c2613 (draft) h
407 o 21:11a89d1c2613 (draft) h
410 |
408 |
411 o 20:c1dec7ca82ea (draft) g
409 o 20:c1dec7ca82ea (draft) g
412 |
410 |
413 o 19:087281e68428 (draft) f
411 o 19:087281e68428 (draft) f
414 |
412 |
415 o 12:40db8afa467b (public) c
413 o 12:40db8afa467b (public) c
416 |
414 |
417 o 0:cb9a9f314b8b (public) a
415 o 0:cb9a9f314b8b (public) a
418
416
419 $ cd ..
417 $ cd ..
420
418
421
419
422 Changeset reordering
420 Changeset reordering
423 -------------------------------------------
421 -------------------------------------------
424
422
425 If a secret changeset is put before a draft one, all descendant should be secret.
423 If a secret changeset is put before a draft one, all descendant should be secret.
426 It seems more important to present the secret phase.
424 It seems more important to present the secret phase.
427
425
428 $ cp -R base reorder
426 $ cp -R base reorder
429 $ cd reorder
427 $ cd reorder
430 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
428 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
431 > pick b449568bf7fc 11 f
429 > pick b449568bf7fc 11 f
432 > pick 3a6c53ee7f3d 15 j
430 > pick 3a6c53ee7f3d 15 j
433 > pick 6b70183d2492 12 g
431 > pick 6b70183d2492 12 g
434 > pick b605fb7503f2 14 i
432 > pick b605fb7503f2 14 i
435 > pick 7395e1ff83bd 13 h
433 > pick 7395e1ff83bd 13 h
436 > pick ee118ab9fa44 16 k
434 > pick ee118ab9fa44 16 k
437 > EOF
435 > EOF
438 $ hg log -G
436 $ hg log -G
439 @ 23:558246857888 (secret) k
437 @ 23:558246857888 (secret) k
440 |
438 |
441 o 22:28bd44768535 (secret) h
439 o 22:28bd44768535 (secret) h
442 |
440 |
443 o 21:d5395202aeb9 (secret) i
441 o 21:d5395202aeb9 (secret) i
444 |
442 |
445 o 20:21edda8e341b (secret) g
443 o 20:21edda8e341b (secret) g
446 |
444 |
447 o 19:5ab64f3a4832 (secret) j
445 o 19:5ab64f3a4832 (secret) j
448 |
446 |
449 o 13:b449568bf7fc (draft) f
447 o 13:b449568bf7fc (draft) f
450 |
448 |
451 o 12:40db8afa467b (public) c
449 o 12:40db8afa467b (public) c
452 |
450 |
453 o 0:cb9a9f314b8b (public) a
451 o 0:cb9a9f314b8b (public) a
454
452
455 $ cd ..
453 $ cd ..
456
454
457 Changeset folding
455 Changeset folding
458 -------------------------------------------
456 -------------------------------------------
459
457
460 Folding a secret changeset with a draft one turn the result secret (again,
458 Folding a secret changeset with a draft one turn the result secret (again,
461 better safe than sorry). Folding between same phase changeset still works
459 better safe than sorry). Folding between same phase changeset still works
462
460
463 Note that there is a few reordering in this series for more extensive test
461 Note that there is a few reordering in this series for more extensive test
464
462
465 $ cp -R base folding
463 $ cp -R base folding
466 $ cd folding
464 $ cd folding
467 $ cat >> .hg/hgrc << EOF
465 $ cat >> .hg/hgrc << EOF
468 > [phases]
466 > [phases]
469 > new-commit=secret
467 > new-commit=secret
470 > EOF
468 > EOF
471 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
469 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
472 > pick 7395e1ff83bd 13 h
470 > pick 7395e1ff83bd 13 h
473 > fold b449568bf7fc 11 f
471 > fold b449568bf7fc 11 f
474 > pick 6b70183d2492 12 g
472 > pick 6b70183d2492 12 g
475 > fold 3a6c53ee7f3d 15 j
473 > fold 3a6c53ee7f3d 15 j
476 > pick b605fb7503f2 14 i
474 > pick b605fb7503f2 14 i
477 > fold ee118ab9fa44 16 k
475 > fold ee118ab9fa44 16 k
478 > EOF
476 > EOF
479 $ hg log -G
477 $ hg log -G
480 @ 27:f9daec13fb98 (secret) i
478 @ 27:f9daec13fb98 (secret) i
481 |
479 |
482 o 24:49807617f46a (secret) g
480 o 24:49807617f46a (secret) g
483 |
481 |
484 o 21:050280826e04 (draft) h
482 o 21:050280826e04 (draft) h
485 |
483 |
486 o 12:40db8afa467b (public) c
484 o 12:40db8afa467b (public) c
487 |
485 |
488 o 0:cb9a9f314b8b (public) a
486 o 0:cb9a9f314b8b (public) a
489
487
490 $ hg co 49807617f46a
488 $ hg co 49807617f46a
491 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
489 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
492 $ echo wat >> wat
490 $ echo wat >> wat
493 $ hg add wat
491 $ hg add wat
494 $ hg ci -m 'add wat'
492 $ hg ci -m 'add wat'
495 created new head
493 created new head
496 $ hg merge f9daec13fb98
494 $ hg merge f9daec13fb98
497 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
495 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 (branch merge, don't forget to commit)
496 (branch merge, don't forget to commit)
499 $ hg ci -m 'merge'
497 $ hg ci -m 'merge'
500 $ echo not wat > wat
498 $ echo not wat > wat
501 $ hg ci -m 'modify wat'
499 $ hg ci -m 'modify wat'
502 $ hg histedit 050280826e04
500 $ hg histedit 050280826e04
503 abort: cannot edit history that contains merges
501 abort: cannot edit history that contains merges
504 [255]
502 [255]
505 $ cd ..
503 $ cd ..
506
504
507 Check abort behavior
505 Check abort behavior
508 -------------------------------------------
506 -------------------------------------------
509
507
510 We checks that abort properly clean the repository so the same histedit can be
508 We checks that abort properly clean the repository so the same histedit can be
511 attempted later.
509 attempted later.
512
510
513 $ cp -R base abort
511 $ cp -R base abort
514 $ cd abort
512 $ cd abort
515 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
513 $ hg histedit -r 'b449568bf7fc' --commands - << EOF
516 > pick b449568bf7fc 13 f
514 > pick b449568bf7fc 13 f
517 > pick 7395e1ff83bd 15 h
515 > pick 7395e1ff83bd 15 h
518 > pick 6b70183d2492 14 g
516 > pick 6b70183d2492 14 g
519 > pick b605fb7503f2 16 i
517 > pick b605fb7503f2 16 i
520 > roll 3a6c53ee7f3d 17 j
518 > roll 3a6c53ee7f3d 17 j
521 > edit ee118ab9fa44 18 k
519 > edit ee118ab9fa44 18 k
522 > EOF
520 > EOF
523 Editing (ee118ab9fa44), you may commit or record as needed now.
521 Editing (ee118ab9fa44), you may commit or record as needed now.
524 (hg histedit --continue to resume)
522 (hg histedit --continue to resume)
525 [1]
523 [1]
526
524
527 $ hg histedit --abort
525 $ hg histedit --abort
528 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
526 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
529 saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg (glob)
527 saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg (glob)
530
528
531 $ hg log -G
529 $ hg log -G
532 @ 18:ee118ab9fa44 (secret) k
530 @ 18:ee118ab9fa44 (secret) k
533 |
531 |
534 o 17:3a6c53ee7f3d (secret) j
532 o 17:3a6c53ee7f3d (secret) j
535 |
533 |
536 o 16:b605fb7503f2 (secret) i
534 o 16:b605fb7503f2 (secret) i
537 |
535 |
538 o 15:7395e1ff83bd (draft) h
536 o 15:7395e1ff83bd (draft) h
539 |
537 |
540 o 14:6b70183d2492 (draft) g
538 o 14:6b70183d2492 (draft) g
541 |
539 |
542 o 13:b449568bf7fc (draft) f
540 o 13:b449568bf7fc (draft) f
543 |
541 |
544 o 12:40db8afa467b (public) c
542 o 12:40db8afa467b (public) c
545 |
543 |
546 o 0:cb9a9f314b8b (public) a
544 o 0:cb9a9f314b8b (public) a
547
545
548 $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.stabilization.track-operation=1
546 $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.stabilization.track-operation=1
549 > pick b449568bf7fc 13 f
547 > pick b449568bf7fc 13 f
550 > pick 7395e1ff83bd 15 h
548 > pick 7395e1ff83bd 15 h
551 > pick 6b70183d2492 14 g
549 > pick 6b70183d2492 14 g
552 > pick b605fb7503f2 16 i
550 > pick b605fb7503f2 16 i
553 > pick 3a6c53ee7f3d 17 j
551 > pick 3a6c53ee7f3d 17 j
554 > edit ee118ab9fa44 18 k
552 > edit ee118ab9fa44 18 k
555 > EOF
553 > EOF
556 Editing (ee118ab9fa44), you may commit or record as needed now.
554 Editing (ee118ab9fa44), you may commit or record as needed now.
557 (hg histedit --continue to resume)
555 (hg histedit --continue to resume)
558 [1]
556 [1]
559 $ hg histedit --continue --config experimental.stabilization.track-operation=1
557 $ hg histedit --continue --config experimental.stabilization.track-operation=1
560 $ hg log -G
558 $ hg log -G
561 @ 23:175d6b286a22 (secret) k
559 @ 23:175d6b286a22 (secret) k
562 |
560 |
563 o 22:44ca09d59ae4 (secret) j
561 o 22:44ca09d59ae4 (secret) j
564 |
562 |
565 o 21:31747692a644 (secret) i
563 o 21:31747692a644 (secret) i
566 |
564 |
567 o 20:9985cd4f21fa (draft) g
565 o 20:9985cd4f21fa (draft) g
568 |
566 |
569 o 19:4dc06258baa6 (draft) h
567 o 19:4dc06258baa6 (draft) h
570 |
568 |
571 o 13:b449568bf7fc (draft) f
569 o 13:b449568bf7fc (draft) f
572 |
570 |
573 o 12:40db8afa467b (public) c
571 o 12:40db8afa467b (public) c
574 |
572 |
575 o 0:cb9a9f314b8b (public) a
573 o 0:cb9a9f314b8b (public) a
576
574
577 $ hg debugobsolete --rev .
575 $ hg debugobsolete --rev .
578 ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (*) {'operation': 'histedit', 'user': 'test'} (glob)
576 ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (*) {'operation': 'histedit', 'user': 'test'} (glob)
@@ -1,2393 +1,2393 b''
1 Log on empty repository: checking consistency
1 Log on empty repository: checking consistency
2
2
3 $ hg init empty
3 $ hg init empty
4 $ cd empty
4 $ cd empty
5 $ hg log
5 $ hg log
6 $ hg log -r 1
6 $ hg log -r 1
7 abort: unknown revision '1'!
7 abort: unknown revision '1'!
8 [255]
8 [255]
9 $ hg log -r -1:0
9 $ hg log -r -1:0
10 abort: unknown revision '-1'!
10 abort: unknown revision '-1'!
11 [255]
11 [255]
12 $ hg log -r 'branch(name)'
12 $ hg log -r 'branch(name)'
13 abort: unknown revision 'name'!
13 abort: unknown revision 'name'!
14 [255]
14 [255]
15 $ hg log -r null -q
15 $ hg log -r null -q
16 -1:000000000000
16 -1:000000000000
17
17
18 The g is crafted to have 2 filelog topological heads in a linear
18 The g is crafted to have 2 filelog topological heads in a linear
19 changeset graph
19 changeset graph
20
20
21 $ hg init a
21 $ hg init a
22 $ cd a
22 $ cd a
23 $ echo a > a
23 $ echo a > a
24 $ echo f > f
24 $ echo f > f
25 $ hg ci -Ama -d '1 0'
25 $ hg ci -Ama -d '1 0'
26 adding a
26 adding a
27 adding f
27 adding f
28
28
29 $ hg cp a b
29 $ hg cp a b
30 $ hg cp f g
30 $ hg cp f g
31 $ hg ci -mb -d '2 0'
31 $ hg ci -mb -d '2 0'
32
32
33 $ mkdir dir
33 $ mkdir dir
34 $ hg mv b dir
34 $ hg mv b dir
35 $ echo g >> g
35 $ echo g >> g
36 $ echo f >> f
36 $ echo f >> f
37 $ hg ci -mc -d '3 0'
37 $ hg ci -mc -d '3 0'
38
38
39 $ hg mv a b
39 $ hg mv a b
40 $ hg cp -f f g
40 $ hg cp -f f g
41 $ echo a > d
41 $ echo a > d
42 $ hg add d
42 $ hg add d
43 $ hg ci -md -d '4 0'
43 $ hg ci -md -d '4 0'
44
44
45 $ hg mv dir/b e
45 $ hg mv dir/b e
46 $ hg ci -me -d '5 0'
46 $ hg ci -me -d '5 0'
47
47
48 Make sure largefiles doesn't interfere with logging a regular file
48 Make sure largefiles doesn't interfere with logging a regular file
49 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
49 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
50 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
50 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
51 updated patterns: .hglf/a, a
51 updated patterns: .hglf/a, a
52 0: a
52 0: a
53 $ hg log a
53 $ hg log a
54 changeset: 0:9161b9aeaf16
54 changeset: 0:9161b9aeaf16
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:01 1970 +0000
56 date: Thu Jan 01 00:00:01 1970 +0000
57 summary: a
57 summary: a
58
58
59 $ hg log glob:a*
59 $ hg log glob:a*
60 changeset: 3:2ca5ba701980
60 changeset: 3:2ca5ba701980
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:04 1970 +0000
62 date: Thu Jan 01 00:00:04 1970 +0000
63 summary: d
63 summary: d
64
64
65 changeset: 0:9161b9aeaf16
65 changeset: 0:9161b9aeaf16
66 user: test
66 user: test
67 date: Thu Jan 01 00:00:01 1970 +0000
67 date: Thu Jan 01 00:00:01 1970 +0000
68 summary: a
68 summary: a
69
69
70 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
70 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
71 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
71 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
72 updated patterns: glob:.hglf/a*, glob:a*
72 updated patterns: glob:.hglf/a*, glob:a*
73 3: d
73 3: d
74 0: a
74 0: a
75
75
76 log on directory
76 log on directory
77
77
78 $ hg log dir
78 $ hg log dir
79 changeset: 4:7e4639b4691b
79 changeset: 4:7e4639b4691b
80 tag: tip
80 tag: tip
81 user: test
81 user: test
82 date: Thu Jan 01 00:00:05 1970 +0000
82 date: Thu Jan 01 00:00:05 1970 +0000
83 summary: e
83 summary: e
84
84
85 changeset: 2:f8954cd4dc1f
85 changeset: 2:f8954cd4dc1f
86 user: test
86 user: test
87 date: Thu Jan 01 00:00:03 1970 +0000
87 date: Thu Jan 01 00:00:03 1970 +0000
88 summary: c
88 summary: c
89
89
90 $ hg log somethingthatdoesntexist dir
90 $ hg log somethingthatdoesntexist dir
91 changeset: 4:7e4639b4691b
91 changeset: 4:7e4639b4691b
92 tag: tip
92 tag: tip
93 user: test
93 user: test
94 date: Thu Jan 01 00:00:05 1970 +0000
94 date: Thu Jan 01 00:00:05 1970 +0000
95 summary: e
95 summary: e
96
96
97 changeset: 2:f8954cd4dc1f
97 changeset: 2:f8954cd4dc1f
98 user: test
98 user: test
99 date: Thu Jan 01 00:00:03 1970 +0000
99 date: Thu Jan 01 00:00:03 1970 +0000
100 summary: c
100 summary: c
101
101
102
102
103 -f, non-existent directory
103 -f, non-existent directory
104
104
105 $ hg log -f dir
105 $ hg log -f dir
106 abort: cannot follow file not in parent revision: "dir"
106 abort: cannot follow file not in parent revision: "dir"
107 [255]
107 [255]
108
108
109 -f, directory
109 -f, directory
110
110
111 $ hg up -q 3
111 $ hg up -q 3
112 $ hg log -f dir
112 $ hg log -f dir
113 changeset: 2:f8954cd4dc1f
113 changeset: 2:f8954cd4dc1f
114 user: test
114 user: test
115 date: Thu Jan 01 00:00:03 1970 +0000
115 date: Thu Jan 01 00:00:03 1970 +0000
116 summary: c
116 summary: c
117
117
118 -f, directory with --patch
118 -f, directory with --patch
119
119
120 $ hg log -f dir -p
120 $ hg log -f dir -p
121 changeset: 2:f8954cd4dc1f
121 changeset: 2:f8954cd4dc1f
122 user: test
122 user: test
123 date: Thu Jan 01 00:00:03 1970 +0000
123 date: Thu Jan 01 00:00:03 1970 +0000
124 summary: c
124 summary: c
125
125
126 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
126 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
127 --- /dev/null* (glob)
127 --- /dev/null* (glob)
128 +++ b/dir/b* (glob)
128 +++ b/dir/b* (glob)
129 @@ -0,0 +1,1 @@
129 @@ -0,0 +1,1 @@
130 +a
130 +a
131
131
132
132
133 -f, pattern
133 -f, pattern
134
134
135 $ hg log -f -I 'dir**' -p
135 $ hg log -f -I 'dir**' -p
136 changeset: 2:f8954cd4dc1f
136 changeset: 2:f8954cd4dc1f
137 user: test
137 user: test
138 date: Thu Jan 01 00:00:03 1970 +0000
138 date: Thu Jan 01 00:00:03 1970 +0000
139 summary: c
139 summary: c
140
140
141 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
141 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
142 --- /dev/null* (glob)
142 --- /dev/null* (glob)
143 +++ b/dir/b* (glob)
143 +++ b/dir/b* (glob)
144 @@ -0,0 +1,1 @@
144 @@ -0,0 +1,1 @@
145 +a
145 +a
146
146
147 $ hg up -q 4
147 $ hg up -q 4
148
148
149 -f, a wrong style
149 -f, a wrong style
150
150
151 $ hg log -f -l1 --style something
151 $ hg log -f -l1 --style something
152 abort: style 'something' not found
152 abort: style 'something' not found
153 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
153 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
154 [255]
154 [255]
155
155
156 -f, phases style
156 -f, phases style
157
157
158
158
159 $ hg log -f -l1 --style phases
159 $ hg log -f -l1 --style phases
160 changeset: 4:7e4639b4691b
160 changeset: 4:7e4639b4691b
161 tag: tip
161 tag: tip
162 phase: draft
162 phase: draft
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:05 1970 +0000
164 date: Thu Jan 01 00:00:05 1970 +0000
165 summary: e
165 summary: e
166
166
167
167
168 $ hg log -f -l1 --style phases -q
168 $ hg log -f -l1 --style phases -q
169 4:7e4639b4691b
169 4:7e4639b4691b
170
170
171 -f, but no args
171 -f, but no args
172
172
173 $ hg log -f
173 $ hg log -f
174 changeset: 4:7e4639b4691b
174 changeset: 4:7e4639b4691b
175 tag: tip
175 tag: tip
176 user: test
176 user: test
177 date: Thu Jan 01 00:00:05 1970 +0000
177 date: Thu Jan 01 00:00:05 1970 +0000
178 summary: e
178 summary: e
179
179
180 changeset: 3:2ca5ba701980
180 changeset: 3:2ca5ba701980
181 user: test
181 user: test
182 date: Thu Jan 01 00:00:04 1970 +0000
182 date: Thu Jan 01 00:00:04 1970 +0000
183 summary: d
183 summary: d
184
184
185 changeset: 2:f8954cd4dc1f
185 changeset: 2:f8954cd4dc1f
186 user: test
186 user: test
187 date: Thu Jan 01 00:00:03 1970 +0000
187 date: Thu Jan 01 00:00:03 1970 +0000
188 summary: c
188 summary: c
189
189
190 changeset: 1:d89b0a12d229
190 changeset: 1:d89b0a12d229
191 user: test
191 user: test
192 date: Thu Jan 01 00:00:02 1970 +0000
192 date: Thu Jan 01 00:00:02 1970 +0000
193 summary: b
193 summary: b
194
194
195 changeset: 0:9161b9aeaf16
195 changeset: 0:9161b9aeaf16
196 user: test
196 user: test
197 date: Thu Jan 01 00:00:01 1970 +0000
197 date: Thu Jan 01 00:00:01 1970 +0000
198 summary: a
198 summary: a
199
199
200
200
201 one rename
201 one rename
202
202
203 $ hg up -q 2
203 $ hg up -q 2
204 $ hg log -vf a
204 $ hg log -vf a
205 changeset: 0:9161b9aeaf16
205 changeset: 0:9161b9aeaf16
206 user: test
206 user: test
207 date: Thu Jan 01 00:00:01 1970 +0000
207 date: Thu Jan 01 00:00:01 1970 +0000
208 files: a f
208 files: a f
209 description:
209 description:
210 a
210 a
211
211
212
212
213
213
214 many renames
214 many renames
215
215
216 $ hg up -q tip
216 $ hg up -q tip
217 $ hg log -vf e
217 $ hg log -vf e
218 changeset: 4:7e4639b4691b
218 changeset: 4:7e4639b4691b
219 tag: tip
219 tag: tip
220 user: test
220 user: test
221 date: Thu Jan 01 00:00:05 1970 +0000
221 date: Thu Jan 01 00:00:05 1970 +0000
222 files: dir/b e
222 files: dir/b e
223 description:
223 description:
224 e
224 e
225
225
226
226
227 changeset: 2:f8954cd4dc1f
227 changeset: 2:f8954cd4dc1f
228 user: test
228 user: test
229 date: Thu Jan 01 00:00:03 1970 +0000
229 date: Thu Jan 01 00:00:03 1970 +0000
230 files: b dir/b f g
230 files: b dir/b f g
231 description:
231 description:
232 c
232 c
233
233
234
234
235 changeset: 1:d89b0a12d229
235 changeset: 1:d89b0a12d229
236 user: test
236 user: test
237 date: Thu Jan 01 00:00:02 1970 +0000
237 date: Thu Jan 01 00:00:02 1970 +0000
238 files: b g
238 files: b g
239 description:
239 description:
240 b
240 b
241
241
242
242
243 changeset: 0:9161b9aeaf16
243 changeset: 0:9161b9aeaf16
244 user: test
244 user: test
245 date: Thu Jan 01 00:00:01 1970 +0000
245 date: Thu Jan 01 00:00:01 1970 +0000
246 files: a f
246 files: a f
247 description:
247 description:
248 a
248 a
249
249
250
250
251
251
252
252
253 log -pf dir/b
253 log -pf dir/b
254
254
255 $ hg up -q 3
255 $ hg up -q 3
256 $ hg log -pf dir/b
256 $ hg log -pf dir/b
257 changeset: 2:f8954cd4dc1f
257 changeset: 2:f8954cd4dc1f
258 user: test
258 user: test
259 date: Thu Jan 01 00:00:03 1970 +0000
259 date: Thu Jan 01 00:00:03 1970 +0000
260 summary: c
260 summary: c
261
261
262 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
262 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
263 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
263 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
264 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
264 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
265 @@ -0,0 +1,1 @@
265 @@ -0,0 +1,1 @@
266 +a
266 +a
267
267
268 changeset: 1:d89b0a12d229
268 changeset: 1:d89b0a12d229
269 user: test
269 user: test
270 date: Thu Jan 01 00:00:02 1970 +0000
270 date: Thu Jan 01 00:00:02 1970 +0000
271 summary: b
271 summary: b
272
272
273 diff -r 9161b9aeaf16 -r d89b0a12d229 b
273 diff -r 9161b9aeaf16 -r d89b0a12d229 b
274 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
274 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
275 +++ b/b Thu Jan 01 00:00:02 1970 +0000
275 +++ b/b Thu Jan 01 00:00:02 1970 +0000
276 @@ -0,0 +1,1 @@
276 @@ -0,0 +1,1 @@
277 +a
277 +a
278
278
279 changeset: 0:9161b9aeaf16
279 changeset: 0:9161b9aeaf16
280 user: test
280 user: test
281 date: Thu Jan 01 00:00:01 1970 +0000
281 date: Thu Jan 01 00:00:01 1970 +0000
282 summary: a
282 summary: a
283
283
284 diff -r 000000000000 -r 9161b9aeaf16 a
284 diff -r 000000000000 -r 9161b9aeaf16 a
285 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
285 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
286 +++ b/a Thu Jan 01 00:00:01 1970 +0000
286 +++ b/a Thu Jan 01 00:00:01 1970 +0000
287 @@ -0,0 +1,1 @@
287 @@ -0,0 +1,1 @@
288 +a
288 +a
289
289
290
290
291 log -pf b inside dir
291 log -pf b inside dir
292
292
293 $ hg --cwd=dir log -pf b
293 $ hg --cwd=dir log -pf b
294 changeset: 2:f8954cd4dc1f
294 changeset: 2:f8954cd4dc1f
295 user: test
295 user: test
296 date: Thu Jan 01 00:00:03 1970 +0000
296 date: Thu Jan 01 00:00:03 1970 +0000
297 summary: c
297 summary: c
298
298
299 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
299 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
300 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
300 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
301 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
301 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
302 @@ -0,0 +1,1 @@
302 @@ -0,0 +1,1 @@
303 +a
303 +a
304
304
305 changeset: 1:d89b0a12d229
305 changeset: 1:d89b0a12d229
306 user: test
306 user: test
307 date: Thu Jan 01 00:00:02 1970 +0000
307 date: Thu Jan 01 00:00:02 1970 +0000
308 summary: b
308 summary: b
309
309
310 diff -r 9161b9aeaf16 -r d89b0a12d229 b
310 diff -r 9161b9aeaf16 -r d89b0a12d229 b
311 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
311 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
312 +++ b/b Thu Jan 01 00:00:02 1970 +0000
312 +++ b/b Thu Jan 01 00:00:02 1970 +0000
313 @@ -0,0 +1,1 @@
313 @@ -0,0 +1,1 @@
314 +a
314 +a
315
315
316 changeset: 0:9161b9aeaf16
316 changeset: 0:9161b9aeaf16
317 user: test
317 user: test
318 date: Thu Jan 01 00:00:01 1970 +0000
318 date: Thu Jan 01 00:00:01 1970 +0000
319 summary: a
319 summary: a
320
320
321 diff -r 000000000000 -r 9161b9aeaf16 a
321 diff -r 000000000000 -r 9161b9aeaf16 a
322 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
322 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
323 +++ b/a Thu Jan 01 00:00:01 1970 +0000
323 +++ b/a Thu Jan 01 00:00:01 1970 +0000
324 @@ -0,0 +1,1 @@
324 @@ -0,0 +1,1 @@
325 +a
325 +a
326
326
327
327
328 log -pf, but no args
328 log -pf, but no args
329
329
330 $ hg log -pf
330 $ hg log -pf
331 changeset: 3:2ca5ba701980
331 changeset: 3:2ca5ba701980
332 user: test
332 user: test
333 date: Thu Jan 01 00:00:04 1970 +0000
333 date: Thu Jan 01 00:00:04 1970 +0000
334 summary: d
334 summary: d
335
335
336 diff -r f8954cd4dc1f -r 2ca5ba701980 a
336 diff -r f8954cd4dc1f -r 2ca5ba701980 a
337 --- a/a Thu Jan 01 00:00:03 1970 +0000
337 --- a/a Thu Jan 01 00:00:03 1970 +0000
338 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
338 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
339 @@ -1,1 +0,0 @@
339 @@ -1,1 +0,0 @@
340 -a
340 -a
341 diff -r f8954cd4dc1f -r 2ca5ba701980 b
341 diff -r f8954cd4dc1f -r 2ca5ba701980 b
342 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
342 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
343 +++ b/b Thu Jan 01 00:00:04 1970 +0000
343 +++ b/b Thu Jan 01 00:00:04 1970 +0000
344 @@ -0,0 +1,1 @@
344 @@ -0,0 +1,1 @@
345 +a
345 +a
346 diff -r f8954cd4dc1f -r 2ca5ba701980 d
346 diff -r f8954cd4dc1f -r 2ca5ba701980 d
347 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
347 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
348 +++ b/d Thu Jan 01 00:00:04 1970 +0000
348 +++ b/d Thu Jan 01 00:00:04 1970 +0000
349 @@ -0,0 +1,1 @@
349 @@ -0,0 +1,1 @@
350 +a
350 +a
351 diff -r f8954cd4dc1f -r 2ca5ba701980 g
351 diff -r f8954cd4dc1f -r 2ca5ba701980 g
352 --- a/g Thu Jan 01 00:00:03 1970 +0000
352 --- a/g Thu Jan 01 00:00:03 1970 +0000
353 +++ b/g Thu Jan 01 00:00:04 1970 +0000
353 +++ b/g Thu Jan 01 00:00:04 1970 +0000
354 @@ -1,2 +1,2 @@
354 @@ -1,2 +1,2 @@
355 f
355 f
356 -g
356 -g
357 +f
357 +f
358
358
359 changeset: 2:f8954cd4dc1f
359 changeset: 2:f8954cd4dc1f
360 user: test
360 user: test
361 date: Thu Jan 01 00:00:03 1970 +0000
361 date: Thu Jan 01 00:00:03 1970 +0000
362 summary: c
362 summary: c
363
363
364 diff -r d89b0a12d229 -r f8954cd4dc1f b
364 diff -r d89b0a12d229 -r f8954cd4dc1f b
365 --- a/b Thu Jan 01 00:00:02 1970 +0000
365 --- a/b Thu Jan 01 00:00:02 1970 +0000
366 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
366 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
367 @@ -1,1 +0,0 @@
367 @@ -1,1 +0,0 @@
368 -a
368 -a
369 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
369 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
370 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
370 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
371 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
371 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
372 @@ -0,0 +1,1 @@
372 @@ -0,0 +1,1 @@
373 +a
373 +a
374 diff -r d89b0a12d229 -r f8954cd4dc1f f
374 diff -r d89b0a12d229 -r f8954cd4dc1f f
375 --- a/f Thu Jan 01 00:00:02 1970 +0000
375 --- a/f Thu Jan 01 00:00:02 1970 +0000
376 +++ b/f Thu Jan 01 00:00:03 1970 +0000
376 +++ b/f Thu Jan 01 00:00:03 1970 +0000
377 @@ -1,1 +1,2 @@
377 @@ -1,1 +1,2 @@
378 f
378 f
379 +f
379 +f
380 diff -r d89b0a12d229 -r f8954cd4dc1f g
380 diff -r d89b0a12d229 -r f8954cd4dc1f g
381 --- a/g Thu Jan 01 00:00:02 1970 +0000
381 --- a/g Thu Jan 01 00:00:02 1970 +0000
382 +++ b/g Thu Jan 01 00:00:03 1970 +0000
382 +++ b/g Thu Jan 01 00:00:03 1970 +0000
383 @@ -1,1 +1,2 @@
383 @@ -1,1 +1,2 @@
384 f
384 f
385 +g
385 +g
386
386
387 changeset: 1:d89b0a12d229
387 changeset: 1:d89b0a12d229
388 user: test
388 user: test
389 date: Thu Jan 01 00:00:02 1970 +0000
389 date: Thu Jan 01 00:00:02 1970 +0000
390 summary: b
390 summary: b
391
391
392 diff -r 9161b9aeaf16 -r d89b0a12d229 b
392 diff -r 9161b9aeaf16 -r d89b0a12d229 b
393 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
393 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
394 +++ b/b Thu Jan 01 00:00:02 1970 +0000
394 +++ b/b Thu Jan 01 00:00:02 1970 +0000
395 @@ -0,0 +1,1 @@
395 @@ -0,0 +1,1 @@
396 +a
396 +a
397 diff -r 9161b9aeaf16 -r d89b0a12d229 g
397 diff -r 9161b9aeaf16 -r d89b0a12d229 g
398 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
398 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
399 +++ b/g Thu Jan 01 00:00:02 1970 +0000
399 +++ b/g Thu Jan 01 00:00:02 1970 +0000
400 @@ -0,0 +1,1 @@
400 @@ -0,0 +1,1 @@
401 +f
401 +f
402
402
403 changeset: 0:9161b9aeaf16
403 changeset: 0:9161b9aeaf16
404 user: test
404 user: test
405 date: Thu Jan 01 00:00:01 1970 +0000
405 date: Thu Jan 01 00:00:01 1970 +0000
406 summary: a
406 summary: a
407
407
408 diff -r 000000000000 -r 9161b9aeaf16 a
408 diff -r 000000000000 -r 9161b9aeaf16 a
409 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
409 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
410 +++ b/a Thu Jan 01 00:00:01 1970 +0000
410 +++ b/a Thu Jan 01 00:00:01 1970 +0000
411 @@ -0,0 +1,1 @@
411 @@ -0,0 +1,1 @@
412 +a
412 +a
413 diff -r 000000000000 -r 9161b9aeaf16 f
413 diff -r 000000000000 -r 9161b9aeaf16 f
414 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
414 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
415 +++ b/f Thu Jan 01 00:00:01 1970 +0000
415 +++ b/f Thu Jan 01 00:00:01 1970 +0000
416 @@ -0,0 +1,1 @@
416 @@ -0,0 +1,1 @@
417 +f
417 +f
418
418
419
419
420 log -vf dir/b
420 log -vf dir/b
421
421
422 $ hg log -vf dir/b
422 $ hg log -vf dir/b
423 changeset: 2:f8954cd4dc1f
423 changeset: 2:f8954cd4dc1f
424 user: test
424 user: test
425 date: Thu Jan 01 00:00:03 1970 +0000
425 date: Thu Jan 01 00:00:03 1970 +0000
426 files: b dir/b f g
426 files: b dir/b f g
427 description:
427 description:
428 c
428 c
429
429
430
430
431 changeset: 1:d89b0a12d229
431 changeset: 1:d89b0a12d229
432 user: test
432 user: test
433 date: Thu Jan 01 00:00:02 1970 +0000
433 date: Thu Jan 01 00:00:02 1970 +0000
434 files: b g
434 files: b g
435 description:
435 description:
436 b
436 b
437
437
438
438
439 changeset: 0:9161b9aeaf16
439 changeset: 0:9161b9aeaf16
440 user: test
440 user: test
441 date: Thu Jan 01 00:00:01 1970 +0000
441 date: Thu Jan 01 00:00:01 1970 +0000
442 files: a f
442 files: a f
443 description:
443 description:
444 a
444 a
445
445
446
446
447
447
448
448
449 -f and multiple filelog heads
449 -f and multiple filelog heads
450
450
451 $ hg up -q 2
451 $ hg up -q 2
452 $ hg log -f g --template '{rev}\n'
452 $ hg log -f g --template '{rev}\n'
453 2
453 2
454 1
454 1
455 0
455 0
456 $ hg up -q tip
456 $ hg up -q tip
457 $ hg log -f g --template '{rev}\n'
457 $ hg log -f g --template '{rev}\n'
458 3
458 3
459 2
459 2
460 0
460 0
461
461
462
462
463 log copies with --copies
463 log copies with --copies
464
464
465 $ hg log -vC --template '{rev} {file_copies}\n'
465 $ hg log -vC --template '{rev} {file_copies}\n'
466 4 e (dir/b)
466 4 e (dir/b)
467 3 b (a)g (f)
467 3 b (a)g (f)
468 2 dir/b (b)
468 2 dir/b (b)
469 1 b (a)g (f)
469 1 b (a)g (f)
470 0
470 0
471
471
472 log copies switch without --copies, with old filecopy template
472 log copies switch without --copies, with old filecopy template
473
473
474 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
474 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
475 4
475 4
476 3
476 3
477 2
477 2
478 1
478 1
479 0
479 0
480
480
481 log copies switch with --copies
481 log copies switch with --copies
482
482
483 $ hg log -vC --template '{rev} {file_copies_switch}\n'
483 $ hg log -vC --template '{rev} {file_copies_switch}\n'
484 4 e (dir/b)
484 4 e (dir/b)
485 3 b (a)g (f)
485 3 b (a)g (f)
486 2 dir/b (b)
486 2 dir/b (b)
487 1 b (a)g (f)
487 1 b (a)g (f)
488 0
488 0
489
489
490
490
491 log copies with hardcoded style and with --style=default
491 log copies with hardcoded style and with --style=default
492
492
493 $ hg log -vC -r4
493 $ hg log -vC -r4
494 changeset: 4:7e4639b4691b
494 changeset: 4:7e4639b4691b
495 tag: tip
495 tag: tip
496 user: test
496 user: test
497 date: Thu Jan 01 00:00:05 1970 +0000
497 date: Thu Jan 01 00:00:05 1970 +0000
498 files: dir/b e
498 files: dir/b e
499 copies: e (dir/b)
499 copies: e (dir/b)
500 description:
500 description:
501 e
501 e
502
502
503
503
504 $ hg log -vC -r4 --style=default
504 $ hg log -vC -r4 --style=default
505 changeset: 4:7e4639b4691b
505 changeset: 4:7e4639b4691b
506 tag: tip
506 tag: tip
507 user: test
507 user: test
508 date: Thu Jan 01 00:00:05 1970 +0000
508 date: Thu Jan 01 00:00:05 1970 +0000
509 files: dir/b e
509 files: dir/b e
510 copies: e (dir/b)
510 copies: e (dir/b)
511 description:
511 description:
512 e
512 e
513
513
514
514
515 $ hg log -vC -r4 -Tjson
515 $ hg log -vC -r4 -Tjson
516 [
516 [
517 {
517 {
518 "rev": 4,
518 "rev": 4,
519 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
519 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
520 "branch": "default",
520 "branch": "default",
521 "phase": "draft",
521 "phase": "draft",
522 "user": "test",
522 "user": "test",
523 "date": [5, 0],
523 "date": [5, 0],
524 "desc": "e",
524 "desc": "e",
525 "bookmarks": [],
525 "bookmarks": [],
526 "tags": ["tip"],
526 "tags": ["tip"],
527 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
527 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
528 "files": ["dir/b", "e"],
528 "files": ["dir/b", "e"],
529 "copies": {"e": "dir/b"}
529 "copies": {"e": "dir/b"}
530 }
530 }
531 ]
531 ]
532
532
533 log copies, non-linear manifest
533 log copies, non-linear manifest
534
534
535 $ hg up -C 3
535 $ hg up -C 3
536 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
536 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
537 $ hg mv dir/b e
537 $ hg mv dir/b e
538 $ echo foo > foo
538 $ echo foo > foo
539 $ hg ci -Ame2 -d '6 0'
539 $ hg ci -Ame2 -d '6 0'
540 adding foo
540 adding foo
541 created new head
541 created new head
542 $ hg log -v --template '{rev} {file_copies}\n' -r 5
542 $ hg log -v --template '{rev} {file_copies}\n' -r 5
543 5 e (dir/b)
543 5 e (dir/b)
544
544
545
545
546 log copies, execute bit set
546 log copies, execute bit set
547
547
548 #if execbit
548 #if execbit
549 $ chmod +x e
549 $ chmod +x e
550 $ hg ci -me3 -d '7 0'
550 $ hg ci -me3 -d '7 0'
551 $ hg log -v --template '{rev} {file_copies}\n' -r 6
551 $ hg log -v --template '{rev} {file_copies}\n' -r 6
552 6
552 6
553 #endif
553 #endif
554
554
555
555
556 log -p d
556 log -p d
557
557
558 $ hg log -pv d
558 $ hg log -pv d
559 changeset: 3:2ca5ba701980
559 changeset: 3:2ca5ba701980
560 user: test
560 user: test
561 date: Thu Jan 01 00:00:04 1970 +0000
561 date: Thu Jan 01 00:00:04 1970 +0000
562 files: a b d g
562 files: a b d g
563 description:
563 description:
564 d
564 d
565
565
566
566
567 diff -r f8954cd4dc1f -r 2ca5ba701980 d
567 diff -r f8954cd4dc1f -r 2ca5ba701980 d
568 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
568 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
569 +++ b/d Thu Jan 01 00:00:04 1970 +0000
569 +++ b/d Thu Jan 01 00:00:04 1970 +0000
570 @@ -0,0 +1,1 @@
570 @@ -0,0 +1,1 @@
571 +a
571 +a
572
572
573
573
574
574
575 log --removed file
575 log --removed file
576
576
577 $ hg log --removed -v a
577 $ hg log --removed -v a
578 changeset: 3:2ca5ba701980
578 changeset: 3:2ca5ba701980
579 user: test
579 user: test
580 date: Thu Jan 01 00:00:04 1970 +0000
580 date: Thu Jan 01 00:00:04 1970 +0000
581 files: a b d g
581 files: a b d g
582 description:
582 description:
583 d
583 d
584
584
585
585
586 changeset: 0:9161b9aeaf16
586 changeset: 0:9161b9aeaf16
587 user: test
587 user: test
588 date: Thu Jan 01 00:00:01 1970 +0000
588 date: Thu Jan 01 00:00:01 1970 +0000
589 files: a f
589 files: a f
590 description:
590 description:
591 a
591 a
592
592
593
593
594
594
595 log --removed revrange file
595 log --removed revrange file
596
596
597 $ hg log --removed -v -r0:2 a
597 $ hg log --removed -v -r0:2 a
598 changeset: 0:9161b9aeaf16
598 changeset: 0:9161b9aeaf16
599 user: test
599 user: test
600 date: Thu Jan 01 00:00:01 1970 +0000
600 date: Thu Jan 01 00:00:01 1970 +0000
601 files: a f
601 files: a f
602 description:
602 description:
603 a
603 a
604
604
605
605
606 $ cd ..
606 $ cd ..
607
607
608 log --follow tests
608 log --follow tests
609
609
610 $ hg init follow
610 $ hg init follow
611 $ cd follow
611 $ cd follow
612
612
613 $ echo base > base
613 $ echo base > base
614 $ hg ci -Ambase -d '1 0'
614 $ hg ci -Ambase -d '1 0'
615 adding base
615 adding base
616
616
617 $ echo r1 >> base
617 $ echo r1 >> base
618 $ hg ci -Amr1 -d '1 0'
618 $ hg ci -Amr1 -d '1 0'
619 $ echo r2 >> base
619 $ echo r2 >> base
620 $ hg ci -Amr2 -d '1 0'
620 $ hg ci -Amr2 -d '1 0'
621
621
622 $ hg up -C 1
622 $ hg up -C 1
623 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
623 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
624 $ echo b1 > b1
624 $ echo b1 > b1
625
625
626 log -r "follow('set:clean()')"
626 log -r "follow('set:clean()')"
627
627
628 $ hg log -r "follow('set:clean()')"
628 $ hg log -r "follow('set:clean()')"
629 changeset: 0:67e992f2c4f3
629 changeset: 0:67e992f2c4f3
630 user: test
630 user: test
631 date: Thu Jan 01 00:00:01 1970 +0000
631 date: Thu Jan 01 00:00:01 1970 +0000
632 summary: base
632 summary: base
633
633
634 changeset: 1:3d5bf5654eda
634 changeset: 1:3d5bf5654eda
635 user: test
635 user: test
636 date: Thu Jan 01 00:00:01 1970 +0000
636 date: Thu Jan 01 00:00:01 1970 +0000
637 summary: r1
637 summary: r1
638
638
639
639
640 $ hg ci -Amb1 -d '1 0'
640 $ hg ci -Amb1 -d '1 0'
641 adding b1
641 adding b1
642 created new head
642 created new head
643
643
644
644
645 log -f
645 log -f
646
646
647 $ hg log -f
647 $ hg log -f
648 changeset: 3:e62f78d544b4
648 changeset: 3:e62f78d544b4
649 tag: tip
649 tag: tip
650 parent: 1:3d5bf5654eda
650 parent: 1:3d5bf5654eda
651 user: test
651 user: test
652 date: Thu Jan 01 00:00:01 1970 +0000
652 date: Thu Jan 01 00:00:01 1970 +0000
653 summary: b1
653 summary: b1
654
654
655 changeset: 1:3d5bf5654eda
655 changeset: 1:3d5bf5654eda
656 user: test
656 user: test
657 date: Thu Jan 01 00:00:01 1970 +0000
657 date: Thu Jan 01 00:00:01 1970 +0000
658 summary: r1
658 summary: r1
659
659
660 changeset: 0:67e992f2c4f3
660 changeset: 0:67e992f2c4f3
661 user: test
661 user: test
662 date: Thu Jan 01 00:00:01 1970 +0000
662 date: Thu Jan 01 00:00:01 1970 +0000
663 summary: base
663 summary: base
664
664
665
665
666 log -r follow('glob:b*')
666 log -r follow('glob:b*')
667
667
668 $ hg log -r "follow('glob:b*')"
668 $ hg log -r "follow('glob:b*')"
669 changeset: 0:67e992f2c4f3
669 changeset: 0:67e992f2c4f3
670 user: test
670 user: test
671 date: Thu Jan 01 00:00:01 1970 +0000
671 date: Thu Jan 01 00:00:01 1970 +0000
672 summary: base
672 summary: base
673
673
674 changeset: 1:3d5bf5654eda
674 changeset: 1:3d5bf5654eda
675 user: test
675 user: test
676 date: Thu Jan 01 00:00:01 1970 +0000
676 date: Thu Jan 01 00:00:01 1970 +0000
677 summary: r1
677 summary: r1
678
678
679 changeset: 3:e62f78d544b4
679 changeset: 3:e62f78d544b4
680 tag: tip
680 tag: tip
681 parent: 1:3d5bf5654eda
681 parent: 1:3d5bf5654eda
682 user: test
682 user: test
683 date: Thu Jan 01 00:00:01 1970 +0000
683 date: Thu Jan 01 00:00:01 1970 +0000
684 summary: b1
684 summary: b1
685
685
686 log -f -r '1 + 4'
686 log -f -r '1 + 4'
687
687
688 $ hg up -C 0
688 $ hg up -C 0
689 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
689 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
690 $ echo b2 > b2
690 $ echo b2 > b2
691 $ hg ci -Amb2 -d '1 0'
691 $ hg ci -Amb2 -d '1 0'
692 adding b2
692 adding b2
693 created new head
693 created new head
694 $ hg log -f -r '1 + 4'
694 $ hg log -f -r '1 + 4'
695 changeset: 4:ddb82e70d1a1
695 changeset: 4:ddb82e70d1a1
696 tag: tip
696 tag: tip
697 parent: 0:67e992f2c4f3
697 parent: 0:67e992f2c4f3
698 user: test
698 user: test
699 date: Thu Jan 01 00:00:01 1970 +0000
699 date: Thu Jan 01 00:00:01 1970 +0000
700 summary: b2
700 summary: b2
701
701
702 changeset: 1:3d5bf5654eda
702 changeset: 1:3d5bf5654eda
703 user: test
703 user: test
704 date: Thu Jan 01 00:00:01 1970 +0000
704 date: Thu Jan 01 00:00:01 1970 +0000
705 summary: r1
705 summary: r1
706
706
707 changeset: 0:67e992f2c4f3
707 changeset: 0:67e992f2c4f3
708 user: test
708 user: test
709 date: Thu Jan 01 00:00:01 1970 +0000
709 date: Thu Jan 01 00:00:01 1970 +0000
710 summary: base
710 summary: base
711
711
712 log -r "follow('set:grep(b2)')"
712 log -r "follow('set:grep(b2)')"
713
713
714 $ hg log -r "follow('set:grep(b2)')"
714 $ hg log -r "follow('set:grep(b2)')"
715 changeset: 4:ddb82e70d1a1
715 changeset: 4:ddb82e70d1a1
716 tag: tip
716 tag: tip
717 parent: 0:67e992f2c4f3
717 parent: 0:67e992f2c4f3
718 user: test
718 user: test
719 date: Thu Jan 01 00:00:01 1970 +0000
719 date: Thu Jan 01 00:00:01 1970 +0000
720 summary: b2
720 summary: b2
721
721
722 log -r "follow('set:grep(b2)', 4)"
722 log -r "follow('set:grep(b2)', 4)"
723
723
724 $ hg up -qC 0
724 $ hg up -qC 0
725 $ hg log -r "follow('set:grep(b2)', 4)"
725 $ hg log -r "follow('set:grep(b2)', 4)"
726 changeset: 4:ddb82e70d1a1
726 changeset: 4:ddb82e70d1a1
727 tag: tip
727 tag: tip
728 parent: 0:67e992f2c4f3
728 parent: 0:67e992f2c4f3
729 user: test
729 user: test
730 date: Thu Jan 01 00:00:01 1970 +0000
730 date: Thu Jan 01 00:00:01 1970 +0000
731 summary: b2
731 summary: b2
732
732
733 $ hg up -qC 4
733 $ hg up -qC 4
734
734
735 log -f -r null
735 log -f -r null
736
736
737 $ hg log -f -r null
737 $ hg log -f -r null
738 changeset: -1:000000000000
738 changeset: -1:000000000000
739 user:
739 user:
740 date: Thu Jan 01 00:00:00 1970 +0000
740 date: Thu Jan 01 00:00:00 1970 +0000
741
741
742 $ hg log -f -r null -G
742 $ hg log -f -r null -G
743 o changeset: -1:000000000000
743 o changeset: -1:000000000000
744 user:
744 user:
745 date: Thu Jan 01 00:00:00 1970 +0000
745 date: Thu Jan 01 00:00:00 1970 +0000
746
746
747
747
748
748
749 log -f with null parent
749 log -f with null parent
750
750
751 $ hg up -C null
751 $ hg up -C null
752 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
752 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
753 $ hg log -f
753 $ hg log -f
754
754
755
755
756 log -r . with two parents
756 log -r . with two parents
757
757
758 $ hg up -C 3
758 $ hg up -C 3
759 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
759 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
760 $ hg merge tip
760 $ hg merge tip
761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
762 (branch merge, don't forget to commit)
762 (branch merge, don't forget to commit)
763 $ hg log -r .
763 $ hg log -r .
764 changeset: 3:e62f78d544b4
764 changeset: 3:e62f78d544b4
765 parent: 1:3d5bf5654eda
765 parent: 1:3d5bf5654eda
766 user: test
766 user: test
767 date: Thu Jan 01 00:00:01 1970 +0000
767 date: Thu Jan 01 00:00:01 1970 +0000
768 summary: b1
768 summary: b1
769
769
770
770
771
771
772 log -r . with one parent
772 log -r . with one parent
773
773
774 $ hg ci -mm12 -d '1 0'
774 $ hg ci -mm12 -d '1 0'
775 $ hg log -r .
775 $ hg log -r .
776 changeset: 5:302e9dd6890d
776 changeset: 5:302e9dd6890d
777 tag: tip
777 tag: tip
778 parent: 3:e62f78d544b4
778 parent: 3:e62f78d544b4
779 parent: 4:ddb82e70d1a1
779 parent: 4:ddb82e70d1a1
780 user: test
780 user: test
781 date: Thu Jan 01 00:00:01 1970 +0000
781 date: Thu Jan 01 00:00:01 1970 +0000
782 summary: m12
782 summary: m12
783
783
784
784
785 $ echo postm >> b1
785 $ echo postm >> b1
786 $ hg ci -Amb1.1 -d'1 0'
786 $ hg ci -Amb1.1 -d'1 0'
787
787
788
788
789 log --follow-first
789 log --follow-first
790
790
791 $ hg log --follow-first
791 $ hg log --follow-first
792 changeset: 6:2404bbcab562
792 changeset: 6:2404bbcab562
793 tag: tip
793 tag: tip
794 user: test
794 user: test
795 date: Thu Jan 01 00:00:01 1970 +0000
795 date: Thu Jan 01 00:00:01 1970 +0000
796 summary: b1.1
796 summary: b1.1
797
797
798 changeset: 5:302e9dd6890d
798 changeset: 5:302e9dd6890d
799 parent: 3:e62f78d544b4
799 parent: 3:e62f78d544b4
800 parent: 4:ddb82e70d1a1
800 parent: 4:ddb82e70d1a1
801 user: test
801 user: test
802 date: Thu Jan 01 00:00:01 1970 +0000
802 date: Thu Jan 01 00:00:01 1970 +0000
803 summary: m12
803 summary: m12
804
804
805 changeset: 3:e62f78d544b4
805 changeset: 3:e62f78d544b4
806 parent: 1:3d5bf5654eda
806 parent: 1:3d5bf5654eda
807 user: test
807 user: test
808 date: Thu Jan 01 00:00:01 1970 +0000
808 date: Thu Jan 01 00:00:01 1970 +0000
809 summary: b1
809 summary: b1
810
810
811 changeset: 1:3d5bf5654eda
811 changeset: 1:3d5bf5654eda
812 user: test
812 user: test
813 date: Thu Jan 01 00:00:01 1970 +0000
813 date: Thu Jan 01 00:00:01 1970 +0000
814 summary: r1
814 summary: r1
815
815
816 changeset: 0:67e992f2c4f3
816 changeset: 0:67e992f2c4f3
817 user: test
817 user: test
818 date: Thu Jan 01 00:00:01 1970 +0000
818 date: Thu Jan 01 00:00:01 1970 +0000
819 summary: base
819 summary: base
820
820
821
821
822
822
823 log -P 2
823 log -P 2
824
824
825 $ hg log -P 2
825 $ hg log -P 2
826 changeset: 6:2404bbcab562
826 changeset: 6:2404bbcab562
827 tag: tip
827 tag: tip
828 user: test
828 user: test
829 date: Thu Jan 01 00:00:01 1970 +0000
829 date: Thu Jan 01 00:00:01 1970 +0000
830 summary: b1.1
830 summary: b1.1
831
831
832 changeset: 5:302e9dd6890d
832 changeset: 5:302e9dd6890d
833 parent: 3:e62f78d544b4
833 parent: 3:e62f78d544b4
834 parent: 4:ddb82e70d1a1
834 parent: 4:ddb82e70d1a1
835 user: test
835 user: test
836 date: Thu Jan 01 00:00:01 1970 +0000
836 date: Thu Jan 01 00:00:01 1970 +0000
837 summary: m12
837 summary: m12
838
838
839 changeset: 4:ddb82e70d1a1
839 changeset: 4:ddb82e70d1a1
840 parent: 0:67e992f2c4f3
840 parent: 0:67e992f2c4f3
841 user: test
841 user: test
842 date: Thu Jan 01 00:00:01 1970 +0000
842 date: Thu Jan 01 00:00:01 1970 +0000
843 summary: b2
843 summary: b2
844
844
845 changeset: 3:e62f78d544b4
845 changeset: 3:e62f78d544b4
846 parent: 1:3d5bf5654eda
846 parent: 1:3d5bf5654eda
847 user: test
847 user: test
848 date: Thu Jan 01 00:00:01 1970 +0000
848 date: Thu Jan 01 00:00:01 1970 +0000
849 summary: b1
849 summary: b1
850
850
851
851
852
852
853 log -r tip -p --git
853 log -r tip -p --git
854
854
855 $ hg log -r tip -p --git
855 $ hg log -r tip -p --git
856 changeset: 6:2404bbcab562
856 changeset: 6:2404bbcab562
857 tag: tip
857 tag: tip
858 user: test
858 user: test
859 date: Thu Jan 01 00:00:01 1970 +0000
859 date: Thu Jan 01 00:00:01 1970 +0000
860 summary: b1.1
860 summary: b1.1
861
861
862 diff --git a/b1 b/b1
862 diff --git a/b1 b/b1
863 --- a/b1
863 --- a/b1
864 +++ b/b1
864 +++ b/b1
865 @@ -1,1 +1,2 @@
865 @@ -1,1 +1,2 @@
866 b1
866 b1
867 +postm
867 +postm
868
868
869
869
870
870
871 log -r ""
871 log -r ""
872
872
873 $ hg log -r ''
873 $ hg log -r ''
874 hg: parse error: empty query
874 hg: parse error: empty query
875 [255]
875 [255]
876
876
877 log -r <some unknown node id>
877 log -r <some unknown node id>
878
878
879 $ hg log -r 1000000000000000000000000000000000000000
879 $ hg log -r 1000000000000000000000000000000000000000
880 abort: unknown revision '1000000000000000000000000000000000000000'!
880 abort: unknown revision '1000000000000000000000000000000000000000'!
881 [255]
881 [255]
882
882
883 log -k r1
883 log -k r1
884
884
885 $ hg log -k r1
885 $ hg log -k r1
886 changeset: 1:3d5bf5654eda
886 changeset: 1:3d5bf5654eda
887 user: test
887 user: test
888 date: Thu Jan 01 00:00:01 1970 +0000
888 date: Thu Jan 01 00:00:01 1970 +0000
889 summary: r1
889 summary: r1
890
890
891 log -p -l2 --color=always
891 log -p -l2 --color=always
892
892
893 $ hg --config extensions.color= --config color.mode=ansi \
893 $ hg --config extensions.color= --config color.mode=ansi \
894 > log -p -l2 --color=always
894 > log -p -l2 --color=always
895 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
895 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
896 tag: tip
896 tag: tip
897 user: test
897 user: test
898 date: Thu Jan 01 00:00:01 1970 +0000
898 date: Thu Jan 01 00:00:01 1970 +0000
899 summary: b1.1
899 summary: b1.1
900
900
901 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
901 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
902 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
902 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
903 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
903 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
904 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
904 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
905 b1
905 b1
906 \x1b[0;32m+postm\x1b[0m (esc)
906 \x1b[0;32m+postm\x1b[0m (esc)
907
907
908 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
908 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
909 parent: 3:e62f78d544b4
909 parent: 3:e62f78d544b4
910 parent: 4:ddb82e70d1a1
910 parent: 4:ddb82e70d1a1
911 user: test
911 user: test
912 date: Thu Jan 01 00:00:01 1970 +0000
912 date: Thu Jan 01 00:00:01 1970 +0000
913 summary: m12
913 summary: m12
914
914
915 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
915 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
916 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
916 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
917 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
917 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
918 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
918 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
919 \x1b[0;32m+b2\x1b[0m (esc)
919 \x1b[0;32m+b2\x1b[0m (esc)
920
920
921
921
922
922
923 log -r tip --stat
923 log -r tip --stat
924
924
925 $ hg log -r tip --stat
925 $ hg log -r tip --stat
926 changeset: 6:2404bbcab562
926 changeset: 6:2404bbcab562
927 tag: tip
927 tag: tip
928 user: test
928 user: test
929 date: Thu Jan 01 00:00:01 1970 +0000
929 date: Thu Jan 01 00:00:01 1970 +0000
930 summary: b1.1
930 summary: b1.1
931
931
932 b1 | 1 +
932 b1 | 1 +
933 1 files changed, 1 insertions(+), 0 deletions(-)
933 1 files changed, 1 insertions(+), 0 deletions(-)
934
934
935
935
936 $ cd ..
936 $ cd ..
937
937
938 log --follow --patch FILE in repository where linkrev isn't trustworthy
938 log --follow --patch FILE in repository where linkrev isn't trustworthy
939 (issue5376)
939 (issue5376)
940
940
941 $ hg init follow-dup
941 $ hg init follow-dup
942 $ cd follow-dup
942 $ cd follow-dup
943 $ cat <<EOF >> .hg/hgrc
943 $ cat <<EOF >> .hg/hgrc
944 > [ui]
944 > [ui]
945 > logtemplate = '=== {rev}: {desc}\n'
945 > logtemplate = '=== {rev}: {desc}\n'
946 > [diff]
946 > [diff]
947 > nodates = True
947 > nodates = True
948 > EOF
948 > EOF
949 $ echo 0 >> a
949 $ echo 0 >> a
950 $ hg ci -qAm 'a0'
950 $ hg ci -qAm 'a0'
951 $ echo 1 >> a
951 $ echo 1 >> a
952 $ hg ci -m 'a1'
952 $ hg ci -m 'a1'
953 $ hg up -q 0
953 $ hg up -q 0
954 $ echo 1 >> a
954 $ echo 1 >> a
955 $ touch b
955 $ touch b
956 $ hg ci -qAm 'a1 with b'
956 $ hg ci -qAm 'a1 with b'
957 $ echo 3 >> a
957 $ echo 3 >> a
958 $ hg ci -m 'a3'
958 $ hg ci -m 'a3'
959
959
960 fctx.rev() == 2, but fctx.linkrev() == 1
960 fctx.rev() == 2, but fctx.linkrev() == 1
961
961
962 $ hg log -pf a
962 $ hg log -pf a
963 === 3: a3
963 === 3: a3
964 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
964 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
965 --- a/a
965 --- a/a
966 +++ b/a
966 +++ b/a
967 @@ -1,2 +1,3 @@
967 @@ -1,2 +1,3 @@
968 0
968 0
969 1
969 1
970 +3
970 +3
971
971
972 === 2: a1 with b
972 === 2: a1 with b
973 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
973 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
974 --- a/a
974 --- a/a
975 +++ b/a
975 +++ b/a
976 @@ -1,1 +1,2 @@
976 @@ -1,1 +1,2 @@
977 0
977 0
978 +1
978 +1
979
979
980 === 0: a0
980 === 0: a0
981 diff -r 000000000000 -r 49b5e81287e2 a
981 diff -r 000000000000 -r 49b5e81287e2 a
982 --- /dev/null
982 --- /dev/null
983 +++ b/a
983 +++ b/a
984 @@ -0,0 +1,1 @@
984 @@ -0,0 +1,1 @@
985 +0
985 +0
986
986
987
987
988 fctx.introrev() == 2, but fctx.linkrev() == 1
988 fctx.introrev() == 2, but fctx.linkrev() == 1
989
989
990 $ hg up -q 2
990 $ hg up -q 2
991 $ hg log -pf a
991 $ hg log -pf a
992 === 2: a1 with b
992 === 2: a1 with b
993 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
993 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
994 --- a/a
994 --- a/a
995 +++ b/a
995 +++ b/a
996 @@ -1,1 +1,2 @@
996 @@ -1,1 +1,2 @@
997 0
997 0
998 +1
998 +1
999
999
1000 === 0: a0
1000 === 0: a0
1001 diff -r 000000000000 -r 49b5e81287e2 a
1001 diff -r 000000000000 -r 49b5e81287e2 a
1002 --- /dev/null
1002 --- /dev/null
1003 +++ b/a
1003 +++ b/a
1004 @@ -0,0 +1,1 @@
1004 @@ -0,0 +1,1 @@
1005 +0
1005 +0
1006
1006
1007
1007
1008 $ cd ..
1008 $ cd ..
1009
1009
1010 Test that log should respect the order of -rREV even if multiple OR conditions
1010 Test that log should respect the order of -rREV even if multiple OR conditions
1011 are specified (issue5100):
1011 are specified (issue5100):
1012
1012
1013 $ hg init revorder
1013 $ hg init revorder
1014 $ cd revorder
1014 $ cd revorder
1015
1015
1016 $ hg branch -q b0
1016 $ hg branch -q b0
1017 $ echo 0 >> f0
1017 $ echo 0 >> f0
1018 $ hg ci -qAm k0 -u u0
1018 $ hg ci -qAm k0 -u u0
1019 $ hg branch -q b1
1019 $ hg branch -q b1
1020 $ echo 1 >> f1
1020 $ echo 1 >> f1
1021 $ hg ci -qAm k1 -u u1
1021 $ hg ci -qAm k1 -u u1
1022 $ hg branch -q b2
1022 $ hg branch -q b2
1023 $ echo 2 >> f2
1023 $ echo 2 >> f2
1024 $ hg ci -qAm k2 -u u2
1024 $ hg ci -qAm k2 -u u2
1025
1025
1026 $ hg update -q b2
1026 $ hg update -q b2
1027 $ echo 3 >> f2
1027 $ echo 3 >> f2
1028 $ hg ci -qAm k2 -u u2
1028 $ hg ci -qAm k2 -u u2
1029 $ hg update -q b1
1029 $ hg update -q b1
1030 $ echo 4 >> f1
1030 $ echo 4 >> f1
1031 $ hg ci -qAm k1 -u u1
1031 $ hg ci -qAm k1 -u u1
1032 $ hg update -q b0
1032 $ hg update -q b0
1033 $ echo 5 >> f0
1033 $ echo 5 >> f0
1034 $ hg ci -qAm k0 -u u0
1034 $ hg ci -qAm k0 -u u0
1035
1035
1036 summary of revisions:
1036 summary of revisions:
1037
1037
1038 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1038 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1039 @ 5 b0 u0 k0 f0
1039 @ 5 b0 u0 k0 f0
1040 |
1040 |
1041 | o 4 b1 u1 k1 f1
1041 | o 4 b1 u1 k1 f1
1042 | |
1042 | |
1043 | | o 3 b2 u2 k2 f2
1043 | | o 3 b2 u2 k2 f2
1044 | | |
1044 | | |
1045 | | o 2 b2 u2 k2 f2
1045 | | o 2 b2 u2 k2 f2
1046 | |/
1046 | |/
1047 | o 1 b1 u1 k1 f1
1047 | o 1 b1 u1 k1 f1
1048 |/
1048 |/
1049 o 0 b0 u0 k0 f0
1049 o 0 b0 u0 k0 f0
1050
1050
1051
1051
1052 log -b BRANCH in ascending order:
1052 log -b BRANCH in ascending order:
1053
1053
1054 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1054 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1055 0 b0
1055 0 b0
1056 1 b1
1056 1 b1
1057 4 b1
1057 4 b1
1058 5 b0
1058 5 b0
1059 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1059 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1060 0 b0
1060 0 b0
1061 1 b1
1061 1 b1
1062 4 b1
1062 4 b1
1063 5 b0
1063 5 b0
1064
1064
1065 log --only-branch BRANCH in descending order:
1065 log --only-branch BRANCH in descending order:
1066
1066
1067 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1067 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1068 4 b1
1068 4 b1
1069 3 b2
1069 3 b2
1070 2 b2
1070 2 b2
1071 1 b1
1071 1 b1
1072 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1072 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1073 4 b1
1073 4 b1
1074 3 b2
1074 3 b2
1075 2 b2
1075 2 b2
1076 1 b1
1076 1 b1
1077
1077
1078 log -u USER in ascending order, against compound set:
1078 log -u USER in ascending order, against compound set:
1079
1079
1080 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1080 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1081 0 u0
1081 0 u0
1082 2 u2
1082 2 u2
1083 3 u2
1083 3 u2
1084 5 u0
1084 5 u0
1085 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1085 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1086 0 u0
1086 0 u0
1087 2 u2
1087 2 u2
1088 3 u2
1088 3 u2
1089 5 u0
1089 5 u0
1090
1090
1091 log -k TEXT in descending order, against compound set:
1091 log -k TEXT in descending order, against compound set:
1092
1092
1093 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1093 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1094 5 k0
1094 5 k0
1095 3 k2
1095 3 k2
1096 2 k2
1096 2 k2
1097 1 k1
1097 1 k1
1098 0 k0
1098 0 k0
1099 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1099 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1100 5 k0
1100 5 k0
1101 3 k2
1101 3 k2
1102 2 k2
1102 2 k2
1103 1 k1
1103 1 k1
1104 0 k0
1104 0 k0
1105
1105
1106 log FILE in ascending order, against dagrange:
1106 log FILE in ascending order, against dagrange:
1107
1107
1108 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1108 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1109 1 f1
1109 1 f1
1110 2 f2
1110 2 f2
1111 3 f2
1111 3 f2
1112 4 f1
1112 4 f1
1113 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1113 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1114 1 f1
1114 1 f1
1115 2 f2
1115 2 f2
1116 3 f2
1116 3 f2
1117 4 f1
1117 4 f1
1118
1118
1119 $ cd ..
1119 $ cd ..
1120
1120
1121 User
1121 User
1122
1122
1123 $ hg init usertest
1123 $ hg init usertest
1124 $ cd usertest
1124 $ cd usertest
1125
1125
1126 $ echo a > a
1126 $ echo a > a
1127 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1127 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1128 adding a
1128 adding a
1129 $ echo b > b
1129 $ echo b > b
1130 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1130 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1131 adding b
1131 adding b
1132
1132
1133 $ hg log -u "User One <user1@example.org>"
1133 $ hg log -u "User One <user1@example.org>"
1134 changeset: 0:29a4c94f1924
1134 changeset: 0:29a4c94f1924
1135 user: User One <user1@example.org>
1135 user: User One <user1@example.org>
1136 date: Thu Jan 01 00:00:00 1970 +0000
1136 date: Thu Jan 01 00:00:00 1970 +0000
1137 summary: a
1137 summary: a
1138
1138
1139 $ hg log -u "user1" -u "user2"
1139 $ hg log -u "user1" -u "user2"
1140 changeset: 1:e834b5e69c0e
1140 changeset: 1:e834b5e69c0e
1141 tag: tip
1141 tag: tip
1142 user: User Two <user2@example.org>
1142 user: User Two <user2@example.org>
1143 date: Thu Jan 01 00:00:00 1970 +0000
1143 date: Thu Jan 01 00:00:00 1970 +0000
1144 summary: b
1144 summary: b
1145
1145
1146 changeset: 0:29a4c94f1924
1146 changeset: 0:29a4c94f1924
1147 user: User One <user1@example.org>
1147 user: User One <user1@example.org>
1148 date: Thu Jan 01 00:00:00 1970 +0000
1148 date: Thu Jan 01 00:00:00 1970 +0000
1149 summary: a
1149 summary: a
1150
1150
1151 $ hg log -u "user3"
1151 $ hg log -u "user3"
1152
1152
1153 $ cd ..
1153 $ cd ..
1154
1154
1155 $ hg init branches
1155 $ hg init branches
1156 $ cd branches
1156 $ cd branches
1157
1157
1158 $ echo a > a
1158 $ echo a > a
1159 $ hg ci -A -m "commit on default"
1159 $ hg ci -A -m "commit on default"
1160 adding a
1160 adding a
1161 $ hg branch test
1161 $ hg branch test
1162 marked working directory as branch test
1162 marked working directory as branch test
1163 (branches are permanent and global, did you want a bookmark?)
1163 (branches are permanent and global, did you want a bookmark?)
1164 $ echo b > b
1164 $ echo b > b
1165 $ hg ci -A -m "commit on test"
1165 $ hg ci -A -m "commit on test"
1166 adding b
1166 adding b
1167
1167
1168 $ hg up default
1168 $ hg up default
1169 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1169 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1170 $ echo c > c
1170 $ echo c > c
1171 $ hg ci -A -m "commit on default"
1171 $ hg ci -A -m "commit on default"
1172 adding c
1172 adding c
1173 $ hg up test
1173 $ hg up test
1174 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1174 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1175 $ echo c > c
1175 $ echo c > c
1176 $ hg ci -A -m "commit on test"
1176 $ hg ci -A -m "commit on test"
1177 adding c
1177 adding c
1178
1178
1179
1179
1180 log -b default
1180 log -b default
1181
1181
1182 $ hg log -b default
1182 $ hg log -b default
1183 changeset: 2:c3a4f03cc9a7
1183 changeset: 2:c3a4f03cc9a7
1184 parent: 0:24427303d56f
1184 parent: 0:24427303d56f
1185 user: test
1185 user: test
1186 date: Thu Jan 01 00:00:00 1970 +0000
1186 date: Thu Jan 01 00:00:00 1970 +0000
1187 summary: commit on default
1187 summary: commit on default
1188
1188
1189 changeset: 0:24427303d56f
1189 changeset: 0:24427303d56f
1190 user: test
1190 user: test
1191 date: Thu Jan 01 00:00:00 1970 +0000
1191 date: Thu Jan 01 00:00:00 1970 +0000
1192 summary: commit on default
1192 summary: commit on default
1193
1193
1194
1194
1195
1195
1196 log -b test
1196 log -b test
1197
1197
1198 $ hg log -b test
1198 $ hg log -b test
1199 changeset: 3:f5d8de11c2e2
1199 changeset: 3:f5d8de11c2e2
1200 branch: test
1200 branch: test
1201 tag: tip
1201 tag: tip
1202 parent: 1:d32277701ccb
1202 parent: 1:d32277701ccb
1203 user: test
1203 user: test
1204 date: Thu Jan 01 00:00:00 1970 +0000
1204 date: Thu Jan 01 00:00:00 1970 +0000
1205 summary: commit on test
1205 summary: commit on test
1206
1206
1207 changeset: 1:d32277701ccb
1207 changeset: 1:d32277701ccb
1208 branch: test
1208 branch: test
1209 user: test
1209 user: test
1210 date: Thu Jan 01 00:00:00 1970 +0000
1210 date: Thu Jan 01 00:00:00 1970 +0000
1211 summary: commit on test
1211 summary: commit on test
1212
1212
1213
1213
1214
1214
1215 log -b dummy
1215 log -b dummy
1216
1216
1217 $ hg log -b dummy
1217 $ hg log -b dummy
1218 abort: unknown revision 'dummy'!
1218 abort: unknown revision 'dummy'!
1219 [255]
1219 [255]
1220
1220
1221
1221
1222 log -b .
1222 log -b .
1223
1223
1224 $ hg log -b .
1224 $ hg log -b .
1225 changeset: 3:f5d8de11c2e2
1225 changeset: 3:f5d8de11c2e2
1226 branch: test
1226 branch: test
1227 tag: tip
1227 tag: tip
1228 parent: 1:d32277701ccb
1228 parent: 1:d32277701ccb
1229 user: test
1229 user: test
1230 date: Thu Jan 01 00:00:00 1970 +0000
1230 date: Thu Jan 01 00:00:00 1970 +0000
1231 summary: commit on test
1231 summary: commit on test
1232
1232
1233 changeset: 1:d32277701ccb
1233 changeset: 1:d32277701ccb
1234 branch: test
1234 branch: test
1235 user: test
1235 user: test
1236 date: Thu Jan 01 00:00:00 1970 +0000
1236 date: Thu Jan 01 00:00:00 1970 +0000
1237 summary: commit on test
1237 summary: commit on test
1238
1238
1239
1239
1240
1240
1241 log -b default -b test
1241 log -b default -b test
1242
1242
1243 $ hg log -b default -b test
1243 $ hg log -b default -b test
1244 changeset: 3:f5d8de11c2e2
1244 changeset: 3:f5d8de11c2e2
1245 branch: test
1245 branch: test
1246 tag: tip
1246 tag: tip
1247 parent: 1:d32277701ccb
1247 parent: 1:d32277701ccb
1248 user: test
1248 user: test
1249 date: Thu Jan 01 00:00:00 1970 +0000
1249 date: Thu Jan 01 00:00:00 1970 +0000
1250 summary: commit on test
1250 summary: commit on test
1251
1251
1252 changeset: 2:c3a4f03cc9a7
1252 changeset: 2:c3a4f03cc9a7
1253 parent: 0:24427303d56f
1253 parent: 0:24427303d56f
1254 user: test
1254 user: test
1255 date: Thu Jan 01 00:00:00 1970 +0000
1255 date: Thu Jan 01 00:00:00 1970 +0000
1256 summary: commit on default
1256 summary: commit on default
1257
1257
1258 changeset: 1:d32277701ccb
1258 changeset: 1:d32277701ccb
1259 branch: test
1259 branch: test
1260 user: test
1260 user: test
1261 date: Thu Jan 01 00:00:00 1970 +0000
1261 date: Thu Jan 01 00:00:00 1970 +0000
1262 summary: commit on test
1262 summary: commit on test
1263
1263
1264 changeset: 0:24427303d56f
1264 changeset: 0:24427303d56f
1265 user: test
1265 user: test
1266 date: Thu Jan 01 00:00:00 1970 +0000
1266 date: Thu Jan 01 00:00:00 1970 +0000
1267 summary: commit on default
1267 summary: commit on default
1268
1268
1269
1269
1270
1270
1271 log -b default -b .
1271 log -b default -b .
1272
1272
1273 $ hg log -b default -b .
1273 $ hg log -b default -b .
1274 changeset: 3:f5d8de11c2e2
1274 changeset: 3:f5d8de11c2e2
1275 branch: test
1275 branch: test
1276 tag: tip
1276 tag: tip
1277 parent: 1:d32277701ccb
1277 parent: 1:d32277701ccb
1278 user: test
1278 user: test
1279 date: Thu Jan 01 00:00:00 1970 +0000
1279 date: Thu Jan 01 00:00:00 1970 +0000
1280 summary: commit on test
1280 summary: commit on test
1281
1281
1282 changeset: 2:c3a4f03cc9a7
1282 changeset: 2:c3a4f03cc9a7
1283 parent: 0:24427303d56f
1283 parent: 0:24427303d56f
1284 user: test
1284 user: test
1285 date: Thu Jan 01 00:00:00 1970 +0000
1285 date: Thu Jan 01 00:00:00 1970 +0000
1286 summary: commit on default
1286 summary: commit on default
1287
1287
1288 changeset: 1:d32277701ccb
1288 changeset: 1:d32277701ccb
1289 branch: test
1289 branch: test
1290 user: test
1290 user: test
1291 date: Thu Jan 01 00:00:00 1970 +0000
1291 date: Thu Jan 01 00:00:00 1970 +0000
1292 summary: commit on test
1292 summary: commit on test
1293
1293
1294 changeset: 0:24427303d56f
1294 changeset: 0:24427303d56f
1295 user: test
1295 user: test
1296 date: Thu Jan 01 00:00:00 1970 +0000
1296 date: Thu Jan 01 00:00:00 1970 +0000
1297 summary: commit on default
1297 summary: commit on default
1298
1298
1299
1299
1300
1300
1301 log -b . -b test
1301 log -b . -b test
1302
1302
1303 $ hg log -b . -b test
1303 $ hg log -b . -b test
1304 changeset: 3:f5d8de11c2e2
1304 changeset: 3:f5d8de11c2e2
1305 branch: test
1305 branch: test
1306 tag: tip
1306 tag: tip
1307 parent: 1:d32277701ccb
1307 parent: 1:d32277701ccb
1308 user: test
1308 user: test
1309 date: Thu Jan 01 00:00:00 1970 +0000
1309 date: Thu Jan 01 00:00:00 1970 +0000
1310 summary: commit on test
1310 summary: commit on test
1311
1311
1312 changeset: 1:d32277701ccb
1312 changeset: 1:d32277701ccb
1313 branch: test
1313 branch: test
1314 user: test
1314 user: test
1315 date: Thu Jan 01 00:00:00 1970 +0000
1315 date: Thu Jan 01 00:00:00 1970 +0000
1316 summary: commit on test
1316 summary: commit on test
1317
1317
1318
1318
1319
1319
1320 log -b 2
1320 log -b 2
1321
1321
1322 $ hg log -b 2
1322 $ hg log -b 2
1323 changeset: 2:c3a4f03cc9a7
1323 changeset: 2:c3a4f03cc9a7
1324 parent: 0:24427303d56f
1324 parent: 0:24427303d56f
1325 user: test
1325 user: test
1326 date: Thu Jan 01 00:00:00 1970 +0000
1326 date: Thu Jan 01 00:00:00 1970 +0000
1327 summary: commit on default
1327 summary: commit on default
1328
1328
1329 changeset: 0:24427303d56f
1329 changeset: 0:24427303d56f
1330 user: test
1330 user: test
1331 date: Thu Jan 01 00:00:00 1970 +0000
1331 date: Thu Jan 01 00:00:00 1970 +0000
1332 summary: commit on default
1332 summary: commit on default
1333
1333
1334 #if gettext
1334 #if gettext
1335
1335
1336 Test that all log names are translated (e.g. branches, bookmarks, tags):
1336 Test that all log names are translated (e.g. branches, bookmarks, tags):
1337
1337
1338 $ hg bookmark babar -r tip
1338 $ hg bookmark babar -r tip
1339
1339
1340 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1340 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1341 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1341 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1342 Zweig: test
1342 Zweig: test
1343 Lesezeichen: babar
1343 Lesezeichen: babar
1344 Marke: tip
1344 Marke: tip
1345 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1345 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1346 Nutzer: test
1346 Nutzer: test
1347 Datum: Thu Jan 01 00:00:00 1970 +0000
1347 Datum: Thu Jan 01 00:00:00 1970 +0000
1348 Zusammenfassung: commit on test
1348 Zusammenfassung: commit on test
1349
1349
1350 $ hg bookmark -d babar
1350 $ hg bookmark -d babar
1351
1351
1352 #endif
1352 #endif
1353
1353
1354 log -p --cwd dir (in subdir)
1354 log -p --cwd dir (in subdir)
1355
1355
1356 $ mkdir dir
1356 $ mkdir dir
1357 $ hg log -p --cwd dir
1357 $ hg log -p --cwd dir
1358 changeset: 3:f5d8de11c2e2
1358 changeset: 3:f5d8de11c2e2
1359 branch: test
1359 branch: test
1360 tag: tip
1360 tag: tip
1361 parent: 1:d32277701ccb
1361 parent: 1:d32277701ccb
1362 user: test
1362 user: test
1363 date: Thu Jan 01 00:00:00 1970 +0000
1363 date: Thu Jan 01 00:00:00 1970 +0000
1364 summary: commit on test
1364 summary: commit on test
1365
1365
1366 diff -r d32277701ccb -r f5d8de11c2e2 c
1366 diff -r d32277701ccb -r f5d8de11c2e2 c
1367 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1367 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1368 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1368 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1369 @@ -0,0 +1,1 @@
1369 @@ -0,0 +1,1 @@
1370 +c
1370 +c
1371
1371
1372 changeset: 2:c3a4f03cc9a7
1372 changeset: 2:c3a4f03cc9a7
1373 parent: 0:24427303d56f
1373 parent: 0:24427303d56f
1374 user: test
1374 user: test
1375 date: Thu Jan 01 00:00:00 1970 +0000
1375 date: Thu Jan 01 00:00:00 1970 +0000
1376 summary: commit on default
1376 summary: commit on default
1377
1377
1378 diff -r 24427303d56f -r c3a4f03cc9a7 c
1378 diff -r 24427303d56f -r c3a4f03cc9a7 c
1379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1380 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1380 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1381 @@ -0,0 +1,1 @@
1381 @@ -0,0 +1,1 @@
1382 +c
1382 +c
1383
1383
1384 changeset: 1:d32277701ccb
1384 changeset: 1:d32277701ccb
1385 branch: test
1385 branch: test
1386 user: test
1386 user: test
1387 date: Thu Jan 01 00:00:00 1970 +0000
1387 date: Thu Jan 01 00:00:00 1970 +0000
1388 summary: commit on test
1388 summary: commit on test
1389
1389
1390 diff -r 24427303d56f -r d32277701ccb b
1390 diff -r 24427303d56f -r d32277701ccb b
1391 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1391 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1392 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1392 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1393 @@ -0,0 +1,1 @@
1393 @@ -0,0 +1,1 @@
1394 +b
1394 +b
1395
1395
1396 changeset: 0:24427303d56f
1396 changeset: 0:24427303d56f
1397 user: test
1397 user: test
1398 date: Thu Jan 01 00:00:00 1970 +0000
1398 date: Thu Jan 01 00:00:00 1970 +0000
1399 summary: commit on default
1399 summary: commit on default
1400
1400
1401 diff -r 000000000000 -r 24427303d56f a
1401 diff -r 000000000000 -r 24427303d56f a
1402 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1402 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1403 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1403 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1404 @@ -0,0 +1,1 @@
1404 @@ -0,0 +1,1 @@
1405 +a
1405 +a
1406
1406
1407
1407
1408
1408
1409 log -p -R repo
1409 log -p -R repo
1410
1410
1411 $ cd dir
1411 $ cd dir
1412 $ hg log -p -R .. ../a
1412 $ hg log -p -R .. ../a
1413 changeset: 0:24427303d56f
1413 changeset: 0:24427303d56f
1414 user: test
1414 user: test
1415 date: Thu Jan 01 00:00:00 1970 +0000
1415 date: Thu Jan 01 00:00:00 1970 +0000
1416 summary: commit on default
1416 summary: commit on default
1417
1417
1418 diff -r 000000000000 -r 24427303d56f a
1418 diff -r 000000000000 -r 24427303d56f a
1419 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1419 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1420 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1420 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1421 @@ -0,0 +1,1 @@
1421 @@ -0,0 +1,1 @@
1422 +a
1422 +a
1423
1423
1424
1424
1425 $ cd ../..
1425 $ cd ../..
1426
1426
1427 $ hg init follow2
1427 $ hg init follow2
1428 $ cd follow2
1428 $ cd follow2
1429
1429
1430 # Build the following history:
1430 # Build the following history:
1431 # tip - o - x - o - x - x
1431 # tip - o - x - o - x - x
1432 # \ /
1432 # \ /
1433 # o - o - o - x
1433 # o - o - o - x
1434 # \ /
1434 # \ /
1435 # o
1435 # o
1436 #
1436 #
1437 # Where "o" is a revision containing "foo" and
1437 # Where "o" is a revision containing "foo" and
1438 # "x" is a revision without "foo"
1438 # "x" is a revision without "foo"
1439
1439
1440 $ touch init
1440 $ touch init
1441 $ hg ci -A -m "init, unrelated"
1441 $ hg ci -A -m "init, unrelated"
1442 adding init
1442 adding init
1443 $ echo 'foo' > init
1443 $ echo 'foo' > init
1444 $ hg ci -m "change, unrelated"
1444 $ hg ci -m "change, unrelated"
1445 $ echo 'foo' > foo
1445 $ echo 'foo' > foo
1446 $ hg ci -A -m "add unrelated old foo"
1446 $ hg ci -A -m "add unrelated old foo"
1447 adding foo
1447 adding foo
1448 $ hg rm foo
1448 $ hg rm foo
1449 $ hg ci -m "delete foo, unrelated"
1449 $ hg ci -m "delete foo, unrelated"
1450 $ echo 'related' > foo
1450 $ echo 'related' > foo
1451 $ hg ci -A -m "add foo, related"
1451 $ hg ci -A -m "add foo, related"
1452 adding foo
1452 adding foo
1453
1453
1454 $ hg up 0
1454 $ hg up 0
1455 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1455 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1456 $ touch branch
1456 $ touch branch
1457 $ hg ci -A -m "first branch, unrelated"
1457 $ hg ci -A -m "first branch, unrelated"
1458 adding branch
1458 adding branch
1459 created new head
1459 created new head
1460 $ touch foo
1460 $ touch foo
1461 $ hg ci -A -m "create foo, related"
1461 $ hg ci -A -m "create foo, related"
1462 adding foo
1462 adding foo
1463 $ echo 'change' > foo
1463 $ echo 'change' > foo
1464 $ hg ci -m "change foo, related"
1464 $ hg ci -m "change foo, related"
1465
1465
1466 $ hg up 6
1466 $ hg up 6
1467 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1467 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1468 $ echo 'change foo in branch' > foo
1468 $ echo 'change foo in branch' > foo
1469 $ hg ci -m "change foo in branch, related"
1469 $ hg ci -m "change foo in branch, related"
1470 created new head
1470 created new head
1471 $ hg merge 7
1471 $ hg merge 7
1472 merging foo
1472 merging foo
1473 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1473 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1474 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1474 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1475 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1475 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1476 [1]
1476 [1]
1477 $ echo 'merge 1' > foo
1477 $ echo 'merge 1' > foo
1478 $ hg resolve -m foo
1478 $ hg resolve -m foo
1479 (no more unresolved files)
1479 (no more unresolved files)
1480 $ hg ci -m "First merge, related"
1480 $ hg ci -m "First merge, related"
1481
1481
1482 $ hg merge 4
1482 $ hg merge 4
1483 merging foo
1483 merging foo
1484 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1484 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1485 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1485 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1486 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1486 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1487 [1]
1487 [1]
1488 $ echo 'merge 2' > foo
1488 $ echo 'merge 2' > foo
1489 $ hg resolve -m foo
1489 $ hg resolve -m foo
1490 (no more unresolved files)
1490 (no more unresolved files)
1491 $ hg ci -m "Last merge, related"
1491 $ hg ci -m "Last merge, related"
1492
1492
1493 $ hg log --graph
1493 $ hg log --graph
1494 @ changeset: 10:4dae8563d2c5
1494 @ changeset: 10:4dae8563d2c5
1495 |\ tag: tip
1495 |\ tag: tip
1496 | | parent: 9:7b35701b003e
1496 | | parent: 9:7b35701b003e
1497 | | parent: 4:88176d361b69
1497 | | parent: 4:88176d361b69
1498 | | user: test
1498 | | user: test
1499 | | date: Thu Jan 01 00:00:00 1970 +0000
1499 | | date: Thu Jan 01 00:00:00 1970 +0000
1500 | | summary: Last merge, related
1500 | | summary: Last merge, related
1501 | |
1501 | |
1502 | o changeset: 9:7b35701b003e
1502 | o changeset: 9:7b35701b003e
1503 | |\ parent: 8:e5416ad8a855
1503 | |\ parent: 8:e5416ad8a855
1504 | | | parent: 7:87fe3144dcfa
1504 | | | parent: 7:87fe3144dcfa
1505 | | | user: test
1505 | | | user: test
1506 | | | date: Thu Jan 01 00:00:00 1970 +0000
1506 | | | date: Thu Jan 01 00:00:00 1970 +0000
1507 | | | summary: First merge, related
1507 | | | summary: First merge, related
1508 | | |
1508 | | |
1509 | | o changeset: 8:e5416ad8a855
1509 | | o changeset: 8:e5416ad8a855
1510 | | | parent: 6:dc6c325fe5ee
1510 | | | parent: 6:dc6c325fe5ee
1511 | | | user: test
1511 | | | user: test
1512 | | | date: Thu Jan 01 00:00:00 1970 +0000
1512 | | | date: Thu Jan 01 00:00:00 1970 +0000
1513 | | | summary: change foo in branch, related
1513 | | | summary: change foo in branch, related
1514 | | |
1514 | | |
1515 | o | changeset: 7:87fe3144dcfa
1515 | o | changeset: 7:87fe3144dcfa
1516 | |/ user: test
1516 | |/ user: test
1517 | | date: Thu Jan 01 00:00:00 1970 +0000
1517 | | date: Thu Jan 01 00:00:00 1970 +0000
1518 | | summary: change foo, related
1518 | | summary: change foo, related
1519 | |
1519 | |
1520 | o changeset: 6:dc6c325fe5ee
1520 | o changeset: 6:dc6c325fe5ee
1521 | | user: test
1521 | | user: test
1522 | | date: Thu Jan 01 00:00:00 1970 +0000
1522 | | date: Thu Jan 01 00:00:00 1970 +0000
1523 | | summary: create foo, related
1523 | | summary: create foo, related
1524 | |
1524 | |
1525 | o changeset: 5:73db34516eb9
1525 | o changeset: 5:73db34516eb9
1526 | | parent: 0:e87515fd044a
1526 | | parent: 0:e87515fd044a
1527 | | user: test
1527 | | user: test
1528 | | date: Thu Jan 01 00:00:00 1970 +0000
1528 | | date: Thu Jan 01 00:00:00 1970 +0000
1529 | | summary: first branch, unrelated
1529 | | summary: first branch, unrelated
1530 | |
1530 | |
1531 o | changeset: 4:88176d361b69
1531 o | changeset: 4:88176d361b69
1532 | | user: test
1532 | | user: test
1533 | | date: Thu Jan 01 00:00:00 1970 +0000
1533 | | date: Thu Jan 01 00:00:00 1970 +0000
1534 | | summary: add foo, related
1534 | | summary: add foo, related
1535 | |
1535 | |
1536 o | changeset: 3:dd78ae4afb56
1536 o | changeset: 3:dd78ae4afb56
1537 | | user: test
1537 | | user: test
1538 | | date: Thu Jan 01 00:00:00 1970 +0000
1538 | | date: Thu Jan 01 00:00:00 1970 +0000
1539 | | summary: delete foo, unrelated
1539 | | summary: delete foo, unrelated
1540 | |
1540 | |
1541 o | changeset: 2:c4c64aedf0f7
1541 o | changeset: 2:c4c64aedf0f7
1542 | | user: test
1542 | | user: test
1543 | | date: Thu Jan 01 00:00:00 1970 +0000
1543 | | date: Thu Jan 01 00:00:00 1970 +0000
1544 | | summary: add unrelated old foo
1544 | | summary: add unrelated old foo
1545 | |
1545 | |
1546 o | changeset: 1:e5faa7440653
1546 o | changeset: 1:e5faa7440653
1547 |/ user: test
1547 |/ user: test
1548 | date: Thu Jan 01 00:00:00 1970 +0000
1548 | date: Thu Jan 01 00:00:00 1970 +0000
1549 | summary: change, unrelated
1549 | summary: change, unrelated
1550 |
1550 |
1551 o changeset: 0:e87515fd044a
1551 o changeset: 0:e87515fd044a
1552 user: test
1552 user: test
1553 date: Thu Jan 01 00:00:00 1970 +0000
1553 date: Thu Jan 01 00:00:00 1970 +0000
1554 summary: init, unrelated
1554 summary: init, unrelated
1555
1555
1556
1556
1557 $ hg --traceback log -f foo
1557 $ hg --traceback log -f foo
1558 changeset: 10:4dae8563d2c5
1558 changeset: 10:4dae8563d2c5
1559 tag: tip
1559 tag: tip
1560 parent: 9:7b35701b003e
1560 parent: 9:7b35701b003e
1561 parent: 4:88176d361b69
1561 parent: 4:88176d361b69
1562 user: test
1562 user: test
1563 date: Thu Jan 01 00:00:00 1970 +0000
1563 date: Thu Jan 01 00:00:00 1970 +0000
1564 summary: Last merge, related
1564 summary: Last merge, related
1565
1565
1566 changeset: 9:7b35701b003e
1566 changeset: 9:7b35701b003e
1567 parent: 8:e5416ad8a855
1567 parent: 8:e5416ad8a855
1568 parent: 7:87fe3144dcfa
1568 parent: 7:87fe3144dcfa
1569 user: test
1569 user: test
1570 date: Thu Jan 01 00:00:00 1970 +0000
1570 date: Thu Jan 01 00:00:00 1970 +0000
1571 summary: First merge, related
1571 summary: First merge, related
1572
1572
1573 changeset: 8:e5416ad8a855
1573 changeset: 8:e5416ad8a855
1574 parent: 6:dc6c325fe5ee
1574 parent: 6:dc6c325fe5ee
1575 user: test
1575 user: test
1576 date: Thu Jan 01 00:00:00 1970 +0000
1576 date: Thu Jan 01 00:00:00 1970 +0000
1577 summary: change foo in branch, related
1577 summary: change foo in branch, related
1578
1578
1579 changeset: 7:87fe3144dcfa
1579 changeset: 7:87fe3144dcfa
1580 user: test
1580 user: test
1581 date: Thu Jan 01 00:00:00 1970 +0000
1581 date: Thu Jan 01 00:00:00 1970 +0000
1582 summary: change foo, related
1582 summary: change foo, related
1583
1583
1584 changeset: 6:dc6c325fe5ee
1584 changeset: 6:dc6c325fe5ee
1585 user: test
1585 user: test
1586 date: Thu Jan 01 00:00:00 1970 +0000
1586 date: Thu Jan 01 00:00:00 1970 +0000
1587 summary: create foo, related
1587 summary: create foo, related
1588
1588
1589 changeset: 4:88176d361b69
1589 changeset: 4:88176d361b69
1590 user: test
1590 user: test
1591 date: Thu Jan 01 00:00:00 1970 +0000
1591 date: Thu Jan 01 00:00:00 1970 +0000
1592 summary: add foo, related
1592 summary: add foo, related
1593
1593
1594
1594
1595 Also check when maxrev < lastrevfilelog
1595 Also check when maxrev < lastrevfilelog
1596
1596
1597 $ hg --traceback log -f -r4 foo
1597 $ hg --traceback log -f -r4 foo
1598 changeset: 4:88176d361b69
1598 changeset: 4:88176d361b69
1599 user: test
1599 user: test
1600 date: Thu Jan 01 00:00:00 1970 +0000
1600 date: Thu Jan 01 00:00:00 1970 +0000
1601 summary: add foo, related
1601 summary: add foo, related
1602
1602
1603 changeset: 2:c4c64aedf0f7
1603 changeset: 2:c4c64aedf0f7
1604 user: test
1604 user: test
1605 date: Thu Jan 01 00:00:00 1970 +0000
1605 date: Thu Jan 01 00:00:00 1970 +0000
1606 summary: add unrelated old foo
1606 summary: add unrelated old foo
1607
1607
1608 $ cd ..
1608 $ cd ..
1609
1609
1610 Issue2383: hg log showing _less_ differences than hg diff
1610 Issue2383: hg log showing _less_ differences than hg diff
1611
1611
1612 $ hg init issue2383
1612 $ hg init issue2383
1613 $ cd issue2383
1613 $ cd issue2383
1614
1614
1615 Create a test repo:
1615 Create a test repo:
1616
1616
1617 $ echo a > a
1617 $ echo a > a
1618 $ hg ci -Am0
1618 $ hg ci -Am0
1619 adding a
1619 adding a
1620 $ echo b > b
1620 $ echo b > b
1621 $ hg ci -Am1
1621 $ hg ci -Am1
1622 adding b
1622 adding b
1623 $ hg co 0
1623 $ hg co 0
1624 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1624 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1625 $ echo b > a
1625 $ echo b > a
1626 $ hg ci -m2
1626 $ hg ci -m2
1627 created new head
1627 created new head
1628
1628
1629 Merge:
1629 Merge:
1630
1630
1631 $ hg merge
1631 $ hg merge
1632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1633 (branch merge, don't forget to commit)
1633 (branch merge, don't forget to commit)
1634
1634
1635 Make sure there's a file listed in the merge to trigger the bug:
1635 Make sure there's a file listed in the merge to trigger the bug:
1636
1636
1637 $ echo c > a
1637 $ echo c > a
1638 $ hg ci -m3
1638 $ hg ci -m3
1639
1639
1640 Two files shown here in diff:
1640 Two files shown here in diff:
1641
1641
1642 $ hg diff --rev 2:3
1642 $ hg diff --rev 2:3
1643 diff -r b09be438c43a -r 8e07aafe1edc a
1643 diff -r b09be438c43a -r 8e07aafe1edc a
1644 --- a/a Thu Jan 01 00:00:00 1970 +0000
1644 --- a/a Thu Jan 01 00:00:00 1970 +0000
1645 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1645 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1646 @@ -1,1 +1,1 @@
1646 @@ -1,1 +1,1 @@
1647 -b
1647 -b
1648 +c
1648 +c
1649 diff -r b09be438c43a -r 8e07aafe1edc b
1649 diff -r b09be438c43a -r 8e07aafe1edc b
1650 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1650 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1651 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1651 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1652 @@ -0,0 +1,1 @@
1652 @@ -0,0 +1,1 @@
1653 +b
1653 +b
1654
1654
1655 Diff here should be the same:
1655 Diff here should be the same:
1656
1656
1657 $ hg log -vpr 3
1657 $ hg log -vpr 3
1658 changeset: 3:8e07aafe1edc
1658 changeset: 3:8e07aafe1edc
1659 tag: tip
1659 tag: tip
1660 parent: 2:b09be438c43a
1660 parent: 2:b09be438c43a
1661 parent: 1:925d80f479bb
1661 parent: 1:925d80f479bb
1662 user: test
1662 user: test
1663 date: Thu Jan 01 00:00:00 1970 +0000
1663 date: Thu Jan 01 00:00:00 1970 +0000
1664 files: a
1664 files: a
1665 description:
1665 description:
1666 3
1666 3
1667
1667
1668
1668
1669 diff -r b09be438c43a -r 8e07aafe1edc a
1669 diff -r b09be438c43a -r 8e07aafe1edc a
1670 --- a/a Thu Jan 01 00:00:00 1970 +0000
1670 --- a/a Thu Jan 01 00:00:00 1970 +0000
1671 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1671 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1672 @@ -1,1 +1,1 @@
1672 @@ -1,1 +1,1 @@
1673 -b
1673 -b
1674 +c
1674 +c
1675 diff -r b09be438c43a -r 8e07aafe1edc b
1675 diff -r b09be438c43a -r 8e07aafe1edc b
1676 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1676 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1677 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1677 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1678 @@ -0,0 +1,1 @@
1678 @@ -0,0 +1,1 @@
1679 +b
1679 +b
1680
1680
1681 $ cd ..
1681 $ cd ..
1682
1682
1683 'hg log -r rev fn' when last(filelog(fn)) != rev
1683 'hg log -r rev fn' when last(filelog(fn)) != rev
1684
1684
1685 $ hg init simplelog
1685 $ hg init simplelog
1686 $ cd simplelog
1686 $ cd simplelog
1687 $ echo f > a
1687 $ echo f > a
1688 $ hg ci -Am'a' -d '0 0'
1688 $ hg ci -Am'a' -d '0 0'
1689 adding a
1689 adding a
1690 $ echo f >> a
1690 $ echo f >> a
1691 $ hg ci -Am'a bis' -d '1 0'
1691 $ hg ci -Am'a bis' -d '1 0'
1692
1692
1693 $ hg log -r0 a
1693 $ hg log -r0 a
1694 changeset: 0:9f758d63dcde
1694 changeset: 0:9f758d63dcde
1695 user: test
1695 user: test
1696 date: Thu Jan 01 00:00:00 1970 +0000
1696 date: Thu Jan 01 00:00:00 1970 +0000
1697 summary: a
1697 summary: a
1698
1698
1699 enable obsolete to test hidden feature
1699 enable obsolete to test hidden feature
1700
1700
1701 $ cat >> $HGRCPATH << EOF
1701 $ cat >> $HGRCPATH << EOF
1702 > [experimental]
1702 > [experimental]
1703 > stabilization=createmarkers
1703 > stabilization=createmarkers
1704 > EOF
1704 > EOF
1705
1705
1706 $ hg log --template='{rev}:{node}\n'
1706 $ hg log --template='{rev}:{node}\n'
1707 1:a765632148dc55d38c35c4f247c618701886cb2f
1707 1:a765632148dc55d38c35c4f247c618701886cb2f
1708 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1708 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1709 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1709 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1710 obsoleted 1 changesets
1710 obsoleted 1 changesets
1711 $ hg up null -q
1711 $ hg up null -q
1712 $ hg log --template='{rev}:{node}\n'
1712 $ hg log --template='{rev}:{node}\n'
1713 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1713 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1714 $ hg log --template='{rev}:{node}\n' --hidden
1714 $ hg log --template='{rev}:{node}\n' --hidden
1715 1:a765632148dc55d38c35c4f247c618701886cb2f
1715 1:a765632148dc55d38c35c4f247c618701886cb2f
1716 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1716 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1717 $ hg log -r a
1717 $ hg log -r a
1718 abort: hidden revision 'a'!
1718 abort: hidden revision 'a'!
1719 (use --hidden to access hidden revisions)
1719 (use --hidden to access hidden revisions)
1720 [255]
1720 [255]
1721
1721
1722 test that parent prevent a changeset to be hidden
1722 test that parent prevent a changeset to be hidden
1723
1723
1724 $ hg up 1 -q --hidden
1724 $ hg up 1 -q --hidden
1725 $ hg log --template='{rev}:{node}\n'
1725 $ hg log --template='{rev}:{node}\n'
1726 1:a765632148dc55d38c35c4f247c618701886cb2f
1726 1:a765632148dc55d38c35c4f247c618701886cb2f
1727 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1727 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1728
1728
1729 test that second parent prevent a changeset to be hidden too
1729 test that second parent prevent a changeset to be hidden too
1730
1730
1731 $ hg debugsetparents 0 1 # nothing suitable to merge here
1731 $ hg debugsetparents 0 1 # nothing suitable to merge here
1732 $ hg log --template='{rev}:{node}\n'
1732 $ hg log --template='{rev}:{node}\n'
1733 1:a765632148dc55d38c35c4f247c618701886cb2f
1733 1:a765632148dc55d38c35c4f247c618701886cb2f
1734 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1734 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1735 $ hg debugsetparents 1
1735 $ hg debugsetparents 1
1736 $ hg up -q null
1736 $ hg up -q null
1737
1737
1738 bookmarks prevent a changeset being hidden
1738 bookmarks prevent a changeset being hidden
1739
1739
1740 $ hg bookmark --hidden -r 1 X
1740 $ hg bookmark --hidden -r 1 X
1741 $ hg log --template '{rev}:{node}\n'
1741 $ hg log --template '{rev}:{node}\n'
1742 1:a765632148dc55d38c35c4f247c618701886cb2f
1742 1:a765632148dc55d38c35c4f247c618701886cb2f
1743 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1743 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1744 $ hg bookmark -d X
1744 $ hg bookmark -d X
1745
1745
1746 divergent bookmarks are not hidden
1746 divergent bookmarks are not hidden
1747
1747
1748 $ hg bookmark --hidden -r 1 X@foo
1748 $ hg bookmark --hidden -r 1 X@foo
1749 $ hg log --template '{rev}:{node}\n'
1749 $ hg log --template '{rev}:{node}\n'
1750 1:a765632148dc55d38c35c4f247c618701886cb2f
1750 1:a765632148dc55d38c35c4f247c618701886cb2f
1751 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1751 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1752
1752
1753 test hidden revision 0 (issue5385)
1753 test hidden revision 0 (issue5385)
1754
1754
1755 $ hg bookmark -d X@foo
1755 $ hg bookmark -d X@foo
1756 $ hg up null -q
1756 $ hg up null -q
1757 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1757 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1758 obsoleted 1 changesets
1758 obsoleted 1 changesets
1759 $ echo f > b
1759 $ echo f > b
1760 $ hg ci -Am'b' -d '2 0'
1760 $ hg ci -Am'b' -d '2 0'
1761 adding b
1761 adding b
1762 $ echo f >> b
1762 $ echo f >> b
1763 $ hg ci -m'b bis' -d '3 0'
1763 $ hg ci -m'b bis' -d '3 0'
1764 $ hg log -T'{rev}:{node}\n'
1764 $ hg log -T'{rev}:{node}\n'
1765 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1765 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1766 2:94375ec45bddd2a824535fc04855bd058c926ec0
1766 2:94375ec45bddd2a824535fc04855bd058c926ec0
1767
1767
1768 $ hg log -T'{rev}:{node}\n' -r:
1768 $ hg log -T'{rev}:{node}\n' -r:
1769 2:94375ec45bddd2a824535fc04855bd058c926ec0
1769 2:94375ec45bddd2a824535fc04855bd058c926ec0
1770 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1770 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1771 $ hg log -T'{rev}:{node}\n' -r:tip
1771 $ hg log -T'{rev}:{node}\n' -r:tip
1772 2:94375ec45bddd2a824535fc04855bd058c926ec0
1772 2:94375ec45bddd2a824535fc04855bd058c926ec0
1773 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1773 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1774 $ hg log -T'{rev}:{node}\n' -r:0
1774 $ hg log -T'{rev}:{node}\n' -r:0
1775 abort: hidden revision '0'!
1775 abort: hidden revision '0'!
1776 (use --hidden to access hidden revisions)
1776 (use --hidden to access hidden revisions)
1777 [255]
1777 [255]
1778 $ hg log -T'{rev}:{node}\n' -f
1778 $ hg log -T'{rev}:{node}\n' -f
1779 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1779 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1780 2:94375ec45bddd2a824535fc04855bd058c926ec0
1780 2:94375ec45bddd2a824535fc04855bd058c926ec0
1781
1781
1782 clear extensions configuration
1782 clear extensions configuration
1783 $ echo '[extensions]' >> $HGRCPATH
1783 $ echo '[extensions]' >> $HGRCPATH
1784 $ echo "obs=!" >> $HGRCPATH
1784 $ echo "obs=!" >> $HGRCPATH
1785 $ cd ..
1785 $ cd ..
1786
1786
1787 test -u/-k for problematic encoding
1787 test -u/-k for problematic encoding
1788 # unicode: cp932:
1788 # unicode: cp932:
1789 # u30A2 0x83 0x41(= 'A')
1789 # u30A2 0x83 0x41(= 'A')
1790 # u30C2 0x83 0x61(= 'a')
1790 # u30C2 0x83 0x61(= 'a')
1791
1791
1792 $ hg init problematicencoding
1792 $ hg init problematicencoding
1793 $ cd problematicencoding
1793 $ cd problematicencoding
1794
1794
1795 $ $PYTHON > setup.sh <<EOF
1795 $ $PYTHON > setup.sh <<EOF
1796 > print(u'''
1796 > print(u'''
1797 > echo a > text
1797 > echo a > text
1798 > hg add text
1798 > hg add text
1799 > hg --encoding utf-8 commit -u '\u30A2' -m none
1799 > hg --encoding utf-8 commit -u '\u30A2' -m none
1800 > echo b > text
1800 > echo b > text
1801 > hg --encoding utf-8 commit -u '\u30C2' -m none
1801 > hg --encoding utf-8 commit -u '\u30C2' -m none
1802 > echo c > text
1802 > echo c > text
1803 > hg --encoding utf-8 commit -u none -m '\u30A2'
1803 > hg --encoding utf-8 commit -u none -m '\u30A2'
1804 > echo d > text
1804 > echo d > text
1805 > hg --encoding utf-8 commit -u none -m '\u30C2'
1805 > hg --encoding utf-8 commit -u none -m '\u30C2'
1806 > '''.encode('utf-8'))
1806 > '''.encode('utf-8'))
1807 > EOF
1807 > EOF
1808 $ sh < setup.sh
1808 $ sh < setup.sh
1809
1809
1810 test in problematic encoding
1810 test in problematic encoding
1811 $ $PYTHON > test.sh <<EOF
1811 $ $PYTHON > test.sh <<EOF
1812 > print(u'''
1812 > print(u'''
1813 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
1813 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
1814 > echo ====
1814 > echo ====
1815 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
1815 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
1816 > echo ====
1816 > echo ====
1817 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
1817 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
1818 > echo ====
1818 > echo ====
1819 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
1819 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
1820 > '''.encode('cp932'))
1820 > '''.encode('cp932'))
1821 > EOF
1821 > EOF
1822 $ sh < test.sh
1822 $ sh < test.sh
1823 0
1823 0
1824 ====
1824 ====
1825 1
1825 1
1826 ====
1826 ====
1827 2
1827 2
1828 0
1828 0
1829 ====
1829 ====
1830 3
1830 3
1831 1
1831 1
1832
1832
1833 $ cd ..
1833 $ cd ..
1834
1834
1835 test hg log on non-existent files and on directories
1835 test hg log on non-existent files and on directories
1836 $ hg init issue1340
1836 $ hg init issue1340
1837 $ cd issue1340
1837 $ cd issue1340
1838 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
1838 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
1839 $ echo 1 > d1/f1
1839 $ echo 1 > d1/f1
1840 $ echo 1 > D2/f1
1840 $ echo 1 > D2/f1
1841 $ echo 1 > D3.i/f1
1841 $ echo 1 > D3.i/f1
1842 $ echo 1 > d4.hg/f1
1842 $ echo 1 > d4.hg/f1
1843 $ echo 1 > d5.d/f1
1843 $ echo 1 > d5.d/f1
1844 $ echo 1 > .d6/f1
1844 $ echo 1 > .d6/f1
1845 $ hg -q add .
1845 $ hg -q add .
1846 $ hg commit -m "a bunch of weird directories"
1846 $ hg commit -m "a bunch of weird directories"
1847 $ hg log -l1 d1/f1 | grep changeset
1847 $ hg log -l1 d1/f1 | grep changeset
1848 changeset: 0:65624cd9070a
1848 changeset: 0:65624cd9070a
1849 $ hg log -l1 f1
1849 $ hg log -l1 f1
1850 $ hg log -l1 . | grep changeset
1850 $ hg log -l1 . | grep changeset
1851 changeset: 0:65624cd9070a
1851 changeset: 0:65624cd9070a
1852 $ hg log -l1 ./ | grep changeset
1852 $ hg log -l1 ./ | grep changeset
1853 changeset: 0:65624cd9070a
1853 changeset: 0:65624cd9070a
1854 $ hg log -l1 d1 | grep changeset
1854 $ hg log -l1 d1 | grep changeset
1855 changeset: 0:65624cd9070a
1855 changeset: 0:65624cd9070a
1856 $ hg log -l1 D2 | grep changeset
1856 $ hg log -l1 D2 | grep changeset
1857 changeset: 0:65624cd9070a
1857 changeset: 0:65624cd9070a
1858 $ hg log -l1 D2/f1 | grep changeset
1858 $ hg log -l1 D2/f1 | grep changeset
1859 changeset: 0:65624cd9070a
1859 changeset: 0:65624cd9070a
1860 $ hg log -l1 D3.i | grep changeset
1860 $ hg log -l1 D3.i | grep changeset
1861 changeset: 0:65624cd9070a
1861 changeset: 0:65624cd9070a
1862 $ hg log -l1 D3.i/f1 | grep changeset
1862 $ hg log -l1 D3.i/f1 | grep changeset
1863 changeset: 0:65624cd9070a
1863 changeset: 0:65624cd9070a
1864 $ hg log -l1 d4.hg | grep changeset
1864 $ hg log -l1 d4.hg | grep changeset
1865 changeset: 0:65624cd9070a
1865 changeset: 0:65624cd9070a
1866 $ hg log -l1 d4.hg/f1 | grep changeset
1866 $ hg log -l1 d4.hg/f1 | grep changeset
1867 changeset: 0:65624cd9070a
1867 changeset: 0:65624cd9070a
1868 $ hg log -l1 d5.d | grep changeset
1868 $ hg log -l1 d5.d | grep changeset
1869 changeset: 0:65624cd9070a
1869 changeset: 0:65624cd9070a
1870 $ hg log -l1 d5.d/f1 | grep changeset
1870 $ hg log -l1 d5.d/f1 | grep changeset
1871 changeset: 0:65624cd9070a
1871 changeset: 0:65624cd9070a
1872 $ hg log -l1 .d6 | grep changeset
1872 $ hg log -l1 .d6 | grep changeset
1873 changeset: 0:65624cd9070a
1873 changeset: 0:65624cd9070a
1874 $ hg log -l1 .d6/f1 | grep changeset
1874 $ hg log -l1 .d6/f1 | grep changeset
1875 changeset: 0:65624cd9070a
1875 changeset: 0:65624cd9070a
1876
1876
1877 issue3772: hg log -r :null showing revision 0 as well
1877 issue3772: hg log -r :null showing revision 0 as well
1878
1878
1879 $ hg log -r :null
1879 $ hg log -r :null
1880 changeset: 0:65624cd9070a
1880 changeset: 0:65624cd9070a
1881 tag: tip
1881 tag: tip
1882 user: test
1882 user: test
1883 date: Thu Jan 01 00:00:00 1970 +0000
1883 date: Thu Jan 01 00:00:00 1970 +0000
1884 summary: a bunch of weird directories
1884 summary: a bunch of weird directories
1885
1885
1886 changeset: -1:000000000000
1886 changeset: -1:000000000000
1887 user:
1887 user:
1888 date: Thu Jan 01 00:00:00 1970 +0000
1888 date: Thu Jan 01 00:00:00 1970 +0000
1889
1889
1890 $ hg log -r null:null
1890 $ hg log -r null:null
1891 changeset: -1:000000000000
1891 changeset: -1:000000000000
1892 user:
1892 user:
1893 date: Thu Jan 01 00:00:00 1970 +0000
1893 date: Thu Jan 01 00:00:00 1970 +0000
1894
1894
1895 working-directory revision requires special treatment
1895 working-directory revision requires special treatment
1896
1896
1897 clean:
1897 clean:
1898
1898
1899 $ hg log -r 'wdir()' --debug
1899 $ hg log -r 'wdir()' --debug
1900 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1900 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1901 phase: draft
1901 phase: draft
1902 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1902 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1903 parent: -1:0000000000000000000000000000000000000000
1903 parent: -1:0000000000000000000000000000000000000000
1904 user: test
1904 user: test
1905 date: [A-Za-z0-9:+ ]+ (re)
1905 date: [A-Za-z0-9:+ ]+ (re)
1906 extra: branch=default
1906 extra: branch=default
1907
1907
1908 $ hg log -r 'wdir()' -p --stat
1908 $ hg log -r 'wdir()' -p --stat
1909 changeset: 2147483647:ffffffffffff
1909 changeset: 2147483647:ffffffffffff
1910 parent: 0:65624cd9070a
1910 parent: 0:65624cd9070a
1911 user: test
1911 user: test
1912 date: [A-Za-z0-9:+ ]+ (re)
1912 date: [A-Za-z0-9:+ ]+ (re)
1913
1913
1914
1914
1915
1915
1916
1916
1917 dirty:
1917 dirty:
1918
1918
1919 $ echo 2 >> d1/f1
1919 $ echo 2 >> d1/f1
1920 $ echo 2 > d1/f2
1920 $ echo 2 > d1/f2
1921 $ hg add d1/f2
1921 $ hg add d1/f2
1922 $ hg remove .d6/f1
1922 $ hg remove .d6/f1
1923 $ hg status
1923 $ hg status
1924 M d1/f1
1924 M d1/f1
1925 A d1/f2
1925 A d1/f2
1926 R .d6/f1
1926 R .d6/f1
1927
1927
1928 $ hg log -r 'wdir()'
1928 $ hg log -r 'wdir()'
1929 changeset: 2147483647:ffffffffffff
1929 changeset: 2147483647:ffffffffffff
1930 parent: 0:65624cd9070a
1930 parent: 0:65624cd9070a
1931 user: test
1931 user: test
1932 date: [A-Za-z0-9:+ ]+ (re)
1932 date: [A-Za-z0-9:+ ]+ (re)
1933
1933
1934 $ hg log -r 'wdir()' -q
1934 $ hg log -r 'wdir()' -q
1935 2147483647:ffffffffffff
1935 2147483647:ffffffffffff
1936
1936
1937 $ hg log -r 'wdir()' --debug
1937 $ hg log -r 'wdir()' --debug
1938 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1938 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
1939 phase: draft
1939 phase: draft
1940 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1940 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
1941 parent: -1:0000000000000000000000000000000000000000
1941 parent: -1:0000000000000000000000000000000000000000
1942 user: test
1942 user: test
1943 date: [A-Za-z0-9:+ ]+ (re)
1943 date: [A-Za-z0-9:+ ]+ (re)
1944 files: d1/f1
1944 files: d1/f1
1945 files+: d1/f2
1945 files+: d1/f2
1946 files-: .d6/f1
1946 files-: .d6/f1
1947 extra: branch=default
1947 extra: branch=default
1948
1948
1949 $ hg log -r 'wdir()' -p --stat --git
1949 $ hg log -r 'wdir()' -p --stat --git
1950 changeset: 2147483647:ffffffffffff
1950 changeset: 2147483647:ffffffffffff
1951 parent: 0:65624cd9070a
1951 parent: 0:65624cd9070a
1952 user: test
1952 user: test
1953 date: [A-Za-z0-9:+ ]+ (re)
1953 date: [A-Za-z0-9:+ ]+ (re)
1954
1954
1955 .d6/f1 | 1 -
1955 .d6/f1 | 1 -
1956 d1/f1 | 1 +
1956 d1/f1 | 1 +
1957 d1/f2 | 1 +
1957 d1/f2 | 1 +
1958 3 files changed, 2 insertions(+), 1 deletions(-)
1958 3 files changed, 2 insertions(+), 1 deletions(-)
1959
1959
1960 diff --git a/.d6/f1 b/.d6/f1
1960 diff --git a/.d6/f1 b/.d6/f1
1961 deleted file mode 100644
1961 deleted file mode 100644
1962 --- a/.d6/f1
1962 --- a/.d6/f1
1963 +++ /dev/null
1963 +++ /dev/null
1964 @@ -1,1 +0,0 @@
1964 @@ -1,1 +0,0 @@
1965 -1
1965 -1
1966 diff --git a/d1/f1 b/d1/f1
1966 diff --git a/d1/f1 b/d1/f1
1967 --- a/d1/f1
1967 --- a/d1/f1
1968 +++ b/d1/f1
1968 +++ b/d1/f1
1969 @@ -1,1 +1,2 @@
1969 @@ -1,1 +1,2 @@
1970 1
1970 1
1971 +2
1971 +2
1972 diff --git a/d1/f2 b/d1/f2
1972 diff --git a/d1/f2 b/d1/f2
1973 new file mode 100644
1973 new file mode 100644
1974 --- /dev/null
1974 --- /dev/null
1975 +++ b/d1/f2
1975 +++ b/d1/f2
1976 @@ -0,0 +1,1 @@
1976 @@ -0,0 +1,1 @@
1977 +2
1977 +2
1978
1978
1979 $ hg log -r 'wdir()' -Tjson
1979 $ hg log -r 'wdir()' -Tjson
1980 [
1980 [
1981 {
1981 {
1982 "rev": null,
1982 "rev": null,
1983 "node": null,
1983 "node": null,
1984 "branch": "default",
1984 "branch": "default",
1985 "phase": "draft",
1985 "phase": "draft",
1986 "user": "test",
1986 "user": "test",
1987 "date": [*, 0], (glob)
1987 "date": [*, 0], (glob)
1988 "desc": "",
1988 "desc": "",
1989 "bookmarks": [],
1989 "bookmarks": [],
1990 "tags": [],
1990 "tags": [],
1991 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
1991 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
1992 }
1992 }
1993 ]
1993 ]
1994
1994
1995 $ hg log -r 'wdir()' -Tjson -q
1995 $ hg log -r 'wdir()' -Tjson -q
1996 [
1996 [
1997 {
1997 {
1998 "rev": null,
1998 "rev": null,
1999 "node": null
1999 "node": null
2000 }
2000 }
2001 ]
2001 ]
2002
2002
2003 $ hg log -r 'wdir()' -Tjson --debug
2003 $ hg log -r 'wdir()' -Tjson --debug
2004 [
2004 [
2005 {
2005 {
2006 "rev": null,
2006 "rev": null,
2007 "node": null,
2007 "node": null,
2008 "branch": "default",
2008 "branch": "default",
2009 "phase": "draft",
2009 "phase": "draft",
2010 "user": "test",
2010 "user": "test",
2011 "date": [*, 0], (glob)
2011 "date": [*, 0], (glob)
2012 "desc": "",
2012 "desc": "",
2013 "bookmarks": [],
2013 "bookmarks": [],
2014 "tags": [],
2014 "tags": [],
2015 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2015 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2016 "manifest": null,
2016 "manifest": null,
2017 "extra": {"branch": "default"},
2017 "extra": {"branch": "default"},
2018 "modified": ["d1/f1"],
2018 "modified": ["d1/f1"],
2019 "added": ["d1/f2"],
2019 "added": ["d1/f2"],
2020 "removed": [".d6/f1"]
2020 "removed": [".d6/f1"]
2021 }
2021 }
2022 ]
2022 ]
2023
2023
2024 $ hg revert -aqC
2024 $ hg revert -aqC
2025
2025
2026 Check that adding an arbitrary name shows up in log automatically
2026 Check that adding an arbitrary name shows up in log automatically
2027
2027
2028 $ cat > ../names.py <<EOF
2028 $ cat > ../names.py <<EOF
2029 > """A small extension to test adding arbitrary names to a repo"""
2029 > """A small extension to test adding arbitrary names to a repo"""
2030 > from __future__ import absolute_import
2030 > from __future__ import absolute_import
2031 > from mercurial import namespaces
2031 > from mercurial import namespaces
2032 >
2032 >
2033 > def reposetup(ui, repo):
2033 > def reposetup(ui, repo):
2034 > foo = {'foo': repo[0].node()}
2034 > foo = {'foo': repo[0].node()}
2035 > names = lambda r: foo.keys()
2035 > names = lambda r: foo.keys()
2036 > namemap = lambda r, name: foo.get(name)
2036 > namemap = lambda r, name: foo.get(name)
2037 > nodemap = lambda r, node: [name for name, n in foo.iteritems()
2037 > nodemap = lambda r, node: [name for name, n in foo.iteritems()
2038 > if n == node]
2038 > if n == node]
2039 > ns = namespaces.namespace(
2039 > ns = namespaces.namespace(
2040 > "bars", templatename="bar", logname="barlog",
2040 > "bars", templatename="bar", logname="barlog",
2041 > colorname="barcolor", listnames=names, namemap=namemap,
2041 > colorname="barcolor", listnames=names, namemap=namemap,
2042 > nodemap=nodemap)
2042 > nodemap=nodemap)
2043 >
2043 >
2044 > repo.names.addnamespace(ns)
2044 > repo.names.addnamespace(ns)
2045 > EOF
2045 > EOF
2046
2046
2047 $ hg --config extensions.names=../names.py log -r 0
2047 $ hg --config extensions.names=../names.py log -r 0
2048 changeset: 0:65624cd9070a
2048 changeset: 0:65624cd9070a
2049 tag: tip
2049 tag: tip
2050 barlog: foo
2050 barlog: foo
2051 user: test
2051 user: test
2052 date: Thu Jan 01 00:00:00 1970 +0000
2052 date: Thu Jan 01 00:00:00 1970 +0000
2053 summary: a bunch of weird directories
2053 summary: a bunch of weird directories
2054
2054
2055 $ hg --config extensions.names=../names.py \
2055 $ hg --config extensions.names=../names.py \
2056 > --config extensions.color= --config color.log.barcolor=red \
2056 > --config extensions.color= --config color.log.barcolor=red \
2057 > --color=always log -r 0
2057 > --color=always log -r 0
2058 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2058 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2059 tag: tip
2059 tag: tip
2060 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2060 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2061 user: test
2061 user: test
2062 date: Thu Jan 01 00:00:00 1970 +0000
2062 date: Thu Jan 01 00:00:00 1970 +0000
2063 summary: a bunch of weird directories
2063 summary: a bunch of weird directories
2064
2064
2065 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2065 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2066 foo
2066 foo
2067
2067
2068 $ cd ..
2068 $ cd ..
2069
2069
2070 hg log -f dir across branches
2070 hg log -f dir across branches
2071
2071
2072 $ hg init acrossbranches
2072 $ hg init acrossbranches
2073 $ cd acrossbranches
2073 $ cd acrossbranches
2074 $ mkdir d
2074 $ mkdir d
2075 $ echo a > d/a && hg ci -Aqm a
2075 $ echo a > d/a && hg ci -Aqm a
2076 $ echo b > d/a && hg ci -Aqm b
2076 $ echo b > d/a && hg ci -Aqm b
2077 $ hg up -q 0
2077 $ hg up -q 0
2078 $ echo b > d/a && hg ci -Aqm c
2078 $ echo b > d/a && hg ci -Aqm c
2079 $ hg log -f d -T '{desc}' -G
2079 $ hg log -f d -T '{desc}' -G
2080 @ c
2080 @ c
2081 |
2081 |
2082 o a
2082 o a
2083
2083
2084 Ensure that largefiles doesn't interfere with following a normal file
2084 Ensure that largefiles doesn't interfere with following a normal file
2085 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2085 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2086 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2086 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2087 @ c
2087 @ c
2088 |
2088 |
2089 o a
2089 o a
2090
2090
2091 $ hg log -f d/a -T '{desc}' -G
2091 $ hg log -f d/a -T '{desc}' -G
2092 @ c
2092 @ c
2093 |
2093 |
2094 o a
2094 o a
2095
2095
2096 $ cd ..
2096 $ cd ..
2097
2097
2098 hg log -f with linkrev pointing to another branch
2098 hg log -f with linkrev pointing to another branch
2099 -------------------------------------------------
2099 -------------------------------------------------
2100
2100
2101 create history with a filerev whose linkrev points to another branch
2101 create history with a filerev whose linkrev points to another branch
2102
2102
2103 $ hg init branchedlinkrev
2103 $ hg init branchedlinkrev
2104 $ cd branchedlinkrev
2104 $ cd branchedlinkrev
2105 $ echo 1 > a
2105 $ echo 1 > a
2106 $ hg commit -Am 'content1'
2106 $ hg commit -Am 'content1'
2107 adding a
2107 adding a
2108 $ echo 2 > a
2108 $ echo 2 > a
2109 $ hg commit -m 'content2'
2109 $ hg commit -m 'content2'
2110 $ hg up --rev 'desc(content1)'
2110 $ hg up --rev 'desc(content1)'
2111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2112 $ echo unrelated > unrelated
2112 $ echo unrelated > unrelated
2113 $ hg commit -Am 'unrelated'
2113 $ hg commit -Am 'unrelated'
2114 adding unrelated
2114 adding unrelated
2115 created new head
2115 created new head
2116 $ hg graft -r 'desc(content2)'
2116 $ hg graft -r 'desc(content2)'
2117 grafting 1:2294ae80ad84 "content2"
2117 grafting 1:2294ae80ad84 "content2"
2118 $ echo 3 > a
2118 $ echo 3 > a
2119 $ hg commit -m 'content3'
2119 $ hg commit -m 'content3'
2120 $ hg log -G
2120 $ hg log -G
2121 @ changeset: 4:50b9b36e9c5d
2121 @ changeset: 4:50b9b36e9c5d
2122 | tag: tip
2122 | tag: tip
2123 | user: test
2123 | user: test
2124 | date: Thu Jan 01 00:00:00 1970 +0000
2124 | date: Thu Jan 01 00:00:00 1970 +0000
2125 | summary: content3
2125 | summary: content3
2126 |
2126 |
2127 o changeset: 3:15b2327059e5
2127 o changeset: 3:15b2327059e5
2128 | user: test
2128 | user: test
2129 | date: Thu Jan 01 00:00:00 1970 +0000
2129 | date: Thu Jan 01 00:00:00 1970 +0000
2130 | summary: content2
2130 | summary: content2
2131 |
2131 |
2132 o changeset: 2:2029acd1168c
2132 o changeset: 2:2029acd1168c
2133 | parent: 0:ae0a3c9f9e95
2133 | parent: 0:ae0a3c9f9e95
2134 | user: test
2134 | user: test
2135 | date: Thu Jan 01 00:00:00 1970 +0000
2135 | date: Thu Jan 01 00:00:00 1970 +0000
2136 | summary: unrelated
2136 | summary: unrelated
2137 |
2137 |
2138 | o changeset: 1:2294ae80ad84
2138 | o changeset: 1:2294ae80ad84
2139 |/ user: test
2139 |/ user: test
2140 | date: Thu Jan 01 00:00:00 1970 +0000
2140 | date: Thu Jan 01 00:00:00 1970 +0000
2141 | summary: content2
2141 | summary: content2
2142 |
2142 |
2143 o changeset: 0:ae0a3c9f9e95
2143 o changeset: 0:ae0a3c9f9e95
2144 user: test
2144 user: test
2145 date: Thu Jan 01 00:00:00 1970 +0000
2145 date: Thu Jan 01 00:00:00 1970 +0000
2146 summary: content1
2146 summary: content1
2147
2147
2148
2148
2149 log -f on the file should list the graft result.
2149 log -f on the file should list the graft result.
2150
2150
2151 $ hg log -Gf a
2151 $ hg log -Gf a
2152 @ changeset: 4:50b9b36e9c5d
2152 @ changeset: 4:50b9b36e9c5d
2153 | tag: tip
2153 | tag: tip
2154 | user: test
2154 | user: test
2155 | date: Thu Jan 01 00:00:00 1970 +0000
2155 | date: Thu Jan 01 00:00:00 1970 +0000
2156 | summary: content3
2156 | summary: content3
2157 |
2157 |
2158 o changeset: 3:15b2327059e5
2158 o changeset: 3:15b2327059e5
2159 : user: test
2159 : user: test
2160 : date: Thu Jan 01 00:00:00 1970 +0000
2160 : date: Thu Jan 01 00:00:00 1970 +0000
2161 : summary: content2
2161 : summary: content2
2162 :
2162 :
2163 o changeset: 0:ae0a3c9f9e95
2163 o changeset: 0:ae0a3c9f9e95
2164 user: test
2164 user: test
2165 date: Thu Jan 01 00:00:00 1970 +0000
2165 date: Thu Jan 01 00:00:00 1970 +0000
2166 summary: content1
2166 summary: content1
2167
2167
2168
2168
2169 plain log lists the original version
2169 plain log lists the original version
2170 (XXX we should probably list both)
2170 (XXX we should probably list both)
2171
2171
2172 $ hg log -G a
2172 $ hg log -G a
2173 @ changeset: 4:50b9b36e9c5d
2173 @ changeset: 4:50b9b36e9c5d
2174 : tag: tip
2174 : tag: tip
2175 : user: test
2175 : user: test
2176 : date: Thu Jan 01 00:00:00 1970 +0000
2176 : date: Thu Jan 01 00:00:00 1970 +0000
2177 : summary: content3
2177 : summary: content3
2178 :
2178 :
2179 : o changeset: 1:2294ae80ad84
2179 : o changeset: 1:2294ae80ad84
2180 :/ user: test
2180 :/ user: test
2181 : date: Thu Jan 01 00:00:00 1970 +0000
2181 : date: Thu Jan 01 00:00:00 1970 +0000
2182 : summary: content2
2182 : summary: content2
2183 :
2183 :
2184 o changeset: 0:ae0a3c9f9e95
2184 o changeset: 0:ae0a3c9f9e95
2185 user: test
2185 user: test
2186 date: Thu Jan 01 00:00:00 1970 +0000
2186 date: Thu Jan 01 00:00:00 1970 +0000
2187 summary: content1
2187 summary: content1
2188
2188
2189
2189
2190 hg log -f from the grafted changeset
2190 hg log -f from the grafted changeset
2191 (The bootstrap should properly take the topology in account)
2191 (The bootstrap should properly take the topology in account)
2192
2192
2193 $ hg up 'desc(content3)^'
2193 $ hg up 'desc(content3)^'
2194 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2194 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2195 $ hg log -Gf a
2195 $ hg log -Gf a
2196 @ changeset: 3:15b2327059e5
2196 @ changeset: 3:15b2327059e5
2197 : user: test
2197 : user: test
2198 : date: Thu Jan 01 00:00:00 1970 +0000
2198 : date: Thu Jan 01 00:00:00 1970 +0000
2199 : summary: content2
2199 : summary: content2
2200 :
2200 :
2201 o changeset: 0:ae0a3c9f9e95
2201 o changeset: 0:ae0a3c9f9e95
2202 user: test
2202 user: test
2203 date: Thu Jan 01 00:00:00 1970 +0000
2203 date: Thu Jan 01 00:00:00 1970 +0000
2204 summary: content1
2204 summary: content1
2205
2205
2206
2206
2207 Test that we use the first non-hidden changeset in that case.
2207 Test that we use the first non-hidden changeset in that case.
2208
2208
2209 (hide the changeset)
2209 (hide the changeset)
2210
2210
2211 $ hg log -T '{node}\n' -r 1
2211 $ hg log -T '{node}\n' -r 1
2212 2294ae80ad8447bc78383182eeac50cb049df623
2212 2294ae80ad8447bc78383182eeac50cb049df623
2213 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2213 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2214 obsoleted 1 changesets
2214 obsoleted 1 changesets
2215 $ hg log -G
2215 $ hg log -G
2216 o changeset: 4:50b9b36e9c5d
2216 o changeset: 4:50b9b36e9c5d
2217 | tag: tip
2217 | tag: tip
2218 | user: test
2218 | user: test
2219 | date: Thu Jan 01 00:00:00 1970 +0000
2219 | date: Thu Jan 01 00:00:00 1970 +0000
2220 | summary: content3
2220 | summary: content3
2221 |
2221 |
2222 @ changeset: 3:15b2327059e5
2222 @ changeset: 3:15b2327059e5
2223 | user: test
2223 | user: test
2224 | date: Thu Jan 01 00:00:00 1970 +0000
2224 | date: Thu Jan 01 00:00:00 1970 +0000
2225 | summary: content2
2225 | summary: content2
2226 |
2226 |
2227 o changeset: 2:2029acd1168c
2227 o changeset: 2:2029acd1168c
2228 | parent: 0:ae0a3c9f9e95
2228 | parent: 0:ae0a3c9f9e95
2229 | user: test
2229 | user: test
2230 | date: Thu Jan 01 00:00:00 1970 +0000
2230 | date: Thu Jan 01 00:00:00 1970 +0000
2231 | summary: unrelated
2231 | summary: unrelated
2232 |
2232 |
2233 o changeset: 0:ae0a3c9f9e95
2233 o changeset: 0:ae0a3c9f9e95
2234 user: test
2234 user: test
2235 date: Thu Jan 01 00:00:00 1970 +0000
2235 date: Thu Jan 01 00:00:00 1970 +0000
2236 summary: content1
2236 summary: content1
2237
2237
2238
2238
2239 Check that log on the file does not drop the file revision.
2239 Check that log on the file does not drop the file revision.
2240
2240
2241 $ hg log -G a
2241 $ hg log -G a
2242 o changeset: 4:50b9b36e9c5d
2242 o changeset: 4:50b9b36e9c5d
2243 | tag: tip
2243 | tag: tip
2244 | user: test
2244 | user: test
2245 | date: Thu Jan 01 00:00:00 1970 +0000
2245 | date: Thu Jan 01 00:00:00 1970 +0000
2246 | summary: content3
2246 | summary: content3
2247 |
2247 |
2248 @ changeset: 3:15b2327059e5
2248 @ changeset: 3:15b2327059e5
2249 : user: test
2249 : user: test
2250 : date: Thu Jan 01 00:00:00 1970 +0000
2250 : date: Thu Jan 01 00:00:00 1970 +0000
2251 : summary: content2
2251 : summary: content2
2252 :
2252 :
2253 o changeset: 0:ae0a3c9f9e95
2253 o changeset: 0:ae0a3c9f9e95
2254 user: test
2254 user: test
2255 date: Thu Jan 01 00:00:00 1970 +0000
2255 date: Thu Jan 01 00:00:00 1970 +0000
2256 summary: content1
2256 summary: content1
2257
2257
2258
2258
2259 Even when a head revision is linkrev-shadowed.
2259 Even when a head revision is linkrev-shadowed.
2260
2260
2261 $ hg log -T '{node}\n' -r 4
2261 $ hg log -T '{node}\n' -r 4
2262 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2262 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2263 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2263 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2264 obsoleted 1 changesets
2264 obsoleted 1 changesets
2265 $ hg log -G a
2265 $ hg log -G a
2266 @ changeset: 3:15b2327059e5
2266 @ changeset: 3:15b2327059e5
2267 : tag: tip
2267 : tag: tip
2268 : user: test
2268 : user: test
2269 : date: Thu Jan 01 00:00:00 1970 +0000
2269 : date: Thu Jan 01 00:00:00 1970 +0000
2270 : summary: content2
2270 : summary: content2
2271 :
2271 :
2272 o changeset: 0:ae0a3c9f9e95
2272 o changeset: 0:ae0a3c9f9e95
2273 user: test
2273 user: test
2274 date: Thu Jan 01 00:00:00 1970 +0000
2274 date: Thu Jan 01 00:00:00 1970 +0000
2275 summary: content1
2275 summary: content1
2276
2276
2277
2277
2278 $ cd ..
2278 $ cd ..
2279
2279
2280 Even when the file revision is missing from some head:
2280 Even when the file revision is missing from some head:
2281
2281
2282 $ hg init issue4490
2282 $ hg init issue4490
2283 $ cd issue4490
2283 $ cd issue4490
2284 $ echo '[experimental]' >> .hg/hgrc
2284 $ echo '[experimental]' >> .hg/hgrc
2285 $ echo 'stabilization=createmarkers' >> .hg/hgrc
2285 $ echo 'stabilization=createmarkers' >> .hg/hgrc
2286 $ echo a > a
2286 $ echo a > a
2287 $ hg ci -Am0
2287 $ hg ci -Am0
2288 adding a
2288 adding a
2289 $ echo b > b
2289 $ echo b > b
2290 $ hg ci -Am1
2290 $ hg ci -Am1
2291 adding b
2291 adding b
2292 $ echo B > b
2292 $ echo B > b
2293 $ hg ci --amend -m 1
2293 $ hg ci --amend -m 1
2294 $ hg up 0
2294 $ hg up 0
2295 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2295 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2296 $ echo c > c
2296 $ echo c > c
2297 $ hg ci -Am2
2297 $ hg ci -Am2
2298 adding c
2298 adding c
2299 created new head
2299 created new head
2300 $ hg up 'head() and not .'
2300 $ hg up 'head() and not .'
2301 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2301 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2302 $ hg log -G
2302 $ hg log -G
2303 o changeset: 4:db815d6d32e6
2303 o changeset: 3:db815d6d32e6
2304 | tag: tip
2304 | tag: tip
2305 | parent: 0:f7b1eb17ad24
2305 | parent: 0:f7b1eb17ad24
2306 | user: test
2306 | user: test
2307 | date: Thu Jan 01 00:00:00 1970 +0000
2307 | date: Thu Jan 01 00:00:00 1970 +0000
2308 | summary: 2
2308 | summary: 2
2309 |
2309 |
2310 | @ changeset: 3:9bc8ce7f9356
2310 | @ changeset: 2:9bc8ce7f9356
2311 |/ parent: 0:f7b1eb17ad24
2311 |/ parent: 0:f7b1eb17ad24
2312 | user: test
2312 | user: test
2313 | date: Thu Jan 01 00:00:00 1970 +0000
2313 | date: Thu Jan 01 00:00:00 1970 +0000
2314 | summary: 1
2314 | summary: 1
2315 |
2315 |
2316 o changeset: 0:f7b1eb17ad24
2316 o changeset: 0:f7b1eb17ad24
2317 user: test
2317 user: test
2318 date: Thu Jan 01 00:00:00 1970 +0000
2318 date: Thu Jan 01 00:00:00 1970 +0000
2319 summary: 0
2319 summary: 0
2320
2320
2321 $ hg log -f -G b
2321 $ hg log -f -G b
2322 @ changeset: 3:9bc8ce7f9356
2322 @ changeset: 2:9bc8ce7f9356
2323 | parent: 0:f7b1eb17ad24
2323 | parent: 0:f7b1eb17ad24
2324 ~ user: test
2324 ~ user: test
2325 date: Thu Jan 01 00:00:00 1970 +0000
2325 date: Thu Jan 01 00:00:00 1970 +0000
2326 summary: 1
2326 summary: 1
2327
2327
2328 $ hg log -G b
2328 $ hg log -G b
2329 @ changeset: 3:9bc8ce7f9356
2329 @ changeset: 2:9bc8ce7f9356
2330 | parent: 0:f7b1eb17ad24
2330 | parent: 0:f7b1eb17ad24
2331 ~ user: test
2331 ~ user: test
2332 date: Thu Jan 01 00:00:00 1970 +0000
2332 date: Thu Jan 01 00:00:00 1970 +0000
2333 summary: 1
2333 summary: 1
2334
2334
2335 $ cd ..
2335 $ cd ..
2336
2336
2337 Check proper report when the manifest changes but not the file issue4499
2337 Check proper report when the manifest changes but not the file issue4499
2338 ------------------------------------------------------------------------
2338 ------------------------------------------------------------------------
2339
2339
2340 $ hg init issue4499
2340 $ hg init issue4499
2341 $ cd issue4499
2341 $ cd issue4499
2342 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2342 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2343 > echo 1 > $f;
2343 > echo 1 > $f;
2344 > hg add $f;
2344 > hg add $f;
2345 > done
2345 > done
2346 $ hg commit -m 'A1B1C1'
2346 $ hg commit -m 'A1B1C1'
2347 $ echo 2 > A
2347 $ echo 2 > A
2348 $ echo 2 > B
2348 $ echo 2 > B
2349 $ echo 2 > C
2349 $ echo 2 > C
2350 $ hg commit -m 'A2B2C2'
2350 $ hg commit -m 'A2B2C2'
2351 $ hg up 0
2351 $ hg up 0
2352 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2352 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2353 $ echo 3 > A
2353 $ echo 3 > A
2354 $ echo 2 > B
2354 $ echo 2 > B
2355 $ echo 2 > C
2355 $ echo 2 > C
2356 $ hg commit -m 'A3B2C2'
2356 $ hg commit -m 'A3B2C2'
2357 created new head
2357 created new head
2358
2358
2359 $ hg log -G
2359 $ hg log -G
2360 @ changeset: 2:fe5fc3d0eb17
2360 @ changeset: 2:fe5fc3d0eb17
2361 | tag: tip
2361 | tag: tip
2362 | parent: 0:abf4f0e38563
2362 | parent: 0:abf4f0e38563
2363 | user: test
2363 | user: test
2364 | date: Thu Jan 01 00:00:00 1970 +0000
2364 | date: Thu Jan 01 00:00:00 1970 +0000
2365 | summary: A3B2C2
2365 | summary: A3B2C2
2366 |
2366 |
2367 | o changeset: 1:07dcc6b312c0
2367 | o changeset: 1:07dcc6b312c0
2368 |/ user: test
2368 |/ user: test
2369 | date: Thu Jan 01 00:00:00 1970 +0000
2369 | date: Thu Jan 01 00:00:00 1970 +0000
2370 | summary: A2B2C2
2370 | summary: A2B2C2
2371 |
2371 |
2372 o changeset: 0:abf4f0e38563
2372 o changeset: 0:abf4f0e38563
2373 user: test
2373 user: test
2374 date: Thu Jan 01 00:00:00 1970 +0000
2374 date: Thu Jan 01 00:00:00 1970 +0000
2375 summary: A1B1C1
2375 summary: A1B1C1
2376
2376
2377
2377
2378 Log -f on B should reports current changesets
2378 Log -f on B should reports current changesets
2379
2379
2380 $ hg log -fG B
2380 $ hg log -fG B
2381 @ changeset: 2:fe5fc3d0eb17
2381 @ changeset: 2:fe5fc3d0eb17
2382 | tag: tip
2382 | tag: tip
2383 | parent: 0:abf4f0e38563
2383 | parent: 0:abf4f0e38563
2384 | user: test
2384 | user: test
2385 | date: Thu Jan 01 00:00:00 1970 +0000
2385 | date: Thu Jan 01 00:00:00 1970 +0000
2386 | summary: A3B2C2
2386 | summary: A3B2C2
2387 |
2387 |
2388 o changeset: 0:abf4f0e38563
2388 o changeset: 0:abf4f0e38563
2389 user: test
2389 user: test
2390 date: Thu Jan 01 00:00:00 1970 +0000
2390 date: Thu Jan 01 00:00:00 1970 +0000
2391 summary: A1B1C1
2391 summary: A1B1C1
2392
2392
2393 $ cd ..
2393 $ cd ..
@@ -1,1780 +1,1765 b''
1 This test file test the various templates related to obsmarkers.
1 This test file test the various templates related to obsmarkers.
2
2
3 Global setup
3 Global setup
4 ============
4 ============
5
5
6 $ . $TESTDIR/testlib/obsmarker-common.sh
6 $ . $TESTDIR/testlib/obsmarker-common.sh
7 $ cat >> $HGRCPATH <<EOF
7 $ cat >> $HGRCPATH <<EOF
8 > [ui]
8 > [ui]
9 > interactive = true
9 > interactive = true
10 > [phases]
10 > [phases]
11 > publish=False
11 > publish=False
12 > [experimental]
12 > [experimental]
13 > stabilization=all
13 > stabilization=all
14 > [templates]
14 > [templates]
15 > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
15 > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
16 > obsfateverb = "{obsfateverb(successors)}"
16 > obsfateverb = "{obsfateverb(successors)}"
17 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
17 > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
18 > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"
18 > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"
19 > obsfate = "{obsfateverb}{obsfatesuccessors}{obsfateusers}{obsfatedate}; "
19 > obsfate = "{obsfateverb}{obsfatesuccessors}{obsfateusers}{obsfatedate}; "
20 > [alias]
20 > [alias]
21 > tlog = log -G -T '{node|short}\
21 > tlog = log -G -T '{node|short}\
22 > {if(predecessors, "\n Predecessors: {predecessors}")}\
22 > {if(predecessors, "\n Predecessors: {predecessors}")}\
23 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
23 > {if(predecessors, "\n semi-colon: {join(predecessors, "; ")}")}\
24 > {if(predecessors, "\n json: {predecessors|json}")}\
24 > {if(predecessors, "\n json: {predecessors|json}")}\
25 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\
25 > {if(predecessors, "\n map: {join(predecessors % "{rev}:{node}", " ")}")}\
26 > {if(successorssets, "\n Successors: {successorssets}")}\
26 > {if(successorssets, "\n Successors: {successorssets}")}\
27 > {if(successorssets, "\n multi-line: {join(successorssets, "\n multi-line: ")}")}\
27 > {if(successorssets, "\n multi-line: {join(successorssets, "\n multi-line: ")}")}\
28 > {if(successorssets, "\n json: {successorssets|json}")}\n'
28 > {if(successorssets, "\n json: {successorssets|json}")}\n'
29 > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers % "{obsfate}"} \n" )}'
29 > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers % "{obsfate}"} \n" )}'
30 > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers|json}\n")}'
30 > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, " Obsfate: {succsandmarkers|json}\n")}'
31 > EOF
31 > EOF
32
32
33 Test templates on amended commit
33 Test templates on amended commit
34 ================================
34 ================================
35
35
36 Test setup
36 Test setup
37 ----------
37 ----------
38
38
39 $ hg init $TESTTMP/templates-local-amend
39 $ hg init $TESTTMP/templates-local-amend
40 $ cd $TESTTMP/templates-local-amend
40 $ cd $TESTTMP/templates-local-amend
41 $ mkcommit ROOT
41 $ mkcommit ROOT
42 $ mkcommit A0
42 $ mkcommit A0
43 $ echo 42 >> A0
43 $ echo 42 >> A0
44 $ HGUSER=test1 hg commit --amend -m "A1" --config devel.default-date="1234567890 0"
44 $ HGUSER=test1 hg commit --amend -m "A1" --config devel.default-date="1234567890 0"
45 $ HGUSER=test2 hg commit --amend -m "A2" --config devel.default-date="987654321 0"
45 $ HGUSER=test2 hg commit --amend -m "A2" --config devel.default-date="987654321 0"
46
46
47 $ hg log --hidden -G
47 $ hg log --hidden -G
48 @ changeset: 4:d004c8f274b9
48 @ changeset: 3:d004c8f274b9
49 | tag: tip
49 | tag: tip
50 | parent: 0:ea207398892e
50 | parent: 0:ea207398892e
51 | user: test
51 | user: test
52 | date: Thu Jan 01 00:00:00 1970 +0000
52 | date: Thu Jan 01 00:00:00 1970 +0000
53 | summary: A2
53 | summary: A2
54 |
54 |
55 | x changeset: 3:a468dc9b3633
55 | x changeset: 2:a468dc9b3633
56 |/ parent: 0:ea207398892e
56 |/ parent: 0:ea207398892e
57 | user: test
57 | user: test
58 | date: Thu Jan 01 00:00:00 1970 +0000
58 | date: Thu Jan 01 00:00:00 1970 +0000
59 | summary: A1
59 | summary: A1
60 |
60 |
61 | x changeset: 2:f137d23bb3e1
62 | | user: test
63 | | date: Thu Jan 01 00:00:00 1970 +0000
64 | | summary: temporary amend commit for 471f378eab4c
65 | |
66 | x changeset: 1:471f378eab4c
61 | x changeset: 1:471f378eab4c
67 |/ user: test
62 |/ user: test
68 | date: Thu Jan 01 00:00:00 1970 +0000
63 | date: Thu Jan 01 00:00:00 1970 +0000
69 | summary: A0
64 | summary: A0
70 |
65 |
71 o changeset: 0:ea207398892e
66 o changeset: 0:ea207398892e
72 user: test
67 user: test
73 date: Thu Jan 01 00:00:00 1970 +0000
68 date: Thu Jan 01 00:00:00 1970 +0000
74 summary: ROOT
69 summary: ROOT
75
70
76 Check templates
71 Check templates
77 ---------------
72 ---------------
78 $ hg up 'desc(A0)' --hidden
73 $ hg up 'desc(A0)' --hidden
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80
75
81 Predecessors template should show current revision as it is the working copy
76 Predecessors template should show current revision as it is the working copy
82 $ hg tlog
77 $ hg tlog
83 o d004c8f274b9
78 o d004c8f274b9
84 | Predecessors: 1:471f378eab4c
79 | Predecessors: 1:471f378eab4c
85 | semi-colon: 1:471f378eab4c
80 | semi-colon: 1:471f378eab4c
86 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
81 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
87 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
82 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
88 | @ 471f378eab4c
83 | @ 471f378eab4c
89 |/ Successors: 4:d004c8f274b9
84 |/ Successors: 3:d004c8f274b9
90 | multi-line: 4:d004c8f274b9
85 | multi-line: 3:d004c8f274b9
91 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
86 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
92 o ea207398892e
87 o ea207398892e
93
88
94 $ hg fatelog -q --traceback
89 $ hg fatelog -q --traceback
95 o d004c8f274b9
90 o d004c8f274b9
96 |
91 |
97 | @ 471f378eab4c
92 | @ 471f378eab4c
98 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
93 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
99 o ea207398892e
94 o ea207398892e
100
95
101 $ hg fatelog
96 $ hg fatelog
102 o d004c8f274b9
97 o d004c8f274b9
103 |
98 |
104 | @ 471f378eab4c
99 | @ 471f378eab4c
105 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
100 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
106 o ea207398892e
101 o ea207398892e
107
102
108 $ hg fatelog -v
103 $ hg fatelog -v
109 o d004c8f274b9
104 o d004c8f274b9
110 |
105 |
111 | @ 471f378eab4c
106 | @ 471f378eab4c
112 |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
107 |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000);
113 o ea207398892e
108 o ea207398892e
114
109
115 $ hg up 'desc(A1)' --hidden
110 $ hg up 'desc(A1)' --hidden
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117
112
118 Predecessors template should show current revision as it is the working copy
113 Predecessors template should show current revision as it is the working copy
119 $ hg tlog
114 $ hg tlog
120 o d004c8f274b9
115 o d004c8f274b9
121 | Predecessors: 3:a468dc9b3633
116 | Predecessors: 2:a468dc9b3633
122 | semi-colon: 3:a468dc9b3633
117 | semi-colon: 2:a468dc9b3633
123 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
118 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
124 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
119 | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad
125 | @ a468dc9b3633
120 | @ a468dc9b3633
126 |/ Successors: 4:d004c8f274b9
121 |/ Successors: 3:d004c8f274b9
127 | multi-line: 4:d004c8f274b9
122 | multi-line: 3:d004c8f274b9
128 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
123 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
129 o ea207398892e
124 o ea207398892e
130
125
131 $ hg fatelog -v
126 $ hg fatelog -v
132 o d004c8f274b9
127 o d004c8f274b9
133 |
128 |
134 | @ a468dc9b3633
129 | @ a468dc9b3633
135 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
130 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
136 o ea207398892e
131 o ea207398892e
137
132
138 Predecessors template should show all the predecessors as we force their display
133 Predecessors template should show all the predecessors as we force their display
139 with --hidden
134 with --hidden
140 $ hg tlog --hidden
135 $ hg tlog --hidden
141 o d004c8f274b9
136 o d004c8f274b9
142 | Predecessors: 3:a468dc9b3633
137 | Predecessors: 2:a468dc9b3633
143 | semi-colon: 3:a468dc9b3633
138 | semi-colon: 2:a468dc9b3633
144 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
139 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
145 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
140 | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad
146 | @ a468dc9b3633
141 | @ a468dc9b3633
147 |/ Predecessors: 1:471f378eab4c
142 |/ Predecessors: 1:471f378eab4c
148 | semi-colon: 1:471f378eab4c
143 | semi-colon: 1:471f378eab4c
149 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
144 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
150 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
145 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
151 | Successors: 4:d004c8f274b9
146 | Successors: 3:d004c8f274b9
152 | multi-line: 4:d004c8f274b9
147 | multi-line: 3:d004c8f274b9
153 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
148 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
154 | x f137d23bb3e1
155 | |
156 | x 471f378eab4c
149 | x 471f378eab4c
157 |/ Successors: 3:a468dc9b3633
150 |/ Successors: 2:a468dc9b3633
158 | multi-line: 3:a468dc9b3633
151 | multi-line: 2:a468dc9b3633
159 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
152 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
160 o ea207398892e
153 o ea207398892e
161
154
162 $ hg fatelog --hidden -q
155 $ hg fatelog --hidden -q
163 o d004c8f274b9
156 o d004c8f274b9
164 |
157 |
165 | @ a468dc9b3633
158 | @ a468dc9b3633
166 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
159 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
167 | x f137d23bb3e1
168 | | Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000);
169 | x 471f378eab4c
160 | x 471f378eab4c
170 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
161 |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
171 o ea207398892e
162 o ea207398892e
172
163
173
164
174 Predecessors template shouldn't show anything as all obsolete commit are not
165 Predecessors template shouldn't show anything as all obsolete commit are not
175 visible.
166 visible.
176 $ hg up 'desc(A2)'
167 $ hg up 'desc(A2)'
177 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 $ hg tlog
169 $ hg tlog
179 @ d004c8f274b9
170 @ d004c8f274b9
180 |
171 |
181 o ea207398892e
172 o ea207398892e
182
173
183 $ hg tlog --hidden
174 $ hg tlog --hidden
184 @ d004c8f274b9
175 @ d004c8f274b9
185 | Predecessors: 3:a468dc9b3633
176 | Predecessors: 2:a468dc9b3633
186 | semi-colon: 3:a468dc9b3633
177 | semi-colon: 2:a468dc9b3633
187 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
178 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]
188 | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad
179 | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad
189 | x a468dc9b3633
180 | x a468dc9b3633
190 |/ Predecessors: 1:471f378eab4c
181 |/ Predecessors: 1:471f378eab4c
191 | semi-colon: 1:471f378eab4c
182 | semi-colon: 1:471f378eab4c
192 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
183 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
193 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
184 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
194 | Successors: 4:d004c8f274b9
185 | Successors: 3:d004c8f274b9
195 | multi-line: 4:d004c8f274b9
186 | multi-line: 3:d004c8f274b9
196 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
187 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]]
197 | x f137d23bb3e1
198 | |
199 | x 471f378eab4c
188 | x 471f378eab4c
200 |/ Successors: 3:a468dc9b3633
189 |/ Successors: 2:a468dc9b3633
201 | multi-line: 3:a468dc9b3633
190 | multi-line: 2:a468dc9b3633
202 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
191 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]]
203 o ea207398892e
192 o ea207398892e
204
193
205 $ hg fatelog -v
194 $ hg fatelog -v
206 @ d004c8f274b9
195 @ d004c8f274b9
207 |
196 |
208 o ea207398892e
197 o ea207398892e
209
198
210
199
211 $ hg fatelog -v --hidden
200 $ hg fatelog -v --hidden
212 @ d004c8f274b9
201 @ d004c8f274b9
213 |
202 |
214 | x a468dc9b3633
203 | x a468dc9b3633
215 |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
204 |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000);
216 | x f137d23bb3e1
217 | | Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000);
218 | x 471f378eab4c
205 | x 471f378eab4c
219 |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
206 |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000);
220 o ea207398892e
207 o ea207398892e
221
208
222 $ hg fatelogjson --hidden
209 $ hg fatelogjson --hidden
223 @ d004c8f274b9
210 @ d004c8f274b9
224 |
211 |
225 | x a468dc9b3633
212 | x a468dc9b3633
226 |/ Obsfate: [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["user", "test2"]], [987654321.0, 0], null]], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"]}]
213 |/ Obsfate: [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["user", "test2"]], [987654321.0, 0], null]], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"]}]
227 | x f137d23bb3e1
228 | | Obsfate: [{"markers": [["f137d23bb3e11dc1daeb6264fac9cb2433782e15", [], 0, [["user", "test1"]], [1234567890.0, 0], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]], "successors": []}]
229 | x 471f378eab4c
214 | x 471f378eab4c
230 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["user", "test1"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}]
215 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["user", "test1"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}]
231 o ea207398892e
216 o ea207398892e
232
217
233 Test templates with splitted commit
218 Test templates with splitted commit
234 ===================================
219 ===================================
235
220
236 $ hg init $TESTTMP/templates-local-split
221 $ hg init $TESTTMP/templates-local-split
237 $ cd $TESTTMP/templates-local-split
222 $ cd $TESTTMP/templates-local-split
238 $ mkcommit ROOT
223 $ mkcommit ROOT
239 $ echo 42 >> a
224 $ echo 42 >> a
240 $ echo 43 >> b
225 $ echo 43 >> b
241 $ hg commit -A -m "A0"
226 $ hg commit -A -m "A0"
242 adding a
227 adding a
243 adding b
228 adding b
244 $ hg log --hidden -G
229 $ hg log --hidden -G
245 @ changeset: 1:471597cad322
230 @ changeset: 1:471597cad322
246 | tag: tip
231 | tag: tip
247 | user: test
232 | user: test
248 | date: Thu Jan 01 00:00:00 1970 +0000
233 | date: Thu Jan 01 00:00:00 1970 +0000
249 | summary: A0
234 | summary: A0
250 |
235 |
251 o changeset: 0:ea207398892e
236 o changeset: 0:ea207398892e
252 user: test
237 user: test
253 date: Thu Jan 01 00:00:00 1970 +0000
238 date: Thu Jan 01 00:00:00 1970 +0000
254 summary: ROOT
239 summary: ROOT
255
240
256 # Simulate split
241 # Simulate split
257 $ hg up -r "desc(ROOT)"
242 $ hg up -r "desc(ROOT)"
258 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
243 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
259 $ echo 42 >> a
244 $ echo 42 >> a
260 $ hg commit -A -m "A0"
245 $ hg commit -A -m "A0"
261 adding a
246 adding a
262 created new head
247 created new head
263 $ echo 43 >> b
248 $ echo 43 >> b
264 $ hg commit -A -m "A0"
249 $ hg commit -A -m "A0"
265 adding b
250 adding b
266 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
251 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
267 obsoleted 1 changesets
252 obsoleted 1 changesets
268
253
269 $ hg log --hidden -G
254 $ hg log --hidden -G
270 @ changeset: 3:f257fde29c7a
255 @ changeset: 3:f257fde29c7a
271 | tag: tip
256 | tag: tip
272 | user: test
257 | user: test
273 | date: Thu Jan 01 00:00:00 1970 +0000
258 | date: Thu Jan 01 00:00:00 1970 +0000
274 | summary: A0
259 | summary: A0
275 |
260 |
276 o changeset: 2:337fec4d2edc
261 o changeset: 2:337fec4d2edc
277 | parent: 0:ea207398892e
262 | parent: 0:ea207398892e
278 | user: test
263 | user: test
279 | date: Thu Jan 01 00:00:00 1970 +0000
264 | date: Thu Jan 01 00:00:00 1970 +0000
280 | summary: A0
265 | summary: A0
281 |
266 |
282 | x changeset: 1:471597cad322
267 | x changeset: 1:471597cad322
283 |/ user: test
268 |/ user: test
284 | date: Thu Jan 01 00:00:00 1970 +0000
269 | date: Thu Jan 01 00:00:00 1970 +0000
285 | summary: A0
270 | summary: A0
286 |
271 |
287 o changeset: 0:ea207398892e
272 o changeset: 0:ea207398892e
288 user: test
273 user: test
289 date: Thu Jan 01 00:00:00 1970 +0000
274 date: Thu Jan 01 00:00:00 1970 +0000
290 summary: ROOT
275 summary: ROOT
291
276
292 Check templates
277 Check templates
293 ---------------
278 ---------------
294
279
295 $ hg up 'obsolete()' --hidden
280 $ hg up 'obsolete()' --hidden
296 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
297
282
298 Predecessors template should show current revision as it is the working copy
283 Predecessors template should show current revision as it is the working copy
299 $ hg tlog
284 $ hg tlog
300 o f257fde29c7a
285 o f257fde29c7a
301 | Predecessors: 1:471597cad322
286 | Predecessors: 1:471597cad322
302 | semi-colon: 1:471597cad322
287 | semi-colon: 1:471597cad322
303 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
288 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
304 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
289 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
305 o 337fec4d2edc
290 o 337fec4d2edc
306 | Predecessors: 1:471597cad322
291 | Predecessors: 1:471597cad322
307 | semi-colon: 1:471597cad322
292 | semi-colon: 1:471597cad322
308 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
293 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
309 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
294 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
310 | @ 471597cad322
295 | @ 471597cad322
311 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
296 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
312 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
297 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
313 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
298 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
314 o ea207398892e
299 o ea207398892e
315
300
316
301
317 $ hg fatelog
302 $ hg fatelog
318 o f257fde29c7a
303 o f257fde29c7a
319 |
304 |
320 o 337fec4d2edc
305 o 337fec4d2edc
321 |
306 |
322 | @ 471597cad322
307 | @ 471597cad322
323 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
308 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
324 o ea207398892e
309 o ea207398892e
325
310
326 $ hg up f257fde29c7a
311 $ hg up f257fde29c7a
327 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
328
313
329 Predecessors template should not show a predecessor as it's not displayed in
314 Predecessors template should not show a predecessor as it's not displayed in
330 the log
315 the log
331 $ hg tlog
316 $ hg tlog
332 @ f257fde29c7a
317 @ f257fde29c7a
333 |
318 |
334 o 337fec4d2edc
319 o 337fec4d2edc
335 |
320 |
336 o ea207398892e
321 o ea207398892e
337
322
338 Predecessors template should show both predecessors as we force their display
323 Predecessors template should show both predecessors as we force their display
339 with --hidden
324 with --hidden
340 $ hg tlog --hidden
325 $ hg tlog --hidden
341 @ f257fde29c7a
326 @ f257fde29c7a
342 | Predecessors: 1:471597cad322
327 | Predecessors: 1:471597cad322
343 | semi-colon: 1:471597cad322
328 | semi-colon: 1:471597cad322
344 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
329 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
345 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
330 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
346 o 337fec4d2edc
331 o 337fec4d2edc
347 | Predecessors: 1:471597cad322
332 | Predecessors: 1:471597cad322
348 | semi-colon: 1:471597cad322
333 | semi-colon: 1:471597cad322
349 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
334 | json: ["471597cad322d1f659bb169751be9133dad92ef3"]
350 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
335 | map: 1:471597cad322d1f659bb169751be9133dad92ef3
351 | x 471597cad322
336 | x 471597cad322
352 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
337 |/ Successors: 2:337fec4d2edc 3:f257fde29c7a
353 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
338 | multi-line: 2:337fec4d2edc 3:f257fde29c7a
354 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
339 | json: [["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]]
355 o ea207398892e
340 o ea207398892e
356
341
357
342
358 $ hg fatelog --hidden
343 $ hg fatelog --hidden
359 @ f257fde29c7a
344 @ f257fde29c7a
360 |
345 |
361 o 337fec4d2edc
346 o 337fec4d2edc
362 |
347 |
363 | x 471597cad322
348 | x 471597cad322
364 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
349 |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 1970-01-01 00:00 +0000);
365 o ea207398892e
350 o ea207398892e
366
351
367 $ hg fatelogjson --hidden
352 $ hg fatelogjson --hidden
368 @ f257fde29c7a
353 @ f257fde29c7a
369 |
354 |
370 o 337fec4d2edc
355 o 337fec4d2edc
371 |
356 |
372 | x 471597cad322
357 | x 471597cad322
373 |/ Obsfate: [{"markers": [["471597cad322d1f659bb169751be9133dad92ef3", ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]}]
358 |/ Obsfate: [{"markers": [["471597cad322d1f659bb169751be9133dad92ef3", ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["337fec4d2edcf0e7a467e35f818234bc620068b5", "f257fde29c7a847c9b607f6e958656d0df0fb15c"]}]
374 o ea207398892e
359 o ea207398892e
375
360
376 Test templates with folded commit
361 Test templates with folded commit
377 =================================
362 =================================
378
363
379 Test setup
364 Test setup
380 ----------
365 ----------
381
366
382 $ hg init $TESTTMP/templates-local-fold
367 $ hg init $TESTTMP/templates-local-fold
383 $ cd $TESTTMP/templates-local-fold
368 $ cd $TESTTMP/templates-local-fold
384 $ mkcommit ROOT
369 $ mkcommit ROOT
385 $ mkcommit A0
370 $ mkcommit A0
386 $ mkcommit B0
371 $ mkcommit B0
387 $ hg log --hidden -G
372 $ hg log --hidden -G
388 @ changeset: 2:0dec01379d3b
373 @ changeset: 2:0dec01379d3b
389 | tag: tip
374 | tag: tip
390 | user: test
375 | user: test
391 | date: Thu Jan 01 00:00:00 1970 +0000
376 | date: Thu Jan 01 00:00:00 1970 +0000
392 | summary: B0
377 | summary: B0
393 |
378 |
394 o changeset: 1:471f378eab4c
379 o changeset: 1:471f378eab4c
395 | user: test
380 | user: test
396 | date: Thu Jan 01 00:00:00 1970 +0000
381 | date: Thu Jan 01 00:00:00 1970 +0000
397 | summary: A0
382 | summary: A0
398 |
383 |
399 o changeset: 0:ea207398892e
384 o changeset: 0:ea207398892e
400 user: test
385 user: test
401 date: Thu Jan 01 00:00:00 1970 +0000
386 date: Thu Jan 01 00:00:00 1970 +0000
402 summary: ROOT
387 summary: ROOT
403
388
404 Simulate a fold
389 Simulate a fold
405 $ hg up -r "desc(ROOT)"
390 $ hg up -r "desc(ROOT)"
406 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
391 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
407 $ echo "A0" > A0
392 $ echo "A0" > A0
408 $ echo "B0" > B0
393 $ echo "B0" > B0
409 $ hg commit -A -m "C0"
394 $ hg commit -A -m "C0"
410 adding A0
395 adding A0
411 adding B0
396 adding B0
412 created new head
397 created new head
413 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
398 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
414 obsoleted 1 changesets
399 obsoleted 1 changesets
415 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
400 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
416 obsoleted 1 changesets
401 obsoleted 1 changesets
417
402
418 $ hg log --hidden -G
403 $ hg log --hidden -G
419 @ changeset: 3:eb5a0daa2192
404 @ changeset: 3:eb5a0daa2192
420 | tag: tip
405 | tag: tip
421 | parent: 0:ea207398892e
406 | parent: 0:ea207398892e
422 | user: test
407 | user: test
423 | date: Thu Jan 01 00:00:00 1970 +0000
408 | date: Thu Jan 01 00:00:00 1970 +0000
424 | summary: C0
409 | summary: C0
425 |
410 |
426 | x changeset: 2:0dec01379d3b
411 | x changeset: 2:0dec01379d3b
427 | | user: test
412 | | user: test
428 | | date: Thu Jan 01 00:00:00 1970 +0000
413 | | date: Thu Jan 01 00:00:00 1970 +0000
429 | | summary: B0
414 | | summary: B0
430 | |
415 | |
431 | x changeset: 1:471f378eab4c
416 | x changeset: 1:471f378eab4c
432 |/ user: test
417 |/ user: test
433 | date: Thu Jan 01 00:00:00 1970 +0000
418 | date: Thu Jan 01 00:00:00 1970 +0000
434 | summary: A0
419 | summary: A0
435 |
420 |
436 o changeset: 0:ea207398892e
421 o changeset: 0:ea207398892e
437 user: test
422 user: test
438 date: Thu Jan 01 00:00:00 1970 +0000
423 date: Thu Jan 01 00:00:00 1970 +0000
439 summary: ROOT
424 summary: ROOT
440
425
441 Check templates
426 Check templates
442 ---------------
427 ---------------
443
428
444 $ hg up 'desc(A0)' --hidden
429 $ hg up 'desc(A0)' --hidden
445 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
446
431
447 Predecessors template should show current revision as it is the working copy
432 Predecessors template should show current revision as it is the working copy
448 $ hg tlog
433 $ hg tlog
449 o eb5a0daa2192
434 o eb5a0daa2192
450 | Predecessors: 1:471f378eab4c
435 | Predecessors: 1:471f378eab4c
451 | semi-colon: 1:471f378eab4c
436 | semi-colon: 1:471f378eab4c
452 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
437 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
453 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
438 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
454 | @ 471f378eab4c
439 | @ 471f378eab4c
455 |/ Successors: 3:eb5a0daa2192
440 |/ Successors: 3:eb5a0daa2192
456 | multi-line: 3:eb5a0daa2192
441 | multi-line: 3:eb5a0daa2192
457 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
442 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
458 o ea207398892e
443 o ea207398892e
459
444
460
445
461 $ hg fatelog
446 $ hg fatelog
462 o eb5a0daa2192
447 o eb5a0daa2192
463 |
448 |
464 | @ 471f378eab4c
449 | @ 471f378eab4c
465 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
450 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
466 o ea207398892e
451 o ea207398892e
467
452
468 $ hg up 'desc(B0)' --hidden
453 $ hg up 'desc(B0)' --hidden
469 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
454 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
470
455
471 Predecessors template should show both predecessors as they should be both
456 Predecessors template should show both predecessors as they should be both
472 displayed
457 displayed
473 $ hg tlog
458 $ hg tlog
474 o eb5a0daa2192
459 o eb5a0daa2192
475 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
460 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
476 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
461 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
477 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
462 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
478 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
463 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
479 | @ 0dec01379d3b
464 | @ 0dec01379d3b
480 | | Successors: 3:eb5a0daa2192
465 | | Successors: 3:eb5a0daa2192
481 | | multi-line: 3:eb5a0daa2192
466 | | multi-line: 3:eb5a0daa2192
482 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
467 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
483 | x 471f378eab4c
468 | x 471f378eab4c
484 |/ Successors: 3:eb5a0daa2192
469 |/ Successors: 3:eb5a0daa2192
485 | multi-line: 3:eb5a0daa2192
470 | multi-line: 3:eb5a0daa2192
486 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
471 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
487 o ea207398892e
472 o ea207398892e
488
473
489
474
490 $ hg fatelog
475 $ hg fatelog
491 o eb5a0daa2192
476 o eb5a0daa2192
492 |
477 |
493 | @ 0dec01379d3b
478 | @ 0dec01379d3b
494 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
479 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
495 | x 471f378eab4c
480 | x 471f378eab4c
496 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
481 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
497 o ea207398892e
482 o ea207398892e
498
483
499 $ hg up 'desc(C0)'
484 $ hg up 'desc(C0)'
500 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
485 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
501
486
502 Predecessors template should not show predecessors as they are not displayed in
487 Predecessors template should not show predecessors as they are not displayed in
503 the log
488 the log
504 $ hg tlog
489 $ hg tlog
505 @ eb5a0daa2192
490 @ eb5a0daa2192
506 |
491 |
507 o ea207398892e
492 o ea207398892e
508
493
509 Predecessors template should show both predecessors as we force their display
494 Predecessors template should show both predecessors as we force their display
510 with --hidden
495 with --hidden
511 $ hg tlog --hidden
496 $ hg tlog --hidden
512 @ eb5a0daa2192
497 @ eb5a0daa2192
513 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
498 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
514 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
499 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
515 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
500 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
516 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
501 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
517 | x 0dec01379d3b
502 | x 0dec01379d3b
518 | | Successors: 3:eb5a0daa2192
503 | | Successors: 3:eb5a0daa2192
519 | | multi-line: 3:eb5a0daa2192
504 | | multi-line: 3:eb5a0daa2192
520 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
505 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
521 | x 471f378eab4c
506 | x 471f378eab4c
522 |/ Successors: 3:eb5a0daa2192
507 |/ Successors: 3:eb5a0daa2192
523 | multi-line: 3:eb5a0daa2192
508 | multi-line: 3:eb5a0daa2192
524 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
509 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
525 o ea207398892e
510 o ea207398892e
526
511
527
512
528 $ hg fatelog --hidden
513 $ hg fatelog --hidden
529 @ eb5a0daa2192
514 @ eb5a0daa2192
530 |
515 |
531 | x 0dec01379d3b
516 | x 0dec01379d3b
532 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
517 | | Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
533 | x 471f378eab4c
518 | x 471f378eab4c
534 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
519 |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
535 o ea207398892e
520 o ea207398892e
536
521
537
522
538 $ hg fatelogjson --hidden
523 $ hg fatelogjson --hidden
539 @ eb5a0daa2192
524 @ eb5a0daa2192
540 |
525 |
541 | x 0dec01379d3b
526 | x 0dec01379d3b
542 | | Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
527 | | Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
543 | x 471f378eab4c
528 | x 471f378eab4c
544 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
529 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
545 o ea207398892e
530 o ea207398892e
546
531
547
532
548 Test templates with divergence
533 Test templates with divergence
549 ==============================
534 ==============================
550
535
551 Test setup
536 Test setup
552 ----------
537 ----------
553
538
554 $ hg init $TESTTMP/templates-local-divergence
539 $ hg init $TESTTMP/templates-local-divergence
555 $ cd $TESTTMP/templates-local-divergence
540 $ cd $TESTTMP/templates-local-divergence
556 $ mkcommit ROOT
541 $ mkcommit ROOT
557 $ mkcommit A0
542 $ mkcommit A0
558 $ hg commit --amend -m "A1"
543 $ hg commit --amend -m "A1"
559 $ hg log --hidden -G
544 $ hg log --hidden -G
560 @ changeset: 2:fdf9bde5129a
545 @ changeset: 2:fdf9bde5129a
561 | tag: tip
546 | tag: tip
562 | parent: 0:ea207398892e
547 | parent: 0:ea207398892e
563 | user: test
548 | user: test
564 | date: Thu Jan 01 00:00:00 1970 +0000
549 | date: Thu Jan 01 00:00:00 1970 +0000
565 | summary: A1
550 | summary: A1
566 |
551 |
567 | x changeset: 1:471f378eab4c
552 | x changeset: 1:471f378eab4c
568 |/ user: test
553 |/ user: test
569 | date: Thu Jan 01 00:00:00 1970 +0000
554 | date: Thu Jan 01 00:00:00 1970 +0000
570 | summary: A0
555 | summary: A0
571 |
556 |
572 o changeset: 0:ea207398892e
557 o changeset: 0:ea207398892e
573 user: test
558 user: test
574 date: Thu Jan 01 00:00:00 1970 +0000
559 date: Thu Jan 01 00:00:00 1970 +0000
575 summary: ROOT
560 summary: ROOT
576
561
577 $ hg update --hidden 'desc(A0)'
562 $ hg update --hidden 'desc(A0)'
578 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
563 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
579 $ hg commit --amend -m "A2"
564 $ hg commit --amend -m "A2"
580 $ hg log --hidden -G
565 $ hg log --hidden -G
581 @ changeset: 3:65b757b745b9
566 @ changeset: 3:65b757b745b9
582 | tag: tip
567 | tag: tip
583 | parent: 0:ea207398892e
568 | parent: 0:ea207398892e
584 | user: test
569 | user: test
585 | date: Thu Jan 01 00:00:00 1970 +0000
570 | date: Thu Jan 01 00:00:00 1970 +0000
586 | instability: content-divergent
571 | instability: content-divergent
587 | summary: A2
572 | summary: A2
588 |
573 |
589 | o changeset: 2:fdf9bde5129a
574 | o changeset: 2:fdf9bde5129a
590 |/ parent: 0:ea207398892e
575 |/ parent: 0:ea207398892e
591 | user: test
576 | user: test
592 | date: Thu Jan 01 00:00:00 1970 +0000
577 | date: Thu Jan 01 00:00:00 1970 +0000
593 | instability: content-divergent
578 | instability: content-divergent
594 | summary: A1
579 | summary: A1
595 |
580 |
596 | x changeset: 1:471f378eab4c
581 | x changeset: 1:471f378eab4c
597 |/ user: test
582 |/ user: test
598 | date: Thu Jan 01 00:00:00 1970 +0000
583 | date: Thu Jan 01 00:00:00 1970 +0000
599 | summary: A0
584 | summary: A0
600 |
585 |
601 o changeset: 0:ea207398892e
586 o changeset: 0:ea207398892e
602 user: test
587 user: test
603 date: Thu Jan 01 00:00:00 1970 +0000
588 date: Thu Jan 01 00:00:00 1970 +0000
604 summary: ROOT
589 summary: ROOT
605
590
606 $ hg commit --amend -m 'A3'
591 $ hg commit --amend -m 'A3'
607 $ hg log --hidden -G
592 $ hg log --hidden -G
608 @ changeset: 4:019fadeab383
593 @ changeset: 4:019fadeab383
609 | tag: tip
594 | tag: tip
610 | parent: 0:ea207398892e
595 | parent: 0:ea207398892e
611 | user: test
596 | user: test
612 | date: Thu Jan 01 00:00:00 1970 +0000
597 | date: Thu Jan 01 00:00:00 1970 +0000
613 | instability: content-divergent
598 | instability: content-divergent
614 | summary: A3
599 | summary: A3
615 |
600 |
616 | x changeset: 3:65b757b745b9
601 | x changeset: 3:65b757b745b9
617 |/ parent: 0:ea207398892e
602 |/ parent: 0:ea207398892e
618 | user: test
603 | user: test
619 | date: Thu Jan 01 00:00:00 1970 +0000
604 | date: Thu Jan 01 00:00:00 1970 +0000
620 | summary: A2
605 | summary: A2
621 |
606 |
622 | o changeset: 2:fdf9bde5129a
607 | o changeset: 2:fdf9bde5129a
623 |/ parent: 0:ea207398892e
608 |/ parent: 0:ea207398892e
624 | user: test
609 | user: test
625 | date: Thu Jan 01 00:00:00 1970 +0000
610 | date: Thu Jan 01 00:00:00 1970 +0000
626 | instability: content-divergent
611 | instability: content-divergent
627 | summary: A1
612 | summary: A1
628 |
613 |
629 | x changeset: 1:471f378eab4c
614 | x changeset: 1:471f378eab4c
630 |/ user: test
615 |/ user: test
631 | date: Thu Jan 01 00:00:00 1970 +0000
616 | date: Thu Jan 01 00:00:00 1970 +0000
632 | summary: A0
617 | summary: A0
633 |
618 |
634 o changeset: 0:ea207398892e
619 o changeset: 0:ea207398892e
635 user: test
620 user: test
636 date: Thu Jan 01 00:00:00 1970 +0000
621 date: Thu Jan 01 00:00:00 1970 +0000
637 summary: ROOT
622 summary: ROOT
638
623
639
624
640 Check templates
625 Check templates
641 ---------------
626 ---------------
642
627
643 $ hg up 'desc(A0)' --hidden
628 $ hg up 'desc(A0)' --hidden
644 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
629 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
645
630
646 Predecessors template should show current revision as it is the working copy
631 Predecessors template should show current revision as it is the working copy
647 $ hg tlog
632 $ hg tlog
648 o 019fadeab383
633 o 019fadeab383
649 | Predecessors: 1:471f378eab4c
634 | Predecessors: 1:471f378eab4c
650 | semi-colon: 1:471f378eab4c
635 | semi-colon: 1:471f378eab4c
651 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
636 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
652 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
637 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
653 | o fdf9bde5129a
638 | o fdf9bde5129a
654 |/ Predecessors: 1:471f378eab4c
639 |/ Predecessors: 1:471f378eab4c
655 | semi-colon: 1:471f378eab4c
640 | semi-colon: 1:471f378eab4c
656 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
641 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
657 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
642 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
658 | @ 471f378eab4c
643 | @ 471f378eab4c
659 |/ Successors: 2:fdf9bde5129a; 4:019fadeab383
644 |/ Successors: 2:fdf9bde5129a; 4:019fadeab383
660 | multi-line: 2:fdf9bde5129a
645 | multi-line: 2:fdf9bde5129a
661 | multi-line: 4:019fadeab383
646 | multi-line: 4:019fadeab383
662 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
647 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
663 o ea207398892e
648 o ea207398892e
664
649
665 $ hg fatelog
650 $ hg fatelog
666 o 019fadeab383
651 o 019fadeab383
667 |
652 |
668 | o fdf9bde5129a
653 | o fdf9bde5129a
669 |/
654 |/
670 | @ 471f378eab4c
655 | @ 471f378eab4c
671 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
656 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
672 o ea207398892e
657 o ea207398892e
673
658
674 $ hg up 'desc(A1)'
659 $ hg up 'desc(A1)'
675 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
660 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
676
661
677 Predecessors template should not show predecessors as they are not displayed in
662 Predecessors template should not show predecessors as they are not displayed in
678 the log
663 the log
679 $ hg tlog
664 $ hg tlog
680 o 019fadeab383
665 o 019fadeab383
681 |
666 |
682 | @ fdf9bde5129a
667 | @ fdf9bde5129a
683 |/
668 |/
684 o ea207398892e
669 o ea207398892e
685
670
686
671
687 $ hg fatelog
672 $ hg fatelog
688 o 019fadeab383
673 o 019fadeab383
689 |
674 |
690 | @ fdf9bde5129a
675 | @ fdf9bde5129a
691 |/
676 |/
692 o ea207398892e
677 o ea207398892e
693
678
694 Predecessors template should the predecessors as we force their display with
679 Predecessors template should the predecessors as we force their display with
695 --hidden
680 --hidden
696 $ hg tlog --hidden
681 $ hg tlog --hidden
697 o 019fadeab383
682 o 019fadeab383
698 | Predecessors: 3:65b757b745b9
683 | Predecessors: 3:65b757b745b9
699 | semi-colon: 3:65b757b745b9
684 | semi-colon: 3:65b757b745b9
700 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
685 | json: ["65b757b745b935093c87a2bccd877521cccffcbd"]
701 | map: 3:65b757b745b935093c87a2bccd877521cccffcbd
686 | map: 3:65b757b745b935093c87a2bccd877521cccffcbd
702 | x 65b757b745b9
687 | x 65b757b745b9
703 |/ Predecessors: 1:471f378eab4c
688 |/ Predecessors: 1:471f378eab4c
704 | semi-colon: 1:471f378eab4c
689 | semi-colon: 1:471f378eab4c
705 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
690 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
706 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
691 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
707 | Successors: 4:019fadeab383
692 | Successors: 4:019fadeab383
708 | multi-line: 4:019fadeab383
693 | multi-line: 4:019fadeab383
709 | json: [["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
694 | json: [["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]]
710 | @ fdf9bde5129a
695 | @ fdf9bde5129a
711 |/ Predecessors: 1:471f378eab4c
696 |/ Predecessors: 1:471f378eab4c
712 | semi-colon: 1:471f378eab4c
697 | semi-colon: 1:471f378eab4c
713 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
698 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
714 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
699 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
715 | x 471f378eab4c
700 | x 471f378eab4c
716 |/ Successors: 2:fdf9bde5129a; 3:65b757b745b9
701 |/ Successors: 2:fdf9bde5129a; 3:65b757b745b9
717 | multi-line: 2:fdf9bde5129a
702 | multi-line: 2:fdf9bde5129a
718 | multi-line: 3:65b757b745b9
703 | multi-line: 3:65b757b745b9
719 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["65b757b745b935093c87a2bccd877521cccffcbd"]]
704 | json: [["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], ["65b757b745b935093c87a2bccd877521cccffcbd"]]
720 o ea207398892e
705 o ea207398892e
721
706
722
707
723 $ hg fatelog --hidden
708 $ hg fatelog --hidden
724 o 019fadeab383
709 o 019fadeab383
725 |
710 |
726 | x 65b757b745b9
711 | x 65b757b745b9
727 |/ Obsfate: rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
712 |/ Obsfate: rewritten as 4:019fadeab383 by test (at 1970-01-01 00:00 +0000);
728 | @ fdf9bde5129a
713 | @ fdf9bde5129a
729 |/
714 |/
730 | x 471f378eab4c
715 | x 471f378eab4c
731 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
716 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
732 o ea207398892e
717 o ea207398892e
733
718
734
719
735 $ hg fatelogjson --hidden
720 $ hg fatelogjson --hidden
736 o 019fadeab383
721 o 019fadeab383
737 |
722 |
738 | x 65b757b745b9
723 | x 65b757b745b9
739 |/ Obsfate: [{"markers": [["65b757b745b935093c87a2bccd877521cccffcbd", ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]}]
724 |/ Obsfate: [{"markers": [["65b757b745b935093c87a2bccd877521cccffcbd", ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["019fadeab383f6699fa83ad7bdb4d82ed2c0e5ab"]}]
740 | @ fdf9bde5129a
725 | @ fdf9bde5129a
741 |/
726 |/
742 | x 471f378eab4c
727 | x 471f378eab4c
743 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"]}, {"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["65b757b745b935093c87a2bccd877521cccffcbd"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["65b757b745b935093c87a2bccd877521cccffcbd"]}]
728 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"]}, {"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["65b757b745b935093c87a2bccd877521cccffcbd"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["65b757b745b935093c87a2bccd877521cccffcbd"]}]
744 o ea207398892e
729 o ea207398892e
745
730
746
731
747 Test templates with amended + folded commit
732 Test templates with amended + folded commit
748 ===========================================
733 ===========================================
749
734
750 Test setup
735 Test setup
751 ----------
736 ----------
752
737
753 $ hg init $TESTTMP/templates-local-amend-fold
738 $ hg init $TESTTMP/templates-local-amend-fold
754 $ cd $TESTTMP/templates-local-amend-fold
739 $ cd $TESTTMP/templates-local-amend-fold
755 $ mkcommit ROOT
740 $ mkcommit ROOT
756 $ mkcommit A0
741 $ mkcommit A0
757 $ mkcommit B0
742 $ mkcommit B0
758 $ hg commit --amend -m "B1"
743 $ hg commit --amend -m "B1"
759 $ hg log --hidden -G
744 $ hg log --hidden -G
760 @ changeset: 3:b7ea6d14e664
745 @ changeset: 3:b7ea6d14e664
761 | tag: tip
746 | tag: tip
762 | parent: 1:471f378eab4c
747 | parent: 1:471f378eab4c
763 | user: test
748 | user: test
764 | date: Thu Jan 01 00:00:00 1970 +0000
749 | date: Thu Jan 01 00:00:00 1970 +0000
765 | summary: B1
750 | summary: B1
766 |
751 |
767 | x changeset: 2:0dec01379d3b
752 | x changeset: 2:0dec01379d3b
768 |/ user: test
753 |/ user: test
769 | date: Thu Jan 01 00:00:00 1970 +0000
754 | date: Thu Jan 01 00:00:00 1970 +0000
770 | summary: B0
755 | summary: B0
771 |
756 |
772 o changeset: 1:471f378eab4c
757 o changeset: 1:471f378eab4c
773 | user: test
758 | user: test
774 | date: Thu Jan 01 00:00:00 1970 +0000
759 | date: Thu Jan 01 00:00:00 1970 +0000
775 | summary: A0
760 | summary: A0
776 |
761 |
777 o changeset: 0:ea207398892e
762 o changeset: 0:ea207398892e
778 user: test
763 user: test
779 date: Thu Jan 01 00:00:00 1970 +0000
764 date: Thu Jan 01 00:00:00 1970 +0000
780 summary: ROOT
765 summary: ROOT
781
766
782 # Simulate a fold
767 # Simulate a fold
783 $ hg up -r "desc(ROOT)"
768 $ hg up -r "desc(ROOT)"
784 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
769 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
785 $ echo "A0" > A0
770 $ echo "A0" > A0
786 $ echo "B0" > B0
771 $ echo "B0" > B0
787 $ hg commit -A -m "C0"
772 $ hg commit -A -m "C0"
788 adding A0
773 adding A0
789 adding B0
774 adding B0
790 created new head
775 created new head
791 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
776 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(C0)"`
792 obsoleted 1 changesets
777 obsoleted 1 changesets
793 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
778 $ hg debugobsolete `getid "desc(B1)"` `getid "desc(C0)"`
794 obsoleted 1 changesets
779 obsoleted 1 changesets
795
780
796 $ hg log --hidden -G
781 $ hg log --hidden -G
797 @ changeset: 4:eb5a0daa2192
782 @ changeset: 4:eb5a0daa2192
798 | tag: tip
783 | tag: tip
799 | parent: 0:ea207398892e
784 | parent: 0:ea207398892e
800 | user: test
785 | user: test
801 | date: Thu Jan 01 00:00:00 1970 +0000
786 | date: Thu Jan 01 00:00:00 1970 +0000
802 | summary: C0
787 | summary: C0
803 |
788 |
804 | x changeset: 3:b7ea6d14e664
789 | x changeset: 3:b7ea6d14e664
805 | | parent: 1:471f378eab4c
790 | | parent: 1:471f378eab4c
806 | | user: test
791 | | user: test
807 | | date: Thu Jan 01 00:00:00 1970 +0000
792 | | date: Thu Jan 01 00:00:00 1970 +0000
808 | | summary: B1
793 | | summary: B1
809 | |
794 | |
810 | | x changeset: 2:0dec01379d3b
795 | | x changeset: 2:0dec01379d3b
811 | |/ user: test
796 | |/ user: test
812 | | date: Thu Jan 01 00:00:00 1970 +0000
797 | | date: Thu Jan 01 00:00:00 1970 +0000
813 | | summary: B0
798 | | summary: B0
814 | |
799 | |
815 | x changeset: 1:471f378eab4c
800 | x changeset: 1:471f378eab4c
816 |/ user: test
801 |/ user: test
817 | date: Thu Jan 01 00:00:00 1970 +0000
802 | date: Thu Jan 01 00:00:00 1970 +0000
818 | summary: A0
803 | summary: A0
819 |
804 |
820 o changeset: 0:ea207398892e
805 o changeset: 0:ea207398892e
821 user: test
806 user: test
822 date: Thu Jan 01 00:00:00 1970 +0000
807 date: Thu Jan 01 00:00:00 1970 +0000
823 summary: ROOT
808 summary: ROOT
824
809
825 Check templates
810 Check templates
826 ---------------
811 ---------------
827
812
828 $ hg up 'desc(A0)' --hidden
813 $ hg up 'desc(A0)' --hidden
829 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
814 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
830
815
831 Predecessors template should show current revision as it is the working copy
816 Predecessors template should show current revision as it is the working copy
832 $ hg tlog
817 $ hg tlog
833 o eb5a0daa2192
818 o eb5a0daa2192
834 | Predecessors: 1:471f378eab4c
819 | Predecessors: 1:471f378eab4c
835 | semi-colon: 1:471f378eab4c
820 | semi-colon: 1:471f378eab4c
836 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
821 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
837 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
822 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
838 | @ 471f378eab4c
823 | @ 471f378eab4c
839 |/ Successors: 4:eb5a0daa2192
824 |/ Successors: 4:eb5a0daa2192
840 | multi-line: 4:eb5a0daa2192
825 | multi-line: 4:eb5a0daa2192
841 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
826 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
842 o ea207398892e
827 o ea207398892e
843
828
844
829
845 $ hg fatelog
830 $ hg fatelog
846 o eb5a0daa2192
831 o eb5a0daa2192
847 |
832 |
848 | @ 471f378eab4c
833 | @ 471f378eab4c
849 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
834 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
850 o ea207398892e
835 o ea207398892e
851
836
852 $ hg up 'desc(B0)' --hidden
837 $ hg up 'desc(B0)' --hidden
853 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
838 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
854
839
855 Predecessors template should both predecessors as they are visible
840 Predecessors template should both predecessors as they are visible
856 $ hg tlog
841 $ hg tlog
857 o eb5a0daa2192
842 o eb5a0daa2192
858 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
843 | Predecessors: 2:0dec01379d3b 1:471f378eab4c
859 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
844 | semi-colon: 2:0dec01379d3b; 1:471f378eab4c
860 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
845 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", "471f378eab4c5e25f6c77f785b27c936efb22874"]
861 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
846 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5 1:471f378eab4c5e25f6c77f785b27c936efb22874
862 | @ 0dec01379d3b
847 | @ 0dec01379d3b
863 | | Successors: 4:eb5a0daa2192
848 | | Successors: 4:eb5a0daa2192
864 | | multi-line: 4:eb5a0daa2192
849 | | multi-line: 4:eb5a0daa2192
865 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
850 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
866 | x 471f378eab4c
851 | x 471f378eab4c
867 |/ Successors: 4:eb5a0daa2192
852 |/ Successors: 4:eb5a0daa2192
868 | multi-line: 4:eb5a0daa2192
853 | multi-line: 4:eb5a0daa2192
869 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
854 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
870 o ea207398892e
855 o ea207398892e
871
856
872
857
873 $ hg fatelog
858 $ hg fatelog
874 o eb5a0daa2192
859 o eb5a0daa2192
875 |
860 |
876 | @ 0dec01379d3b
861 | @ 0dec01379d3b
877 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
862 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
878 | x 471f378eab4c
863 | x 471f378eab4c
879 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
864 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
880 o ea207398892e
865 o ea207398892e
881
866
882 $ hg up 'desc(B1)' --hidden
867 $ hg up 'desc(B1)' --hidden
883 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
868 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
884
869
885 Predecessors template should both predecessors as they are visible
870 Predecessors template should both predecessors as they are visible
886 $ hg tlog
871 $ hg tlog
887 o eb5a0daa2192
872 o eb5a0daa2192
888 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
873 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
889 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
874 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
890 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
875 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
891 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
876 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
892 | @ b7ea6d14e664
877 | @ b7ea6d14e664
893 | | Successors: 4:eb5a0daa2192
878 | | Successors: 4:eb5a0daa2192
894 | | multi-line: 4:eb5a0daa2192
879 | | multi-line: 4:eb5a0daa2192
895 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
880 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
896 | x 471f378eab4c
881 | x 471f378eab4c
897 |/ Successors: 4:eb5a0daa2192
882 |/ Successors: 4:eb5a0daa2192
898 | multi-line: 4:eb5a0daa2192
883 | multi-line: 4:eb5a0daa2192
899 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
884 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
900 o ea207398892e
885 o ea207398892e
901
886
902
887
903 $ hg fatelog
888 $ hg fatelog
904 o eb5a0daa2192
889 o eb5a0daa2192
905 |
890 |
906 | @ b7ea6d14e664
891 | @ b7ea6d14e664
907 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
892 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
908 | x 471f378eab4c
893 | x 471f378eab4c
909 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
894 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
910 o ea207398892e
895 o ea207398892e
911
896
912 $ hg up 'desc(C0)'
897 $ hg up 'desc(C0)'
913 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
898 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
914
899
915 Predecessors template should show no predecessors as they are both non visible
900 Predecessors template should show no predecessors as they are both non visible
916 $ hg tlog
901 $ hg tlog
917 @ eb5a0daa2192
902 @ eb5a0daa2192
918 |
903 |
919 o ea207398892e
904 o ea207398892e
920
905
921
906
922 $ hg fatelog
907 $ hg fatelog
923 @ eb5a0daa2192
908 @ eb5a0daa2192
924 |
909 |
925 o ea207398892e
910 o ea207398892e
926
911
927 Predecessors template should show all predecessors as we force their display
912 Predecessors template should show all predecessors as we force their display
928 with --hidden
913 with --hidden
929 $ hg tlog --hidden
914 $ hg tlog --hidden
930 @ eb5a0daa2192
915 @ eb5a0daa2192
931 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
916 | Predecessors: 1:471f378eab4c 3:b7ea6d14e664
932 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
917 | semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
933 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
918 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874", "b7ea6d14e664bdc8922221f7992631b50da3fb07"]
934 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
919 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 3:b7ea6d14e664bdc8922221f7992631b50da3fb07
935 | x b7ea6d14e664
920 | x b7ea6d14e664
936 | | Predecessors: 2:0dec01379d3b
921 | | Predecessors: 2:0dec01379d3b
937 | | semi-colon: 2:0dec01379d3b
922 | | semi-colon: 2:0dec01379d3b
938 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
923 | | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
939 | | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
924 | | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
940 | | Successors: 4:eb5a0daa2192
925 | | Successors: 4:eb5a0daa2192
941 | | multi-line: 4:eb5a0daa2192
926 | | multi-line: 4:eb5a0daa2192
942 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
927 | | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
943 | | x 0dec01379d3b
928 | | x 0dec01379d3b
944 | |/ Successors: 3:b7ea6d14e664
929 | |/ Successors: 3:b7ea6d14e664
945 | | multi-line: 3:b7ea6d14e664
930 | | multi-line: 3:b7ea6d14e664
946 | | json: [["b7ea6d14e664bdc8922221f7992631b50da3fb07"]]
931 | | json: [["b7ea6d14e664bdc8922221f7992631b50da3fb07"]]
947 | x 471f378eab4c
932 | x 471f378eab4c
948 |/ Successors: 4:eb5a0daa2192
933 |/ Successors: 4:eb5a0daa2192
949 | multi-line: 4:eb5a0daa2192
934 | multi-line: 4:eb5a0daa2192
950 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
935 | json: [["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]]
951 o ea207398892e
936 o ea207398892e
952
937
953
938
954 $ hg fatelog --hidden
939 $ hg fatelog --hidden
955 @ eb5a0daa2192
940 @ eb5a0daa2192
956 |
941 |
957 | x b7ea6d14e664
942 | x b7ea6d14e664
958 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
943 | | Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
959 | | x 0dec01379d3b
944 | | x 0dec01379d3b
960 | |/ Obsfate: rewritten as 3:b7ea6d14e664 by test (at 1970-01-01 00:00 +0000);
945 | |/ Obsfate: rewritten as 3:b7ea6d14e664 by test (at 1970-01-01 00:00 +0000);
961 | x 471f378eab4c
946 | x 471f378eab4c
962 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
947 |/ Obsfate: rewritten as 4:eb5a0daa2192 by test (at 1970-01-01 00:00 +0000);
963 o ea207398892e
948 o ea207398892e
964
949
965
950
966 $ hg fatelogjson --hidden
951 $ hg fatelogjson --hidden
967 @ eb5a0daa2192
952 @ eb5a0daa2192
968 |
953 |
969 | x b7ea6d14e664
954 | x b7ea6d14e664
970 | | Obsfate: [{"markers": [["b7ea6d14e664bdc8922221f7992631b50da3fb07", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
955 | | Obsfate: [{"markers": [["b7ea6d14e664bdc8922221f7992631b50da3fb07", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
971 | | x 0dec01379d3b
956 | | x 0dec01379d3b
972 | |/ Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["b7ea6d14e664bdc8922221f7992631b50da3fb07"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["b7ea6d14e664bdc8922221f7992631b50da3fb07"]}]
957 | |/ Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["b7ea6d14e664bdc8922221f7992631b50da3fb07"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["b7ea6d14e664bdc8922221f7992631b50da3fb07"]}]
973 | x 471f378eab4c
958 | x 471f378eab4c
974 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
959 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["eb5a0daa21923bbf8caeb2c42085b9e463861fd0"]}]
975 o ea207398892e
960 o ea207398892e
976
961
977
962
978 Test template with pushed and pulled obs markers
963 Test template with pushed and pulled obs markers
979 ================================================
964 ================================================
980
965
981 Test setup
966 Test setup
982 ----------
967 ----------
983
968
984 $ hg init $TESTTMP/templates-local-remote-markers-1
969 $ hg init $TESTTMP/templates-local-remote-markers-1
985 $ cd $TESTTMP/templates-local-remote-markers-1
970 $ cd $TESTTMP/templates-local-remote-markers-1
986 $ mkcommit ROOT
971 $ mkcommit ROOT
987 $ mkcommit A0
972 $ mkcommit A0
988 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
973 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
989 updating to branch default
974 updating to branch default
990 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
975 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
991 $ cd $TESTTMP/templates-local-remote-markers-2
976 $ cd $TESTTMP/templates-local-remote-markers-2
992 $ hg log --hidden -G
977 $ hg log --hidden -G
993 @ changeset: 1:471f378eab4c
978 @ changeset: 1:471f378eab4c
994 | tag: tip
979 | tag: tip
995 | user: test
980 | user: test
996 | date: Thu Jan 01 00:00:00 1970 +0000
981 | date: Thu Jan 01 00:00:00 1970 +0000
997 | summary: A0
982 | summary: A0
998 |
983 |
999 o changeset: 0:ea207398892e
984 o changeset: 0:ea207398892e
1000 user: test
985 user: test
1001 date: Thu Jan 01 00:00:00 1970 +0000
986 date: Thu Jan 01 00:00:00 1970 +0000
1002 summary: ROOT
987 summary: ROOT
1003
988
1004 $ cd $TESTTMP/templates-local-remote-markers-1
989 $ cd $TESTTMP/templates-local-remote-markers-1
1005 $ hg commit --amend -m "A1"
990 $ hg commit --amend -m "A1"
1006 $ hg commit --amend -m "A2"
991 $ hg commit --amend -m "A2"
1007 $ hg log --hidden -G
992 $ hg log --hidden -G
1008 @ changeset: 3:7a230b46bf61
993 @ changeset: 3:7a230b46bf61
1009 | tag: tip
994 | tag: tip
1010 | parent: 0:ea207398892e
995 | parent: 0:ea207398892e
1011 | user: test
996 | user: test
1012 | date: Thu Jan 01 00:00:00 1970 +0000
997 | date: Thu Jan 01 00:00:00 1970 +0000
1013 | summary: A2
998 | summary: A2
1014 |
999 |
1015 | x changeset: 2:fdf9bde5129a
1000 | x changeset: 2:fdf9bde5129a
1016 |/ parent: 0:ea207398892e
1001 |/ parent: 0:ea207398892e
1017 | user: test
1002 | user: test
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1003 | date: Thu Jan 01 00:00:00 1970 +0000
1019 | summary: A1
1004 | summary: A1
1020 |
1005 |
1021 | x changeset: 1:471f378eab4c
1006 | x changeset: 1:471f378eab4c
1022 |/ user: test
1007 |/ user: test
1023 | date: Thu Jan 01 00:00:00 1970 +0000
1008 | date: Thu Jan 01 00:00:00 1970 +0000
1024 | summary: A0
1009 | summary: A0
1025 |
1010 |
1026 o changeset: 0:ea207398892e
1011 o changeset: 0:ea207398892e
1027 user: test
1012 user: test
1028 date: Thu Jan 01 00:00:00 1970 +0000
1013 date: Thu Jan 01 00:00:00 1970 +0000
1029 summary: ROOT
1014 summary: ROOT
1030
1015
1031 $ cd $TESTTMP/templates-local-remote-markers-2
1016 $ cd $TESTTMP/templates-local-remote-markers-2
1032 $ hg pull
1017 $ hg pull
1033 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
1018 pulling from $TESTTMP/templates-local-remote-markers-1 (glob)
1034 searching for changes
1019 searching for changes
1035 adding changesets
1020 adding changesets
1036 adding manifests
1021 adding manifests
1037 adding file changes
1022 adding file changes
1038 added 1 changesets with 0 changes to 1 files (+1 heads)
1023 added 1 changesets with 0 changes to 1 files (+1 heads)
1039 2 new obsolescence markers
1024 2 new obsolescence markers
1040 obsoleted 1 changesets
1025 obsoleted 1 changesets
1041 (run 'hg heads' to see heads, 'hg merge' to merge)
1026 (run 'hg heads' to see heads, 'hg merge' to merge)
1042 $ hg log --hidden -G
1027 $ hg log --hidden -G
1043 o changeset: 2:7a230b46bf61
1028 o changeset: 2:7a230b46bf61
1044 | tag: tip
1029 | tag: tip
1045 | parent: 0:ea207398892e
1030 | parent: 0:ea207398892e
1046 | user: test
1031 | user: test
1047 | date: Thu Jan 01 00:00:00 1970 +0000
1032 | date: Thu Jan 01 00:00:00 1970 +0000
1048 | summary: A2
1033 | summary: A2
1049 |
1034 |
1050 | @ changeset: 1:471f378eab4c
1035 | @ changeset: 1:471f378eab4c
1051 |/ user: test
1036 |/ user: test
1052 | date: Thu Jan 01 00:00:00 1970 +0000
1037 | date: Thu Jan 01 00:00:00 1970 +0000
1053 | summary: A0
1038 | summary: A0
1054 |
1039 |
1055 o changeset: 0:ea207398892e
1040 o changeset: 0:ea207398892e
1056 user: test
1041 user: test
1057 date: Thu Jan 01 00:00:00 1970 +0000
1042 date: Thu Jan 01 00:00:00 1970 +0000
1058 summary: ROOT
1043 summary: ROOT
1059
1044
1060
1045
1061 $ hg debugobsolete
1046 $ hg debugobsolete
1062 471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1047 471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1063 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1048 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 7a230b46bf61e50b30308c6cfd7bd1269ef54702 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1064
1049
1065 Check templates
1050 Check templates
1066 ---------------
1051 ---------------
1067
1052
1068 Predecessors template should show current revision as it is the working copy
1053 Predecessors template should show current revision as it is the working copy
1069 $ hg tlog
1054 $ hg tlog
1070 o 7a230b46bf61
1055 o 7a230b46bf61
1071 | Predecessors: 1:471f378eab4c
1056 | Predecessors: 1:471f378eab4c
1072 | semi-colon: 1:471f378eab4c
1057 | semi-colon: 1:471f378eab4c
1073 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1058 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1074 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1059 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1075 | @ 471f378eab4c
1060 | @ 471f378eab4c
1076 |/ Successors: 2:7a230b46bf61
1061 |/ Successors: 2:7a230b46bf61
1077 | multi-line: 2:7a230b46bf61
1062 | multi-line: 2:7a230b46bf61
1078 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
1063 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
1079 o ea207398892e
1064 o ea207398892e
1080
1065
1081
1066
1082 $ hg fatelog
1067 $ hg fatelog
1083 o 7a230b46bf61
1068 o 7a230b46bf61
1084 |
1069 |
1085 | @ 471f378eab4c
1070 | @ 471f378eab4c
1086 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1071 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1087 o ea207398892e
1072 o ea207398892e
1088
1073
1089 $ hg up 'desc(A2)'
1074 $ hg up 'desc(A2)'
1090 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1075 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1091
1076
1092 Predecessors template should show no predecessors as they are non visible
1077 Predecessors template should show no predecessors as they are non visible
1093 $ hg tlog
1078 $ hg tlog
1094 @ 7a230b46bf61
1079 @ 7a230b46bf61
1095 |
1080 |
1096 o ea207398892e
1081 o ea207398892e
1097
1082
1098
1083
1099 $ hg fatelog
1084 $ hg fatelog
1100 @ 7a230b46bf61
1085 @ 7a230b46bf61
1101 |
1086 |
1102 o ea207398892e
1087 o ea207398892e
1103
1088
1104 Predecessors template should show all predecessors as we force their display
1089 Predecessors template should show all predecessors as we force their display
1105 with --hidden
1090 with --hidden
1106 $ hg tlog --hidden
1091 $ hg tlog --hidden
1107 @ 7a230b46bf61
1092 @ 7a230b46bf61
1108 | Predecessors: 1:471f378eab4c
1093 | Predecessors: 1:471f378eab4c
1109 | semi-colon: 1:471f378eab4c
1094 | semi-colon: 1:471f378eab4c
1110 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1095 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1111 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1096 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1112 | x 471f378eab4c
1097 | x 471f378eab4c
1113 |/ Successors: 2:7a230b46bf61
1098 |/ Successors: 2:7a230b46bf61
1114 | multi-line: 2:7a230b46bf61
1099 | multi-line: 2:7a230b46bf61
1115 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
1100 | json: [["7a230b46bf61e50b30308c6cfd7bd1269ef54702"]]
1116 o ea207398892e
1101 o ea207398892e
1117
1102
1118
1103
1119 $ hg fatelog --hidden
1104 $ hg fatelog --hidden
1120 @ 7a230b46bf61
1105 @ 7a230b46bf61
1121 |
1106 |
1122 | x 471f378eab4c
1107 | x 471f378eab4c
1123 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1108 |/ Obsfate: rewritten as 2:7a230b46bf61 by test (at 1970-01-01 00:00 +0000);
1124 o ea207398892e
1109 o ea207398892e
1125
1110
1126
1111
1127 Test template with obsmarkers cycle
1112 Test template with obsmarkers cycle
1128 ===================================
1113 ===================================
1129
1114
1130 Test setup
1115 Test setup
1131 ----------
1116 ----------
1132
1117
1133 $ hg init $TESTTMP/templates-local-cycle
1118 $ hg init $TESTTMP/templates-local-cycle
1134 $ cd $TESTTMP/templates-local-cycle
1119 $ cd $TESTTMP/templates-local-cycle
1135 $ mkcommit ROOT
1120 $ mkcommit ROOT
1136 $ mkcommit A0
1121 $ mkcommit A0
1137 $ mkcommit B0
1122 $ mkcommit B0
1138 $ hg up -r 0
1123 $ hg up -r 0
1139 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1124 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1140 $ mkcommit C0
1125 $ mkcommit C0
1141 created new head
1126 created new head
1142
1127
1143 Create the cycle
1128 Create the cycle
1144
1129
1145 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
1130 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(B0)"`
1146 obsoleted 1 changesets
1131 obsoleted 1 changesets
1147 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
1132 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(C0)"`
1148 obsoleted 1 changesets
1133 obsoleted 1 changesets
1149 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
1134 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(A0)"`
1150
1135
1151 Check templates
1136 Check templates
1152 ---------------
1137 ---------------
1153
1138
1154 $ hg tlog
1139 $ hg tlog
1155 @ f897c6137566
1140 @ f897c6137566
1156 |
1141 |
1157 o ea207398892e
1142 o ea207398892e
1158
1143
1159
1144
1160 $ hg fatelog
1145 $ hg fatelog
1161 @ f897c6137566
1146 @ f897c6137566
1162 |
1147 |
1163 o ea207398892e
1148 o ea207398892e
1164
1149
1165
1150
1166 $ hg up -r "desc(B0)" --hidden
1151 $ hg up -r "desc(B0)" --hidden
1167 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1152 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1168 $ hg tlog
1153 $ hg tlog
1169 o f897c6137566
1154 o f897c6137566
1170 | Predecessors: 2:0dec01379d3b
1155 | Predecessors: 2:0dec01379d3b
1171 | semi-colon: 2:0dec01379d3b
1156 | semi-colon: 2:0dec01379d3b
1172 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1157 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1173 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1158 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1174 | @ 0dec01379d3b
1159 | @ 0dec01379d3b
1175 | | Predecessors: 1:471f378eab4c
1160 | | Predecessors: 1:471f378eab4c
1176 | | semi-colon: 1:471f378eab4c
1161 | | semi-colon: 1:471f378eab4c
1177 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1162 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1178 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1163 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1179 | | Successors: 3:f897c6137566; 1:471f378eab4c
1164 | | Successors: 3:f897c6137566; 1:471f378eab4c
1180 | | multi-line: 3:f897c6137566
1165 | | multi-line: 3:f897c6137566
1181 | | multi-line: 1:471f378eab4c
1166 | | multi-line: 1:471f378eab4c
1182 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1167 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1183 | x 471f378eab4c
1168 | x 471f378eab4c
1184 |/ Predecessors: 2:0dec01379d3b
1169 |/ Predecessors: 2:0dec01379d3b
1185 | semi-colon: 2:0dec01379d3b
1170 | semi-colon: 2:0dec01379d3b
1186 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1171 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1187 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1172 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1188 | Successors: 2:0dec01379d3b
1173 | Successors: 2:0dec01379d3b
1189 | multi-line: 2:0dec01379d3b
1174 | multi-line: 2:0dec01379d3b
1190 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1175 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1191 o ea207398892e
1176 o ea207398892e
1192
1177
1193
1178
1194 $ hg fatelog
1179 $ hg fatelog
1195 o f897c6137566
1180 o f897c6137566
1196 |
1181 |
1197 | @ 0dec01379d3b
1182 | @ 0dec01379d3b
1198 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1183 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1199 | x 471f378eab4c
1184 | x 471f378eab4c
1200 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1185 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1201 o ea207398892e
1186 o ea207398892e
1202
1187
1203
1188
1204 $ hg up -r "desc(A0)" --hidden
1189 $ hg up -r "desc(A0)" --hidden
1205 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1190 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1206 $ hg tlog
1191 $ hg tlog
1207 o f897c6137566
1192 o f897c6137566
1208 | Predecessors: 1:471f378eab4c
1193 | Predecessors: 1:471f378eab4c
1209 | semi-colon: 1:471f378eab4c
1194 | semi-colon: 1:471f378eab4c
1210 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1195 | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1211 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1196 | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1212 | @ 471f378eab4c
1197 | @ 471f378eab4c
1213 |/
1198 |/
1214 o ea207398892e
1199 o ea207398892e
1215
1200
1216
1201
1217 $ hg fatelog
1202 $ hg fatelog
1218 o f897c6137566
1203 o f897c6137566
1219 |
1204 |
1220 | @ 471f378eab4c
1205 | @ 471f378eab4c
1221 |/ Obsfate: pruned;
1206 |/ Obsfate: pruned;
1222 o ea207398892e
1207 o ea207398892e
1223
1208
1224
1209
1225 $ hg up -r "desc(ROOT)" --hidden
1210 $ hg up -r "desc(ROOT)" --hidden
1226 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1211 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1227 $ hg tlog
1212 $ hg tlog
1228 o f897c6137566
1213 o f897c6137566
1229 |
1214 |
1230 @ ea207398892e
1215 @ ea207398892e
1231
1216
1232
1217
1233 $ hg fatelog
1218 $ hg fatelog
1234 o f897c6137566
1219 o f897c6137566
1235 |
1220 |
1236 @ ea207398892e
1221 @ ea207398892e
1237
1222
1238
1223
1239 $ hg tlog --hidden
1224 $ hg tlog --hidden
1240 o f897c6137566
1225 o f897c6137566
1241 | Predecessors: 2:0dec01379d3b
1226 | Predecessors: 2:0dec01379d3b
1242 | semi-colon: 2:0dec01379d3b
1227 | semi-colon: 2:0dec01379d3b
1243 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1228 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1244 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1229 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1245 | x 0dec01379d3b
1230 | x 0dec01379d3b
1246 | | Predecessors: 1:471f378eab4c
1231 | | Predecessors: 1:471f378eab4c
1247 | | semi-colon: 1:471f378eab4c
1232 | | semi-colon: 1:471f378eab4c
1248 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1233 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1249 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1234 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1250 | | Successors: 3:f897c6137566; 1:471f378eab4c
1235 | | Successors: 3:f897c6137566; 1:471f378eab4c
1251 | | multi-line: 3:f897c6137566
1236 | | multi-line: 3:f897c6137566
1252 | | multi-line: 1:471f378eab4c
1237 | | multi-line: 1:471f378eab4c
1253 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1238 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1254 | x 471f378eab4c
1239 | x 471f378eab4c
1255 |/ Predecessors: 2:0dec01379d3b
1240 |/ Predecessors: 2:0dec01379d3b
1256 | semi-colon: 2:0dec01379d3b
1241 | semi-colon: 2:0dec01379d3b
1257 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1242 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1258 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1243 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1259 | Successors: 2:0dec01379d3b
1244 | Successors: 2:0dec01379d3b
1260 | multi-line: 2:0dec01379d3b
1245 | multi-line: 2:0dec01379d3b
1261 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1246 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1262 @ ea207398892e
1247 @ ea207398892e
1263
1248
1264 Test template with split + divergence with cycles
1249 Test template with split + divergence with cycles
1265 =================================================
1250 =================================================
1266
1251
1267 $ hg log -G
1252 $ hg log -G
1268 o changeset: 3:f897c6137566
1253 o changeset: 3:f897c6137566
1269 | tag: tip
1254 | tag: tip
1270 | parent: 0:ea207398892e
1255 | parent: 0:ea207398892e
1271 | user: test
1256 | user: test
1272 | date: Thu Jan 01 00:00:00 1970 +0000
1257 | date: Thu Jan 01 00:00:00 1970 +0000
1273 | summary: C0
1258 | summary: C0
1274 |
1259 |
1275 @ changeset: 0:ea207398892e
1260 @ changeset: 0:ea207398892e
1276 user: test
1261 user: test
1277 date: Thu Jan 01 00:00:00 1970 +0000
1262 date: Thu Jan 01 00:00:00 1970 +0000
1278 summary: ROOT
1263 summary: ROOT
1279
1264
1280 $ hg up
1265 $ hg up
1281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1282
1267
1283 Create a commit with three files
1268 Create a commit with three files
1284 $ touch A B C
1269 $ touch A B C
1285 $ hg commit -A -m "Add A,B,C" A B C
1270 $ hg commit -A -m "Add A,B,C" A B C
1286
1271
1287 Split it
1272 Split it
1288 $ hg up 3
1273 $ hg up 3
1289 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
1274 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
1290 $ touch A
1275 $ touch A
1291 $ hg commit -A -m "Add A,B,C" A
1276 $ hg commit -A -m "Add A,B,C" A
1292 created new head
1277 created new head
1293
1278
1294 $ touch B
1279 $ touch B
1295 $ hg commit -A -m "Add A,B,C" B
1280 $ hg commit -A -m "Add A,B,C" B
1296
1281
1297 $ touch C
1282 $ touch C
1298 $ hg commit -A -m "Add A,B,C" C
1283 $ hg commit -A -m "Add A,B,C" C
1299
1284
1300 $ hg log -G
1285 $ hg log -G
1301 @ changeset: 7:ba2ed02b0c9a
1286 @ changeset: 7:ba2ed02b0c9a
1302 | tag: tip
1287 | tag: tip
1303 | user: test
1288 | user: test
1304 | date: Thu Jan 01 00:00:00 1970 +0000
1289 | date: Thu Jan 01 00:00:00 1970 +0000
1305 | summary: Add A,B,C
1290 | summary: Add A,B,C
1306 |
1291 |
1307 o changeset: 6:4a004186e638
1292 o changeset: 6:4a004186e638
1308 | user: test
1293 | user: test
1309 | date: Thu Jan 01 00:00:00 1970 +0000
1294 | date: Thu Jan 01 00:00:00 1970 +0000
1310 | summary: Add A,B,C
1295 | summary: Add A,B,C
1311 |
1296 |
1312 o changeset: 5:dd800401bd8c
1297 o changeset: 5:dd800401bd8c
1313 | parent: 3:f897c6137566
1298 | parent: 3:f897c6137566
1314 | user: test
1299 | user: test
1315 | date: Thu Jan 01 00:00:00 1970 +0000
1300 | date: Thu Jan 01 00:00:00 1970 +0000
1316 | summary: Add A,B,C
1301 | summary: Add A,B,C
1317 |
1302 |
1318 | o changeset: 4:9bd10a0775e4
1303 | o changeset: 4:9bd10a0775e4
1319 |/ user: test
1304 |/ user: test
1320 | date: Thu Jan 01 00:00:00 1970 +0000
1305 | date: Thu Jan 01 00:00:00 1970 +0000
1321 | summary: Add A,B,C
1306 | summary: Add A,B,C
1322 |
1307 |
1323 o changeset: 3:f897c6137566
1308 o changeset: 3:f897c6137566
1324 | parent: 0:ea207398892e
1309 | parent: 0:ea207398892e
1325 | user: test
1310 | user: test
1326 | date: Thu Jan 01 00:00:00 1970 +0000
1311 | date: Thu Jan 01 00:00:00 1970 +0000
1327 | summary: C0
1312 | summary: C0
1328 |
1313 |
1329 o changeset: 0:ea207398892e
1314 o changeset: 0:ea207398892e
1330 user: test
1315 user: test
1331 date: Thu Jan 01 00:00:00 1970 +0000
1316 date: Thu Jan 01 00:00:00 1970 +0000
1332 summary: ROOT
1317 summary: ROOT
1333
1318
1334 $ hg debugobsolete `getid "4"` `getid "5"` `getid "6"` `getid "7"`
1319 $ hg debugobsolete `getid "4"` `getid "5"` `getid "6"` `getid "7"`
1335 obsoleted 1 changesets
1320 obsoleted 1 changesets
1336 $ hg log -G
1321 $ hg log -G
1337 @ changeset: 7:ba2ed02b0c9a
1322 @ changeset: 7:ba2ed02b0c9a
1338 | tag: tip
1323 | tag: tip
1339 | user: test
1324 | user: test
1340 | date: Thu Jan 01 00:00:00 1970 +0000
1325 | date: Thu Jan 01 00:00:00 1970 +0000
1341 | summary: Add A,B,C
1326 | summary: Add A,B,C
1342 |
1327 |
1343 o changeset: 6:4a004186e638
1328 o changeset: 6:4a004186e638
1344 | user: test
1329 | user: test
1345 | date: Thu Jan 01 00:00:00 1970 +0000
1330 | date: Thu Jan 01 00:00:00 1970 +0000
1346 | summary: Add A,B,C
1331 | summary: Add A,B,C
1347 |
1332 |
1348 o changeset: 5:dd800401bd8c
1333 o changeset: 5:dd800401bd8c
1349 | parent: 3:f897c6137566
1334 | parent: 3:f897c6137566
1350 | user: test
1335 | user: test
1351 | date: Thu Jan 01 00:00:00 1970 +0000
1336 | date: Thu Jan 01 00:00:00 1970 +0000
1352 | summary: Add A,B,C
1337 | summary: Add A,B,C
1353 |
1338 |
1354 o changeset: 3:f897c6137566
1339 o changeset: 3:f897c6137566
1355 | parent: 0:ea207398892e
1340 | parent: 0:ea207398892e
1356 | user: test
1341 | user: test
1357 | date: Thu Jan 01 00:00:00 1970 +0000
1342 | date: Thu Jan 01 00:00:00 1970 +0000
1358 | summary: C0
1343 | summary: C0
1359 |
1344 |
1360 o changeset: 0:ea207398892e
1345 o changeset: 0:ea207398892e
1361 user: test
1346 user: test
1362 date: Thu Jan 01 00:00:00 1970 +0000
1347 date: Thu Jan 01 00:00:00 1970 +0000
1363 summary: ROOT
1348 summary: ROOT
1364
1349
1365 Diverge one of the splitted commit
1350 Diverge one of the splitted commit
1366
1351
1367 $ hg up 6
1352 $ hg up 6
1368 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1353 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1369 $ hg commit --amend -m "Add only B"
1354 $ hg commit --amend -m "Add only B"
1370
1355
1371 $ hg up 6 --hidden
1356 $ hg up 6 --hidden
1372 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1357 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1373 $ hg commit --amend -m "Add B only"
1358 $ hg commit --amend -m "Add B only"
1374
1359
1375 $ hg log -G
1360 $ hg log -G
1376 @ changeset: 9:0b997eb7ceee
1361 @ changeset: 9:0b997eb7ceee
1377 | tag: tip
1362 | tag: tip
1378 | parent: 5:dd800401bd8c
1363 | parent: 5:dd800401bd8c
1379 | user: test
1364 | user: test
1380 | date: Thu Jan 01 00:00:00 1970 +0000
1365 | date: Thu Jan 01 00:00:00 1970 +0000
1381 | instability: content-divergent
1366 | instability: content-divergent
1382 | summary: Add B only
1367 | summary: Add B only
1383 |
1368 |
1384 | o changeset: 8:b18bc8331526
1369 | o changeset: 8:b18bc8331526
1385 |/ parent: 5:dd800401bd8c
1370 |/ parent: 5:dd800401bd8c
1386 | user: test
1371 | user: test
1387 | date: Thu Jan 01 00:00:00 1970 +0000
1372 | date: Thu Jan 01 00:00:00 1970 +0000
1388 | instability: content-divergent
1373 | instability: content-divergent
1389 | summary: Add only B
1374 | summary: Add only B
1390 |
1375 |
1391 | o changeset: 7:ba2ed02b0c9a
1376 | o changeset: 7:ba2ed02b0c9a
1392 | | user: test
1377 | | user: test
1393 | | date: Thu Jan 01 00:00:00 1970 +0000
1378 | | date: Thu Jan 01 00:00:00 1970 +0000
1394 | | instability: orphan, content-divergent
1379 | | instability: orphan, content-divergent
1395 | | summary: Add A,B,C
1380 | | summary: Add A,B,C
1396 | |
1381 | |
1397 | x changeset: 6:4a004186e638
1382 | x changeset: 6:4a004186e638
1398 |/ user: test
1383 |/ user: test
1399 | date: Thu Jan 01 00:00:00 1970 +0000
1384 | date: Thu Jan 01 00:00:00 1970 +0000
1400 | summary: Add A,B,C
1385 | summary: Add A,B,C
1401 |
1386 |
1402 o changeset: 5:dd800401bd8c
1387 o changeset: 5:dd800401bd8c
1403 | parent: 3:f897c6137566
1388 | parent: 3:f897c6137566
1404 | user: test
1389 | user: test
1405 | date: Thu Jan 01 00:00:00 1970 +0000
1390 | date: Thu Jan 01 00:00:00 1970 +0000
1406 | instability: content-divergent
1391 | instability: content-divergent
1407 | summary: Add A,B,C
1392 | summary: Add A,B,C
1408 |
1393 |
1409 o changeset: 3:f897c6137566
1394 o changeset: 3:f897c6137566
1410 | parent: 0:ea207398892e
1395 | parent: 0:ea207398892e
1411 | user: test
1396 | user: test
1412 | date: Thu Jan 01 00:00:00 1970 +0000
1397 | date: Thu Jan 01 00:00:00 1970 +0000
1413 | summary: C0
1398 | summary: C0
1414 |
1399 |
1415 o changeset: 0:ea207398892e
1400 o changeset: 0:ea207398892e
1416 user: test
1401 user: test
1417 date: Thu Jan 01 00:00:00 1970 +0000
1402 date: Thu Jan 01 00:00:00 1970 +0000
1418 summary: ROOT
1403 summary: ROOT
1419
1404
1420
1405
1421 Check templates
1406 Check templates
1422 ---------------
1407 ---------------
1423
1408
1424 $ hg tlog
1409 $ hg tlog
1425 @ 0b997eb7ceee
1410 @ 0b997eb7ceee
1426 | Predecessors: 6:4a004186e638
1411 | Predecessors: 6:4a004186e638
1427 | semi-colon: 6:4a004186e638
1412 | semi-colon: 6:4a004186e638
1428 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1413 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1429 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1414 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1430 | o b18bc8331526
1415 | o b18bc8331526
1431 |/ Predecessors: 6:4a004186e638
1416 |/ Predecessors: 6:4a004186e638
1432 | semi-colon: 6:4a004186e638
1417 | semi-colon: 6:4a004186e638
1433 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1418 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1434 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1419 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1435 | o ba2ed02b0c9a
1420 | o ba2ed02b0c9a
1436 | |
1421 | |
1437 | x 4a004186e638
1422 | x 4a004186e638
1438 |/ Successors: 8:b18bc8331526; 9:0b997eb7ceee
1423 |/ Successors: 8:b18bc8331526; 9:0b997eb7ceee
1439 | multi-line: 8:b18bc8331526
1424 | multi-line: 8:b18bc8331526
1440 | multi-line: 9:0b997eb7ceee
1425 | multi-line: 9:0b997eb7ceee
1441 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1426 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1442 o dd800401bd8c
1427 o dd800401bd8c
1443 |
1428 |
1444 o f897c6137566
1429 o f897c6137566
1445 |
1430 |
1446 o ea207398892e
1431 o ea207398892e
1447
1432
1448 $ hg fatelog
1433 $ hg fatelog
1449 @ 0b997eb7ceee
1434 @ 0b997eb7ceee
1450 |
1435 |
1451 | o b18bc8331526
1436 | o b18bc8331526
1452 |/
1437 |/
1453 | o ba2ed02b0c9a
1438 | o ba2ed02b0c9a
1454 | |
1439 | |
1455 | x 4a004186e638
1440 | x 4a004186e638
1456 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1441 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1457 o dd800401bd8c
1442 o dd800401bd8c
1458 |
1443 |
1459 o f897c6137566
1444 o f897c6137566
1460 |
1445 |
1461 o ea207398892e
1446 o ea207398892e
1462
1447
1463 $ hg tlog --hidden
1448 $ hg tlog --hidden
1464 @ 0b997eb7ceee
1449 @ 0b997eb7ceee
1465 | Predecessors: 6:4a004186e638
1450 | Predecessors: 6:4a004186e638
1466 | semi-colon: 6:4a004186e638
1451 | semi-colon: 6:4a004186e638
1467 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1452 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1468 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1453 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1469 | o b18bc8331526
1454 | o b18bc8331526
1470 |/ Predecessors: 6:4a004186e638
1455 |/ Predecessors: 6:4a004186e638
1471 | semi-colon: 6:4a004186e638
1456 | semi-colon: 6:4a004186e638
1472 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1457 | json: ["4a004186e63889f20cb16434fcbd72220bd1eace"]
1473 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1458 | map: 6:4a004186e63889f20cb16434fcbd72220bd1eace
1474 | o ba2ed02b0c9a
1459 | o ba2ed02b0c9a
1475 | | Predecessors: 4:9bd10a0775e4
1460 | | Predecessors: 4:9bd10a0775e4
1476 | | semi-colon: 4:9bd10a0775e4
1461 | | semi-colon: 4:9bd10a0775e4
1477 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1462 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1478 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1463 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1479 | x 4a004186e638
1464 | x 4a004186e638
1480 |/ Predecessors: 4:9bd10a0775e4
1465 |/ Predecessors: 4:9bd10a0775e4
1481 | semi-colon: 4:9bd10a0775e4
1466 | semi-colon: 4:9bd10a0775e4
1482 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1467 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1483 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1468 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1484 | Successors: 8:b18bc8331526; 9:0b997eb7ceee
1469 | Successors: 8:b18bc8331526; 9:0b997eb7ceee
1485 | multi-line: 8:b18bc8331526
1470 | multi-line: 8:b18bc8331526
1486 | multi-line: 9:0b997eb7ceee
1471 | multi-line: 9:0b997eb7ceee
1487 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1472 | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]]
1488 o dd800401bd8c
1473 o dd800401bd8c
1489 | Predecessors: 4:9bd10a0775e4
1474 | Predecessors: 4:9bd10a0775e4
1490 | semi-colon: 4:9bd10a0775e4
1475 | semi-colon: 4:9bd10a0775e4
1491 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1476 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1492 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1477 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1493 | x 9bd10a0775e4
1478 | x 9bd10a0775e4
1494 |/ Successors: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1479 |/ Successors: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1495 | multi-line: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1480 | multi-line: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
1496 | json: [["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]]
1481 | json: [["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]]
1497 o f897c6137566
1482 o f897c6137566
1498 | Predecessors: 2:0dec01379d3b
1483 | Predecessors: 2:0dec01379d3b
1499 | semi-colon: 2:0dec01379d3b
1484 | semi-colon: 2:0dec01379d3b
1500 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1485 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1501 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1486 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1502 | x 0dec01379d3b
1487 | x 0dec01379d3b
1503 | | Predecessors: 1:471f378eab4c
1488 | | Predecessors: 1:471f378eab4c
1504 | | semi-colon: 1:471f378eab4c
1489 | | semi-colon: 1:471f378eab4c
1505 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1490 | | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"]
1506 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1491 | | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874
1507 | | Successors: 3:f897c6137566; 1:471f378eab4c
1492 | | Successors: 3:f897c6137566; 1:471f378eab4c
1508 | | multi-line: 3:f897c6137566
1493 | | multi-line: 3:f897c6137566
1509 | | multi-line: 1:471f378eab4c
1494 | | multi-line: 1:471f378eab4c
1510 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1495 | | json: [["f897c6137566320b081514b4c7227ecc3d384b39"], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]
1511 | x 471f378eab4c
1496 | x 471f378eab4c
1512 |/ Predecessors: 2:0dec01379d3b
1497 |/ Predecessors: 2:0dec01379d3b
1513 | semi-colon: 2:0dec01379d3b
1498 | semi-colon: 2:0dec01379d3b
1514 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1499 | json: ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]
1515 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1500 | map: 2:0dec01379d3be6318c470ead31b1fe7ae7cb53d5
1516 | Successors: 2:0dec01379d3b
1501 | Successors: 2:0dec01379d3b
1517 | multi-line: 2:0dec01379d3b
1502 | multi-line: 2:0dec01379d3b
1518 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1503 | json: [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]]
1519 o ea207398892e
1504 o ea207398892e
1520
1505
1521 $ hg fatelog --hidden
1506 $ hg fatelog --hidden
1522 @ 0b997eb7ceee
1507 @ 0b997eb7ceee
1523 |
1508 |
1524 | o b18bc8331526
1509 | o b18bc8331526
1525 |/
1510 |/
1526 | o ba2ed02b0c9a
1511 | o ba2ed02b0c9a
1527 | |
1512 | |
1528 | x 4a004186e638
1513 | x 4a004186e638
1529 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1514 |/ Obsfate: rewritten as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000);
1530 o dd800401bd8c
1515 o dd800401bd8c
1531 |
1516 |
1532 | x 9bd10a0775e4
1517 | x 9bd10a0775e4
1533 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test (at 1970-01-01 00:00 +0000);
1518 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test (at 1970-01-01 00:00 +0000);
1534 o f897c6137566
1519 o f897c6137566
1535 |
1520 |
1536 | x 0dec01379d3b
1521 | x 0dec01379d3b
1537 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1522 | | Obsfate: rewritten as 3:f897c6137566 by test (at 1970-01-01 00:00 +0000); rewritten as 1:471f378eab4c by test (at 1970-01-01 00:00 +0000);
1538 | x 471f378eab4c
1523 | x 471f378eab4c
1539 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1524 |/ Obsfate: rewritten as 2:0dec01379d3b by test (at 1970-01-01 00:00 +0000);
1540 o ea207398892e
1525 o ea207398892e
1541
1526
1542 $ hg fatelogjson --hidden
1527 $ hg fatelogjson --hidden
1543 @ 0b997eb7ceee
1528 @ 0b997eb7ceee
1544 |
1529 |
1545 | o b18bc8331526
1530 | o b18bc8331526
1546 |/
1531 |/
1547 | o ba2ed02b0c9a
1532 | o ba2ed02b0c9a
1548 | |
1533 | |
1549 | x 4a004186e638
1534 | x 4a004186e638
1550 |/ Obsfate: [{"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["b18bc8331526a22cbb1801022bd1555bf291c48b"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["b18bc8331526a22cbb1801022bd1555bf291c48b"]}, {"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["0b997eb7ceeee06200a02f8aab185979092d514e"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["0b997eb7ceeee06200a02f8aab185979092d514e"]}]
1535 |/ Obsfate: [{"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["b18bc8331526a22cbb1801022bd1555bf291c48b"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["b18bc8331526a22cbb1801022bd1555bf291c48b"]}, {"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["0b997eb7ceeee06200a02f8aab185979092d514e"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["0b997eb7ceeee06200a02f8aab185979092d514e"]}]
1551 o dd800401bd8c
1536 o dd800401bd8c
1552 |
1537 |
1553 | x 9bd10a0775e4
1538 | x 9bd10a0775e4
1554 |/ Obsfate: [{"markers": [["9bd10a0775e478708cada5f176ec6de654359ce7", ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]}]
1539 |/ Obsfate: [{"markers": [["9bd10a0775e478708cada5f176ec6de654359ce7", ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]}]
1555 o f897c6137566
1540 o f897c6137566
1556 |
1541 |
1557 | x 0dec01379d3b
1542 | x 0dec01379d3b
1558 | | Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["f897c6137566320b081514b4c7227ecc3d384b39"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["f897c6137566320b081514b4c7227ecc3d384b39"]}, {"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["471f378eab4c5e25f6c77f785b27c936efb22874"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["471f378eab4c5e25f6c77f785b27c936efb22874"]}]
1543 | | Obsfate: [{"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["f897c6137566320b081514b4c7227ecc3d384b39"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["f897c6137566320b081514b4c7227ecc3d384b39"]}, {"markers": [["0dec01379d3be6318c470ead31b1fe7ae7cb53d5", ["471f378eab4c5e25f6c77f785b27c936efb22874"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["471f378eab4c5e25f6c77f785b27c936efb22874"]}]
1559 | x 471f378eab4c
1544 | x 471f378eab4c
1560 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]}]
1545 |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["0dec01379d3be6318c470ead31b1fe7ae7cb53d5"]}]
1561 o ea207398892e
1546 o ea207398892e
1562
1547
1563 $ hg up --hidden 4
1548 $ hg up --hidden 4
1564 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1549 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1565 $ hg rebase -r 7 -d 8 --config extensions.rebase=
1550 $ hg rebase -r 7 -d 8 --config extensions.rebase=
1566 rebasing 7:ba2ed02b0c9a "Add A,B,C"
1551 rebasing 7:ba2ed02b0c9a "Add A,B,C"
1567 $ hg tlog
1552 $ hg tlog
1568 o eceed8f98ffc
1553 o eceed8f98ffc
1569 | Predecessors: 4:9bd10a0775e4
1554 | Predecessors: 4:9bd10a0775e4
1570 | semi-colon: 4:9bd10a0775e4
1555 | semi-colon: 4:9bd10a0775e4
1571 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1556 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1572 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1557 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1573 | o 0b997eb7ceee
1558 | o 0b997eb7ceee
1574 | | Predecessors: 4:9bd10a0775e4
1559 | | Predecessors: 4:9bd10a0775e4
1575 | | semi-colon: 4:9bd10a0775e4
1560 | | semi-colon: 4:9bd10a0775e4
1576 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1561 | | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1577 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1562 | | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1578 o | b18bc8331526
1563 o | b18bc8331526
1579 |/ Predecessors: 4:9bd10a0775e4
1564 |/ Predecessors: 4:9bd10a0775e4
1580 | semi-colon: 4:9bd10a0775e4
1565 | semi-colon: 4:9bd10a0775e4
1581 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1566 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1582 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1567 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1583 o dd800401bd8c
1568 o dd800401bd8c
1584 | Predecessors: 4:9bd10a0775e4
1569 | Predecessors: 4:9bd10a0775e4
1585 | semi-colon: 4:9bd10a0775e4
1570 | semi-colon: 4:9bd10a0775e4
1586 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1571 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"]
1587 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1572 | map: 4:9bd10a0775e478708cada5f176ec6de654359ce7
1588 | @ 9bd10a0775e4
1573 | @ 9bd10a0775e4
1589 |/ Successors: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1574 |/ Successors: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1590 | multi-line: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc
1575 | multi-line: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc
1591 | multi-line: 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1576 | multi-line: 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
1592 | json: [["dd800401bd8c79d815329277739e433e883f784e", "0b997eb7ceeee06200a02f8aab185979092d514e", "eceed8f98ffc4186032e29a6542ab98888ebf68d"], ["dd800401bd8c79d815329277739e433e883f784e", "b18bc8331526a22cbb1801022bd1555bf291c48b", "eceed8f98ffc4186032e29a6542ab98888ebf68d"]]
1577 | json: [["dd800401bd8c79d815329277739e433e883f784e", "0b997eb7ceeee06200a02f8aab185979092d514e", "eceed8f98ffc4186032e29a6542ab98888ebf68d"], ["dd800401bd8c79d815329277739e433e883f784e", "b18bc8331526a22cbb1801022bd1555bf291c48b", "eceed8f98ffc4186032e29a6542ab98888ebf68d"]]
1593 o f897c6137566
1578 o f897c6137566
1594 |
1579 |
1595 o ea207398892e
1580 o ea207398892e
1596
1581
1597
1582
1598 $ hg fatelog
1583 $ hg fatelog
1599 o eceed8f98ffc
1584 o eceed8f98ffc
1600 |
1585 |
1601 | o 0b997eb7ceee
1586 | o 0b997eb7ceee
1602 | |
1587 | |
1603 o | b18bc8331526
1588 o | b18bc8331526
1604 |/
1589 |/
1605 o dd800401bd8c
1590 o dd800401bd8c
1606 |
1591 |
1607 | @ 9bd10a0775e4
1592 | @ 9bd10a0775e4
1608 |/ Obsfate: split as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); split as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000);
1593 |/ Obsfate: split as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); split as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000);
1609 o f897c6137566
1594 o f897c6137566
1610 |
1595 |
1611 o ea207398892e
1596 o ea207398892e
1612
1597
1613 Test templates with pruned commits
1598 Test templates with pruned commits
1614 ==================================
1599 ==================================
1615
1600
1616 Test setup
1601 Test setup
1617 ----------
1602 ----------
1618
1603
1619 $ hg init $TESTTMP/templates-local-prune
1604 $ hg init $TESTTMP/templates-local-prune
1620 $ cd $TESTTMP/templates-local-prune
1605 $ cd $TESTTMP/templates-local-prune
1621 $ mkcommit ROOT
1606 $ mkcommit ROOT
1622 $ mkcommit A0
1607 $ mkcommit A0
1623 $ hg debugobsolete --record-parent `getid "."`
1608 $ hg debugobsolete --record-parent `getid "."`
1624 obsoleted 1 changesets
1609 obsoleted 1 changesets
1625
1610
1626 Check output
1611 Check output
1627 ------------
1612 ------------
1628
1613
1629 $ hg up "desc(A0)" --hidden
1614 $ hg up "desc(A0)" --hidden
1630 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1615 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1631 $ hg tlog
1616 $ hg tlog
1632 @ 471f378eab4c
1617 @ 471f378eab4c
1633 |
1618 |
1634 o ea207398892e
1619 o ea207398892e
1635
1620
1636 $ hg fatelog
1621 $ hg fatelog
1637 @ 471f378eab4c
1622 @ 471f378eab4c
1638 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1623 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1639 o ea207398892e
1624 o ea207398892e
1640
1625
1641 $ hg fatelog -v
1626 $ hg fatelog -v
1642 @ 471f378eab4c
1627 @ 471f378eab4c
1643 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1628 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1644 o ea207398892e
1629 o ea207398892e
1645
1630
1646 Test templates with multiple pruned commits
1631 Test templates with multiple pruned commits
1647 ===========================================
1632 ===========================================
1648
1633
1649 Test setup
1634 Test setup
1650 ----------
1635 ----------
1651
1636
1652 $ hg init $TESTTMP/multiple-local-prune
1637 $ hg init $TESTTMP/multiple-local-prune
1653 $ cd $TESTTMP/multiple-local-prune
1638 $ cd $TESTTMP/multiple-local-prune
1654 $ mkcommit ROOT
1639 $ mkcommit ROOT
1655 $ mkcommit A0
1640 $ mkcommit A0
1656 $ hg commit --amend -m "A1"
1641 $ hg commit --amend -m "A1"
1657 $ hg debugobsolete --record-parent `getid "."`
1642 $ hg debugobsolete --record-parent `getid "."`
1658 obsoleted 1 changesets
1643 obsoleted 1 changesets
1659
1644
1660 $ hg up -r "desc(A0)" --hidden
1645 $ hg up -r "desc(A0)" --hidden
1661 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1646 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1662 $ hg commit --amend -m "A2"
1647 $ hg commit --amend -m "A2"
1663 $ hg debugobsolete --record-parent `getid "."`
1648 $ hg debugobsolete --record-parent `getid "."`
1664 obsoleted 1 changesets
1649 obsoleted 1 changesets
1665
1650
1666 Check output
1651 Check output
1667 ------------
1652 ------------
1668
1653
1669 $ hg up "desc(A0)" --hidden
1654 $ hg up "desc(A0)" --hidden
1670 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1655 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1671 $ hg tlog
1656 $ hg tlog
1672 @ 471f378eab4c
1657 @ 471f378eab4c
1673 |
1658 |
1674 o ea207398892e
1659 o ea207398892e
1675
1660
1676 # todo: the obsfate output is not ideal
1661 # todo: the obsfate output is not ideal
1677 $ hg fatelog
1662 $ hg fatelog
1678 @ 471f378eab4c
1663 @ 471f378eab4c
1679 | Obsfate: pruned;
1664 | Obsfate: pruned;
1680 o ea207398892e
1665 o ea207398892e
1681
1666
1682 $ hg fatelog -v --hidden
1667 $ hg fatelog -v --hidden
1683 x 65b757b745b9
1668 x 65b757b745b9
1684 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1669 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1685 | x fdf9bde5129a
1670 | x fdf9bde5129a
1686 |/ Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1671 |/ Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1687 | @ 471f378eab4c
1672 | @ 471f378eab4c
1688 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
1673 |/ Obsfate: rewritten as 2:fdf9bde5129a by test (at 1970-01-01 00:00 +0000); rewritten as 3:65b757b745b9 by test (at 1970-01-01 00:00 +0000);
1689 o ea207398892e
1674 o ea207398892e
1690
1675
1691
1676
1692 Test templates with splitted and pruned commit
1677 Test templates with splitted and pruned commit
1693 ==============================================
1678 ==============================================
1694
1679
1695 $ hg init $TESTTMP/templates-local-split-prune
1680 $ hg init $TESTTMP/templates-local-split-prune
1696 $ cd $TESTTMP/templates-local-split-prune
1681 $ cd $TESTTMP/templates-local-split-prune
1697 $ mkcommit ROOT
1682 $ mkcommit ROOT
1698 $ echo 42 >> a
1683 $ echo 42 >> a
1699 $ echo 43 >> b
1684 $ echo 43 >> b
1700 $ hg commit -A -m "A0"
1685 $ hg commit -A -m "A0"
1701 adding a
1686 adding a
1702 adding b
1687 adding b
1703 $ hg log --hidden -G
1688 $ hg log --hidden -G
1704 @ changeset: 1:471597cad322
1689 @ changeset: 1:471597cad322
1705 | tag: tip
1690 | tag: tip
1706 | user: test
1691 | user: test
1707 | date: Thu Jan 01 00:00:00 1970 +0000
1692 | date: Thu Jan 01 00:00:00 1970 +0000
1708 | summary: A0
1693 | summary: A0
1709 |
1694 |
1710 o changeset: 0:ea207398892e
1695 o changeset: 0:ea207398892e
1711 user: test
1696 user: test
1712 date: Thu Jan 01 00:00:00 1970 +0000
1697 date: Thu Jan 01 00:00:00 1970 +0000
1713 summary: ROOT
1698 summary: ROOT
1714
1699
1715 # Simulate split
1700 # Simulate split
1716 $ hg up -r "desc(ROOT)"
1701 $ hg up -r "desc(ROOT)"
1717 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1702 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1718 $ echo 42 >> a
1703 $ echo 42 >> a
1719 $ hg commit -A -m "A1"
1704 $ hg commit -A -m "A1"
1720 adding a
1705 adding a
1721 created new head
1706 created new head
1722 $ echo 43 >> b
1707 $ echo 43 >> b
1723 $ hg commit -A -m "A2"
1708 $ hg commit -A -m "A2"
1724 adding b
1709 adding b
1725 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
1710 $ hg debugobsolete `getid "1"` `getid "2"` `getid "3"`
1726 obsoleted 1 changesets
1711 obsoleted 1 changesets
1727
1712
1728 # Simulate prune
1713 # Simulate prune
1729 $ hg debugobsolete --record-parent `getid "."`
1714 $ hg debugobsolete --record-parent `getid "."`
1730 obsoleted 1 changesets
1715 obsoleted 1 changesets
1731
1716
1732 $ hg log --hidden -G
1717 $ hg log --hidden -G
1733 @ changeset: 3:0d0ef4bdf70e
1718 @ changeset: 3:0d0ef4bdf70e
1734 | tag: tip
1719 | tag: tip
1735 | user: test
1720 | user: test
1736 | date: Thu Jan 01 00:00:00 1970 +0000
1721 | date: Thu Jan 01 00:00:00 1970 +0000
1737 | summary: A2
1722 | summary: A2
1738 |
1723 |
1739 o changeset: 2:617adc3a144c
1724 o changeset: 2:617adc3a144c
1740 | parent: 0:ea207398892e
1725 | parent: 0:ea207398892e
1741 | user: test
1726 | user: test
1742 | date: Thu Jan 01 00:00:00 1970 +0000
1727 | date: Thu Jan 01 00:00:00 1970 +0000
1743 | summary: A1
1728 | summary: A1
1744 |
1729 |
1745 | x changeset: 1:471597cad322
1730 | x changeset: 1:471597cad322
1746 |/ user: test
1731 |/ user: test
1747 | date: Thu Jan 01 00:00:00 1970 +0000
1732 | date: Thu Jan 01 00:00:00 1970 +0000
1748 | summary: A0
1733 | summary: A0
1749 |
1734 |
1750 o changeset: 0:ea207398892e
1735 o changeset: 0:ea207398892e
1751 user: test
1736 user: test
1752 date: Thu Jan 01 00:00:00 1970 +0000
1737 date: Thu Jan 01 00:00:00 1970 +0000
1753 summary: ROOT
1738 summary: ROOT
1754
1739
1755 Check templates
1740 Check templates
1756 ---------------
1741 ---------------
1757
1742
1758 $ hg up 'desc("A0")' --hidden
1743 $ hg up 'desc("A0")' --hidden
1759 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1744 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1760
1745
1761 # todo: the obsfate output is not ideal
1746 # todo: the obsfate output is not ideal
1762 $ hg fatelog
1747 $ hg fatelog
1763 o 617adc3a144c
1748 o 617adc3a144c
1764 |
1749 |
1765 | @ 471597cad322
1750 | @ 471597cad322
1766 |/ Obsfate: pruned;
1751 |/ Obsfate: pruned;
1767 o ea207398892e
1752 o ea207398892e
1768
1753
1769 $ hg up -r 'desc("A2")' --hidden
1754 $ hg up -r 'desc("A2")' --hidden
1770 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1755 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1771
1756
1772 $ hg fatelog --hidden
1757 $ hg fatelog --hidden
1773 @ 0d0ef4bdf70e
1758 @ 0d0ef4bdf70e
1774 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1759 | Obsfate: pruned by test (at 1970-01-01 00:00 +0000);
1775 o 617adc3a144c
1760 o 617adc3a144c
1776 |
1761 |
1777 | x 471597cad322
1762 | x 471597cad322
1778 |/ Obsfate: split as 2:617adc3a144c, 3:0d0ef4bdf70e by test (at 1970-01-01 00:00 +0000);
1763 |/ Obsfate: split as 2:617adc3a144c, 3:0d0ef4bdf70e by test (at 1970-01-01 00:00 +0000);
1779 o ea207398892e
1764 o ea207398892e
1780
1765
@@ -1,1513 +1,1501 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [phases]
2 > [phases]
3 > # public changeset are not obsolete
3 > # public changeset are not obsolete
4 > publish=false
4 > publish=false
5 > [ui]
5 > [ui]
6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n"
6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n"
7 > EOF
7 > EOF
8 $ mkcommit() {
8 $ mkcommit() {
9 > echo "$1" > "$1"
9 > echo "$1" > "$1"
10 > hg add "$1"
10 > hg add "$1"
11 > hg ci -m "add $1"
11 > hg ci -m "add $1"
12 > }
12 > }
13 $ getid() {
13 $ getid() {
14 > hg log -T "{node}\n" --hidden -r "desc('$1')"
14 > hg log -T "{node}\n" --hidden -r "desc('$1')"
15 > }
15 > }
16
16
17 $ cat > debugkeys.py <<EOF
17 $ cat > debugkeys.py <<EOF
18 > def reposetup(ui, repo):
18 > def reposetup(ui, repo):
19 > class debugkeysrepo(repo.__class__):
19 > class debugkeysrepo(repo.__class__):
20 > def listkeys(self, namespace):
20 > def listkeys(self, namespace):
21 > ui.write('listkeys %s\n' % (namespace,))
21 > ui.write('listkeys %s\n' % (namespace,))
22 > return super(debugkeysrepo, self).listkeys(namespace)
22 > return super(debugkeysrepo, self).listkeys(namespace)
23 >
23 >
24 > if repo.local():
24 > if repo.local():
25 > repo.__class__ = debugkeysrepo
25 > repo.__class__ = debugkeysrepo
26 > EOF
26 > EOF
27
27
28 $ hg init tmpa
28 $ hg init tmpa
29 $ cd tmpa
29 $ cd tmpa
30 $ mkcommit kill_me
30 $ mkcommit kill_me
31
31
32 Checking that the feature is properly disabled
32 Checking that the feature is properly disabled
33
33
34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 abort: creating obsolete markers is not enabled on this repo
35 abort: creating obsolete markers is not enabled on this repo
36 [255]
36 [255]
37
37
38 Enabling it
38 Enabling it
39
39
40 $ cat >> $HGRCPATH << EOF
40 $ cat >> $HGRCPATH << EOF
41 > [experimental]
41 > [experimental]
42 > stabilization=createmarkers,exchange
42 > stabilization=createmarkers,exchange
43 > EOF
43 > EOF
44
44
45 Killing a single changeset without replacement
45 Killing a single changeset without replacement
46
46
47 $ hg debugobsolete 0
47 $ hg debugobsolete 0
48 abort: changeset references must be full hexadecimal node identifiers
48 abort: changeset references must be full hexadecimal node identifiers
49 [255]
49 [255]
50 $ hg debugobsolete '00'
50 $ hg debugobsolete '00'
51 abort: changeset references must be full hexadecimal node identifiers
51 abort: changeset references must be full hexadecimal node identifiers
52 [255]
52 [255]
53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
54 obsoleted 1 changesets
54 obsoleted 1 changesets
55 $ hg debugobsolete
55 $ hg debugobsolete
56 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'babar'}
56 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'babar'}
57
57
58 (test that mercurial is not confused)
58 (test that mercurial is not confused)
59
59
60 $ hg up null --quiet # having 0 as parent prevents it to be hidden
60 $ hg up null --quiet # having 0 as parent prevents it to be hidden
61 $ hg tip
61 $ hg tip
62 -1:000000000000 (public) [tip ]
62 -1:000000000000 (public) [tip ]
63 $ hg up --hidden tip --quiet
63 $ hg up --hidden tip --quiet
64
64
65 Killing a single changeset with itself should fail
65 Killing a single changeset with itself should fail
66 (simple local safeguard)
66 (simple local safeguard)
67
67
68 $ hg debugobsolete `getid kill_me` `getid kill_me`
68 $ hg debugobsolete `getid kill_me` `getid kill_me`
69 abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
69 abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
70 [255]
70 [255]
71
71
72 $ cd ..
72 $ cd ..
73
73
74 Killing a single changeset with replacement
74 Killing a single changeset with replacement
75 (and testing the format option)
75 (and testing the format option)
76
76
77 $ hg init tmpb
77 $ hg init tmpb
78 $ cd tmpb
78 $ cd tmpb
79 $ mkcommit a
79 $ mkcommit a
80 $ mkcommit b
80 $ mkcommit b
81 $ mkcommit original_c
81 $ mkcommit original_c
82 $ hg up "desc('b')"
82 $ hg up "desc('b')"
83 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
83 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
84 $ mkcommit new_c
84 $ mkcommit new_c
85 created new head
85 created new head
86 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
86 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
87 $ hg debugobsolete --config format.obsstore-version=0 --flag 12 `getid original_c` `getid new_c` -d '121 120'
87 $ hg debugobsolete --config format.obsstore-version=0 --flag 12 `getid original_c` `getid new_c` -d '121 120'
88 obsoleted 1 changesets
88 obsoleted 1 changesets
89 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
89 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
90 2:245bde4270cd add original_c
90 2:245bde4270cd add original_c
91 $ hg debugrevlog -cd
91 $ hg debugrevlog -cd
92 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
92 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
93 0 -1 -1 0 59 0 0 0 0 58 58 0 1 0
93 0 -1 -1 0 59 0 0 0 0 58 58 0 1 0
94 1 0 -1 59 118 59 59 0 0 58 116 0 1 0
94 1 0 -1 59 118 59 59 0 0 58 116 0 1 0
95 2 1 -1 118 193 118 118 59 0 76 192 0 1 0
95 2 1 -1 118 193 118 118 59 0 76 192 0 1 0
96 3 1 -1 193 260 193 193 59 0 66 258 0 2 0
96 3 1 -1 193 260 193 193 59 0 66 258 0 2 0
97 $ hg debugobsolete
97 $ hg debugobsolete
98 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
98 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
99
99
100 (check for version number of the obsstore)
100 (check for version number of the obsstore)
101
101
102 $ dd bs=1 count=1 if=.hg/store/obsstore 2>/dev/null
102 $ dd bs=1 count=1 if=.hg/store/obsstore 2>/dev/null
103 \x00 (no-eol) (esc)
103 \x00 (no-eol) (esc)
104
104
105 do it again (it read the obsstore before adding new changeset)
105 do it again (it read the obsstore before adding new changeset)
106
106
107 $ hg up '.^'
107 $ hg up '.^'
108 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
108 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
109 $ mkcommit new_2_c
109 $ mkcommit new_2_c
110 created new head
110 created new head
111 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
111 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
112 obsoleted 1 changesets
112 obsoleted 1 changesets
113 $ hg debugobsolete
113 $ hg debugobsolete
114 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
114 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
115 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
115 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
116
116
117 Register two markers with a missing node
117 Register two markers with a missing node
118
118
119 $ hg up '.^'
119 $ hg up '.^'
120 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
120 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 $ mkcommit new_3_c
121 $ mkcommit new_3_c
122 created new head
122 created new head
123 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
123 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
124 obsoleted 1 changesets
124 obsoleted 1 changesets
125 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
125 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
126 $ hg debugobsolete
126 $ hg debugobsolete
127 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
127 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
128 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
128 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
129 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
129 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
130 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
130 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
131
131
132 Test the --index option of debugobsolete command
132 Test the --index option of debugobsolete command
133 $ hg debugobsolete --index
133 $ hg debugobsolete --index
134 0 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
134 0 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
135 1 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
135 1 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
136 2 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
136 2 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
137 3 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
137 3 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
138
138
139 Refuse pathological nullid successors
139 Refuse pathological nullid successors
140 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
140 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
141 transaction abort!
141 transaction abort!
142 rollback completed
142 rollback completed
143 abort: bad obsolescence marker detected: invalid successors nullid
143 abort: bad obsolescence marker detected: invalid successors nullid
144 [255]
144 [255]
145
145
146 Check that graphlog detect that a changeset is obsolete:
146 Check that graphlog detect that a changeset is obsolete:
147
147
148 $ hg log -G
148 $ hg log -G
149 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
149 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
150 |
150 |
151 o 1:7c3bad9141dc (draft) [ ] add b
151 o 1:7c3bad9141dc (draft) [ ] add b
152 |
152 |
153 o 0:1f0dee641bb7 (draft) [ ] add a
153 o 0:1f0dee641bb7 (draft) [ ] add a
154
154
155
155
156 check that heads does not report them
156 check that heads does not report them
157
157
158 $ hg heads
158 $ hg heads
159 5:5601fb93a350 (draft) [tip ] add new_3_c
159 5:5601fb93a350 (draft) [tip ] add new_3_c
160 $ hg heads --hidden
160 $ hg heads --hidden
161 5:5601fb93a350 (draft) [tip ] add new_3_c
161 5:5601fb93a350 (draft) [tip ] add new_3_c
162 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
162 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
163 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
163 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
164 2:245bde4270cd (draft *obsolete*) [ ] add original_c
164 2:245bde4270cd (draft *obsolete*) [ ] add original_c
165
165
166
166
167 check that summary does not report them
167 check that summary does not report them
168
168
169 $ hg init ../sink
169 $ hg init ../sink
170 $ echo '[paths]' >> .hg/hgrc
170 $ echo '[paths]' >> .hg/hgrc
171 $ echo 'default=../sink' >> .hg/hgrc
171 $ echo 'default=../sink' >> .hg/hgrc
172 $ hg summary --remote
172 $ hg summary --remote
173 parent: 5:5601fb93a350 tip
173 parent: 5:5601fb93a350 tip
174 add new_3_c
174 add new_3_c
175 branch: default
175 branch: default
176 commit: (clean)
176 commit: (clean)
177 update: (current)
177 update: (current)
178 phases: 3 draft
178 phases: 3 draft
179 remote: 3 outgoing
179 remote: 3 outgoing
180
180
181 $ hg summary --remote --hidden
181 $ hg summary --remote --hidden
182 parent: 5:5601fb93a350 tip
182 parent: 5:5601fb93a350 tip
183 add new_3_c
183 add new_3_c
184 branch: default
184 branch: default
185 commit: (clean)
185 commit: (clean)
186 update: 3 new changesets, 4 branch heads (merge)
186 update: 3 new changesets, 4 branch heads (merge)
187 phases: 6 draft
187 phases: 6 draft
188 remote: 3 outgoing
188 remote: 3 outgoing
189
189
190 check that various commands work well with filtering
190 check that various commands work well with filtering
191
191
192 $ hg tip
192 $ hg tip
193 5:5601fb93a350 (draft) [tip ] add new_3_c
193 5:5601fb93a350 (draft) [tip ] add new_3_c
194 $ hg log -r 6
194 $ hg log -r 6
195 abort: unknown revision '6'!
195 abort: unknown revision '6'!
196 [255]
196 [255]
197 $ hg log -r 4
197 $ hg log -r 4
198 abort: hidden revision '4'!
198 abort: hidden revision '4'!
199 (use --hidden to access hidden revisions)
199 (use --hidden to access hidden revisions)
200 [255]
200 [255]
201 $ hg debugrevspec 'rev(6)'
201 $ hg debugrevspec 'rev(6)'
202 $ hg debugrevspec 'rev(4)'
202 $ hg debugrevspec 'rev(4)'
203 $ hg debugrevspec 'null'
203 $ hg debugrevspec 'null'
204 -1
204 -1
205
205
206 Check that public changeset are not accounted as obsolete:
206 Check that public changeset are not accounted as obsolete:
207
207
208 $ hg --hidden phase --public 2
208 $ hg --hidden phase --public 2
209 $ hg log -G
209 $ hg log -G
210 @ 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
210 @ 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
211 |
211 |
212 | o 2:245bde4270cd (public) [ ] add original_c
212 | o 2:245bde4270cd (public) [ ] add original_c
213 |/
213 |/
214 o 1:7c3bad9141dc (public) [ ] add b
214 o 1:7c3bad9141dc (public) [ ] add b
215 |
215 |
216 o 0:1f0dee641bb7 (public) [ ] add a
216 o 0:1f0dee641bb7 (public) [ ] add a
217
217
218
218
219 And that bumped changeset are detected
219 And that bumped changeset are detected
220 --------------------------------------
220 --------------------------------------
221
221
222 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
222 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
223 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
223 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
224 the public changeset
224 the public changeset
225
225
226 $ hg log --hidden -r 'phasedivergent()'
226 $ hg log --hidden -r 'phasedivergent()'
227 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
227 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
228
228
229 And that we can't push bumped changeset
229 And that we can't push bumped changeset
230
230
231 $ hg push ../tmpa -r 0 --force #(make repo related)
231 $ hg push ../tmpa -r 0 --force #(make repo related)
232 pushing to ../tmpa
232 pushing to ../tmpa
233 searching for changes
233 searching for changes
234 warning: repository is unrelated
234 warning: repository is unrelated
235 adding changesets
235 adding changesets
236 adding manifests
236 adding manifests
237 adding file changes
237 adding file changes
238 added 1 changesets with 1 changes to 1 files (+1 heads)
238 added 1 changesets with 1 changes to 1 files (+1 heads)
239 $ hg push ../tmpa
239 $ hg push ../tmpa
240 pushing to ../tmpa
240 pushing to ../tmpa
241 searching for changes
241 searching for changes
242 abort: push includes phase-divergent changeset: 5601fb93a350!
242 abort: push includes phase-divergent changeset: 5601fb93a350!
243 [255]
243 [255]
244
244
245 Fixing "bumped" situation
245 Fixing "bumped" situation
246 We need to create a clone of 5 and add a special marker with a flag
246 We need to create a clone of 5 and add a special marker with a flag
247
247
248 $ hg summary
248 $ hg summary
249 parent: 5:5601fb93a350 tip (phase-divergent)
249 parent: 5:5601fb93a350 tip (phase-divergent)
250 add new_3_c
250 add new_3_c
251 branch: default
251 branch: default
252 commit: (clean)
252 commit: (clean)
253 update: 1 new changesets, 2 branch heads (merge)
253 update: 1 new changesets, 2 branch heads (merge)
254 phases: 1 draft
254 phases: 1 draft
255 phase-divergent: 1 changesets
255 phase-divergent: 1 changesets
256 $ hg up '5^'
256 $ hg up '5^'
257 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
257 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
258 $ hg revert -ar 5
258 $ hg revert -ar 5
259 adding new_3_c
259 adding new_3_c
260 $ hg ci -m 'add n3w_3_c'
260 $ hg ci -m 'add n3w_3_c'
261 created new head
261 created new head
262 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
262 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
263 obsoleted 1 changesets
263 obsoleted 1 changesets
264 $ hg log -r 'phasedivergent()'
264 $ hg log -r 'phasedivergent()'
265 $ hg log -G
265 $ hg log -G
266 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
266 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
267 |
267 |
268 | o 2:245bde4270cd (public) [ ] add original_c
268 | o 2:245bde4270cd (public) [ ] add original_c
269 |/
269 |/
270 o 1:7c3bad9141dc (public) [ ] add b
270 o 1:7c3bad9141dc (public) [ ] add b
271 |
271 |
272 o 0:1f0dee641bb7 (public) [ ] add a
272 o 0:1f0dee641bb7 (public) [ ] add a
273
273
274
274
275 Basic exclusive testing
275 Basic exclusive testing
276
276
277 $ hg log -G --hidden
277 $ hg log -G --hidden
278 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
278 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
279 |
279 |
280 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
280 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
281 |/
281 |/
282 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
282 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
283 |/
283 |/
284 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
284 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
285 |/
285 |/
286 | o 2:245bde4270cd (public) [ ] add original_c
286 | o 2:245bde4270cd (public) [ ] add original_c
287 |/
287 |/
288 o 1:7c3bad9141dc (public) [ ] add b
288 o 1:7c3bad9141dc (public) [ ] add b
289 |
289 |
290 o 0:1f0dee641bb7 (public) [ ] add a
290 o 0:1f0dee641bb7 (public) [ ] add a
291
291
292 $ hg debugobsolete --rev 6f9641995072
292 $ hg debugobsolete --rev 6f9641995072
293 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
293 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
294 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
294 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
295 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
295 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
296 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
296 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
297 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
297 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
298 $ hg debugobsolete --rev 6f9641995072 --exclusive
298 $ hg debugobsolete --rev 6f9641995072 --exclusive
299 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
299 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
300 $ hg debugobsolete --rev 5601fb93a350 --hidden
300 $ hg debugobsolete --rev 5601fb93a350 --hidden
301 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
301 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
302 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
302 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
303 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
303 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
304 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
304 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
305 $ hg debugobsolete --rev 5601fb93a350 --hidden --exclusive
305 $ hg debugobsolete --rev 5601fb93a350 --hidden --exclusive
306 $ hg debugobsolete --rev 5601fb93a350+6f9641995072 --hidden --exclusive
306 $ hg debugobsolete --rev 5601fb93a350+6f9641995072 --hidden --exclusive
307 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
307 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
308 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
308 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
309 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
309 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
310
310
311 $ cd ..
311 $ cd ..
312
312
313 Revision 0 is hidden
313 Revision 0 is hidden
314 --------------------
314 --------------------
315
315
316 $ hg init rev0hidden
316 $ hg init rev0hidden
317 $ cd rev0hidden
317 $ cd rev0hidden
318
318
319 $ mkcommit kill0
319 $ mkcommit kill0
320 $ hg up -q null
320 $ hg up -q null
321 $ hg debugobsolete `getid kill0`
321 $ hg debugobsolete `getid kill0`
322 obsoleted 1 changesets
322 obsoleted 1 changesets
323 $ mkcommit a
323 $ mkcommit a
324 $ mkcommit b
324 $ mkcommit b
325
325
326 Should pick the first visible revision as "repo" node
326 Should pick the first visible revision as "repo" node
327
327
328 $ hg archive ../archive-null
328 $ hg archive ../archive-null
329 $ cat ../archive-null/.hg_archival.txt
329 $ cat ../archive-null/.hg_archival.txt
330 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
330 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
331 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
331 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
332 branch: default
332 branch: default
333 latesttag: null
333 latesttag: null
334 latesttagdistance: 2
334 latesttagdistance: 2
335 changessincelatesttag: 2
335 changessincelatesttag: 2
336
336
337
337
338 $ cd ..
338 $ cd ..
339
339
340 Exchange Test
340 Exchange Test
341 ============================
341 ============================
342
342
343 Destination repo does not have any data
343 Destination repo does not have any data
344 ---------------------------------------
344 ---------------------------------------
345
345
346 Simple incoming test
346 Simple incoming test
347
347
348 $ hg init tmpc
348 $ hg init tmpc
349 $ cd tmpc
349 $ cd tmpc
350 $ hg incoming ../tmpb
350 $ hg incoming ../tmpb
351 comparing with ../tmpb
351 comparing with ../tmpb
352 0:1f0dee641bb7 (public) [ ] add a
352 0:1f0dee641bb7 (public) [ ] add a
353 1:7c3bad9141dc (public) [ ] add b
353 1:7c3bad9141dc (public) [ ] add b
354 2:245bde4270cd (public) [ ] add original_c
354 2:245bde4270cd (public) [ ] add original_c
355 6:6f9641995072 (draft) [tip ] add n3w_3_c
355 6:6f9641995072 (draft) [tip ] add n3w_3_c
356
356
357 Try to pull markers
357 Try to pull markers
358 (extinct changeset are excluded but marker are pushed)
358 (extinct changeset are excluded but marker are pushed)
359
359
360 $ hg pull ../tmpb
360 $ hg pull ../tmpb
361 pulling from ../tmpb
361 pulling from ../tmpb
362 requesting all changes
362 requesting all changes
363 adding changesets
363 adding changesets
364 adding manifests
364 adding manifests
365 adding file changes
365 adding file changes
366 added 4 changesets with 4 changes to 4 files (+1 heads)
366 added 4 changesets with 4 changes to 4 files (+1 heads)
367 5 new obsolescence markers
367 5 new obsolescence markers
368 (run 'hg heads' to see heads, 'hg merge' to merge)
368 (run 'hg heads' to see heads, 'hg merge' to merge)
369 $ hg debugobsolete
369 $ hg debugobsolete
370 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
370 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
371 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
371 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
372 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
372 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
373 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
373 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
374 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
374 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
375
375
376 Rollback//Transaction support
376 Rollback//Transaction support
377
377
378 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
378 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
379 $ hg debugobsolete
379 $ hg debugobsolete
380 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
380 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
381 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
381 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
382 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
382 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
383 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
383 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
384 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
384 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
385 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
385 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
386 $ hg rollback -n
386 $ hg rollback -n
387 repository tip rolled back to revision 3 (undo debugobsolete)
387 repository tip rolled back to revision 3 (undo debugobsolete)
388 $ hg rollback
388 $ hg rollback
389 repository tip rolled back to revision 3 (undo debugobsolete)
389 repository tip rolled back to revision 3 (undo debugobsolete)
390 $ hg debugobsolete
390 $ hg debugobsolete
391 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
391 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
392 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
392 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
393 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
393 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
394 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
394 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
395 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
395 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
396
396
397 $ cd ..
397 $ cd ..
398
398
399 Try to push markers
399 Try to push markers
400
400
401 $ hg init tmpd
401 $ hg init tmpd
402 $ hg -R tmpb push tmpd
402 $ hg -R tmpb push tmpd
403 pushing to tmpd
403 pushing to tmpd
404 searching for changes
404 searching for changes
405 adding changesets
405 adding changesets
406 adding manifests
406 adding manifests
407 adding file changes
407 adding file changes
408 added 4 changesets with 4 changes to 4 files (+1 heads)
408 added 4 changesets with 4 changes to 4 files (+1 heads)
409 5 new obsolescence markers
409 5 new obsolescence markers
410 $ hg -R tmpd debugobsolete | sort
410 $ hg -R tmpd debugobsolete | sort
411 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
411 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
412 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
412 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
413 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
413 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
414 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
414 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
415 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
415 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
416
416
417 Check obsolete keys are exchanged only if source has an obsolete store
417 Check obsolete keys are exchanged only if source has an obsolete store
418
418
419 $ hg init empty
419 $ hg init empty
420 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
420 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
421 pushing to tmpd
421 pushing to tmpd
422 listkeys phases
422 listkeys phases
423 listkeys bookmarks
423 listkeys bookmarks
424 no changes found
424 no changes found
425 listkeys phases
425 listkeys phases
426 [1]
426 [1]
427
427
428 clone support
428 clone support
429 (markers are copied and extinct changesets are included to allow hardlinks)
429 (markers are copied and extinct changesets are included to allow hardlinks)
430
430
431 $ hg clone tmpb clone-dest
431 $ hg clone tmpb clone-dest
432 updating to branch default
432 updating to branch default
433 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
433 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
434 $ hg -R clone-dest log -G --hidden
434 $ hg -R clone-dest log -G --hidden
435 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
435 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
436 |
436 |
437 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
437 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
438 |/
438 |/
439 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
439 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
440 |/
440 |/
441 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
441 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
442 |/
442 |/
443 | o 2:245bde4270cd (public) [ ] add original_c
443 | o 2:245bde4270cd (public) [ ] add original_c
444 |/
444 |/
445 o 1:7c3bad9141dc (public) [ ] add b
445 o 1:7c3bad9141dc (public) [ ] add b
446 |
446 |
447 o 0:1f0dee641bb7 (public) [ ] add a
447 o 0:1f0dee641bb7 (public) [ ] add a
448
448
449 $ hg -R clone-dest debugobsolete
449 $ hg -R clone-dest debugobsolete
450 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
450 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
451 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
451 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
452 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
452 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
453 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
453 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
454 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
454 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
455
455
456
456
457 Destination repo have existing data
457 Destination repo have existing data
458 ---------------------------------------
458 ---------------------------------------
459
459
460 On pull
460 On pull
461
461
462 $ hg init tmpe
462 $ hg init tmpe
463 $ cd tmpe
463 $ cd tmpe
464 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
464 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
465 $ hg pull ../tmpb
465 $ hg pull ../tmpb
466 pulling from ../tmpb
466 pulling from ../tmpb
467 requesting all changes
467 requesting all changes
468 adding changesets
468 adding changesets
469 adding manifests
469 adding manifests
470 adding file changes
470 adding file changes
471 added 4 changesets with 4 changes to 4 files (+1 heads)
471 added 4 changesets with 4 changes to 4 files (+1 heads)
472 5 new obsolescence markers
472 5 new obsolescence markers
473 (run 'hg heads' to see heads, 'hg merge' to merge)
473 (run 'hg heads' to see heads, 'hg merge' to merge)
474 $ hg debugobsolete
474 $ hg debugobsolete
475 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
475 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
476 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
476 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
477 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
477 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
478 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
478 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
479 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
479 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
480 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
480 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
481
481
482
482
483 On push
483 On push
484
484
485 $ hg push ../tmpc
485 $ hg push ../tmpc
486 pushing to ../tmpc
486 pushing to ../tmpc
487 searching for changes
487 searching for changes
488 no changes found
488 no changes found
489 1 new obsolescence markers
489 1 new obsolescence markers
490 [1]
490 [1]
491 $ hg -R ../tmpc debugobsolete
491 $ hg -R ../tmpc debugobsolete
492 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
492 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
493 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
493 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
494 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
494 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
495 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
495 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
496 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
496 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
497 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
497 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
498
498
499 detect outgoing obsolete and unstable
499 detect outgoing obsolete and unstable
500 ---------------------------------------
500 ---------------------------------------
501
501
502
502
503 $ hg log -G
503 $ hg log -G
504 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
504 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
505 |
505 |
506 | o 2:245bde4270cd (public) [ ] add original_c
506 | o 2:245bde4270cd (public) [ ] add original_c
507 |/
507 |/
508 o 1:7c3bad9141dc (public) [ ] add b
508 o 1:7c3bad9141dc (public) [ ] add b
509 |
509 |
510 o 0:1f0dee641bb7 (public) [ ] add a
510 o 0:1f0dee641bb7 (public) [ ] add a
511
511
512 $ hg up 'desc("n3w_3_c")'
512 $ hg up 'desc("n3w_3_c")'
513 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
513 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
514 $ mkcommit original_d
514 $ mkcommit original_d
515 $ mkcommit original_e
515 $ mkcommit original_e
516 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
516 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
517 obsoleted 1 changesets
517 obsoleted 1 changesets
518 $ hg debugobsolete | grep `getid original_d`
518 $ hg debugobsolete | grep `getid original_d`
519 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
519 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
520 $ hg log -r 'obsolete()'
520 $ hg log -r 'obsolete()'
521 4:94b33453f93b (draft *obsolete*) [ ] add original_d
521 4:94b33453f93b (draft *obsolete*) [ ] add original_d
522 $ hg summary
522 $ hg summary
523 parent: 5:cda648ca50f5 tip (orphan)
523 parent: 5:cda648ca50f5 tip (orphan)
524 add original_e
524 add original_e
525 branch: default
525 branch: default
526 commit: (clean)
526 commit: (clean)
527 update: 1 new changesets, 2 branch heads (merge)
527 update: 1 new changesets, 2 branch heads (merge)
528 phases: 3 draft
528 phases: 3 draft
529 orphan: 1 changesets
529 orphan: 1 changesets
530 $ hg log -G -r '::orphan()'
530 $ hg log -G -r '::orphan()'
531 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
531 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
532 |
532 |
533 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
533 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
534 |
534 |
535 o 3:6f9641995072 (draft) [ ] add n3w_3_c
535 o 3:6f9641995072 (draft) [ ] add n3w_3_c
536 |
536 |
537 o 1:7c3bad9141dc (public) [ ] add b
537 o 1:7c3bad9141dc (public) [ ] add b
538 |
538 |
539 o 0:1f0dee641bb7 (public) [ ] add a
539 o 0:1f0dee641bb7 (public) [ ] add a
540
540
541
541
542 refuse to push obsolete changeset
542 refuse to push obsolete changeset
543
543
544 $ hg push ../tmpc/ -r 'desc("original_d")'
544 $ hg push ../tmpc/ -r 'desc("original_d")'
545 pushing to ../tmpc/
545 pushing to ../tmpc/
546 searching for changes
546 searching for changes
547 abort: push includes obsolete changeset: 94b33453f93b!
547 abort: push includes obsolete changeset: 94b33453f93b!
548 [255]
548 [255]
549
549
550 refuse to push unstable changeset
550 refuse to push unstable changeset
551
551
552 $ hg push ../tmpc/
552 $ hg push ../tmpc/
553 pushing to ../tmpc/
553 pushing to ../tmpc/
554 searching for changes
554 searching for changes
555 abort: push includes orphan changeset: cda648ca50f5!
555 abort: push includes orphan changeset: cda648ca50f5!
556 [255]
556 [255]
557
557
558 Test that extinct changeset are properly detected
558 Test that extinct changeset are properly detected
559
559
560 $ hg log -r 'extinct()'
560 $ hg log -r 'extinct()'
561
561
562 Don't try to push extinct changeset
562 Don't try to push extinct changeset
563
563
564 $ hg init ../tmpf
564 $ hg init ../tmpf
565 $ hg out ../tmpf
565 $ hg out ../tmpf
566 comparing with ../tmpf
566 comparing with ../tmpf
567 searching for changes
567 searching for changes
568 0:1f0dee641bb7 (public) [ ] add a
568 0:1f0dee641bb7 (public) [ ] add a
569 1:7c3bad9141dc (public) [ ] add b
569 1:7c3bad9141dc (public) [ ] add b
570 2:245bde4270cd (public) [ ] add original_c
570 2:245bde4270cd (public) [ ] add original_c
571 3:6f9641995072 (draft) [ ] add n3w_3_c
571 3:6f9641995072 (draft) [ ] add n3w_3_c
572 4:94b33453f93b (draft *obsolete*) [ ] add original_d
572 4:94b33453f93b (draft *obsolete*) [ ] add original_d
573 5:cda648ca50f5 (draft orphan) [tip ] add original_e
573 5:cda648ca50f5 (draft orphan) [tip ] add original_e
574 $ hg push ../tmpf -f # -f because be push unstable too
574 $ hg push ../tmpf -f # -f because be push unstable too
575 pushing to ../tmpf
575 pushing to ../tmpf
576 searching for changes
576 searching for changes
577 adding changesets
577 adding changesets
578 adding manifests
578 adding manifests
579 adding file changes
579 adding file changes
580 added 6 changesets with 6 changes to 6 files (+1 heads)
580 added 6 changesets with 6 changes to 6 files (+1 heads)
581 7 new obsolescence markers
581 7 new obsolescence markers
582
582
583 no warning displayed
583 no warning displayed
584
584
585 $ hg push ../tmpf
585 $ hg push ../tmpf
586 pushing to ../tmpf
586 pushing to ../tmpf
587 searching for changes
587 searching for changes
588 no changes found
588 no changes found
589 [1]
589 [1]
590
590
591 Do not warn about new head when the new head is a successors of a remote one
591 Do not warn about new head when the new head is a successors of a remote one
592
592
593 $ hg log -G
593 $ hg log -G
594 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
594 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
595 |
595 |
596 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
596 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
597 |
597 |
598 o 3:6f9641995072 (draft) [ ] add n3w_3_c
598 o 3:6f9641995072 (draft) [ ] add n3w_3_c
599 |
599 |
600 | o 2:245bde4270cd (public) [ ] add original_c
600 | o 2:245bde4270cd (public) [ ] add original_c
601 |/
601 |/
602 o 1:7c3bad9141dc (public) [ ] add b
602 o 1:7c3bad9141dc (public) [ ] add b
603 |
603 |
604 o 0:1f0dee641bb7 (public) [ ] add a
604 o 0:1f0dee641bb7 (public) [ ] add a
605
605
606 $ hg up -q 'desc(n3w_3_c)'
606 $ hg up -q 'desc(n3w_3_c)'
607 $ mkcommit obsolete_e
607 $ mkcommit obsolete_e
608 created new head
608 created new head
609 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'` \
609 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'` \
610 > -u 'test <test@example.net>'
610 > -u 'test <test@example.net>'
611 obsoleted 1 changesets
611 obsoleted 1 changesets
612 $ hg outgoing ../tmpf # parasite hg outgoing testin
612 $ hg outgoing ../tmpf # parasite hg outgoing testin
613 comparing with ../tmpf
613 comparing with ../tmpf
614 searching for changes
614 searching for changes
615 6:3de5eca88c00 (draft) [tip ] add obsolete_e
615 6:3de5eca88c00 (draft) [tip ] add obsolete_e
616 $ hg push ../tmpf
616 $ hg push ../tmpf
617 pushing to ../tmpf
617 pushing to ../tmpf
618 searching for changes
618 searching for changes
619 adding changesets
619 adding changesets
620 adding manifests
620 adding manifests
621 adding file changes
621 adding file changes
622 added 1 changesets with 1 changes to 1 files (+1 heads)
622 added 1 changesets with 1 changes to 1 files (+1 heads)
623 1 new obsolescence markers
623 1 new obsolescence markers
624 obsoleted 1 changesets
624 obsoleted 1 changesets
625
625
626 test relevance computation
626 test relevance computation
627 ---------------------------------------
627 ---------------------------------------
628
628
629 Checking simple case of "marker relevance".
629 Checking simple case of "marker relevance".
630
630
631
631
632 Reminder of the repo situation
632 Reminder of the repo situation
633
633
634 $ hg log --hidden --graph
634 $ hg log --hidden --graph
635 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
635 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
636 |
636 |
637 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e
637 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e
638 | |
638 | |
639 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
639 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
640 |/
640 |/
641 o 3:6f9641995072 (draft) [ ] add n3w_3_c
641 o 3:6f9641995072 (draft) [ ] add n3w_3_c
642 |
642 |
643 | o 2:245bde4270cd (public) [ ] add original_c
643 | o 2:245bde4270cd (public) [ ] add original_c
644 |/
644 |/
645 o 1:7c3bad9141dc (public) [ ] add b
645 o 1:7c3bad9141dc (public) [ ] add b
646 |
646 |
647 o 0:1f0dee641bb7 (public) [ ] add a
647 o 0:1f0dee641bb7 (public) [ ] add a
648
648
649
649
650 List of all markers
650 List of all markers
651
651
652 $ hg debugobsolete
652 $ hg debugobsolete
653 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
653 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
654 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
654 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
655 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
655 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
656 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
656 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
657 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
657 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
658 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
658 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
659 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
659 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
660 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
660 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
661
661
662 List of changesets with no chain
662 List of changesets with no chain
663
663
664 $ hg debugobsolete --hidden --rev ::2
664 $ hg debugobsolete --hidden --rev ::2
665
665
666 List of changesets that are included on marker chain
666 List of changesets that are included on marker chain
667
667
668 $ hg debugobsolete --hidden --rev 6
668 $ hg debugobsolete --hidden --rev 6
669 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
669 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
670
670
671 List of changesets with a longer chain, (including a pruned children)
671 List of changesets with a longer chain, (including a pruned children)
672
672
673 $ hg debugobsolete --hidden --rev 3
673 $ hg debugobsolete --hidden --rev 3
674 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
674 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
675 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
675 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
676 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
676 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
677 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
677 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
678 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
678 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
679 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
679 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
680 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
680 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
681
681
682 List of both
682 List of both
683
683
684 $ hg debugobsolete --hidden --rev 3::6
684 $ hg debugobsolete --hidden --rev 3::6
685 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
685 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
686 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
686 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
687 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
687 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
688 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
688 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
689 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
689 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
690 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
690 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
691 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
691 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
692 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
692 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
693
693
694 List of all markers in JSON
694 List of all markers in JSON
695
695
696 $ hg debugobsolete -Tjson
696 $ hg debugobsolete -Tjson
697 [
697 [
698 {
698 {
699 "date": [1339.0, 0],
699 "date": [1339.0, 0],
700 "flag": 0,
700 "flag": 0,
701 "metadata": {"user": "test"},
701 "metadata": {"user": "test"},
702 "prednode": "1339133913391339133913391339133913391339",
702 "prednode": "1339133913391339133913391339133913391339",
703 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
703 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
704 },
704 },
705 {
705 {
706 "date": [1339.0, 0],
706 "date": [1339.0, 0],
707 "flag": 0,
707 "flag": 0,
708 "metadata": {"user": "test"},
708 "metadata": {"user": "test"},
709 "prednode": "1337133713371337133713371337133713371337",
709 "prednode": "1337133713371337133713371337133713371337",
710 "succnodes": ["5601fb93a350734d935195fee37f4054c529ff39"]
710 "succnodes": ["5601fb93a350734d935195fee37f4054c529ff39"]
711 },
711 },
712 {
712 {
713 "date": [121.0, 120],
713 "date": [121.0, 120],
714 "flag": 12,
714 "flag": 12,
715 "metadata": {"user": "test"},
715 "metadata": {"user": "test"},
716 "prednode": "245bde4270cd1072a27757984f9cda8ba26f08ca",
716 "prednode": "245bde4270cd1072a27757984f9cda8ba26f08ca",
717 "succnodes": ["cdbce2fbb16313928851e97e0d85413f3f7eb77f"]
717 "succnodes": ["cdbce2fbb16313928851e97e0d85413f3f7eb77f"]
718 },
718 },
719 {
719 {
720 "date": [1338.0, 0],
720 "date": [1338.0, 0],
721 "flag": 1,
721 "flag": 1,
722 "metadata": {"user": "test"},
722 "metadata": {"user": "test"},
723 "prednode": "5601fb93a350734d935195fee37f4054c529ff39",
723 "prednode": "5601fb93a350734d935195fee37f4054c529ff39",
724 "succnodes": ["6f96419950729f3671185b847352890f074f7557"]
724 "succnodes": ["6f96419950729f3671185b847352890f074f7557"]
725 },
725 },
726 {
726 {
727 "date": [1338.0, 0],
727 "date": [1338.0, 0],
728 "flag": 0,
728 "flag": 0,
729 "metadata": {"user": "test"},
729 "metadata": {"user": "test"},
730 "prednode": "ca819180edb99ed25ceafb3e9584ac287e240b00",
730 "prednode": "ca819180edb99ed25ceafb3e9584ac287e240b00",
731 "succnodes": ["1337133713371337133713371337133713371337"]
731 "succnodes": ["1337133713371337133713371337133713371337"]
732 },
732 },
733 {
733 {
734 "date": [1337.0, 0],
734 "date": [1337.0, 0],
735 "flag": 0,
735 "flag": 0,
736 "metadata": {"user": "test"},
736 "metadata": {"user": "test"},
737 "prednode": "cdbce2fbb16313928851e97e0d85413f3f7eb77f",
737 "prednode": "cdbce2fbb16313928851e97e0d85413f3f7eb77f",
738 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
738 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
739 },
739 },
740 {
740 {
741 "date": [0.0, 0],
741 "date": [0.0, 0],
742 "flag": 0,
742 "flag": 0,
743 "metadata": {"user": "test"},
743 "metadata": {"user": "test"},
744 "parentnodes": ["6f96419950729f3671185b847352890f074f7557"],
744 "parentnodes": ["6f96419950729f3671185b847352890f074f7557"],
745 "prednode": "94b33453f93bdb8d457ef9b770851a618bf413e1",
745 "prednode": "94b33453f93bdb8d457ef9b770851a618bf413e1",
746 "succnodes": []
746 "succnodes": []
747 },
747 },
748 {
748 {
749 "date": *, (glob)
749 "date": *, (glob)
750 "flag": 0,
750 "flag": 0,
751 "metadata": {"user": "test <test@example.net>"},
751 "metadata": {"user": "test <test@example.net>"},
752 "prednode": "cda648ca50f50482b7055c0b0c4c117bba6733d9",
752 "prednode": "cda648ca50f50482b7055c0b0c4c117bba6733d9",
753 "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"]
753 "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"]
754 }
754 }
755 ]
755 ]
756
756
757 Template keywords
757 Template keywords
758
758
759 $ hg debugobsolete -r6 -T '{succnodes % "{node|short}"} {date|shortdate}\n'
759 $ hg debugobsolete -r6 -T '{succnodes % "{node|short}"} {date|shortdate}\n'
760 3de5eca88c00 ????-??-?? (glob)
760 3de5eca88c00 ????-??-?? (glob)
761 $ hg debugobsolete -r6 -T '{join(metadata % "{key}={value}", " ")}\n'
761 $ hg debugobsolete -r6 -T '{join(metadata % "{key}={value}", " ")}\n'
762 user=test <test@example.net>
762 user=test <test@example.net>
763 $ hg debugobsolete -r6 -T '{metadata}\n'
763 $ hg debugobsolete -r6 -T '{metadata}\n'
764 'user': 'test <test@example.net>'
764 'user': 'test <test@example.net>'
765 $ hg debugobsolete -r6 -T '{flag} {get(metadata, "user")}\n'
765 $ hg debugobsolete -r6 -T '{flag} {get(metadata, "user")}\n'
766 0 test <test@example.net>
766 0 test <test@example.net>
767
767
768 Test the debug output for exchange
768 Test the debug output for exchange
769 ----------------------------------
769 ----------------------------------
770
770
771 $ hg pull ../tmpb --config 'experimental.obsmarkers-exchange-debug=True' # bundle2
771 $ hg pull ../tmpb --config 'experimental.obsmarkers-exchange-debug=True' # bundle2
772 pulling from ../tmpb
772 pulling from ../tmpb
773 searching for changes
773 searching for changes
774 no changes found
774 no changes found
775 obsmarker-exchange: 346 bytes received
775 obsmarker-exchange: 346 bytes received
776
776
777 check hgweb does not explode
777 check hgweb does not explode
778 ====================================
778 ====================================
779
779
780 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
780 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
781 adding changesets
781 adding changesets
782 adding manifests
782 adding manifests
783 adding file changes
783 adding file changes
784 added 62 changesets with 63 changes to 9 files (+60 heads)
784 added 62 changesets with 63 changes to 9 files (+60 heads)
785 (run 'hg heads .' to see heads, 'hg merge' to merge)
785 (run 'hg heads .' to see heads, 'hg merge' to merge)
786 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
786 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
787 > do
787 > do
788 > hg debugobsolete $node
788 > hg debugobsolete $node
789 > done
789 > done
790 obsoleted 1 changesets
790 obsoleted 1 changesets
791 obsoleted 1 changesets
791 obsoleted 1 changesets
792 obsoleted 1 changesets
792 obsoleted 1 changesets
793 obsoleted 1 changesets
793 obsoleted 1 changesets
794 obsoleted 1 changesets
794 obsoleted 1 changesets
795 obsoleted 1 changesets
795 obsoleted 1 changesets
796 obsoleted 1 changesets
796 obsoleted 1 changesets
797 obsoleted 1 changesets
797 obsoleted 1 changesets
798 obsoleted 1 changesets
798 obsoleted 1 changesets
799 obsoleted 1 changesets
799 obsoleted 1 changesets
800 obsoleted 1 changesets
800 obsoleted 1 changesets
801 obsoleted 1 changesets
801 obsoleted 1 changesets
802 obsoleted 1 changesets
802 obsoleted 1 changesets
803 obsoleted 1 changesets
803 obsoleted 1 changesets
804 obsoleted 1 changesets
804 obsoleted 1 changesets
805 obsoleted 1 changesets
805 obsoleted 1 changesets
806 obsoleted 1 changesets
806 obsoleted 1 changesets
807 obsoleted 1 changesets
807 obsoleted 1 changesets
808 obsoleted 1 changesets
808 obsoleted 1 changesets
809 obsoleted 1 changesets
809 obsoleted 1 changesets
810 obsoleted 1 changesets
810 obsoleted 1 changesets
811 obsoleted 1 changesets
811 obsoleted 1 changesets
812 obsoleted 1 changesets
812 obsoleted 1 changesets
813 obsoleted 1 changesets
813 obsoleted 1 changesets
814 obsoleted 1 changesets
814 obsoleted 1 changesets
815 obsoleted 1 changesets
815 obsoleted 1 changesets
816 obsoleted 1 changesets
816 obsoleted 1 changesets
817 obsoleted 1 changesets
817 obsoleted 1 changesets
818 obsoleted 1 changesets
818 obsoleted 1 changesets
819 obsoleted 1 changesets
819 obsoleted 1 changesets
820 obsoleted 1 changesets
820 obsoleted 1 changesets
821 obsoleted 1 changesets
821 obsoleted 1 changesets
822 obsoleted 1 changesets
822 obsoleted 1 changesets
823 obsoleted 1 changesets
823 obsoleted 1 changesets
824 obsoleted 1 changesets
824 obsoleted 1 changesets
825 obsoleted 1 changesets
825 obsoleted 1 changesets
826 obsoleted 1 changesets
826 obsoleted 1 changesets
827 obsoleted 1 changesets
827 obsoleted 1 changesets
828 obsoleted 1 changesets
828 obsoleted 1 changesets
829 obsoleted 1 changesets
829 obsoleted 1 changesets
830 obsoleted 1 changesets
830 obsoleted 1 changesets
831 obsoleted 1 changesets
831 obsoleted 1 changesets
832 obsoleted 1 changesets
832 obsoleted 1 changesets
833 obsoleted 1 changesets
833 obsoleted 1 changesets
834 obsoleted 1 changesets
834 obsoleted 1 changesets
835 obsoleted 1 changesets
835 obsoleted 1 changesets
836 obsoleted 1 changesets
836 obsoleted 1 changesets
837 obsoleted 1 changesets
837 obsoleted 1 changesets
838 obsoleted 1 changesets
838 obsoleted 1 changesets
839 obsoleted 1 changesets
839 obsoleted 1 changesets
840 obsoleted 1 changesets
840 obsoleted 1 changesets
841 obsoleted 1 changesets
841 obsoleted 1 changesets
842 obsoleted 1 changesets
842 obsoleted 1 changesets
843 obsoleted 1 changesets
843 obsoleted 1 changesets
844 obsoleted 1 changesets
844 obsoleted 1 changesets
845 obsoleted 1 changesets
845 obsoleted 1 changesets
846 obsoleted 1 changesets
846 obsoleted 1 changesets
847 obsoleted 1 changesets
847 obsoleted 1 changesets
848 obsoleted 1 changesets
848 obsoleted 1 changesets
849 obsoleted 1 changesets
849 obsoleted 1 changesets
850 $ hg up tip
850 $ hg up tip
851 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
851 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
852
852
853 #if serve
853 #if serve
854
854
855 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
855 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
856 $ cat hg.pid >> $DAEMON_PIDS
856 $ cat hg.pid >> $DAEMON_PIDS
857
857
858 check changelog view
858 check changelog view
859
859
860 $ get-with-headers.py --headeronly localhost:$HGPORT 'shortlog/'
860 $ get-with-headers.py --headeronly localhost:$HGPORT 'shortlog/'
861 200 Script output follows
861 200 Script output follows
862
862
863 check graph view
863 check graph view
864
864
865 $ get-with-headers.py --headeronly localhost:$HGPORT 'graph'
865 $ get-with-headers.py --headeronly localhost:$HGPORT 'graph'
866 200 Script output follows
866 200 Script output follows
867
867
868 check filelog view
868 check filelog view
869
869
870 $ get-with-headers.py --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
870 $ get-with-headers.py --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
871 200 Script output follows
871 200 Script output follows
872
872
873 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/68'
873 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/68'
874 200 Script output follows
874 200 Script output follows
875 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
875 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
876 404 Not Found
876 404 Not Found
877 [1]
877 [1]
878
878
879 check that web.view config option:
879 check that web.view config option:
880
880
881 $ killdaemons.py hg.pid
881 $ killdaemons.py hg.pid
882 $ cat >> .hg/hgrc << EOF
882 $ cat >> .hg/hgrc << EOF
883 > [web]
883 > [web]
884 > view=all
884 > view=all
885 > EOF
885 > EOF
886 $ wait
886 $ wait
887 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
887 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
888 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
888 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
889 200 Script output follows
889 200 Script output follows
890 $ killdaemons.py hg.pid
890 $ killdaemons.py hg.pid
891
891
892 Checking _enable=False warning if obsolete marker exists
892 Checking _enable=False warning if obsolete marker exists
893
893
894 $ echo '[experimental]' >> $HGRCPATH
894 $ echo '[experimental]' >> $HGRCPATH
895 $ echo "stabilization=" >> $HGRCPATH
895 $ echo "stabilization=" >> $HGRCPATH
896 $ hg log -r tip
896 $ hg log -r tip
897 obsolete feature not enabled but 68 markers found!
897 obsolete feature not enabled but 68 markers found!
898 68:c15e9edfca13 (draft) [tip ] add celestine
898 68:c15e9edfca13 (draft) [tip ] add celestine
899
899
900 reenable for later test
900 reenable for later test
901
901
902 $ echo '[experimental]' >> $HGRCPATH
902 $ echo '[experimental]' >> $HGRCPATH
903 $ echo "stabilization=createmarkers,exchange" >> $HGRCPATH
903 $ echo "stabilization=createmarkers,exchange" >> $HGRCPATH
904
904
905 $ rm hg.pid access.log errors.log
905 $ rm hg.pid access.log errors.log
906 #endif
906 #endif
907
907
908 Several troubles on the same changeset (create an unstable and bumped changeset)
908 Several troubles on the same changeset (create an unstable and bumped changeset)
909
909
910 $ hg debugobsolete `getid obsolete_e`
910 $ hg debugobsolete `getid obsolete_e`
911 obsoleted 1 changesets
911 obsoleted 1 changesets
912 $ hg debugobsolete `getid original_c` `getid babar`
912 $ hg debugobsolete `getid original_c` `getid babar`
913 $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan()'
913 $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan()'
914 changeset: 7:50c51b361e60
914 changeset: 7:50c51b361e60
915 user: test
915 user: test
916 date: Thu Jan 01 00:00:00 1970 +0000
916 date: Thu Jan 01 00:00:00 1970 +0000
917 instability: orphan, phase-divergent
917 instability: orphan, phase-divergent
918 summary: add babar
918 summary: add babar
919
919
920
920
921 test the "obsolete" templatekw
921 test the "obsolete" templatekw
922
922
923 $ hg log -r 'obsolete()'
923 $ hg log -r 'obsolete()'
924 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e
924 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e
925
925
926 test the "troubles" templatekw
926 test the "troubles" templatekw
927
927
928 $ hg log -r 'phasedivergent() and orphan()'
928 $ hg log -r 'phasedivergent() and orphan()'
929 7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
929 7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
930
930
931 test the default cmdline template
931 test the default cmdline template
932
932
933 $ hg log -T default -r 'phasedivergent()'
933 $ hg log -T default -r 'phasedivergent()'
934 changeset: 7:50c51b361e60
934 changeset: 7:50c51b361e60
935 user: test
935 user: test
936 date: Thu Jan 01 00:00:00 1970 +0000
936 date: Thu Jan 01 00:00:00 1970 +0000
937 instability: orphan, phase-divergent
937 instability: orphan, phase-divergent
938 summary: add babar
938 summary: add babar
939
939
940 $ hg log -T default -r 'obsolete()'
940 $ hg log -T default -r 'obsolete()'
941 changeset: 6:3de5eca88c00
941 changeset: 6:3de5eca88c00
942 parent: 3:6f9641995072
942 parent: 3:6f9641995072
943 user: test
943 user: test
944 date: Thu Jan 01 00:00:00 1970 +0000
944 date: Thu Jan 01 00:00:00 1970 +0000
945 summary: add obsolete_e
945 summary: add obsolete_e
946
946
947
947
948 test the obsolete labels
948 test the obsolete labels
949
949
950 $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
950 $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
951 [log.changeset changeset.draft changeset.unstable instability.orphan instability.phase-divergent|changeset: 7:50c51b361e60]
951 [log.changeset changeset.draft changeset.unstable instability.orphan instability.phase-divergent|changeset: 7:50c51b361e60]
952 [log.user|user: test]
952 [log.user|user: test]
953 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
953 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
954 [log.instability|instability: orphan, phase-divergent]
954 [log.instability|instability: orphan, phase-divergent]
955 [log.summary|summary: add babar]
955 [log.summary|summary: add babar]
956
956
957
957
958 $ hg log -T default -r 'phasedivergent()' --color=debug
958 $ hg log -T default -r 'phasedivergent()' --color=debug
959 [log.changeset changeset.draft changeset.unstable instability.orphaninstability.phase-divergent|changeset: 7:50c51b361e60]
959 [log.changeset changeset.draft changeset.unstable instability.orphaninstability.phase-divergent|changeset: 7:50c51b361e60]
960 [log.user|user: test]
960 [log.user|user: test]
961 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
961 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
962 [log.instability|instability: orphan, phase-divergent]
962 [log.instability|instability: orphan, phase-divergent]
963 [log.summary|summary: add babar]
963 [log.summary|summary: add babar]
964
964
965
965
966 $ hg log --config ui.logtemplate= --color=debug -r "obsolete()"
966 $ hg log --config ui.logtemplate= --color=debug -r "obsolete()"
967 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
967 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
968 [log.parent changeset.draft|parent: 3:6f9641995072]
968 [log.parent changeset.draft|parent: 3:6f9641995072]
969 [log.user|user: test]
969 [log.user|user: test]
970 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
970 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
971 [log.summary|summary: add obsolete_e]
971 [log.summary|summary: add obsolete_e]
972
972
973
973
974 $ hg log -T default -r 'obsolete()' --color=debug
974 $ hg log -T default -r 'obsolete()' --color=debug
975 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
975 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
976 [log.parent changeset.draft|parent: 3:6f9641995072]
976 [log.parent changeset.draft|parent: 3:6f9641995072]
977 [log.user|user: test]
977 [log.user|user: test]
978 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
978 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
979 [log.summary|summary: add obsolete_e]
979 [log.summary|summary: add obsolete_e]
980
980
981
981
982 test summary output
982 test summary output
983
983
984 $ hg up -r 'phasedivergent() and orphan()'
984 $ hg up -r 'phasedivergent() and orphan()'
985 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
985 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
986 $ hg summary
986 $ hg summary
987 parent: 7:50c51b361e60 (orphan, phase-divergent)
987 parent: 7:50c51b361e60 (orphan, phase-divergent)
988 add babar
988 add babar
989 branch: default
989 branch: default
990 commit: (clean)
990 commit: (clean)
991 update: 2 new changesets (update)
991 update: 2 new changesets (update)
992 phases: 4 draft
992 phases: 4 draft
993 orphan: 2 changesets
993 orphan: 2 changesets
994 phase-divergent: 1 changesets
994 phase-divergent: 1 changesets
995 $ hg up -r 'obsolete()'
995 $ hg up -r 'obsolete()'
996 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
996 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
997 $ hg summary
997 $ hg summary
998 parent: 6:3de5eca88c00 (obsolete)
998 parent: 6:3de5eca88c00 (obsolete)
999 add obsolete_e
999 add obsolete_e
1000 branch: default
1000 branch: default
1001 commit: (clean)
1001 commit: (clean)
1002 update: 3 new changesets (update)
1002 update: 3 new changesets (update)
1003 phases: 4 draft
1003 phases: 4 draft
1004 orphan: 2 changesets
1004 orphan: 2 changesets
1005 phase-divergent: 1 changesets
1005 phase-divergent: 1 changesets
1006
1006
1007 Test incoming/outcoming with changesets obsoleted remotely, known locally
1007 Test incoming/outcoming with changesets obsoleted remotely, known locally
1008 ===============================================================================
1008 ===============================================================================
1009
1009
1010 This test issue 3805
1010 This test issue 3805
1011
1011
1012 $ hg init repo-issue3805
1012 $ hg init repo-issue3805
1013 $ cd repo-issue3805
1013 $ cd repo-issue3805
1014 $ echo "base" > base
1014 $ echo "base" > base
1015 $ hg ci -Am "base"
1015 $ hg ci -Am "base"
1016 adding base
1016 adding base
1017 $ echo "foo" > foo
1017 $ echo "foo" > foo
1018 $ hg ci -Am "A"
1018 $ hg ci -Am "A"
1019 adding foo
1019 adding foo
1020 $ hg clone . ../other-issue3805
1020 $ hg clone . ../other-issue3805
1021 updating to branch default
1021 updating to branch default
1022 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1022 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1023 $ echo "bar" >> foo
1023 $ echo "bar" >> foo
1024 $ hg ci --amend
1024 $ hg ci --amend
1025 $ cd ../other-issue3805
1025 $ cd ../other-issue3805
1026 $ hg log -G
1026 $ hg log -G
1027 @ 1:29f0c6921ddd (draft) [tip ] A
1027 @ 1:29f0c6921ddd (draft) [tip ] A
1028 |
1028 |
1029 o 0:d20a80d4def3 (draft) [ ] base
1029 o 0:d20a80d4def3 (draft) [ ] base
1030
1030
1031 $ hg log -G -R ../repo-issue3805
1031 $ hg log -G -R ../repo-issue3805
1032 @ 3:323a9c3ddd91 (draft) [tip ] A
1032 @ 2:323a9c3ddd91 (draft) [tip ] A
1033 |
1033 |
1034 o 0:d20a80d4def3 (draft) [ ] base
1034 o 0:d20a80d4def3 (draft) [ ] base
1035
1035
1036 $ hg incoming
1036 $ hg incoming
1037 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1037 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1038 searching for changes
1038 searching for changes
1039 3:323a9c3ddd91 (draft) [tip ] A
1039 2:323a9c3ddd91 (draft) [tip ] A
1040 $ hg incoming --bundle ../issue3805.hg
1040 $ hg incoming --bundle ../issue3805.hg
1041 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1041 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1042 searching for changes
1042 searching for changes
1043 3:323a9c3ddd91 (draft) [tip ] A
1043 2:323a9c3ddd91 (draft) [tip ] A
1044 $ hg outgoing
1044 $ hg outgoing
1045 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1045 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
1046 searching for changes
1046 searching for changes
1047 1:29f0c6921ddd (draft) [tip ] A
1047 1:29f0c6921ddd (draft) [tip ] A
1048
1048
1049 #if serve
1049 #if serve
1050
1050
1051 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1051 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1052 $ cat hg.pid >> $DAEMON_PIDS
1052 $ cat hg.pid >> $DAEMON_PIDS
1053
1053
1054 $ hg incoming http://localhost:$HGPORT
1054 $ hg incoming http://localhost:$HGPORT
1055 comparing with http://localhost:$HGPORT/
1055 comparing with http://localhost:$HGPORT/
1056 searching for changes
1056 searching for changes
1057 2:323a9c3ddd91 (draft) [tip ] A
1057 2:323a9c3ddd91 (draft) [tip ] A
1058 $ hg outgoing http://localhost:$HGPORT
1058 $ hg outgoing http://localhost:$HGPORT
1059 comparing with http://localhost:$HGPORT/
1059 comparing with http://localhost:$HGPORT/
1060 searching for changes
1060 searching for changes
1061 1:29f0c6921ddd (draft) [tip ] A
1061 1:29f0c6921ddd (draft) [tip ] A
1062
1062
1063 $ killdaemons.py
1063 $ killdaemons.py
1064
1064
1065 #endif
1065 #endif
1066
1066
1067 This test issue 3814
1067 This test issue 3814
1068
1068
1069 (nothing to push but locally hidden changeset)
1069 (nothing to push but locally hidden changeset)
1070
1070
1071 $ cd ..
1071 $ cd ..
1072 $ hg init repo-issue3814
1072 $ hg init repo-issue3814
1073 $ cd repo-issue3805
1073 $ cd repo-issue3805
1074 $ hg push -r 323a9c3ddd91 ../repo-issue3814
1074 $ hg push -r 323a9c3ddd91 ../repo-issue3814
1075 pushing to ../repo-issue3814
1075 pushing to ../repo-issue3814
1076 searching for changes
1076 searching for changes
1077 adding changesets
1077 adding changesets
1078 adding manifests
1078 adding manifests
1079 adding file changes
1079 adding file changes
1080 added 2 changesets with 2 changes to 2 files
1080 added 2 changesets with 2 changes to 2 files
1081 2 new obsolescence markers
1081 1 new obsolescence markers
1082 $ hg out ../repo-issue3814
1082 $ hg out ../repo-issue3814
1083 comparing with ../repo-issue3814
1083 comparing with ../repo-issue3814
1084 searching for changes
1084 searching for changes
1085 no changes found
1085 no changes found
1086 [1]
1086 [1]
1087
1087
1088 Test that a local tag blocks a changeset from being hidden
1088 Test that a local tag blocks a changeset from being hidden
1089
1089
1090 $ hg tag -l visible -r 1 --hidden
1090 $ hg tag -l visible -r 1 --hidden
1091 $ hg log -G
1091 $ hg log -G
1092 @ 3:323a9c3ddd91 (draft) [tip ] A
1092 @ 2:323a9c3ddd91 (draft) [tip ] A
1093 |
1093 |
1094 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A
1094 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A
1095 |/
1095 |/
1096 o 0:d20a80d4def3 (draft) [ ] base
1096 o 0:d20a80d4def3 (draft) [ ] base
1097
1097
1098 Test that removing a local tag does not cause some commands to fail
1098 Test that removing a local tag does not cause some commands to fail
1099
1099
1100 $ hg tag -l -r tip tiptag
1100 $ hg tag -l -r tip tiptag
1101 $ hg tags
1101 $ hg tags
1102 tiptag 3:323a9c3ddd91
1102 tiptag 2:323a9c3ddd91
1103 tip 3:323a9c3ddd91
1103 tip 2:323a9c3ddd91
1104 visible 1:29f0c6921ddd
1104 visible 1:29f0c6921ddd
1105 $ hg --config extensions.strip= strip -r tip --no-backup
1105 $ hg --config extensions.strip= strip -r tip --no-backup
1106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1107 $ hg tags
1107 $ hg tags
1108 visible 1:29f0c6921ddd
1108 visible 1:29f0c6921ddd
1109 tip 1:29f0c6921ddd
1109 tip 1:29f0c6921ddd
1110
1110
1111 Test bundle overlay onto hidden revision
1111 Test bundle overlay onto hidden revision
1112
1112
1113 $ cd ..
1113 $ cd ..
1114 $ hg init repo-bundleoverlay
1114 $ hg init repo-bundleoverlay
1115 $ cd repo-bundleoverlay
1115 $ cd repo-bundleoverlay
1116 $ echo "A" > foo
1116 $ echo "A" > foo
1117 $ hg ci -Am "A"
1117 $ hg ci -Am "A"
1118 adding foo
1118 adding foo
1119 $ echo "B" >> foo
1119 $ echo "B" >> foo
1120 $ hg ci -m "B"
1120 $ hg ci -m "B"
1121 $ hg up 0
1121 $ hg up 0
1122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1123 $ echo "C" >> foo
1123 $ echo "C" >> foo
1124 $ hg ci -m "C"
1124 $ hg ci -m "C"
1125 created new head
1125 created new head
1126 $ hg log -G
1126 $ hg log -G
1127 @ 2:c186d7714947 (draft) [tip ] C
1127 @ 2:c186d7714947 (draft) [tip ] C
1128 |
1128 |
1129 | o 1:44526ebb0f98 (draft) [ ] B
1129 | o 1:44526ebb0f98 (draft) [ ] B
1130 |/
1130 |/
1131 o 0:4b34ecfb0d56 (draft) [ ] A
1131 o 0:4b34ecfb0d56 (draft) [ ] A
1132
1132
1133
1133
1134 $ hg clone -r1 . ../other-bundleoverlay
1134 $ hg clone -r1 . ../other-bundleoverlay
1135 adding changesets
1135 adding changesets
1136 adding manifests
1136 adding manifests
1137 adding file changes
1137 adding file changes
1138 added 2 changesets with 2 changes to 1 files
1138 added 2 changesets with 2 changes to 1 files
1139 updating to branch default
1139 updating to branch default
1140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1141 $ cd ../other-bundleoverlay
1141 $ cd ../other-bundleoverlay
1142 $ echo "B+" >> foo
1142 $ echo "B+" >> foo
1143 $ hg ci --amend -m "B+"
1143 $ hg ci --amend -m "B+"
1144 $ hg log -G --hidden
1144 $ hg log -G --hidden
1145 @ 3:b7d587542d40 (draft) [tip ] B+
1145 @ 2:b7d587542d40 (draft) [tip ] B+
1146 |
1146 |
1147 | x 2:eb95e9297e18 (draft *obsolete*) [ ] temporary amend commit for 44526ebb0f98
1148 | |
1149 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B
1147 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B
1150 |/
1148 |/
1151 o 0:4b34ecfb0d56 (draft) [ ] A
1149 o 0:4b34ecfb0d56 (draft) [ ] A
1152
1150
1153
1151
1154 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
1152 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
1155 comparing with ../repo-bundleoverlay
1153 comparing with ../repo-bundleoverlay
1156 searching for changes
1154 searching for changes
1157 1:44526ebb0f98 (draft) [ ] B
1155 1:44526ebb0f98 (draft) [ ] B
1158 2:c186d7714947 (draft) [tip ] C
1156 2:c186d7714947 (draft) [tip ] C
1159 $ hg log -G -R ../bundleoverlay.hg
1157 $ hg log -G -R ../bundleoverlay.hg
1160 o 4:c186d7714947 (draft) [tip ] C
1158 o 3:c186d7714947 (draft) [tip ] C
1161 |
1159 |
1162 | @ 3:b7d587542d40 (draft) [ ] B+
1160 | @ 2:b7d587542d40 (draft) [ ] B+
1163 |/
1161 |/
1164 o 0:4b34ecfb0d56 (draft) [ ] A
1162 o 0:4b34ecfb0d56 (draft) [ ] A
1165
1163
1166
1164
1167 #if serve
1165 #if serve
1168
1166
1169 Test issue 4506
1167 Test issue 4506
1170
1168
1171 $ cd ..
1169 $ cd ..
1172 $ hg init repo-issue4506
1170 $ hg init repo-issue4506
1173 $ cd repo-issue4506
1171 $ cd repo-issue4506
1174 $ echo "0" > foo
1172 $ echo "0" > foo
1175 $ hg add foo
1173 $ hg add foo
1176 $ hg ci -m "content-0"
1174 $ hg ci -m "content-0"
1177
1175
1178 $ hg up null
1176 $ hg up null
1179 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1177 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1180 $ echo "1" > bar
1178 $ echo "1" > bar
1181 $ hg add bar
1179 $ hg add bar
1182 $ hg ci -m "content-1"
1180 $ hg ci -m "content-1"
1183 created new head
1181 created new head
1184 $ hg up 0
1182 $ hg up 0
1185 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1183 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1186 $ hg graft 1
1184 $ hg graft 1
1187 grafting 1:1c9eddb02162 "content-1" (tip)
1185 grafting 1:1c9eddb02162 "content-1" (tip)
1188
1186
1189 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
1187 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
1190 obsoleted 1 changesets
1188 obsoleted 1 changesets
1191
1189
1192 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1190 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1193 $ cat hg.pid >> $DAEMON_PIDS
1191 $ cat hg.pid >> $DAEMON_PIDS
1194
1192
1195 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/1'
1193 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/1'
1196 404 Not Found
1194 404 Not Found
1197 [1]
1195 [1]
1198 $ get-with-headers.py --headeronly localhost:$HGPORT 'file/tip/bar'
1196 $ get-with-headers.py --headeronly localhost:$HGPORT 'file/tip/bar'
1199 200 Script output follows
1197 200 Script output follows
1200 $ get-with-headers.py --headeronly localhost:$HGPORT 'annotate/tip/bar'
1198 $ get-with-headers.py --headeronly localhost:$HGPORT 'annotate/tip/bar'
1201 200 Script output follows
1199 200 Script output follows
1202
1200
1203 $ killdaemons.py
1201 $ killdaemons.py
1204
1202
1205 #endif
1203 #endif
1206
1204
1207 Test heads computation on pending index changes with obsolescence markers
1205 Test heads computation on pending index changes with obsolescence markers
1208 $ cd ..
1206 $ cd ..
1209 $ cat >$TESTTMP/test_extension.py << EOF
1207 $ cat >$TESTTMP/test_extension.py << EOF
1210 > from __future__ import absolute_import
1208 > from __future__ import absolute_import
1211 > from mercurial.i18n import _
1209 > from mercurial.i18n import _
1212 > from mercurial import cmdutil, registrar
1210 > from mercurial import cmdutil, registrar
1213 >
1211 >
1214 > cmdtable = {}
1212 > cmdtable = {}
1215 > command = registrar.command(cmdtable)
1213 > command = registrar.command(cmdtable)
1216 > @command(b"amendtransient",[], _('hg amendtransient [rev]'))
1214 > @command(b"amendtransient",[], _('hg amendtransient [rev]'))
1217 > def amend(ui, repo, *pats, **opts):
1215 > def amend(ui, repo, *pats, **opts):
1218 > def commitfunc(ui, repo, message, match, opts):
1216 > def commitfunc(ui, repo, message, match, opts):
1219 > return repo.commit(message, repo['.'].user(), repo['.'].date(), match)
1217 > return repo.commit(message, repo['.'].user(), repo['.'].date(), match)
1220 > opts['message'] = 'Test'
1218 > opts['message'] = 'Test'
1221 > opts['logfile'] = None
1219 > opts['logfile'] = None
1222 > cmdutil.amend(ui, repo, commitfunc, repo['.'], {}, pats, opts)
1220 > cmdutil.amend(ui, repo, commitfunc, repo['.'], {}, pats, opts)
1223 > ui.write('%s\n' % repo.changelog.headrevs())
1221 > ui.write('%s\n' % repo.changelog.headrevs())
1224 > EOF
1222 > EOF
1225 $ cat >> $HGRCPATH << EOF
1223 $ cat >> $HGRCPATH << EOF
1226 > [extensions]
1224 > [extensions]
1227 > testextension=$TESTTMP/test_extension.py
1225 > testextension=$TESTTMP/test_extension.py
1228 > EOF
1226 > EOF
1229 $ hg init repo-issue-nativerevs-pending-changes
1227 $ hg init repo-issue-nativerevs-pending-changes
1230 $ cd repo-issue-nativerevs-pending-changes
1228 $ cd repo-issue-nativerevs-pending-changes
1231 $ mkcommit a
1229 $ mkcommit a
1232 $ mkcommit b
1230 $ mkcommit b
1233 $ hg up ".^"
1231 $ hg up ".^"
1234 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1232 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1235 $ echo aa > a
1233 $ echo aa > a
1236 $ hg amendtransient
1234 $ hg amendtransient
1237 [1, 3]
1235 [1, 2]
1238
1236
1239 Test cache consistency for the visible filter
1237 Test cache consistency for the visible filter
1240 1) We want to make sure that the cached filtered revs are invalidated when
1238 1) We want to make sure that the cached filtered revs are invalidated when
1241 bookmarks change
1239 bookmarks change
1242 $ cd ..
1240 $ cd ..
1243 $ cat >$TESTTMP/test_extension.py << EOF
1241 $ cat >$TESTTMP/test_extension.py << EOF
1244 > from __future__ import absolute_import, print_function
1242 > from __future__ import absolute_import, print_function
1245 > import weakref
1243 > import weakref
1246 > from mercurial import (
1244 > from mercurial import (
1247 > bookmarks,
1245 > bookmarks,
1248 > cmdutil,
1246 > cmdutil,
1249 > extensions,
1247 > extensions,
1250 > repoview,
1248 > repoview,
1251 > )
1249 > )
1252 > def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
1250 > def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
1253 > reporef = weakref.ref(bkmstoreinst._repo)
1251 > reporef = weakref.ref(bkmstoreinst._repo)
1254 > def trhook(tr):
1252 > def trhook(tr):
1255 > repo = reporef()
1253 > repo = reporef()
1256 > hidden1 = repoview.computehidden(repo)
1254 > hidden1 = repoview.computehidden(repo)
1257 > hidden = repoview.filterrevs(repo, 'visible')
1255 > hidden = repoview.filterrevs(repo, 'visible')
1258 > if sorted(hidden1) != sorted(hidden):
1256 > if sorted(hidden1) != sorted(hidden):
1259 > print("cache inconsistency")
1257 > print("cache inconsistency")
1260 > bkmstoreinst._repo.currenttransaction().addpostclose('test_extension', trhook)
1258 > bkmstoreinst._repo.currenttransaction().addpostclose('test_extension', trhook)
1261 > orig(bkmstoreinst, *args, **kwargs)
1259 > orig(bkmstoreinst, *args, **kwargs)
1262 > def extsetup(ui):
1260 > def extsetup(ui):
1263 > extensions.wrapfunction(bookmarks.bmstore, '_recordchange',
1261 > extensions.wrapfunction(bookmarks.bmstore, '_recordchange',
1264 > _bookmarkchanged)
1262 > _bookmarkchanged)
1265 > EOF
1263 > EOF
1266
1264
1267 $ hg init repo-cache-inconsistency
1265 $ hg init repo-cache-inconsistency
1268 $ cd repo-issue-nativerevs-pending-changes
1266 $ cd repo-issue-nativerevs-pending-changes
1269 $ mkcommit a
1267 $ mkcommit a
1270 a already tracked!
1268 a already tracked!
1271 $ mkcommit b
1269 $ mkcommit b
1272 $ hg id
1270 $ hg id
1273 13bedc178fce tip
1271 13bedc178fce tip
1274 $ echo "hello" > b
1272 $ echo "hello" > b
1275 $ hg commit --amend -m "message"
1273 $ hg commit --amend -m "message"
1276 $ hg book bookb -r 13bedc178fce --hidden
1274 $ hg book bookb -r 13bedc178fce --hidden
1277 $ hg log -r 13bedc178fce
1275 $ hg log -r 13bedc178fce
1278 5:13bedc178fce (draft *obsolete*) [ bookb] add b
1276 4:13bedc178fce (draft *obsolete*) [ bookb] add b
1279 $ hg book -d bookb
1277 $ hg book -d bookb
1280 $ hg log -r 13bedc178fce
1278 $ hg log -r 13bedc178fce
1281 abort: hidden revision '13bedc178fce'!
1279 abort: hidden revision '13bedc178fce'!
1282 (use --hidden to access hidden revisions)
1280 (use --hidden to access hidden revisions)
1283 [255]
1281 [255]
1284
1282
1285 Empty out the test extension, as it isn't compatible with later parts
1283 Empty out the test extension, as it isn't compatible with later parts
1286 of the test.
1284 of the test.
1287 $ echo > $TESTTMP/test_extension.py
1285 $ echo > $TESTTMP/test_extension.py
1288
1286
1289 Test ability to pull changeset with locally applying obsolescence markers
1287 Test ability to pull changeset with locally applying obsolescence markers
1290 (issue4945)
1288 (issue4945)
1291
1289
1292 $ cd ..
1290 $ cd ..
1293 $ hg init issue4845
1291 $ hg init issue4845
1294 $ cd issue4845
1292 $ cd issue4845
1295
1293
1296 $ echo foo > f0
1294 $ echo foo > f0
1297 $ hg add f0
1295 $ hg add f0
1298 $ hg ci -m '0'
1296 $ hg ci -m '0'
1299 $ echo foo > f1
1297 $ echo foo > f1
1300 $ hg add f1
1298 $ hg add f1
1301 $ hg ci -m '1'
1299 $ hg ci -m '1'
1302 $ echo foo > f2
1300 $ echo foo > f2
1303 $ hg add f2
1301 $ hg add f2
1304 $ hg ci -m '2'
1302 $ hg ci -m '2'
1305
1303
1306 $ echo bar > f2
1304 $ echo bar > f2
1307 $ hg commit --amend --config experimetnal.stabilization=createmarkers
1305 $ hg commit --amend --config experimetnal.stabilization=createmarkers
1308 $ hg log -G
1306 $ hg log -G
1309 @ 4:b0551702f918 (draft) [tip ] 2
1307 @ 3:b0551702f918 (draft) [tip ] 2
1310 |
1308 |
1311 o 1:e016b03fd86f (draft) [ ] 1
1309 o 1:e016b03fd86f (draft) [ ] 1
1312 |
1310 |
1313 o 0:a78f55e5508c (draft) [ ] 0
1311 o 0:a78f55e5508c (draft) [ ] 0
1314
1312
1315 $ hg log -G --hidden
1313 $ hg log -G --hidden
1316 @ 4:b0551702f918 (draft) [tip ] 2
1314 @ 3:b0551702f918 (draft) [tip ] 2
1317 |
1315 |
1318 | x 3:f27abbcc1f77 (draft *obsolete*) [ ] temporary amend commit for e008cf283490
1319 | |
1320 | x 2:e008cf283490 (draft *obsolete*) [ ] 2
1316 | x 2:e008cf283490 (draft *obsolete*) [ ] 2
1321 |/
1317 |/
1322 o 1:e016b03fd86f (draft) [ ] 1
1318 o 1:e016b03fd86f (draft) [ ] 1
1323 |
1319 |
1324 o 0:a78f55e5508c (draft) [ ] 0
1320 o 0:a78f55e5508c (draft) [ ] 0
1325
1321
1326
1322
1327 $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
1323 $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
1328 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-39c978dc-backup.hg (glob)
1324 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg (glob)
1329 $ hg debugobsolete
1325 $ hg debugobsolete
1330 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1326 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1331 f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
1332 $ hg log -G
1327 $ hg log -G
1333 @ 2:b0551702f918 (draft) [tip ] 2
1328 @ 2:b0551702f918 (draft) [tip ] 2
1334 |
1329 |
1335 o 1:e016b03fd86f (draft) [ ] 1
1330 o 1:e016b03fd86f (draft) [ ] 1
1336 |
1331 |
1337 o 0:a78f55e5508c (draft) [ ] 0
1332 o 0:a78f55e5508c (draft) [ ] 0
1338
1333
1339 $ hg log -G --hidden
1334 $ hg log -G --hidden
1340 @ 2:b0551702f918 (draft) [tip ] 2
1335 @ 2:b0551702f918 (draft) [tip ] 2
1341 |
1336 |
1342 o 1:e016b03fd86f (draft) [ ] 1
1337 o 1:e016b03fd86f (draft) [ ] 1
1343 |
1338 |
1344 o 0:a78f55e5508c (draft) [ ] 0
1339 o 0:a78f55e5508c (draft) [ ] 0
1345
1340
1346 $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
1341 $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
1347 Stream params: {Compression: BZ}
1342 Stream params: {Compression: BZ}
1348 changegroup -- {nbchanges: 2, version: 02}
1343 changegroup -- {nbchanges: 1, version: 02}
1349 e008cf2834908e5d6b0f792a9d4b0e2272260fb8
1344 e008cf2834908e5d6b0f792a9d4b0e2272260fb8
1350 f27abbcc1f77fb409cf9160482fe619541e2d605
1351 obsmarkers -- {}
1352 version: 1 (70 bytes)
1353 f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1354 phase-heads -- {}
1345 phase-heads -- {}
1355 f27abbcc1f77fb409cf9160482fe619541e2d605 draft
1346 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 draft
1356
1347
1357 $ hg pull .hg/strip-backup/e008cf283490-*-backup.hg
1348 $ hg pull .hg/strip-backup/e008cf283490-*-backup.hg
1358 pulling from .hg/strip-backup/e008cf283490-39c978dc-backup.hg
1349 pulling from .hg/strip-backup/e008cf283490-ede36964-backup.hg
1359 searching for changes
1350 searching for changes
1360 no changes found
1351 no changes found
1361 $ hg debugobsolete
1352 $ hg debugobsolete
1362 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1353 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1363 f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
1364 $ hg log -G
1354 $ hg log -G
1365 @ 2:b0551702f918 (draft) [tip ] 2
1355 @ 2:b0551702f918 (draft) [tip ] 2
1366 |
1356 |
1367 o 1:e016b03fd86f (draft) [ ] 1
1357 o 1:e016b03fd86f (draft) [ ] 1
1368 |
1358 |
1369 o 0:a78f55e5508c (draft) [ ] 0
1359 o 0:a78f55e5508c (draft) [ ] 0
1370
1360
1371 $ hg log -G --hidden
1361 $ hg log -G --hidden
1372 @ 2:b0551702f918 (draft) [tip ] 2
1362 @ 2:b0551702f918 (draft) [tip ] 2
1373 |
1363 |
1374 o 1:e016b03fd86f (draft) [ ] 1
1364 o 1:e016b03fd86f (draft) [ ] 1
1375 |
1365 |
1376 o 0:a78f55e5508c (draft) [ ] 0
1366 o 0:a78f55e5508c (draft) [ ] 0
1377
1367
1378
1368
1379 Testing that strip remove markers:
1369 Testing that strip remove markers:
1380
1370
1381 $ hg strip -r 1 --config extensions.strip=
1371 $ hg strip -r 1 --config extensions.strip=
1382 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1372 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1383 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg (glob)
1373 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg (glob)
1384 $ hg debugobsolete
1374 $ hg debugobsolete
1385 $ hg log -G
1375 $ hg log -G
1386 @ 0:a78f55e5508c (draft) [tip ] 0
1376 @ 0:a78f55e5508c (draft) [tip ] 0
1387
1377
1388 $ hg log -G --hidden
1378 $ hg log -G --hidden
1389 @ 0:a78f55e5508c (draft) [tip ] 0
1379 @ 0:a78f55e5508c (draft) [tip ] 0
1390
1380
1391 $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1381 $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1392 Stream params: {Compression: BZ}
1382 Stream params: {Compression: BZ}
1393 changegroup -- {nbchanges: 2, version: 02}
1383 changegroup -- {nbchanges: 2, version: 02}
1394 e016b03fd86fcccc54817d120b90b751aaf367d6
1384 e016b03fd86fcccc54817d120b90b751aaf367d6
1395 b0551702f918510f01ae838ab03a463054c67b46
1385 b0551702f918510f01ae838ab03a463054c67b46
1396 obsmarkers -- {}
1386 obsmarkers -- {}
1397 version: 1 (139 bytes)
1387 version: 1 (70 bytes)
1398 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1388 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1399 f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1400 phase-heads -- {}
1389 phase-heads -- {}
1401 b0551702f918510f01ae838ab03a463054c67b46 draft
1390 b0551702f918510f01ae838ab03a463054c67b46 draft
1402
1391
1403 $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1392 $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1404 adding changesets
1393 adding changesets
1405 adding manifests
1394 adding manifests
1406 adding file changes
1395 adding file changes
1407 added 2 changesets with 2 changes to 2 files
1396 added 2 changesets with 2 changes to 2 files
1408 2 new obsolescence markers
1397 1 new obsolescence markers
1409 (run 'hg update' to get a working copy)
1398 (run 'hg update' to get a working copy)
1410 $ hg debugobsolete | sort
1399 $ hg debugobsolete | sort
1411 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1400 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
1412 f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
1413 $ hg log -G
1401 $ hg log -G
1414 o 2:b0551702f918 (draft) [tip ] 2
1402 o 2:b0551702f918 (draft) [tip ] 2
1415 |
1403 |
1416 o 1:e016b03fd86f (draft) [ ] 1
1404 o 1:e016b03fd86f (draft) [ ] 1
1417 |
1405 |
1418 @ 0:a78f55e5508c (draft) [ ] 0
1406 @ 0:a78f55e5508c (draft) [ ] 0
1419
1407
1420 $ hg log -G --hidden
1408 $ hg log -G --hidden
1421 o 2:b0551702f918 (draft) [tip ] 2
1409 o 2:b0551702f918 (draft) [tip ] 2
1422 |
1410 |
1423 o 1:e016b03fd86f (draft) [ ] 1
1411 o 1:e016b03fd86f (draft) [ ] 1
1424 |
1412 |
1425 @ 0:a78f55e5508c (draft) [ ] 0
1413 @ 0:a78f55e5508c (draft) [ ] 0
1426
1414
1427 Test that 'hg debugobsolete --index --rev' can show indices of obsmarkers when
1415 Test that 'hg debugobsolete --index --rev' can show indices of obsmarkers when
1428 only a subset of those are displayed (because of --rev option)
1416 only a subset of those are displayed (because of --rev option)
1429 $ hg init doindexrev
1417 $ hg init doindexrev
1430 $ cd doindexrev
1418 $ cd doindexrev
1431 $ echo a > a
1419 $ echo a > a
1432 $ hg ci -Am a
1420 $ hg ci -Am a
1433 adding a
1421 adding a
1434 $ hg ci --amend -m aa
1422 $ hg ci --amend -m aa
1435 $ echo b > b
1423 $ echo b > b
1436 $ hg ci -Am b
1424 $ hg ci -Am b
1437 adding b
1425 adding b
1438 $ hg ci --amend -m bb
1426 $ hg ci --amend -m bb
1439 $ echo c > c
1427 $ echo c > c
1440 $ hg ci -Am c
1428 $ hg ci -Am c
1441 adding c
1429 adding c
1442 $ hg ci --amend -m cc
1430 $ hg ci --amend -m cc
1443 $ echo d > d
1431 $ echo d > d
1444 $ hg ci -Am d
1432 $ hg ci -Am d
1445 adding d
1433 adding d
1446 $ hg ci --amend -m dd --config experimental.stabilization.track-operation=1
1434 $ hg ci --amend -m dd --config experimental.stabilization.track-operation=1
1447 $ hg debugobsolete --index --rev "3+7"
1435 $ hg debugobsolete --index --rev "3+7"
1448 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re)
1436 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re)
1449 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'operation': 'amend', 'user': 'test'} (re)
1437 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'operation': 'amend', 'user': 'test'} (re)
1450 $ hg debugobsolete --index --rev "3+7" -Tjson
1438 $ hg debugobsolete --index --rev "3+7" -Tjson
1451 [
1439 [
1452 {
1440 {
1453 "date": [0.0, 0],
1441 "date": [0.0, 0],
1454 "flag": 0,
1442 "flag": 0,
1455 "index": 1,
1443 "index": 1,
1456 "metadata": {"user": "test"},
1444 "metadata": {"user": "test"},
1457 "prednode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1",
1445 "prednode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1",
1458 "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"]
1446 "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"]
1459 },
1447 },
1460 {
1448 {
1461 "date": [0.0, 0],
1449 "date": [0.0, 0],
1462 "flag": 0,
1450 "flag": 0,
1463 "index": 3,
1451 "index": 3,
1464 "metadata": {"operation": "amend", "user": "test"},
1452 "metadata": {"operation": "amend", "user": "test"},
1465 "prednode": "4715cf767440ed891755448016c2b8cf70760c30",
1453 "prednode": "4715cf767440ed891755448016c2b8cf70760c30",
1466 "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"]
1454 "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"]
1467 }
1455 }
1468 ]
1456 ]
1469
1457
1470 Test the --delete option of debugobsolete command
1458 Test the --delete option of debugobsolete command
1471 $ hg debugobsolete --index
1459 $ hg debugobsolete --index
1472 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1460 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1473 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1461 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1474 2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1462 2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1475 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
1463 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
1476 $ hg debugobsolete --delete 1 --delete 3
1464 $ hg debugobsolete --delete 1 --delete 3
1477 deleted 2 obsolescence markers
1465 deleted 2 obsolescence markers
1478 $ hg debugobsolete
1466 $ hg debugobsolete
1479 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1467 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1480 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1468 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1481
1469
1482 Test adding changeset after obsmarkers affecting it
1470 Test adding changeset after obsmarkers affecting it
1483 (eg: during pull, or unbundle)
1471 (eg: during pull, or unbundle)
1484
1472
1485 $ mkcommit e
1473 $ mkcommit e
1486 $ hg bundle -r . --base .~1 ../bundle-2.hg
1474 $ hg bundle -r . --base .~1 ../bundle-2.hg
1487 1 changesets found
1475 1 changesets found
1488 $ getid .
1476 $ getid .
1489 $ hg --config extensions.strip= strip -r .
1477 $ hg --config extensions.strip= strip -r .
1490 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1478 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1491 saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg (glob)
1479 saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg (glob)
1492 $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
1480 $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
1493 $ hg unbundle ../bundle-2.hg
1481 $ hg unbundle ../bundle-2.hg
1494 adding changesets
1482 adding changesets
1495 adding manifests
1483 adding manifests
1496 adding file changes
1484 adding file changes
1497 added 1 changesets with 1 changes to 1 files
1485 added 1 changesets with 1 changes to 1 files
1498 (run 'hg update' to get a working copy)
1486 (run 'hg update' to get a working copy)
1499 $ hg log -G
1487 $ hg log -G
1500 @ 7:7ae79c5d60f0 (draft) [tip ] dd
1488 @ 7:7ae79c5d60f0 (draft) [tip ] dd
1501 |
1489 |
1502 | o 6:4715cf767440 (draft) [ ] d
1490 | o 6:4715cf767440 (draft) [ ] d
1503 |/
1491 |/
1504 o 5:29346082e4a9 (draft) [ ] cc
1492 o 5:29346082e4a9 (draft) [ ] cc
1505 |
1493 |
1506 o 3:d27fb9b06607 (draft) [ ] bb
1494 o 3:d27fb9b06607 (draft) [ ] bb
1507 |
1495 |
1508 | o 2:6fdef60fcbab (draft) [ ] b
1496 | o 2:6fdef60fcbab (draft) [ ] b
1509 |/
1497 |/
1510 o 1:f9bd49731b0b (draft) [ ] aa
1498 o 1:f9bd49731b0b (draft) [ ] aa
1511
1499
1512
1500
1513 $ cd ..
1501 $ cd ..
@@ -1,1269 +1,1269 b''
1 ==========================
1 ==========================
2 Test rebase with obsolete
2 Test rebase with obsolete
3 ==========================
3 ==========================
4
4
5 Enable obsolete
5 Enable obsolete
6
6
7 $ cat >> $HGRCPATH << EOF
7 $ cat >> $HGRCPATH << EOF
8 > [ui]
8 > [ui]
9 > logtemplate= {rev}:{node|short} {desc|firstline}
9 > logtemplate= {rev}:{node|short} {desc|firstline}
10 > [experimental]
10 > [experimental]
11 > stabilization=createmarkers,allowunstable
11 > stabilization=createmarkers,allowunstable
12 > [phases]
12 > [phases]
13 > publish=False
13 > publish=False
14 > [extensions]
14 > [extensions]
15 > rebase=
15 > rebase=
16 > drawdag=$TESTDIR/drawdag.py
16 > drawdag=$TESTDIR/drawdag.py
17 > EOF
17 > EOF
18
18
19 Setup rebase canonical repo
19 Setup rebase canonical repo
20
20
21 $ hg init base
21 $ hg init base
22 $ cd base
22 $ cd base
23 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
23 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
24 adding changesets
24 adding changesets
25 adding manifests
25 adding manifests
26 adding file changes
26 adding file changes
27 added 8 changesets with 7 changes to 7 files (+2 heads)
27 added 8 changesets with 7 changes to 7 files (+2 heads)
28 (run 'hg heads' to see heads, 'hg merge' to merge)
28 (run 'hg heads' to see heads, 'hg merge' to merge)
29 $ hg up tip
29 $ hg up tip
30 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 $ hg log -G
31 $ hg log -G
32 @ 7:02de42196ebe H
32 @ 7:02de42196ebe H
33 |
33 |
34 | o 6:eea13746799a G
34 | o 6:eea13746799a G
35 |/|
35 |/|
36 o | 5:24b6387c8c8c F
36 o | 5:24b6387c8c8c F
37 | |
37 | |
38 | o 4:9520eea781bc E
38 | o 4:9520eea781bc E
39 |/
39 |/
40 | o 3:32af7686d403 D
40 | o 3:32af7686d403 D
41 | |
41 | |
42 | o 2:5fddd98957c8 C
42 | o 2:5fddd98957c8 C
43 | |
43 | |
44 | o 1:42ccdea3bb16 B
44 | o 1:42ccdea3bb16 B
45 |/
45 |/
46 o 0:cd010b8cd998 A
46 o 0:cd010b8cd998 A
47
47
48 $ cd ..
48 $ cd ..
49
49
50 simple rebase
50 simple rebase
51 ---------------------------------
51 ---------------------------------
52
52
53 $ hg clone base simple
53 $ hg clone base simple
54 updating to branch default
54 updating to branch default
55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 $ cd simple
56 $ cd simple
57 $ hg up 32af7686d403
57 $ hg up 32af7686d403
58 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
58 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
59 $ hg rebase -d eea13746799a
59 $ hg rebase -d eea13746799a
60 rebasing 1:42ccdea3bb16 "B"
60 rebasing 1:42ccdea3bb16 "B"
61 rebasing 2:5fddd98957c8 "C"
61 rebasing 2:5fddd98957c8 "C"
62 rebasing 3:32af7686d403 "D"
62 rebasing 3:32af7686d403 "D"
63 $ hg log -G
63 $ hg log -G
64 @ 10:8eeb3c33ad33 D
64 @ 10:8eeb3c33ad33 D
65 |
65 |
66 o 9:2327fea05063 C
66 o 9:2327fea05063 C
67 |
67 |
68 o 8:e4e5be0395b2 B
68 o 8:e4e5be0395b2 B
69 |
69 |
70 | o 7:02de42196ebe H
70 | o 7:02de42196ebe H
71 | |
71 | |
72 o | 6:eea13746799a G
72 o | 6:eea13746799a G
73 |\|
73 |\|
74 | o 5:24b6387c8c8c F
74 | o 5:24b6387c8c8c F
75 | |
75 | |
76 o | 4:9520eea781bc E
76 o | 4:9520eea781bc E
77 |/
77 |/
78 o 0:cd010b8cd998 A
78 o 0:cd010b8cd998 A
79
79
80 $ hg log --hidden -G
80 $ hg log --hidden -G
81 @ 10:8eeb3c33ad33 D
81 @ 10:8eeb3c33ad33 D
82 |
82 |
83 o 9:2327fea05063 C
83 o 9:2327fea05063 C
84 |
84 |
85 o 8:e4e5be0395b2 B
85 o 8:e4e5be0395b2 B
86 |
86 |
87 | o 7:02de42196ebe H
87 | o 7:02de42196ebe H
88 | |
88 | |
89 o | 6:eea13746799a G
89 o | 6:eea13746799a G
90 |\|
90 |\|
91 | o 5:24b6387c8c8c F
91 | o 5:24b6387c8c8c F
92 | |
92 | |
93 o | 4:9520eea781bc E
93 o | 4:9520eea781bc E
94 |/
94 |/
95 | x 3:32af7686d403 D
95 | x 3:32af7686d403 D
96 | |
96 | |
97 | x 2:5fddd98957c8 C
97 | x 2:5fddd98957c8 C
98 | |
98 | |
99 | x 1:42ccdea3bb16 B
99 | x 1:42ccdea3bb16 B
100 |/
100 |/
101 o 0:cd010b8cd998 A
101 o 0:cd010b8cd998 A
102
102
103 $ hg debugobsolete
103 $ hg debugobsolete
104 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (*) {'user': 'test'} (glob)
104 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (*) {'user': 'test'} (glob)
105 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (*) {'user': 'test'} (glob)
105 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (*) {'user': 'test'} (glob)
106 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (*) {'user': 'test'} (glob)
106 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (*) {'user': 'test'} (glob)
107
107
108
108
109 $ cd ..
109 $ cd ..
110
110
111 empty changeset
111 empty changeset
112 ---------------------------------
112 ---------------------------------
113
113
114 $ hg clone base empty
114 $ hg clone base empty
115 updating to branch default
115 updating to branch default
116 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 $ cd empty
117 $ cd empty
118 $ hg up eea13746799a
118 $ hg up eea13746799a
119 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
120
120
121 We make a copy of both the first changeset in the rebased and some other in the
121 We make a copy of both the first changeset in the rebased and some other in the
122 set.
122 set.
123
123
124 $ hg graft 42ccdea3bb16 32af7686d403
124 $ hg graft 42ccdea3bb16 32af7686d403
125 grafting 1:42ccdea3bb16 "B"
125 grafting 1:42ccdea3bb16 "B"
126 grafting 3:32af7686d403 "D"
126 grafting 3:32af7686d403 "D"
127 $ hg rebase -s 42ccdea3bb16 -d .
127 $ hg rebase -s 42ccdea3bb16 -d .
128 rebasing 1:42ccdea3bb16 "B"
128 rebasing 1:42ccdea3bb16 "B"
129 note: rebase of 1:42ccdea3bb16 created no changes to commit
129 note: rebase of 1:42ccdea3bb16 created no changes to commit
130 rebasing 2:5fddd98957c8 "C"
130 rebasing 2:5fddd98957c8 "C"
131 rebasing 3:32af7686d403 "D"
131 rebasing 3:32af7686d403 "D"
132 note: rebase of 3:32af7686d403 created no changes to commit
132 note: rebase of 3:32af7686d403 created no changes to commit
133 $ hg log -G
133 $ hg log -G
134 o 10:5ae4c968c6ac C
134 o 10:5ae4c968c6ac C
135 |
135 |
136 @ 9:08483444fef9 D
136 @ 9:08483444fef9 D
137 |
137 |
138 o 8:8877864f1edb B
138 o 8:8877864f1edb B
139 |
139 |
140 | o 7:02de42196ebe H
140 | o 7:02de42196ebe H
141 | |
141 | |
142 o | 6:eea13746799a G
142 o | 6:eea13746799a G
143 |\|
143 |\|
144 | o 5:24b6387c8c8c F
144 | o 5:24b6387c8c8c F
145 | |
145 | |
146 o | 4:9520eea781bc E
146 o | 4:9520eea781bc E
147 |/
147 |/
148 o 0:cd010b8cd998 A
148 o 0:cd010b8cd998 A
149
149
150 $ hg log --hidden -G
150 $ hg log --hidden -G
151 o 10:5ae4c968c6ac C
151 o 10:5ae4c968c6ac C
152 |
152 |
153 @ 9:08483444fef9 D
153 @ 9:08483444fef9 D
154 |
154 |
155 o 8:8877864f1edb B
155 o 8:8877864f1edb B
156 |
156 |
157 | o 7:02de42196ebe H
157 | o 7:02de42196ebe H
158 | |
158 | |
159 o | 6:eea13746799a G
159 o | 6:eea13746799a G
160 |\|
160 |\|
161 | o 5:24b6387c8c8c F
161 | o 5:24b6387c8c8c F
162 | |
162 | |
163 o | 4:9520eea781bc E
163 o | 4:9520eea781bc E
164 |/
164 |/
165 | x 3:32af7686d403 D
165 | x 3:32af7686d403 D
166 | |
166 | |
167 | x 2:5fddd98957c8 C
167 | x 2:5fddd98957c8 C
168 | |
168 | |
169 | x 1:42ccdea3bb16 B
169 | x 1:42ccdea3bb16 B
170 |/
170 |/
171 o 0:cd010b8cd998 A
171 o 0:cd010b8cd998 A
172
172
173 $ hg debugobsolete
173 $ hg debugobsolete
174 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
174 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
175 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
175 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
176 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
176 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
177
177
178
178
179 More complex case where part of the rebase set were already rebased
179 More complex case where part of the rebase set were already rebased
180
180
181 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
181 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
182 rebasing 9:08483444fef9 "D"
182 rebasing 9:08483444fef9 "D"
183 $ hg debugobsolete
183 $ hg debugobsolete
184 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
184 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
185 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
185 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
186 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
186 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
187 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
187 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
188 $ hg log -G
188 $ hg log -G
189 @ 11:4596109a6a43 D
189 @ 11:4596109a6a43 D
190 |
190 |
191 | o 10:5ae4c968c6ac C
191 | o 10:5ae4c968c6ac C
192 | |
192 | |
193 | x 9:08483444fef9 D
193 | x 9:08483444fef9 D
194 | |
194 | |
195 | o 8:8877864f1edb B
195 | o 8:8877864f1edb B
196 | |
196 | |
197 o | 7:02de42196ebe H
197 o | 7:02de42196ebe H
198 | |
198 | |
199 | o 6:eea13746799a G
199 | o 6:eea13746799a G
200 |/|
200 |/|
201 o | 5:24b6387c8c8c F
201 o | 5:24b6387c8c8c F
202 | |
202 | |
203 | o 4:9520eea781bc E
203 | o 4:9520eea781bc E
204 |/
204 |/
205 o 0:cd010b8cd998 A
205 o 0:cd010b8cd998 A
206
206
207 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
207 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
208 rebasing 8:8877864f1edb "B"
208 rebasing 8:8877864f1edb "B"
209 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
209 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
210 rebasing 10:5ae4c968c6ac "C"
210 rebasing 10:5ae4c968c6ac "C"
211 $ hg debugobsolete
211 $ hg debugobsolete
212 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
212 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
213 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
213 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
214 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
214 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
215 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
215 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
216 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
216 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
217 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
217 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
218 $ hg log --rev 'contentdivergent()'
218 $ hg log --rev 'contentdivergent()'
219 $ hg log -G
219 $ hg log -G
220 o 13:98f6af4ee953 C
220 o 13:98f6af4ee953 C
221 |
221 |
222 o 12:462a34d07e59 B
222 o 12:462a34d07e59 B
223 |
223 |
224 @ 11:4596109a6a43 D
224 @ 11:4596109a6a43 D
225 |
225 |
226 o 7:02de42196ebe H
226 o 7:02de42196ebe H
227 |
227 |
228 | o 6:eea13746799a G
228 | o 6:eea13746799a G
229 |/|
229 |/|
230 o | 5:24b6387c8c8c F
230 o | 5:24b6387c8c8c F
231 | |
231 | |
232 | o 4:9520eea781bc E
232 | o 4:9520eea781bc E
233 |/
233 |/
234 o 0:cd010b8cd998 A
234 o 0:cd010b8cd998 A
235
235
236 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
236 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
237 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
237 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
238 phase: draft
238 phase: draft
239 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
239 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
240 parent: -1:0000000000000000000000000000000000000000
240 parent: -1:0000000000000000000000000000000000000000
241 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
241 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
242 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
242 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
243 date: Sat Apr 30 15:24:48 2011 +0200
243 date: Sat Apr 30 15:24:48 2011 +0200
244 files+: D
244 files+: D
245 extra: branch=default
245 extra: branch=default
246 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
246 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
247 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
247 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
248 description:
248 description:
249 D
249 D
250
250
251
251
252 $ hg up -qr 'desc(G)'
252 $ hg up -qr 'desc(G)'
253 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
253 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
254 grafting 11:4596109a6a43 "D"
254 grafting 11:4596109a6a43 "D"
255 $ hg up -qr 'desc(E)'
255 $ hg up -qr 'desc(E)'
256 $ hg rebase -s tip -d .
256 $ hg rebase -s tip -d .
257 rebasing 14:9e36056a46e3 "D" (tip)
257 rebasing 14:9e36056a46e3 "D" (tip)
258 $ hg log --style default --debug -r tip
258 $ hg log --style default --debug -r tip
259 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
259 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
260 tag: tip
260 tag: tip
261 phase: draft
261 phase: draft
262 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
262 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
263 parent: -1:0000000000000000000000000000000000000000
263 parent: -1:0000000000000000000000000000000000000000
264 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
264 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
265 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
265 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
266 date: Sat Apr 30 15:24:48 2011 +0200
266 date: Sat Apr 30 15:24:48 2011 +0200
267 files+: D
267 files+: D
268 extra: branch=default
268 extra: branch=default
269 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
269 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
270 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
270 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
271 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
271 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
272 description:
272 description:
273 D
273 D
274
274
275
275
276 Start rebase from a commit that is obsolete but not hidden only because it's
276 Start rebase from a commit that is obsolete but not hidden only because it's
277 a working copy parent. We should be moved back to the starting commit as usual
277 a working copy parent. We should be moved back to the starting commit as usual
278 even though it is hidden (until we're moved there).
278 even though it is hidden (until we're moved there).
279
279
280 $ hg --hidden up -qr 'first(hidden())'
280 $ hg --hidden up -qr 'first(hidden())'
281 $ hg rebase --rev 13 --dest 15
281 $ hg rebase --rev 13 --dest 15
282 rebasing 13:98f6af4ee953 "C"
282 rebasing 13:98f6af4ee953 "C"
283 $ hg log -G
283 $ hg log -G
284 o 16:294a2b93eb4d C
284 o 16:294a2b93eb4d C
285 |
285 |
286 o 15:627d46148090 D
286 o 15:627d46148090 D
287 |
287 |
288 | o 12:462a34d07e59 B
288 | o 12:462a34d07e59 B
289 | |
289 | |
290 | o 11:4596109a6a43 D
290 | o 11:4596109a6a43 D
291 | |
291 | |
292 | o 7:02de42196ebe H
292 | o 7:02de42196ebe H
293 | |
293 | |
294 +---o 6:eea13746799a G
294 +---o 6:eea13746799a G
295 | |/
295 | |/
296 | o 5:24b6387c8c8c F
296 | o 5:24b6387c8c8c F
297 | |
297 | |
298 o | 4:9520eea781bc E
298 o | 4:9520eea781bc E
299 |/
299 |/
300 | @ 1:42ccdea3bb16 B
300 | @ 1:42ccdea3bb16 B
301 |/
301 |/
302 o 0:cd010b8cd998 A
302 o 0:cd010b8cd998 A
303
303
304
304
305 $ cd ..
305 $ cd ..
306
306
307 collapse rebase
307 collapse rebase
308 ---------------------------------
308 ---------------------------------
309
309
310 $ hg clone base collapse
310 $ hg clone base collapse
311 updating to branch default
311 updating to branch default
312 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 $ cd collapse
313 $ cd collapse
314 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
314 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
315 rebasing 1:42ccdea3bb16 "B"
315 rebasing 1:42ccdea3bb16 "B"
316 rebasing 2:5fddd98957c8 "C"
316 rebasing 2:5fddd98957c8 "C"
317 rebasing 3:32af7686d403 "D"
317 rebasing 3:32af7686d403 "D"
318 $ hg log -G
318 $ hg log -G
319 o 8:4dc2197e807b Collapsed revision
319 o 8:4dc2197e807b Collapsed revision
320 |
320 |
321 | @ 7:02de42196ebe H
321 | @ 7:02de42196ebe H
322 | |
322 | |
323 o | 6:eea13746799a G
323 o | 6:eea13746799a G
324 |\|
324 |\|
325 | o 5:24b6387c8c8c F
325 | o 5:24b6387c8c8c F
326 | |
326 | |
327 o | 4:9520eea781bc E
327 o | 4:9520eea781bc E
328 |/
328 |/
329 o 0:cd010b8cd998 A
329 o 0:cd010b8cd998 A
330
330
331 $ hg log --hidden -G
331 $ hg log --hidden -G
332 o 8:4dc2197e807b Collapsed revision
332 o 8:4dc2197e807b Collapsed revision
333 |
333 |
334 | @ 7:02de42196ebe H
334 | @ 7:02de42196ebe H
335 | |
335 | |
336 o | 6:eea13746799a G
336 o | 6:eea13746799a G
337 |\|
337 |\|
338 | o 5:24b6387c8c8c F
338 | o 5:24b6387c8c8c F
339 | |
339 | |
340 o | 4:9520eea781bc E
340 o | 4:9520eea781bc E
341 |/
341 |/
342 | x 3:32af7686d403 D
342 | x 3:32af7686d403 D
343 | |
343 | |
344 | x 2:5fddd98957c8 C
344 | x 2:5fddd98957c8 C
345 | |
345 | |
346 | x 1:42ccdea3bb16 B
346 | x 1:42ccdea3bb16 B
347 |/
347 |/
348 o 0:cd010b8cd998 A
348 o 0:cd010b8cd998 A
349
349
350 $ hg id --debug -r tip
350 $ hg id --debug -r tip
351 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
351 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
352 $ hg debugobsolete
352 $ hg debugobsolete
353 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
353 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
354 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
354 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
355 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
355 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
356
356
357 $ cd ..
357 $ cd ..
358
358
359 Rebase set has hidden descendants
359 Rebase set has hidden descendants
360 ---------------------------------
360 ---------------------------------
361
361
362 We rebase a changeset which has a hidden changeset. The hidden changeset must
362 We rebase a changeset which has a hidden changeset. The hidden changeset must
363 not be rebased.
363 not be rebased.
364
364
365 $ hg clone base hidden
365 $ hg clone base hidden
366 updating to branch default
366 updating to branch default
367 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 $ cd hidden
368 $ cd hidden
369 $ hg rebase -s 5fddd98957c8 -d eea13746799a
369 $ hg rebase -s 5fddd98957c8 -d eea13746799a
370 rebasing 2:5fddd98957c8 "C"
370 rebasing 2:5fddd98957c8 "C"
371 rebasing 3:32af7686d403 "D"
371 rebasing 3:32af7686d403 "D"
372 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
372 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
373 rebasing 1:42ccdea3bb16 "B"
373 rebasing 1:42ccdea3bb16 "B"
374 $ hg log -G
374 $ hg log -G
375 o 10:7c6027df6a99 B
375 o 10:7c6027df6a99 B
376 |
376 |
377 | o 9:cf44d2f5a9f4 D
377 | o 9:cf44d2f5a9f4 D
378 | |
378 | |
379 | o 8:e273c5e7d2d2 C
379 | o 8:e273c5e7d2d2 C
380 | |
380 | |
381 @ | 7:02de42196ebe H
381 @ | 7:02de42196ebe H
382 | |
382 | |
383 | o 6:eea13746799a G
383 | o 6:eea13746799a G
384 |/|
384 |/|
385 o | 5:24b6387c8c8c F
385 o | 5:24b6387c8c8c F
386 | |
386 | |
387 | o 4:9520eea781bc E
387 | o 4:9520eea781bc E
388 |/
388 |/
389 o 0:cd010b8cd998 A
389 o 0:cd010b8cd998 A
390
390
391 $ hg log --hidden -G
391 $ hg log --hidden -G
392 o 10:7c6027df6a99 B
392 o 10:7c6027df6a99 B
393 |
393 |
394 | o 9:cf44d2f5a9f4 D
394 | o 9:cf44d2f5a9f4 D
395 | |
395 | |
396 | o 8:e273c5e7d2d2 C
396 | o 8:e273c5e7d2d2 C
397 | |
397 | |
398 @ | 7:02de42196ebe H
398 @ | 7:02de42196ebe H
399 | |
399 | |
400 | o 6:eea13746799a G
400 | o 6:eea13746799a G
401 |/|
401 |/|
402 o | 5:24b6387c8c8c F
402 o | 5:24b6387c8c8c F
403 | |
403 | |
404 | o 4:9520eea781bc E
404 | o 4:9520eea781bc E
405 |/
405 |/
406 | x 3:32af7686d403 D
406 | x 3:32af7686d403 D
407 | |
407 | |
408 | x 2:5fddd98957c8 C
408 | x 2:5fddd98957c8 C
409 | |
409 | |
410 | x 1:42ccdea3bb16 B
410 | x 1:42ccdea3bb16 B
411 |/
411 |/
412 o 0:cd010b8cd998 A
412 o 0:cd010b8cd998 A
413
413
414 $ hg debugobsolete
414 $ hg debugobsolete
415 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (*) {'user': 'test'} (glob)
415 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (*) {'user': 'test'} (glob)
416 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (*) {'user': 'test'} (glob)
416 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (*) {'user': 'test'} (glob)
417 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (*) {'user': 'test'} (glob)
417 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (*) {'user': 'test'} (glob)
418
418
419 Test that rewriting leaving instability behind is allowed
419 Test that rewriting leaving instability behind is allowed
420 ---------------------------------------------------------------------
420 ---------------------------------------------------------------------
421
421
422 $ hg log -r 'children(8)'
422 $ hg log -r 'children(8)'
423 9:cf44d2f5a9f4 D (no-eol)
423 9:cf44d2f5a9f4 D (no-eol)
424 $ hg rebase -r 8
424 $ hg rebase -r 8
425 rebasing 8:e273c5e7d2d2 "C"
425 rebasing 8:e273c5e7d2d2 "C"
426 $ hg log -G
426 $ hg log -G
427 o 11:0d8f238b634c C
427 o 11:0d8f238b634c C
428 |
428 |
429 o 10:7c6027df6a99 B
429 o 10:7c6027df6a99 B
430 |
430 |
431 | o 9:cf44d2f5a9f4 D
431 | o 9:cf44d2f5a9f4 D
432 | |
432 | |
433 | x 8:e273c5e7d2d2 C
433 | x 8:e273c5e7d2d2 C
434 | |
434 | |
435 @ | 7:02de42196ebe H
435 @ | 7:02de42196ebe H
436 | |
436 | |
437 | o 6:eea13746799a G
437 | o 6:eea13746799a G
438 |/|
438 |/|
439 o | 5:24b6387c8c8c F
439 o | 5:24b6387c8c8c F
440 | |
440 | |
441 | o 4:9520eea781bc E
441 | o 4:9520eea781bc E
442 |/
442 |/
443 o 0:cd010b8cd998 A
443 o 0:cd010b8cd998 A
444
444
445
445
446
446
447 Test multiple root handling
447 Test multiple root handling
448 ------------------------------------
448 ------------------------------------
449
449
450 $ hg rebase --dest 4 --rev '7+11+9'
450 $ hg rebase --dest 4 --rev '7+11+9'
451 rebasing 9:cf44d2f5a9f4 "D"
451 rebasing 9:cf44d2f5a9f4 "D"
452 rebasing 7:02de42196ebe "H"
452 rebasing 7:02de42196ebe "H"
453 rebasing 11:0d8f238b634c "C" (tip)
453 rebasing 11:0d8f238b634c "C" (tip)
454 $ hg log -G
454 $ hg log -G
455 o 14:1e8370e38cca C
455 o 14:1e8370e38cca C
456 |
456 |
457 @ 13:bfe264faf697 H
457 @ 13:bfe264faf697 H
458 |
458 |
459 | o 12:102b4c1d889b D
459 | o 12:102b4c1d889b D
460 |/
460 |/
461 | o 10:7c6027df6a99 B
461 | o 10:7c6027df6a99 B
462 | |
462 | |
463 | x 7:02de42196ebe H
463 | x 7:02de42196ebe H
464 | |
464 | |
465 +---o 6:eea13746799a G
465 +---o 6:eea13746799a G
466 | |/
466 | |/
467 | o 5:24b6387c8c8c F
467 | o 5:24b6387c8c8c F
468 | |
468 | |
469 o | 4:9520eea781bc E
469 o | 4:9520eea781bc E
470 |/
470 |/
471 o 0:cd010b8cd998 A
471 o 0:cd010b8cd998 A
472
472
473 $ cd ..
473 $ cd ..
474
474
475 Detach both parents
475 Detach both parents
476
476
477 $ hg init double-detach
477 $ hg init double-detach
478 $ cd double-detach
478 $ cd double-detach
479
479
480 $ hg debugdrawdag <<EOF
480 $ hg debugdrawdag <<EOF
481 > F
481 > F
482 > /|
482 > /|
483 > C E
483 > C E
484 > | |
484 > | |
485 > B D G
485 > B D G
486 > \|/
486 > \|/
487 > A
487 > A
488 > EOF
488 > EOF
489
489
490 $ hg rebase -d G -r 'B + D + F'
490 $ hg rebase -d G -r 'B + D + F'
491 rebasing 1:112478962961 "B" (B)
491 rebasing 1:112478962961 "B" (B)
492 rebasing 2:b18e25de2cf5 "D" (D)
492 rebasing 2:b18e25de2cf5 "D" (D)
493 rebasing 6:f15c3adaf214 "F" (F tip)
493 rebasing 6:f15c3adaf214 "F" (F tip)
494 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
494 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
495 [255]
495 [255]
496
496
497 $ cd ..
497 $ cd ..
498
498
499 test on rebase dropping a merge
499 test on rebase dropping a merge
500
500
501 (setup)
501 (setup)
502
502
503 $ hg init dropmerge
503 $ hg init dropmerge
504 $ cd dropmerge
504 $ cd dropmerge
505 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
505 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
506 adding changesets
506 adding changesets
507 adding manifests
507 adding manifests
508 adding file changes
508 adding file changes
509 added 8 changesets with 7 changes to 7 files (+2 heads)
509 added 8 changesets with 7 changes to 7 files (+2 heads)
510 (run 'hg heads' to see heads, 'hg merge' to merge)
510 (run 'hg heads' to see heads, 'hg merge' to merge)
511 $ hg up 3
511 $ hg up 3
512 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
512 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
513 $ hg merge 7
513 $ hg merge 7
514 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
514 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
515 (branch merge, don't forget to commit)
515 (branch merge, don't forget to commit)
516 $ hg ci -m 'M'
516 $ hg ci -m 'M'
517 $ echo I > I
517 $ echo I > I
518 $ hg add I
518 $ hg add I
519 $ hg ci -m I
519 $ hg ci -m I
520 $ hg log -G
520 $ hg log -G
521 @ 9:4bde274eefcf I
521 @ 9:4bde274eefcf I
522 |
522 |
523 o 8:53a6a128b2b7 M
523 o 8:53a6a128b2b7 M
524 |\
524 |\
525 | o 7:02de42196ebe H
525 | o 7:02de42196ebe H
526 | |
526 | |
527 | | o 6:eea13746799a G
527 | | o 6:eea13746799a G
528 | |/|
528 | |/|
529 | o | 5:24b6387c8c8c F
529 | o | 5:24b6387c8c8c F
530 | | |
530 | | |
531 | | o 4:9520eea781bc E
531 | | o 4:9520eea781bc E
532 | |/
532 | |/
533 o | 3:32af7686d403 D
533 o | 3:32af7686d403 D
534 | |
534 | |
535 o | 2:5fddd98957c8 C
535 o | 2:5fddd98957c8 C
536 | |
536 | |
537 o | 1:42ccdea3bb16 B
537 o | 1:42ccdea3bb16 B
538 |/
538 |/
539 o 0:cd010b8cd998 A
539 o 0:cd010b8cd998 A
540
540
541 (actual test)
541 (actual test)
542
542
543 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
543 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
544 rebasing 3:32af7686d403 "D"
544 rebasing 3:32af7686d403 "D"
545 rebasing 7:02de42196ebe "H"
545 rebasing 7:02de42196ebe "H"
546 rebasing 9:4bde274eefcf "I" (tip)
546 rebasing 9:4bde274eefcf "I" (tip)
547 $ hg log -G
547 $ hg log -G
548 @ 12:acd174b7ab39 I
548 @ 12:acd174b7ab39 I
549 |
549 |
550 o 11:6c11a6218c97 H
550 o 11:6c11a6218c97 H
551 |
551 |
552 | o 10:b5313c85b22e D
552 | o 10:b5313c85b22e D
553 |/
553 |/
554 | o 8:53a6a128b2b7 M
554 | o 8:53a6a128b2b7 M
555 | |\
555 | |\
556 | | x 7:02de42196ebe H
556 | | x 7:02de42196ebe H
557 | | |
557 | | |
558 o---+ 6:eea13746799a G
558 o---+ 6:eea13746799a G
559 | | |
559 | | |
560 | | o 5:24b6387c8c8c F
560 | | o 5:24b6387c8c8c F
561 | | |
561 | | |
562 o---+ 4:9520eea781bc E
562 o---+ 4:9520eea781bc E
563 / /
563 / /
564 x | 3:32af7686d403 D
564 x | 3:32af7686d403 D
565 | |
565 | |
566 o | 2:5fddd98957c8 C
566 o | 2:5fddd98957c8 C
567 | |
567 | |
568 o | 1:42ccdea3bb16 B
568 o | 1:42ccdea3bb16 B
569 |/
569 |/
570 o 0:cd010b8cd998 A
570 o 0:cd010b8cd998 A
571
571
572
572
573 Test hidden changesets in the rebase set (issue4504)
573 Test hidden changesets in the rebase set (issue4504)
574
574
575 $ hg up --hidden 9
575 $ hg up --hidden 9
576 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
576 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
577 $ echo J > J
577 $ echo J > J
578 $ hg add J
578 $ hg add J
579 $ hg commit -m J
579 $ hg commit -m J
580 $ hg debugobsolete `hg log --rev . -T '{node}'`
580 $ hg debugobsolete `hg log --rev . -T '{node}'`
581 obsoleted 1 changesets
581 obsoleted 1 changesets
582
582
583 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
583 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
584 rebasing 9:4bde274eefcf "I"
584 rebasing 9:4bde274eefcf "I"
585 rebasing 13:06edfc82198f "J" (tip)
585 rebasing 13:06edfc82198f "J" (tip)
586 $ hg log -G
586 $ hg log -G
587 @ 15:5ae8a643467b J
587 @ 15:5ae8a643467b J
588 |
588 |
589 o 14:9ad579b4a5de I
589 o 14:9ad579b4a5de I
590 |
590 |
591 | o 12:acd174b7ab39 I
591 | o 12:acd174b7ab39 I
592 | |
592 | |
593 | o 11:6c11a6218c97 H
593 | o 11:6c11a6218c97 H
594 | |
594 | |
595 o | 10:b5313c85b22e D
595 o | 10:b5313c85b22e D
596 |/
596 |/
597 | o 8:53a6a128b2b7 M
597 | o 8:53a6a128b2b7 M
598 | |\
598 | |\
599 | | x 7:02de42196ebe H
599 | | x 7:02de42196ebe H
600 | | |
600 | | |
601 o---+ 6:eea13746799a G
601 o---+ 6:eea13746799a G
602 | | |
602 | | |
603 | | o 5:24b6387c8c8c F
603 | | o 5:24b6387c8c8c F
604 | | |
604 | | |
605 o---+ 4:9520eea781bc E
605 o---+ 4:9520eea781bc E
606 / /
606 / /
607 x | 3:32af7686d403 D
607 x | 3:32af7686d403 D
608 | |
608 | |
609 o | 2:5fddd98957c8 C
609 o | 2:5fddd98957c8 C
610 | |
610 | |
611 o | 1:42ccdea3bb16 B
611 o | 1:42ccdea3bb16 B
612 |/
612 |/
613 o 0:cd010b8cd998 A
613 o 0:cd010b8cd998 A
614
614
615 $ hg up 14 -C
615 $ hg up 14 -C
616 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
616 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
617 $ echo "K" > K
617 $ echo "K" > K
618 $ hg add K
618 $ hg add K
619 $ hg commit --amend -m "K"
619 $ hg commit --amend -m "K"
620 $ echo "L" > L
620 $ echo "L" > L
621 $ hg add L
621 $ hg add L
622 $ hg commit -m "L"
622 $ hg commit -m "L"
623 $ hg up '.^'
623 $ hg up '.^'
624 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
624 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
625 $ echo "M" > M
625 $ echo "M" > M
626 $ hg add M
626 $ hg add M
627 $ hg commit --amend -m "M"
627 $ hg commit --amend -m "M"
628 $ hg log -G
628 $ hg log -G
629 @ 20:bfaedf8eb73b M
629 @ 18:bfaedf8eb73b M
630 |
630 |
631 | o 18:97219452e4bd L
631 | o 17:97219452e4bd L
632 | |
632 | |
633 | x 17:fc37a630c901 K
633 | x 16:fc37a630c901 K
634 |/
634 |/
635 | o 15:5ae8a643467b J
635 | o 15:5ae8a643467b J
636 | |
636 | |
637 | x 14:9ad579b4a5de I
637 | x 14:9ad579b4a5de I
638 |/
638 |/
639 | o 12:acd174b7ab39 I
639 | o 12:acd174b7ab39 I
640 | |
640 | |
641 | o 11:6c11a6218c97 H
641 | o 11:6c11a6218c97 H
642 | |
642 | |
643 o | 10:b5313c85b22e D
643 o | 10:b5313c85b22e D
644 |/
644 |/
645 | o 8:53a6a128b2b7 M
645 | o 8:53a6a128b2b7 M
646 | |\
646 | |\
647 | | x 7:02de42196ebe H
647 | | x 7:02de42196ebe H
648 | | |
648 | | |
649 o---+ 6:eea13746799a G
649 o---+ 6:eea13746799a G
650 | | |
650 | | |
651 | | o 5:24b6387c8c8c F
651 | | o 5:24b6387c8c8c F
652 | | |
652 | | |
653 o---+ 4:9520eea781bc E
653 o---+ 4:9520eea781bc E
654 / /
654 / /
655 x | 3:32af7686d403 D
655 x | 3:32af7686d403 D
656 | |
656 | |
657 o | 2:5fddd98957c8 C
657 o | 2:5fddd98957c8 C
658 | |
658 | |
659 o | 1:42ccdea3bb16 B
659 o | 1:42ccdea3bb16 B
660 |/
660 |/
661 o 0:cd010b8cd998 A
661 o 0:cd010b8cd998 A
662
662
663 $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True
663 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
664 note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
664 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
665 rebasing 15:5ae8a643467b "J"
665 rebasing 15:5ae8a643467b "J"
666
666
667 $ cd ..
667 $ cd ..
668
668
669 Skip obsolete changeset even with multiple hops
669 Skip obsolete changeset even with multiple hops
670 -----------------------------------------------
670 -----------------------------------------------
671
671
672 setup
672 setup
673
673
674 $ hg init obsskip
674 $ hg init obsskip
675 $ cd obsskip
675 $ cd obsskip
676 $ cat << EOF >> .hg/hgrc
676 $ cat << EOF >> .hg/hgrc
677 > [experimental]
677 > [experimental]
678 > rebaseskipobsolete = True
678 > rebaseskipobsolete = True
679 > [extensions]
679 > [extensions]
680 > strip =
680 > strip =
681 > EOF
681 > EOF
682 $ echo A > A
682 $ echo A > A
683 $ hg add A
683 $ hg add A
684 $ hg commit -m A
684 $ hg commit -m A
685 $ echo B > B
685 $ echo B > B
686 $ hg add B
686 $ hg add B
687 $ hg commit -m B0
687 $ hg commit -m B0
688 $ hg commit --amend -m B1
688 $ hg commit --amend -m B1
689 $ hg commit --amend -m B2
689 $ hg commit --amend -m B2
690 $ hg up --hidden 'desc(B0)'
690 $ hg up --hidden 'desc(B0)'
691 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
691 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
692 $ echo C > C
692 $ echo C > C
693 $ hg add C
693 $ hg add C
694 $ hg commit -m C
694 $ hg commit -m C
695
695
696 Rebase finds its way in a chain of marker
696 Rebase finds its way in a chain of marker
697
697
698 $ hg rebase -d 'desc(B2)'
698 $ hg rebase -d 'desc(B2)'
699 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
699 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
700 rebasing 4:212cb178bcbb "C" (tip)
700 rebasing 4:212cb178bcbb "C" (tip)
701
701
702 Even when the chain include missing node
702 Even when the chain include missing node
703
703
704 $ hg up --hidden 'desc(B0)'
704 $ hg up --hidden 'desc(B0)'
705 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
705 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
706 $ echo D > D
706 $ echo D > D
707 $ hg add D
707 $ hg add D
708 $ hg commit -m D
708 $ hg commit -m D
709 $ hg --hidden strip -r 'desc(B1)'
709 $ hg --hidden strip -r 'desc(B1)'
710 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
710 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
711
711
712 $ hg rebase -d 'desc(B2)'
712 $ hg rebase -d 'desc(B2)'
713 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
713 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
714 rebasing 5:1a79b7535141 "D" (tip)
714 rebasing 5:1a79b7535141 "D" (tip)
715 $ hg up 4
715 $ hg up 4
716 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
716 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
717 $ echo "O" > O
717 $ echo "O" > O
718 $ hg add O
718 $ hg add O
719 $ hg commit -m O
719 $ hg commit -m O
720 $ echo "P" > P
720 $ echo "P" > P
721 $ hg add P
721 $ hg add P
722 $ hg commit -m P
722 $ hg commit -m P
723 $ hg log -G
723 $ hg log -G
724 @ 8:8d47583e023f P
724 @ 8:8d47583e023f P
725 |
725 |
726 o 7:360bbaa7d3ce O
726 o 7:360bbaa7d3ce O
727 |
727 |
728 | o 6:9c48361117de D
728 | o 6:9c48361117de D
729 | |
729 | |
730 o | 4:ff2c4d47b71d C
730 o | 4:ff2c4d47b71d C
731 |/
731 |/
732 o 2:261e70097290 B2
732 o 2:261e70097290 B2
733 |
733 |
734 o 0:4a2df7238c3b A
734 o 0:4a2df7238c3b A
735
735
736 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.stabilization=all
736 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.stabilization=all
737 obsoleted 1 changesets
737 obsoleted 1 changesets
738 $ hg rebase -d 6 -r "4::"
738 $ hg rebase -d 6 -r "4::"
739 rebasing 4:ff2c4d47b71d "C"
739 rebasing 4:ff2c4d47b71d "C"
740 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
740 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
741 rebasing 8:8d47583e023f "P" (tip)
741 rebasing 8:8d47583e023f "P" (tip)
742
742
743 If all the changeset to be rebased are obsolete and present in the destination, we
743 If all the changeset to be rebased are obsolete and present in the destination, we
744 should display a friendly error message
744 should display a friendly error message
745
745
746 $ hg log -G
746 $ hg log -G
747 @ 10:121d9e3bc4c6 P
747 @ 10:121d9e3bc4c6 P
748 |
748 |
749 o 9:4be60e099a77 C
749 o 9:4be60e099a77 C
750 |
750 |
751 o 6:9c48361117de D
751 o 6:9c48361117de D
752 |
752 |
753 o 2:261e70097290 B2
753 o 2:261e70097290 B2
754 |
754 |
755 o 0:4a2df7238c3b A
755 o 0:4a2df7238c3b A
756
756
757
757
758 $ hg up 9
758 $ hg up 9
759 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
759 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
760 $ echo "non-relevant change" > nonrelevant
760 $ echo "non-relevant change" > nonrelevant
761 $ hg add nonrelevant
761 $ hg add nonrelevant
762 $ hg commit -m nonrelevant
762 $ hg commit -m nonrelevant
763 created new head
763 created new head
764 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.stabilization=all
764 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.stabilization=all
765 obsoleted 1 changesets
765 obsoleted 1 changesets
766 $ hg rebase -r . -d 10
766 $ hg rebase -r . -d 10
767 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
767 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
768
768
769 If a rebase is going to create divergence, it should abort
769 If a rebase is going to create divergence, it should abort
770
770
771 $ hg log -G
771 $ hg log -G
772 @ 10:121d9e3bc4c6 P
772 @ 10:121d9e3bc4c6 P
773 |
773 |
774 o 9:4be60e099a77 C
774 o 9:4be60e099a77 C
775 |
775 |
776 o 6:9c48361117de D
776 o 6:9c48361117de D
777 |
777 |
778 o 2:261e70097290 B2
778 o 2:261e70097290 B2
779 |
779 |
780 o 0:4a2df7238c3b A
780 o 0:4a2df7238c3b A
781
781
782
782
783 $ hg up 9
783 $ hg up 9
784 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
784 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
785 $ echo "john" > doe
785 $ echo "john" > doe
786 $ hg add doe
786 $ hg add doe
787 $ hg commit -m "john doe"
787 $ hg commit -m "john doe"
788 created new head
788 created new head
789 $ hg up 10
789 $ hg up 10
790 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
790 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
791 $ echo "foo" > bar
791 $ echo "foo" > bar
792 $ hg add bar
792 $ hg add bar
793 $ hg commit --amend -m "10'"
793 $ hg commit --amend -m "10'"
794 $ hg up 10 --hidden
794 $ hg up 10 --hidden
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 $ echo "bar" > foo
796 $ echo "bar" > foo
797 $ hg add foo
797 $ hg add foo
798 $ hg commit -m "bar foo"
798 $ hg commit -m "bar foo"
799 $ hg log -G
799 $ hg log -G
800 @ 15:73568ab6879d bar foo
800 @ 14:73568ab6879d bar foo
801 |
801 |
802 | o 14:77d874d096a2 10'
802 | o 13:77d874d096a2 10'
803 | |
803 | |
804 | | o 12:3eb461388009 john doe
804 | | o 12:3eb461388009 john doe
805 | |/
805 | |/
806 x | 10:121d9e3bc4c6 P
806 x | 10:121d9e3bc4c6 P
807 |/
807 |/
808 o 9:4be60e099a77 C
808 o 9:4be60e099a77 C
809 |
809 |
810 o 6:9c48361117de D
810 o 6:9c48361117de D
811 |
811 |
812 o 2:261e70097290 B2
812 o 2:261e70097290 B2
813 |
813 |
814 o 0:4a2df7238c3b A
814 o 0:4a2df7238c3b A
815
815
816 $ hg summary
816 $ hg summary
817 parent: 15:73568ab6879d tip (orphan)
817 parent: 14:73568ab6879d tip (orphan)
818 bar foo
818 bar foo
819 branch: default
819 branch: default
820 commit: (clean)
820 commit: (clean)
821 update: 2 new changesets, 3 branch heads (merge)
821 update: 2 new changesets, 3 branch heads (merge)
822 phases: 8 draft
822 phases: 8 draft
823 orphan: 1 changesets
823 orphan: 1 changesets
824 $ hg rebase -s 10 -d 12
824 $ hg rebase -s 10 -d 12
825 abort: this rebase will cause divergences from: 121d9e3bc4c6
825 abort: this rebase will cause divergences from: 121d9e3bc4c6
826 (to force the rebase please set experimental.allowdivergence=True)
826 (to force the rebase please set experimental.allowdivergence=True)
827 [255]
827 [255]
828 $ hg log -G
828 $ hg log -G
829 @ 15:73568ab6879d bar foo
829 @ 14:73568ab6879d bar foo
830 |
830 |
831 | o 14:77d874d096a2 10'
831 | o 13:77d874d096a2 10'
832 | |
832 | |
833 | | o 12:3eb461388009 john doe
833 | | o 12:3eb461388009 john doe
834 | |/
834 | |/
835 x | 10:121d9e3bc4c6 P
835 x | 10:121d9e3bc4c6 P
836 |/
836 |/
837 o 9:4be60e099a77 C
837 o 9:4be60e099a77 C
838 |
838 |
839 o 6:9c48361117de D
839 o 6:9c48361117de D
840 |
840 |
841 o 2:261e70097290 B2
841 o 2:261e70097290 B2
842 |
842 |
843 o 0:4a2df7238c3b A
843 o 0:4a2df7238c3b A
844
844
845 With experimental.allowdivergence=True, rebase can create divergence
845 With experimental.allowdivergence=True, rebase can create divergence
846
846
847 $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True
847 $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True
848 rebasing 10:121d9e3bc4c6 "P"
848 rebasing 10:121d9e3bc4c6 "P"
849 rebasing 15:73568ab6879d "bar foo" (tip)
849 rebasing 14:73568ab6879d "bar foo" (tip)
850 $ hg summary
850 $ hg summary
851 parent: 17:61bd55f69bc4 tip
851 parent: 16:61bd55f69bc4 tip
852 bar foo
852 bar foo
853 branch: default
853 branch: default
854 commit: (clean)
854 commit: (clean)
855 update: 1 new changesets, 2 branch heads (merge)
855 update: 1 new changesets, 2 branch heads (merge)
856 phases: 8 draft
856 phases: 8 draft
857 content-divergent: 2 changesets
857 content-divergent: 2 changesets
858
858
859 rebase --continue + skipped rev because their successors are in destination
859 rebase --continue + skipped rev because their successors are in destination
860 we make a change in trunk and work on conflicting changes to make rebase abort.
860 we make a change in trunk and work on conflicting changes to make rebase abort.
861
861
862 $ hg log -G -r 17::
862 $ hg log -G -r 16::
863 @ 17:61bd55f69bc4 bar foo
863 @ 16:61bd55f69bc4 bar foo
864 |
864 |
865 ~
865 ~
866
866
867 Create the two changes in trunk
867 Create the two changes in trunk
868 $ printf "a" > willconflict
868 $ printf "a" > willconflict
869 $ hg add willconflict
869 $ hg add willconflict
870 $ hg commit -m "willconflict first version"
870 $ hg commit -m "willconflict first version"
871
871
872 $ printf "dummy" > C
872 $ printf "dummy" > C
873 $ hg commit -m "dummy change successor"
873 $ hg commit -m "dummy change successor"
874
874
875 Create the changes that we will rebase
875 Create the changes that we will rebase
876 $ hg update -C 17 -q
876 $ hg update -C 16 -q
877 $ printf "b" > willconflict
877 $ printf "b" > willconflict
878 $ hg add willconflict
878 $ hg add willconflict
879 $ hg commit -m "willconflict second version"
879 $ hg commit -m "willconflict second version"
880 created new head
880 created new head
881 $ printf "dummy" > K
881 $ printf "dummy" > K
882 $ hg add K
882 $ hg add K
883 $ hg commit -m "dummy change"
883 $ hg commit -m "dummy change"
884 $ printf "dummy" > L
884 $ printf "dummy" > L
885 $ hg add L
885 $ hg add L
886 $ hg commit -m "dummy change"
886 $ hg commit -m "dummy change"
887 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 19 -T '{node}'` --config experimental.stabilization=all
887 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.stabilization=all
888 obsoleted 1 changesets
888 obsoleted 1 changesets
889
889
890 $ hg log -G -r 17::
890 $ hg log -G -r 16::
891 @ 22:7bdc8a87673d dummy change
891 @ 21:7bdc8a87673d dummy change
892 |
892 |
893 x 21:8b31da3c4919 dummy change
893 x 20:8b31da3c4919 dummy change
894 |
894 |
895 o 20:b82fb57ea638 willconflict second version
895 o 19:b82fb57ea638 willconflict second version
896 |
896 |
897 | o 19:601db7a18f51 dummy change successor
897 | o 18:601db7a18f51 dummy change successor
898 | |
898 | |
899 | o 18:357ddf1602d5 willconflict first version
899 | o 17:357ddf1602d5 willconflict first version
900 |/
900 |/
901 o 17:61bd55f69bc4 bar foo
901 o 16:61bd55f69bc4 bar foo
902 |
902 |
903 ~
903 ~
904 $ hg rebase -r ".^^ + .^ + ." -d 19
904 $ hg rebase -r ".^^ + .^ + ." -d 18
905 rebasing 20:b82fb57ea638 "willconflict second version"
905 rebasing 19:b82fb57ea638 "willconflict second version"
906 merging willconflict
906 merging willconflict
907 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
907 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
908 unresolved conflicts (see hg resolve, then hg rebase --continue)
908 unresolved conflicts (see hg resolve, then hg rebase --continue)
909 [1]
909 [1]
910
910
911 $ hg resolve --mark willconflict
911 $ hg resolve --mark willconflict
912 (no more unresolved files)
912 (no more unresolved files)
913 continue: hg rebase --continue
913 continue: hg rebase --continue
914 $ hg rebase --continue
914 $ hg rebase --continue
915 rebasing 20:b82fb57ea638 "willconflict second version"
915 rebasing 19:b82fb57ea638 "willconflict second version"
916 note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor"
916 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
917 rebasing 22:7bdc8a87673d "dummy change" (tip)
917 rebasing 21:7bdc8a87673d "dummy change" (tip)
918 $ cd ..
918 $ cd ..
919
919
920 Rebase merge where successor of one parent is equal to destination (issue5198)
920 Rebase merge where successor of one parent is equal to destination (issue5198)
921
921
922 $ hg init p1-succ-is-dest
922 $ hg init p1-succ-is-dest
923 $ cd p1-succ-is-dest
923 $ cd p1-succ-is-dest
924
924
925 $ hg debugdrawdag <<EOF
925 $ hg debugdrawdag <<EOF
926 > F
926 > F
927 > /|
927 > /|
928 > E D B # replace: D -> B
928 > E D B # replace: D -> B
929 > \|/
929 > \|/
930 > A
930 > A
931 > EOF
931 > EOF
932
932
933 $ hg rebase -d B -s D
933 $ hg rebase -d B -s D
934 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
934 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
935 rebasing 4:66f1a38021c9 "F" (F tip)
935 rebasing 4:66f1a38021c9 "F" (F tip)
936 $ hg log -G
936 $ hg log -G
937 o 5:50e9d60b99c6 F
937 o 5:50e9d60b99c6 F
938 |\
938 |\
939 | | x 4:66f1a38021c9 F
939 | | x 4:66f1a38021c9 F
940 | |/|
940 | |/|
941 | o | 3:7fb047a69f22 E
941 | o | 3:7fb047a69f22 E
942 | | |
942 | | |
943 | | x 2:b18e25de2cf5 D
943 | | x 2:b18e25de2cf5 D
944 | |/
944 | |/
945 o | 1:112478962961 B
945 o | 1:112478962961 B
946 |/
946 |/
947 o 0:426bada5c675 A
947 o 0:426bada5c675 A
948
948
949 $ cd ..
949 $ cd ..
950
950
951 Rebase merge where successor of other parent is equal to destination
951 Rebase merge where successor of other parent is equal to destination
952
952
953 $ hg init p2-succ-is-dest
953 $ hg init p2-succ-is-dest
954 $ cd p2-succ-is-dest
954 $ cd p2-succ-is-dest
955
955
956 $ hg debugdrawdag <<EOF
956 $ hg debugdrawdag <<EOF
957 > F
957 > F
958 > /|
958 > /|
959 > E D B # replace: E -> B
959 > E D B # replace: E -> B
960 > \|/
960 > \|/
961 > A
961 > A
962 > EOF
962 > EOF
963
963
964 $ hg rebase -d B -s E
964 $ hg rebase -d B -s E
965 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
965 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
966 rebasing 4:66f1a38021c9 "F" (F tip)
966 rebasing 4:66f1a38021c9 "F" (F tip)
967 $ hg log -G
967 $ hg log -G
968 o 5:aae1787dacee F
968 o 5:aae1787dacee F
969 |\
969 |\
970 | | x 4:66f1a38021c9 F
970 | | x 4:66f1a38021c9 F
971 | |/|
971 | |/|
972 | | x 3:7fb047a69f22 E
972 | | x 3:7fb047a69f22 E
973 | | |
973 | | |
974 | o | 2:b18e25de2cf5 D
974 | o | 2:b18e25de2cf5 D
975 | |/
975 | |/
976 o / 1:112478962961 B
976 o / 1:112478962961 B
977 |/
977 |/
978 o 0:426bada5c675 A
978 o 0:426bada5c675 A
979
979
980 $ cd ..
980 $ cd ..
981
981
982 Rebase merge where successor of one parent is ancestor of destination
982 Rebase merge where successor of one parent is ancestor of destination
983
983
984 $ hg init p1-succ-in-dest
984 $ hg init p1-succ-in-dest
985 $ cd p1-succ-in-dest
985 $ cd p1-succ-in-dest
986
986
987 $ hg debugdrawdag <<EOF
987 $ hg debugdrawdag <<EOF
988 > F C
988 > F C
989 > /| |
989 > /| |
990 > E D B # replace: D -> B
990 > E D B # replace: D -> B
991 > \|/
991 > \|/
992 > A
992 > A
993 > EOF
993 > EOF
994
994
995 $ hg rebase -d C -s D
995 $ hg rebase -d C -s D
996 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
996 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
997 rebasing 5:66f1a38021c9 "F" (F tip)
997 rebasing 5:66f1a38021c9 "F" (F tip)
998
998
999 $ hg log -G
999 $ hg log -G
1000 o 6:0913febf6439 F
1000 o 6:0913febf6439 F
1001 |\
1001 |\
1002 +---x 5:66f1a38021c9 F
1002 +---x 5:66f1a38021c9 F
1003 | | |
1003 | | |
1004 | o | 4:26805aba1e60 C
1004 | o | 4:26805aba1e60 C
1005 | | |
1005 | | |
1006 o | | 3:7fb047a69f22 E
1006 o | | 3:7fb047a69f22 E
1007 | | |
1007 | | |
1008 +---x 2:b18e25de2cf5 D
1008 +---x 2:b18e25de2cf5 D
1009 | |
1009 | |
1010 | o 1:112478962961 B
1010 | o 1:112478962961 B
1011 |/
1011 |/
1012 o 0:426bada5c675 A
1012 o 0:426bada5c675 A
1013
1013
1014 $ cd ..
1014 $ cd ..
1015
1015
1016 Rebase merge where successor of other parent is ancestor of destination
1016 Rebase merge where successor of other parent is ancestor of destination
1017
1017
1018 $ hg init p2-succ-in-dest
1018 $ hg init p2-succ-in-dest
1019 $ cd p2-succ-in-dest
1019 $ cd p2-succ-in-dest
1020
1020
1021 $ hg debugdrawdag <<EOF
1021 $ hg debugdrawdag <<EOF
1022 > F C
1022 > F C
1023 > /| |
1023 > /| |
1024 > E D B # replace: E -> B
1024 > E D B # replace: E -> B
1025 > \|/
1025 > \|/
1026 > A
1026 > A
1027 > EOF
1027 > EOF
1028
1028
1029 $ hg rebase -d C -s E
1029 $ hg rebase -d C -s E
1030 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1030 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1031 rebasing 5:66f1a38021c9 "F" (F tip)
1031 rebasing 5:66f1a38021c9 "F" (F tip)
1032 $ hg log -G
1032 $ hg log -G
1033 o 6:c6ab0cc6d220 F
1033 o 6:c6ab0cc6d220 F
1034 |\
1034 |\
1035 +---x 5:66f1a38021c9 F
1035 +---x 5:66f1a38021c9 F
1036 | | |
1036 | | |
1037 | o | 4:26805aba1e60 C
1037 | o | 4:26805aba1e60 C
1038 | | |
1038 | | |
1039 | | x 3:7fb047a69f22 E
1039 | | x 3:7fb047a69f22 E
1040 | | |
1040 | | |
1041 o---+ 2:b18e25de2cf5 D
1041 o---+ 2:b18e25de2cf5 D
1042 / /
1042 / /
1043 o / 1:112478962961 B
1043 o / 1:112478962961 B
1044 |/
1044 |/
1045 o 0:426bada5c675 A
1045 o 0:426bada5c675 A
1046
1046
1047 $ cd ..
1047 $ cd ..
1048
1048
1049 Rebase merge where successor of one parent is ancestor of destination
1049 Rebase merge where successor of one parent is ancestor of destination
1050
1050
1051 $ hg init p1-succ-in-dest-b
1051 $ hg init p1-succ-in-dest-b
1052 $ cd p1-succ-in-dest-b
1052 $ cd p1-succ-in-dest-b
1053
1053
1054 $ hg debugdrawdag <<EOF
1054 $ hg debugdrawdag <<EOF
1055 > F C
1055 > F C
1056 > /| |
1056 > /| |
1057 > E D B # replace: E -> B
1057 > E D B # replace: E -> B
1058 > \|/
1058 > \|/
1059 > A
1059 > A
1060 > EOF
1060 > EOF
1061
1061
1062 $ hg rebase -d C -b F
1062 $ hg rebase -d C -b F
1063 rebasing 2:b18e25de2cf5 "D" (D)
1063 rebasing 2:b18e25de2cf5 "D" (D)
1064 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1064 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1065 rebasing 5:66f1a38021c9 "F" (F tip)
1065 rebasing 5:66f1a38021c9 "F" (F tip)
1066 note: rebase of 5:66f1a38021c9 created no changes to commit
1066 note: rebase of 5:66f1a38021c9 created no changes to commit
1067 $ hg log -G
1067 $ hg log -G
1068 o 6:8f47515dda15 D
1068 o 6:8f47515dda15 D
1069 |
1069 |
1070 | x 5:66f1a38021c9 F
1070 | x 5:66f1a38021c9 F
1071 | |\
1071 | |\
1072 o | | 4:26805aba1e60 C
1072 o | | 4:26805aba1e60 C
1073 | | |
1073 | | |
1074 | | x 3:7fb047a69f22 E
1074 | | x 3:7fb047a69f22 E
1075 | | |
1075 | | |
1076 | x | 2:b18e25de2cf5 D
1076 | x | 2:b18e25de2cf5 D
1077 | |/
1077 | |/
1078 o / 1:112478962961 B
1078 o / 1:112478962961 B
1079 |/
1079 |/
1080 o 0:426bada5c675 A
1080 o 0:426bada5c675 A
1081
1081
1082 $ cd ..
1082 $ cd ..
1083
1083
1084 Rebase merge where successor of other parent is ancestor of destination
1084 Rebase merge where successor of other parent is ancestor of destination
1085
1085
1086 $ hg init p2-succ-in-dest-b
1086 $ hg init p2-succ-in-dest-b
1087 $ cd p2-succ-in-dest-b
1087 $ cd p2-succ-in-dest-b
1088
1088
1089 $ hg debugdrawdag <<EOF
1089 $ hg debugdrawdag <<EOF
1090 > F C
1090 > F C
1091 > /| |
1091 > /| |
1092 > E D B # replace: D -> B
1092 > E D B # replace: D -> B
1093 > \|/
1093 > \|/
1094 > A
1094 > A
1095 > EOF
1095 > EOF
1096
1096
1097 $ hg rebase -d C -b F
1097 $ hg rebase -d C -b F
1098 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1098 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1099 rebasing 3:7fb047a69f22 "E" (E)
1099 rebasing 3:7fb047a69f22 "E" (E)
1100 rebasing 5:66f1a38021c9 "F" (F tip)
1100 rebasing 5:66f1a38021c9 "F" (F tip)
1101 note: rebase of 5:66f1a38021c9 created no changes to commit
1101 note: rebase of 5:66f1a38021c9 created no changes to commit
1102
1102
1103 $ hg log -G
1103 $ hg log -G
1104 o 6:533690786a86 E
1104 o 6:533690786a86 E
1105 |
1105 |
1106 | x 5:66f1a38021c9 F
1106 | x 5:66f1a38021c9 F
1107 | |\
1107 | |\
1108 o | | 4:26805aba1e60 C
1108 o | | 4:26805aba1e60 C
1109 | | |
1109 | | |
1110 | | x 3:7fb047a69f22 E
1110 | | x 3:7fb047a69f22 E
1111 | | |
1111 | | |
1112 | x | 2:b18e25de2cf5 D
1112 | x | 2:b18e25de2cf5 D
1113 | |/
1113 | |/
1114 o / 1:112478962961 B
1114 o / 1:112478962961 B
1115 |/
1115 |/
1116 o 0:426bada5c675 A
1116 o 0:426bada5c675 A
1117
1117
1118 $ cd ..
1118 $ cd ..
1119
1119
1120 Rebase merge where both parents have successors in destination
1120 Rebase merge where both parents have successors in destination
1121
1121
1122 $ hg init p12-succ-in-dest
1122 $ hg init p12-succ-in-dest
1123 $ cd p12-succ-in-dest
1123 $ cd p12-succ-in-dest
1124 $ hg debugdrawdag <<'EOS'
1124 $ hg debugdrawdag <<'EOS'
1125 > E F
1125 > E F
1126 > /| /| # replace: A -> C
1126 > /| /| # replace: A -> C
1127 > A B C D # replace: B -> D
1127 > A B C D # replace: B -> D
1128 > | |
1128 > | |
1129 > X Y
1129 > X Y
1130 > EOS
1130 > EOS
1131 $ hg rebase -r A+B+E -d F
1131 $ hg rebase -r A+B+E -d F
1132 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1132 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1133 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1133 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1134 rebasing 7:dac5d11c5a7d "E" (E tip)
1134 rebasing 7:dac5d11c5a7d "E" (E tip)
1135 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1135 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1136 [255]
1136 [255]
1137 $ cd ..
1137 $ cd ..
1138
1138
1139 Rebase a non-clean merge. One parent has successor in destination, the other
1139 Rebase a non-clean merge. One parent has successor in destination, the other
1140 parent moves as requested.
1140 parent moves as requested.
1141
1141
1142 $ hg init p1-succ-p2-move
1142 $ hg init p1-succ-p2-move
1143 $ cd p1-succ-p2-move
1143 $ cd p1-succ-p2-move
1144 $ hg debugdrawdag <<'EOS'
1144 $ hg debugdrawdag <<'EOS'
1145 > D Z
1145 > D Z
1146 > /| | # replace: A -> C
1146 > /| | # replace: A -> C
1147 > A B C # D/D = D
1147 > A B C # D/D = D
1148 > EOS
1148 > EOS
1149 $ hg rebase -r A+B+D -d Z
1149 $ hg rebase -r A+B+D -d Z
1150 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1150 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1151 rebasing 1:fc2b737bb2e5 "B" (B)
1151 rebasing 1:fc2b737bb2e5 "B" (B)
1152 rebasing 3:b8ed089c80ad "D" (D)
1152 rebasing 3:b8ed089c80ad "D" (D)
1153
1153
1154 $ rm .hg/localtags
1154 $ rm .hg/localtags
1155 $ hg log -G
1155 $ hg log -G
1156 o 6:e4f78693cc88 D
1156 o 6:e4f78693cc88 D
1157 |
1157 |
1158 o 5:76840d832e98 B
1158 o 5:76840d832e98 B
1159 |
1159 |
1160 o 4:50e41c1f3950 Z
1160 o 4:50e41c1f3950 Z
1161 |
1161 |
1162 o 2:96cc3511f894 C
1162 o 2:96cc3511f894 C
1163
1163
1164 $ hg files -r tip
1164 $ hg files -r tip
1165 B
1165 B
1166 C
1166 C
1167 D
1167 D
1168 Z
1168 Z
1169
1169
1170 $ cd ..
1170 $ cd ..
1171
1171
1172 $ hg init p1-move-p2-succ
1172 $ hg init p1-move-p2-succ
1173 $ cd p1-move-p2-succ
1173 $ cd p1-move-p2-succ
1174 $ hg debugdrawdag <<'EOS'
1174 $ hg debugdrawdag <<'EOS'
1175 > D Z
1175 > D Z
1176 > /| | # replace: B -> C
1176 > /| | # replace: B -> C
1177 > A B C # D/D = D
1177 > A B C # D/D = D
1178 > EOS
1178 > EOS
1179 $ hg rebase -r B+A+D -d Z
1179 $ hg rebase -r B+A+D -d Z
1180 rebasing 0:426bada5c675 "A" (A)
1180 rebasing 0:426bada5c675 "A" (A)
1181 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1181 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1182 rebasing 3:b8ed089c80ad "D" (D)
1182 rebasing 3:b8ed089c80ad "D" (D)
1183
1183
1184 $ rm .hg/localtags
1184 $ rm .hg/localtags
1185 $ hg log -G
1185 $ hg log -G
1186 o 6:1b355ed94d82 D
1186 o 6:1b355ed94d82 D
1187 |
1187 |
1188 o 5:a81a74d764a6 A
1188 o 5:a81a74d764a6 A
1189 |
1189 |
1190 o 4:50e41c1f3950 Z
1190 o 4:50e41c1f3950 Z
1191 |
1191 |
1192 o 2:96cc3511f894 C
1192 o 2:96cc3511f894 C
1193
1193
1194 $ hg files -r tip
1194 $ hg files -r tip
1195 A
1195 A
1196 C
1196 C
1197 D
1197 D
1198 Z
1198 Z
1199
1199
1200 $ cd ..
1200 $ cd ..
1201
1201
1202 Test that bookmark is moved and working dir is updated when all changesets have
1202 Test that bookmark is moved and working dir is updated when all changesets have
1203 equivalents in destination
1203 equivalents in destination
1204 $ hg init rbsrepo && cd rbsrepo
1204 $ hg init rbsrepo && cd rbsrepo
1205 $ echo "[experimental]" > .hg/hgrc
1205 $ echo "[experimental]" > .hg/hgrc
1206 $ echo "stabilization=all" >> .hg/hgrc
1206 $ echo "stabilization=all" >> .hg/hgrc
1207 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1207 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1208 $ echo root > root && hg ci -Am root
1208 $ echo root > root && hg ci -Am root
1209 adding root
1209 adding root
1210 $ echo a > a && hg ci -Am a
1210 $ echo a > a && hg ci -Am a
1211 adding a
1211 adding a
1212 $ hg up 0
1212 $ hg up 0
1213 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1213 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1214 $ echo b > b && hg ci -Am b
1214 $ echo b > b && hg ci -Am b
1215 adding b
1215 adding b
1216 created new head
1216 created new head
1217 $ hg rebase -r 2 -d 1
1217 $ hg rebase -r 2 -d 1
1218 rebasing 2:1e9a3c00cbe9 "b" (tip)
1218 rebasing 2:1e9a3c00cbe9 "b" (tip)
1219 $ hg log -r . # working dir is at rev 3 (successor of 2)
1219 $ hg log -r . # working dir is at rev 3 (successor of 2)
1220 3:be1832deae9a b (no-eol)
1220 3:be1832deae9a b (no-eol)
1221 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1221 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1222 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1222 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1223 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1223 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1224 2:1e9a3c00cbe9 b (no-eol)
1224 2:1e9a3c00cbe9 b (no-eol)
1225 $ hg rebase -r 2 -d 3 --config experimental.stabilization.track-operation=1
1225 $ hg rebase -r 2 -d 3 --config experimental.stabilization.track-operation=1
1226 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1226 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1227 Check that working directory and bookmark was updated to rev 3 although rev 2
1227 Check that working directory and bookmark was updated to rev 3 although rev 2
1228 was skipped
1228 was skipped
1229 $ hg log -r .
1229 $ hg log -r .
1230 3:be1832deae9a b (no-eol)
1230 3:be1832deae9a b (no-eol)
1231 $ hg bookmarks
1231 $ hg bookmarks
1232 mybook 3:be1832deae9a
1232 mybook 3:be1832deae9a
1233 $ hg debugobsolete --rev tip
1233 $ hg debugobsolete --rev tip
1234 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (*) {'user': 'test'} (glob)
1234 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (*) {'user': 'test'} (glob)
1235
1235
1236 Obsoleted working parent and bookmark could be moved if an ancestor of working
1236 Obsoleted working parent and bookmark could be moved if an ancestor of working
1237 parent gets moved:
1237 parent gets moved:
1238
1238
1239 $ hg init $TESTTMP/ancestor-wd-move
1239 $ hg init $TESTTMP/ancestor-wd-move
1240 $ cd $TESTTMP/ancestor-wd-move
1240 $ cd $TESTTMP/ancestor-wd-move
1241 $ hg debugdrawdag <<'EOS'
1241 $ hg debugdrawdag <<'EOS'
1242 > E D1 # rebase: D1 -> D2
1242 > E D1 # rebase: D1 -> D2
1243 > | |
1243 > | |
1244 > | C
1244 > | C
1245 > D2 |
1245 > D2 |
1246 > | B
1246 > | B
1247 > |/
1247 > |/
1248 > A
1248 > A
1249 > EOS
1249 > EOS
1250 $ hg update D1 -q
1250 $ hg update D1 -q
1251 $ hg bookmark book -i
1251 $ hg bookmark book -i
1252 $ hg rebase -r B+D1 -d E
1252 $ hg rebase -r B+D1 -d E
1253 rebasing 1:112478962961 "B" (B)
1253 rebasing 1:112478962961 "B" (B)
1254 note: not rebasing 5:15ecf15e0114 "D1" (D1 tip book), already in destination as 2:0807738e0be9 "D2" (D2)
1254 note: not rebasing 5:15ecf15e0114 "D1" (D1 tip book), already in destination as 2:0807738e0be9 "D2" (D2)
1255 $ hg log -G -T '{desc} {bookmarks}'
1255 $ hg log -G -T '{desc} {bookmarks}'
1256 @ B book
1256 @ B book
1257 |
1257 |
1258 | x D1
1258 | x D1
1259 | |
1259 | |
1260 o | E
1260 o | E
1261 | |
1261 | |
1262 | o C
1262 | o C
1263 | |
1263 | |
1264 o | D2
1264 o | D2
1265 | |
1265 | |
1266 | x B
1266 | x B
1267 |/
1267 |/
1268 o A
1268 o A
1269
1269
@@ -1,869 +1,869 b''
1 #require killdaemons
1 #require killdaemons
2
2
3 $ cat << EOF >> $HGRCPATH
3 $ cat << EOF >> $HGRCPATH
4 > [format]
4 > [format]
5 > usegeneraldelta=yes
5 > usegeneraldelta=yes
6 > [ui]
6 > [ui]
7 > ssh=$PYTHON "$TESTDIR/dummyssh"
7 > ssh=$PYTHON "$TESTDIR/dummyssh"
8 > EOF
8 > EOF
9
9
10 Set up repo
10 Set up repo
11
11
12 $ hg --config experimental.treemanifest=True init repo
12 $ hg --config experimental.treemanifest=True init repo
13 $ cd repo
13 $ cd repo
14
14
15 Requirements get set on init
15 Requirements get set on init
16
16
17 $ grep treemanifest .hg/requires
17 $ grep treemanifest .hg/requires
18 treemanifest
18 treemanifest
19
19
20 Without directories, looks like any other repo
20 Without directories, looks like any other repo
21
21
22 $ echo 0 > a
22 $ echo 0 > a
23 $ echo 0 > b
23 $ echo 0 > b
24 $ hg ci -Aqm initial
24 $ hg ci -Aqm initial
25 $ hg debugdata -m 0
25 $ hg debugdata -m 0
26 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
26 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
27 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
27 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
28
28
29 Submanifest is stored in separate revlog
29 Submanifest is stored in separate revlog
30
30
31 $ mkdir dir1
31 $ mkdir dir1
32 $ echo 1 > dir1/a
32 $ echo 1 > dir1/a
33 $ echo 1 > dir1/b
33 $ echo 1 > dir1/b
34 $ echo 1 > e
34 $ echo 1 > e
35 $ hg ci -Aqm 'add dir1'
35 $ hg ci -Aqm 'add dir1'
36 $ hg debugdata -m 1
36 $ hg debugdata -m 1
37 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
37 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
38 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
38 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
39 dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44et (esc)
39 dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44et (esc)
40 e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
40 e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
41 $ hg debugdata --dir dir1 0
41 $ hg debugdata --dir dir1 0
42 a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
42 a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
43 b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
43 b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
44
44
45 Can add nested directories
45 Can add nested directories
46
46
47 $ mkdir dir1/dir1
47 $ mkdir dir1/dir1
48 $ echo 2 > dir1/dir1/a
48 $ echo 2 > dir1/dir1/a
49 $ echo 2 > dir1/dir1/b
49 $ echo 2 > dir1/dir1/b
50 $ mkdir dir1/dir2
50 $ mkdir dir1/dir2
51 $ echo 2 > dir1/dir2/a
51 $ echo 2 > dir1/dir2/a
52 $ echo 2 > dir1/dir2/b
52 $ echo 2 > dir1/dir2/b
53 $ hg ci -Aqm 'add dir1/dir1'
53 $ hg ci -Aqm 'add dir1/dir1'
54 $ hg files -r .
54 $ hg files -r .
55 a
55 a
56 b
56 b
57 dir1/a (glob)
57 dir1/a (glob)
58 dir1/b (glob)
58 dir1/b (glob)
59 dir1/dir1/a (glob)
59 dir1/dir1/a (glob)
60 dir1/dir1/b (glob)
60 dir1/dir1/b (glob)
61 dir1/dir2/a (glob)
61 dir1/dir2/a (glob)
62 dir1/dir2/b (glob)
62 dir1/dir2/b (glob)
63 e
63 e
64
64
65 The manifest command works
65 The manifest command works
66
66
67 $ hg manifest
67 $ hg manifest
68 a
68 a
69 b
69 b
70 dir1/a
70 dir1/a
71 dir1/b
71 dir1/b
72 dir1/dir1/a
72 dir1/dir1/a
73 dir1/dir1/b
73 dir1/dir1/b
74 dir1/dir2/a
74 dir1/dir2/a
75 dir1/dir2/b
75 dir1/dir2/b
76 e
76 e
77
77
78 Revision is not created for unchanged directory
78 Revision is not created for unchanged directory
79
79
80 $ mkdir dir2
80 $ mkdir dir2
81 $ echo 3 > dir2/a
81 $ echo 3 > dir2/a
82 $ hg add dir2
82 $ hg add dir2
83 adding dir2/a (glob)
83 adding dir2/a (glob)
84 $ hg debugindex --dir dir1 > before
84 $ hg debugindex --dir dir1 > before
85 $ hg ci -qm 'add dir2'
85 $ hg ci -qm 'add dir2'
86 $ hg debugindex --dir dir1 > after
86 $ hg debugindex --dir dir1 > after
87 $ diff before after
87 $ diff before after
88 $ rm before after
88 $ rm before after
89
89
90 Removing directory does not create an revlog entry
90 Removing directory does not create an revlog entry
91
91
92 $ hg rm dir1/dir1
92 $ hg rm dir1/dir1
93 removing dir1/dir1/a (glob)
93 removing dir1/dir1/a (glob)
94 removing dir1/dir1/b (glob)
94 removing dir1/dir1/b (glob)
95 $ hg debugindex --dir dir1/dir1 > before
95 $ hg debugindex --dir dir1/dir1 > before
96 $ hg ci -qm 'remove dir1/dir1'
96 $ hg ci -qm 'remove dir1/dir1'
97 $ hg debugindex --dir dir1/dir1 > after
97 $ hg debugindex --dir dir1/dir1 > after
98 $ diff before after
98 $ diff before after
99 $ rm before after
99 $ rm before after
100
100
101 Check that hg files (calls treemanifest.walk()) works
101 Check that hg files (calls treemanifest.walk()) works
102 without loading all directory revlogs
102 without loading all directory revlogs
103
103
104 $ hg co 'desc("add dir2")'
104 $ hg co 'desc("add dir2")'
105 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 $ mv .hg/store/meta/dir2 .hg/store/meta/dir2-backup
106 $ mv .hg/store/meta/dir2 .hg/store/meta/dir2-backup
107 $ hg files -r . dir1
107 $ hg files -r . dir1
108 dir1/a (glob)
108 dir1/a (glob)
109 dir1/b (glob)
109 dir1/b (glob)
110 dir1/dir1/a (glob)
110 dir1/dir1/a (glob)
111 dir1/dir1/b (glob)
111 dir1/dir1/b (glob)
112 dir1/dir2/a (glob)
112 dir1/dir2/a (glob)
113 dir1/dir2/b (glob)
113 dir1/dir2/b (glob)
114
114
115 Check that status between revisions works (calls treemanifest.matches())
115 Check that status between revisions works (calls treemanifest.matches())
116 without loading all directory revlogs
116 without loading all directory revlogs
117
117
118 $ hg status --rev 'desc("add dir1")' --rev . dir1
118 $ hg status --rev 'desc("add dir1")' --rev . dir1
119 A dir1/dir1/a
119 A dir1/dir1/a
120 A dir1/dir1/b
120 A dir1/dir1/b
121 A dir1/dir2/a
121 A dir1/dir2/a
122 A dir1/dir2/b
122 A dir1/dir2/b
123 $ mv .hg/store/meta/dir2-backup .hg/store/meta/dir2
123 $ mv .hg/store/meta/dir2-backup .hg/store/meta/dir2
124
124
125 Merge creates 2-parent revision of directory revlog
125 Merge creates 2-parent revision of directory revlog
126
126
127 $ echo 5 > dir1/a
127 $ echo 5 > dir1/a
128 $ hg ci -Aqm 'modify dir1/a'
128 $ hg ci -Aqm 'modify dir1/a'
129 $ hg co '.^'
129 $ hg co '.^'
130 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
131 $ echo 6 > dir1/b
131 $ echo 6 > dir1/b
132 $ hg ci -Aqm 'modify dir1/b'
132 $ hg ci -Aqm 'modify dir1/b'
133 $ hg merge 'desc("modify dir1/a")'
133 $ hg merge 'desc("modify dir1/a")'
134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 (branch merge, don't forget to commit)
135 (branch merge, don't forget to commit)
136 $ hg ci -m 'conflict-free merge involving dir1/'
136 $ hg ci -m 'conflict-free merge involving dir1/'
137 $ cat dir1/a
137 $ cat dir1/a
138 5
138 5
139 $ cat dir1/b
139 $ cat dir1/b
140 6
140 6
141 $ hg debugindex --dir dir1
141 $ hg debugindex --dir dir1
142 rev offset length delta linkrev nodeid p1 p2
142 rev offset length delta linkrev nodeid p1 p2
143 0 0 54 -1 1 8b3ffd73f901 000000000000 000000000000
143 0 0 54 -1 1 8b3ffd73f901 000000000000 000000000000
144 1 54 68 0 2 68e9d057c5a8 8b3ffd73f901 000000000000
144 1 54 68 0 2 68e9d057c5a8 8b3ffd73f901 000000000000
145 2 122 12 1 4 4698198d2624 68e9d057c5a8 000000000000
145 2 122 12 1 4 4698198d2624 68e9d057c5a8 000000000000
146 3 134 55 1 5 44844058ccce 68e9d057c5a8 000000000000
146 3 134 55 1 5 44844058ccce 68e9d057c5a8 000000000000
147 4 189 55 1 6 bf3d9b744927 68e9d057c5a8 000000000000
147 4 189 55 1 6 bf3d9b744927 68e9d057c5a8 000000000000
148 5 244 55 4 7 dde7c0af2a03 bf3d9b744927 44844058ccce
148 5 244 55 4 7 dde7c0af2a03 bf3d9b744927 44844058ccce
149
149
150 Merge keeping directory from parent 1 does not create revlog entry. (Note that
150 Merge keeping directory from parent 1 does not create revlog entry. (Note that
151 dir1's manifest does change, but only because dir1/a's filelog changes.)
151 dir1's manifest does change, but only because dir1/a's filelog changes.)
152
152
153 $ hg co 'desc("add dir2")'
153 $ hg co 'desc("add dir2")'
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ echo 8 > dir2/a
155 $ echo 8 > dir2/a
156 $ hg ci -m 'modify dir2/a'
156 $ hg ci -m 'modify dir2/a'
157 created new head
157 created new head
158
158
159 $ hg debugindex --dir dir2 > before
159 $ hg debugindex --dir dir2 > before
160 $ hg merge 'desc("modify dir1/a")'
160 $ hg merge 'desc("modify dir1/a")'
161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 (branch merge, don't forget to commit)
162 (branch merge, don't forget to commit)
163 $ hg revert -r 'desc("modify dir2/a")' .
163 $ hg revert -r 'desc("modify dir2/a")' .
164 reverting dir1/a (glob)
164 reverting dir1/a (glob)
165 $ hg ci -m 'merge, keeping parent 1'
165 $ hg ci -m 'merge, keeping parent 1'
166 $ hg debugindex --dir dir2 > after
166 $ hg debugindex --dir dir2 > after
167 $ diff before after
167 $ diff before after
168 $ rm before after
168 $ rm before after
169
169
170 Merge keeping directory from parent 2 does not create revlog entry. (Note that
170 Merge keeping directory from parent 2 does not create revlog entry. (Note that
171 dir2's manifest does change, but only because dir2/a's filelog changes.)
171 dir2's manifest does change, but only because dir2/a's filelog changes.)
172
172
173 $ hg co 'desc("modify dir2/a")'
173 $ hg co 'desc("modify dir2/a")'
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 $ hg debugindex --dir dir1 > before
175 $ hg debugindex --dir dir1 > before
176 $ hg merge 'desc("modify dir1/a")'
176 $ hg merge 'desc("modify dir1/a")'
177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 (branch merge, don't forget to commit)
178 (branch merge, don't forget to commit)
179 $ hg revert -r 'desc("modify dir1/a")' .
179 $ hg revert -r 'desc("modify dir1/a")' .
180 reverting dir2/a (glob)
180 reverting dir2/a (glob)
181 $ hg ci -m 'merge, keeping parent 2'
181 $ hg ci -m 'merge, keeping parent 2'
182 created new head
182 created new head
183 $ hg debugindex --dir dir1 > after
183 $ hg debugindex --dir dir1 > after
184 $ diff before after
184 $ diff before after
185 $ rm before after
185 $ rm before after
186
186
187 Create flat source repo for tests with mixed flat/tree manifests
187 Create flat source repo for tests with mixed flat/tree manifests
188
188
189 $ cd ..
189 $ cd ..
190 $ hg init repo-flat
190 $ hg init repo-flat
191 $ cd repo-flat
191 $ cd repo-flat
192
192
193 Create a few commits with flat manifest
193 Create a few commits with flat manifest
194
194
195 $ echo 0 > a
195 $ echo 0 > a
196 $ echo 0 > b
196 $ echo 0 > b
197 $ echo 0 > e
197 $ echo 0 > e
198 $ for d in dir1 dir1/dir1 dir1/dir2 dir2
198 $ for d in dir1 dir1/dir1 dir1/dir2 dir2
199 > do
199 > do
200 > mkdir $d
200 > mkdir $d
201 > echo 0 > $d/a
201 > echo 0 > $d/a
202 > echo 0 > $d/b
202 > echo 0 > $d/b
203 > done
203 > done
204 $ hg ci -Aqm initial
204 $ hg ci -Aqm initial
205
205
206 $ echo 1 > a
206 $ echo 1 > a
207 $ echo 1 > dir1/a
207 $ echo 1 > dir1/a
208 $ echo 1 > dir1/dir1/a
208 $ echo 1 > dir1/dir1/a
209 $ hg ci -Aqm 'modify on branch 1'
209 $ hg ci -Aqm 'modify on branch 1'
210
210
211 $ hg co 0
211 $ hg co 0
212 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 $ echo 2 > b
213 $ echo 2 > b
214 $ echo 2 > dir1/b
214 $ echo 2 > dir1/b
215 $ echo 2 > dir1/dir1/b
215 $ echo 2 > dir1/dir1/b
216 $ hg ci -Aqm 'modify on branch 2'
216 $ hg ci -Aqm 'modify on branch 2'
217
217
218 $ hg merge 1
218 $ hg merge 1
219 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 (branch merge, don't forget to commit)
220 (branch merge, don't forget to commit)
221 $ hg ci -m 'merge of flat manifests to new flat manifest'
221 $ hg ci -m 'merge of flat manifests to new flat manifest'
222
222
223 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log
223 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log
224 $ cat hg.pid >> $DAEMON_PIDS
224 $ cat hg.pid >> $DAEMON_PIDS
225
225
226 Create clone with tree manifests enabled
226 Create clone with tree manifests enabled
227
227
228 $ cd ..
228 $ cd ..
229 $ hg clone --config experimental.treemanifest=1 \
229 $ hg clone --config experimental.treemanifest=1 \
230 > http://localhost:$HGPORT repo-mixed -r 1
230 > http://localhost:$HGPORT repo-mixed -r 1
231 adding changesets
231 adding changesets
232 adding manifests
232 adding manifests
233 adding file changes
233 adding file changes
234 added 2 changesets with 14 changes to 11 files
234 added 2 changesets with 14 changes to 11 files
235 updating to branch default
235 updating to branch default
236 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 $ cd repo-mixed
237 $ cd repo-mixed
238 $ test -d .hg/store/meta
238 $ test -d .hg/store/meta
239 [1]
239 [1]
240 $ grep treemanifest .hg/requires
240 $ grep treemanifest .hg/requires
241 treemanifest
241 treemanifest
242
242
243 Should be possible to push updates from flat to tree manifest repo
243 Should be possible to push updates from flat to tree manifest repo
244
244
245 $ hg -R ../repo-flat push ssh://user@dummy/repo-mixed
245 $ hg -R ../repo-flat push ssh://user@dummy/repo-mixed
246 pushing to ssh://user@dummy/repo-mixed
246 pushing to ssh://user@dummy/repo-mixed
247 searching for changes
247 searching for changes
248 remote: adding changesets
248 remote: adding changesets
249 remote: adding manifests
249 remote: adding manifests
250 remote: adding file changes
250 remote: adding file changes
251 remote: added 2 changesets with 3 changes to 3 files
251 remote: added 2 changesets with 3 changes to 3 files
252
252
253 Commit should store revlog per directory
253 Commit should store revlog per directory
254
254
255 $ hg co 1
255 $ hg co 1
256 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 $ echo 3 > a
257 $ echo 3 > a
258 $ echo 3 > dir1/a
258 $ echo 3 > dir1/a
259 $ echo 3 > dir1/dir1/a
259 $ echo 3 > dir1/dir1/a
260 $ hg ci -m 'first tree'
260 $ hg ci -m 'first tree'
261 created new head
261 created new head
262 $ find .hg/store/meta | sort
262 $ find .hg/store/meta | sort
263 .hg/store/meta
263 .hg/store/meta
264 .hg/store/meta/dir1
264 .hg/store/meta/dir1
265 .hg/store/meta/dir1/00manifest.i
265 .hg/store/meta/dir1/00manifest.i
266 .hg/store/meta/dir1/dir1
266 .hg/store/meta/dir1/dir1
267 .hg/store/meta/dir1/dir1/00manifest.i
267 .hg/store/meta/dir1/dir1/00manifest.i
268 .hg/store/meta/dir1/dir2
268 .hg/store/meta/dir1/dir2
269 .hg/store/meta/dir1/dir2/00manifest.i
269 .hg/store/meta/dir1/dir2/00manifest.i
270 .hg/store/meta/dir2
270 .hg/store/meta/dir2
271 .hg/store/meta/dir2/00manifest.i
271 .hg/store/meta/dir2/00manifest.i
272
272
273 Merge of two trees
273 Merge of two trees
274
274
275 $ hg co 2
275 $ hg co 2
276 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 $ hg merge 1
277 $ hg merge 1
278 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 (branch merge, don't forget to commit)
279 (branch merge, don't forget to commit)
280 $ hg ci -m 'merge of flat manifests to new tree manifest'
280 $ hg ci -m 'merge of flat manifests to new tree manifest'
281 created new head
281 created new head
282 $ hg diff -r 3
282 $ hg diff -r 3
283
283
284 Parent of tree root manifest should be flat manifest, and two for merge
284 Parent of tree root manifest should be flat manifest, and two for merge
285
285
286 $ hg debugindex -m
286 $ hg debugindex -m
287 rev offset length delta linkrev nodeid p1 p2
287 rev offset length delta linkrev nodeid p1 p2
288 0 0 80 -1 0 40536115ed9e 000000000000 000000000000
288 0 0 80 -1 0 40536115ed9e 000000000000 000000000000
289 1 80 83 0 1 f3376063c255 40536115ed9e 000000000000
289 1 80 83 0 1 f3376063c255 40536115ed9e 000000000000
290 2 163 89 0 2 5d9b9da231a2 40536115ed9e 000000000000
290 2 163 89 0 2 5d9b9da231a2 40536115ed9e 000000000000
291 3 252 83 2 3 d17d663cbd8a 5d9b9da231a2 f3376063c255
291 3 252 83 2 3 d17d663cbd8a 5d9b9da231a2 f3376063c255
292 4 335 124 1 4 51e32a8c60ee f3376063c255 000000000000
292 4 335 124 1 4 51e32a8c60ee f3376063c255 000000000000
293 5 459 126 2 5 cc5baa78b230 5d9b9da231a2 f3376063c255
293 5 459 126 2 5 cc5baa78b230 5d9b9da231a2 f3376063c255
294
294
295
295
296 Status across flat/tree boundary should work
296 Status across flat/tree boundary should work
297
297
298 $ hg status --rev '.^' --rev .
298 $ hg status --rev '.^' --rev .
299 M a
299 M a
300 M dir1/a
300 M dir1/a
301 M dir1/dir1/a
301 M dir1/dir1/a
302
302
303
303
304 Turning off treemanifest config has no effect
304 Turning off treemanifest config has no effect
305
305
306 $ hg debugindex --dir dir1
306 $ hg debugindex --dir dir1
307 rev offset length delta linkrev nodeid p1 p2
307 rev offset length delta linkrev nodeid p1 p2
308 0 0 127 -1 4 064927a0648a 000000000000 000000000000
308 0 0 127 -1 4 064927a0648a 000000000000 000000000000
309 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
309 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
310 $ echo 2 > dir1/a
310 $ echo 2 > dir1/a
311 $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a'
311 $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a'
312 $ hg debugindex --dir dir1
312 $ hg debugindex --dir dir1
313 rev offset length delta linkrev nodeid p1 p2
313 rev offset length delta linkrev nodeid p1 p2
314 0 0 127 -1 4 064927a0648a 000000000000 000000000000
314 0 0 127 -1 4 064927a0648a 000000000000 000000000000
315 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
315 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
316 2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
316 2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
317
317
318 Stripping and recovering changes should work
318 Stripping and recovering changes should work
319
319
320 $ hg st --change tip
320 $ hg st --change tip
321 M dir1/a
321 M dir1/a
322 $ hg --config extensions.strip= strip tip
322 $ hg --config extensions.strip= strip tip
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg (glob)
324 saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg (glob)
325 $ hg debugindex --dir dir1
325 $ hg debugindex --dir dir1
326 rev offset length delta linkrev nodeid p1 p2
326 rev offset length delta linkrev nodeid p1 p2
327 0 0 127 -1 4 064927a0648a 000000000000 000000000000
327 0 0 127 -1 4 064927a0648a 000000000000 000000000000
328 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
328 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
329 $ hg incoming .hg/strip-backup/*
329 $ hg incoming .hg/strip-backup/*
330 comparing with .hg/strip-backup/*-backup.hg (glob)
330 comparing with .hg/strip-backup/*-backup.hg (glob)
331 searching for changes
331 searching for changes
332 changeset: 6:51cfd7b1e13b
332 changeset: 6:51cfd7b1e13b
333 tag: tip
333 tag: tip
334 user: test
334 user: test
335 date: Thu Jan 01 00:00:00 1970 +0000
335 date: Thu Jan 01 00:00:00 1970 +0000
336 summary: modify dir1/a
336 summary: modify dir1/a
337
337
338 $ hg pull .hg/strip-backup/*
338 $ hg pull .hg/strip-backup/*
339 pulling from .hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
339 pulling from .hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
340 searching for changes
340 searching for changes
341 adding changesets
341 adding changesets
342 adding manifests
342 adding manifests
343 adding file changes
343 adding file changes
344 added 1 changesets with 1 changes to 1 files
344 added 1 changesets with 1 changes to 1 files
345 (run 'hg update' to get a working copy)
345 (run 'hg update' to get a working copy)
346 $ hg --config extensions.strip= strip tip
346 $ hg --config extensions.strip= strip tip
347 saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/*-backup.hg (glob)
347 saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/*-backup.hg (glob)
348 $ hg unbundle -q .hg/strip-backup/*
348 $ hg unbundle -q .hg/strip-backup/*
349 $ hg debugindex --dir dir1
349 $ hg debugindex --dir dir1
350 rev offset length delta linkrev nodeid p1 p2
350 rev offset length delta linkrev nodeid p1 p2
351 0 0 127 -1 4 064927a0648a 000000000000 000000000000
351 0 0 127 -1 4 064927a0648a 000000000000 000000000000
352 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
352 1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
353 2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
353 2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
354 $ hg st --change tip
354 $ hg st --change tip
355 M dir1/a
355 M dir1/a
356
356
357 Shelving and unshelving should work
357 Shelving and unshelving should work
358
358
359 $ echo foo >> dir1/a
359 $ echo foo >> dir1/a
360 $ hg --config extensions.shelve= shelve
360 $ hg --config extensions.shelve= shelve
361 shelved as default
361 shelved as default
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 $ hg --config extensions.shelve= unshelve
363 $ hg --config extensions.shelve= unshelve
364 unshelving change 'default'
364 unshelving change 'default'
365 $ hg diff --nodates
365 $ hg diff --nodates
366 diff -r 708a273da119 dir1/a
366 diff -r 708a273da119 dir1/a
367 --- a/dir1/a
367 --- a/dir1/a
368 +++ b/dir1/a
368 +++ b/dir1/a
369 @@ -1,1 +1,2 @@
369 @@ -1,1 +1,2 @@
370 1
370 1
371 +foo
371 +foo
372
372
373 Pushing from treemanifest repo to an empty repo makes that a treemanifest repo
373 Pushing from treemanifest repo to an empty repo makes that a treemanifest repo
374
374
375 $ cd ..
375 $ cd ..
376 $ hg init empty-repo
376 $ hg init empty-repo
377 $ cat << EOF >> empty-repo/.hg/hgrc
377 $ cat << EOF >> empty-repo/.hg/hgrc
378 > [experimental]
378 > [experimental]
379 > changegroup3=yes
379 > changegroup3=yes
380 > EOF
380 > EOF
381 $ grep treemanifest empty-repo/.hg/requires
381 $ grep treemanifest empty-repo/.hg/requires
382 [1]
382 [1]
383 $ hg push -R repo -r 0 empty-repo
383 $ hg push -R repo -r 0 empty-repo
384 pushing to empty-repo
384 pushing to empty-repo
385 searching for changes
385 searching for changes
386 adding changesets
386 adding changesets
387 adding manifests
387 adding manifests
388 adding file changes
388 adding file changes
389 added 1 changesets with 2 changes to 2 files
389 added 1 changesets with 2 changes to 2 files
390 $ grep treemanifest empty-repo/.hg/requires
390 $ grep treemanifest empty-repo/.hg/requires
391 treemanifest
391 treemanifest
392
392
393 Pushing to an empty repo works
393 Pushing to an empty repo works
394
394
395 $ hg --config experimental.treemanifest=1 init clone
395 $ hg --config experimental.treemanifest=1 init clone
396 $ grep treemanifest clone/.hg/requires
396 $ grep treemanifest clone/.hg/requires
397 treemanifest
397 treemanifest
398 $ hg push -R repo clone
398 $ hg push -R repo clone
399 pushing to clone
399 pushing to clone
400 searching for changes
400 searching for changes
401 adding changesets
401 adding changesets
402 adding manifests
402 adding manifests
403 adding file changes
403 adding file changes
404 added 11 changesets with 15 changes to 10 files (+3 heads)
404 added 11 changesets with 15 changes to 10 files (+3 heads)
405 $ grep treemanifest clone/.hg/requires
405 $ grep treemanifest clone/.hg/requires
406 treemanifest
406 treemanifest
407 $ hg -R clone verify
407 $ hg -R clone verify
408 checking changesets
408 checking changesets
409 checking manifests
409 checking manifests
410 checking directory manifests
410 checking directory manifests
411 crosschecking files in changesets and manifests
411 crosschecking files in changesets and manifests
412 checking files
412 checking files
413 10 files, 11 changesets, 15 total revisions
413 10 files, 11 changesets, 15 total revisions
414
414
415 Create deeper repo with tree manifests.
415 Create deeper repo with tree manifests.
416
416
417 $ hg --config experimental.treemanifest=True init deeprepo
417 $ hg --config experimental.treemanifest=True init deeprepo
418 $ cd deeprepo
418 $ cd deeprepo
419
419
420 $ mkdir .A
420 $ mkdir .A
421 $ mkdir b
421 $ mkdir b
422 $ mkdir b/bar
422 $ mkdir b/bar
423 $ mkdir b/bar/orange
423 $ mkdir b/bar/orange
424 $ mkdir b/bar/orange/fly
424 $ mkdir b/bar/orange/fly
425 $ mkdir b/foo
425 $ mkdir b/foo
426 $ mkdir b/foo/apple
426 $ mkdir b/foo/apple
427 $ mkdir b/foo/apple/bees
427 $ mkdir b/foo/apple/bees
428
428
429 $ touch .A/one.txt
429 $ touch .A/one.txt
430 $ touch .A/two.txt
430 $ touch .A/two.txt
431 $ touch b/bar/fruits.txt
431 $ touch b/bar/fruits.txt
432 $ touch b/bar/orange/fly/gnat.py
432 $ touch b/bar/orange/fly/gnat.py
433 $ touch b/bar/orange/fly/housefly.txt
433 $ touch b/bar/orange/fly/housefly.txt
434 $ touch b/foo/apple/bees/flower.py
434 $ touch b/foo/apple/bees/flower.py
435 $ touch c.txt
435 $ touch c.txt
436 $ touch d.py
436 $ touch d.py
437
437
438 $ hg ci -Aqm 'initial'
438 $ hg ci -Aqm 'initial'
439
439
440 $ echo >> .A/one.txt
440 $ echo >> .A/one.txt
441 $ echo >> .A/two.txt
441 $ echo >> .A/two.txt
442 $ echo >> b/bar/fruits.txt
442 $ echo >> b/bar/fruits.txt
443 $ echo >> b/bar/orange/fly/gnat.py
443 $ echo >> b/bar/orange/fly/gnat.py
444 $ echo >> b/bar/orange/fly/housefly.txt
444 $ echo >> b/bar/orange/fly/housefly.txt
445 $ echo >> b/foo/apple/bees/flower.py
445 $ echo >> b/foo/apple/bees/flower.py
446 $ echo >> c.txt
446 $ echo >> c.txt
447 $ echo >> d.py
447 $ echo >> d.py
448 $ hg ci -Aqm 'second'
448 $ hg ci -Aqm 'second'
449
449
450 We'll see that visitdir works by removing some treemanifest revlogs and running
450 We'll see that visitdir works by removing some treemanifest revlogs and running
451 the files command with various parameters.
451 the files command with various parameters.
452
452
453 Test files from the root.
453 Test files from the root.
454
454
455 $ hg files -r .
455 $ hg files -r .
456 .A/one.txt (glob)
456 .A/one.txt (glob)
457 .A/two.txt (glob)
457 .A/two.txt (glob)
458 b/bar/fruits.txt (glob)
458 b/bar/fruits.txt (glob)
459 b/bar/orange/fly/gnat.py (glob)
459 b/bar/orange/fly/gnat.py (glob)
460 b/bar/orange/fly/housefly.txt (glob)
460 b/bar/orange/fly/housefly.txt (glob)
461 b/foo/apple/bees/flower.py (glob)
461 b/foo/apple/bees/flower.py (glob)
462 c.txt
462 c.txt
463 d.py
463 d.py
464
464
465 Excludes with a glob should not exclude everything from the glob's root
465 Excludes with a glob should not exclude everything from the glob's root
466
466
467 $ hg files -r . -X 'b/fo?' b
467 $ hg files -r . -X 'b/fo?' b
468 b/bar/fruits.txt (glob)
468 b/bar/fruits.txt (glob)
469 b/bar/orange/fly/gnat.py (glob)
469 b/bar/orange/fly/gnat.py (glob)
470 b/bar/orange/fly/housefly.txt (glob)
470 b/bar/orange/fly/housefly.txt (glob)
471 $ cp -R .hg/store .hg/store-copy
471 $ cp -R .hg/store .hg/store-copy
472
472
473 Test files for a subdirectory.
473 Test files for a subdirectory.
474
474
475 $ rm -r .hg/store/meta/~2e_a
475 $ rm -r .hg/store/meta/~2e_a
476 $ hg files -r . b
476 $ hg files -r . b
477 b/bar/fruits.txt (glob)
477 b/bar/fruits.txt (glob)
478 b/bar/orange/fly/gnat.py (glob)
478 b/bar/orange/fly/gnat.py (glob)
479 b/bar/orange/fly/housefly.txt (glob)
479 b/bar/orange/fly/housefly.txt (glob)
480 b/foo/apple/bees/flower.py (glob)
480 b/foo/apple/bees/flower.py (glob)
481 $ hg diff -r '.^' -r . --stat b
481 $ hg diff -r '.^' -r . --stat b
482 b/bar/fruits.txt | 1 +
482 b/bar/fruits.txt | 1 +
483 b/bar/orange/fly/gnat.py | 1 +
483 b/bar/orange/fly/gnat.py | 1 +
484 b/bar/orange/fly/housefly.txt | 1 +
484 b/bar/orange/fly/housefly.txt | 1 +
485 b/foo/apple/bees/flower.py | 1 +
485 b/foo/apple/bees/flower.py | 1 +
486 4 files changed, 4 insertions(+), 0 deletions(-)
486 4 files changed, 4 insertions(+), 0 deletions(-)
487 $ cp -R .hg/store-copy/. .hg/store
487 $ cp -R .hg/store-copy/. .hg/store
488
488
489 Test files with just includes and excludes.
489 Test files with just includes and excludes.
490
490
491 $ rm -r .hg/store/meta/~2e_a
491 $ rm -r .hg/store/meta/~2e_a
492 $ rm -r .hg/store/meta/b/bar/orange/fly
492 $ rm -r .hg/store/meta/b/bar/orange/fly
493 $ rm -r .hg/store/meta/b/foo/apple/bees
493 $ rm -r .hg/store/meta/b/foo/apple/bees
494 $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
494 $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
495 b/bar/fruits.txt (glob)
495 b/bar/fruits.txt (glob)
496 $ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
496 $ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
497 b/bar/fruits.txt | 1 +
497 b/bar/fruits.txt | 1 +
498 1 files changed, 1 insertions(+), 0 deletions(-)
498 1 files changed, 1 insertions(+), 0 deletions(-)
499 $ cp -R .hg/store-copy/. .hg/store
499 $ cp -R .hg/store-copy/. .hg/store
500
500
501 Test files for a subdirectory, excluding a directory within it.
501 Test files for a subdirectory, excluding a directory within it.
502
502
503 $ rm -r .hg/store/meta/~2e_a
503 $ rm -r .hg/store/meta/~2e_a
504 $ rm -r .hg/store/meta/b/foo
504 $ rm -r .hg/store/meta/b/foo
505 $ hg files -r . -X path:b/foo b
505 $ hg files -r . -X path:b/foo b
506 b/bar/fruits.txt (glob)
506 b/bar/fruits.txt (glob)
507 b/bar/orange/fly/gnat.py (glob)
507 b/bar/orange/fly/gnat.py (glob)
508 b/bar/orange/fly/housefly.txt (glob)
508 b/bar/orange/fly/housefly.txt (glob)
509 $ hg diff -r '.^' -r . --stat -X path:b/foo b
509 $ hg diff -r '.^' -r . --stat -X path:b/foo b
510 b/bar/fruits.txt | 1 +
510 b/bar/fruits.txt | 1 +
511 b/bar/orange/fly/gnat.py | 1 +
511 b/bar/orange/fly/gnat.py | 1 +
512 b/bar/orange/fly/housefly.txt | 1 +
512 b/bar/orange/fly/housefly.txt | 1 +
513 3 files changed, 3 insertions(+), 0 deletions(-)
513 3 files changed, 3 insertions(+), 0 deletions(-)
514 $ cp -R .hg/store-copy/. .hg/store
514 $ cp -R .hg/store-copy/. .hg/store
515
515
516 Test files for a sub directory, including only a directory within it, and
516 Test files for a sub directory, including only a directory within it, and
517 including an unrelated directory.
517 including an unrelated directory.
518
518
519 $ rm -r .hg/store/meta/~2e_a
519 $ rm -r .hg/store/meta/~2e_a
520 $ rm -r .hg/store/meta/b/foo
520 $ rm -r .hg/store/meta/b/foo
521 $ hg files -r . -I path:b/bar/orange -I path:a b
521 $ hg files -r . -I path:b/bar/orange -I path:a b
522 b/bar/orange/fly/gnat.py (glob)
522 b/bar/orange/fly/gnat.py (glob)
523 b/bar/orange/fly/housefly.txt (glob)
523 b/bar/orange/fly/housefly.txt (glob)
524 $ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b
524 $ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b
525 b/bar/orange/fly/gnat.py | 1 +
525 b/bar/orange/fly/gnat.py | 1 +
526 b/bar/orange/fly/housefly.txt | 1 +
526 b/bar/orange/fly/housefly.txt | 1 +
527 2 files changed, 2 insertions(+), 0 deletions(-)
527 2 files changed, 2 insertions(+), 0 deletions(-)
528 $ cp -R .hg/store-copy/. .hg/store
528 $ cp -R .hg/store-copy/. .hg/store
529
529
530 Test files for a pattern, including a directory, and excluding a directory
530 Test files for a pattern, including a directory, and excluding a directory
531 within that.
531 within that.
532
532
533 $ rm -r .hg/store/meta/~2e_a
533 $ rm -r .hg/store/meta/~2e_a
534 $ rm -r .hg/store/meta/b/foo
534 $ rm -r .hg/store/meta/b/foo
535 $ rm -r .hg/store/meta/b/bar/orange
535 $ rm -r .hg/store/meta/b/bar/orange
536 $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange
536 $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange
537 b/bar/fruits.txt (glob)
537 b/bar/fruits.txt (glob)
538 $ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange
538 $ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange
539 b/bar/fruits.txt | 1 +
539 b/bar/fruits.txt | 1 +
540 1 files changed, 1 insertions(+), 0 deletions(-)
540 1 files changed, 1 insertions(+), 0 deletions(-)
541 $ cp -R .hg/store-copy/. .hg/store
541 $ cp -R .hg/store-copy/. .hg/store
542
542
543 Add some more changes to the deep repo
543 Add some more changes to the deep repo
544 $ echo narf >> b/bar/fruits.txt
544 $ echo narf >> b/bar/fruits.txt
545 $ hg ci -m narf
545 $ hg ci -m narf
546 $ echo troz >> b/bar/orange/fly/gnat.py
546 $ echo troz >> b/bar/orange/fly/gnat.py
547 $ hg ci -m troz
547 $ hg ci -m troz
548
548
549 Verify works
549 Verify works
550 $ hg verify
550 $ hg verify
551 checking changesets
551 checking changesets
552 checking manifests
552 checking manifests
553 checking directory manifests
553 checking directory manifests
554 crosschecking files in changesets and manifests
554 crosschecking files in changesets and manifests
555 checking files
555 checking files
556 8 files, 4 changesets, 18 total revisions
556 8 files, 4 changesets, 18 total revisions
557
557
558 Dirlogs are included in fncache
558 Dirlogs are included in fncache
559 $ grep meta/.A/00manifest.i .hg/store/fncache
559 $ grep meta/.A/00manifest.i .hg/store/fncache
560 meta/.A/00manifest.i
560 meta/.A/00manifest.i
561
561
562 Rebuilt fncache includes dirlogs
562 Rebuilt fncache includes dirlogs
563 $ rm .hg/store/fncache
563 $ rm .hg/store/fncache
564 $ hg debugrebuildfncache
564 $ hg debugrebuildfncache
565 adding data/.A/one.txt.i
565 adding data/.A/one.txt.i
566 adding data/.A/two.txt.i
566 adding data/.A/two.txt.i
567 adding data/b/bar/fruits.txt.i
567 adding data/b/bar/fruits.txt.i
568 adding data/b/bar/orange/fly/gnat.py.i
568 adding data/b/bar/orange/fly/gnat.py.i
569 adding data/b/bar/orange/fly/housefly.txt.i
569 adding data/b/bar/orange/fly/housefly.txt.i
570 adding data/b/foo/apple/bees/flower.py.i
570 adding data/b/foo/apple/bees/flower.py.i
571 adding data/c.txt.i
571 adding data/c.txt.i
572 adding data/d.py.i
572 adding data/d.py.i
573 adding meta/.A/00manifest.i
573 adding meta/.A/00manifest.i
574 adding meta/b/00manifest.i
574 adding meta/b/00manifest.i
575 adding meta/b/bar/00manifest.i
575 adding meta/b/bar/00manifest.i
576 adding meta/b/bar/orange/00manifest.i
576 adding meta/b/bar/orange/00manifest.i
577 adding meta/b/bar/orange/fly/00manifest.i
577 adding meta/b/bar/orange/fly/00manifest.i
578 adding meta/b/foo/00manifest.i
578 adding meta/b/foo/00manifest.i
579 adding meta/b/foo/apple/00manifest.i
579 adding meta/b/foo/apple/00manifest.i
580 adding meta/b/foo/apple/bees/00manifest.i
580 adding meta/b/foo/apple/bees/00manifest.i
581 16 items added, 0 removed from fncache
581 16 items added, 0 removed from fncache
582
582
583 Finish first server
583 Finish first server
584 $ killdaemons.py
584 $ killdaemons.py
585
585
586 Back up the recently added revlogs
586 Back up the recently added revlogs
587 $ cp -R .hg/store .hg/store-newcopy
587 $ cp -R .hg/store .hg/store-newcopy
588
588
589 Verify reports missing dirlog
589 Verify reports missing dirlog
590 $ rm .hg/store/meta/b/00manifest.*
590 $ rm .hg/store/meta/b/00manifest.*
591 $ hg verify
591 $ hg verify
592 checking changesets
592 checking changesets
593 checking manifests
593 checking manifests
594 checking directory manifests
594 checking directory manifests
595 0: empty or missing b/
595 0: empty or missing b/
596 b/@0: parent-directory manifest refers to unknown revision 67688a370455
596 b/@0: parent-directory manifest refers to unknown revision 67688a370455
597 b/@1: parent-directory manifest refers to unknown revision f065da70369e
597 b/@1: parent-directory manifest refers to unknown revision f065da70369e
598 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
598 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
599 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
599 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
600 warning: orphan revlog 'meta/b/bar/00manifest.i'
600 warning: orphan revlog 'meta/b/bar/00manifest.i'
601 warning: orphan revlog 'meta/b/bar/orange/00manifest.i'
601 warning: orphan revlog 'meta/b/bar/orange/00manifest.i'
602 warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i'
602 warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i'
603 warning: orphan revlog 'meta/b/foo/00manifest.i'
603 warning: orphan revlog 'meta/b/foo/00manifest.i'
604 warning: orphan revlog 'meta/b/foo/apple/00manifest.i'
604 warning: orphan revlog 'meta/b/foo/apple/00manifest.i'
605 warning: orphan revlog 'meta/b/foo/apple/bees/00manifest.i'
605 warning: orphan revlog 'meta/b/foo/apple/bees/00manifest.i'
606 crosschecking files in changesets and manifests
606 crosschecking files in changesets and manifests
607 b/bar/fruits.txt@0: in changeset but not in manifest
607 b/bar/fruits.txt@0: in changeset but not in manifest
608 b/bar/orange/fly/gnat.py@0: in changeset but not in manifest
608 b/bar/orange/fly/gnat.py@0: in changeset but not in manifest
609 b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest
609 b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest
610 b/foo/apple/bees/flower.py@0: in changeset but not in manifest
610 b/foo/apple/bees/flower.py@0: in changeset but not in manifest
611 checking files
611 checking files
612 8 files, 4 changesets, 18 total revisions
612 8 files, 4 changesets, 18 total revisions
613 6 warnings encountered!
613 6 warnings encountered!
614 9 integrity errors encountered!
614 9 integrity errors encountered!
615 (first damaged changeset appears to be 0)
615 (first damaged changeset appears to be 0)
616 [1]
616 [1]
617 $ cp -R .hg/store-newcopy/. .hg/store
617 $ cp -R .hg/store-newcopy/. .hg/store
618
618
619 Verify reports missing dirlog entry
619 Verify reports missing dirlog entry
620 $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/
620 $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/
621 $ hg verify
621 $ hg verify
622 checking changesets
622 checking changesets
623 checking manifests
623 checking manifests
624 checking directory manifests
624 checking directory manifests
625 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
625 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
626 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
626 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
627 b/bar/@?: rev 2 points to unexpected changeset 2
627 b/bar/@?: rev 2 points to unexpected changeset 2
628 b/bar/@?: 44d7e1146e0d not in parent-directory manifest
628 b/bar/@?: 44d7e1146e0d not in parent-directory manifest
629 b/bar/@?: rev 3 points to unexpected changeset 3
629 b/bar/@?: rev 3 points to unexpected changeset 3
630 b/bar/@?: 70b10c6b17b7 not in parent-directory manifest
630 b/bar/@?: 70b10c6b17b7 not in parent-directory manifest
631 b/bar/orange/@?: rev 2 points to unexpected changeset 3
631 b/bar/orange/@?: rev 2 points to unexpected changeset 3
632 (expected None)
632 (expected None)
633 b/bar/orange/fly/@?: rev 2 points to unexpected changeset 3
633 b/bar/orange/fly/@?: rev 2 points to unexpected changeset 3
634 (expected None)
634 (expected None)
635 crosschecking files in changesets and manifests
635 crosschecking files in changesets and manifests
636 checking files
636 checking files
637 8 files, 4 changesets, 18 total revisions
637 8 files, 4 changesets, 18 total revisions
638 2 warnings encountered!
638 2 warnings encountered!
639 8 integrity errors encountered!
639 8 integrity errors encountered!
640 (first damaged changeset appears to be 2)
640 (first damaged changeset appears to be 2)
641 [1]
641 [1]
642 $ cp -R .hg/store-newcopy/. .hg/store
642 $ cp -R .hg/store-newcopy/. .hg/store
643
643
644 Test cloning a treemanifest repo over http.
644 Test cloning a treemanifest repo over http.
645 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log
645 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log
646 $ cat hg.pid >> $DAEMON_PIDS
646 $ cat hg.pid >> $DAEMON_PIDS
647 $ cd ..
647 $ cd ..
648 We can clone even with the knob turned off and we'll get a treemanifest repo.
648 We can clone even with the knob turned off and we'll get a treemanifest repo.
649 $ hg clone --config experimental.treemanifest=False \
649 $ hg clone --config experimental.treemanifest=False \
650 > --config experimental.changegroup3=True \
650 > --config experimental.changegroup3=True \
651 > http://localhost:$HGPORT deepclone
651 > http://localhost:$HGPORT deepclone
652 requesting all changes
652 requesting all changes
653 adding changesets
653 adding changesets
654 adding manifests
654 adding manifests
655 adding file changes
655 adding file changes
656 added 4 changesets with 18 changes to 8 files
656 added 4 changesets with 18 changes to 8 files
657 updating to branch default
657 updating to branch default
658 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
658 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
659 No server errors.
659 No server errors.
660 $ cat deeprepo/errors.log
660 $ cat deeprepo/errors.log
661 requires got updated to include treemanifest
661 requires got updated to include treemanifest
662 $ cat deepclone/.hg/requires | grep treemanifest
662 $ cat deepclone/.hg/requires | grep treemanifest
663 treemanifest
663 treemanifest
664 Tree manifest revlogs exist.
664 Tree manifest revlogs exist.
665 $ find deepclone/.hg/store/meta | sort
665 $ find deepclone/.hg/store/meta | sort
666 deepclone/.hg/store/meta
666 deepclone/.hg/store/meta
667 deepclone/.hg/store/meta/b
667 deepclone/.hg/store/meta/b
668 deepclone/.hg/store/meta/b/00manifest.i
668 deepclone/.hg/store/meta/b/00manifest.i
669 deepclone/.hg/store/meta/b/bar
669 deepclone/.hg/store/meta/b/bar
670 deepclone/.hg/store/meta/b/bar/00manifest.i
670 deepclone/.hg/store/meta/b/bar/00manifest.i
671 deepclone/.hg/store/meta/b/bar/orange
671 deepclone/.hg/store/meta/b/bar/orange
672 deepclone/.hg/store/meta/b/bar/orange/00manifest.i
672 deepclone/.hg/store/meta/b/bar/orange/00manifest.i
673 deepclone/.hg/store/meta/b/bar/orange/fly
673 deepclone/.hg/store/meta/b/bar/orange/fly
674 deepclone/.hg/store/meta/b/bar/orange/fly/00manifest.i
674 deepclone/.hg/store/meta/b/bar/orange/fly/00manifest.i
675 deepclone/.hg/store/meta/b/foo
675 deepclone/.hg/store/meta/b/foo
676 deepclone/.hg/store/meta/b/foo/00manifest.i
676 deepclone/.hg/store/meta/b/foo/00manifest.i
677 deepclone/.hg/store/meta/b/foo/apple
677 deepclone/.hg/store/meta/b/foo/apple
678 deepclone/.hg/store/meta/b/foo/apple/00manifest.i
678 deepclone/.hg/store/meta/b/foo/apple/00manifest.i
679 deepclone/.hg/store/meta/b/foo/apple/bees
679 deepclone/.hg/store/meta/b/foo/apple/bees
680 deepclone/.hg/store/meta/b/foo/apple/bees/00manifest.i
680 deepclone/.hg/store/meta/b/foo/apple/bees/00manifest.i
681 deepclone/.hg/store/meta/~2e_a
681 deepclone/.hg/store/meta/~2e_a
682 deepclone/.hg/store/meta/~2e_a/00manifest.i
682 deepclone/.hg/store/meta/~2e_a/00manifest.i
683 Verify passes.
683 Verify passes.
684 $ cd deepclone
684 $ cd deepclone
685 $ hg verify
685 $ hg verify
686 checking changesets
686 checking changesets
687 checking manifests
687 checking manifests
688 checking directory manifests
688 checking directory manifests
689 crosschecking files in changesets and manifests
689 crosschecking files in changesets and manifests
690 checking files
690 checking files
691 8 files, 4 changesets, 18 total revisions
691 8 files, 4 changesets, 18 total revisions
692 $ cd ..
692 $ cd ..
693
693
694 Create clones using old repo formats to use in later tests
694 Create clones using old repo formats to use in later tests
695 $ hg clone --config format.usestore=False \
695 $ hg clone --config format.usestore=False \
696 > --config experimental.changegroup3=True \
696 > --config experimental.changegroup3=True \
697 > http://localhost:$HGPORT deeprepo-basicstore
697 > http://localhost:$HGPORT deeprepo-basicstore
698 requesting all changes
698 requesting all changes
699 adding changesets
699 adding changesets
700 adding manifests
700 adding manifests
701 adding file changes
701 adding file changes
702 added 4 changesets with 18 changes to 8 files
702 added 4 changesets with 18 changes to 8 files
703 updating to branch default
703 updating to branch default
704 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
704 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
705 $ cd deeprepo-basicstore
705 $ cd deeprepo-basicstore
706 $ grep store .hg/requires
706 $ grep store .hg/requires
707 [1]
707 [1]
708 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --errorlog=errors.log
708 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --errorlog=errors.log
709 $ cat hg.pid >> $DAEMON_PIDS
709 $ cat hg.pid >> $DAEMON_PIDS
710 $ cd ..
710 $ cd ..
711 $ hg clone --config format.usefncache=False \
711 $ hg clone --config format.usefncache=False \
712 > --config experimental.changegroup3=True \
712 > --config experimental.changegroup3=True \
713 > http://localhost:$HGPORT deeprepo-encodedstore
713 > http://localhost:$HGPORT deeprepo-encodedstore
714 requesting all changes
714 requesting all changes
715 adding changesets
715 adding changesets
716 adding manifests
716 adding manifests
717 adding file changes
717 adding file changes
718 added 4 changesets with 18 changes to 8 files
718 added 4 changesets with 18 changes to 8 files
719 updating to branch default
719 updating to branch default
720 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
720 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
721 $ cd deeprepo-encodedstore
721 $ cd deeprepo-encodedstore
722 $ grep fncache .hg/requires
722 $ grep fncache .hg/requires
723 [1]
723 [1]
724 $ hg serve -p $HGPORT2 -d --pid-file=hg.pid --errorlog=errors.log
724 $ hg serve -p $HGPORT2 -d --pid-file=hg.pid --errorlog=errors.log
725 $ cat hg.pid >> $DAEMON_PIDS
725 $ cat hg.pid >> $DAEMON_PIDS
726 $ cd ..
726 $ cd ..
727
727
728 Local clone with basicstore
728 Local clone with basicstore
729 $ hg clone -U deeprepo-basicstore local-clone-basicstore
729 $ hg clone -U deeprepo-basicstore local-clone-basicstore
730 $ hg -R local-clone-basicstore verify
730 $ hg -R local-clone-basicstore verify
731 checking changesets
731 checking changesets
732 checking manifests
732 checking manifests
733 checking directory manifests
733 checking directory manifests
734 crosschecking files in changesets and manifests
734 crosschecking files in changesets and manifests
735 checking files
735 checking files
736 8 files, 4 changesets, 18 total revisions
736 8 files, 4 changesets, 18 total revisions
737
737
738 Local clone with encodedstore
738 Local clone with encodedstore
739 $ hg clone -U deeprepo-encodedstore local-clone-encodedstore
739 $ hg clone -U deeprepo-encodedstore local-clone-encodedstore
740 $ hg -R local-clone-encodedstore verify
740 $ hg -R local-clone-encodedstore verify
741 checking changesets
741 checking changesets
742 checking manifests
742 checking manifests
743 checking directory manifests
743 checking directory manifests
744 crosschecking files in changesets and manifests
744 crosschecking files in changesets and manifests
745 checking files
745 checking files
746 8 files, 4 changesets, 18 total revisions
746 8 files, 4 changesets, 18 total revisions
747
747
748 Local clone with fncachestore
748 Local clone with fncachestore
749 $ hg clone -U deeprepo local-clone-fncachestore
749 $ hg clone -U deeprepo local-clone-fncachestore
750 $ hg -R local-clone-fncachestore verify
750 $ hg -R local-clone-fncachestore verify
751 checking changesets
751 checking changesets
752 checking manifests
752 checking manifests
753 checking directory manifests
753 checking directory manifests
754 crosschecking files in changesets and manifests
754 crosschecking files in changesets and manifests
755 checking files
755 checking files
756 8 files, 4 changesets, 18 total revisions
756 8 files, 4 changesets, 18 total revisions
757
757
758 Stream clone with basicstore
758 Stream clone with basicstore
759 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
759 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
760 > http://localhost:$HGPORT1 stream-clone-basicstore
760 > http://localhost:$HGPORT1 stream-clone-basicstore
761 streaming all changes
761 streaming all changes
762 18 files to transfer, * of data (glob)
762 18 files to transfer, * of data (glob)
763 transferred * in * seconds (*) (glob)
763 transferred * in * seconds (*) (glob)
764 searching for changes
764 searching for changes
765 no changes found
765 no changes found
766 $ hg -R stream-clone-basicstore verify
766 $ hg -R stream-clone-basicstore verify
767 checking changesets
767 checking changesets
768 checking manifests
768 checking manifests
769 checking directory manifests
769 checking directory manifests
770 crosschecking files in changesets and manifests
770 crosschecking files in changesets and manifests
771 checking files
771 checking files
772 8 files, 4 changesets, 18 total revisions
772 8 files, 4 changesets, 18 total revisions
773
773
774 Stream clone with encodedstore
774 Stream clone with encodedstore
775 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
775 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
776 > http://localhost:$HGPORT2 stream-clone-encodedstore
776 > http://localhost:$HGPORT2 stream-clone-encodedstore
777 streaming all changes
777 streaming all changes
778 18 files to transfer, * of data (glob)
778 18 files to transfer, * of data (glob)
779 transferred * in * seconds (*) (glob)
779 transferred * in * seconds (*) (glob)
780 searching for changes
780 searching for changes
781 no changes found
781 no changes found
782 $ hg -R stream-clone-encodedstore verify
782 $ hg -R stream-clone-encodedstore verify
783 checking changesets
783 checking changesets
784 checking manifests
784 checking manifests
785 checking directory manifests
785 checking directory manifests
786 crosschecking files in changesets and manifests
786 crosschecking files in changesets and manifests
787 checking files
787 checking files
788 8 files, 4 changesets, 18 total revisions
788 8 files, 4 changesets, 18 total revisions
789
789
790 Stream clone with fncachestore
790 Stream clone with fncachestore
791 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
791 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
792 > http://localhost:$HGPORT stream-clone-fncachestore
792 > http://localhost:$HGPORT stream-clone-fncachestore
793 streaming all changes
793 streaming all changes
794 18 files to transfer, * of data (glob)
794 18 files to transfer, * of data (glob)
795 transferred * in * seconds (*) (glob)
795 transferred * in * seconds (*) (glob)
796 searching for changes
796 searching for changes
797 no changes found
797 no changes found
798 $ hg -R stream-clone-fncachestore verify
798 $ hg -R stream-clone-fncachestore verify
799 checking changesets
799 checking changesets
800 checking manifests
800 checking manifests
801 checking directory manifests
801 checking directory manifests
802 crosschecking files in changesets and manifests
802 crosschecking files in changesets and manifests
803 checking files
803 checking files
804 8 files, 4 changesets, 18 total revisions
804 8 files, 4 changesets, 18 total revisions
805
805
806 Packed bundle
806 Packed bundle
807 $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg
807 $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg
808 writing 5330 bytes for 18 files
808 writing 5330 bytes for 18 files
809 bundle requirements: generaldelta, revlogv1, treemanifest
809 bundle requirements: generaldelta, revlogv1, treemanifest
810 $ hg debugbundle --spec repo-packed.hg
810 $ hg debugbundle --spec repo-packed.hg
811 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest
811 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest
812
812
813 Bundle with changegroup2 is not supported
813 Bundle with changegroup2 is not supported
814
814
815 $ hg -R deeprepo bundle --all -t v2 deeprepo.bundle
815 $ hg -R deeprepo bundle --all -t v2 deeprepo.bundle
816 abort: repository does not support bundle version 02
816 abort: repository does not support bundle version 02
817 [255]
817 [255]
818
818
819 Pull does not include changegroup for manifest the client already has from
819 Pull does not include changegroup for manifest the client already has from
820 other branch
820 other branch
821
821
822 $ mkdir grafted-dir-repo
822 $ mkdir grafted-dir-repo
823 $ cd grafted-dir-repo
823 $ cd grafted-dir-repo
824 $ hg --config experimental.treemanifest=1 init
824 $ hg --config experimental.treemanifest=1 init
825 $ mkdir dir
825 $ mkdir dir
826 $ echo a > dir/file
826 $ echo a > dir/file
827 $ echo a > file
827 $ echo a > file
828 $ hg ci -Am initial
828 $ hg ci -Am initial
829 adding dir/file
829 adding dir/file
830 adding file
830 adding file
831 $ echo b > dir/file
831 $ echo b > dir/file
832 $ hg ci -m updated
832 $ hg ci -m updated
833 $ hg co '.^'
833 $ hg co '.^'
834 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
834 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
835 $ hg revert -r tip dir/
835 $ hg revert -r tip dir/
836 reverting dir/file (glob)
836 reverting dir/file (glob)
837 $ echo b > file # to make sure root manifest is sent
837 $ echo b > file # to make sure root manifest is sent
838 $ hg ci -m grafted
838 $ hg ci -m grafted
839 created new head
839 created new head
840 $ cd ..
840 $ cd ..
841
841
842 $ hg --config experimental.treemanifest=1 clone --pull -r 1 \
842 $ hg --config experimental.treemanifest=1 clone --pull -r 1 \
843 > grafted-dir-repo grafted-dir-repo-clone
843 > grafted-dir-repo grafted-dir-repo-clone
844 adding changesets
844 adding changesets
845 adding manifests
845 adding manifests
846 adding file changes
846 adding file changes
847 added 2 changesets with 3 changes to 2 files
847 added 2 changesets with 3 changes to 2 files
848 updating to branch default
848 updating to branch default
849 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
849 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
850 $ cd grafted-dir-repo-clone
850 $ cd grafted-dir-repo-clone
851 $ hg pull -r 2
851 $ hg pull -r 2
852 pulling from $TESTTMP/grafted-dir-repo (glob)
852 pulling from $TESTTMP/grafted-dir-repo (glob)
853 searching for changes
853 searching for changes
854 adding changesets
854 adding changesets
855 adding manifests
855 adding manifests
856 adding file changes
856 adding file changes
857 added 1 changesets with 1 changes to 1 files (+1 heads)
857 added 1 changesets with 1 changes to 1 files (+1 heads)
858 (run 'hg heads' to see heads, 'hg merge' to merge)
858 (run 'hg heads' to see heads, 'hg merge' to merge)
859
859
860 Committing a empty commit does not duplicate root treemanifest
860 Committing a empty commit does not duplicate root treemanifest
861 $ echo z >> z
861 $ echo z >> z
862 $ hg commit -Aqm 'pre-empty commit'
862 $ hg commit -Aqm 'pre-empty commit'
863 $ hg rm z
863 $ hg rm z
864 $ hg commit --amend -m 'empty commit'
864 $ hg commit --amend -m 'empty commit'
865 saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-de37743b-amend.hg (glob)
865 saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-9e3b6b02-amend.hg (glob)
866 $ hg log -r 'tip + tip^' -T '{manifest}\n'
866 $ hg log -r 'tip + tip^' -T '{manifest}\n'
867 1:678d3574b88c
867 1:678d3574b88c
868 1:678d3574b88c
868 1:678d3574b88c
869 $ hg --config extensions.strip= strip -r . -q
869 $ hg --config extensions.strip= strip -r . -q
General Comments 0
You need to be logged in to leave comments. Login now