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