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