Show More
@@ -1,216 +1,222 | |||||
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 mercurial import changegroup, exchange, util, bundle2 |
|
9 | from mercurial import changegroup, exchange, util, bundle2 | |
10 | from mercurial.node import short, hex |
|
10 | from mercurial.node import short, hex | |
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
12 | import errno |
|
12 | import errno | |
13 |
|
13 | |||
14 | def _bundle(repo, bases, heads, node, suffix, compress=True): |
|
14 | def _bundle(repo, bases, heads, node, suffix, compress=True): | |
15 | """create a bundle with the specified revisions as a backup""" |
|
15 | """create a bundle with the specified revisions as a backup""" | |
16 | usebundle2 = (repo.ui.config('experimental', 'bundle2-exp') and |
|
16 | usebundle2 = (repo.ui.config('experimental', 'bundle2-exp') and | |
17 | repo.ui.config('experimental', 'strip-bundle2-version')) |
|
17 | repo.ui.config('experimental', 'strip-bundle2-version')) | |
18 | if usebundle2: |
|
18 | if usebundle2: | |
19 | cgversion = repo.ui.config('experimental', 'strip-bundle2-version') |
|
19 | cgversion = repo.ui.config('experimental', 'strip-bundle2-version') | |
|
20 | if cgversion not in changegroup.packermap: | |||
|
21 | repo.ui.warn(_('unknown strip-bundle2-version value %r; ' + | |||
|
22 | 'should be one of %r\n') % | |||
|
23 | (cgversion, sorted(changegroup.packermap.keys()),)) | |||
|
24 | cgversion = '01' | |||
|
25 | usebundle2 = False | |||
20 | else: |
|
26 | else: | |
21 | cgversion = '01' |
|
27 | cgversion = '01' | |
22 |
|
28 | |||
23 | cg = changegroup.changegroupsubset(repo, bases, heads, 'strip', |
|
29 | cg = changegroup.changegroupsubset(repo, bases, heads, 'strip', | |
24 | version=cgversion) |
|
30 | version=cgversion) | |
25 | backupdir = "strip-backup" |
|
31 | backupdir = "strip-backup" | |
26 | vfs = repo.vfs |
|
32 | vfs = repo.vfs | |
27 | if not vfs.isdir(backupdir): |
|
33 | if not vfs.isdir(backupdir): | |
28 | vfs.mkdir(backupdir) |
|
34 | vfs.mkdir(backupdir) | |
29 |
|
35 | |||
30 | # 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 | |
31 | hexbases = (hex(n) for n in bases) |
|
37 | hexbases = (hex(n) for n in bases) | |
32 | hexheads = (hex(n) for n in heads) |
|
38 | hexheads = (hex(n) for n in heads) | |
33 | allcommits = repo.set('%ls::%ls', hexbases, hexheads) |
|
39 | allcommits = repo.set('%ls::%ls', hexbases, hexheads) | |
34 | allhashes = sorted(c.hex() for c in allcommits) |
|
40 | allhashes = sorted(c.hex() for c in allcommits) | |
35 | totalhash = util.sha1(''.join(allhashes)).hexdigest() |
|
41 | totalhash = util.sha1(''.join(allhashes)).hexdigest() | |
36 | name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) |
|
42 | name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) | |
37 |
|
43 | |||
38 | if usebundle2: |
|
44 | if usebundle2: | |
39 | bundletype = "HG2Y" |
|
45 | bundletype = "HG2Y" | |
40 | elif compress: |
|
46 | elif compress: | |
41 | bundletype = "HG10BZ" |
|
47 | bundletype = "HG10BZ" | |
42 | else: |
|
48 | else: | |
43 | bundletype = "HG10UN" |
|
49 | bundletype = "HG10UN" | |
44 | return changegroup.writebundle(repo.ui, cg, name, bundletype, vfs) |
|
50 | return changegroup.writebundle(repo.ui, cg, name, bundletype, vfs) | |
45 |
|
51 | |||
46 | def _collectfiles(repo, striprev): |
|
52 | def _collectfiles(repo, striprev): | |
47 | """find out the filelogs affected by the strip""" |
|
53 | """find out the filelogs affected by the strip""" | |
48 | files = set() |
|
54 | files = set() | |
49 |
|
55 | |||
50 | for x in xrange(striprev, len(repo)): |
|
56 | for x in xrange(striprev, len(repo)): | |
51 | files.update(repo[x].files()) |
|
57 | files.update(repo[x].files()) | |
52 |
|
58 | |||
53 | return sorted(files) |
|
59 | return sorted(files) | |
54 |
|
60 | |||
55 | def _collectbrokencsets(repo, files, striprev): |
|
61 | def _collectbrokencsets(repo, files, striprev): | |
56 | """return the changesets which will be broken by the truncation""" |
|
62 | """return the changesets which will be broken by the truncation""" | |
57 | s = set() |
|
63 | s = set() | |
58 | def collectone(revlog): |
|
64 | def collectone(revlog): | |
59 | _, brokenset = revlog.getstrippoint(striprev) |
|
65 | _, brokenset = revlog.getstrippoint(striprev) | |
60 | s.update([revlog.linkrev(r) for r in brokenset]) |
|
66 | s.update([revlog.linkrev(r) for r in brokenset]) | |
61 |
|
67 | |||
62 | collectone(repo.manifest) |
|
68 | collectone(repo.manifest) | |
63 | for fname in files: |
|
69 | for fname in files: | |
64 | collectone(repo.file(fname)) |
|
70 | collectone(repo.file(fname)) | |
65 |
|
71 | |||
66 | return s |
|
72 | return s | |
67 |
|
73 | |||
68 | def strip(ui, repo, nodelist, backup=True, topic='backup'): |
|
74 | def strip(ui, repo, nodelist, backup=True, topic='backup'): | |
69 |
|
75 | |||
70 | # Simple way to maintain backwards compatibility for this |
|
76 | # Simple way to maintain backwards compatibility for this | |
71 | # argument. |
|
77 | # argument. | |
72 | if backup in ['none', 'strip']: |
|
78 | if backup in ['none', 'strip']: | |
73 | backup = False |
|
79 | backup = False | |
74 |
|
80 | |||
75 | repo = repo.unfiltered() |
|
81 | repo = repo.unfiltered() | |
76 | repo.destroying() |
|
82 | repo.destroying() | |
77 |
|
83 | |||
78 | cl = repo.changelog |
|
84 | cl = repo.changelog | |
79 | # TODO handle undo of merge sets |
|
85 | # TODO handle undo of merge sets | |
80 | if isinstance(nodelist, str): |
|
86 | if isinstance(nodelist, str): | |
81 | nodelist = [nodelist] |
|
87 | nodelist = [nodelist] | |
82 | striplist = [cl.rev(node) for node in nodelist] |
|
88 | striplist = [cl.rev(node) for node in nodelist] | |
83 | striprev = min(striplist) |
|
89 | striprev = min(striplist) | |
84 |
|
90 | |||
85 | # Some revisions with rev > striprev may not be descendants of striprev. |
|
91 | # Some revisions with rev > striprev may not be descendants of striprev. | |
86 | # We have to find these revisions and put them in a bundle, so that |
|
92 | # We have to find these revisions and put them in a bundle, so that | |
87 | # we can restore them after the truncations. |
|
93 | # we can restore them after the truncations. | |
88 | # To create the bundle we use repo.changegroupsubset which requires |
|
94 | # To create the bundle we use repo.changegroupsubset which requires | |
89 | # the list of heads and bases of the set of interesting revisions. |
|
95 | # the list of heads and bases of the set of interesting revisions. | |
90 | # (head = revision in the set that has no descendant in the set; |
|
96 | # (head = revision in the set that has no descendant in the set; | |
91 | # base = revision in the set that has no ancestor in the set) |
|
97 | # base = revision in the set that has no ancestor in the set) | |
92 | tostrip = set(striplist) |
|
98 | tostrip = set(striplist) | |
93 | for rev in striplist: |
|
99 | for rev in striplist: | |
94 | for desc in cl.descendants([rev]): |
|
100 | for desc in cl.descendants([rev]): | |
95 | tostrip.add(desc) |
|
101 | tostrip.add(desc) | |
96 |
|
102 | |||
97 | files = _collectfiles(repo, striprev) |
|
103 | files = _collectfiles(repo, striprev) | |
98 | saverevs = _collectbrokencsets(repo, files, striprev) |
|
104 | saverevs = _collectbrokencsets(repo, files, striprev) | |
99 |
|
105 | |||
100 | # compute heads |
|
106 | # compute heads | |
101 | saveheads = set(saverevs) |
|
107 | saveheads = set(saverevs) | |
102 | for r in xrange(striprev + 1, len(cl)): |
|
108 | for r in xrange(striprev + 1, len(cl)): | |
103 | if r not in tostrip: |
|
109 | if r not in tostrip: | |
104 | saverevs.add(r) |
|
110 | saverevs.add(r) | |
105 | saveheads.difference_update(cl.parentrevs(r)) |
|
111 | saveheads.difference_update(cl.parentrevs(r)) | |
106 | saveheads.add(r) |
|
112 | saveheads.add(r) | |
107 | saveheads = [cl.node(r) for r in saveheads] |
|
113 | saveheads = [cl.node(r) for r in saveheads] | |
108 |
|
114 | |||
109 | # compute base nodes |
|
115 | # compute base nodes | |
110 | if saverevs: |
|
116 | if saverevs: | |
111 | descendants = set(cl.descendants(saverevs)) |
|
117 | descendants = set(cl.descendants(saverevs)) | |
112 | saverevs.difference_update(descendants) |
|
118 | saverevs.difference_update(descendants) | |
113 | savebases = [cl.node(r) for r in saverevs] |
|
119 | savebases = [cl.node(r) for r in saverevs] | |
114 | stripbases = [cl.node(r) for r in tostrip] |
|
120 | stripbases = [cl.node(r) for r in tostrip] | |
115 |
|
121 | |||
116 | # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but |
|
122 | # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but | |
117 | # is much faster |
|
123 | # is much faster | |
118 | newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip) |
|
124 | newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip) | |
119 | if newbmtarget: |
|
125 | if newbmtarget: | |
120 | newbmtarget = repo[newbmtarget.first()].node() |
|
126 | newbmtarget = repo[newbmtarget.first()].node() | |
121 | else: |
|
127 | else: | |
122 | newbmtarget = '.' |
|
128 | newbmtarget = '.' | |
123 |
|
129 | |||
124 | bm = repo._bookmarks |
|
130 | bm = repo._bookmarks | |
125 | updatebm = [] |
|
131 | updatebm = [] | |
126 | for m in bm: |
|
132 | for m in bm: | |
127 | rev = repo[bm[m]].rev() |
|
133 | rev = repo[bm[m]].rev() | |
128 | if rev in tostrip: |
|
134 | if rev in tostrip: | |
129 | updatebm.append(m) |
|
135 | updatebm.append(m) | |
130 |
|
136 | |||
131 | # create a changegroup for all the branches we need to keep |
|
137 | # create a changegroup for all the branches we need to keep | |
132 | backupfile = None |
|
138 | backupfile = None | |
133 | vfs = repo.vfs |
|
139 | vfs = repo.vfs | |
134 | if backup: |
|
140 | if backup: | |
135 | backupfile = _bundle(repo, stripbases, cl.heads(), node, topic) |
|
141 | backupfile = _bundle(repo, stripbases, cl.heads(), node, topic) | |
136 | repo.ui.status(_("saved backup bundle to %s\n") % |
|
142 | repo.ui.status(_("saved backup bundle to %s\n") % | |
137 | vfs.join(backupfile)) |
|
143 | vfs.join(backupfile)) | |
138 | repo.ui.log("backupbundle", "saved backup bundle to %s\n", |
|
144 | repo.ui.log("backupbundle", "saved backup bundle to %s\n", | |
139 | vfs.join(backupfile)) |
|
145 | vfs.join(backupfile)) | |
140 | if saveheads or savebases: |
|
146 | if saveheads or savebases: | |
141 | # do not compress partial bundle if we remove it from disk later |
|
147 | # do not compress partial bundle if we remove it from disk later | |
142 | chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', |
|
148 | chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', | |
143 | compress=False) |
|
149 | compress=False) | |
144 |
|
150 | |||
145 | mfst = repo.manifest |
|
151 | mfst = repo.manifest | |
146 |
|
152 | |||
147 | tr = repo.transaction("strip") |
|
153 | tr = repo.transaction("strip") | |
148 | offset = len(tr.entries) |
|
154 | offset = len(tr.entries) | |
149 |
|
155 | |||
150 | try: |
|
156 | try: | |
151 | tr.startgroup() |
|
157 | tr.startgroup() | |
152 | cl.strip(striprev, tr) |
|
158 | cl.strip(striprev, tr) | |
153 | mfst.strip(striprev, tr) |
|
159 | mfst.strip(striprev, tr) | |
154 | for fn in files: |
|
160 | for fn in files: | |
155 | repo.file(fn).strip(striprev, tr) |
|
161 | repo.file(fn).strip(striprev, tr) | |
156 | tr.endgroup() |
|
162 | tr.endgroup() | |
157 |
|
163 | |||
158 | try: |
|
164 | try: | |
159 | for i in xrange(offset, len(tr.entries)): |
|
165 | for i in xrange(offset, len(tr.entries)): | |
160 | file, troffset, ignore = tr.entries[i] |
|
166 | file, troffset, ignore = tr.entries[i] | |
161 | repo.svfs(file, 'a').truncate(troffset) |
|
167 | repo.svfs(file, 'a').truncate(troffset) | |
162 | if troffset == 0: |
|
168 | if troffset == 0: | |
163 | repo.store.markremoved(file) |
|
169 | repo.store.markremoved(file) | |
164 | tr.close() |
|
170 | tr.close() | |
165 | except: # re-raises |
|
171 | except: # re-raises | |
166 | tr.abort() |
|
172 | tr.abort() | |
167 | raise |
|
173 | raise | |
168 |
|
174 | |||
169 | if saveheads or savebases: |
|
175 | if saveheads or savebases: | |
170 | ui.note(_("adding branch\n")) |
|
176 | ui.note(_("adding branch\n")) | |
171 | f = vfs.open(chgrpfile, "rb") |
|
177 | f = vfs.open(chgrpfile, "rb") | |
172 | gen = exchange.readbundle(ui, f, chgrpfile, vfs) |
|
178 | gen = exchange.readbundle(ui, f, chgrpfile, vfs) | |
173 | if not repo.ui.verbose: |
|
179 | if not repo.ui.verbose: | |
174 | # silence internal shuffling chatter |
|
180 | # silence internal shuffling chatter | |
175 | repo.ui.pushbuffer() |
|
181 | repo.ui.pushbuffer() | |
176 | if isinstance(gen, bundle2.unbundle20): |
|
182 | if isinstance(gen, bundle2.unbundle20): | |
177 | tr = repo.transaction('strip') |
|
183 | tr = repo.transaction('strip') | |
178 | try: |
|
184 | try: | |
179 | bundle2.processbundle(repo, gen, lambda: tr) |
|
185 | bundle2.processbundle(repo, gen, lambda: tr) | |
180 | tr.close() |
|
186 | tr.close() | |
181 | finally: |
|
187 | finally: | |
182 | tr.release() |
|
188 | tr.release() | |
183 | else: |
|
189 | else: | |
184 | changegroup.addchangegroup(repo, gen, 'strip', |
|
190 | changegroup.addchangegroup(repo, gen, 'strip', | |
185 | 'bundle:' + vfs.join(chgrpfile), |
|
191 | 'bundle:' + vfs.join(chgrpfile), | |
186 | True) |
|
192 | True) | |
187 | if not repo.ui.verbose: |
|
193 | if not repo.ui.verbose: | |
188 | repo.ui.popbuffer() |
|
194 | repo.ui.popbuffer() | |
189 | f.close() |
|
195 | f.close() | |
190 |
|
196 | |||
191 | # remove undo files |
|
197 | # remove undo files | |
192 | for undovfs, undofile in repo.undofiles(): |
|
198 | for undovfs, undofile in repo.undofiles(): | |
193 | try: |
|
199 | try: | |
194 | undovfs.unlink(undofile) |
|
200 | undovfs.unlink(undofile) | |
195 | except OSError, e: |
|
201 | except OSError, e: | |
196 | if e.errno != errno.ENOENT: |
|
202 | if e.errno != errno.ENOENT: | |
197 | ui.warn(_('error removing %s: %s\n') % |
|
203 | ui.warn(_('error removing %s: %s\n') % | |
198 | (undovfs.join(undofile), str(e))) |
|
204 | (undovfs.join(undofile), str(e))) | |
199 |
|
205 | |||
200 | for m in updatebm: |
|
206 | for m in updatebm: | |
201 | bm[m] = repo[newbmtarget].node() |
|
207 | bm[m] = repo[newbmtarget].node() | |
202 | bm.write() |
|
208 | bm.write() | |
203 | except: # re-raises |
|
209 | except: # re-raises | |
204 | if backupfile: |
|
210 | if backupfile: | |
205 | ui.warn(_("strip failed, full bundle stored in '%s'\n") |
|
211 | ui.warn(_("strip failed, full bundle stored in '%s'\n") | |
206 | % vfs.join(backupfile)) |
|
212 | % vfs.join(backupfile)) | |
207 | elif saveheads: |
|
213 | elif saveheads: | |
208 | ui.warn(_("strip failed, partial bundle stored in '%s'\n") |
|
214 | ui.warn(_("strip failed, partial bundle stored in '%s'\n") | |
209 | % vfs.join(chgrpfile)) |
|
215 | % vfs.join(chgrpfile)) | |
210 | raise |
|
216 | raise | |
211 | else: |
|
217 | else: | |
212 | if saveheads or savebases: |
|
218 | if saveheads or savebases: | |
213 | # Remove partial backup only if there were no exceptions |
|
219 | # Remove partial backup only if there were no exceptions | |
214 | vfs.unlink(chgrpfile) |
|
220 | vfs.unlink(chgrpfile) | |
215 |
|
221 | |||
216 | repo.destroyed() |
|
222 | repo.destroyed() |
@@ -1,595 +1,605 | |||||
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 | ||||
|
208 | $ hg up -C 4 | |||
|
209 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
200 |
$ |
|
210 | $ hg --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02 --traceback strip 4 | |
201 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
211 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
202 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob) |
|
212 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob) | |
203 | $ hg parents |
|
213 | $ hg parents | |
204 | changeset: 1:ef3a871183d7 |
|
214 | changeset: 1:ef3a871183d7 | |
205 | user: test |
|
215 | user: test | |
206 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
216 | date: Thu Jan 01 00:00:00 1970 +0000 | |
207 | summary: b |
|
217 | summary: b | |
208 |
|
218 | |||
209 | $ hg debugbundle .hg/strip-backup/* |
|
219 | $ hg debugbundle .hg/strip-backup/* | |
210 | Stream params: {} |
|
220 | Stream params: {} | |
211 | b2x:changegroup -- "{'version': '02'}" |
|
221 | b2x:changegroup -- "{'version': '02'}" | |
212 | 264128213d290d868c54642d13aeaa3675551a78 |
|
222 | 264128213d290d868c54642d13aeaa3675551a78 | |
213 | $ restore |
|
223 | $ restore | |
214 |
|
224 | |||
215 | $ hg up -C 2 |
|
225 | $ hg up -C 2 | |
216 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
217 | $ hg merge 4 |
|
227 | $ hg merge 4 | |
218 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
228 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
219 | (branch merge, don't forget to commit) |
|
229 | (branch merge, don't forget to commit) | |
220 |
|
230 | |||
221 | before strip of merge parent |
|
231 | before strip of merge parent | |
222 |
|
232 | |||
223 | $ hg parents |
|
233 | $ hg parents | |
224 | changeset: 2:65bd5f99a4a3 |
|
234 | changeset: 2:65bd5f99a4a3 | |
225 | user: test |
|
235 | user: test | |
226 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
236 | date: Thu Jan 01 00:00:00 1970 +0000 | |
227 | summary: d |
|
237 | summary: d | |
228 |
|
238 | |||
229 | changeset: 4:264128213d29 |
|
239 | changeset: 4:264128213d29 | |
230 | tag: tip |
|
240 | tag: tip | |
231 | parent: 1:ef3a871183d7 |
|
241 | parent: 1:ef3a871183d7 | |
232 | user: test |
|
242 | user: test | |
233 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
243 | date: Thu Jan 01 00:00:00 1970 +0000 | |
234 | summary: c |
|
244 | summary: c | |
235 |
|
245 | |||
236 | $ hg strip 4 |
|
246 | $ hg strip 4 | |
237 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
247 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
238 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
248 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
239 |
|
249 | |||
240 | after strip of merge parent |
|
250 | after strip of merge parent | |
241 |
|
251 | |||
242 | $ hg parents |
|
252 | $ hg parents | |
243 | changeset: 1:ef3a871183d7 |
|
253 | changeset: 1:ef3a871183d7 | |
244 | user: test |
|
254 | user: test | |
245 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
255 | date: Thu Jan 01 00:00:00 1970 +0000 | |
246 | summary: b |
|
256 | summary: b | |
247 |
|
257 | |||
248 | $ restore |
|
258 | $ restore | |
249 |
|
259 | |||
250 | $ hg up |
|
260 | $ hg up | |
251 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
261 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
252 | $ hg log -G |
|
262 | $ hg log -G | |
253 | @ changeset: 4:264128213d29 |
|
263 | @ changeset: 4:264128213d29 | |
254 | | tag: tip |
|
264 | | tag: tip | |
255 | | parent: 1:ef3a871183d7 |
|
265 | | parent: 1:ef3a871183d7 | |
256 | | user: test |
|
266 | | user: test | |
257 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
267 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
258 | | summary: c |
|
268 | | summary: c | |
259 | | |
|
269 | | | |
260 | | o changeset: 3:443431ffac4f |
|
270 | | o changeset: 3:443431ffac4f | |
261 | | | user: test |
|
271 | | | user: test | |
262 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
272 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
263 | | | summary: e |
|
273 | | | summary: e | |
264 | | | |
|
274 | | | | |
265 | | o changeset: 2:65bd5f99a4a3 |
|
275 | | o changeset: 2:65bd5f99a4a3 | |
266 | |/ user: test |
|
276 | |/ user: test | |
267 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
277 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
268 | | summary: d |
|
278 | | summary: d | |
269 | | |
|
279 | | | |
270 | o changeset: 1:ef3a871183d7 |
|
280 | o changeset: 1:ef3a871183d7 | |
271 | | user: test |
|
281 | | user: test | |
272 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
282 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
273 | | summary: b |
|
283 | | summary: b | |
274 | | |
|
284 | | | |
275 | o changeset: 0:9ab35a2d17cb |
|
285 | o changeset: 0:9ab35a2d17cb | |
276 | user: test |
|
286 | user: test | |
277 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
287 | date: Thu Jan 01 00:00:00 1970 +0000 | |
278 | summary: a |
|
288 | summary: a | |
279 |
|
289 | |||
280 |
|
290 | |||
281 | 2 is parent of 3, only one strip should happen |
|
291 | 2 is parent of 3, only one strip should happen | |
282 |
|
292 | |||
283 | $ hg strip "roots(2)" 3 |
|
293 | $ hg strip "roots(2)" 3 | |
284 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
294 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
285 | $ hg log -G |
|
295 | $ hg log -G | |
286 | @ changeset: 2:264128213d29 |
|
296 | @ changeset: 2:264128213d29 | |
287 | | tag: tip |
|
297 | | tag: tip | |
288 | | user: test |
|
298 | | user: test | |
289 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
299 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
290 | | summary: c |
|
300 | | summary: c | |
291 | | |
|
301 | | | |
292 | o changeset: 1:ef3a871183d7 |
|
302 | o changeset: 1:ef3a871183d7 | |
293 | | user: test |
|
303 | | user: test | |
294 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
304 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
295 | | summary: b |
|
305 | | summary: b | |
296 | | |
|
306 | | | |
297 | o changeset: 0:9ab35a2d17cb |
|
307 | o changeset: 0:9ab35a2d17cb | |
298 | user: test |
|
308 | user: test | |
299 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
309 | date: Thu Jan 01 00:00:00 1970 +0000 | |
300 | summary: a |
|
310 | summary: a | |
301 |
|
311 | |||
302 | $ restore |
|
312 | $ restore | |
303 | $ hg log -G |
|
313 | $ hg log -G | |
304 | o changeset: 4:443431ffac4f |
|
314 | o changeset: 4:443431ffac4f | |
305 | | tag: tip |
|
315 | | tag: tip | |
306 | | user: test |
|
316 | | user: test | |
307 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
317 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
308 | | summary: e |
|
318 | | summary: e | |
309 | | |
|
319 | | | |
310 | o changeset: 3:65bd5f99a4a3 |
|
320 | o changeset: 3:65bd5f99a4a3 | |
311 | | parent: 1:ef3a871183d7 |
|
321 | | parent: 1:ef3a871183d7 | |
312 | | user: test |
|
322 | | user: test | |
313 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
323 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
314 | | summary: d |
|
324 | | summary: d | |
315 | | |
|
325 | | | |
316 | | @ changeset: 2:264128213d29 |
|
326 | | @ changeset: 2:264128213d29 | |
317 | |/ user: test |
|
327 | |/ user: test | |
318 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
328 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
319 | | summary: c |
|
329 | | summary: c | |
320 | | |
|
330 | | | |
321 | o changeset: 1:ef3a871183d7 |
|
331 | o changeset: 1:ef3a871183d7 | |
322 | | user: test |
|
332 | | user: test | |
323 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
333 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
324 | | summary: b |
|
334 | | summary: b | |
325 | | |
|
335 | | | |
326 | o changeset: 0:9ab35a2d17cb |
|
336 | o changeset: 0:9ab35a2d17cb | |
327 | user: test |
|
337 | user: test | |
328 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
338 | date: Thu Jan 01 00:00:00 1970 +0000 | |
329 | summary: a |
|
339 | summary: a | |
330 |
|
340 | |||
331 |
|
341 | |||
332 | 2 different branches: 2 strips |
|
342 | 2 different branches: 2 strips | |
333 |
|
343 | |||
334 | $ hg strip 2 4 |
|
344 | $ hg strip 2 4 | |
335 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
345 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
336 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
346 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
337 | $ hg log -G |
|
347 | $ hg log -G | |
338 | o changeset: 2:65bd5f99a4a3 |
|
348 | o changeset: 2:65bd5f99a4a3 | |
339 | | tag: tip |
|
349 | | tag: tip | |
340 | | user: test |
|
350 | | user: test | |
341 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
351 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
342 | | summary: d |
|
352 | | summary: d | |
343 | | |
|
353 | | | |
344 | @ changeset: 1:ef3a871183d7 |
|
354 | @ changeset: 1:ef3a871183d7 | |
345 | | user: test |
|
355 | | user: test | |
346 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
356 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
347 | | summary: b |
|
357 | | summary: b | |
348 | | |
|
358 | | | |
349 | o changeset: 0:9ab35a2d17cb |
|
359 | o changeset: 0:9ab35a2d17cb | |
350 | user: test |
|
360 | user: test | |
351 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
361 | date: Thu Jan 01 00:00:00 1970 +0000 | |
352 | summary: a |
|
362 | summary: a | |
353 |
|
363 | |||
354 | $ restore |
|
364 | $ restore | |
355 |
|
365 | |||
356 | 2 different branches and a common ancestor: 1 strip |
|
366 | 2 different branches and a common ancestor: 1 strip | |
357 |
|
367 | |||
358 | $ hg strip 1 "2|4" |
|
368 | $ hg strip 1 "2|4" | |
359 | 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 | |
360 | 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) | |
361 | $ restore |
|
371 | $ restore | |
362 |
|
372 | |||
363 | verify fncache is kept up-to-date |
|
373 | verify fncache is kept up-to-date | |
364 |
|
374 | |||
365 | $ touch a |
|
375 | $ touch a | |
366 | $ hg ci -qAm a |
|
376 | $ hg ci -qAm a | |
367 | $ cat .hg/store/fncache | sort |
|
377 | $ cat .hg/store/fncache | sort | |
368 | data/a.i |
|
378 | data/a.i | |
369 | data/bar.i |
|
379 | data/bar.i | |
370 | $ hg strip tip |
|
380 | $ hg strip tip | |
371 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
381 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
372 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
382 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
373 | $ cat .hg/store/fncache |
|
383 | $ cat .hg/store/fncache | |
374 | data/bar.i |
|
384 | data/bar.i | |
375 |
|
385 | |||
376 | stripping an empty revset |
|
386 | stripping an empty revset | |
377 |
|
387 | |||
378 | $ hg strip "1 and not 1" |
|
388 | $ hg strip "1 and not 1" | |
379 | abort: empty revision set |
|
389 | abort: empty revision set | |
380 | [255] |
|
390 | [255] | |
381 |
|
391 | |||
382 | remove branchy history for qimport tests |
|
392 | remove branchy history for qimport tests | |
383 |
|
393 | |||
384 | $ hg strip 3 |
|
394 | $ hg strip 3 | |
385 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
395 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
386 |
|
396 | |||
387 |
|
397 | |||
388 | strip of applied mq should cleanup status file |
|
398 | strip of applied mq should cleanup status file | |
389 |
|
399 | |||
390 | $ echo "mq=" >> $HGRCPATH |
|
400 | $ echo "mq=" >> $HGRCPATH | |
391 | $ hg up -C 3 |
|
401 | $ hg up -C 3 | |
392 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
402 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
393 | $ echo fooagain >> bar |
|
403 | $ echo fooagain >> bar | |
394 | $ hg ci -mf |
|
404 | $ hg ci -mf | |
395 | $ hg qimport -r tip:2 |
|
405 | $ hg qimport -r tip:2 | |
396 |
|
406 | |||
397 | applied patches before strip |
|
407 | applied patches before strip | |
398 |
|
408 | |||
399 | $ hg qapplied |
|
409 | $ hg qapplied | |
400 | 2.diff |
|
410 | 2.diff | |
401 | 3.diff |
|
411 | 3.diff | |
402 | 4.diff |
|
412 | 4.diff | |
403 |
|
413 | |||
404 | stripping revision in queue |
|
414 | stripping revision in queue | |
405 |
|
415 | |||
406 | $ hg strip 3 |
|
416 | $ hg strip 3 | |
407 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
417 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
408 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
418 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
409 |
|
419 | |||
410 | applied patches after stripping rev in queue |
|
420 | applied patches after stripping rev in queue | |
411 |
|
421 | |||
412 | $ hg qapplied |
|
422 | $ hg qapplied | |
413 | 2.diff |
|
423 | 2.diff | |
414 |
|
424 | |||
415 | stripping ancestor of queue |
|
425 | stripping ancestor of queue | |
416 |
|
426 | |||
417 | $ hg strip 1 |
|
427 | $ hg strip 1 | |
418 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
428 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
419 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
429 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
420 |
|
430 | |||
421 | applied patches after stripping ancestor of queue |
|
431 | applied patches after stripping ancestor of queue | |
422 |
|
432 | |||
423 | $ hg qapplied |
|
433 | $ hg qapplied | |
424 |
|
434 | |||
425 | Verify strip protects against stripping wc parent when there are uncommitted mods |
|
435 | Verify strip protects against stripping wc parent when there are uncommitted mods | |
426 |
|
436 | |||
427 | $ echo b > b |
|
437 | $ echo b > b | |
428 | $ hg add b |
|
438 | $ hg add b | |
429 | $ hg ci -m 'b' |
|
439 | $ hg ci -m 'b' | |
430 | $ hg log --graph |
|
440 | $ hg log --graph | |
431 | @ changeset: 1:7519abd79d14 |
|
441 | @ changeset: 1:7519abd79d14 | |
432 | | tag: tip |
|
442 | | tag: tip | |
433 | | user: test |
|
443 | | user: test | |
434 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
444 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
435 | | summary: b |
|
445 | | summary: b | |
436 | | |
|
446 | | | |
437 | o changeset: 0:9ab35a2d17cb |
|
447 | o changeset: 0:9ab35a2d17cb | |
438 | user: test |
|
448 | user: test | |
439 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
449 | date: Thu Jan 01 00:00:00 1970 +0000 | |
440 | summary: a |
|
450 | summary: a | |
441 |
|
451 | |||
442 |
|
452 | |||
443 | $ echo c > b |
|
453 | $ echo c > b | |
444 | $ echo c > bar |
|
454 | $ echo c > bar | |
445 | $ hg strip tip |
|
455 | $ hg strip tip | |
446 | abort: local changes found |
|
456 | abort: local changes found | |
447 | [255] |
|
457 | [255] | |
448 | $ hg strip tip --keep |
|
458 | $ hg strip tip --keep | |
449 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
459 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
450 | $ hg log --graph |
|
460 | $ hg log --graph | |
451 | @ changeset: 0:9ab35a2d17cb |
|
461 | @ changeset: 0:9ab35a2d17cb | |
452 | tag: tip |
|
462 | tag: tip | |
453 | user: test |
|
463 | user: test | |
454 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
464 | date: Thu Jan 01 00:00:00 1970 +0000 | |
455 | summary: a |
|
465 | summary: a | |
456 |
|
466 | |||
457 | $ hg status |
|
467 | $ hg status | |
458 | M bar |
|
468 | M bar | |
459 | ? b |
|
469 | ? b | |
460 |
|
470 | |||
461 | Strip adds, removes, modifies with --keep |
|
471 | Strip adds, removes, modifies with --keep | |
462 |
|
472 | |||
463 | $ touch b |
|
473 | $ touch b | |
464 | $ hg add b |
|
474 | $ hg add b | |
465 | $ hg commit -mb |
|
475 | $ hg commit -mb | |
466 | $ touch c |
|
476 | $ touch c | |
467 |
|
477 | |||
468 | ... with a clean working dir |
|
478 | ... with a clean working dir | |
469 |
|
479 | |||
470 | $ hg add c |
|
480 | $ hg add c | |
471 | $ hg rm bar |
|
481 | $ hg rm bar | |
472 | $ hg commit -mc |
|
482 | $ hg commit -mc | |
473 | $ hg status |
|
483 | $ hg status | |
474 | $ hg strip --keep tip |
|
484 | $ hg strip --keep tip | |
475 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
485 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
476 | $ hg status |
|
486 | $ hg status | |
477 | ! bar |
|
487 | ! bar | |
478 | ? c |
|
488 | ? c | |
479 |
|
489 | |||
480 | ... with a dirty working dir |
|
490 | ... with a dirty working dir | |
481 |
|
491 | |||
482 | $ hg add c |
|
492 | $ hg add c | |
483 | $ hg rm bar |
|
493 | $ hg rm bar | |
484 | $ hg commit -mc |
|
494 | $ hg commit -mc | |
485 | $ hg status |
|
495 | $ hg status | |
486 | $ echo b > b |
|
496 | $ echo b > b | |
487 | $ echo d > d |
|
497 | $ echo d > d | |
488 | $ hg strip --keep tip |
|
498 | $ hg strip --keep tip | |
489 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/57e364c8a475-4cfed93c-backup.hg (glob) |
|
499 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/57e364c8a475-4cfed93c-backup.hg (glob) | |
490 | $ hg status |
|
500 | $ hg status | |
491 | M b |
|
501 | M b | |
492 | ! bar |
|
502 | ! bar | |
493 | ? c |
|
503 | ? c | |
494 | ? d |
|
504 | ? d | |
495 | $ cd .. |
|
505 | $ cd .. | |
496 |
|
506 | |||
497 | stripping many nodes on a complex graph (issue3299) |
|
507 | stripping many nodes on a complex graph (issue3299) | |
498 |
|
508 | |||
499 | $ hg init issue3299 |
|
509 | $ hg init issue3299 | |
500 | $ cd issue3299 |
|
510 | $ cd issue3299 | |
501 | $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' |
|
511 | $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' | |
502 | $ hg strip 'not ancestors(x)' |
|
512 | $ hg strip 'not ancestors(x)' | |
503 | saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) |
|
513 | saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) | |
504 |
|
514 | |||
505 | test hg strip -B bookmark |
|
515 | test hg strip -B bookmark | |
506 |
|
516 | |||
507 | $ cd .. |
|
517 | $ cd .. | |
508 | $ hg init bookmarks |
|
518 | $ hg init bookmarks | |
509 | $ cd bookmarks |
|
519 | $ cd bookmarks | |
510 | $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b' |
|
520 | $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b' | |
511 | $ hg bookmark -r 'a' 'todelete' |
|
521 | $ hg bookmark -r 'a' 'todelete' | |
512 | $ hg bookmark -r 'b' 'B' |
|
522 | $ hg bookmark -r 'b' 'B' | |
513 | $ hg bookmark -r 'b' 'nostrip' |
|
523 | $ hg bookmark -r 'b' 'nostrip' | |
514 | $ hg bookmark -r 'c' 'delete' |
|
524 | $ hg bookmark -r 'c' 'delete' | |
515 | $ hg up -C todelete |
|
525 | $ hg up -C todelete | |
516 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
526 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
517 | (activating bookmark todelete) |
|
527 | (activating bookmark todelete) | |
518 | $ hg strip -B nostrip |
|
528 | $ hg strip -B nostrip | |
519 | bookmark 'nostrip' deleted |
|
529 | bookmark 'nostrip' deleted | |
520 | abort: empty revision set |
|
530 | abort: empty revision set | |
521 | [255] |
|
531 | [255] | |
522 | $ hg strip -B todelete |
|
532 | $ hg strip -B todelete | |
523 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
533 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
524 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
534 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) | |
525 | bookmark 'todelete' deleted |
|
535 | bookmark 'todelete' deleted | |
526 | $ hg id -ir dcbb326fdec2 |
|
536 | $ hg id -ir dcbb326fdec2 | |
527 | abort: unknown revision 'dcbb326fdec2'! |
|
537 | abort: unknown revision 'dcbb326fdec2'! | |
528 | [255] |
|
538 | [255] | |
529 | $ hg id -ir d62d843c9a01 |
|
539 | $ hg id -ir d62d843c9a01 | |
530 | d62d843c9a01 |
|
540 | d62d843c9a01 | |
531 | $ hg bookmarks |
|
541 | $ hg bookmarks | |
532 | B 9:ff43616e5d0f |
|
542 | B 9:ff43616e5d0f | |
533 | delete 6:2702dd0c91e7 |
|
543 | delete 6:2702dd0c91e7 | |
534 | $ hg strip -B delete |
|
544 | $ hg strip -B delete | |
535 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
545 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) | |
536 | bookmark 'delete' deleted |
|
546 | bookmark 'delete' deleted | |
537 | $ hg id -ir 6:2702dd0c91e7 |
|
547 | $ hg id -ir 6:2702dd0c91e7 | |
538 | abort: unknown revision '2702dd0c91e7'! |
|
548 | abort: unknown revision '2702dd0c91e7'! | |
539 | [255] |
|
549 | [255] | |
540 | $ hg update B |
|
550 | $ hg update B | |
541 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
551 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
542 | (activating bookmark B) |
|
552 | (activating bookmark B) | |
543 | $ echo a > a |
|
553 | $ echo a > a | |
544 | $ hg add a |
|
554 | $ hg add a | |
545 | $ hg strip -B B |
|
555 | $ hg strip -B B | |
546 | abort: local changes found |
|
556 | abort: local changes found | |
547 | [255] |
|
557 | [255] | |
548 | $ hg bookmarks |
|
558 | $ hg bookmarks | |
549 | * B 6:ff43616e5d0f |
|
559 | * B 6:ff43616e5d0f | |
550 |
|
560 | |||
551 | Make sure no one adds back a -b option: |
|
561 | Make sure no one adds back a -b option: | |
552 |
|
562 | |||
553 | $ hg strip -b tip |
|
563 | $ hg strip -b tip | |
554 | hg strip: option -b not recognized |
|
564 | hg strip: option -b not recognized | |
555 | hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV... |
|
565 | hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV... | |
556 |
|
566 | |||
557 | strip changesets and all their descendants from the repository |
|
567 | strip changesets and all their descendants from the repository | |
558 |
|
568 | |||
559 | (use "hg help -e strip" to show help for the strip extension) |
|
569 | (use "hg help -e strip" to show help for the strip extension) | |
560 |
|
570 | |||
561 | options ([+] can be repeated): |
|
571 | options ([+] can be repeated): | |
562 |
|
572 | |||
563 | -r --rev REV [+] strip specified revision (optional, can specify revisions |
|
573 | -r --rev REV [+] strip specified revision (optional, can specify revisions | |
564 | without this option) |
|
574 | without this option) | |
565 | -f --force force removal of changesets, discard uncommitted changes |
|
575 | -f --force force removal of changesets, discard uncommitted changes | |
566 | (no backup) |
|
576 | (no backup) | |
567 | --no-backup no backups |
|
577 | --no-backup no backups | |
568 | -k --keep do not modify working copy during strip |
|
578 | -k --keep do not modify working copy during strip | |
569 | -B --bookmark VALUE remove revs only reachable from given bookmark |
|
579 | -B --bookmark VALUE remove revs only reachable from given bookmark | |
570 | --mq operate on patch repository |
|
580 | --mq operate on patch repository | |
571 |
|
581 | |||
572 | (use "hg strip -h" to show more help) |
|
582 | (use "hg strip -h" to show more help) | |
573 | [255] |
|
583 | [255] | |
574 |
|
584 | |||
575 | $ cd .. |
|
585 | $ cd .. | |
576 |
|
586 | |||
577 | Verify bundles don't get overwritten: |
|
587 | Verify bundles don't get overwritten: | |
578 |
|
588 | |||
579 | $ hg init doublebundle |
|
589 | $ hg init doublebundle | |
580 | $ cd doublebundle |
|
590 | $ cd doublebundle | |
581 | $ touch a |
|
591 | $ touch a | |
582 | $ hg commit -Aqm a |
|
592 | $ hg commit -Aqm a | |
583 | $ touch b |
|
593 | $ touch b | |
584 | $ hg commit -Aqm b |
|
594 | $ hg commit -Aqm b | |
585 | $ hg strip -r 0 |
|
595 | $ hg strip -r 0 | |
586 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
596 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
587 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob) |
|
597 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob) | |
588 | $ ls .hg/strip-backup |
|
598 | $ ls .hg/strip-backup | |
589 | 3903775176ed-e68910bd-backup.hg |
|
599 | 3903775176ed-e68910bd-backup.hg | |
590 | $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg |
|
600 | $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg | |
591 | $ hg strip -r 0 |
|
601 | $ hg strip -r 0 | |
592 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob) |
|
602 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob) | |
593 | $ ls .hg/strip-backup |
|
603 | $ ls .hg/strip-backup | |
594 | 3903775176ed-54390173-backup.hg |
|
604 | 3903775176ed-54390173-backup.hg | |
595 | 3903775176ed-e68910bd-backup.hg |
|
605 | 3903775176ed-e68910bd-backup.hg |
General Comments 0
You need to be logged in to leave comments.
Login now