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