##// END OF EJS Templates
strip: invalidate phase cache after stripping changeset (issue5235)...
Laurent Charignon -
r29196:bf7b8157 stable
parent child Browse files
Show More
@@ -1,345 +1,346 b''
1 # repair.py - functions for repository repair for mercurial
1 # repair.py - functions for repository repair for mercurial
2 #
2 #
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
4 # Copyright 2007 Matt Mackall
4 # Copyright 2007 Matt Mackall
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import errno
11 import errno
12
12
13 from .i18n import _
13 from .i18n import _
14 from .node import short
14 from .node import short
15 from . import (
15 from . import (
16 bundle2,
16 bundle2,
17 changegroup,
17 changegroup,
18 error,
18 error,
19 exchange,
19 exchange,
20 obsolete,
20 obsolete,
21 util,
21 util,
22 )
22 )
23
23
24 def _bundle(repo, bases, heads, node, suffix, compress=True):
24 def _bundle(repo, bases, heads, node, suffix, compress=True):
25 """create a bundle with the specified revisions as a backup"""
25 """create a bundle with the specified revisions as a backup"""
26 cgversion = changegroup.safeversion(repo)
26 cgversion = changegroup.safeversion(repo)
27
27
28 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
28 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
29 version=cgversion)
29 version=cgversion)
30 backupdir = "strip-backup"
30 backupdir = "strip-backup"
31 vfs = repo.vfs
31 vfs = repo.vfs
32 if not vfs.isdir(backupdir):
32 if not vfs.isdir(backupdir):
33 vfs.mkdir(backupdir)
33 vfs.mkdir(backupdir)
34
34
35 # Include a hash of all the nodes in the filename for uniqueness
35 # Include a hash of all the nodes in the filename for uniqueness
36 allcommits = repo.set('%ln::%ln', bases, heads)
36 allcommits = repo.set('%ln::%ln', bases, heads)
37 allhashes = sorted(c.hex() for c in allcommits)
37 allhashes = sorted(c.hex() for c in allcommits)
38 totalhash = util.sha1(''.join(allhashes)).hexdigest()
38 totalhash = util.sha1(''.join(allhashes)).hexdigest()
39 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
39 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
40
40
41 comp = None
41 comp = None
42 if cgversion != '01':
42 if cgversion != '01':
43 bundletype = "HG20"
43 bundletype = "HG20"
44 if compress:
44 if compress:
45 comp = 'BZ'
45 comp = 'BZ'
46 elif compress:
46 elif compress:
47 bundletype = "HG10BZ"
47 bundletype = "HG10BZ"
48 else:
48 else:
49 bundletype = "HG10UN"
49 bundletype = "HG10UN"
50 return bundle2.writebundle(repo.ui, cg, name, bundletype, vfs,
50 return bundle2.writebundle(repo.ui, cg, name, bundletype, vfs,
51 compression=comp)
51 compression=comp)
52
52
53 def _collectfiles(repo, striprev):
53 def _collectfiles(repo, striprev):
54 """find out the filelogs affected by the strip"""
54 """find out the filelogs affected by the strip"""
55 files = set()
55 files = set()
56
56
57 for x in xrange(striprev, len(repo)):
57 for x in xrange(striprev, len(repo)):
58 files.update(repo[x].files())
58 files.update(repo[x].files())
59
59
60 return sorted(files)
60 return sorted(files)
61
61
62 def _collectbrokencsets(repo, files, striprev):
62 def _collectbrokencsets(repo, files, striprev):
63 """return the changesets which will be broken by the truncation"""
63 """return the changesets which will be broken by the truncation"""
64 s = set()
64 s = set()
65 def collectone(revlog):
65 def collectone(revlog):
66 _, brokenset = revlog.getstrippoint(striprev)
66 _, brokenset = revlog.getstrippoint(striprev)
67 s.update([revlog.linkrev(r) for r in brokenset])
67 s.update([revlog.linkrev(r) for r in brokenset])
68
68
69 collectone(repo.manifest)
69 collectone(repo.manifest)
70 for fname in files:
70 for fname in files:
71 collectone(repo.file(fname))
71 collectone(repo.file(fname))
72
72
73 return s
73 return s
74
74
75 def strip(ui, repo, nodelist, backup=True, topic='backup'):
75 def strip(ui, repo, nodelist, backup=True, topic='backup'):
76 # This function operates within a transaction of its own, but does
76 # This function operates within a transaction of its own, but does
77 # not take any lock on the repo.
77 # not take any lock on the repo.
78 # Simple way to maintain backwards compatibility for this
78 # Simple way to maintain backwards compatibility for this
79 # argument.
79 # argument.
80 if backup in ['none', 'strip']:
80 if backup in ['none', 'strip']:
81 backup = False
81 backup = False
82
82
83 repo = repo.unfiltered()
83 repo = repo.unfiltered()
84 repo.destroying()
84 repo.destroying()
85
85
86 cl = repo.changelog
86 cl = repo.changelog
87 # TODO handle undo of merge sets
87 # TODO handle undo of merge sets
88 if isinstance(nodelist, str):
88 if isinstance(nodelist, str):
89 nodelist = [nodelist]
89 nodelist = [nodelist]
90 striplist = [cl.rev(node) for node in nodelist]
90 striplist = [cl.rev(node) for node in nodelist]
91 striprev = min(striplist)
91 striprev = min(striplist)
92
92
93 # Some revisions with rev > striprev may not be descendants of striprev.
93 # Some revisions with rev > striprev may not be descendants of striprev.
94 # We have to find these revisions and put them in a bundle, so that
94 # We have to find these revisions and put them in a bundle, so that
95 # we can restore them after the truncations.
95 # we can restore them after the truncations.
96 # To create the bundle we use repo.changegroupsubset which requires
96 # To create the bundle we use repo.changegroupsubset which requires
97 # the list of heads and bases of the set of interesting revisions.
97 # the list of heads and bases of the set of interesting revisions.
98 # (head = revision in the set that has no descendant in the set;
98 # (head = revision in the set that has no descendant in the set;
99 # base = revision in the set that has no ancestor in the set)
99 # base = revision in the set that has no ancestor in the set)
100 tostrip = set(striplist)
100 tostrip = set(striplist)
101 for rev in striplist:
101 for rev in striplist:
102 for desc in cl.descendants([rev]):
102 for desc in cl.descendants([rev]):
103 tostrip.add(desc)
103 tostrip.add(desc)
104
104
105 files = _collectfiles(repo, striprev)
105 files = _collectfiles(repo, striprev)
106 saverevs = _collectbrokencsets(repo, files, striprev)
106 saverevs = _collectbrokencsets(repo, files, striprev)
107
107
108 # compute heads
108 # compute heads
109 saveheads = set(saverevs)
109 saveheads = set(saverevs)
110 for r in xrange(striprev + 1, len(cl)):
110 for r in xrange(striprev + 1, len(cl)):
111 if r not in tostrip:
111 if r not in tostrip:
112 saverevs.add(r)
112 saverevs.add(r)
113 saveheads.difference_update(cl.parentrevs(r))
113 saveheads.difference_update(cl.parentrevs(r))
114 saveheads.add(r)
114 saveheads.add(r)
115 saveheads = [cl.node(r) for r in saveheads]
115 saveheads = [cl.node(r) for r in saveheads]
116
116
117 # compute base nodes
117 # compute base nodes
118 if saverevs:
118 if saverevs:
119 descendants = set(cl.descendants(saverevs))
119 descendants = set(cl.descendants(saverevs))
120 saverevs.difference_update(descendants)
120 saverevs.difference_update(descendants)
121 savebases = [cl.node(r) for r in saverevs]
121 savebases = [cl.node(r) for r in saverevs]
122 stripbases = [cl.node(r) for r in tostrip]
122 stripbases = [cl.node(r) for r in tostrip]
123
123
124 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
124 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
125 # is much faster
125 # is much faster
126 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
126 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
127 if newbmtarget:
127 if newbmtarget:
128 newbmtarget = repo[newbmtarget.first()].node()
128 newbmtarget = repo[newbmtarget.first()].node()
129 else:
129 else:
130 newbmtarget = '.'
130 newbmtarget = '.'
131
131
132 bm = repo._bookmarks
132 bm = repo._bookmarks
133 updatebm = []
133 updatebm = []
134 for m in bm:
134 for m in bm:
135 rev = repo[bm[m]].rev()
135 rev = repo[bm[m]].rev()
136 if rev in tostrip:
136 if rev in tostrip:
137 updatebm.append(m)
137 updatebm.append(m)
138
138
139 # create a changegroup for all the branches we need to keep
139 # create a changegroup for all the branches we need to keep
140 backupfile = None
140 backupfile = None
141 vfs = repo.vfs
141 vfs = repo.vfs
142 node = nodelist[-1]
142 node = nodelist[-1]
143 if backup:
143 if backup:
144 backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
144 backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
145 repo.ui.status(_("saved backup bundle to %s\n") %
145 repo.ui.status(_("saved backup bundle to %s\n") %
146 vfs.join(backupfile))
146 vfs.join(backupfile))
147 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
147 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
148 vfs.join(backupfile))
148 vfs.join(backupfile))
149 if saveheads or savebases:
149 if saveheads or savebases:
150 # do not compress partial bundle if we remove it from disk later
150 # do not compress partial bundle if we remove it from disk later
151 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
151 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
152 compress=False)
152 compress=False)
153
153
154 mfst = repo.manifest
154 mfst = repo.manifest
155
155
156 curtr = repo.currenttransaction()
156 curtr = repo.currenttransaction()
157 if curtr is not None:
157 if curtr is not None:
158 del curtr # avoid carrying reference to transaction for nothing
158 del curtr # avoid carrying reference to transaction for nothing
159 msg = _('programming error: cannot strip from inside a transaction')
159 msg = _('programming error: cannot strip from inside a transaction')
160 raise error.Abort(msg, hint=_('contact your extension maintainer'))
160 raise error.Abort(msg, hint=_('contact your extension maintainer'))
161
161
162 try:
162 try:
163 with repo.transaction("strip") as tr:
163 with repo.transaction("strip") as tr:
164 offset = len(tr.entries)
164 offset = len(tr.entries)
165
165
166 tr.startgroup()
166 tr.startgroup()
167 cl.strip(striprev, tr)
167 cl.strip(striprev, tr)
168 mfst.strip(striprev, tr)
168 mfst.strip(striprev, tr)
169 for fn in files:
169 for fn in files:
170 repo.file(fn).strip(striprev, tr)
170 repo.file(fn).strip(striprev, tr)
171 tr.endgroup()
171 tr.endgroup()
172
172
173 for i in xrange(offset, len(tr.entries)):
173 for i in xrange(offset, len(tr.entries)):
174 file, troffset, ignore = tr.entries[i]
174 file, troffset, ignore = tr.entries[i]
175 repo.svfs(file, 'a').truncate(troffset)
175 repo.svfs(file, 'a').truncate(troffset)
176 if troffset == 0:
176 if troffset == 0:
177 repo.store.markremoved(file)
177 repo.store.markremoved(file)
178
178
179 if saveheads or savebases:
179 if saveheads or savebases:
180 ui.note(_("adding branch\n"))
180 ui.note(_("adding branch\n"))
181 f = vfs.open(chgrpfile, "rb")
181 f = vfs.open(chgrpfile, "rb")
182 gen = exchange.readbundle(ui, f, chgrpfile, vfs)
182 gen = exchange.readbundle(ui, f, chgrpfile, vfs)
183 if not repo.ui.verbose:
183 if not repo.ui.verbose:
184 # silence internal shuffling chatter
184 # silence internal shuffling chatter
185 repo.ui.pushbuffer()
185 repo.ui.pushbuffer()
186 if isinstance(gen, bundle2.unbundle20):
186 if isinstance(gen, bundle2.unbundle20):
187 with repo.transaction('strip') as tr:
187 with repo.transaction('strip') as tr:
188 tr.hookargs = {'source': 'strip',
188 tr.hookargs = {'source': 'strip',
189 'url': 'bundle:' + vfs.join(chgrpfile)}
189 'url': 'bundle:' + vfs.join(chgrpfile)}
190 bundle2.applybundle(repo, gen, tr, source='strip',
190 bundle2.applybundle(repo, gen, tr, source='strip',
191 url='bundle:' + vfs.join(chgrpfile))
191 url='bundle:' + vfs.join(chgrpfile))
192 else:
192 else:
193 gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True)
193 gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True)
194 if not repo.ui.verbose:
194 if not repo.ui.verbose:
195 repo.ui.popbuffer()
195 repo.ui.popbuffer()
196 f.close()
196 f.close()
197 repo._phasecache.invalidate()
197
198
198 for m in updatebm:
199 for m in updatebm:
199 bm[m] = repo[newbmtarget].node()
200 bm[m] = repo[newbmtarget].node()
200 lock = tr = None
201 lock = tr = None
201 try:
202 try:
202 lock = repo.lock()
203 lock = repo.lock()
203 tr = repo.transaction('repair')
204 tr = repo.transaction('repair')
204 bm.recordchange(tr)
205 bm.recordchange(tr)
205 tr.close()
206 tr.close()
206 finally:
207 finally:
207 tr.release()
208 tr.release()
208 lock.release()
209 lock.release()
209
210
210 # remove undo files
211 # remove undo files
211 for undovfs, undofile in repo.undofiles():
212 for undovfs, undofile in repo.undofiles():
212 try:
213 try:
213 undovfs.unlink(undofile)
214 undovfs.unlink(undofile)
214 except OSError as e:
215 except OSError as e:
215 if e.errno != errno.ENOENT:
216 if e.errno != errno.ENOENT:
216 ui.warn(_('error removing %s: %s\n') %
217 ui.warn(_('error removing %s: %s\n') %
217 (undovfs.join(undofile), str(e)))
218 (undovfs.join(undofile), str(e)))
218
219
219 except: # re-raises
220 except: # re-raises
220 if backupfile:
221 if backupfile:
221 ui.warn(_("strip failed, full bundle stored in '%s'\n")
222 ui.warn(_("strip failed, full bundle stored in '%s'\n")
222 % vfs.join(backupfile))
223 % vfs.join(backupfile))
223 elif saveheads:
224 elif saveheads:
224 ui.warn(_("strip failed, partial bundle stored in '%s'\n")
225 ui.warn(_("strip failed, partial bundle stored in '%s'\n")
225 % vfs.join(chgrpfile))
226 % vfs.join(chgrpfile))
226 raise
227 raise
227 else:
228 else:
228 if saveheads or savebases:
229 if saveheads or savebases:
229 # Remove partial backup only if there were no exceptions
230 # Remove partial backup only if there were no exceptions
230 vfs.unlink(chgrpfile)
231 vfs.unlink(chgrpfile)
231
232
232 repo.destroyed()
233 repo.destroyed()
233
234
234 def rebuildfncache(ui, repo):
235 def rebuildfncache(ui, repo):
235 """Rebuilds the fncache file from repo history.
236 """Rebuilds the fncache file from repo history.
236
237
237 Missing entries will be added. Extra entries will be removed.
238 Missing entries will be added. Extra entries will be removed.
238 """
239 """
239 repo = repo.unfiltered()
240 repo = repo.unfiltered()
240
241
241 if 'fncache' not in repo.requirements:
242 if 'fncache' not in repo.requirements:
242 ui.warn(_('(not rebuilding fncache because repository does not '
243 ui.warn(_('(not rebuilding fncache because repository does not '
243 'support fncache)\n'))
244 'support fncache)\n'))
244 return
245 return
245
246
246 with repo.lock():
247 with repo.lock():
247 fnc = repo.store.fncache
248 fnc = repo.store.fncache
248 # Trigger load of fncache.
249 # Trigger load of fncache.
249 if 'irrelevant' in fnc:
250 if 'irrelevant' in fnc:
250 pass
251 pass
251
252
252 oldentries = set(fnc.entries)
253 oldentries = set(fnc.entries)
253 newentries = set()
254 newentries = set()
254 seenfiles = set()
255 seenfiles = set()
255
256
256 repolen = len(repo)
257 repolen = len(repo)
257 for rev in repo:
258 for rev in repo:
258 ui.progress(_('rebuilding'), rev, total=repolen,
259 ui.progress(_('rebuilding'), rev, total=repolen,
259 unit=_('changesets'))
260 unit=_('changesets'))
260
261
261 ctx = repo[rev]
262 ctx = repo[rev]
262 for f in ctx.files():
263 for f in ctx.files():
263 # This is to minimize I/O.
264 # This is to minimize I/O.
264 if f in seenfiles:
265 if f in seenfiles:
265 continue
266 continue
266 seenfiles.add(f)
267 seenfiles.add(f)
267
268
268 i = 'data/%s.i' % f
269 i = 'data/%s.i' % f
269 d = 'data/%s.d' % f
270 d = 'data/%s.d' % f
270
271
271 if repo.store._exists(i):
272 if repo.store._exists(i):
272 newentries.add(i)
273 newentries.add(i)
273 if repo.store._exists(d):
274 if repo.store._exists(d):
274 newentries.add(d)
275 newentries.add(d)
275
276
276 ui.progress(_('rebuilding'), None)
277 ui.progress(_('rebuilding'), None)
277
278
278 if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
279 if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
279 for dir in util.dirs(seenfiles):
280 for dir in util.dirs(seenfiles):
280 i = 'meta/%s/00manifest.i' % dir
281 i = 'meta/%s/00manifest.i' % dir
281 d = 'meta/%s/00manifest.d' % dir
282 d = 'meta/%s/00manifest.d' % dir
282
283
283 if repo.store._exists(i):
284 if repo.store._exists(i):
284 newentries.add(i)
285 newentries.add(i)
285 if repo.store._exists(d):
286 if repo.store._exists(d):
286 newentries.add(d)
287 newentries.add(d)
287
288
288 addcount = len(newentries - oldentries)
289 addcount = len(newentries - oldentries)
289 removecount = len(oldentries - newentries)
290 removecount = len(oldentries - newentries)
290 for p in sorted(oldentries - newentries):
291 for p in sorted(oldentries - newentries):
291 ui.write(_('removing %s\n') % p)
292 ui.write(_('removing %s\n') % p)
292 for p in sorted(newentries - oldentries):
293 for p in sorted(newentries - oldentries):
293 ui.write(_('adding %s\n') % p)
294 ui.write(_('adding %s\n') % p)
294
295
295 if addcount or removecount:
296 if addcount or removecount:
296 ui.write(_('%d items added, %d removed from fncache\n') %
297 ui.write(_('%d items added, %d removed from fncache\n') %
297 (addcount, removecount))
298 (addcount, removecount))
298 fnc.entries = newentries
299 fnc.entries = newentries
299 fnc._dirty = True
300 fnc._dirty = True
300
301
301 with repo.transaction('fncache') as tr:
302 with repo.transaction('fncache') as tr:
302 fnc.write(tr)
303 fnc.write(tr)
303 else:
304 else:
304 ui.write(_('fncache already up to date\n'))
305 ui.write(_('fncache already up to date\n'))
305
306
306 def stripbmrevset(repo, mark):
307 def stripbmrevset(repo, mark):
307 """
308 """
308 The revset to strip when strip is called with -B mark
309 The revset to strip when strip is called with -B mark
309
310
310 Needs to live here so extensions can use it and wrap it even when strip is
311 Needs to live here so extensions can use it and wrap it even when strip is
311 not enabled or not present on a box.
312 not enabled or not present on a box.
312 """
313 """
313 return repo.revs("ancestors(bookmark(%s)) - "
314 return repo.revs("ancestors(bookmark(%s)) - "
314 "ancestors(head() and not bookmark(%s)) - "
315 "ancestors(head() and not bookmark(%s)) - "
315 "ancestors(bookmark() and not bookmark(%s))",
316 "ancestors(bookmark() and not bookmark(%s))",
316 mark, mark, mark)
317 mark, mark, mark)
317
318
318 def deleteobsmarkers(obsstore, indices):
319 def deleteobsmarkers(obsstore, indices):
319 """Delete some obsmarkers from obsstore and return how many were deleted
320 """Delete some obsmarkers from obsstore and return how many were deleted
320
321
321 'indices' is a list of ints which are the indices
322 'indices' is a list of ints which are the indices
322 of the markers to be deleted.
323 of the markers to be deleted.
323
324
324 Every invocation of this function completely rewrites the obsstore file,
325 Every invocation of this function completely rewrites the obsstore file,
325 skipping the markers we want to be removed. The new temporary file is
326 skipping the markers we want to be removed. The new temporary file is
326 created, remaining markers are written there and on .close() this file
327 created, remaining markers are written there and on .close() this file
327 gets atomically renamed to obsstore, thus guaranteeing consistency."""
328 gets atomically renamed to obsstore, thus guaranteeing consistency."""
328 if not indices:
329 if not indices:
329 # we don't want to rewrite the obsstore with the same content
330 # we don't want to rewrite the obsstore with the same content
330 return
331 return
331
332
332 left = []
333 left = []
333 current = obsstore._all
334 current = obsstore._all
334 n = 0
335 n = 0
335 for i, m in enumerate(current):
336 for i, m in enumerate(current):
336 if i in indices:
337 if i in indices:
337 n += 1
338 n += 1
338 continue
339 continue
339 left.append(m)
340 left.append(m)
340
341
341 newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True)
342 newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True)
342 for bytes in obsolete.encodemarkers(left, True, obsstore._version):
343 for bytes in obsolete.encodemarkers(left, True, obsstore._version):
343 newobsstorefile.write(bytes)
344 newobsstorefile.write(bytes)
344 newobsstorefile.close()
345 newobsstorefile.close()
345 return n
346 return n
@@ -1,863 +1,898 b''
1 $ echo "[format]" >> $HGRCPATH
1 $ echo "[format]" >> $HGRCPATH
2 $ echo "usegeneraldelta=yes" >> $HGRCPATH
2 $ echo "usegeneraldelta=yes" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "strip=" >> $HGRCPATH
4 $ echo "strip=" >> $HGRCPATH
5
5
6 $ restore() {
6 $ restore() {
7 > hg unbundle -q .hg/strip-backup/*
7 > hg unbundle -q .hg/strip-backup/*
8 > rm .hg/strip-backup/*
8 > rm .hg/strip-backup/*
9 > }
9 > }
10 $ teststrip() {
10 $ teststrip() {
11 > hg up -C $1
11 > hg up -C $1
12 > echo % before update $1, strip $2
12 > echo % before update $1, strip $2
13 > hg parents
13 > hg parents
14 > hg --traceback strip $2
14 > hg --traceback strip $2
15 > echo % after update $1, strip $2
15 > echo % after update $1, strip $2
16 > hg parents
16 > hg parents
17 > restore
17 > restore
18 > }
18 > }
19
19
20 $ hg init test
20 $ hg init test
21 $ cd test
21 $ cd test
22
22
23 $ echo foo > bar
23 $ echo foo > bar
24 $ hg ci -Ama
24 $ hg ci -Ama
25 adding bar
25 adding bar
26
26
27 $ echo more >> bar
27 $ echo more >> bar
28 $ hg ci -Amb
28 $ hg ci -Amb
29
29
30 $ echo blah >> bar
30 $ echo blah >> bar
31 $ hg ci -Amc
31 $ hg ci -Amc
32
32
33 $ hg up 1
33 $ hg up 1
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 $ echo blah >> bar
35 $ echo blah >> bar
36 $ hg ci -Amd
36 $ hg ci -Amd
37 created new head
37 created new head
38
38
39 $ echo final >> bar
39 $ echo final >> bar
40 $ hg ci -Ame
40 $ hg ci -Ame
41
41
42 $ hg log
42 $ hg log
43 changeset: 4:443431ffac4f
43 changeset: 4:443431ffac4f
44 tag: tip
44 tag: tip
45 user: test
45 user: test
46 date: Thu Jan 01 00:00:00 1970 +0000
46 date: Thu Jan 01 00:00:00 1970 +0000
47 summary: e
47 summary: e
48
48
49 changeset: 3:65bd5f99a4a3
49 changeset: 3:65bd5f99a4a3
50 parent: 1:ef3a871183d7
50 parent: 1:ef3a871183d7
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: d
53 summary: d
54
54
55 changeset: 2:264128213d29
55 changeset: 2:264128213d29
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: c
58 summary: c
59
59
60 changeset: 1:ef3a871183d7
60 changeset: 1:ef3a871183d7
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: b
63 summary: b
64
64
65 changeset: 0:9ab35a2d17cb
65 changeset: 0:9ab35a2d17cb
66 user: test
66 user: test
67 date: Thu Jan 01 00:00:00 1970 +0000
67 date: Thu Jan 01 00:00:00 1970 +0000
68 summary: a
68 summary: a
69
69
70
70
71 $ teststrip 4 4
71 $ teststrip 4 4
72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 % before update 4, strip 4
73 % before update 4, strip 4
74 changeset: 4:443431ffac4f
74 changeset: 4:443431ffac4f
75 tag: tip
75 tag: tip
76 user: test
76 user: test
77 date: Thu Jan 01 00:00:00 1970 +0000
77 date: Thu Jan 01 00:00:00 1970 +0000
78 summary: e
78 summary: e
79
79
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
81 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
82 % after update 4, strip 4
82 % after update 4, strip 4
83 changeset: 3:65bd5f99a4a3
83 changeset: 3:65bd5f99a4a3
84 tag: tip
84 tag: tip
85 parent: 1:ef3a871183d7
85 parent: 1:ef3a871183d7
86 user: test
86 user: test
87 date: Thu Jan 01 00:00:00 1970 +0000
87 date: Thu Jan 01 00:00:00 1970 +0000
88 summary: d
88 summary: d
89
89
90 $ teststrip 4 3
90 $ teststrip 4 3
91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 % before update 4, strip 3
92 % before update 4, strip 3
93 changeset: 4:443431ffac4f
93 changeset: 4:443431ffac4f
94 tag: tip
94 tag: tip
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:00 1970 +0000
96 date: Thu Jan 01 00:00:00 1970 +0000
97 summary: e
97 summary: e
98
98
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
100 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
101 % after update 4, strip 3
101 % after update 4, strip 3
102 changeset: 1:ef3a871183d7
102 changeset: 1:ef3a871183d7
103 user: test
103 user: test
104 date: Thu Jan 01 00:00:00 1970 +0000
104 date: Thu Jan 01 00:00:00 1970 +0000
105 summary: b
105 summary: b
106
106
107 $ teststrip 1 4
107 $ teststrip 1 4
108 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 % before update 1, strip 4
109 % before update 1, strip 4
110 changeset: 1:ef3a871183d7
110 changeset: 1:ef3a871183d7
111 user: test
111 user: test
112 date: Thu Jan 01 00:00:00 1970 +0000
112 date: Thu Jan 01 00:00:00 1970 +0000
113 summary: b
113 summary: b
114
114
115 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
115 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
116 % after update 1, strip 4
116 % after update 1, strip 4
117 changeset: 1:ef3a871183d7
117 changeset: 1:ef3a871183d7
118 user: test
118 user: test
119 date: Thu Jan 01 00:00:00 1970 +0000
119 date: Thu Jan 01 00:00:00 1970 +0000
120 summary: b
120 summary: b
121
121
122 $ teststrip 4 2
122 $ teststrip 4 2
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 % before update 4, strip 2
124 % before update 4, strip 2
125 changeset: 4:443431ffac4f
125 changeset: 4:443431ffac4f
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: e
129 summary: e
130
130
131 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
131 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
132 % after update 4, strip 2
132 % after update 4, strip 2
133 changeset: 3:443431ffac4f
133 changeset: 3:443431ffac4f
134 tag: tip
134 tag: tip
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: e
137 summary: e
138
138
139 $ teststrip 4 1
139 $ teststrip 4 1
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 % before update 4, strip 1
141 % before update 4, strip 1
142 changeset: 4:264128213d29
142 changeset: 4:264128213d29
143 tag: tip
143 tag: tip
144 parent: 1:ef3a871183d7
144 parent: 1:ef3a871183d7
145 user: test
145 user: test
146 date: Thu Jan 01 00:00:00 1970 +0000
146 date: Thu Jan 01 00:00:00 1970 +0000
147 summary: c
147 summary: c
148
148
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
150 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
151 % after update 4, strip 1
151 % after update 4, strip 1
152 changeset: 0:9ab35a2d17cb
152 changeset: 0:9ab35a2d17cb
153 tag: tip
153 tag: tip
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: a
156 summary: a
157
157
158 $ teststrip null 4
158 $ teststrip null 4
159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
160 % before update null, strip 4
160 % before update null, strip 4
161 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
161 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
162 % after update null, strip 4
162 % after update null, strip 4
163
163
164 $ hg log
164 $ hg log
165 changeset: 4:264128213d29
165 changeset: 4:264128213d29
166 tag: tip
166 tag: tip
167 parent: 1:ef3a871183d7
167 parent: 1:ef3a871183d7
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: c
170 summary: c
171
171
172 changeset: 3:443431ffac4f
172 changeset: 3:443431ffac4f
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: e
175 summary: e
176
176
177 changeset: 2:65bd5f99a4a3
177 changeset: 2:65bd5f99a4a3
178 user: test
178 user: test
179 date: Thu Jan 01 00:00:00 1970 +0000
179 date: Thu Jan 01 00:00:00 1970 +0000
180 summary: d
180 summary: d
181
181
182 changeset: 1:ef3a871183d7
182 changeset: 1:ef3a871183d7
183 user: test
183 user: test
184 date: Thu Jan 01 00:00:00 1970 +0000
184 date: Thu Jan 01 00:00:00 1970 +0000
185 summary: b
185 summary: b
186
186
187 changeset: 0:9ab35a2d17cb
187 changeset: 0:9ab35a2d17cb
188 user: test
188 user: test
189 date: Thu Jan 01 00:00:00 1970 +0000
189 date: Thu Jan 01 00:00:00 1970 +0000
190 summary: a
190 summary: a
191
191
192 $ hg up -C 4
192 $ hg up -C 4
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 $ hg parents
194 $ hg parents
195 changeset: 4:264128213d29
195 changeset: 4:264128213d29
196 tag: tip
196 tag: tip
197 parent: 1:ef3a871183d7
197 parent: 1:ef3a871183d7
198 user: test
198 user: test
199 date: Thu Jan 01 00:00:00 1970 +0000
199 date: Thu Jan 01 00:00:00 1970 +0000
200 summary: c
200 summary: c
201
201
202
202
203 $ hg --traceback strip 4
203 $ hg --traceback strip 4
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
205 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
206 $ hg parents
206 $ hg parents
207 changeset: 1:ef3a871183d7
207 changeset: 1:ef3a871183d7
208 user: test
208 user: test
209 date: Thu Jan 01 00:00:00 1970 +0000
209 date: Thu Jan 01 00:00:00 1970 +0000
210 summary: b
210 summary: b
211
211
212 $ hg debugbundle .hg/strip-backup/*
212 $ hg debugbundle .hg/strip-backup/*
213 Stream params: {'Compression': 'BZ'}
213 Stream params: {'Compression': 'BZ'}
214 changegroup -- "{'version': '02'}"
214 changegroup -- "{'version': '02'}"
215 264128213d290d868c54642d13aeaa3675551a78
215 264128213d290d868c54642d13aeaa3675551a78
216 $ hg pull .hg/strip-backup/*
216 $ hg pull .hg/strip-backup/*
217 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
217 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
218 searching for changes
218 searching for changes
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
222 added 1 changesets with 0 changes to 0 files (+1 heads)
222 added 1 changesets with 0 changes to 0 files (+1 heads)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
224 $ rm .hg/strip-backup/*
224 $ rm .hg/strip-backup/*
225 $ hg log --graph
225 $ hg log --graph
226 o changeset: 4:264128213d29
226 o changeset: 4:264128213d29
227 | tag: tip
227 | tag: tip
228 | parent: 1:ef3a871183d7
228 | parent: 1:ef3a871183d7
229 | user: test
229 | user: test
230 | date: Thu Jan 01 00:00:00 1970 +0000
230 | date: Thu Jan 01 00:00:00 1970 +0000
231 | summary: c
231 | summary: c
232 |
232 |
233 | o changeset: 3:443431ffac4f
233 | o changeset: 3:443431ffac4f
234 | | user: test
234 | | user: test
235 | | date: Thu Jan 01 00:00:00 1970 +0000
235 | | date: Thu Jan 01 00:00:00 1970 +0000
236 | | summary: e
236 | | summary: e
237 | |
237 | |
238 | o changeset: 2:65bd5f99a4a3
238 | o changeset: 2:65bd5f99a4a3
239 |/ user: test
239 |/ user: test
240 | date: Thu Jan 01 00:00:00 1970 +0000
240 | date: Thu Jan 01 00:00:00 1970 +0000
241 | summary: d
241 | summary: d
242 |
242 |
243 @ changeset: 1:ef3a871183d7
243 @ changeset: 1:ef3a871183d7
244 | user: test
244 | user: test
245 | date: Thu Jan 01 00:00:00 1970 +0000
245 | date: Thu Jan 01 00:00:00 1970 +0000
246 | summary: b
246 | summary: b
247 |
247 |
248 o changeset: 0:9ab35a2d17cb
248 o changeset: 0:9ab35a2d17cb
249 user: test
249 user: test
250 date: Thu Jan 01 00:00:00 1970 +0000
250 date: Thu Jan 01 00:00:00 1970 +0000
251 summary: a
251 summary: a
252
252
253 $ hg up -C 2
253 $ hg up -C 2
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 $ hg merge 4
255 $ hg merge 4
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 (branch merge, don't forget to commit)
257 (branch merge, don't forget to commit)
258
258
259 before strip of merge parent
259 before strip of merge parent
260
260
261 $ hg parents
261 $ hg parents
262 changeset: 2:65bd5f99a4a3
262 changeset: 2:65bd5f99a4a3
263 user: test
263 user: test
264 date: Thu Jan 01 00:00:00 1970 +0000
264 date: Thu Jan 01 00:00:00 1970 +0000
265 summary: d
265 summary: d
266
266
267 changeset: 4:264128213d29
267 changeset: 4:264128213d29
268 tag: tip
268 tag: tip
269 parent: 1:ef3a871183d7
269 parent: 1:ef3a871183d7
270 user: test
270 user: test
271 date: Thu Jan 01 00:00:00 1970 +0000
271 date: Thu Jan 01 00:00:00 1970 +0000
272 summary: c
272 summary: c
273
273
274 $ hg strip 4
274 $ hg strip 4
275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
276 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
277
277
278 after strip of merge parent
278 after strip of merge parent
279
279
280 $ hg parents
280 $ hg parents
281 changeset: 1:ef3a871183d7
281 changeset: 1:ef3a871183d7
282 user: test
282 user: test
283 date: Thu Jan 01 00:00:00 1970 +0000
283 date: Thu Jan 01 00:00:00 1970 +0000
284 summary: b
284 summary: b
285
285
286 $ restore
286 $ restore
287
287
288 $ hg up
288 $ hg up
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 1 other heads for branch "default"
290 1 other heads for branch "default"
291 $ hg log -G
291 $ hg log -G
292 @ changeset: 4:264128213d29
292 @ changeset: 4:264128213d29
293 | tag: tip
293 | tag: tip
294 | parent: 1:ef3a871183d7
294 | parent: 1:ef3a871183d7
295 | user: test
295 | user: test
296 | date: Thu Jan 01 00:00:00 1970 +0000
296 | date: Thu Jan 01 00:00:00 1970 +0000
297 | summary: c
297 | summary: c
298 |
298 |
299 | o changeset: 3:443431ffac4f
299 | o changeset: 3:443431ffac4f
300 | | user: test
300 | | user: test
301 | | date: Thu Jan 01 00:00:00 1970 +0000
301 | | date: Thu Jan 01 00:00:00 1970 +0000
302 | | summary: e
302 | | summary: e
303 | |
303 | |
304 | o changeset: 2:65bd5f99a4a3
304 | o changeset: 2:65bd5f99a4a3
305 |/ user: test
305 |/ user: test
306 | date: Thu Jan 01 00:00:00 1970 +0000
306 | date: Thu Jan 01 00:00:00 1970 +0000
307 | summary: d
307 | summary: d
308 |
308 |
309 o changeset: 1:ef3a871183d7
309 o changeset: 1:ef3a871183d7
310 | user: test
310 | user: test
311 | date: Thu Jan 01 00:00:00 1970 +0000
311 | date: Thu Jan 01 00:00:00 1970 +0000
312 | summary: b
312 | summary: b
313 |
313 |
314 o changeset: 0:9ab35a2d17cb
314 o changeset: 0:9ab35a2d17cb
315 user: test
315 user: test
316 date: Thu Jan 01 00:00:00 1970 +0000
316 date: Thu Jan 01 00:00:00 1970 +0000
317 summary: a
317 summary: a
318
318
319
319
320 2 is parent of 3, only one strip should happen
320 2 is parent of 3, only one strip should happen
321
321
322 $ hg strip "roots(2)" 3
322 $ hg strip "roots(2)" 3
323 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
323 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
324 $ hg log -G
324 $ hg log -G
325 @ changeset: 2:264128213d29
325 @ changeset: 2:264128213d29
326 | tag: tip
326 | tag: tip
327 | user: test
327 | user: test
328 | date: Thu Jan 01 00:00:00 1970 +0000
328 | date: Thu Jan 01 00:00:00 1970 +0000
329 | summary: c
329 | summary: c
330 |
330 |
331 o changeset: 1:ef3a871183d7
331 o changeset: 1:ef3a871183d7
332 | user: test
332 | user: test
333 | date: Thu Jan 01 00:00:00 1970 +0000
333 | date: Thu Jan 01 00:00:00 1970 +0000
334 | summary: b
334 | summary: b
335 |
335 |
336 o changeset: 0:9ab35a2d17cb
336 o changeset: 0:9ab35a2d17cb
337 user: test
337 user: test
338 date: Thu Jan 01 00:00:00 1970 +0000
338 date: Thu Jan 01 00:00:00 1970 +0000
339 summary: a
339 summary: a
340
340
341 $ restore
341 $ restore
342 $ hg log -G
342 $ hg log -G
343 o changeset: 4:443431ffac4f
343 o changeset: 4:443431ffac4f
344 | tag: tip
344 | tag: tip
345 | user: test
345 | user: test
346 | date: Thu Jan 01 00:00:00 1970 +0000
346 | date: Thu Jan 01 00:00:00 1970 +0000
347 | summary: e
347 | summary: e
348 |
348 |
349 o changeset: 3:65bd5f99a4a3
349 o changeset: 3:65bd5f99a4a3
350 | parent: 1:ef3a871183d7
350 | parent: 1:ef3a871183d7
351 | user: test
351 | user: test
352 | date: Thu Jan 01 00:00:00 1970 +0000
352 | date: Thu Jan 01 00:00:00 1970 +0000
353 | summary: d
353 | summary: d
354 |
354 |
355 | @ changeset: 2:264128213d29
355 | @ changeset: 2:264128213d29
356 |/ user: test
356 |/ user: test
357 | date: Thu Jan 01 00:00:00 1970 +0000
357 | date: Thu Jan 01 00:00:00 1970 +0000
358 | summary: c
358 | summary: c
359 |
359 |
360 o changeset: 1:ef3a871183d7
360 o changeset: 1:ef3a871183d7
361 | user: test
361 | user: test
362 | date: Thu Jan 01 00:00:00 1970 +0000
362 | date: Thu Jan 01 00:00:00 1970 +0000
363 | summary: b
363 | summary: b
364 |
364 |
365 o changeset: 0:9ab35a2d17cb
365 o changeset: 0:9ab35a2d17cb
366 user: test
366 user: test
367 date: Thu Jan 01 00:00:00 1970 +0000
367 date: Thu Jan 01 00:00:00 1970 +0000
368 summary: a
368 summary: a
369
369
370
370
371 2 different branches: 2 strips
371 2 different branches: 2 strips
372
372
373 $ hg strip 2 4
373 $ hg strip 2 4
374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
375 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
375 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
376 $ hg log -G
376 $ hg log -G
377 o changeset: 2:65bd5f99a4a3
377 o changeset: 2:65bd5f99a4a3
378 | tag: tip
378 | tag: tip
379 | user: test
379 | user: test
380 | date: Thu Jan 01 00:00:00 1970 +0000
380 | date: Thu Jan 01 00:00:00 1970 +0000
381 | summary: d
381 | summary: d
382 |
382 |
383 @ changeset: 1:ef3a871183d7
383 @ changeset: 1:ef3a871183d7
384 | user: test
384 | user: test
385 | date: Thu Jan 01 00:00:00 1970 +0000
385 | date: Thu Jan 01 00:00:00 1970 +0000
386 | summary: b
386 | summary: b
387 |
387 |
388 o changeset: 0:9ab35a2d17cb
388 o changeset: 0:9ab35a2d17cb
389 user: test
389 user: test
390 date: Thu Jan 01 00:00:00 1970 +0000
390 date: Thu Jan 01 00:00:00 1970 +0000
391 summary: a
391 summary: a
392
392
393 $ restore
393 $ restore
394
394
395 2 different branches and a common ancestor: 1 strip
395 2 different branches and a common ancestor: 1 strip
396
396
397 $ hg strip 1 "2|4"
397 $ hg strip 1 "2|4"
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
399 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
400 $ restore
400 $ restore
401
401
402 verify fncache is kept up-to-date
402 verify fncache is kept up-to-date
403
403
404 $ touch a
404 $ touch a
405 $ hg ci -qAm a
405 $ hg ci -qAm a
406 $ cat .hg/store/fncache | sort
406 $ cat .hg/store/fncache | sort
407 data/a.i
407 data/a.i
408 data/bar.i
408 data/bar.i
409 $ hg strip tip
409 $ hg strip tip
410 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
410 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
411 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
411 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
412 $ cat .hg/store/fncache
412 $ cat .hg/store/fncache
413 data/bar.i
413 data/bar.i
414
414
415 stripping an empty revset
415 stripping an empty revset
416
416
417 $ hg strip "1 and not 1"
417 $ hg strip "1 and not 1"
418 abort: empty revision set
418 abort: empty revision set
419 [255]
419 [255]
420
420
421 remove branchy history for qimport tests
421 remove branchy history for qimport tests
422
422
423 $ hg strip 3
423 $ hg strip 3
424 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
424 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
425
425
426
426
427 strip of applied mq should cleanup status file
427 strip of applied mq should cleanup status file
428
428
429 $ echo "mq=" >> $HGRCPATH
429 $ echo "mq=" >> $HGRCPATH
430 $ hg up -C 3
430 $ hg up -C 3
431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
432 $ echo fooagain >> bar
432 $ echo fooagain >> bar
433 $ hg ci -mf
433 $ hg ci -mf
434 $ hg qimport -r tip:2
434 $ hg qimport -r tip:2
435
435
436 applied patches before strip
436 applied patches before strip
437
437
438 $ hg qapplied
438 $ hg qapplied
439 d
439 d
440 e
440 e
441 f
441 f
442
442
443 stripping revision in queue
443 stripping revision in queue
444
444
445 $ hg strip 3
445 $ hg strip 3
446 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
446 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
447 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
448
448
449 applied patches after stripping rev in queue
449 applied patches after stripping rev in queue
450
450
451 $ hg qapplied
451 $ hg qapplied
452 d
452 d
453
453
454 stripping ancestor of queue
454 stripping ancestor of queue
455
455
456 $ hg strip 1
456 $ hg strip 1
457 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
458 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
458 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
459
459
460 applied patches after stripping ancestor of queue
460 applied patches after stripping ancestor of queue
461
461
462 $ hg qapplied
462 $ hg qapplied
463
463
464 Verify strip protects against stripping wc parent when there are uncommitted mods
464 Verify strip protects against stripping wc parent when there are uncommitted mods
465
465
466 $ echo b > b
466 $ echo b > b
467 $ echo bb > bar
467 $ echo bb > bar
468 $ hg add b
468 $ hg add b
469 $ hg ci -m 'b'
469 $ hg ci -m 'b'
470 $ hg log --graph
470 $ hg log --graph
471 @ changeset: 1:76dcf9fab855
471 @ changeset: 1:76dcf9fab855
472 | tag: tip
472 | tag: tip
473 | user: test
473 | user: test
474 | date: Thu Jan 01 00:00:00 1970 +0000
474 | date: Thu Jan 01 00:00:00 1970 +0000
475 | summary: b
475 | summary: b
476 |
476 |
477 o changeset: 0:9ab35a2d17cb
477 o changeset: 0:9ab35a2d17cb
478 user: test
478 user: test
479 date: Thu Jan 01 00:00:00 1970 +0000
479 date: Thu Jan 01 00:00:00 1970 +0000
480 summary: a
480 summary: a
481
481
482 $ hg up 0
482 $ hg up 0
483 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
483 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
484 $ echo c > bar
484 $ echo c > bar
485 $ hg up -t false
485 $ hg up -t false
486 merging bar
486 merging bar
487 merging bar failed!
487 merging bar failed!
488 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
488 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
489 use 'hg resolve' to retry unresolved file merges
489 use 'hg resolve' to retry unresolved file merges
490 [1]
490 [1]
491 $ hg sum
491 $ hg sum
492 parent: 1:76dcf9fab855 tip
492 parent: 1:76dcf9fab855 tip
493 b
493 b
494 branch: default
494 branch: default
495 commit: 1 modified, 1 unknown, 1 unresolved
495 commit: 1 modified, 1 unknown, 1 unresolved
496 update: (current)
496 update: (current)
497 phases: 2 draft
497 phases: 2 draft
498 mq: 3 unapplied
498 mq: 3 unapplied
499
499
500 $ echo c > b
500 $ echo c > b
501 $ hg strip tip
501 $ hg strip tip
502 abort: local changes found
502 abort: local changes found
503 [255]
503 [255]
504 $ hg strip tip --keep
504 $ hg strip tip --keep
505 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
505 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
506 $ hg log --graph
506 $ hg log --graph
507 @ changeset: 0:9ab35a2d17cb
507 @ changeset: 0:9ab35a2d17cb
508 tag: tip
508 tag: tip
509 user: test
509 user: test
510 date: Thu Jan 01 00:00:00 1970 +0000
510 date: Thu Jan 01 00:00:00 1970 +0000
511 summary: a
511 summary: a
512
512
513 $ hg status
513 $ hg status
514 M bar
514 M bar
515 ? b
515 ? b
516 ? bar.orig
516 ? bar.orig
517
517
518 $ rm bar.orig
518 $ rm bar.orig
519 $ hg sum
519 $ hg sum
520 parent: 0:9ab35a2d17cb tip
520 parent: 0:9ab35a2d17cb tip
521 a
521 a
522 branch: default
522 branch: default
523 commit: 1 modified, 1 unknown
523 commit: 1 modified, 1 unknown
524 update: (current)
524 update: (current)
525 phases: 1 draft
525 phases: 1 draft
526 mq: 3 unapplied
526 mq: 3 unapplied
527
527
528 Strip adds, removes, modifies with --keep
528 Strip adds, removes, modifies with --keep
529
529
530 $ touch b
530 $ touch b
531 $ hg add b
531 $ hg add b
532 $ hg commit -mb
532 $ hg commit -mb
533 $ touch c
533 $ touch c
534
534
535 ... with a clean working dir
535 ... with a clean working dir
536
536
537 $ hg add c
537 $ hg add c
538 $ hg rm bar
538 $ hg rm bar
539 $ hg commit -mc
539 $ hg commit -mc
540 $ hg status
540 $ hg status
541 $ hg strip --keep tip
541 $ hg strip --keep tip
542 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
542 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
543 $ hg status
543 $ hg status
544 ! bar
544 ! bar
545 ? c
545 ? c
546
546
547 ... with a dirty working dir
547 ... with a dirty working dir
548
548
549 $ hg add c
549 $ hg add c
550 $ hg rm bar
550 $ hg rm bar
551 $ hg commit -mc
551 $ hg commit -mc
552 $ hg status
552 $ hg status
553 $ echo b > b
553 $ echo b > b
554 $ echo d > d
554 $ echo d > d
555 $ hg strip --keep tip
555 $ hg strip --keep tip
556 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
556 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
557 $ hg status
557 $ hg status
558 M b
558 M b
559 ! bar
559 ! bar
560 ? c
560 ? c
561 ? d
561 ? d
562
562
563 ... after updating the dirstate
563 ... after updating the dirstate
564 $ hg add c
564 $ hg add c
565 $ hg commit -mc
565 $ hg commit -mc
566 $ hg rm c
566 $ hg rm c
567 $ hg commit -mc
567 $ hg commit -mc
568 $ hg strip --keep '.^' -q
568 $ hg strip --keep '.^' -q
569 $ cd ..
569 $ cd ..
570
570
571 stripping many nodes on a complex graph (issue3299)
571 stripping many nodes on a complex graph (issue3299)
572
572
573 $ hg init issue3299
573 $ hg init issue3299
574 $ cd issue3299
574 $ cd issue3299
575 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
575 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
576 $ hg strip 'not ancestors(x)'
576 $ hg strip 'not ancestors(x)'
577 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
577 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
578
578
579 test hg strip -B bookmark
579 test hg strip -B bookmark
580
580
581 $ cd ..
581 $ cd ..
582 $ hg init bookmarks
582 $ hg init bookmarks
583 $ cd bookmarks
583 $ cd bookmarks
584 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
584 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
585 $ hg bookmark -r 'a' 'todelete'
585 $ hg bookmark -r 'a' 'todelete'
586 $ hg bookmark -r 'b' 'B'
586 $ hg bookmark -r 'b' 'B'
587 $ hg bookmark -r 'b' 'nostrip'
587 $ hg bookmark -r 'b' 'nostrip'
588 $ hg bookmark -r 'c' 'delete'
588 $ hg bookmark -r 'c' 'delete'
589 $ hg bookmark -r 'd' 'multipledelete1'
589 $ hg bookmark -r 'd' 'multipledelete1'
590 $ hg bookmark -r 'e' 'multipledelete2'
590 $ hg bookmark -r 'e' 'multipledelete2'
591 $ hg bookmark -r 'f' 'singlenode1'
591 $ hg bookmark -r 'f' 'singlenode1'
592 $ hg bookmark -r 'f' 'singlenode2'
592 $ hg bookmark -r 'f' 'singlenode2'
593 $ hg up -C todelete
593 $ hg up -C todelete
594 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
594 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
595 (activating bookmark todelete)
595 (activating bookmark todelete)
596 $ hg strip -B nostrip
596 $ hg strip -B nostrip
597 bookmark 'nostrip' deleted
597 bookmark 'nostrip' deleted
598 abort: empty revision set
598 abort: empty revision set
599 [255]
599 [255]
600 $ hg strip -B todelete
600 $ hg strip -B todelete
601 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
601 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
602 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
602 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
603 bookmark 'todelete' deleted
603 bookmark 'todelete' deleted
604 $ hg id -ir dcbb326fdec2
604 $ hg id -ir dcbb326fdec2
605 abort: unknown revision 'dcbb326fdec2'!
605 abort: unknown revision 'dcbb326fdec2'!
606 [255]
606 [255]
607 $ hg id -ir d62d843c9a01
607 $ hg id -ir d62d843c9a01
608 d62d843c9a01
608 d62d843c9a01
609 $ hg bookmarks
609 $ hg bookmarks
610 B 9:ff43616e5d0f
610 B 9:ff43616e5d0f
611 delete 6:2702dd0c91e7
611 delete 6:2702dd0c91e7
612 multipledelete1 11:e46a4836065c
612 multipledelete1 11:e46a4836065c
613 multipledelete2 12:b4594d867745
613 multipledelete2 12:b4594d867745
614 singlenode1 13:43227190fef8
614 singlenode1 13:43227190fef8
615 singlenode2 13:43227190fef8
615 singlenode2 13:43227190fef8
616 $ hg strip -B multipledelete1 -B multipledelete2
616 $ hg strip -B multipledelete1 -B multipledelete2
617 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob)
617 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob)
618 bookmark 'multipledelete1' deleted
618 bookmark 'multipledelete1' deleted
619 bookmark 'multipledelete2' deleted
619 bookmark 'multipledelete2' deleted
620 $ hg id -ir e46a4836065c
620 $ hg id -ir e46a4836065c
621 abort: unknown revision 'e46a4836065c'!
621 abort: unknown revision 'e46a4836065c'!
622 [255]
622 [255]
623 $ hg id -ir b4594d867745
623 $ hg id -ir b4594d867745
624 abort: unknown revision 'b4594d867745'!
624 abort: unknown revision 'b4594d867745'!
625 [255]
625 [255]
626 $ hg strip -B singlenode1 -B singlenode2
626 $ hg strip -B singlenode1 -B singlenode2
627 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob)
627 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob)
628 bookmark 'singlenode1' deleted
628 bookmark 'singlenode1' deleted
629 bookmark 'singlenode2' deleted
629 bookmark 'singlenode2' deleted
630 $ hg id -ir 43227190fef8
630 $ hg id -ir 43227190fef8
631 abort: unknown revision '43227190fef8'!
631 abort: unknown revision '43227190fef8'!
632 [255]
632 [255]
633 $ hg strip -B unknownbookmark
633 $ hg strip -B unknownbookmark
634 abort: bookmark 'unknownbookmark' not found
634 abort: bookmark 'unknownbookmark' not found
635 [255]
635 [255]
636 $ hg strip -B unknownbookmark1 -B unknownbookmark2
636 $ hg strip -B unknownbookmark1 -B unknownbookmark2
637 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
637 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
638 [255]
638 [255]
639 $ hg strip -B delete -B unknownbookmark
639 $ hg strip -B delete -B unknownbookmark
640 abort: bookmark 'unknownbookmark' not found
640 abort: bookmark 'unknownbookmark' not found
641 [255]
641 [255]
642 $ hg strip -B delete
642 $ hg strip -B delete
643 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
643 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
644 bookmark 'delete' deleted
644 bookmark 'delete' deleted
645 $ hg id -ir 6:2702dd0c91e7
645 $ hg id -ir 6:2702dd0c91e7
646 abort: unknown revision '2702dd0c91e7'!
646 abort: unknown revision '2702dd0c91e7'!
647 [255]
647 [255]
648 $ hg update B
648 $ hg update B
649 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
649 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
650 (activating bookmark B)
650 (activating bookmark B)
651 $ echo a > a
651 $ echo a > a
652 $ hg add a
652 $ hg add a
653 $ hg strip -B B
653 $ hg strip -B B
654 abort: local changes found
654 abort: local changes found
655 [255]
655 [255]
656 $ hg bookmarks
656 $ hg bookmarks
657 * B 6:ff43616e5d0f
657 * B 6:ff43616e5d0f
658
658
659 Make sure no one adds back a -b option:
659 Make sure no one adds back a -b option:
660
660
661 $ hg strip -b tip
661 $ hg strip -b tip
662 hg strip: option -b not recognized
662 hg strip: option -b not recognized
663 hg strip [-k] [-f] [-B bookmark] [-r] REV...
663 hg strip [-k] [-f] [-B bookmark] [-r] REV...
664
664
665 strip changesets and all their descendants from the repository
665 strip changesets and all their descendants from the repository
666
666
667 (use "hg help -e strip" to show help for the strip extension)
667 (use "hg help -e strip" to show help for the strip extension)
668
668
669 options ([+] can be repeated):
669 options ([+] can be repeated):
670
670
671 -r --rev REV [+] strip specified revision (optional, can specify
671 -r --rev REV [+] strip specified revision (optional, can specify
672 revisions without this option)
672 revisions without this option)
673 -f --force force removal of changesets, discard uncommitted
673 -f --force force removal of changesets, discard uncommitted
674 changes (no backup)
674 changes (no backup)
675 --no-backup no backups
675 --no-backup no backups
676 -k --keep do not modify working directory during strip
676 -k --keep do not modify working directory during strip
677 -B --bookmark VALUE [+] remove revs only reachable from given bookmark
677 -B --bookmark VALUE [+] remove revs only reachable from given bookmark
678 --mq operate on patch repository
678 --mq operate on patch repository
679
679
680 (use "hg strip -h" to show more help)
680 (use "hg strip -h" to show more help)
681 [255]
681 [255]
682
682
683 $ cd ..
683 $ cd ..
684
684
685 Verify bundles don't get overwritten:
685 Verify bundles don't get overwritten:
686
686
687 $ hg init doublebundle
687 $ hg init doublebundle
688 $ cd doublebundle
688 $ cd doublebundle
689 $ touch a
689 $ touch a
690 $ hg commit -Aqm a
690 $ hg commit -Aqm a
691 $ touch b
691 $ touch b
692 $ hg commit -Aqm b
692 $ hg commit -Aqm b
693 $ hg strip -r 0
693 $ hg strip -r 0
694 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
694 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
695 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob)
695 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob)
696 $ ls .hg/strip-backup
696 $ ls .hg/strip-backup
697 3903775176ed-e68910bd-backup.hg
697 3903775176ed-e68910bd-backup.hg
698 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
698 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
699 $ hg strip -r 0
699 $ hg strip -r 0
700 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob)
700 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob)
701 $ ls .hg/strip-backup
701 $ ls .hg/strip-backup
702 3903775176ed-54390173-backup.hg
702 3903775176ed-54390173-backup.hg
703 3903775176ed-e68910bd-backup.hg
703 3903775176ed-e68910bd-backup.hg
704 $ cd ..
704 $ cd ..
705
705
706 Test that we only bundle the stripped changesets (issue4736)
706 Test that we only bundle the stripped changesets (issue4736)
707 ------------------------------------------------------------
707 ------------------------------------------------------------
708
708
709 initialization (previous repo is empty anyway)
709 initialization (previous repo is empty anyway)
710
710
711 $ hg init issue4736
711 $ hg init issue4736
712 $ cd issue4736
712 $ cd issue4736
713 $ echo a > a
713 $ echo a > a
714 $ hg add a
714 $ hg add a
715 $ hg commit -m commitA
715 $ hg commit -m commitA
716 $ echo b > b
716 $ echo b > b
717 $ hg add b
717 $ hg add b
718 $ hg commit -m commitB
718 $ hg commit -m commitB
719 $ echo c > c
719 $ echo c > c
720 $ hg add c
720 $ hg add c
721 $ hg commit -m commitC
721 $ hg commit -m commitC
722 $ hg up 'desc(commitB)'
722 $ hg up 'desc(commitB)'
723 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
723 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
724 $ echo d > d
724 $ echo d > d
725 $ hg add d
725 $ hg add d
726 $ hg commit -m commitD
726 $ hg commit -m commitD
727 created new head
727 created new head
728 $ hg up 'desc(commitC)'
728 $ hg up 'desc(commitC)'
729 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
729 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
730 $ hg merge 'desc(commitD)'
730 $ hg merge 'desc(commitD)'
731 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
732 (branch merge, don't forget to commit)
732 (branch merge, don't forget to commit)
733 $ hg ci -m 'mergeCD'
733 $ hg ci -m 'mergeCD'
734 $ hg log -G
734 $ hg log -G
735 @ changeset: 4:d8db9d137221
735 @ changeset: 4:d8db9d137221
736 |\ tag: tip
736 |\ tag: tip
737 | | parent: 2:5c51d8d6557d
737 | | parent: 2:5c51d8d6557d
738 | | parent: 3:6625a5168474
738 | | parent: 3:6625a5168474
739 | | user: test
739 | | user: test
740 | | date: Thu Jan 01 00:00:00 1970 +0000
740 | | date: Thu Jan 01 00:00:00 1970 +0000
741 | | summary: mergeCD
741 | | summary: mergeCD
742 | |
742 | |
743 | o changeset: 3:6625a5168474
743 | o changeset: 3:6625a5168474
744 | | parent: 1:eca11cf91c71
744 | | parent: 1:eca11cf91c71
745 | | user: test
745 | | user: test
746 | | date: Thu Jan 01 00:00:00 1970 +0000
746 | | date: Thu Jan 01 00:00:00 1970 +0000
747 | | summary: commitD
747 | | summary: commitD
748 | |
748 | |
749 o | changeset: 2:5c51d8d6557d
749 o | changeset: 2:5c51d8d6557d
750 |/ user: test
750 |/ user: test
751 | date: Thu Jan 01 00:00:00 1970 +0000
751 | date: Thu Jan 01 00:00:00 1970 +0000
752 | summary: commitC
752 | summary: commitC
753 |
753 |
754 o changeset: 1:eca11cf91c71
754 o changeset: 1:eca11cf91c71
755 | user: test
755 | user: test
756 | date: Thu Jan 01 00:00:00 1970 +0000
756 | date: Thu Jan 01 00:00:00 1970 +0000
757 | summary: commitB
757 | summary: commitB
758 |
758 |
759 o changeset: 0:105141ef12d0
759 o changeset: 0:105141ef12d0
760 user: test
760 user: test
761 date: Thu Jan 01 00:00:00 1970 +0000
761 date: Thu Jan 01 00:00:00 1970 +0000
762 summary: commitA
762 summary: commitA
763
763
764
764
765 Check bundle behavior:
765 Check bundle behavior:
766
766
767 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
767 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
768 2 changesets found
768 2 changesets found
769 $ hg log -r 'bundle()' -R ../issue4736.hg
769 $ hg log -r 'bundle()' -R ../issue4736.hg
770 changeset: 3:6625a5168474
770 changeset: 3:6625a5168474
771 parent: 1:eca11cf91c71
771 parent: 1:eca11cf91c71
772 user: test
772 user: test
773 date: Thu Jan 01 00:00:00 1970 +0000
773 date: Thu Jan 01 00:00:00 1970 +0000
774 summary: commitD
774 summary: commitD
775
775
776 changeset: 4:d8db9d137221
776 changeset: 4:d8db9d137221
777 tag: tip
777 tag: tip
778 parent: 2:5c51d8d6557d
778 parent: 2:5c51d8d6557d
779 parent: 3:6625a5168474
779 parent: 3:6625a5168474
780 user: test
780 user: test
781 date: Thu Jan 01 00:00:00 1970 +0000
781 date: Thu Jan 01 00:00:00 1970 +0000
782 summary: mergeCD
782 summary: mergeCD
783
783
784
784
785 check strip behavior
785 check strip behavior
786
786
787 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
787 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
788 resolving manifests
788 resolving manifests
789 branchmerge: False, force: True, partial: False
789 branchmerge: False, force: True, partial: False
790 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
790 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
791 c: other deleted -> r
791 c: other deleted -> r
792 removing c
792 removing c
793 d: other deleted -> r
793 d: other deleted -> r
794 removing d
794 removing d
795 starting 4 threads for background file closing (?)
795 starting 4 threads for background file closing (?)
796 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
796 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
797 2 changesets found
797 2 changesets found
798 list of changesets:
798 list of changesets:
799 6625a516847449b6f0fa3737b9ba56e9f0f3032c
799 6625a516847449b6f0fa3737b9ba56e9f0f3032c
800 d8db9d1372214336d2b5570f20ee468d2c72fa8b
800 d8db9d1372214336d2b5570f20ee468d2c72fa8b
801 bundle2-output-bundle: "HG20", (1 params) 1 parts total
801 bundle2-output-bundle: "HG20", (1 params) 1 parts total
802 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
802 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
803 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
803 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
804 invalid branchheads cache (served): tip differs
804 invalid branchheads cache (served): tip differs
805 truncating cache/rbc-revs-v1 to 24
805 truncating cache/rbc-revs-v1 to 24
806 $ hg log -G
806 $ hg log -G
807 o changeset: 2:5c51d8d6557d
807 o changeset: 2:5c51d8d6557d
808 | tag: tip
808 | tag: tip
809 | user: test
809 | user: test
810 | date: Thu Jan 01 00:00:00 1970 +0000
810 | date: Thu Jan 01 00:00:00 1970 +0000
811 | summary: commitC
811 | summary: commitC
812 |
812 |
813 @ changeset: 1:eca11cf91c71
813 @ changeset: 1:eca11cf91c71
814 | user: test
814 | user: test
815 | date: Thu Jan 01 00:00:00 1970 +0000
815 | date: Thu Jan 01 00:00:00 1970 +0000
816 | summary: commitB
816 | summary: commitB
817 |
817 |
818 o changeset: 0:105141ef12d0
818 o changeset: 0:105141ef12d0
819 user: test
819 user: test
820 date: Thu Jan 01 00:00:00 1970 +0000
820 date: Thu Jan 01 00:00:00 1970 +0000
821 summary: commitA
821 summary: commitA
822
822
823
823
824 strip backup content
824 strip backup content
825
825
826 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
826 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
827 changeset: 3:6625a5168474
827 changeset: 3:6625a5168474
828 parent: 1:eca11cf91c71
828 parent: 1:eca11cf91c71
829 user: test
829 user: test
830 date: Thu Jan 01 00:00:00 1970 +0000
830 date: Thu Jan 01 00:00:00 1970 +0000
831 summary: commitD
831 summary: commitD
832
832
833 changeset: 4:d8db9d137221
833 changeset: 4:d8db9d137221
834 tag: tip
834 tag: tip
835 parent: 2:5c51d8d6557d
835 parent: 2:5c51d8d6557d
836 parent: 3:6625a5168474
836 parent: 3:6625a5168474
837 user: test
837 user: test
838 date: Thu Jan 01 00:00:00 1970 +0000
838 date: Thu Jan 01 00:00:00 1970 +0000
839 summary: mergeCD
839 summary: mergeCD
840
840
841 Check that the phase cache is properly invalidated after a strip with bookmark.
842
843 $ cat > ../stripstalephasecache.py << EOF
844 > from mercurial import extensions, localrepo
845 > def transactioncallback(orig, repo, desc, *args, **kwargs):
846 > def test(transaction):
847 > # observe cache inconsistency
848 > try:
849 > [repo.changelog.node(r) for r in repo.revs("not public()")]
850 > except IndexError:
851 > repo.ui.status("Index error!\n")
852 > transaction = orig(repo, desc, *args, **kwargs)
853 > # warm up the phase cache
854 > list(repo.revs("not public()"))
855 > if desc != 'strip':
856 > transaction.addpostclose("phase invalidation test", test)
857 > return transaction
858 > def extsetup(ui):
859 > extensions.wrapfunction(localrepo.localrepository, "transaction",
860 > transactioncallback)
861 > EOF
862 $ hg up -C 2
863 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
864 $ echo k > k
865 $ hg add k
866 $ hg commit -m commitK
867 $ echo l > l
868 $ hg add l
869 $ hg commit -m commitL
870 $ hg book -r tip blah
871 $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
872 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
873 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg (glob)
874 $ hg up -C 1
875 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
841
876
842 Error during post-close callback of the strip transaction
877 Error during post-close callback of the strip transaction
843 (They should be gracefully handled and reported)
878 (They should be gracefully handled and reported)
844
879
845 $ cat > ../crashstrip.py << EOF
880 $ cat > ../crashstrip.py << EOF
846 > from mercurial import error
881 > from mercurial import error
847 > def reposetup(ui, repo):
882 > def reposetup(ui, repo):
848 > class crashstriprepo(repo.__class__):
883 > class crashstriprepo(repo.__class__):
849 > def transaction(self, desc, *args, **kwargs):
884 > def transaction(self, desc, *args, **kwargs):
850 > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
885 > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
851 > if desc == 'strip':
886 > if desc == 'strip':
852 > def crash(tra): raise error.Abort('boom')
887 > def crash(tra): raise error.Abort('boom')
853 > tr.addpostclose('crash', crash)
888 > tr.addpostclose('crash', crash)
854 > return tr
889 > return tr
855 > repo.__class__ = crashstriprepo
890 > repo.__class__ = crashstriprepo
856 > EOF
891 > EOF
857 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
892 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
858 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
893 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
859 strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
894 strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
860 abort: boom
895 abort: boom
861 [255]
896 [255]
862
897
863
898
General Comments 0
You need to be logged in to leave comments. Login now