Show More
@@ -1,355 +1,355 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 |
|
|
233 | if chgrpfile: | |
234 | ui.warn(_("strip failed, partial bundle stored in '%s'\n") |
|
234 | ui.warn(_("strip failed, partial bundle stored in '%s'\n") | |
235 | % vfs.join(chgrpfile)) |
|
235 | % vfs.join(chgrpfile)) | |
236 | raise |
|
236 | raise | |
237 | else: |
|
237 | else: | |
238 | if chgrpfile: |
|
238 | if chgrpfile: | |
239 | # Remove partial backup only if there were no exceptions |
|
239 | # Remove partial backup only if there were no exceptions | |
240 | vfs.unlink(chgrpfile) |
|
240 | vfs.unlink(chgrpfile) | |
241 |
|
241 | |||
242 | repo.destroyed() |
|
242 | repo.destroyed() | |
243 |
|
243 | |||
244 | def rebuildfncache(ui, repo): |
|
244 | def rebuildfncache(ui, repo): | |
245 | """Rebuilds the fncache file from repo history. |
|
245 | """Rebuilds the fncache file from repo history. | |
246 |
|
246 | |||
247 | Missing entries will be added. Extra entries will be removed. |
|
247 | Missing entries will be added. Extra entries will be removed. | |
248 | """ |
|
248 | """ | |
249 | repo = repo.unfiltered() |
|
249 | repo = repo.unfiltered() | |
250 |
|
250 | |||
251 | if 'fncache' not in repo.requirements: |
|
251 | if 'fncache' not in repo.requirements: | |
252 | ui.warn(_('(not rebuilding fncache because repository does not ' |
|
252 | ui.warn(_('(not rebuilding fncache because repository does not ' | |
253 | 'support fncache)\n')) |
|
253 | 'support fncache)\n')) | |
254 | return |
|
254 | return | |
255 |
|
255 | |||
256 | with repo.lock(): |
|
256 | with repo.lock(): | |
257 | fnc = repo.store.fncache |
|
257 | fnc = repo.store.fncache | |
258 | # Trigger load of fncache. |
|
258 | # Trigger load of fncache. | |
259 | if 'irrelevant' in fnc: |
|
259 | if 'irrelevant' in fnc: | |
260 | pass |
|
260 | pass | |
261 |
|
261 | |||
262 | oldentries = set(fnc.entries) |
|
262 | oldentries = set(fnc.entries) | |
263 | newentries = set() |
|
263 | newentries = set() | |
264 | seenfiles = set() |
|
264 | seenfiles = set() | |
265 |
|
265 | |||
266 | repolen = len(repo) |
|
266 | repolen = len(repo) | |
267 | for rev in repo: |
|
267 | for rev in repo: | |
268 | ui.progress(_('rebuilding'), rev, total=repolen, |
|
268 | ui.progress(_('rebuilding'), rev, total=repolen, | |
269 | unit=_('changesets')) |
|
269 | unit=_('changesets')) | |
270 |
|
270 | |||
271 | ctx = repo[rev] |
|
271 | ctx = repo[rev] | |
272 | for f in ctx.files(): |
|
272 | for f in ctx.files(): | |
273 | # This is to minimize I/O. |
|
273 | # This is to minimize I/O. | |
274 | if f in seenfiles: |
|
274 | if f in seenfiles: | |
275 | continue |
|
275 | continue | |
276 | seenfiles.add(f) |
|
276 | seenfiles.add(f) | |
277 |
|
277 | |||
278 | i = 'data/%s.i' % f |
|
278 | i = 'data/%s.i' % f | |
279 | d = 'data/%s.d' % f |
|
279 | d = 'data/%s.d' % f | |
280 |
|
280 | |||
281 | if repo.store._exists(i): |
|
281 | if repo.store._exists(i): | |
282 | newentries.add(i) |
|
282 | newentries.add(i) | |
283 | if repo.store._exists(d): |
|
283 | if repo.store._exists(d): | |
284 | newentries.add(d) |
|
284 | newentries.add(d) | |
285 |
|
285 | |||
286 | ui.progress(_('rebuilding'), None) |
|
286 | ui.progress(_('rebuilding'), None) | |
287 |
|
287 | |||
288 | if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise |
|
288 | if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise | |
289 | for dir in util.dirs(seenfiles): |
|
289 | for dir in util.dirs(seenfiles): | |
290 | i = 'meta/%s/00manifest.i' % dir |
|
290 | i = 'meta/%s/00manifest.i' % dir | |
291 | d = 'meta/%s/00manifest.d' % dir |
|
291 | d = 'meta/%s/00manifest.d' % dir | |
292 |
|
292 | |||
293 | if repo.store._exists(i): |
|
293 | if repo.store._exists(i): | |
294 | newentries.add(i) |
|
294 | newentries.add(i) | |
295 | if repo.store._exists(d): |
|
295 | if repo.store._exists(d): | |
296 | newentries.add(d) |
|
296 | newentries.add(d) | |
297 |
|
297 | |||
298 | addcount = len(newentries - oldentries) |
|
298 | addcount = len(newentries - oldentries) | |
299 | removecount = len(oldentries - newentries) |
|
299 | removecount = len(oldentries - newentries) | |
300 | for p in sorted(oldentries - newentries): |
|
300 | for p in sorted(oldentries - newentries): | |
301 | ui.write(_('removing %s\n') % p) |
|
301 | ui.write(_('removing %s\n') % p) | |
302 | for p in sorted(newentries - oldentries): |
|
302 | for p in sorted(newentries - oldentries): | |
303 | ui.write(_('adding %s\n') % p) |
|
303 | ui.write(_('adding %s\n') % p) | |
304 |
|
304 | |||
305 | if addcount or removecount: |
|
305 | if addcount or removecount: | |
306 | ui.write(_('%d items added, %d removed from fncache\n') % |
|
306 | ui.write(_('%d items added, %d removed from fncache\n') % | |
307 | (addcount, removecount)) |
|
307 | (addcount, removecount)) | |
308 | fnc.entries = newentries |
|
308 | fnc.entries = newentries | |
309 | fnc._dirty = True |
|
309 | fnc._dirty = True | |
310 |
|
310 | |||
311 | with repo.transaction('fncache') as tr: |
|
311 | with repo.transaction('fncache') as tr: | |
312 | fnc.write(tr) |
|
312 | fnc.write(tr) | |
313 | else: |
|
313 | else: | |
314 | ui.write(_('fncache already up to date\n')) |
|
314 | ui.write(_('fncache already up to date\n')) | |
315 |
|
315 | |||
316 | def stripbmrevset(repo, mark): |
|
316 | def stripbmrevset(repo, mark): | |
317 | """ |
|
317 | """ | |
318 | The revset to strip when strip is called with -B mark |
|
318 | The revset to strip when strip is called with -B mark | |
319 |
|
319 | |||
320 | Needs to live here so extensions can use it and wrap it even when strip is |
|
320 | 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. |
|
321 | not enabled or not present on a box. | |
322 | """ |
|
322 | """ | |
323 | return repo.revs("ancestors(bookmark(%s)) - " |
|
323 | return repo.revs("ancestors(bookmark(%s)) - " | |
324 | "ancestors(head() and not bookmark(%s)) - " |
|
324 | "ancestors(head() and not bookmark(%s)) - " | |
325 | "ancestors(bookmark() and not bookmark(%s))", |
|
325 | "ancestors(bookmark() and not bookmark(%s))", | |
326 | mark, mark, mark) |
|
326 | mark, mark, mark) | |
327 |
|
327 | |||
328 | def deleteobsmarkers(obsstore, indices): |
|
328 | def deleteobsmarkers(obsstore, indices): | |
329 | """Delete some obsmarkers from obsstore and return how many were deleted |
|
329 | """Delete some obsmarkers from obsstore and return how many were deleted | |
330 |
|
330 | |||
331 | 'indices' is a list of ints which are the indices |
|
331 | 'indices' is a list of ints which are the indices | |
332 | of the markers to be deleted. |
|
332 | of the markers to be deleted. | |
333 |
|
333 | |||
334 | Every invocation of this function completely rewrites the obsstore file, |
|
334 | Every invocation of this function completely rewrites the obsstore file, | |
335 | skipping the markers we want to be removed. The new temporary file is |
|
335 | 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 |
|
336 | created, remaining markers are written there and on .close() this file | |
337 | gets atomically renamed to obsstore, thus guaranteeing consistency.""" |
|
337 | gets atomically renamed to obsstore, thus guaranteeing consistency.""" | |
338 | if not indices: |
|
338 | if not indices: | |
339 | # we don't want to rewrite the obsstore with the same content |
|
339 | # we don't want to rewrite the obsstore with the same content | |
340 | return |
|
340 | return | |
341 |
|
341 | |||
342 | left = [] |
|
342 | left = [] | |
343 | current = obsstore._all |
|
343 | current = obsstore._all | |
344 | n = 0 |
|
344 | n = 0 | |
345 | for i, m in enumerate(current): |
|
345 | for i, m in enumerate(current): | |
346 | if i in indices: |
|
346 | if i in indices: | |
347 | n += 1 |
|
347 | n += 1 | |
348 | continue |
|
348 | continue | |
349 | left.append(m) |
|
349 | left.append(m) | |
350 |
|
350 | |||
351 | newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True) |
|
351 | newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True) | |
352 | for bytes in obsolete.encodemarkers(left, True, obsstore._version): |
|
352 | for bytes in obsolete.encodemarkers(left, True, obsstore._version): | |
353 | newobsstorefile.write(bytes) |
|
353 | newobsstorefile.write(bytes) | |
354 | newobsstorefile.close() |
|
354 | newobsstorefile.close() | |
355 | return n |
|
355 | return n |
@@ -1,898 +1,937 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. | |||
|
371 | ||||
|
372 | $ hg strip 2 --config hooks.pretxnchangegroup.bad=false | |||
|
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) | |||
|
375 | transaction abort! | |||
|
376 | rollback completed | |||
|
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) | |||
|
379 | abort: pretxnchangegroup.bad hook exited with status 1 | |||
|
380 | [255] | |||
|
381 | $ restore | |||
|
382 | $ hg log -G | |||
|
383 | o changeset: 4:443431ffac4f | |||
|
384 | | tag: tip | |||
|
385 | | user: test | |||
|
386 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
387 | | summary: e | |||
|
388 | | | |||
|
389 | o changeset: 3:65bd5f99a4a3 | |||
|
390 | | parent: 1:ef3a871183d7 | |||
|
391 | | user: test | |||
|
392 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
393 | | summary: d | |||
|
394 | | | |||
|
395 | | o changeset: 2:264128213d29 | |||
|
396 | |/ user: test | |||
|
397 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
398 | | summary: c | |||
|
399 | | | |||
|
400 | @ changeset: 1:ef3a871183d7 | |||
|
401 | | user: test | |||
|
402 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
403 | | summary: b | |||
|
404 | | | |||
|
405 | o changeset: 0:9ab35a2d17cb | |||
|
406 | user: test | |||
|
407 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
408 | summary: a | |||
|
409 | ||||
370 |
|
410 | |||
371 | 2 different branches: 2 strips |
|
411 | 2 different branches: 2 strips | |
372 |
|
412 | |||
373 | $ hg strip 2 4 |
|
413 | $ hg strip 2 4 | |
374 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
|||
375 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
414 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
376 | $ hg log -G |
|
415 | $ hg log -G | |
377 | o changeset: 2:65bd5f99a4a3 |
|
416 | o changeset: 2:65bd5f99a4a3 | |
378 | | tag: tip |
|
417 | | tag: tip | |
379 | | user: test |
|
418 | | user: test | |
380 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
419 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
381 | | summary: d |
|
420 | | summary: d | |
382 | | |
|
421 | | | |
383 | @ changeset: 1:ef3a871183d7 |
|
422 | @ changeset: 1:ef3a871183d7 | |
384 | | user: test |
|
423 | | user: test | |
385 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
424 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
386 | | summary: b |
|
425 | | summary: b | |
387 | | |
|
426 | | | |
388 | o changeset: 0:9ab35a2d17cb |
|
427 | o changeset: 0:9ab35a2d17cb | |
389 | user: test |
|
428 | user: test | |
390 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
429 | date: Thu Jan 01 00:00:00 1970 +0000 | |
391 | summary: a |
|
430 | summary: a | |
392 |
|
431 | |||
393 | $ restore |
|
432 | $ restore | |
394 |
|
433 | |||
395 | 2 different branches and a common ancestor: 1 strip |
|
434 | 2 different branches and a common ancestor: 1 strip | |
396 |
|
435 | |||
397 | $ hg strip 1 "2|4" |
|
436 | $ hg strip 1 "2|4" | |
398 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
437 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
399 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
438 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
400 | $ restore |
|
439 | $ restore | |
401 |
|
440 | |||
402 | verify fncache is kept up-to-date |
|
441 | verify fncache is kept up-to-date | |
403 |
|
442 | |||
404 | $ touch a |
|
443 | $ touch a | |
405 | $ hg ci -qAm a |
|
444 | $ hg ci -qAm a | |
406 | $ cat .hg/store/fncache | sort |
|
445 | $ cat .hg/store/fncache | sort | |
407 | data/a.i |
|
446 | data/a.i | |
408 | data/bar.i |
|
447 | data/bar.i | |
409 | $ hg strip tip |
|
448 | $ hg strip tip | |
410 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
449 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
411 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
450 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
412 | $ cat .hg/store/fncache |
|
451 | $ cat .hg/store/fncache | |
413 | data/bar.i |
|
452 | data/bar.i | |
414 |
|
453 | |||
415 | stripping an empty revset |
|
454 | stripping an empty revset | |
416 |
|
455 | |||
417 | $ hg strip "1 and not 1" |
|
456 | $ hg strip "1 and not 1" | |
418 | abort: empty revision set |
|
457 | abort: empty revision set | |
419 | [255] |
|
458 | [255] | |
420 |
|
459 | |||
421 | remove branchy history for qimport tests |
|
460 | remove branchy history for qimport tests | |
422 |
|
461 | |||
423 | $ hg strip 3 |
|
462 | $ hg strip 3 | |
424 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
463 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
425 |
|
464 | |||
426 |
|
465 | |||
427 | strip of applied mq should cleanup status file |
|
466 | strip of applied mq should cleanup status file | |
428 |
|
467 | |||
429 | $ echo "mq=" >> $HGRCPATH |
|
468 | $ echo "mq=" >> $HGRCPATH | |
430 | $ hg up -C 3 |
|
469 | $ hg up -C 3 | |
431 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
470 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
432 | $ echo fooagain >> bar |
|
471 | $ echo fooagain >> bar | |
433 | $ hg ci -mf |
|
472 | $ hg ci -mf | |
434 | $ hg qimport -r tip:2 |
|
473 | $ hg qimport -r tip:2 | |
435 |
|
474 | |||
436 | applied patches before strip |
|
475 | applied patches before strip | |
437 |
|
476 | |||
438 | $ hg qapplied |
|
477 | $ hg qapplied | |
439 | d |
|
478 | d | |
440 | e |
|
479 | e | |
441 | f |
|
480 | f | |
442 |
|
481 | |||
443 | stripping revision in queue |
|
482 | stripping revision in queue | |
444 |
|
483 | |||
445 | $ hg strip 3 |
|
484 | $ hg strip 3 | |
446 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
485 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
447 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
486 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
448 |
|
487 | |||
449 | applied patches after stripping rev in queue |
|
488 | applied patches after stripping rev in queue | |
450 |
|
489 | |||
451 | $ hg qapplied |
|
490 | $ hg qapplied | |
452 | d |
|
491 | d | |
453 |
|
492 | |||
454 | stripping ancestor of queue |
|
493 | stripping ancestor of queue | |
455 |
|
494 | |||
456 | $ hg strip 1 |
|
495 | $ hg strip 1 | |
457 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
496 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
458 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
497 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
459 |
|
498 | |||
460 | applied patches after stripping ancestor of queue |
|
499 | applied patches after stripping ancestor of queue | |
461 |
|
500 | |||
462 | $ hg qapplied |
|
501 | $ hg qapplied | |
463 |
|
502 | |||
464 | Verify strip protects against stripping wc parent when there are uncommitted mods |
|
503 | Verify strip protects against stripping wc parent when there are uncommitted mods | |
465 |
|
504 | |||
466 | $ echo b > b |
|
505 | $ echo b > b | |
467 | $ echo bb > bar |
|
506 | $ echo bb > bar | |
468 | $ hg add b |
|
507 | $ hg add b | |
469 | $ hg ci -m 'b' |
|
508 | $ hg ci -m 'b' | |
470 | $ hg log --graph |
|
509 | $ hg log --graph | |
471 | @ changeset: 1:76dcf9fab855 |
|
510 | @ changeset: 1:76dcf9fab855 | |
472 | | tag: tip |
|
511 | | tag: tip | |
473 | | user: test |
|
512 | | user: test | |
474 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
513 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
475 | | summary: b |
|
514 | | summary: b | |
476 | | |
|
515 | | | |
477 | o changeset: 0:9ab35a2d17cb |
|
516 | o changeset: 0:9ab35a2d17cb | |
478 | user: test |
|
517 | user: test | |
479 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
518 | date: Thu Jan 01 00:00:00 1970 +0000 | |
480 | summary: a |
|
519 | summary: a | |
481 |
|
520 | |||
482 | $ hg up 0 |
|
521 | $ hg up 0 | |
483 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
522 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
484 | $ echo c > bar |
|
523 | $ echo c > bar | |
485 | $ hg up -t false |
|
524 | $ hg up -t false | |
486 | merging bar |
|
525 | merging bar | |
487 | merging bar failed! |
|
526 | merging bar failed! | |
488 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
527 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
489 | use 'hg resolve' to retry unresolved file merges |
|
528 | use 'hg resolve' to retry unresolved file merges | |
490 | [1] |
|
529 | [1] | |
491 | $ hg sum |
|
530 | $ hg sum | |
492 | parent: 1:76dcf9fab855 tip |
|
531 | parent: 1:76dcf9fab855 tip | |
493 | b |
|
532 | b | |
494 | branch: default |
|
533 | branch: default | |
495 | commit: 1 modified, 1 unknown, 1 unresolved |
|
534 | commit: 1 modified, 1 unknown, 1 unresolved | |
496 | update: (current) |
|
535 | update: (current) | |
497 | phases: 2 draft |
|
536 | phases: 2 draft | |
498 | mq: 3 unapplied |
|
537 | mq: 3 unapplied | |
499 |
|
538 | |||
500 | $ echo c > b |
|
539 | $ echo c > b | |
501 | $ hg strip tip |
|
540 | $ hg strip tip | |
502 | abort: local changes found |
|
541 | abort: local changes found | |
503 | [255] |
|
542 | [255] | |
504 | $ hg strip tip --keep |
|
543 | $ hg strip tip --keep | |
505 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
544 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
506 | $ hg log --graph |
|
545 | $ hg log --graph | |
507 | @ changeset: 0:9ab35a2d17cb |
|
546 | @ changeset: 0:9ab35a2d17cb | |
508 | tag: tip |
|
547 | tag: tip | |
509 | user: test |
|
548 | user: test | |
510 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
549 | date: Thu Jan 01 00:00:00 1970 +0000 | |
511 | summary: a |
|
550 | summary: a | |
512 |
|
551 | |||
513 | $ hg status |
|
552 | $ hg status | |
514 | M bar |
|
553 | M bar | |
515 | ? b |
|
554 | ? b | |
516 | ? bar.orig |
|
555 | ? bar.orig | |
517 |
|
556 | |||
518 | $ rm bar.orig |
|
557 | $ rm bar.orig | |
519 | $ hg sum |
|
558 | $ hg sum | |
520 | parent: 0:9ab35a2d17cb tip |
|
559 | parent: 0:9ab35a2d17cb tip | |
521 | a |
|
560 | a | |
522 | branch: default |
|
561 | branch: default | |
523 | commit: 1 modified, 1 unknown |
|
562 | commit: 1 modified, 1 unknown | |
524 | update: (current) |
|
563 | update: (current) | |
525 | phases: 1 draft |
|
564 | phases: 1 draft | |
526 | mq: 3 unapplied |
|
565 | mq: 3 unapplied | |
527 |
|
566 | |||
528 | Strip adds, removes, modifies with --keep |
|
567 | Strip adds, removes, modifies with --keep | |
529 |
|
568 | |||
530 | $ touch b |
|
569 | $ touch b | |
531 | $ hg add b |
|
570 | $ hg add b | |
532 | $ hg commit -mb |
|
571 | $ hg commit -mb | |
533 | $ touch c |
|
572 | $ touch c | |
534 |
|
573 | |||
535 | ... with a clean working dir |
|
574 | ... with a clean working dir | |
536 |
|
575 | |||
537 | $ hg add c |
|
576 | $ hg add c | |
538 | $ hg rm bar |
|
577 | $ hg rm bar | |
539 | $ hg commit -mc |
|
578 | $ hg commit -mc | |
540 | $ hg status |
|
579 | $ hg status | |
541 | $ hg strip --keep tip |
|
580 | $ hg strip --keep tip | |
542 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
581 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
543 | $ hg status |
|
582 | $ hg status | |
544 | ! bar |
|
583 | ! bar | |
545 | ? c |
|
584 | ? c | |
546 |
|
585 | |||
547 | ... with a dirty working dir |
|
586 | ... with a dirty working dir | |
548 |
|
587 | |||
549 | $ hg add c |
|
588 | $ hg add c | |
550 | $ hg rm bar |
|
589 | $ hg rm bar | |
551 | $ hg commit -mc |
|
590 | $ hg commit -mc | |
552 | $ hg status |
|
591 | $ hg status | |
553 | $ echo b > b |
|
592 | $ echo b > b | |
554 | $ echo d > d |
|
593 | $ echo d > d | |
555 | $ hg strip --keep tip |
|
594 | $ hg strip --keep tip | |
556 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
595 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
557 | $ hg status |
|
596 | $ hg status | |
558 | M b |
|
597 | M b | |
559 | ! bar |
|
598 | ! bar | |
560 | ? c |
|
599 | ? c | |
561 | ? d |
|
600 | ? d | |
562 |
|
601 | |||
563 | ... after updating the dirstate |
|
602 | ... after updating the dirstate | |
564 | $ hg add c |
|
603 | $ hg add c | |
565 | $ hg commit -mc |
|
604 | $ hg commit -mc | |
566 | $ hg rm c |
|
605 | $ hg rm c | |
567 | $ hg commit -mc |
|
606 | $ hg commit -mc | |
568 | $ hg strip --keep '.^' -q |
|
607 | $ hg strip --keep '.^' -q | |
569 | $ cd .. |
|
608 | $ cd .. | |
570 |
|
609 | |||
571 | stripping many nodes on a complex graph (issue3299) |
|
610 | stripping many nodes on a complex graph (issue3299) | |
572 |
|
611 | |||
573 | $ hg init issue3299 |
|
612 | $ hg init issue3299 | |
574 | $ cd issue3299 |
|
613 | $ cd issue3299 | |
575 | $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' |
|
614 | $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' | |
576 | $ hg strip 'not ancestors(x)' |
|
615 | $ hg strip 'not ancestors(x)' | |
577 | saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) |
|
616 | saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) | |
578 |
|
617 | |||
579 | test hg strip -B bookmark |
|
618 | test hg strip -B bookmark | |
580 |
|
619 | |||
581 | $ cd .. |
|
620 | $ cd .. | |
582 | $ hg init bookmarks |
|
621 | $ hg init bookmarks | |
583 | $ cd bookmarks |
|
622 | $ cd bookmarks | |
584 | $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f' |
|
623 | $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f' | |
585 | $ hg bookmark -r 'a' 'todelete' |
|
624 | $ hg bookmark -r 'a' 'todelete' | |
586 | $ hg bookmark -r 'b' 'B' |
|
625 | $ hg bookmark -r 'b' 'B' | |
587 | $ hg bookmark -r 'b' 'nostrip' |
|
626 | $ hg bookmark -r 'b' 'nostrip' | |
588 | $ hg bookmark -r 'c' 'delete' |
|
627 | $ hg bookmark -r 'c' 'delete' | |
589 | $ hg bookmark -r 'd' 'multipledelete1' |
|
628 | $ hg bookmark -r 'd' 'multipledelete1' | |
590 | $ hg bookmark -r 'e' 'multipledelete2' |
|
629 | $ hg bookmark -r 'e' 'multipledelete2' | |
591 | $ hg bookmark -r 'f' 'singlenode1' |
|
630 | $ hg bookmark -r 'f' 'singlenode1' | |
592 | $ hg bookmark -r 'f' 'singlenode2' |
|
631 | $ hg bookmark -r 'f' 'singlenode2' | |
593 | $ hg up -C todelete |
|
632 | $ hg up -C todelete | |
594 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
633 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
595 | (activating bookmark todelete) |
|
634 | (activating bookmark todelete) | |
596 | $ hg strip -B nostrip |
|
635 | $ hg strip -B nostrip | |
597 | bookmark 'nostrip' deleted |
|
636 | bookmark 'nostrip' deleted | |
598 | abort: empty revision set |
|
637 | abort: empty revision set | |
599 | [255] |
|
638 | [255] | |
600 | $ hg strip -B todelete |
|
639 | $ hg strip -B todelete | |
601 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
640 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
602 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
641 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) | |
603 | bookmark 'todelete' deleted |
|
642 | bookmark 'todelete' deleted | |
604 | $ hg id -ir dcbb326fdec2 |
|
643 | $ hg id -ir dcbb326fdec2 | |
605 | abort: unknown revision 'dcbb326fdec2'! |
|
644 | abort: unknown revision 'dcbb326fdec2'! | |
606 | [255] |
|
645 | [255] | |
607 | $ hg id -ir d62d843c9a01 |
|
646 | $ hg id -ir d62d843c9a01 | |
608 | d62d843c9a01 |
|
647 | d62d843c9a01 | |
609 | $ hg bookmarks |
|
648 | $ hg bookmarks | |
610 | B 9:ff43616e5d0f |
|
649 | B 9:ff43616e5d0f | |
611 | delete 6:2702dd0c91e7 |
|
650 | delete 6:2702dd0c91e7 | |
612 | multipledelete1 11:e46a4836065c |
|
651 | multipledelete1 11:e46a4836065c | |
613 | multipledelete2 12:b4594d867745 |
|
652 | multipledelete2 12:b4594d867745 | |
614 | singlenode1 13:43227190fef8 |
|
653 | singlenode1 13:43227190fef8 | |
615 | singlenode2 13:43227190fef8 |
|
654 | singlenode2 13:43227190fef8 | |
616 | $ hg strip -B multipledelete1 -B multipledelete2 |
|
655 | $ hg strip -B multipledelete1 -B multipledelete2 | |
617 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob) |
|
656 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob) | |
618 | bookmark 'multipledelete1' deleted |
|
657 | bookmark 'multipledelete1' deleted | |
619 | bookmark 'multipledelete2' deleted |
|
658 | bookmark 'multipledelete2' deleted | |
620 | $ hg id -ir e46a4836065c |
|
659 | $ hg id -ir e46a4836065c | |
621 | abort: unknown revision 'e46a4836065c'! |
|
660 | abort: unknown revision 'e46a4836065c'! | |
622 | [255] |
|
661 | [255] | |
623 | $ hg id -ir b4594d867745 |
|
662 | $ hg id -ir b4594d867745 | |
624 | abort: unknown revision 'b4594d867745'! |
|
663 | abort: unknown revision 'b4594d867745'! | |
625 | [255] |
|
664 | [255] | |
626 | $ hg strip -B singlenode1 -B singlenode2 |
|
665 | $ hg strip -B singlenode1 -B singlenode2 | |
627 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob) |
|
666 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob) | |
628 | bookmark 'singlenode1' deleted |
|
667 | bookmark 'singlenode1' deleted | |
629 | bookmark 'singlenode2' deleted |
|
668 | bookmark 'singlenode2' deleted | |
630 | $ hg id -ir 43227190fef8 |
|
669 | $ hg id -ir 43227190fef8 | |
631 | abort: unknown revision '43227190fef8'! |
|
670 | abort: unknown revision '43227190fef8'! | |
632 | [255] |
|
671 | [255] | |
633 | $ hg strip -B unknownbookmark |
|
672 | $ hg strip -B unknownbookmark | |
634 | abort: bookmark 'unknownbookmark' not found |
|
673 | abort: bookmark 'unknownbookmark' not found | |
635 | [255] |
|
674 | [255] | |
636 | $ hg strip -B unknownbookmark1 -B unknownbookmark2 |
|
675 | $ hg strip -B unknownbookmark1 -B unknownbookmark2 | |
637 | abort: bookmark 'unknownbookmark1,unknownbookmark2' not found |
|
676 | abort: bookmark 'unknownbookmark1,unknownbookmark2' not found | |
638 | [255] |
|
677 | [255] | |
639 | $ hg strip -B delete -B unknownbookmark |
|
678 | $ hg strip -B delete -B unknownbookmark | |
640 | abort: bookmark 'unknownbookmark' not found |
|
679 | abort: bookmark 'unknownbookmark' not found | |
641 | [255] |
|
680 | [255] | |
642 | $ hg strip -B delete |
|
681 | $ hg strip -B delete | |
643 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
682 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) | |
644 | bookmark 'delete' deleted |
|
683 | bookmark 'delete' deleted | |
645 | $ hg id -ir 6:2702dd0c91e7 |
|
684 | $ hg id -ir 6:2702dd0c91e7 | |
646 | abort: unknown revision '2702dd0c91e7'! |
|
685 | abort: unknown revision '2702dd0c91e7'! | |
647 | [255] |
|
686 | [255] | |
648 | $ hg update B |
|
687 | $ hg update B | |
649 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
688 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
650 | (activating bookmark B) |
|
689 | (activating bookmark B) | |
651 | $ echo a > a |
|
690 | $ echo a > a | |
652 | $ hg add a |
|
691 | $ hg add a | |
653 | $ hg strip -B B |
|
692 | $ hg strip -B B | |
654 | abort: local changes found |
|
693 | abort: local changes found | |
655 | [255] |
|
694 | [255] | |
656 | $ hg bookmarks |
|
695 | $ hg bookmarks | |
657 | * B 6:ff43616e5d0f |
|
696 | * B 6:ff43616e5d0f | |
658 |
|
697 | |||
659 | Make sure no one adds back a -b option: |
|
698 | Make sure no one adds back a -b option: | |
660 |
|
699 | |||
661 | $ hg strip -b tip |
|
700 | $ hg strip -b tip | |
662 | hg strip: option -b not recognized |
|
701 | hg strip: option -b not recognized | |
663 | hg strip [-k] [-f] [-B bookmark] [-r] REV... |
|
702 | hg strip [-k] [-f] [-B bookmark] [-r] REV... | |
664 |
|
703 | |||
665 | strip changesets and all their descendants from the repository |
|
704 | strip changesets and all their descendants from the repository | |
666 |
|
705 | |||
667 | (use "hg help -e strip" to show help for the strip extension) |
|
706 | (use "hg help -e strip" to show help for the strip extension) | |
668 |
|
707 | |||
669 | options ([+] can be repeated): |
|
708 | options ([+] can be repeated): | |
670 |
|
709 | |||
671 | -r --rev REV [+] strip specified revision (optional, can specify |
|
710 | -r --rev REV [+] strip specified revision (optional, can specify | |
672 | revisions without this option) |
|
711 | revisions without this option) | |
673 | -f --force force removal of changesets, discard uncommitted |
|
712 | -f --force force removal of changesets, discard uncommitted | |
674 | changes (no backup) |
|
713 | changes (no backup) | |
675 | --no-backup no backups |
|
714 | --no-backup no backups | |
676 | -k --keep do not modify working directory during strip |
|
715 | -k --keep do not modify working directory during strip | |
677 | -B --bookmark VALUE [+] remove revs only reachable from given bookmark |
|
716 | -B --bookmark VALUE [+] remove revs only reachable from given bookmark | |
678 | --mq operate on patch repository |
|
717 | --mq operate on patch repository | |
679 |
|
718 | |||
680 | (use "hg strip -h" to show more help) |
|
719 | (use "hg strip -h" to show more help) | |
681 | [255] |
|
720 | [255] | |
682 |
|
721 | |||
683 | $ cd .. |
|
722 | $ cd .. | |
684 |
|
723 | |||
685 | Verify bundles don't get overwritten: |
|
724 | Verify bundles don't get overwritten: | |
686 |
|
725 | |||
687 | $ hg init doublebundle |
|
726 | $ hg init doublebundle | |
688 | $ cd doublebundle |
|
727 | $ cd doublebundle | |
689 | $ touch a |
|
728 | $ touch a | |
690 | $ hg commit -Aqm a |
|
729 | $ hg commit -Aqm a | |
691 | $ touch b |
|
730 | $ touch b | |
692 | $ hg commit -Aqm b |
|
731 | $ hg commit -Aqm b | |
693 | $ hg strip -r 0 |
|
732 | $ hg strip -r 0 | |
694 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
733 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
695 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob) |
|
734 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob) | |
696 | $ ls .hg/strip-backup |
|
735 | $ ls .hg/strip-backup | |
697 | 3903775176ed-e68910bd-backup.hg |
|
736 | 3903775176ed-e68910bd-backup.hg | |
698 | $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg |
|
737 | $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg | |
699 | $ hg strip -r 0 |
|
738 | $ hg strip -r 0 | |
700 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob) |
|
739 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob) | |
701 | $ ls .hg/strip-backup |
|
740 | $ ls .hg/strip-backup | |
702 | 3903775176ed-54390173-backup.hg |
|
741 | 3903775176ed-54390173-backup.hg | |
703 | 3903775176ed-e68910bd-backup.hg |
|
742 | 3903775176ed-e68910bd-backup.hg | |
704 | $ cd .. |
|
743 | $ cd .. | |
705 |
|
744 | |||
706 | Test that we only bundle the stripped changesets (issue4736) |
|
745 | Test that we only bundle the stripped changesets (issue4736) | |
707 | ------------------------------------------------------------ |
|
746 | ------------------------------------------------------------ | |
708 |
|
747 | |||
709 | initialization (previous repo is empty anyway) |
|
748 | initialization (previous repo is empty anyway) | |
710 |
|
749 | |||
711 | $ hg init issue4736 |
|
750 | $ hg init issue4736 | |
712 | $ cd issue4736 |
|
751 | $ cd issue4736 | |
713 | $ echo a > a |
|
752 | $ echo a > a | |
714 | $ hg add a |
|
753 | $ hg add a | |
715 | $ hg commit -m commitA |
|
754 | $ hg commit -m commitA | |
716 | $ echo b > b |
|
755 | $ echo b > b | |
717 | $ hg add b |
|
756 | $ hg add b | |
718 | $ hg commit -m commitB |
|
757 | $ hg commit -m commitB | |
719 | $ echo c > c |
|
758 | $ echo c > c | |
720 | $ hg add c |
|
759 | $ hg add c | |
721 | $ hg commit -m commitC |
|
760 | $ hg commit -m commitC | |
722 | $ hg up 'desc(commitB)' |
|
761 | $ hg up 'desc(commitB)' | |
723 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
762 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
724 | $ echo d > d |
|
763 | $ echo d > d | |
725 | $ hg add d |
|
764 | $ hg add d | |
726 | $ hg commit -m commitD |
|
765 | $ hg commit -m commitD | |
727 | created new head |
|
766 | created new head | |
728 | $ hg up 'desc(commitC)' |
|
767 | $ hg up 'desc(commitC)' | |
729 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
768 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
730 | $ hg merge 'desc(commitD)' |
|
769 | $ hg merge 'desc(commitD)' | |
731 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
770 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
732 | (branch merge, don't forget to commit) |
|
771 | (branch merge, don't forget to commit) | |
733 | $ hg ci -m 'mergeCD' |
|
772 | $ hg ci -m 'mergeCD' | |
734 | $ hg log -G |
|
773 | $ hg log -G | |
735 | @ changeset: 4:d8db9d137221 |
|
774 | @ changeset: 4:d8db9d137221 | |
736 | |\ tag: tip |
|
775 | |\ tag: tip | |
737 | | | parent: 2:5c51d8d6557d |
|
776 | | | parent: 2:5c51d8d6557d | |
738 | | | parent: 3:6625a5168474 |
|
777 | | | parent: 3:6625a5168474 | |
739 | | | user: test |
|
778 | | | user: test | |
740 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
779 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
741 | | | summary: mergeCD |
|
780 | | | summary: mergeCD | |
742 | | | |
|
781 | | | | |
743 | | o changeset: 3:6625a5168474 |
|
782 | | o changeset: 3:6625a5168474 | |
744 | | | parent: 1:eca11cf91c71 |
|
783 | | | parent: 1:eca11cf91c71 | |
745 | | | user: test |
|
784 | | | user: test | |
746 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
785 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
747 | | | summary: commitD |
|
786 | | | summary: commitD | |
748 | | | |
|
787 | | | | |
749 | o | changeset: 2:5c51d8d6557d |
|
788 | o | changeset: 2:5c51d8d6557d | |
750 | |/ user: test |
|
789 | |/ user: test | |
751 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
790 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
752 | | summary: commitC |
|
791 | | summary: commitC | |
753 | | |
|
792 | | | |
754 | o changeset: 1:eca11cf91c71 |
|
793 | o changeset: 1:eca11cf91c71 | |
755 | | user: test |
|
794 | | user: test | |
756 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
795 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
757 | | summary: commitB |
|
796 | | summary: commitB | |
758 | | |
|
797 | | | |
759 | o changeset: 0:105141ef12d0 |
|
798 | o changeset: 0:105141ef12d0 | |
760 | user: test |
|
799 | user: test | |
761 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
800 | date: Thu Jan 01 00:00:00 1970 +0000 | |
762 | summary: commitA |
|
801 | summary: commitA | |
763 |
|
802 | |||
764 |
|
803 | |||
765 | Check bundle behavior: |
|
804 | Check bundle behavior: | |
766 |
|
805 | |||
767 | $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg |
|
806 | $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg | |
768 | 2 changesets found |
|
807 | 2 changesets found | |
769 | $ hg log -r 'bundle()' -R ../issue4736.hg |
|
808 | $ hg log -r 'bundle()' -R ../issue4736.hg | |
770 | changeset: 3:6625a5168474 |
|
809 | changeset: 3:6625a5168474 | |
771 | parent: 1:eca11cf91c71 |
|
810 | parent: 1:eca11cf91c71 | |
772 | user: test |
|
811 | user: test | |
773 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
812 | date: Thu Jan 01 00:00:00 1970 +0000 | |
774 | summary: commitD |
|
813 | summary: commitD | |
775 |
|
814 | |||
776 | changeset: 4:d8db9d137221 |
|
815 | changeset: 4:d8db9d137221 | |
777 | tag: tip |
|
816 | tag: tip | |
778 | parent: 2:5c51d8d6557d |
|
817 | parent: 2:5c51d8d6557d | |
779 | parent: 3:6625a5168474 |
|
818 | parent: 3:6625a5168474 | |
780 | user: test |
|
819 | user: test | |
781 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
820 | date: Thu Jan 01 00:00:00 1970 +0000 | |
782 | summary: mergeCD |
|
821 | summary: mergeCD | |
783 |
|
822 | |||
784 |
|
823 | |||
785 | check strip behavior |
|
824 | check strip behavior | |
786 |
|
825 | |||
787 | $ hg --config extensions.strip= strip 'desc(commitD)' --debug |
|
826 | $ hg --config extensions.strip= strip 'desc(commitD)' --debug | |
788 | resolving manifests |
|
827 | resolving manifests | |
789 | branchmerge: False, force: True, partial: False |
|
828 | branchmerge: False, force: True, partial: False | |
790 | ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71 |
|
829 | ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71 | |
791 | c: other deleted -> r |
|
830 | c: other deleted -> r | |
792 | removing c |
|
831 | removing c | |
793 | d: other deleted -> r |
|
832 | d: other deleted -> r | |
794 | removing d |
|
833 | removing d | |
795 | starting 4 threads for background file closing (?) |
|
834 | starting 4 threads for background file closing (?) | |
796 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
835 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
797 | 2 changesets found |
|
836 | 2 changesets found | |
798 | list of changesets: |
|
837 | list of changesets: | |
799 | 6625a516847449b6f0fa3737b9ba56e9f0f3032c |
|
838 | 6625a516847449b6f0fa3737b9ba56e9f0f3032c | |
800 | d8db9d1372214336d2b5570f20ee468d2c72fa8b |
|
839 | d8db9d1372214336d2b5570f20ee468d2c72fa8b | |
801 | bundle2-output-bundle: "HG20", (1 params) 1 parts total |
|
840 | bundle2-output-bundle: "HG20", (1 params) 1 parts total | |
802 | bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload |
|
841 | bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload | |
803 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob) |
|
842 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob) | |
804 | invalid branchheads cache (served): tip differs |
|
843 | invalid branchheads cache (served): tip differs | |
805 | truncating cache/rbc-revs-v1 to 24 |
|
844 | truncating cache/rbc-revs-v1 to 24 | |
806 | $ hg log -G |
|
845 | $ hg log -G | |
807 | o changeset: 2:5c51d8d6557d |
|
846 | o changeset: 2:5c51d8d6557d | |
808 | | tag: tip |
|
847 | | tag: tip | |
809 | | user: test |
|
848 | | user: test | |
810 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
849 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
811 | | summary: commitC |
|
850 | | summary: commitC | |
812 | | |
|
851 | | | |
813 | @ changeset: 1:eca11cf91c71 |
|
852 | @ changeset: 1:eca11cf91c71 | |
814 | | user: test |
|
853 | | user: test | |
815 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
854 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
816 | | summary: commitB |
|
855 | | summary: commitB | |
817 | | |
|
856 | | | |
818 | o changeset: 0:105141ef12d0 |
|
857 | o changeset: 0:105141ef12d0 | |
819 | user: test |
|
858 | user: test | |
820 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
859 | date: Thu Jan 01 00:00:00 1970 +0000 | |
821 | summary: commitA |
|
860 | summary: commitA | |
822 |
|
861 | |||
823 |
|
862 | |||
824 | strip backup content |
|
863 | strip backup content | |
825 |
|
864 | |||
826 | $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg |
|
865 | $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg | |
827 | changeset: 3:6625a5168474 |
|
866 | changeset: 3:6625a5168474 | |
828 | parent: 1:eca11cf91c71 |
|
867 | parent: 1:eca11cf91c71 | |
829 | user: test |
|
868 | user: test | |
830 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
869 | date: Thu Jan 01 00:00:00 1970 +0000 | |
831 | summary: commitD |
|
870 | summary: commitD | |
832 |
|
871 | |||
833 | changeset: 4:d8db9d137221 |
|
872 | changeset: 4:d8db9d137221 | |
834 | tag: tip |
|
873 | tag: tip | |
835 | parent: 2:5c51d8d6557d |
|
874 | parent: 2:5c51d8d6557d | |
836 | parent: 3:6625a5168474 |
|
875 | parent: 3:6625a5168474 | |
837 | user: test |
|
876 | user: test | |
838 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
877 | date: Thu Jan 01 00:00:00 1970 +0000 | |
839 | summary: mergeCD |
|
878 | summary: mergeCD | |
840 |
|
879 | |||
841 | Check that the phase cache is properly invalidated after a strip with bookmark. |
|
880 | Check that the phase cache is properly invalidated after a strip with bookmark. | |
842 |
|
881 | |||
843 | $ cat > ../stripstalephasecache.py << EOF |
|
882 | $ cat > ../stripstalephasecache.py << EOF | |
844 | > from mercurial import extensions, localrepo |
|
883 | > from mercurial import extensions, localrepo | |
845 | > def transactioncallback(orig, repo, desc, *args, **kwargs): |
|
884 | > def transactioncallback(orig, repo, desc, *args, **kwargs): | |
846 | > def test(transaction): |
|
885 | > def test(transaction): | |
847 | > # observe cache inconsistency |
|
886 | > # observe cache inconsistency | |
848 | > try: |
|
887 | > try: | |
849 | > [repo.changelog.node(r) for r in repo.revs("not public()")] |
|
888 | > [repo.changelog.node(r) for r in repo.revs("not public()")] | |
850 | > except IndexError: |
|
889 | > except IndexError: | |
851 | > repo.ui.status("Index error!\n") |
|
890 | > repo.ui.status("Index error!\n") | |
852 | > transaction = orig(repo, desc, *args, **kwargs) |
|
891 | > transaction = orig(repo, desc, *args, **kwargs) | |
853 | > # warm up the phase cache |
|
892 | > # warm up the phase cache | |
854 | > list(repo.revs("not public()")) |
|
893 | > list(repo.revs("not public()")) | |
855 | > if desc != 'strip': |
|
894 | > if desc != 'strip': | |
856 | > transaction.addpostclose("phase invalidation test", test) |
|
895 | > transaction.addpostclose("phase invalidation test", test) | |
857 | > return transaction |
|
896 | > return transaction | |
858 | > def extsetup(ui): |
|
897 | > def extsetup(ui): | |
859 | > extensions.wrapfunction(localrepo.localrepository, "transaction", |
|
898 | > extensions.wrapfunction(localrepo.localrepository, "transaction", | |
860 | > transactioncallback) |
|
899 | > transactioncallback) | |
861 | > EOF |
|
900 | > EOF | |
862 | $ hg up -C 2 |
|
901 | $ hg up -C 2 | |
863 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
902 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
864 | $ echo k > k |
|
903 | $ echo k > k | |
865 | $ hg add k |
|
904 | $ hg add k | |
866 | $ hg commit -m commitK |
|
905 | $ hg commit -m commitK | |
867 | $ echo l > l |
|
906 | $ echo l > l | |
868 | $ hg add l |
|
907 | $ hg add l | |
869 | $ hg commit -m commitL |
|
908 | $ hg commit -m commitL | |
870 | $ hg book -r tip blah |
|
909 | $ hg book -r tip blah | |
871 | $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py |
|
910 | $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py | |
872 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
911 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
873 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg (glob) |
|
912 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg (glob) | |
874 | $ hg up -C 1 |
|
913 | $ hg up -C 1 | |
875 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
914 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
876 |
|
915 | |||
877 | Error during post-close callback of the strip transaction |
|
916 | Error during post-close callback of the strip transaction | |
878 | (They should be gracefully handled and reported) |
|
917 | (They should be gracefully handled and reported) | |
879 |
|
918 | |||
880 | $ cat > ../crashstrip.py << EOF |
|
919 | $ cat > ../crashstrip.py << EOF | |
881 | > from mercurial import error |
|
920 | > from mercurial import error | |
882 | > def reposetup(ui, repo): |
|
921 | > def reposetup(ui, repo): | |
883 | > class crashstriprepo(repo.__class__): |
|
922 | > class crashstriprepo(repo.__class__): | |
884 | > def transaction(self, desc, *args, **kwargs): |
|
923 | > def transaction(self, desc, *args, **kwargs): | |
885 | > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs) |
|
924 | > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs) | |
886 | > if desc == 'strip': |
|
925 | > if desc == 'strip': | |
887 | > def crash(tra): raise error.Abort('boom') |
|
926 | > def crash(tra): raise error.Abort('boom') | |
888 | > tr.addpostclose('crash', crash) |
|
927 | > tr.addpostclose('crash', crash) | |
889 | > return tr |
|
928 | > return tr | |
890 | > repo.__class__ = crashstriprepo |
|
929 | > repo.__class__ = crashstriprepo | |
891 | > EOF |
|
930 | > EOF | |
892 | $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py |
|
931 | $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py | |
893 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob) |
|
932 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob) | |
894 | strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob) |
|
933 | strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob) | |
895 | abort: boom |
|
934 | abort: boom | |
896 | [255] |
|
935 | [255] | |
897 |
|
936 | |||
898 |
|
937 |
General Comments 0
You need to be logged in to leave comments.
Login now