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