##// END OF EJS Templates
strip: during merge allow strip only when -f is used...
Taapas Agrawal -
r42670:1acaa9f3 default
parent child Browse files
Show More
@@ -1,248 +1,251 b''
1 """strip changesets and their descendants from history
1 """strip changesets and their descendants from history
2
2
3 This extension allows you to strip changesets and all their descendants from the
3 This extension allows you to strip changesets and all their descendants from the
4 repository. See the command help for details.
4 repository. See the command help for details.
5 """
5 """
6 from __future__ import absolute_import
6 from __future__ import absolute_import
7
7
8 from mercurial.i18n import _
8 from mercurial.i18n import _
9 from mercurial import (
9 from mercurial import (
10 bookmarks as bookmarksmod,
10 bookmarks as bookmarksmod,
11 cmdutil,
11 cmdutil,
12 error,
12 error,
13 hg,
13 hg,
14 lock as lockmod,
14 lock as lockmod,
15 merge,
15 merge,
16 node as nodemod,
16 node as nodemod,
17 pycompat,
17 pycompat,
18 registrar,
18 registrar,
19 repair,
19 repair,
20 scmutil,
20 scmutil,
21 util,
21 util,
22 )
22 )
23 nullid = nodemod.nullid
23 nullid = nodemod.nullid
24 release = lockmod.release
24 release = lockmod.release
25
25
26 cmdtable = {}
26 cmdtable = {}
27 command = registrar.command(cmdtable)
27 command = registrar.command(cmdtable)
28 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
28 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
29 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
29 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
30 # be specifying the version(s) of Mercurial they are tested with, or
30 # be specifying the version(s) of Mercurial they are tested with, or
31 # leave the attribute unspecified.
31 # leave the attribute unspecified.
32 testedwith = 'ships-with-hg-core'
32 testedwith = 'ships-with-hg-core'
33
33
34 def checksubstate(repo, baserev=None):
34 def checksubstate(repo, baserev=None):
35 '''return list of subrepos at a different revision than substate.
35 '''return list of subrepos at a different revision than substate.
36 Abort if any subrepos have uncommitted changes.'''
36 Abort if any subrepos have uncommitted changes.'''
37 inclsubs = []
37 inclsubs = []
38 wctx = repo[None]
38 wctx = repo[None]
39 if baserev:
39 if baserev:
40 bctx = repo[baserev]
40 bctx = repo[baserev]
41 else:
41 else:
42 bctx = wctx.p1()
42 bctx = wctx.p1()
43 for s in sorted(wctx.substate):
43 for s in sorted(wctx.substate):
44 wctx.sub(s).bailifchanged(True)
44 wctx.sub(s).bailifchanged(True)
45 if s not in bctx.substate or bctx.sub(s).dirty():
45 if s not in bctx.substate or bctx.sub(s).dirty():
46 inclsubs.append(s)
46 inclsubs.append(s)
47 return inclsubs
47 return inclsubs
48
48
49 def checklocalchanges(repo, force=False, excsuffix=''):
49 def checklocalchanges(repo, force=False, excsuffix=''):
50 cmdutil.checkunfinished(repo)
50 cmdutil.checkunfinished(repo)
51 s = repo.status()
51 s = repo.status()
52 if not force:
52 if not force:
53 if len(repo[None].parents()) > 1:
54 _("outstanding uncommitted merge") #i18 tool detection
55 raise error.Abort(_("outstanding uncommitted merge"+ excsuffix))
53 if s.modified or s.added or s.removed or s.deleted:
56 if s.modified or s.added or s.removed or s.deleted:
54 _("local changes found") # i18n tool detection
57 _("local changes found") # i18n tool detection
55 raise error.Abort(_("local changes found" + excsuffix))
58 raise error.Abort(_("local changes found" + excsuffix))
56 if checksubstate(repo):
59 if checksubstate(repo):
57 _("local changed subrepos found") # i18n tool detection
60 _("local changed subrepos found") # i18n tool detection
58 raise error.Abort(_("local changed subrepos found" + excsuffix))
61 raise error.Abort(_("local changed subrepos found" + excsuffix))
59 return s
62 return s
60
63
61 def _findupdatetarget(repo, nodes):
64 def _findupdatetarget(repo, nodes):
62 unode, p2 = repo.changelog.parents(nodes[0])
65 unode, p2 = repo.changelog.parents(nodes[0])
63 currentbranch = repo[None].branch()
66 currentbranch = repo[None].branch()
64
67
65 if (util.safehasattr(repo, 'mq') and p2 != nullid
68 if (util.safehasattr(repo, 'mq') and p2 != nullid
66 and p2 in [x.node for x in repo.mq.applied]):
69 and p2 in [x.node for x in repo.mq.applied]):
67 unode = p2
70 unode = p2
68 elif currentbranch != repo[unode].branch():
71 elif currentbranch != repo[unode].branch():
69 pwdir = 'parents(wdir())'
72 pwdir = 'parents(wdir())'
70 revset = 'max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s))'
73 revset = 'max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s))'
71 branchtarget = repo.revs(revset, nodes, pwdir, pwdir, nodes, pwdir,
74 branchtarget = repo.revs(revset, nodes, pwdir, pwdir, nodes, pwdir,
72 currentbranch)
75 currentbranch)
73 if branchtarget:
76 if branchtarget:
74 cl = repo.changelog
77 cl = repo.changelog
75 unode = cl.node(branchtarget.first())
78 unode = cl.node(branchtarget.first())
76
79
77 return unode
80 return unode
78
81
79 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None,
82 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None,
80 soft=False):
83 soft=False):
81 with repo.wlock(), repo.lock():
84 with repo.wlock(), repo.lock():
82
85
83 if update:
86 if update:
84 checklocalchanges(repo, force=force)
87 checklocalchanges(repo, force=force)
85 urev = _findupdatetarget(repo, revs)
88 urev = _findupdatetarget(repo, revs)
86 hg.clean(repo, urev)
89 hg.clean(repo, urev)
87 repo.dirstate.write(repo.currenttransaction())
90 repo.dirstate.write(repo.currenttransaction())
88
91
89 if soft:
92 if soft:
90 repair.softstrip(ui, repo, revs, backup)
93 repair.softstrip(ui, repo, revs, backup)
91 else:
94 else:
92 repair.strip(ui, repo, revs, backup)
95 repair.strip(ui, repo, revs, backup)
93
96
94 repomarks = repo._bookmarks
97 repomarks = repo._bookmarks
95 if bookmarks:
98 if bookmarks:
96 with repo.transaction('strip') as tr:
99 with repo.transaction('strip') as tr:
97 if repo._activebookmark in bookmarks:
100 if repo._activebookmark in bookmarks:
98 bookmarksmod.deactivate(repo)
101 bookmarksmod.deactivate(repo)
99 repomarks.applychanges(repo, tr, [(b, None) for b in bookmarks])
102 repomarks.applychanges(repo, tr, [(b, None) for b in bookmarks])
100 for bookmark in sorted(bookmarks):
103 for bookmark in sorted(bookmarks):
101 ui.write(_("bookmark '%s' deleted\n") % bookmark)
104 ui.write(_("bookmark '%s' deleted\n") % bookmark)
102
105
103 @command("strip",
106 @command("strip",
104 [
107 [
105 ('r', 'rev', [], _('strip specified revision (optional, '
108 ('r', 'rev', [], _('strip specified revision (optional, '
106 'can specify revisions without this '
109 'can specify revisions without this '
107 'option)'), _('REV')),
110 'option)'), _('REV')),
108 ('f', 'force', None, _('force removal of changesets, discard '
111 ('f', 'force', None, _('force removal of changesets, discard '
109 'uncommitted changes (no backup)')),
112 'uncommitted changes (no backup)')),
110 ('', 'no-backup', None, _('do not save backup bundle')),
113 ('', 'no-backup', None, _('do not save backup bundle')),
111 ('', 'nobackup', None, _('do not save backup bundle '
114 ('', 'nobackup', None, _('do not save backup bundle '
112 '(DEPRECATED)')),
115 '(DEPRECATED)')),
113 ('n', '', None, _('ignored (DEPRECATED)')),
116 ('n', '', None, _('ignored (DEPRECATED)')),
114 ('k', 'keep', None, _("do not modify working directory during "
117 ('k', 'keep', None, _("do not modify working directory during "
115 "strip")),
118 "strip")),
116 ('B', 'bookmark', [], _("remove revs only reachable from given"
119 ('B', 'bookmark', [], _("remove revs only reachable from given"
117 " bookmark"), _('BOOKMARK')),
120 " bookmark"), _('BOOKMARK')),
118 ('', 'soft', None,
121 ('', 'soft', None,
119 _("simply drop changesets from visible history (EXPERIMENTAL)")),
122 _("simply drop changesets from visible history (EXPERIMENTAL)")),
120 ],
123 ],
121 _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
124 _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
122 helpcategory=command.CATEGORY_MAINTENANCE)
125 helpcategory=command.CATEGORY_MAINTENANCE)
123 def stripcmd(ui, repo, *revs, **opts):
126 def stripcmd(ui, repo, *revs, **opts):
124 """strip changesets and all their descendants from the repository
127 """strip changesets and all their descendants from the repository
125
128
126 The strip command removes the specified changesets and all their
129 The strip command removes the specified changesets and all their
127 descendants. If the working directory has uncommitted changes, the
130 descendants. If the working directory has uncommitted changes, the
128 operation is aborted unless the --force flag is supplied, in which
131 operation is aborted unless the --force flag is supplied, in which
129 case changes will be discarded.
132 case changes will be discarded.
130
133
131 If a parent of the working directory is stripped, then the working
134 If a parent of the working directory is stripped, then the working
132 directory will automatically be updated to the most recent
135 directory will automatically be updated to the most recent
133 available ancestor of the stripped parent after the operation
136 available ancestor of the stripped parent after the operation
134 completes.
137 completes.
135
138
136 Any stripped changesets are stored in ``.hg/strip-backup`` as a
139 Any stripped changesets are stored in ``.hg/strip-backup`` as a
137 bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
140 bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
138 be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
141 be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
139 where BUNDLE is the bundle file created by the strip. Note that
142 where BUNDLE is the bundle file created by the strip. Note that
140 the local revision numbers will in general be different after the
143 the local revision numbers will in general be different after the
141 restore.
144 restore.
142
145
143 Use the --no-backup option to discard the backup bundle once the
146 Use the --no-backup option to discard the backup bundle once the
144 operation completes.
147 operation completes.
145
148
146 Strip is not a history-rewriting operation and can be used on
149 Strip is not a history-rewriting operation and can be used on
147 changesets in the public phase. But if the stripped changesets have
150 changesets in the public phase. But if the stripped changesets have
148 been pushed to a remote repository you will likely pull them again.
151 been pushed to a remote repository you will likely pull them again.
149
152
150 Return 0 on success.
153 Return 0 on success.
151 """
154 """
152 opts = pycompat.byteskwargs(opts)
155 opts = pycompat.byteskwargs(opts)
153 backup = True
156 backup = True
154 if opts.get('no_backup') or opts.get('nobackup'):
157 if opts.get('no_backup') or opts.get('nobackup'):
155 backup = False
158 backup = False
156
159
157 cl = repo.changelog
160 cl = repo.changelog
158 revs = list(revs) + opts.get('rev')
161 revs = list(revs) + opts.get('rev')
159 revs = set(scmutil.revrange(repo, revs))
162 revs = set(scmutil.revrange(repo, revs))
160
163
161 with repo.wlock():
164 with repo.wlock():
162 bookmarks = set(opts.get('bookmark'))
165 bookmarks = set(opts.get('bookmark'))
163 if bookmarks:
166 if bookmarks:
164 repomarks = repo._bookmarks
167 repomarks = repo._bookmarks
165 if not bookmarks.issubset(repomarks):
168 if not bookmarks.issubset(repomarks):
166 raise error.Abort(_("bookmark '%s' not found") %
169 raise error.Abort(_("bookmark '%s' not found") %
167 ','.join(sorted(bookmarks - set(repomarks.keys()))))
170 ','.join(sorted(bookmarks - set(repomarks.keys()))))
168
171
169 # If the requested bookmark is not the only one pointing to a
172 # If the requested bookmark is not the only one pointing to a
170 # a revision we have to only delete the bookmark and not strip
173 # a revision we have to only delete the bookmark and not strip
171 # anything. revsets cannot detect that case.
174 # anything. revsets cannot detect that case.
172 nodetobookmarks = {}
175 nodetobookmarks = {}
173 for mark, node in repomarks.iteritems():
176 for mark, node in repomarks.iteritems():
174 nodetobookmarks.setdefault(node, []).append(mark)
177 nodetobookmarks.setdefault(node, []).append(mark)
175 for marks in nodetobookmarks.values():
178 for marks in nodetobookmarks.values():
176 if bookmarks.issuperset(marks):
179 if bookmarks.issuperset(marks):
177 rsrevs = scmutil.bookmarkrevs(repo, marks[0])
180 rsrevs = scmutil.bookmarkrevs(repo, marks[0])
178 revs.update(set(rsrevs))
181 revs.update(set(rsrevs))
179 if not revs:
182 if not revs:
180 with repo.lock(), repo.transaction('bookmark') as tr:
183 with repo.lock(), repo.transaction('bookmark') as tr:
181 bmchanges = [(b, None) for b in bookmarks]
184 bmchanges = [(b, None) for b in bookmarks]
182 repomarks.applychanges(repo, tr, bmchanges)
185 repomarks.applychanges(repo, tr, bmchanges)
183 for bookmark in sorted(bookmarks):
186 for bookmark in sorted(bookmarks):
184 ui.write(_("bookmark '%s' deleted\n") % bookmark)
187 ui.write(_("bookmark '%s' deleted\n") % bookmark)
185
188
186 if not revs:
189 if not revs:
187 raise error.Abort(_('empty revision set'))
190 raise error.Abort(_('empty revision set'))
188
191
189 descendants = set(cl.descendants(revs))
192 descendants = set(cl.descendants(revs))
190 strippedrevs = revs.union(descendants)
193 strippedrevs = revs.union(descendants)
191 roots = revs.difference(descendants)
194 roots = revs.difference(descendants)
192
195
193 # if one of the wdir parent is stripped we'll need
196 # if one of the wdir parent is stripped we'll need
194 # to update away to an earlier revision
197 # to update away to an earlier revision
195 update = any(p != nullid and cl.rev(p) in strippedrevs
198 update = any(p != nullid and cl.rev(p) in strippedrevs
196 for p in repo.dirstate.parents())
199 for p in repo.dirstate.parents())
197
200
198 rootnodes = set(cl.node(r) for r in roots)
201 rootnodes = set(cl.node(r) for r in roots)
199
202
200 q = getattr(repo, 'mq', None)
203 q = getattr(repo, 'mq', None)
201 if q is not None and q.applied:
204 if q is not None and q.applied:
202 # refresh queue state if we're about to strip
205 # refresh queue state if we're about to strip
203 # applied patches
206 # applied patches
204 if cl.rev(repo.lookup('qtip')) in strippedrevs:
207 if cl.rev(repo.lookup('qtip')) in strippedrevs:
205 q.applieddirty = True
208 q.applieddirty = True
206 start = 0
209 start = 0
207 end = len(q.applied)
210 end = len(q.applied)
208 for i, statusentry in enumerate(q.applied):
211 for i, statusentry in enumerate(q.applied):
209 if statusentry.node in rootnodes:
212 if statusentry.node in rootnodes:
210 # if one of the stripped roots is an applied
213 # if one of the stripped roots is an applied
211 # patch, only part of the queue is stripped
214 # patch, only part of the queue is stripped
212 start = i
215 start = i
213 break
216 break
214 del q.applied[start:end]
217 del q.applied[start:end]
215 q.savedirty()
218 q.savedirty()
216
219
217 revs = sorted(rootnodes)
220 revs = sorted(rootnodes)
218 if update and opts.get('keep'):
221 if update and opts.get('keep'):
219 urev = _findupdatetarget(repo, revs)
222 urev = _findupdatetarget(repo, revs)
220 uctx = repo[urev]
223 uctx = repo[urev]
221
224
222 # only reset the dirstate for files that would actually change
225 # only reset the dirstate for files that would actually change
223 # between the working context and uctx
226 # between the working context and uctx
224 descendantrevs = repo.revs(b"%d::.", uctx.rev())
227 descendantrevs = repo.revs(b"%d::.", uctx.rev())
225 changedfiles = []
228 changedfiles = []
226 for rev in descendantrevs:
229 for rev in descendantrevs:
227 # blindly reset the files, regardless of what actually changed
230 # blindly reset the files, regardless of what actually changed
228 changedfiles.extend(repo[rev].files())
231 changedfiles.extend(repo[rev].files())
229
232
230 # reset files that only changed in the dirstate too
233 # reset files that only changed in the dirstate too
231 dirstate = repo.dirstate
234 dirstate = repo.dirstate
232 dirchanges = [f for f in dirstate if dirstate[f] != 'n']
235 dirchanges = [f for f in dirstate if dirstate[f] != 'n']
233 changedfiles.extend(dirchanges)
236 changedfiles.extend(dirchanges)
234
237
235 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
238 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
236 repo.dirstate.write(repo.currenttransaction())
239 repo.dirstate.write(repo.currenttransaction())
237
240
238 # clear resolve state
241 # clear resolve state
239 merge.mergestate.clean(repo, repo['.'].node())
242 merge.mergestate.clean(repo, repo['.'].node())
240
243
241 update = False
244 update = False
242
245
243
246
244 strip(ui, repo, revs, backup=backup, update=update,
247 strip(ui, repo, revs, backup=backup, update=update,
245 force=opts.get('force'), bookmarks=bookmarks,
248 force=opts.get('force'), bookmarks=bookmarks,
246 soft=opts['soft'])
249 soft=opts['soft'])
247
250
248 return 0
251 return 0
@@ -1,1348 +1,1353 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "strip=" >> $HGRCPATH
2 $ echo "strip=" >> $HGRCPATH
3 $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH
3 $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH
4
4
5 $ restore() {
5 $ restore() {
6 > hg unbundle -q .hg/strip-backup/*
6 > hg unbundle -q .hg/strip-backup/*
7 > rm .hg/strip-backup/*
7 > rm .hg/strip-backup/*
8 > }
8 > }
9 $ teststrip() {
9 $ teststrip() {
10 > hg up -C $1
10 > hg up -C $1
11 > echo % before update $1, strip $2
11 > echo % before update $1, strip $2
12 > hg parents
12 > hg parents
13 > hg --traceback strip $2
13 > hg --traceback strip $2
14 > echo % after update $1, strip $2
14 > echo % after update $1, strip $2
15 > hg parents
15 > hg parents
16 > restore
16 > restore
17 > }
17 > }
18
18
19 $ hg init test
19 $ hg init test
20 $ cd test
20 $ cd test
21
21
22 $ echo foo > bar
22 $ echo foo > bar
23 $ hg ci -Ama
23 $ hg ci -Ama
24 adding bar
24 adding bar
25
25
26 $ echo more >> bar
26 $ echo more >> bar
27 $ hg ci -Amb
27 $ hg ci -Amb
28
28
29 $ echo blah >> bar
29 $ echo blah >> bar
30 $ hg ci -Amc
30 $ hg ci -Amc
31
31
32 $ hg up 1
32 $ hg up 1
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ echo blah >> bar
34 $ echo blah >> bar
35 $ hg ci -Amd
35 $ hg ci -Amd
36 created new head
36 created new head
37
37
38 $ echo final >> bar
38 $ echo final >> bar
39 $ hg ci -Ame
39 $ hg ci -Ame
40
40
41 $ hg log
41 $ hg log
42 changeset: 4:443431ffac4f
42 changeset: 4:443431ffac4f
43 tag: tip
43 tag: tip
44 user: test
44 user: test
45 date: Thu Jan 01 00:00:00 1970 +0000
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: e
46 summary: e
47
47
48 changeset: 3:65bd5f99a4a3
48 changeset: 3:65bd5f99a4a3
49 parent: 1:ef3a871183d7
49 parent: 1:ef3a871183d7
50 user: test
50 user: test
51 date: Thu Jan 01 00:00:00 1970 +0000
51 date: Thu Jan 01 00:00:00 1970 +0000
52 summary: d
52 summary: d
53
53
54 changeset: 2:264128213d29
54 changeset: 2:264128213d29
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:00 1970 +0000
56 date: Thu Jan 01 00:00:00 1970 +0000
57 summary: c
57 summary: c
58
58
59 changeset: 1:ef3a871183d7
59 changeset: 1:ef3a871183d7
60 user: test
60 user: test
61 date: Thu Jan 01 00:00:00 1970 +0000
61 date: Thu Jan 01 00:00:00 1970 +0000
62 summary: b
62 summary: b
63
63
64 changeset: 0:9ab35a2d17cb
64 changeset: 0:9ab35a2d17cb
65 user: test
65 user: test
66 date: Thu Jan 01 00:00:00 1970 +0000
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: a
67 summary: a
68
68
69
69
70 $ teststrip 4 4
70 $ teststrip 4 4
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 % before update 4, strip 4
72 % before update 4, strip 4
73 changeset: 4:443431ffac4f
73 changeset: 4:443431ffac4f
74 tag: tip
74 tag: tip
75 user: test
75 user: test
76 date: Thu Jan 01 00:00:00 1970 +0000
76 date: Thu Jan 01 00:00:00 1970 +0000
77 summary: e
77 summary: e
78
78
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
80 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
81 % after update 4, strip 4
81 % after update 4, strip 4
82 changeset: 3:65bd5f99a4a3
82 changeset: 3:65bd5f99a4a3
83 tag: tip
83 tag: tip
84 parent: 1:ef3a871183d7
84 parent: 1:ef3a871183d7
85 user: test
85 user: test
86 date: Thu Jan 01 00:00:00 1970 +0000
86 date: Thu Jan 01 00:00:00 1970 +0000
87 summary: d
87 summary: d
88
88
89 $ teststrip 4 3
89 $ teststrip 4 3
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 % before update 4, strip 3
91 % before update 4, strip 3
92 changeset: 4:443431ffac4f
92 changeset: 4:443431ffac4f
93 tag: tip
93 tag: tip
94 user: test
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: e
96 summary: e
97
97
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
99 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
100 % after update 4, strip 3
100 % after update 4, strip 3
101 changeset: 1:ef3a871183d7
101 changeset: 1:ef3a871183d7
102 user: test
102 user: test
103 date: Thu Jan 01 00:00:00 1970 +0000
103 date: Thu Jan 01 00:00:00 1970 +0000
104 summary: b
104 summary: b
105
105
106 $ teststrip 1 4
106 $ teststrip 1 4
107 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 % before update 1, strip 4
108 % before update 1, strip 4
109 changeset: 1:ef3a871183d7
109 changeset: 1:ef3a871183d7
110 user: test
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: b
112 summary: b
113
113
114 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
114 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
115 % after update 1, strip 4
115 % after update 1, strip 4
116 changeset: 1:ef3a871183d7
116 changeset: 1:ef3a871183d7
117 user: test
117 user: test
118 date: Thu Jan 01 00:00:00 1970 +0000
118 date: Thu Jan 01 00:00:00 1970 +0000
119 summary: b
119 summary: b
120
120
121 $ teststrip 4 2
121 $ teststrip 4 2
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 % before update 4, strip 2
123 % before update 4, strip 2
124 changeset: 4:443431ffac4f
124 changeset: 4:443431ffac4f
125 tag: tip
125 tag: tip
126 user: test
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: e
128 summary: e
129
129
130 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
130 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
131 % after update 4, strip 2
131 % after update 4, strip 2
132 changeset: 3:443431ffac4f
132 changeset: 3:443431ffac4f
133 tag: tip
133 tag: tip
134 user: test
134 user: test
135 date: Thu Jan 01 00:00:00 1970 +0000
135 date: Thu Jan 01 00:00:00 1970 +0000
136 summary: e
136 summary: e
137
137
138 $ teststrip 4 1
138 $ teststrip 4 1
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 % before update 4, strip 1
140 % before update 4, strip 1
141 changeset: 4:264128213d29
141 changeset: 4:264128213d29
142 tag: tip
142 tag: tip
143 parent: 1:ef3a871183d7
143 parent: 1:ef3a871183d7
144 user: test
144 user: test
145 date: Thu Jan 01 00:00:00 1970 +0000
145 date: Thu Jan 01 00:00:00 1970 +0000
146 summary: c
146 summary: c
147
147
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
149 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
150 % after update 4, strip 1
150 % after update 4, strip 1
151 changeset: 0:9ab35a2d17cb
151 changeset: 0:9ab35a2d17cb
152 tag: tip
152 tag: tip
153 user: test
153 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
154 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: a
155 summary: a
156
156
157 $ teststrip null 4
157 $ teststrip null 4
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 % before update null, strip 4
159 % before update null, strip 4
160 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
160 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
161 % after update null, strip 4
161 % after update null, strip 4
162
162
163 $ hg log
163 $ hg log
164 changeset: 4:264128213d29
164 changeset: 4:264128213d29
165 tag: tip
165 tag: tip
166 parent: 1:ef3a871183d7
166 parent: 1:ef3a871183d7
167 user: test
167 user: test
168 date: Thu Jan 01 00:00:00 1970 +0000
168 date: Thu Jan 01 00:00:00 1970 +0000
169 summary: c
169 summary: c
170
170
171 changeset: 3:443431ffac4f
171 changeset: 3:443431ffac4f
172 user: test
172 user: test
173 date: Thu Jan 01 00:00:00 1970 +0000
173 date: Thu Jan 01 00:00:00 1970 +0000
174 summary: e
174 summary: e
175
175
176 changeset: 2:65bd5f99a4a3
176 changeset: 2:65bd5f99a4a3
177 user: test
177 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
178 date: Thu Jan 01 00:00:00 1970 +0000
179 summary: d
179 summary: d
180
180
181 changeset: 1:ef3a871183d7
181 changeset: 1:ef3a871183d7
182 user: test
182 user: test
183 date: Thu Jan 01 00:00:00 1970 +0000
183 date: Thu Jan 01 00:00:00 1970 +0000
184 summary: b
184 summary: b
185
185
186 changeset: 0:9ab35a2d17cb
186 changeset: 0:9ab35a2d17cb
187 user: test
187 user: test
188 date: Thu Jan 01 00:00:00 1970 +0000
188 date: Thu Jan 01 00:00:00 1970 +0000
189 summary: a
189 summary: a
190
190
191 $ hg up -C 4
191 $ hg up -C 4
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 $ hg parents
193 $ hg parents
194 changeset: 4:264128213d29
194 changeset: 4:264128213d29
195 tag: tip
195 tag: tip
196 parent: 1:ef3a871183d7
196 parent: 1:ef3a871183d7
197 user: test
197 user: test
198 date: Thu Jan 01 00:00:00 1970 +0000
198 date: Thu Jan 01 00:00:00 1970 +0000
199 summary: c
199 summary: c
200
200
201
201
202 $ hg --traceback strip 4
202 $ hg --traceback strip 4
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
204 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
205 $ hg parents
205 $ hg parents
206 changeset: 1:ef3a871183d7
206 changeset: 1:ef3a871183d7
207 user: test
207 user: test
208 date: Thu Jan 01 00:00:00 1970 +0000
208 date: Thu Jan 01 00:00:00 1970 +0000
209 summary: b
209 summary: b
210
210
211 $ hg debugbundle .hg/strip-backup/*
211 $ hg debugbundle .hg/strip-backup/*
212 Stream params: {Compression: BZ}
212 Stream params: {Compression: BZ}
213 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
213 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
214 264128213d290d868c54642d13aeaa3675551a78
214 264128213d290d868c54642d13aeaa3675551a78
215 cache:rev-branch-cache -- {} (mandatory: False)
215 cache:rev-branch-cache -- {} (mandatory: False)
216 phase-heads -- {} (mandatory: True)
216 phase-heads -- {} (mandatory: True)
217 264128213d290d868c54642d13aeaa3675551a78 draft
217 264128213d290d868c54642d13aeaa3675551a78 draft
218 $ hg unbundle .hg/strip-backup/*
218 $ hg unbundle .hg/strip-backup/*
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
222 added 1 changesets with 0 changes to 1 files (+1 heads)
222 added 1 changesets with 0 changes to 1 files (+1 heads)
223 new changesets 264128213d29 (1 drafts)
223 new changesets 264128213d29 (1 drafts)
224 (run 'hg heads' to see heads, 'hg merge' to merge)
224 (run 'hg heads' to see heads, 'hg merge' to merge)
225 $ rm .hg/strip-backup/*
225 $ rm .hg/strip-backup/*
226 $ hg log --graph
226 $ hg log --graph
227 o changeset: 4:264128213d29
227 o changeset: 4:264128213d29
228 | tag: tip
228 | tag: tip
229 | parent: 1:ef3a871183d7
229 | parent: 1:ef3a871183d7
230 | user: test
230 | user: test
231 | date: Thu Jan 01 00:00:00 1970 +0000
231 | date: Thu Jan 01 00:00:00 1970 +0000
232 | summary: c
232 | summary: c
233 |
233 |
234 | o changeset: 3:443431ffac4f
234 | o changeset: 3:443431ffac4f
235 | | user: test
235 | | user: test
236 | | date: Thu Jan 01 00:00:00 1970 +0000
236 | | date: Thu Jan 01 00:00:00 1970 +0000
237 | | summary: e
237 | | summary: e
238 | |
238 | |
239 | o changeset: 2:65bd5f99a4a3
239 | o changeset: 2:65bd5f99a4a3
240 |/ user: test
240 |/ user: test
241 | date: Thu Jan 01 00:00:00 1970 +0000
241 | date: Thu Jan 01 00:00:00 1970 +0000
242 | summary: d
242 | summary: d
243 |
243 |
244 @ changeset: 1:ef3a871183d7
244 @ changeset: 1:ef3a871183d7
245 | user: test
245 | user: test
246 | date: Thu Jan 01 00:00:00 1970 +0000
246 | date: Thu Jan 01 00:00:00 1970 +0000
247 | summary: b
247 | summary: b
248 |
248 |
249 o changeset: 0:9ab35a2d17cb
249 o changeset: 0:9ab35a2d17cb
250 user: test
250 user: test
251 date: Thu Jan 01 00:00:00 1970 +0000
251 date: Thu Jan 01 00:00:00 1970 +0000
252 summary: a
252 summary: a
253
253
254 $ hg up -C 2
254 $ hg up -C 2
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 $ hg merge 4
256 $ hg merge 4
257 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 (branch merge, don't forget to commit)
258 (branch merge, don't forget to commit)
259
259
260 before strip of merge parent
260 before strip of merge parent
261
261
262 $ hg parents
262 $ hg parents
263 changeset: 2:65bd5f99a4a3
263 changeset: 2:65bd5f99a4a3
264 user: test
264 user: test
265 date: Thu Jan 01 00:00:00 1970 +0000
265 date: Thu Jan 01 00:00:00 1970 +0000
266 summary: d
266 summary: d
267
267
268 changeset: 4:264128213d29
268 changeset: 4:264128213d29
269 tag: tip
269 tag: tip
270 parent: 1:ef3a871183d7
270 parent: 1:ef3a871183d7
271 user: test
271 user: test
272 date: Thu Jan 01 00:00:00 1970 +0000
272 date: Thu Jan 01 00:00:00 1970 +0000
273 summary: c
273 summary: c
274
274
275 ##strip not allowed with merge in progress
275 $ hg strip 4
276 $ hg strip 4
277 abort: outstanding uncommitted merge
278 [255]
279 ##strip allowed --force with merge in progress
280 $ hg strip 4 --force
276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
282 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
278
283
279 after strip of merge parent
284 after strip of merge parent
280
285
281 $ hg parents
286 $ hg parents
282 changeset: 1:ef3a871183d7
287 changeset: 1:ef3a871183d7
283 user: test
288 user: test
284 date: Thu Jan 01 00:00:00 1970 +0000
289 date: Thu Jan 01 00:00:00 1970 +0000
285 summary: b
290 summary: b
286
291
287 $ restore
292 $ restore
288
293
289 $ hg up
294 $ hg up
290 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 updated to "264128213d29: c"
296 updated to "264128213d29: c"
292 1 other heads for branch "default"
297 1 other heads for branch "default"
293 $ hg log -G
298 $ hg log -G
294 @ changeset: 4:264128213d29
299 @ changeset: 4:264128213d29
295 | tag: tip
300 | tag: tip
296 | parent: 1:ef3a871183d7
301 | parent: 1:ef3a871183d7
297 | user: test
302 | user: test
298 | date: Thu Jan 01 00:00:00 1970 +0000
303 | date: Thu Jan 01 00:00:00 1970 +0000
299 | summary: c
304 | summary: c
300 |
305 |
301 | o changeset: 3:443431ffac4f
306 | o changeset: 3:443431ffac4f
302 | | user: test
307 | | user: test
303 | | date: Thu Jan 01 00:00:00 1970 +0000
308 | | date: Thu Jan 01 00:00:00 1970 +0000
304 | | summary: e
309 | | summary: e
305 | |
310 | |
306 | o changeset: 2:65bd5f99a4a3
311 | o changeset: 2:65bd5f99a4a3
307 |/ user: test
312 |/ user: test
308 | date: Thu Jan 01 00:00:00 1970 +0000
313 | date: Thu Jan 01 00:00:00 1970 +0000
309 | summary: d
314 | summary: d
310 |
315 |
311 o changeset: 1:ef3a871183d7
316 o changeset: 1:ef3a871183d7
312 | user: test
317 | user: test
313 | date: Thu Jan 01 00:00:00 1970 +0000
318 | date: Thu Jan 01 00:00:00 1970 +0000
314 | summary: b
319 | summary: b
315 |
320 |
316 o changeset: 0:9ab35a2d17cb
321 o changeset: 0:9ab35a2d17cb
317 user: test
322 user: test
318 date: Thu Jan 01 00:00:00 1970 +0000
323 date: Thu Jan 01 00:00:00 1970 +0000
319 summary: a
324 summary: a
320
325
321
326
322 2 is parent of 3, only one strip should happen
327 2 is parent of 3, only one strip should happen
323
328
324 $ hg strip "roots(2)" 3
329 $ hg strip "roots(2)" 3
325 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
330 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
326 $ hg log -G
331 $ hg log -G
327 @ changeset: 2:264128213d29
332 @ changeset: 2:264128213d29
328 | tag: tip
333 | tag: tip
329 | user: test
334 | user: test
330 | date: Thu Jan 01 00:00:00 1970 +0000
335 | date: Thu Jan 01 00:00:00 1970 +0000
331 | summary: c
336 | summary: c
332 |
337 |
333 o changeset: 1:ef3a871183d7
338 o changeset: 1:ef3a871183d7
334 | user: test
339 | user: test
335 | date: Thu Jan 01 00:00:00 1970 +0000
340 | date: Thu Jan 01 00:00:00 1970 +0000
336 | summary: b
341 | summary: b
337 |
342 |
338 o changeset: 0:9ab35a2d17cb
343 o changeset: 0:9ab35a2d17cb
339 user: test
344 user: test
340 date: Thu Jan 01 00:00:00 1970 +0000
345 date: Thu Jan 01 00:00:00 1970 +0000
341 summary: a
346 summary: a
342
347
343 $ restore
348 $ restore
344 $ hg log -G
349 $ hg log -G
345 o changeset: 4:443431ffac4f
350 o changeset: 4:443431ffac4f
346 | tag: tip
351 | tag: tip
347 | user: test
352 | user: test
348 | date: Thu Jan 01 00:00:00 1970 +0000
353 | date: Thu Jan 01 00:00:00 1970 +0000
349 | summary: e
354 | summary: e
350 |
355 |
351 o changeset: 3:65bd5f99a4a3
356 o changeset: 3:65bd5f99a4a3
352 | parent: 1:ef3a871183d7
357 | parent: 1:ef3a871183d7
353 | user: test
358 | user: test
354 | date: Thu Jan 01 00:00:00 1970 +0000
359 | date: Thu Jan 01 00:00:00 1970 +0000
355 | summary: d
360 | summary: d
356 |
361 |
357 | @ changeset: 2:264128213d29
362 | @ changeset: 2:264128213d29
358 |/ user: test
363 |/ user: test
359 | date: Thu Jan 01 00:00:00 1970 +0000
364 | date: Thu Jan 01 00:00:00 1970 +0000
360 | summary: c
365 | summary: c
361 |
366 |
362 o changeset: 1:ef3a871183d7
367 o changeset: 1:ef3a871183d7
363 | user: test
368 | user: test
364 | date: Thu Jan 01 00:00:00 1970 +0000
369 | date: Thu Jan 01 00:00:00 1970 +0000
365 | summary: b
370 | summary: b
366 |
371 |
367 o changeset: 0:9ab35a2d17cb
372 o changeset: 0:9ab35a2d17cb
368 user: test
373 user: test
369 date: Thu Jan 01 00:00:00 1970 +0000
374 date: Thu Jan 01 00:00:00 1970 +0000
370 summary: a
375 summary: a
371
376
372 Failed hook while applying "saveheads" bundle.
377 Failed hook while applying "saveheads" bundle.
373
378
374 $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
379 $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
375 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
381 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
377 transaction abort!
382 transaction abort!
378 rollback completed
383 rollback completed
379 strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
384 strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
380 strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
385 strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
381 (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
386 (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
382 abort: pretxnchangegroup.bad hook exited with status 1
387 abort: pretxnchangegroup.bad hook exited with status 1
383 [255]
388 [255]
384 $ restore
389 $ restore
385 $ hg log -G
390 $ hg log -G
386 o changeset: 4:443431ffac4f
391 o changeset: 4:443431ffac4f
387 | tag: tip
392 | tag: tip
388 | user: test
393 | user: test
389 | date: Thu Jan 01 00:00:00 1970 +0000
394 | date: Thu Jan 01 00:00:00 1970 +0000
390 | summary: e
395 | summary: e
391 |
396 |
392 o changeset: 3:65bd5f99a4a3
397 o changeset: 3:65bd5f99a4a3
393 | parent: 1:ef3a871183d7
398 | parent: 1:ef3a871183d7
394 | user: test
399 | user: test
395 | date: Thu Jan 01 00:00:00 1970 +0000
400 | date: Thu Jan 01 00:00:00 1970 +0000
396 | summary: d
401 | summary: d
397 |
402 |
398 | o changeset: 2:264128213d29
403 | o changeset: 2:264128213d29
399 |/ user: test
404 |/ user: test
400 | date: Thu Jan 01 00:00:00 1970 +0000
405 | date: Thu Jan 01 00:00:00 1970 +0000
401 | summary: c
406 | summary: c
402 |
407 |
403 @ changeset: 1:ef3a871183d7
408 @ changeset: 1:ef3a871183d7
404 | user: test
409 | user: test
405 | date: Thu Jan 01 00:00:00 1970 +0000
410 | date: Thu Jan 01 00:00:00 1970 +0000
406 | summary: b
411 | summary: b
407 |
412 |
408 o changeset: 0:9ab35a2d17cb
413 o changeset: 0:9ab35a2d17cb
409 user: test
414 user: test
410 date: Thu Jan 01 00:00:00 1970 +0000
415 date: Thu Jan 01 00:00:00 1970 +0000
411 summary: a
416 summary: a
412
417
413
418
414 2 different branches: 2 strips
419 2 different branches: 2 strips
415
420
416 $ hg strip 2 4
421 $ hg strip 2 4
417 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
422 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
418 $ hg log -G
423 $ hg log -G
419 o changeset: 2:65bd5f99a4a3
424 o changeset: 2:65bd5f99a4a3
420 | tag: tip
425 | tag: tip
421 | user: test
426 | user: test
422 | date: Thu Jan 01 00:00:00 1970 +0000
427 | date: Thu Jan 01 00:00:00 1970 +0000
423 | summary: d
428 | summary: d
424 |
429 |
425 @ changeset: 1:ef3a871183d7
430 @ changeset: 1:ef3a871183d7
426 | user: test
431 | user: test
427 | date: Thu Jan 01 00:00:00 1970 +0000
432 | date: Thu Jan 01 00:00:00 1970 +0000
428 | summary: b
433 | summary: b
429 |
434 |
430 o changeset: 0:9ab35a2d17cb
435 o changeset: 0:9ab35a2d17cb
431 user: test
436 user: test
432 date: Thu Jan 01 00:00:00 1970 +0000
437 date: Thu Jan 01 00:00:00 1970 +0000
433 summary: a
438 summary: a
434
439
435 $ restore
440 $ restore
436
441
437 2 different branches and a common ancestor: 1 strip
442 2 different branches and a common ancestor: 1 strip
438
443
439 $ hg strip 1 "2|4"
444 $ hg strip 1 "2|4"
440 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
446 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
442 $ restore
447 $ restore
443
448
444 verify fncache is kept up-to-date
449 verify fncache is kept up-to-date
445
450
446 $ touch a
451 $ touch a
447 $ hg ci -qAm a
452 $ hg ci -qAm a
448 #if repofncache
453 #if repofncache
449 $ cat .hg/store/fncache | sort
454 $ cat .hg/store/fncache | sort
450 data/a.i
455 data/a.i
451 data/bar.i
456 data/bar.i
452 #endif
457 #endif
453
458
454 $ hg strip tip
459 $ hg strip tip
455 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
460 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
456 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
461 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
457 #if repofncache
462 #if repofncache
458 $ cat .hg/store/fncache
463 $ cat .hg/store/fncache
459 data/bar.i
464 data/bar.i
460 #endif
465 #endif
461
466
462 stripping an empty revset
467 stripping an empty revset
463
468
464 $ hg strip "1 and not 1"
469 $ hg strip "1 and not 1"
465 abort: empty revision set
470 abort: empty revision set
466 [255]
471 [255]
467
472
468 remove branchy history for qimport tests
473 remove branchy history for qimport tests
469
474
470 $ hg strip 3
475 $ hg strip 3
471 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
476 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
472
477
473
478
474 strip of applied mq should cleanup status file
479 strip of applied mq should cleanup status file
475
480
476 $ echo "mq=" >> $HGRCPATH
481 $ echo "mq=" >> $HGRCPATH
477 $ hg up -C 3
482 $ hg up -C 3
478 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
479 $ echo fooagain >> bar
484 $ echo fooagain >> bar
480 $ hg ci -mf
485 $ hg ci -mf
481 $ hg qimport -r tip:2
486 $ hg qimport -r tip:2
482
487
483 applied patches before strip
488 applied patches before strip
484
489
485 $ hg qapplied
490 $ hg qapplied
486 d
491 d
487 e
492 e
488 f
493 f
489
494
490 stripping revision in queue
495 stripping revision in queue
491
496
492 $ hg strip 3
497 $ hg strip 3
493 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
494 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
499 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
495
500
496 applied patches after stripping rev in queue
501 applied patches after stripping rev in queue
497
502
498 $ hg qapplied
503 $ hg qapplied
499 d
504 d
500
505
501 stripping ancestor of queue
506 stripping ancestor of queue
502
507
503 $ hg strip 1
508 $ hg strip 1
504 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
509 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
505 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
510 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
506
511
507 applied patches after stripping ancestor of queue
512 applied patches after stripping ancestor of queue
508
513
509 $ hg qapplied
514 $ hg qapplied
510
515
511 Verify strip protects against stripping wc parent when there are uncommitted mods
516 Verify strip protects against stripping wc parent when there are uncommitted mods
512
517
513 $ echo b > b
518 $ echo b > b
514 $ echo bb > bar
519 $ echo bb > bar
515 $ hg add b
520 $ hg add b
516 $ hg ci -m 'b'
521 $ hg ci -m 'b'
517 $ hg log --graph
522 $ hg log --graph
518 @ changeset: 1:76dcf9fab855
523 @ changeset: 1:76dcf9fab855
519 | tag: tip
524 | tag: tip
520 | user: test
525 | user: test
521 | date: Thu Jan 01 00:00:00 1970 +0000
526 | date: Thu Jan 01 00:00:00 1970 +0000
522 | summary: b
527 | summary: b
523 |
528 |
524 o changeset: 0:9ab35a2d17cb
529 o changeset: 0:9ab35a2d17cb
525 user: test
530 user: test
526 date: Thu Jan 01 00:00:00 1970 +0000
531 date: Thu Jan 01 00:00:00 1970 +0000
527 summary: a
532 summary: a
528
533
529 $ hg up 0
534 $ hg up 0
530 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
535 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
531 $ echo c > bar
536 $ echo c > bar
532 $ hg up -t false
537 $ hg up -t false
533 merging bar
538 merging bar
534 merging bar failed!
539 merging bar failed!
535 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
540 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
536 use 'hg resolve' to retry unresolved file merges
541 use 'hg resolve' to retry unresolved file merges
537 [1]
542 [1]
538 $ hg sum
543 $ hg sum
539 parent: 1:76dcf9fab855 tip
544 parent: 1:76dcf9fab855 tip
540 b
545 b
541 branch: default
546 branch: default
542 commit: 1 modified, 1 unknown, 1 unresolved
547 commit: 1 modified, 1 unknown, 1 unresolved
543 update: (current)
548 update: (current)
544 phases: 2 draft
549 phases: 2 draft
545 mq: 3 unapplied
550 mq: 3 unapplied
546
551
547 $ echo c > b
552 $ echo c > b
548 $ hg strip tip
553 $ hg strip tip
549 abort: local changes found
554 abort: local changes found
550 [255]
555 [255]
551 $ hg strip tip --keep
556 $ hg strip tip --keep
552 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
557 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
553 $ hg log --graph
558 $ hg log --graph
554 @ changeset: 0:9ab35a2d17cb
559 @ changeset: 0:9ab35a2d17cb
555 tag: tip
560 tag: tip
556 user: test
561 user: test
557 date: Thu Jan 01 00:00:00 1970 +0000
562 date: Thu Jan 01 00:00:00 1970 +0000
558 summary: a
563 summary: a
559
564
560 $ hg status
565 $ hg status
561 M bar
566 M bar
562 ? b
567 ? b
563 ? bar.orig
568 ? bar.orig
564
569
565 $ rm bar.orig
570 $ rm bar.orig
566 $ hg sum
571 $ hg sum
567 parent: 0:9ab35a2d17cb tip
572 parent: 0:9ab35a2d17cb tip
568 a
573 a
569 branch: default
574 branch: default
570 commit: 1 modified, 1 unknown
575 commit: 1 modified, 1 unknown
571 update: (current)
576 update: (current)
572 phases: 1 draft
577 phases: 1 draft
573 mq: 3 unapplied
578 mq: 3 unapplied
574
579
575 Strip adds, removes, modifies with --keep
580 Strip adds, removes, modifies with --keep
576
581
577 $ touch b
582 $ touch b
578 $ hg add b
583 $ hg add b
579 $ hg commit -mb
584 $ hg commit -mb
580 $ touch c
585 $ touch c
581
586
582 ... with a clean working dir
587 ... with a clean working dir
583
588
584 $ hg add c
589 $ hg add c
585 $ hg rm bar
590 $ hg rm bar
586 $ hg commit -mc
591 $ hg commit -mc
587 $ hg status
592 $ hg status
588 $ hg strip --keep tip
593 $ hg strip --keep tip
589 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
594 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
590 $ hg status
595 $ hg status
591 ! bar
596 ! bar
592 ? c
597 ? c
593
598
594 ... with a dirty working dir
599 ... with a dirty working dir
595
600
596 $ hg add c
601 $ hg add c
597 $ hg rm bar
602 $ hg rm bar
598 $ hg commit -mc
603 $ hg commit -mc
599 $ hg status
604 $ hg status
600 $ echo b > b
605 $ echo b > b
601 $ echo d > d
606 $ echo d > d
602 $ hg strip --keep tip
607 $ hg strip --keep tip
603 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
608 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
604 $ hg status
609 $ hg status
605 M b
610 M b
606 ! bar
611 ! bar
607 ? c
612 ? c
608 ? d
613 ? d
609
614
610 ... after updating the dirstate
615 ... after updating the dirstate
611 $ hg add c
616 $ hg add c
612 $ hg commit -mc
617 $ hg commit -mc
613 $ hg rm c
618 $ hg rm c
614 $ hg commit -mc
619 $ hg commit -mc
615 $ hg strip --keep '.^' -q
620 $ hg strip --keep '.^' -q
616 $ cd ..
621 $ cd ..
617
622
618 stripping many nodes on a complex graph (issue3299)
623 stripping many nodes on a complex graph (issue3299)
619
624
620 $ hg init issue3299
625 $ hg init issue3299
621 $ cd issue3299
626 $ cd issue3299
622 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
627 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
623 $ hg strip 'not ancestors(x)'
628 $ hg strip 'not ancestors(x)'
624 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
629 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
625
630
626 test hg strip -B bookmark
631 test hg strip -B bookmark
627
632
628 $ cd ..
633 $ cd ..
629 $ hg init bookmarks
634 $ hg init bookmarks
630 $ cd bookmarks
635 $ cd bookmarks
631 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
636 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
632 $ hg bookmark -r 'a' 'todelete'
637 $ hg bookmark -r 'a' 'todelete'
633 $ hg bookmark -r 'b' 'B'
638 $ hg bookmark -r 'b' 'B'
634 $ hg bookmark -r 'b' 'nostrip'
639 $ hg bookmark -r 'b' 'nostrip'
635 $ hg bookmark -r 'c' 'delete'
640 $ hg bookmark -r 'c' 'delete'
636 $ hg bookmark -r 'd' 'multipledelete1'
641 $ hg bookmark -r 'd' 'multipledelete1'
637 $ hg bookmark -r 'e' 'multipledelete2'
642 $ hg bookmark -r 'e' 'multipledelete2'
638 $ hg bookmark -r 'f' 'singlenode1'
643 $ hg bookmark -r 'f' 'singlenode1'
639 $ hg bookmark -r 'f' 'singlenode2'
644 $ hg bookmark -r 'f' 'singlenode2'
640 $ hg up -C todelete
645 $ hg up -C todelete
641 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
642 (activating bookmark todelete)
647 (activating bookmark todelete)
643 $ hg strip -B nostrip
648 $ hg strip -B nostrip
644 bookmark 'nostrip' deleted
649 bookmark 'nostrip' deleted
645 abort: empty revision set
650 abort: empty revision set
646 [255]
651 [255]
647 $ hg strip -B todelete
652 $ hg strip -B todelete
648 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
653 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
649 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
654 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
650 bookmark 'todelete' deleted
655 bookmark 'todelete' deleted
651 $ hg id -ir dcbb326fdec2
656 $ hg id -ir dcbb326fdec2
652 abort: unknown revision 'dcbb326fdec2'!
657 abort: unknown revision 'dcbb326fdec2'!
653 [255]
658 [255]
654 $ hg id -ir d62d843c9a01
659 $ hg id -ir d62d843c9a01
655 d62d843c9a01
660 d62d843c9a01
656 $ hg bookmarks
661 $ hg bookmarks
657 B 9:ff43616e5d0f
662 B 9:ff43616e5d0f
658 delete 6:2702dd0c91e7
663 delete 6:2702dd0c91e7
659 multipledelete1 11:e46a4836065c
664 multipledelete1 11:e46a4836065c
660 multipledelete2 12:b4594d867745
665 multipledelete2 12:b4594d867745
661 singlenode1 13:43227190fef8
666 singlenode1 13:43227190fef8
662 singlenode2 13:43227190fef8
667 singlenode2 13:43227190fef8
663 $ hg strip -B multipledelete1 -B multipledelete2
668 $ hg strip -B multipledelete1 -B multipledelete2
664 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
669 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
665 bookmark 'multipledelete1' deleted
670 bookmark 'multipledelete1' deleted
666 bookmark 'multipledelete2' deleted
671 bookmark 'multipledelete2' deleted
667 $ hg id -ir e46a4836065c
672 $ hg id -ir e46a4836065c
668 abort: unknown revision 'e46a4836065c'!
673 abort: unknown revision 'e46a4836065c'!
669 [255]
674 [255]
670 $ hg id -ir b4594d867745
675 $ hg id -ir b4594d867745
671 abort: unknown revision 'b4594d867745'!
676 abort: unknown revision 'b4594d867745'!
672 [255]
677 [255]
673 $ hg strip -B singlenode1 -B singlenode2
678 $ hg strip -B singlenode1 -B singlenode2
674 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
679 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
675 bookmark 'singlenode1' deleted
680 bookmark 'singlenode1' deleted
676 bookmark 'singlenode2' deleted
681 bookmark 'singlenode2' deleted
677 $ hg id -ir 43227190fef8
682 $ hg id -ir 43227190fef8
678 abort: unknown revision '43227190fef8'!
683 abort: unknown revision '43227190fef8'!
679 [255]
684 [255]
680 $ hg strip -B unknownbookmark
685 $ hg strip -B unknownbookmark
681 abort: bookmark 'unknownbookmark' not found
686 abort: bookmark 'unknownbookmark' not found
682 [255]
687 [255]
683 $ hg strip -B unknownbookmark1 -B unknownbookmark2
688 $ hg strip -B unknownbookmark1 -B unknownbookmark2
684 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
689 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
685 [255]
690 [255]
686 $ hg strip -B delete -B unknownbookmark
691 $ hg strip -B delete -B unknownbookmark
687 abort: bookmark 'unknownbookmark' not found
692 abort: bookmark 'unknownbookmark' not found
688 [255]
693 [255]
689 $ hg strip -B delete
694 $ hg strip -B delete
690 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
695 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
691 bookmark 'delete' deleted
696 bookmark 'delete' deleted
692 $ hg id -ir 6:2702dd0c91e7
697 $ hg id -ir 6:2702dd0c91e7
693 abort: unknown revision '2702dd0c91e7'!
698 abort: unknown revision '2702dd0c91e7'!
694 [255]
699 [255]
695 $ hg update B
700 $ hg update B
696 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
701 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
697 (activating bookmark B)
702 (activating bookmark B)
698 $ echo a > a
703 $ echo a > a
699 $ hg add a
704 $ hg add a
700 $ hg strip -B B
705 $ hg strip -B B
701 abort: local changes found
706 abort: local changes found
702 [255]
707 [255]
703 $ hg bookmarks
708 $ hg bookmarks
704 * B 6:ff43616e5d0f
709 * B 6:ff43616e5d0f
705
710
706 Make sure no one adds back a -b option:
711 Make sure no one adds back a -b option:
707
712
708 $ hg strip -b tip
713 $ hg strip -b tip
709 hg strip: option -b not recognized
714 hg strip: option -b not recognized
710 hg strip [-k] [-f] [-B bookmark] [-r] REV...
715 hg strip [-k] [-f] [-B bookmark] [-r] REV...
711
716
712 strip changesets and all their descendants from the repository
717 strip changesets and all their descendants from the repository
713
718
714 (use 'hg help -e strip' to show help for the strip extension)
719 (use 'hg help -e strip' to show help for the strip extension)
715
720
716 options ([+] can be repeated):
721 options ([+] can be repeated):
717
722
718 -r --rev REV [+] strip specified revision (optional, can specify
723 -r --rev REV [+] strip specified revision (optional, can specify
719 revisions without this option)
724 revisions without this option)
720 -f --force force removal of changesets, discard uncommitted
725 -f --force force removal of changesets, discard uncommitted
721 changes (no backup)
726 changes (no backup)
722 --no-backup do not save backup bundle
727 --no-backup do not save backup bundle
723 -k --keep do not modify working directory during strip
728 -k --keep do not modify working directory during strip
724 -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
729 -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
725 --mq operate on patch repository
730 --mq operate on patch repository
726
731
727 (use 'hg strip -h' to show more help)
732 (use 'hg strip -h' to show more help)
728 [255]
733 [255]
729
734
730 $ cd ..
735 $ cd ..
731
736
732 Verify bundles don't get overwritten:
737 Verify bundles don't get overwritten:
733
738
734 $ hg init doublebundle
739 $ hg init doublebundle
735 $ cd doublebundle
740 $ cd doublebundle
736 $ touch a
741 $ touch a
737 $ hg commit -Aqm a
742 $ hg commit -Aqm a
738 $ touch b
743 $ touch b
739 $ hg commit -Aqm b
744 $ hg commit -Aqm b
740 $ hg strip -r 0
745 $ hg strip -r 0
741 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
746 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
742 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
747 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
743 $ ls .hg/strip-backup
748 $ ls .hg/strip-backup
744 3903775176ed-e68910bd-backup.hg
749 3903775176ed-e68910bd-backup.hg
745 #if repobundlerepo
750 #if repobundlerepo
746 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
751 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
747 $ hg strip -r 0
752 $ hg strip -r 0
748 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
753 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
749 $ ls .hg/strip-backup
754 $ ls .hg/strip-backup
750 3903775176ed-54390173-backup.hg
755 3903775176ed-54390173-backup.hg
751 3903775176ed-e68910bd-backup.hg
756 3903775176ed-e68910bd-backup.hg
752 #endif
757 #endif
753 $ cd ..
758 $ cd ..
754
759
755 Test that we only bundle the stripped changesets (issue4736)
760 Test that we only bundle the stripped changesets (issue4736)
756 ------------------------------------------------------------
761 ------------------------------------------------------------
757
762
758 initialization (previous repo is empty anyway)
763 initialization (previous repo is empty anyway)
759
764
760 $ hg init issue4736
765 $ hg init issue4736
761 $ cd issue4736
766 $ cd issue4736
762 $ echo a > a
767 $ echo a > a
763 $ hg add a
768 $ hg add a
764 $ hg commit -m commitA
769 $ hg commit -m commitA
765 $ echo b > b
770 $ echo b > b
766 $ hg add b
771 $ hg add b
767 $ hg commit -m commitB
772 $ hg commit -m commitB
768 $ echo c > c
773 $ echo c > c
769 $ hg add c
774 $ hg add c
770 $ hg commit -m commitC
775 $ hg commit -m commitC
771 $ hg up 'desc(commitB)'
776 $ hg up 'desc(commitB)'
772 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
777 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
773 $ echo d > d
778 $ echo d > d
774 $ hg add d
779 $ hg add d
775 $ hg commit -m commitD
780 $ hg commit -m commitD
776 created new head
781 created new head
777 $ hg up 'desc(commitC)'
782 $ hg up 'desc(commitC)'
778 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
783 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
779 $ hg merge 'desc(commitD)'
784 $ hg merge 'desc(commitD)'
780 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
785 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
781 (branch merge, don't forget to commit)
786 (branch merge, don't forget to commit)
782 $ hg ci -m 'mergeCD'
787 $ hg ci -m 'mergeCD'
783 $ hg log -G
788 $ hg log -G
784 @ changeset: 4:d8db9d137221
789 @ changeset: 4:d8db9d137221
785 |\ tag: tip
790 |\ tag: tip
786 | | parent: 2:5c51d8d6557d
791 | | parent: 2:5c51d8d6557d
787 | | parent: 3:6625a5168474
792 | | parent: 3:6625a5168474
788 | | user: test
793 | | user: test
789 | | date: Thu Jan 01 00:00:00 1970 +0000
794 | | date: Thu Jan 01 00:00:00 1970 +0000
790 | | summary: mergeCD
795 | | summary: mergeCD
791 | |
796 | |
792 | o changeset: 3:6625a5168474
797 | o changeset: 3:6625a5168474
793 | | parent: 1:eca11cf91c71
798 | | parent: 1:eca11cf91c71
794 | | user: test
799 | | user: test
795 | | date: Thu Jan 01 00:00:00 1970 +0000
800 | | date: Thu Jan 01 00:00:00 1970 +0000
796 | | summary: commitD
801 | | summary: commitD
797 | |
802 | |
798 o | changeset: 2:5c51d8d6557d
803 o | changeset: 2:5c51d8d6557d
799 |/ user: test
804 |/ user: test
800 | date: Thu Jan 01 00:00:00 1970 +0000
805 | date: Thu Jan 01 00:00:00 1970 +0000
801 | summary: commitC
806 | summary: commitC
802 |
807 |
803 o changeset: 1:eca11cf91c71
808 o changeset: 1:eca11cf91c71
804 | user: test
809 | user: test
805 | date: Thu Jan 01 00:00:00 1970 +0000
810 | date: Thu Jan 01 00:00:00 1970 +0000
806 | summary: commitB
811 | summary: commitB
807 |
812 |
808 o changeset: 0:105141ef12d0
813 o changeset: 0:105141ef12d0
809 user: test
814 user: test
810 date: Thu Jan 01 00:00:00 1970 +0000
815 date: Thu Jan 01 00:00:00 1970 +0000
811 summary: commitA
816 summary: commitA
812
817
813
818
814 Check bundle behavior:
819 Check bundle behavior:
815
820
816 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
821 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
817 2 changesets found
822 2 changesets found
818 #if repobundlerepo
823 #if repobundlerepo
819 $ hg log -r 'bundle()' -R ../issue4736.hg
824 $ hg log -r 'bundle()' -R ../issue4736.hg
820 changeset: 3:6625a5168474
825 changeset: 3:6625a5168474
821 parent: 1:eca11cf91c71
826 parent: 1:eca11cf91c71
822 user: test
827 user: test
823 date: Thu Jan 01 00:00:00 1970 +0000
828 date: Thu Jan 01 00:00:00 1970 +0000
824 summary: commitD
829 summary: commitD
825
830
826 changeset: 4:d8db9d137221
831 changeset: 4:d8db9d137221
827 tag: tip
832 tag: tip
828 parent: 2:5c51d8d6557d
833 parent: 2:5c51d8d6557d
829 parent: 3:6625a5168474
834 parent: 3:6625a5168474
830 user: test
835 user: test
831 date: Thu Jan 01 00:00:00 1970 +0000
836 date: Thu Jan 01 00:00:00 1970 +0000
832 summary: mergeCD
837 summary: mergeCD
833
838
834 #endif
839 #endif
835
840
836 check strip behavior
841 check strip behavior
837
842
838 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
843 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
839 resolving manifests
844 resolving manifests
840 branchmerge: False, force: True, partial: False
845 branchmerge: False, force: True, partial: False
841 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
846 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
842 c: other deleted -> r
847 c: other deleted -> r
843 removing c
848 removing c
844 d: other deleted -> r
849 d: other deleted -> r
845 removing d
850 removing d
846 starting 4 threads for background file closing (?)
851 starting 4 threads for background file closing (?)
847 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
852 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
848 2 changesets found
853 2 changesets found
849 list of changesets:
854 list of changesets:
850 6625a516847449b6f0fa3737b9ba56e9f0f3032c
855 6625a516847449b6f0fa3737b9ba56e9f0f3032c
851 d8db9d1372214336d2b5570f20ee468d2c72fa8b
856 d8db9d1372214336d2b5570f20ee468d2c72fa8b
852 bundle2-output-bundle: "HG20", (1 params) 3 parts total
857 bundle2-output-bundle: "HG20", (1 params) 3 parts total
853 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
858 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
854 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
859 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
855 bundle2-output-part: "phase-heads" 24 bytes payload
860 bundle2-output-part: "phase-heads" 24 bytes payload
856 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
861 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
857 updating the branch cache
862 updating the branch cache
858 invalid branchheads cache (served): tip differs
863 invalid branchheads cache (served): tip differs
859 $ hg log -G
864 $ hg log -G
860 o changeset: 2:5c51d8d6557d
865 o changeset: 2:5c51d8d6557d
861 | tag: tip
866 | tag: tip
862 | user: test
867 | user: test
863 | date: Thu Jan 01 00:00:00 1970 +0000
868 | date: Thu Jan 01 00:00:00 1970 +0000
864 | summary: commitC
869 | summary: commitC
865 |
870 |
866 @ changeset: 1:eca11cf91c71
871 @ changeset: 1:eca11cf91c71
867 | user: test
872 | user: test
868 | date: Thu Jan 01 00:00:00 1970 +0000
873 | date: Thu Jan 01 00:00:00 1970 +0000
869 | summary: commitB
874 | summary: commitB
870 |
875 |
871 o changeset: 0:105141ef12d0
876 o changeset: 0:105141ef12d0
872 user: test
877 user: test
873 date: Thu Jan 01 00:00:00 1970 +0000
878 date: Thu Jan 01 00:00:00 1970 +0000
874 summary: commitA
879 summary: commitA
875
880
876
881
877 strip backup content
882 strip backup content
878
883
879 #if repobundlerepo
884 #if repobundlerepo
880 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
885 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
881 changeset: 3:6625a5168474
886 changeset: 3:6625a5168474
882 parent: 1:eca11cf91c71
887 parent: 1:eca11cf91c71
883 user: test
888 user: test
884 date: Thu Jan 01 00:00:00 1970 +0000
889 date: Thu Jan 01 00:00:00 1970 +0000
885 summary: commitD
890 summary: commitD
886
891
887 changeset: 4:d8db9d137221
892 changeset: 4:d8db9d137221
888 tag: tip
893 tag: tip
889 parent: 2:5c51d8d6557d
894 parent: 2:5c51d8d6557d
890 parent: 3:6625a5168474
895 parent: 3:6625a5168474
891 user: test
896 user: test
892 date: Thu Jan 01 00:00:00 1970 +0000
897 date: Thu Jan 01 00:00:00 1970 +0000
893 summary: mergeCD
898 summary: mergeCD
894
899
895
900
896 #endif
901 #endif
897
902
898 Check that the phase cache is properly invalidated after a strip with bookmark.
903 Check that the phase cache is properly invalidated after a strip with bookmark.
899
904
900 $ cat > ../stripstalephasecache.py << EOF
905 $ cat > ../stripstalephasecache.py << EOF
901 > from mercurial import extensions, localrepo
906 > from mercurial import extensions, localrepo
902 > def transactioncallback(orig, repo, desc, *args, **kwargs):
907 > def transactioncallback(orig, repo, desc, *args, **kwargs):
903 > def test(transaction):
908 > def test(transaction):
904 > # observe cache inconsistency
909 > # observe cache inconsistency
905 > try:
910 > try:
906 > [repo.changelog.node(r) for r in repo.revs(b"not public()")]
911 > [repo.changelog.node(r) for r in repo.revs(b"not public()")]
907 > except IndexError:
912 > except IndexError:
908 > repo.ui.status(b"Index error!\n")
913 > repo.ui.status(b"Index error!\n")
909 > transaction = orig(repo, desc, *args, **kwargs)
914 > transaction = orig(repo, desc, *args, **kwargs)
910 > # warm up the phase cache
915 > # warm up the phase cache
911 > list(repo.revs(b"not public()"))
916 > list(repo.revs(b"not public()"))
912 > if desc != b'strip':
917 > if desc != b'strip':
913 > transaction.addpostclose(b"phase invalidation test", test)
918 > transaction.addpostclose(b"phase invalidation test", test)
914 > return transaction
919 > return transaction
915 > def extsetup(ui):
920 > def extsetup(ui):
916 > extensions.wrapfunction(localrepo.localrepository, b"transaction",
921 > extensions.wrapfunction(localrepo.localrepository, b"transaction",
917 > transactioncallback)
922 > transactioncallback)
918 > EOF
923 > EOF
919 $ hg up -C 2
924 $ hg up -C 2
920 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
925 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
921 $ echo k > k
926 $ echo k > k
922 $ hg add k
927 $ hg add k
923 $ hg commit -m commitK
928 $ hg commit -m commitK
924 $ echo l > l
929 $ echo l > l
925 $ hg add l
930 $ hg add l
926 $ hg commit -m commitL
931 $ hg commit -m commitL
927 $ hg book -r tip blah
932 $ hg book -r tip blah
928 $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
933 $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
929 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
934 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
930 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
935 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
931 $ hg up -C 1
936 $ hg up -C 1
932 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
937 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
933
938
934 Error during post-close callback of the strip transaction
939 Error during post-close callback of the strip transaction
935 (They should be gracefully handled and reported)
940 (They should be gracefully handled and reported)
936
941
937 $ cat > ../crashstrip.py << EOF
942 $ cat > ../crashstrip.py << EOF
938 > from mercurial import error
943 > from mercurial import error
939 > def reposetup(ui, repo):
944 > def reposetup(ui, repo):
940 > class crashstriprepo(repo.__class__):
945 > class crashstriprepo(repo.__class__):
941 > def transaction(self, desc, *args, **kwargs):
946 > def transaction(self, desc, *args, **kwargs):
942 > tr = super(crashstriprepo, self).transaction(desc, *args, **kwargs)
947 > tr = super(crashstriprepo, self).transaction(desc, *args, **kwargs)
943 > if desc == b'strip':
948 > if desc == b'strip':
944 > def crash(tra): raise error.Abort(b'boom')
949 > def crash(tra): raise error.Abort(b'boom')
945 > tr.addpostclose(b'crash', crash)
950 > tr.addpostclose(b'crash', crash)
946 > return tr
951 > return tr
947 > repo.__class__ = crashstriprepo
952 > repo.__class__ = crashstriprepo
948 > EOF
953 > EOF
949 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
954 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
950 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
955 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
951 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
956 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
952 abort: boom
957 abort: boom
953 [255]
958 [255]
954
959
955 test stripping a working directory parent doesn't switch named branches
960 test stripping a working directory parent doesn't switch named branches
956
961
957 $ hg log -G
962 $ hg log -G
958 @ changeset: 1:eca11cf91c71
963 @ changeset: 1:eca11cf91c71
959 | tag: tip
964 | tag: tip
960 | user: test
965 | user: test
961 | date: Thu Jan 01 00:00:00 1970 +0000
966 | date: Thu Jan 01 00:00:00 1970 +0000
962 | summary: commitB
967 | summary: commitB
963 |
968 |
964 o changeset: 0:105141ef12d0
969 o changeset: 0:105141ef12d0
965 user: test
970 user: test
966 date: Thu Jan 01 00:00:00 1970 +0000
971 date: Thu Jan 01 00:00:00 1970 +0000
967 summary: commitA
972 summary: commitA
968
973
969
974
970 $ hg branch new-branch
975 $ hg branch new-branch
971 marked working directory as branch new-branch
976 marked working directory as branch new-branch
972 (branches are permanent and global, did you want a bookmark?)
977 (branches are permanent and global, did you want a bookmark?)
973 $ hg ci -m "start new branch"
978 $ hg ci -m "start new branch"
974 $ echo 'foo' > foo.txt
979 $ echo 'foo' > foo.txt
975 $ hg ci -Aqm foo
980 $ hg ci -Aqm foo
976 $ hg up default
981 $ hg up default
977 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
982 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
978 $ echo 'bar' > bar.txt
983 $ echo 'bar' > bar.txt
979 $ hg ci -Aqm bar
984 $ hg ci -Aqm bar
980 $ hg up new-branch
985 $ hg up new-branch
981 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
986 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
982 $ hg merge default
987 $ hg merge default
983 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
988 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
984 (branch merge, don't forget to commit)
989 (branch merge, don't forget to commit)
985 $ hg log -G
990 $ hg log -G
986 @ changeset: 4:35358f982181
991 @ changeset: 4:35358f982181
987 | tag: tip
992 | tag: tip
988 | parent: 1:eca11cf91c71
993 | parent: 1:eca11cf91c71
989 | user: test
994 | user: test
990 | date: Thu Jan 01 00:00:00 1970 +0000
995 | date: Thu Jan 01 00:00:00 1970 +0000
991 | summary: bar
996 | summary: bar
992 |
997 |
993 | @ changeset: 3:f62c6c09b707
998 | @ changeset: 3:f62c6c09b707
994 | | branch: new-branch
999 | | branch: new-branch
995 | | user: test
1000 | | user: test
996 | | date: Thu Jan 01 00:00:00 1970 +0000
1001 | | date: Thu Jan 01 00:00:00 1970 +0000
997 | | summary: foo
1002 | | summary: foo
998 | |
1003 | |
999 | o changeset: 2:b1d33a8cadd9
1004 | o changeset: 2:b1d33a8cadd9
1000 |/ branch: new-branch
1005 |/ branch: new-branch
1001 | user: test
1006 | user: test
1002 | date: Thu Jan 01 00:00:00 1970 +0000
1007 | date: Thu Jan 01 00:00:00 1970 +0000
1003 | summary: start new branch
1008 | summary: start new branch
1004 |
1009 |
1005 o changeset: 1:eca11cf91c71
1010 o changeset: 1:eca11cf91c71
1006 | user: test
1011 | user: test
1007 | date: Thu Jan 01 00:00:00 1970 +0000
1012 | date: Thu Jan 01 00:00:00 1970 +0000
1008 | summary: commitB
1013 | summary: commitB
1009 |
1014 |
1010 o changeset: 0:105141ef12d0
1015 o changeset: 0:105141ef12d0
1011 user: test
1016 user: test
1012 date: Thu Jan 01 00:00:00 1970 +0000
1017 date: Thu Jan 01 00:00:00 1970 +0000
1013 summary: commitA
1018 summary: commitA
1014
1019
1015
1020
1016 $ hg strip --force -r 35358f982181
1021 $ hg strip --force -r 35358f982181
1017 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1022 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1018 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
1023 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
1019 $ hg log -G
1024 $ hg log -G
1020 @ changeset: 3:f62c6c09b707
1025 @ changeset: 3:f62c6c09b707
1021 | branch: new-branch
1026 | branch: new-branch
1022 | tag: tip
1027 | tag: tip
1023 | user: test
1028 | user: test
1024 | date: Thu Jan 01 00:00:00 1970 +0000
1029 | date: Thu Jan 01 00:00:00 1970 +0000
1025 | summary: foo
1030 | summary: foo
1026 |
1031 |
1027 o changeset: 2:b1d33a8cadd9
1032 o changeset: 2:b1d33a8cadd9
1028 | branch: new-branch
1033 | branch: new-branch
1029 | user: test
1034 | user: test
1030 | date: Thu Jan 01 00:00:00 1970 +0000
1035 | date: Thu Jan 01 00:00:00 1970 +0000
1031 | summary: start new branch
1036 | summary: start new branch
1032 |
1037 |
1033 o changeset: 1:eca11cf91c71
1038 o changeset: 1:eca11cf91c71
1034 | user: test
1039 | user: test
1035 | date: Thu Jan 01 00:00:00 1970 +0000
1040 | date: Thu Jan 01 00:00:00 1970 +0000
1036 | summary: commitB
1041 | summary: commitB
1037 |
1042 |
1038 o changeset: 0:105141ef12d0
1043 o changeset: 0:105141ef12d0
1039 user: test
1044 user: test
1040 date: Thu Jan 01 00:00:00 1970 +0000
1045 date: Thu Jan 01 00:00:00 1970 +0000
1041 summary: commitA
1046 summary: commitA
1042
1047
1043
1048
1044 $ hg up default
1049 $ hg up default
1045 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1050 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1046 $ echo 'bar' > bar.txt
1051 $ echo 'bar' > bar.txt
1047 $ hg ci -Aqm bar
1052 $ hg ci -Aqm bar
1048 $ hg up new-branch
1053 $ hg up new-branch
1049 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1054 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1050 $ hg merge default
1055 $ hg merge default
1051 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1056 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1052 (branch merge, don't forget to commit)
1057 (branch merge, don't forget to commit)
1053 $ hg ci -m merge
1058 $ hg ci -m merge
1054 $ hg log -G
1059 $ hg log -G
1055 @ changeset: 5:4cf5e92caec2
1060 @ changeset: 5:4cf5e92caec2
1056 |\ branch: new-branch
1061 |\ branch: new-branch
1057 | | tag: tip
1062 | | tag: tip
1058 | | parent: 3:f62c6c09b707
1063 | | parent: 3:f62c6c09b707
1059 | | parent: 4:35358f982181
1064 | | parent: 4:35358f982181
1060 | | user: test
1065 | | user: test
1061 | | date: Thu Jan 01 00:00:00 1970 +0000
1066 | | date: Thu Jan 01 00:00:00 1970 +0000
1062 | | summary: merge
1067 | | summary: merge
1063 | |
1068 | |
1064 | o changeset: 4:35358f982181
1069 | o changeset: 4:35358f982181
1065 | | parent: 1:eca11cf91c71
1070 | | parent: 1:eca11cf91c71
1066 | | user: test
1071 | | user: test
1067 | | date: Thu Jan 01 00:00:00 1970 +0000
1072 | | date: Thu Jan 01 00:00:00 1970 +0000
1068 | | summary: bar
1073 | | summary: bar
1069 | |
1074 | |
1070 o | changeset: 3:f62c6c09b707
1075 o | changeset: 3:f62c6c09b707
1071 | | branch: new-branch
1076 | | branch: new-branch
1072 | | user: test
1077 | | user: test
1073 | | date: Thu Jan 01 00:00:00 1970 +0000
1078 | | date: Thu Jan 01 00:00:00 1970 +0000
1074 | | summary: foo
1079 | | summary: foo
1075 | |
1080 | |
1076 o | changeset: 2:b1d33a8cadd9
1081 o | changeset: 2:b1d33a8cadd9
1077 |/ branch: new-branch
1082 |/ branch: new-branch
1078 | user: test
1083 | user: test
1079 | date: Thu Jan 01 00:00:00 1970 +0000
1084 | date: Thu Jan 01 00:00:00 1970 +0000
1080 | summary: start new branch
1085 | summary: start new branch
1081 |
1086 |
1082 o changeset: 1:eca11cf91c71
1087 o changeset: 1:eca11cf91c71
1083 | user: test
1088 | user: test
1084 | date: Thu Jan 01 00:00:00 1970 +0000
1089 | date: Thu Jan 01 00:00:00 1970 +0000
1085 | summary: commitB
1090 | summary: commitB
1086 |
1091 |
1087 o changeset: 0:105141ef12d0
1092 o changeset: 0:105141ef12d0
1088 user: test
1093 user: test
1089 date: Thu Jan 01 00:00:00 1970 +0000
1094 date: Thu Jan 01 00:00:00 1970 +0000
1090 summary: commitA
1095 summary: commitA
1091
1096
1092
1097
1093 $ hg strip -r 35358f982181
1098 $ hg strip -r 35358f982181
1094 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1099 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1095 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1100 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1096 $ hg log -G
1101 $ hg log -G
1097 @ changeset: 3:f62c6c09b707
1102 @ changeset: 3:f62c6c09b707
1098 | branch: new-branch
1103 | branch: new-branch
1099 | tag: tip
1104 | tag: tip
1100 | user: test
1105 | user: test
1101 | date: Thu Jan 01 00:00:00 1970 +0000
1106 | date: Thu Jan 01 00:00:00 1970 +0000
1102 | summary: foo
1107 | summary: foo
1103 |
1108 |
1104 o changeset: 2:b1d33a8cadd9
1109 o changeset: 2:b1d33a8cadd9
1105 | branch: new-branch
1110 | branch: new-branch
1106 | user: test
1111 | user: test
1107 | date: Thu Jan 01 00:00:00 1970 +0000
1112 | date: Thu Jan 01 00:00:00 1970 +0000
1108 | summary: start new branch
1113 | summary: start new branch
1109 |
1114 |
1110 o changeset: 1:eca11cf91c71
1115 o changeset: 1:eca11cf91c71
1111 | user: test
1116 | user: test
1112 | date: Thu Jan 01 00:00:00 1970 +0000
1117 | date: Thu Jan 01 00:00:00 1970 +0000
1113 | summary: commitB
1118 | summary: commitB
1114 |
1119 |
1115 o changeset: 0:105141ef12d0
1120 o changeset: 0:105141ef12d0
1116 user: test
1121 user: test
1117 date: Thu Jan 01 00:00:00 1970 +0000
1122 date: Thu Jan 01 00:00:00 1970 +0000
1118 summary: commitA
1123 summary: commitA
1119
1124
1120
1125
1121 $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1126 $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1122 adding changesets
1127 adding changesets
1123 adding manifests
1128 adding manifests
1124 adding file changes
1129 adding file changes
1125 added 2 changesets with 1 changes to 1 files
1130 added 2 changesets with 1 changes to 1 files
1126 new changesets 35358f982181:4cf5e92caec2 (2 drafts)
1131 new changesets 35358f982181:4cf5e92caec2 (2 drafts)
1127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1128
1133
1129 $ hg strip -k -r 35358f982181
1134 $ hg strip -k -r 35358f982181
1130 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1135 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1131 $ hg log -G
1136 $ hg log -G
1132 @ changeset: 3:f62c6c09b707
1137 @ changeset: 3:f62c6c09b707
1133 | branch: new-branch
1138 | branch: new-branch
1134 | tag: tip
1139 | tag: tip
1135 | user: test
1140 | user: test
1136 | date: Thu Jan 01 00:00:00 1970 +0000
1141 | date: Thu Jan 01 00:00:00 1970 +0000
1137 | summary: foo
1142 | summary: foo
1138 |
1143 |
1139 o changeset: 2:b1d33a8cadd9
1144 o changeset: 2:b1d33a8cadd9
1140 | branch: new-branch
1145 | branch: new-branch
1141 | user: test
1146 | user: test
1142 | date: Thu Jan 01 00:00:00 1970 +0000
1147 | date: Thu Jan 01 00:00:00 1970 +0000
1143 | summary: start new branch
1148 | summary: start new branch
1144 |
1149 |
1145 o changeset: 1:eca11cf91c71
1150 o changeset: 1:eca11cf91c71
1146 | user: test
1151 | user: test
1147 | date: Thu Jan 01 00:00:00 1970 +0000
1152 | date: Thu Jan 01 00:00:00 1970 +0000
1148 | summary: commitB
1153 | summary: commitB
1149 |
1154 |
1150 o changeset: 0:105141ef12d0
1155 o changeset: 0:105141ef12d0
1151 user: test
1156 user: test
1152 date: Thu Jan 01 00:00:00 1970 +0000
1157 date: Thu Jan 01 00:00:00 1970 +0000
1153 summary: commitA
1158 summary: commitA
1154
1159
1155 $ hg diff
1160 $ hg diff
1156 diff -r f62c6c09b707 bar.txt
1161 diff -r f62c6c09b707 bar.txt
1157 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1162 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1158 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1163 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1159 @@ -0,0 +1,1 @@
1164 @@ -0,0 +1,1 @@
1160 +bar
1165 +bar
1161
1166
1162 Use delayedstrip to strip inside a transaction
1167 Use delayedstrip to strip inside a transaction
1163
1168
1164 $ cd $TESTTMP
1169 $ cd $TESTTMP
1165 $ hg init delayedstrip
1170 $ hg init delayedstrip
1166 $ cd delayedstrip
1171 $ cd delayedstrip
1167 $ hg debugdrawdag <<'EOS'
1172 $ hg debugdrawdag <<'EOS'
1168 > D
1173 > D
1169 > |
1174 > |
1170 > C F H # Commit on top of "I",
1175 > C F H # Commit on top of "I",
1171 > | |/| # Strip B+D+I+E+G+H+Z
1176 > | |/| # Strip B+D+I+E+G+H+Z
1172 > I B E G
1177 > I B E G
1173 > \|/
1178 > \|/
1174 > A Z
1179 > A Z
1175 > EOS
1180 > EOS
1176 $ cp -R . ../scmutilcleanup
1181 $ cp -R . ../scmutilcleanup
1177
1182
1178 $ hg up -C I
1183 $ hg up -C I
1179 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1184 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1180 $ echo 3 >> I
1185 $ echo 3 >> I
1181 $ cat > $TESTTMP/delayedstrip.py <<EOF
1186 $ cat > $TESTTMP/delayedstrip.py <<EOF
1182 > from __future__ import absolute_import
1187 > from __future__ import absolute_import
1183 > from mercurial import commands, registrar, repair
1188 > from mercurial import commands, registrar, repair
1184 > cmdtable = {}
1189 > cmdtable = {}
1185 > command = registrar.command(cmdtable)
1190 > command = registrar.command(cmdtable)
1186 > @command(b'testdelayedstrip')
1191 > @command(b'testdelayedstrip')
1187 > def testdelayedstrip(ui, repo):
1192 > def testdelayedstrip(ui, repo):
1188 > def getnodes(expr):
1193 > def getnodes(expr):
1189 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1194 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1190 > with repo.wlock():
1195 > with repo.wlock():
1191 > with repo.lock():
1196 > with repo.lock():
1192 > with repo.transaction(b'delayedstrip'):
1197 > with repo.transaction(b'delayedstrip'):
1193 > repair.delayedstrip(ui, repo, getnodes(b'B+I+Z+D+E'), b'J')
1198 > repair.delayedstrip(ui, repo, getnodes(b'B+I+Z+D+E'), b'J')
1194 > repair.delayedstrip(ui, repo, getnodes(b'G+H+Z'), b'I')
1199 > repair.delayedstrip(ui, repo, getnodes(b'G+H+Z'), b'I')
1195 > commands.commit(ui, repo, message=b'J', date=b'0 0')
1200 > commands.commit(ui, repo, message=b'J', date=b'0 0')
1196 > EOF
1201 > EOF
1197 $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py
1202 $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py
1198 warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22
1203 warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22
1199 saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg
1204 saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg
1200
1205
1201 $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)'
1206 $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)'
1202 @ 6:2f2d51af6205 J
1207 @ 6:2f2d51af6205 J
1203 |
1208 |
1204 o 3:08ebfeb61bac I
1209 o 3:08ebfeb61bac I
1205 |
1210 |
1206 | o 5:64a8289d2492 F
1211 | o 5:64a8289d2492 F
1207 | |
1212 | |
1208 | o 2:7fb047a69f22 E
1213 | o 2:7fb047a69f22 E
1209 |/
1214 |/
1210 | o 4:26805aba1e60 C
1215 | o 4:26805aba1e60 C
1211 | |
1216 | |
1212 | o 1:112478962961 B
1217 | o 1:112478962961 B
1213 |/
1218 |/
1214 o 0:426bada5c675 A
1219 o 0:426bada5c675 A
1215
1220
1216 Test high-level scmutil.cleanupnodes API
1221 Test high-level scmutil.cleanupnodes API
1217
1222
1218 $ cd $TESTTMP/scmutilcleanup
1223 $ cd $TESTTMP/scmutilcleanup
1219 $ hg debugdrawdag <<'EOS'
1224 $ hg debugdrawdag <<'EOS'
1220 > D2 F2 G2 # D2, F2, G2 are replacements for D, F, G
1225 > D2 F2 G2 # D2, F2, G2 are replacements for D, F, G
1221 > | | |
1226 > | | |
1222 > C H G
1227 > C H G
1223 > EOS
1228 > EOS
1224 $ for i in B C D F G I Z; do
1229 $ for i in B C D F G I Z; do
1225 > hg bookmark -i -r $i b-$i
1230 > hg bookmark -i -r $i b-$i
1226 > done
1231 > done
1227 $ hg bookmark -i -r E 'b-F@divergent1'
1232 $ hg bookmark -i -r E 'b-F@divergent1'
1228 $ hg bookmark -i -r H 'b-F@divergent2'
1233 $ hg bookmark -i -r H 'b-F@divergent2'
1229 $ hg bookmark -i -r G 'b-F@divergent3'
1234 $ hg bookmark -i -r G 'b-F@divergent3'
1230 $ cp -R . ../scmutilcleanup.obsstore
1235 $ cp -R . ../scmutilcleanup.obsstore
1231
1236
1232 $ cat > $TESTTMP/scmutilcleanup.py <<EOF
1237 $ cat > $TESTTMP/scmutilcleanup.py <<EOF
1233 > from mercurial import registrar, scmutil
1238 > from mercurial import registrar, scmutil
1234 > cmdtable = {}
1239 > cmdtable = {}
1235 > command = registrar.command(cmdtable)
1240 > command = registrar.command(cmdtable)
1236 > @command(b'testnodescleanup')
1241 > @command(b'testnodescleanup')
1237 > def testnodescleanup(ui, repo):
1242 > def testnodescleanup(ui, repo):
1238 > def nodes(expr):
1243 > def nodes(expr):
1239 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1244 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1240 > def node(expr):
1245 > def node(expr):
1241 > return nodes(expr)[0]
1246 > return nodes(expr)[0]
1242 > with repo.wlock():
1247 > with repo.wlock():
1243 > with repo.lock():
1248 > with repo.lock():
1244 > with repo.transaction(b'delayedstrip'):
1249 > with repo.transaction(b'delayedstrip'):
1245 > mapping = {node(b'F'): [node(b'F2')],
1250 > mapping = {node(b'F'): [node(b'F2')],
1246 > node(b'D'): [node(b'D2')],
1251 > node(b'D'): [node(b'D2')],
1247 > node(b'G'): [node(b'G2')]}
1252 > node(b'G'): [node(b'G2')]}
1248 > scmutil.cleanupnodes(repo, mapping, b'replace')
1253 > scmutil.cleanupnodes(repo, mapping, b'replace')
1249 > scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'),
1254 > scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'),
1250 > b'replace')
1255 > b'replace')
1251 > EOF
1256 > EOF
1252 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1257 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1253 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
1258 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
1254 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg
1259 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg
1255
1260
1256 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1261 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1257 o 8:1473d4b996d1 G2 b-F@divergent3 b-G
1262 o 8:1473d4b996d1 G2 b-F@divergent3 b-G
1258 |
1263 |
1259 | o 7:d11b3456a873 F2 b-F
1264 | o 7:d11b3456a873 F2 b-F
1260 | |
1265 | |
1261 | o 5:5cb05ba470a7 H
1266 | o 5:5cb05ba470a7 H
1262 |/|
1267 |/|
1263 | o 3:7fb047a69f22 E b-F@divergent1
1268 | o 3:7fb047a69f22 E b-F@divergent1
1264 | |
1269 | |
1265 | | o 6:7c78f703e465 D2 b-D
1270 | | o 6:7c78f703e465 D2 b-D
1266 | | |
1271 | | |
1267 | | o 4:26805aba1e60 C
1272 | | o 4:26805aba1e60 C
1268 | | |
1273 | | |
1269 | | o 2:112478962961 B
1274 | | o 2:112478962961 B
1270 | |/
1275 | |/
1271 o | 1:1fc8102cda62 G
1276 o | 1:1fc8102cda62 G
1272 /
1277 /
1273 o 0:426bada5c675 A b-B b-C b-I
1278 o 0:426bada5c675 A b-B b-C b-I
1274
1279
1275 $ hg bookmark
1280 $ hg bookmark
1276 b-B 0:426bada5c675
1281 b-B 0:426bada5c675
1277 b-C 0:426bada5c675
1282 b-C 0:426bada5c675
1278 b-D 6:7c78f703e465
1283 b-D 6:7c78f703e465
1279 b-F 7:d11b3456a873
1284 b-F 7:d11b3456a873
1280 b-F@divergent1 3:7fb047a69f22
1285 b-F@divergent1 3:7fb047a69f22
1281 b-F@divergent3 8:1473d4b996d1
1286 b-F@divergent3 8:1473d4b996d1
1282 b-G 8:1473d4b996d1
1287 b-G 8:1473d4b996d1
1283 b-I 0:426bada5c675
1288 b-I 0:426bada5c675
1284 b-Z -1:000000000000
1289 b-Z -1:000000000000
1285
1290
1286 Test the above using obsstore "by the way". Not directly related to strip, but
1291 Test the above using obsstore "by the way". Not directly related to strip, but
1287 we have reusable code here
1292 we have reusable code here
1288
1293
1289 $ cd $TESTTMP/scmutilcleanup.obsstore
1294 $ cd $TESTTMP/scmutilcleanup.obsstore
1290 $ cat >> .hg/hgrc <<EOF
1295 $ cat >> .hg/hgrc <<EOF
1291 > [experimental]
1296 > [experimental]
1292 > evolution=true
1297 > evolution=true
1293 > evolution.track-operation=1
1298 > evolution.track-operation=1
1294 > EOF
1299 > EOF
1295
1300
1296 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1301 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1297 4 new orphan changesets
1302 4 new orphan changesets
1298
1303
1299 $ rm .hg/localtags
1304 $ rm .hg/localtags
1300 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1305 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1301 * 12:1473d4b996d1 G2 b-F@divergent3 b-G
1306 * 12:1473d4b996d1 G2 b-F@divergent3 b-G
1302 |
1307 |
1303 | * 11:d11b3456a873 F2 b-F
1308 | * 11:d11b3456a873 F2 b-F
1304 | |
1309 | |
1305 | * 8:5cb05ba470a7 H
1310 | * 8:5cb05ba470a7 H
1306 |/|
1311 |/|
1307 | o 4:7fb047a69f22 E b-F@divergent1
1312 | o 4:7fb047a69f22 E b-F@divergent1
1308 | |
1313 | |
1309 | | * 10:7c78f703e465 D2 b-D
1314 | | * 10:7c78f703e465 D2 b-D
1310 | | |
1315 | | |
1311 | | x 6:26805aba1e60 C
1316 | | x 6:26805aba1e60 C
1312 | | |
1317 | | |
1313 | | x 3:112478962961 B
1318 | | x 3:112478962961 B
1314 | |/
1319 | |/
1315 x | 1:1fc8102cda62 G
1320 x | 1:1fc8102cda62 G
1316 /
1321 /
1317 o 0:426bada5c675 A b-B b-C b-I
1322 o 0:426bada5c675 A b-B b-C b-I
1318
1323
1319 $ hg debugobsolete
1324 $ hg debugobsolete
1320 1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1325 1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1321 64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1326 64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1322 f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
1327 f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
1323 48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1328 48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1324 112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1329 112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1325 08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1330 08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1326 26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1331 26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1327 $ cd ..
1332 $ cd ..
1328
1333
1329 Test that obsmarkers are restored even when not using generaldelta
1334 Test that obsmarkers are restored even when not using generaldelta
1330
1335
1331 $ hg --config format.usegeneraldelta=no init issue5678
1336 $ hg --config format.usegeneraldelta=no init issue5678
1332 $ cd issue5678
1337 $ cd issue5678
1333 $ cat >> .hg/hgrc <<EOF
1338 $ cat >> .hg/hgrc <<EOF
1334 > [experimental]
1339 > [experimental]
1335 > evolution=true
1340 > evolution=true
1336 > EOF
1341 > EOF
1337 $ echo a > a
1342 $ echo a > a
1338 $ hg ci -Aqm a
1343 $ hg ci -Aqm a
1339 $ hg ci --amend -m a2
1344 $ hg ci --amend -m a2
1340 $ hg debugobsolete
1345 $ hg debugobsolete
1341 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1346 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1342 $ hg strip .
1347 $ hg strip .
1343 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1348 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1344 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
1349 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
1345 $ hg unbundle -q .hg/strip-backup/*
1350 $ hg unbundle -q .hg/strip-backup/*
1346 $ hg debugobsolete
1351 $ hg debugobsolete
1347 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1352 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1348 $ cd ..
1353 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now