##// END OF EJS Templates
strip: changing bookmark argument to be a list...
Shubhanshu Agrawal -
r27030:cf9ed6d3 default
parent child Browse files
Show More
@@ -1,227 +1,225
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 mercurial.i18n import _
6 from mercurial.i18n import _
7 from mercurial.node import nullid
7 from mercurial.node import nullid
8 from mercurial.lock import release
8 from mercurial.lock import release
9 from mercurial import cmdutil, hg, scmutil, util, error
9 from mercurial import cmdutil, hg, scmutil, util, error
10 from mercurial import repair, bookmarks as bookmarksmod , merge
10 from mercurial import repair, bookmarks as bookmarksmod , merge
11
11
12 cmdtable = {}
12 cmdtable = {}
13 command = cmdutil.command(cmdtable)
13 command = cmdutil.command(cmdtable)
14 # Note for extension authors: ONLY specify testedwith = 'internal' for
14 # Note for extension authors: ONLY specify testedwith = 'internal' for
15 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
15 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
16 # be specifying the version(s) of Mercurial they are tested with, or
16 # be specifying the version(s) of Mercurial they are tested with, or
17 # leave the attribute unspecified.
17 # leave the attribute unspecified.
18 testedwith = 'internal'
18 testedwith = 'internal'
19
19
20 def checksubstate(repo, baserev=None):
20 def checksubstate(repo, baserev=None):
21 '''return list of subrepos at a different revision than substate.
21 '''return list of subrepos at a different revision than substate.
22 Abort if any subrepos have uncommitted changes.'''
22 Abort if any subrepos have uncommitted changes.'''
23 inclsubs = []
23 inclsubs = []
24 wctx = repo[None]
24 wctx = repo[None]
25 if baserev:
25 if baserev:
26 bctx = repo[baserev]
26 bctx = repo[baserev]
27 else:
27 else:
28 bctx = wctx.parents()[0]
28 bctx = wctx.parents()[0]
29 for s in sorted(wctx.substate):
29 for s in sorted(wctx.substate):
30 wctx.sub(s).bailifchanged(True)
30 wctx.sub(s).bailifchanged(True)
31 if s not in bctx.substate or bctx.sub(s).dirty():
31 if s not in bctx.substate or bctx.sub(s).dirty():
32 inclsubs.append(s)
32 inclsubs.append(s)
33 return inclsubs
33 return inclsubs
34
34
35 def checklocalchanges(repo, force=False, excsuffix=''):
35 def checklocalchanges(repo, force=False, excsuffix=''):
36 cmdutil.checkunfinished(repo)
36 cmdutil.checkunfinished(repo)
37 s = repo.status()
37 s = repo.status()
38 if not force:
38 if not force:
39 if s.modified or s.added or s.removed or s.deleted:
39 if s.modified or s.added or s.removed or s.deleted:
40 _("local changes found") # i18n tool detection
40 _("local changes found") # i18n tool detection
41 raise error.Abort(_("local changes found" + excsuffix))
41 raise error.Abort(_("local changes found" + excsuffix))
42 if checksubstate(repo):
42 if checksubstate(repo):
43 _("local changed subrepos found") # i18n tool detection
43 _("local changed subrepos found") # i18n tool detection
44 raise error.Abort(_("local changed subrepos found" + excsuffix))
44 raise error.Abort(_("local changed subrepos found" + excsuffix))
45 return s
45 return s
46
46
47 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
47 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
48 wlock = lock = None
48 wlock = lock = None
49 try:
49 try:
50 wlock = repo.wlock()
50 wlock = repo.wlock()
51 lock = repo.lock()
51 lock = repo.lock()
52
52
53 if update:
53 if update:
54 checklocalchanges(repo, force=force)
54 checklocalchanges(repo, force=force)
55 urev, p2 = repo.changelog.parents(revs[0])
55 urev, p2 = repo.changelog.parents(revs[0])
56 if (util.safehasattr(repo, 'mq') and
56 if (util.safehasattr(repo, 'mq') and
57 p2 != nullid
57 p2 != nullid
58 and p2 in [x.node for x in repo.mq.applied]):
58 and p2 in [x.node for x in repo.mq.applied]):
59 urev = p2
59 urev = p2
60 hg.clean(repo, urev)
60 hg.clean(repo, urev)
61 repo.dirstate.write(repo.currenttransaction())
61 repo.dirstate.write(repo.currenttransaction())
62
62
63 repair.strip(ui, repo, revs, backup)
63 repair.strip(ui, repo, revs, backup)
64
64
65 repomarks = repo._bookmarks
65 repomarks = repo._bookmarks
66 if bookmarks:
66 if bookmarks:
67 if repo._activebookmark in bookmarks:
67 if repo._activebookmark in bookmarks:
68 bookmarksmod.deactivate(repo)
68 bookmarksmod.deactivate(repo)
69 for bookmark in bookmarks:
69 for bookmark in bookmarks:
70 del repomarks[bookmark]
70 del repomarks[bookmark]
71 repomarks.write()
71 repomarks.write()
72 for bookmark in sorted(bookmarks):
72 for bookmark in sorted(bookmarks):
73 ui.write(_("bookmark '%s' deleted\n") % bookmark)
73 ui.write(_("bookmark '%s' deleted\n") % bookmark)
74 finally:
74 finally:
75 release(lock, wlock)
75 release(lock, wlock)
76
76
77
77
78 @command("strip",
78 @command("strip",
79 [
79 [
80 ('r', 'rev', [], _('strip specified revision (optional, '
80 ('r', 'rev', [], _('strip specified revision (optional, '
81 'can specify revisions without this '
81 'can specify revisions without this '
82 'option)'), _('REV')),
82 'option)'), _('REV')),
83 ('f', 'force', None, _('force removal of changesets, discard '
83 ('f', 'force', None, _('force removal of changesets, discard '
84 'uncommitted changes (no backup)')),
84 'uncommitted changes (no backup)')),
85 ('', 'no-backup', None, _('no backups')),
85 ('', 'no-backup', None, _('no backups')),
86 ('', 'nobackup', None, _('no backups (DEPRECATED)')),
86 ('', 'nobackup', None, _('no backups (DEPRECATED)')),
87 ('n', '', None, _('ignored (DEPRECATED)')),
87 ('n', '', None, _('ignored (DEPRECATED)')),
88 ('k', 'keep', None, _("do not modify working directory during "
88 ('k', 'keep', None, _("do not modify working directory during "
89 "strip")),
89 "strip")),
90 ('B', 'bookmark', '', _("remove revs only reachable from given"
90 ('B', 'bookmark', [], _("remove revs only reachable from given"
91 " bookmark"))],
91 " bookmark"))],
92 _('hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...'))
92 _('hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...'))
93 def stripcmd(ui, repo, *revs, **opts):
93 def stripcmd(ui, repo, *revs, **opts):
94 """strip changesets and all their descendants from the repository
94 """strip changesets and all their descendants from the repository
95
95
96 The strip command removes the specified changesets and all their
96 The strip command removes the specified changesets and all their
97 descendants. If the working directory has uncommitted changes, the
97 descendants. If the working directory has uncommitted changes, the
98 operation is aborted unless the --force flag is supplied, in which
98 operation is aborted unless the --force flag is supplied, in which
99 case changes will be discarded.
99 case changes will be discarded.
100
100
101 If a parent of the working directory is stripped, then the working
101 If a parent of the working directory is stripped, then the working
102 directory will automatically be updated to the most recent
102 directory will automatically be updated to the most recent
103 available ancestor of the stripped parent after the operation
103 available ancestor of the stripped parent after the operation
104 completes.
104 completes.
105
105
106 Any stripped changesets are stored in ``.hg/strip-backup`` as a
106 Any stripped changesets are stored in ``.hg/strip-backup`` as a
107 bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
107 bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
108 be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
108 be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
109 where BUNDLE is the bundle file created by the strip. Note that
109 where BUNDLE is the bundle file created by the strip. Note that
110 the local revision numbers will in general be different after the
110 the local revision numbers will in general be different after the
111 restore.
111 restore.
112
112
113 Use the --no-backup option to discard the backup bundle once the
113 Use the --no-backup option to discard the backup bundle once the
114 operation completes.
114 operation completes.
115
115
116 Strip is not a history-rewriting operation and can be used on
116 Strip is not a history-rewriting operation and can be used on
117 changesets in the public phase. But if the stripped changesets have
117 changesets in the public phase. But if the stripped changesets have
118 been pushed to a remote repository you will likely pull them again.
118 been pushed to a remote repository you will likely pull them again.
119
119
120 Return 0 on success.
120 Return 0 on success.
121 """
121 """
122 backup = True
122 backup = True
123 if opts.get('no_backup') or opts.get('nobackup'):
123 if opts.get('no_backup') or opts.get('nobackup'):
124 backup = False
124 backup = False
125
125
126 cl = repo.changelog
126 cl = repo.changelog
127 revs = list(revs) + opts.get('rev')
127 revs = list(revs) + opts.get('rev')
128 revs = set(scmutil.revrange(repo, revs))
128 revs = set(scmutil.revrange(repo, revs))
129
129
130 wlock = repo.wlock()
130 wlock = repo.wlock()
131 try:
131 try:
132 bookmarks = None
132 bookmarks = set(opts.get('bookmark'))
133 if opts.get('bookmark'):
134 bookmarks = set([opts.get('bookmark')])
135 if bookmarks:
133 if bookmarks:
136 repomarks = repo._bookmarks
134 repomarks = repo._bookmarks
137 if not bookmarks.issubset(repomarks):
135 if not bookmarks.issubset(repomarks):
138 raise error.Abort(_("bookmark '%s' not found") %
136 raise error.Abort(_("bookmark '%s' not found") %
139 ','.join(sorted(bookmarks - set(repomarks.keys()))))
137 ','.join(sorted(bookmarks - set(repomarks.keys()))))
140
138
141 # If the requested bookmark is not the only one pointing to a
139 # If the requested bookmark is not the only one pointing to a
142 # a revision we have to only delete the bookmark and not strip
140 # a revision we have to only delete the bookmark and not strip
143 # anything. revsets cannot detect that case.
141 # anything. revsets cannot detect that case.
144 nodetobookmarks = {}
142 nodetobookmarks = {}
145 for mark, node in repomarks.iteritems():
143 for mark, node in repomarks.iteritems():
146 nodetobookmarks.setdefault(node, []).append(mark)
144 nodetobookmarks.setdefault(node, []).append(mark)
147 for marks in nodetobookmarks.values():
145 for marks in nodetobookmarks.values():
148 if bookmarks.issuperset(marks):
146 if bookmarks.issuperset(marks):
149 rsrevs = repair.stripbmrevset(repo, marks[0])
147 rsrevs = repair.stripbmrevset(repo, marks[0])
150 revs.update(set(rsrevs))
148 revs.update(set(rsrevs))
151 if not revs:
149 if not revs:
152 for bookmark in bookmarks:
150 for bookmark in bookmarks:
153 del repomarks[bookmark]
151 del repomarks[bookmark]
154 repomarks.write()
152 repomarks.write()
155 for bookmark in sorted(bookmarks):
153 for bookmark in sorted(bookmarks):
156 ui.write(_("bookmark '%s' deleted\n") % bookmark)
154 ui.write(_("bookmark '%s' deleted\n") % bookmark)
157
155
158 if not revs:
156 if not revs:
159 raise error.Abort(_('empty revision set'))
157 raise error.Abort(_('empty revision set'))
160
158
161 descendants = set(cl.descendants(revs))
159 descendants = set(cl.descendants(revs))
162 strippedrevs = revs.union(descendants)
160 strippedrevs = revs.union(descendants)
163 roots = revs.difference(descendants)
161 roots = revs.difference(descendants)
164
162
165 update = False
163 update = False
166 # if one of the wdir parent is stripped we'll need
164 # if one of the wdir parent is stripped we'll need
167 # to update away to an earlier revision
165 # to update away to an earlier revision
168 for p in repo.dirstate.parents():
166 for p in repo.dirstate.parents():
169 if p != nullid and cl.rev(p) in strippedrevs:
167 if p != nullid and cl.rev(p) in strippedrevs:
170 update = True
168 update = True
171 break
169 break
172
170
173 rootnodes = set(cl.node(r) for r in roots)
171 rootnodes = set(cl.node(r) for r in roots)
174
172
175 q = getattr(repo, 'mq', None)
173 q = getattr(repo, 'mq', None)
176 if q is not None and q.applied:
174 if q is not None and q.applied:
177 # refresh queue state if we're about to strip
175 # refresh queue state if we're about to strip
178 # applied patches
176 # applied patches
179 if cl.rev(repo.lookup('qtip')) in strippedrevs:
177 if cl.rev(repo.lookup('qtip')) in strippedrevs:
180 q.applieddirty = True
178 q.applieddirty = True
181 start = 0
179 start = 0
182 end = len(q.applied)
180 end = len(q.applied)
183 for i, statusentry in enumerate(q.applied):
181 for i, statusentry in enumerate(q.applied):
184 if statusentry.node in rootnodes:
182 if statusentry.node in rootnodes:
185 # if one of the stripped roots is an applied
183 # if one of the stripped roots is an applied
186 # patch, only part of the queue is stripped
184 # patch, only part of the queue is stripped
187 start = i
185 start = i
188 break
186 break
189 del q.applied[start:end]
187 del q.applied[start:end]
190 q.savedirty()
188 q.savedirty()
191
189
192 revs = sorted(rootnodes)
190 revs = sorted(rootnodes)
193 if update and opts.get('keep'):
191 if update and opts.get('keep'):
194 urev, p2 = repo.changelog.parents(revs[0])
192 urev, p2 = repo.changelog.parents(revs[0])
195 if (util.safehasattr(repo, 'mq') and p2 != nullid
193 if (util.safehasattr(repo, 'mq') and p2 != nullid
196 and p2 in [x.node for x in repo.mq.applied]):
194 and p2 in [x.node for x in repo.mq.applied]):
197 urev = p2
195 urev = p2
198 uctx = repo[urev]
196 uctx = repo[urev]
199
197
200 # only reset the dirstate for files that would actually change
198 # only reset the dirstate for files that would actually change
201 # between the working context and uctx
199 # between the working context and uctx
202 descendantrevs = repo.revs("%s::." % uctx.rev())
200 descendantrevs = repo.revs("%s::." % uctx.rev())
203 changedfiles = []
201 changedfiles = []
204 for rev in descendantrevs:
202 for rev in descendantrevs:
205 # blindly reset the files, regardless of what actually changed
203 # blindly reset the files, regardless of what actually changed
206 changedfiles.extend(repo[rev].files())
204 changedfiles.extend(repo[rev].files())
207
205
208 # reset files that only changed in the dirstate too
206 # reset files that only changed in the dirstate too
209 dirstate = repo.dirstate
207 dirstate = repo.dirstate
210 dirchanges = [f for f in dirstate if dirstate[f] != 'n']
208 dirchanges = [f for f in dirstate if dirstate[f] != 'n']
211 changedfiles.extend(dirchanges)
209 changedfiles.extend(dirchanges)
212
210
213 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
211 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
214 repo.dirstate.write(repo.currenttransaction())
212 repo.dirstate.write(repo.currenttransaction())
215
213
216 # clear resolve state
214 # clear resolve state
217 merge.mergestate.clean(repo, repo['.'].node())
215 merge.mergestate.clean(repo, repo['.'].node())
218
216
219 update = False
217 update = False
220
218
221
219
222 strip(ui, repo, revs, backup=backup, update=update,
220 strip(ui, repo, revs, backup=backup, update=update,
223 force=opts.get('force'), bookmarks=bookmarks)
221 force=opts.get('force'), bookmarks=bookmarks)
224 finally:
222 finally:
225 wlock.release()
223 wlock.release()
226
224
227 return 0
225 return 0
@@ -1,820 +1,854
1 $ echo "[format]" >> $HGRCPATH
1 $ echo "[format]" >> $HGRCPATH
2 $ echo "usegeneraldelta=yes" >> $HGRCPATH
2 $ echo "usegeneraldelta=yes" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "strip=" >> $HGRCPATH
4 $ echo "strip=" >> $HGRCPATH
5
5
6 $ restore() {
6 $ restore() {
7 > hg unbundle -q .hg/strip-backup/*
7 > hg unbundle -q .hg/strip-backup/*
8 > rm .hg/strip-backup/*
8 > rm .hg/strip-backup/*
9 > }
9 > }
10 $ teststrip() {
10 $ teststrip() {
11 > hg up -C $1
11 > hg up -C $1
12 > echo % before update $1, strip $2
12 > echo % before update $1, strip $2
13 > hg parents
13 > hg parents
14 > hg --traceback strip $2
14 > hg --traceback strip $2
15 > echo % after update $1, strip $2
15 > echo % after update $1, strip $2
16 > hg parents
16 > hg parents
17 > restore
17 > restore
18 > }
18 > }
19
19
20 $ hg init test
20 $ hg init test
21 $ cd test
21 $ cd test
22
22
23 $ echo foo > bar
23 $ echo foo > bar
24 $ hg ci -Ama
24 $ hg ci -Ama
25 adding bar
25 adding bar
26
26
27 $ echo more >> bar
27 $ echo more >> bar
28 $ hg ci -Amb
28 $ hg ci -Amb
29
29
30 $ echo blah >> bar
30 $ echo blah >> bar
31 $ hg ci -Amc
31 $ hg ci -Amc
32
32
33 $ hg up 1
33 $ hg up 1
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 $ echo blah >> bar
35 $ echo blah >> bar
36 $ hg ci -Amd
36 $ hg ci -Amd
37 created new head
37 created new head
38
38
39 $ echo final >> bar
39 $ echo final >> bar
40 $ hg ci -Ame
40 $ hg ci -Ame
41
41
42 $ hg log
42 $ hg log
43 changeset: 4:443431ffac4f
43 changeset: 4:443431ffac4f
44 tag: tip
44 tag: tip
45 user: test
45 user: test
46 date: Thu Jan 01 00:00:00 1970 +0000
46 date: Thu Jan 01 00:00:00 1970 +0000
47 summary: e
47 summary: e
48
48
49 changeset: 3:65bd5f99a4a3
49 changeset: 3:65bd5f99a4a3
50 parent: 1:ef3a871183d7
50 parent: 1:ef3a871183d7
51 user: test
51 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
52 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: d
53 summary: d
54
54
55 changeset: 2:264128213d29
55 changeset: 2:264128213d29
56 user: test
56 user: test
57 date: Thu Jan 01 00:00:00 1970 +0000
57 date: Thu Jan 01 00:00:00 1970 +0000
58 summary: c
58 summary: c
59
59
60 changeset: 1:ef3a871183d7
60 changeset: 1:ef3a871183d7
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: b
63 summary: b
64
64
65 changeset: 0:9ab35a2d17cb
65 changeset: 0:9ab35a2d17cb
66 user: test
66 user: test
67 date: Thu Jan 01 00:00:00 1970 +0000
67 date: Thu Jan 01 00:00:00 1970 +0000
68 summary: a
68 summary: a
69
69
70
70
71 $ teststrip 4 4
71 $ teststrip 4 4
72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 % before update 4, strip 4
73 % before update 4, strip 4
74 changeset: 4:443431ffac4f
74 changeset: 4:443431ffac4f
75 tag: tip
75 tag: tip
76 user: test
76 user: test
77 date: Thu Jan 01 00:00:00 1970 +0000
77 date: Thu Jan 01 00:00:00 1970 +0000
78 summary: e
78 summary: e
79
79
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
81 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
82 % after update 4, strip 4
82 % after update 4, strip 4
83 changeset: 3:65bd5f99a4a3
83 changeset: 3:65bd5f99a4a3
84 tag: tip
84 tag: tip
85 parent: 1:ef3a871183d7
85 parent: 1:ef3a871183d7
86 user: test
86 user: test
87 date: Thu Jan 01 00:00:00 1970 +0000
87 date: Thu Jan 01 00:00:00 1970 +0000
88 summary: d
88 summary: d
89
89
90 $ teststrip 4 3
90 $ teststrip 4 3
91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 % before update 4, strip 3
92 % before update 4, strip 3
93 changeset: 4:443431ffac4f
93 changeset: 4:443431ffac4f
94 tag: tip
94 tag: tip
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:00 1970 +0000
96 date: Thu Jan 01 00:00:00 1970 +0000
97 summary: e
97 summary: e
98
98
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
100 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
101 % after update 4, strip 3
101 % after update 4, strip 3
102 changeset: 1:ef3a871183d7
102 changeset: 1:ef3a871183d7
103 user: test
103 user: test
104 date: Thu Jan 01 00:00:00 1970 +0000
104 date: Thu Jan 01 00:00:00 1970 +0000
105 summary: b
105 summary: b
106
106
107 $ teststrip 1 4
107 $ teststrip 1 4
108 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 % before update 1, strip 4
109 % before update 1, strip 4
110 changeset: 1:ef3a871183d7
110 changeset: 1:ef3a871183d7
111 user: test
111 user: test
112 date: Thu Jan 01 00:00:00 1970 +0000
112 date: Thu Jan 01 00:00:00 1970 +0000
113 summary: b
113 summary: b
114
114
115 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
115 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
116 % after update 1, strip 4
116 % after update 1, strip 4
117 changeset: 1:ef3a871183d7
117 changeset: 1:ef3a871183d7
118 user: test
118 user: test
119 date: Thu Jan 01 00:00:00 1970 +0000
119 date: Thu Jan 01 00:00:00 1970 +0000
120 summary: b
120 summary: b
121
121
122 $ teststrip 4 2
122 $ teststrip 4 2
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 % before update 4, strip 2
124 % before update 4, strip 2
125 changeset: 4:443431ffac4f
125 changeset: 4:443431ffac4f
126 tag: tip
126 tag: tip
127 user: test
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: e
129 summary: e
130
130
131 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
131 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
132 % after update 4, strip 2
132 % after update 4, strip 2
133 changeset: 3:443431ffac4f
133 changeset: 3:443431ffac4f
134 tag: tip
134 tag: tip
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: e
137 summary: e
138
138
139 $ teststrip 4 1
139 $ teststrip 4 1
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 % before update 4, strip 1
141 % before update 4, strip 1
142 changeset: 4:264128213d29
142 changeset: 4:264128213d29
143 tag: tip
143 tag: tip
144 parent: 1:ef3a871183d7
144 parent: 1:ef3a871183d7
145 user: test
145 user: test
146 date: Thu Jan 01 00:00:00 1970 +0000
146 date: Thu Jan 01 00:00:00 1970 +0000
147 summary: c
147 summary: c
148
148
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
150 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
151 % after update 4, strip 1
151 % after update 4, strip 1
152 changeset: 0:9ab35a2d17cb
152 changeset: 0:9ab35a2d17cb
153 tag: tip
153 tag: tip
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: a
156 summary: a
157
157
158 $ teststrip null 4
158 $ teststrip null 4
159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
160 % before update null, strip 4
160 % before update null, strip 4
161 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
161 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
162 % after update null, strip 4
162 % after update null, strip 4
163
163
164 $ hg log
164 $ hg log
165 changeset: 4:264128213d29
165 changeset: 4:264128213d29
166 tag: tip
166 tag: tip
167 parent: 1:ef3a871183d7
167 parent: 1:ef3a871183d7
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: c
170 summary: c
171
171
172 changeset: 3:443431ffac4f
172 changeset: 3:443431ffac4f
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: e
175 summary: e
176
176
177 changeset: 2:65bd5f99a4a3
177 changeset: 2:65bd5f99a4a3
178 user: test
178 user: test
179 date: Thu Jan 01 00:00:00 1970 +0000
179 date: Thu Jan 01 00:00:00 1970 +0000
180 summary: d
180 summary: d
181
181
182 changeset: 1:ef3a871183d7
182 changeset: 1:ef3a871183d7
183 user: test
183 user: test
184 date: Thu Jan 01 00:00:00 1970 +0000
184 date: Thu Jan 01 00:00:00 1970 +0000
185 summary: b
185 summary: b
186
186
187 changeset: 0:9ab35a2d17cb
187 changeset: 0:9ab35a2d17cb
188 user: test
188 user: test
189 date: Thu Jan 01 00:00:00 1970 +0000
189 date: Thu Jan 01 00:00:00 1970 +0000
190 summary: a
190 summary: a
191
191
192 $ hg up -C 4
192 $ hg up -C 4
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 $ hg parents
194 $ hg parents
195 changeset: 4:264128213d29
195 changeset: 4:264128213d29
196 tag: tip
196 tag: tip
197 parent: 1:ef3a871183d7
197 parent: 1:ef3a871183d7
198 user: test
198 user: test
199 date: Thu Jan 01 00:00:00 1970 +0000
199 date: Thu Jan 01 00:00:00 1970 +0000
200 summary: c
200 summary: c
201
201
202
202
203 $ hg --traceback strip 4
203 $ hg --traceback strip 4
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
205 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg (glob)
206 $ hg parents
206 $ hg parents
207 changeset: 1:ef3a871183d7
207 changeset: 1:ef3a871183d7
208 user: test
208 user: test
209 date: Thu Jan 01 00:00:00 1970 +0000
209 date: Thu Jan 01 00:00:00 1970 +0000
210 summary: b
210 summary: b
211
211
212 $ hg debugbundle .hg/strip-backup/*
212 $ hg debugbundle .hg/strip-backup/*
213 Stream params: {'Compression': 'BZ'}
213 Stream params: {'Compression': 'BZ'}
214 changegroup -- "{'version': '02'}"
214 changegroup -- "{'version': '02'}"
215 264128213d290d868c54642d13aeaa3675551a78
215 264128213d290d868c54642d13aeaa3675551a78
216 $ hg pull .hg/strip-backup/*
216 $ hg pull .hg/strip-backup/*
217 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
217 pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
218 searching for changes
218 searching for changes
219 adding changesets
219 adding changesets
220 adding manifests
220 adding manifests
221 adding file changes
221 adding file changes
222 added 1 changesets with 0 changes to 0 files (+1 heads)
222 added 1 changesets with 0 changes to 0 files (+1 heads)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
223 (run 'hg heads' to see heads, 'hg merge' to merge)
224 $ rm .hg/strip-backup/*
224 $ rm .hg/strip-backup/*
225 $ hg log --graph
225 $ hg log --graph
226 o changeset: 4:264128213d29
226 o changeset: 4:264128213d29
227 | tag: tip
227 | tag: tip
228 | parent: 1:ef3a871183d7
228 | parent: 1:ef3a871183d7
229 | user: test
229 | user: test
230 | date: Thu Jan 01 00:00:00 1970 +0000
230 | date: Thu Jan 01 00:00:00 1970 +0000
231 | summary: c
231 | summary: c
232 |
232 |
233 | o changeset: 3:443431ffac4f
233 | o changeset: 3:443431ffac4f
234 | | user: test
234 | | user: test
235 | | date: Thu Jan 01 00:00:00 1970 +0000
235 | | date: Thu Jan 01 00:00:00 1970 +0000
236 | | summary: e
236 | | summary: e
237 | |
237 | |
238 | o changeset: 2:65bd5f99a4a3
238 | o changeset: 2:65bd5f99a4a3
239 |/ user: test
239 |/ user: test
240 | date: Thu Jan 01 00:00:00 1970 +0000
240 | date: Thu Jan 01 00:00:00 1970 +0000
241 | summary: d
241 | summary: d
242 |
242 |
243 @ changeset: 1:ef3a871183d7
243 @ changeset: 1:ef3a871183d7
244 | user: test
244 | user: test
245 | date: Thu Jan 01 00:00:00 1970 +0000
245 | date: Thu Jan 01 00:00:00 1970 +0000
246 | summary: b
246 | summary: b
247 |
247 |
248 o changeset: 0:9ab35a2d17cb
248 o changeset: 0:9ab35a2d17cb
249 user: test
249 user: test
250 date: Thu Jan 01 00:00:00 1970 +0000
250 date: Thu Jan 01 00:00:00 1970 +0000
251 summary: a
251 summary: a
252
252
253 $ hg up -C 2
253 $ hg up -C 2
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 $ hg merge 4
255 $ hg merge 4
256 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 (branch merge, don't forget to commit)
257 (branch merge, don't forget to commit)
258
258
259 before strip of merge parent
259 before strip of merge parent
260
260
261 $ hg parents
261 $ hg parents
262 changeset: 2:65bd5f99a4a3
262 changeset: 2:65bd5f99a4a3
263 user: test
263 user: test
264 date: Thu Jan 01 00:00:00 1970 +0000
264 date: Thu Jan 01 00:00:00 1970 +0000
265 summary: d
265 summary: d
266
266
267 changeset: 4:264128213d29
267 changeset: 4:264128213d29
268 tag: tip
268 tag: tip
269 parent: 1:ef3a871183d7
269 parent: 1:ef3a871183d7
270 user: test
270 user: test
271 date: Thu Jan 01 00:00:00 1970 +0000
271 date: Thu Jan 01 00:00:00 1970 +0000
272 summary: c
272 summary: c
273
273
274 $ hg strip 4
274 $ hg strip 4
275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
276 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
277
277
278 after strip of merge parent
278 after strip of merge parent
279
279
280 $ hg parents
280 $ hg parents
281 changeset: 1:ef3a871183d7
281 changeset: 1:ef3a871183d7
282 user: test
282 user: test
283 date: Thu Jan 01 00:00:00 1970 +0000
283 date: Thu Jan 01 00:00:00 1970 +0000
284 summary: b
284 summary: b
285
285
286 $ restore
286 $ restore
287
287
288 $ hg up
288 $ hg up
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 $ hg log -G
290 $ hg log -G
291 @ changeset: 4:264128213d29
291 @ changeset: 4:264128213d29
292 | tag: tip
292 | tag: tip
293 | parent: 1:ef3a871183d7
293 | parent: 1:ef3a871183d7
294 | user: test
294 | user: test
295 | date: Thu Jan 01 00:00:00 1970 +0000
295 | date: Thu Jan 01 00:00:00 1970 +0000
296 | summary: c
296 | summary: c
297 |
297 |
298 | o changeset: 3:443431ffac4f
298 | o changeset: 3:443431ffac4f
299 | | user: test
299 | | user: test
300 | | date: Thu Jan 01 00:00:00 1970 +0000
300 | | date: Thu Jan 01 00:00:00 1970 +0000
301 | | summary: e
301 | | summary: e
302 | |
302 | |
303 | o changeset: 2:65bd5f99a4a3
303 | o changeset: 2:65bd5f99a4a3
304 |/ user: test
304 |/ user: test
305 | date: Thu Jan 01 00:00:00 1970 +0000
305 | date: Thu Jan 01 00:00:00 1970 +0000
306 | summary: d
306 | summary: d
307 |
307 |
308 o changeset: 1:ef3a871183d7
308 o changeset: 1:ef3a871183d7
309 | user: test
309 | user: test
310 | date: Thu Jan 01 00:00:00 1970 +0000
310 | date: Thu Jan 01 00:00:00 1970 +0000
311 | summary: b
311 | summary: b
312 |
312 |
313 o changeset: 0:9ab35a2d17cb
313 o changeset: 0:9ab35a2d17cb
314 user: test
314 user: test
315 date: Thu Jan 01 00:00:00 1970 +0000
315 date: Thu Jan 01 00:00:00 1970 +0000
316 summary: a
316 summary: a
317
317
318
318
319 2 is parent of 3, only one strip should happen
319 2 is parent of 3, only one strip should happen
320
320
321 $ hg strip "roots(2)" 3
321 $ hg strip "roots(2)" 3
322 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
322 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
323 $ hg log -G
323 $ hg log -G
324 @ changeset: 2:264128213d29
324 @ changeset: 2:264128213d29
325 | tag: tip
325 | tag: tip
326 | user: test
326 | user: test
327 | date: Thu Jan 01 00:00:00 1970 +0000
327 | date: Thu Jan 01 00:00:00 1970 +0000
328 | summary: c
328 | summary: c
329 |
329 |
330 o changeset: 1:ef3a871183d7
330 o changeset: 1:ef3a871183d7
331 | user: test
331 | user: test
332 | date: Thu Jan 01 00:00:00 1970 +0000
332 | date: Thu Jan 01 00:00:00 1970 +0000
333 | summary: b
333 | summary: b
334 |
334 |
335 o changeset: 0:9ab35a2d17cb
335 o changeset: 0:9ab35a2d17cb
336 user: test
336 user: test
337 date: Thu Jan 01 00:00:00 1970 +0000
337 date: Thu Jan 01 00:00:00 1970 +0000
338 summary: a
338 summary: a
339
339
340 $ restore
340 $ restore
341 $ hg log -G
341 $ hg log -G
342 o changeset: 4:443431ffac4f
342 o changeset: 4:443431ffac4f
343 | tag: tip
343 | tag: tip
344 | user: test
344 | user: test
345 | date: Thu Jan 01 00:00:00 1970 +0000
345 | date: Thu Jan 01 00:00:00 1970 +0000
346 | summary: e
346 | summary: e
347 |
347 |
348 o changeset: 3:65bd5f99a4a3
348 o changeset: 3:65bd5f99a4a3
349 | parent: 1:ef3a871183d7
349 | parent: 1:ef3a871183d7
350 | user: test
350 | user: test
351 | date: Thu Jan 01 00:00:00 1970 +0000
351 | date: Thu Jan 01 00:00:00 1970 +0000
352 | summary: d
352 | summary: d
353 |
353 |
354 | @ changeset: 2:264128213d29
354 | @ changeset: 2:264128213d29
355 |/ user: test
355 |/ user: test
356 | date: Thu Jan 01 00:00:00 1970 +0000
356 | date: Thu Jan 01 00:00:00 1970 +0000
357 | summary: c
357 | summary: c
358 |
358 |
359 o changeset: 1:ef3a871183d7
359 o changeset: 1:ef3a871183d7
360 | user: test
360 | user: test
361 | date: Thu Jan 01 00:00:00 1970 +0000
361 | date: Thu Jan 01 00:00:00 1970 +0000
362 | summary: b
362 | summary: b
363 |
363 |
364 o changeset: 0:9ab35a2d17cb
364 o changeset: 0:9ab35a2d17cb
365 user: test
365 user: test
366 date: Thu Jan 01 00:00:00 1970 +0000
366 date: Thu Jan 01 00:00:00 1970 +0000
367 summary: a
367 summary: a
368
368
369
369
370 2 different branches: 2 strips
370 2 different branches: 2 strips
371
371
372 $ hg strip 2 4
372 $ hg strip 2 4
373 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
374 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
375 $ hg log -G
375 $ hg log -G
376 o changeset: 2:65bd5f99a4a3
376 o changeset: 2:65bd5f99a4a3
377 | tag: tip
377 | tag: tip
378 | user: test
378 | user: test
379 | date: Thu Jan 01 00:00:00 1970 +0000
379 | date: Thu Jan 01 00:00:00 1970 +0000
380 | summary: d
380 | summary: d
381 |
381 |
382 @ changeset: 1:ef3a871183d7
382 @ changeset: 1:ef3a871183d7
383 | user: test
383 | user: test
384 | date: Thu Jan 01 00:00:00 1970 +0000
384 | date: Thu Jan 01 00:00:00 1970 +0000
385 | summary: b
385 | summary: b
386 |
386 |
387 o changeset: 0:9ab35a2d17cb
387 o changeset: 0:9ab35a2d17cb
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: a
390 summary: a
391
391
392 $ restore
392 $ restore
393
393
394 2 different branches and a common ancestor: 1 strip
394 2 different branches and a common ancestor: 1 strip
395
395
396 $ hg strip 1 "2|4"
396 $ hg strip 1 "2|4"
397 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
397 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
398 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
399 $ restore
399 $ restore
400
400
401 verify fncache is kept up-to-date
401 verify fncache is kept up-to-date
402
402
403 $ touch a
403 $ touch a
404 $ hg ci -qAm a
404 $ hg ci -qAm a
405 $ cat .hg/store/fncache | sort
405 $ cat .hg/store/fncache | sort
406 data/a.i
406 data/a.i
407 data/bar.i
407 data/bar.i
408 $ hg strip tip
408 $ hg strip tip
409 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
409 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
410 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
410 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
411 $ cat .hg/store/fncache
411 $ cat .hg/store/fncache
412 data/bar.i
412 data/bar.i
413
413
414 stripping an empty revset
414 stripping an empty revset
415
415
416 $ hg strip "1 and not 1"
416 $ hg strip "1 and not 1"
417 abort: empty revision set
417 abort: empty revision set
418 [255]
418 [255]
419
419
420 remove branchy history for qimport tests
420 remove branchy history for qimport tests
421
421
422 $ hg strip 3
422 $ hg strip 3
423 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
423 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
424
424
425
425
426 strip of applied mq should cleanup status file
426 strip of applied mq should cleanup status file
427
427
428 $ echo "mq=" >> $HGRCPATH
428 $ echo "mq=" >> $HGRCPATH
429 $ hg up -C 3
429 $ hg up -C 3
430 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
430 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 $ echo fooagain >> bar
431 $ echo fooagain >> bar
432 $ hg ci -mf
432 $ hg ci -mf
433 $ hg qimport -r tip:2
433 $ hg qimport -r tip:2
434
434
435 applied patches before strip
435 applied patches before strip
436
436
437 $ hg qapplied
437 $ hg qapplied
438 d
438 d
439 e
439 e
440 f
440 f
441
441
442 stripping revision in queue
442 stripping revision in queue
443
443
444 $ hg strip 3
444 $ hg strip 3
445 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
446 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
446 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
447
447
448 applied patches after stripping rev in queue
448 applied patches after stripping rev in queue
449
449
450 $ hg qapplied
450 $ hg qapplied
451 d
451 d
452
452
453 stripping ancestor of queue
453 stripping ancestor of queue
454
454
455 $ hg strip 1
455 $ hg strip 1
456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
457 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
458
458
459 applied patches after stripping ancestor of queue
459 applied patches after stripping ancestor of queue
460
460
461 $ hg qapplied
461 $ hg qapplied
462
462
463 Verify strip protects against stripping wc parent when there are uncommitted mods
463 Verify strip protects against stripping wc parent when there are uncommitted mods
464
464
465 $ echo b > b
465 $ echo b > b
466 $ echo bb > bar
466 $ echo bb > bar
467 $ hg add b
467 $ hg add b
468 $ hg ci -m 'b'
468 $ hg ci -m 'b'
469 $ hg log --graph
469 $ hg log --graph
470 @ changeset: 1:76dcf9fab855
470 @ changeset: 1:76dcf9fab855
471 | tag: tip
471 | tag: tip
472 | user: test
472 | user: test
473 | date: Thu Jan 01 00:00:00 1970 +0000
473 | date: Thu Jan 01 00:00:00 1970 +0000
474 | summary: b
474 | summary: b
475 |
475 |
476 o changeset: 0:9ab35a2d17cb
476 o changeset: 0:9ab35a2d17cb
477 user: test
477 user: test
478 date: Thu Jan 01 00:00:00 1970 +0000
478 date: Thu Jan 01 00:00:00 1970 +0000
479 summary: a
479 summary: a
480
480
481 $ hg up 0
481 $ hg up 0
482 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
482 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
483 $ echo c > bar
483 $ echo c > bar
484 $ hg up -t false
484 $ hg up -t false
485 merging bar
485 merging bar
486 merging bar failed!
486 merging bar failed!
487 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
487 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
488 use 'hg resolve' to retry unresolved file merges
488 use 'hg resolve' to retry unresolved file merges
489 [1]
489 [1]
490 $ hg sum
490 $ hg sum
491 parent: 1:76dcf9fab855 tip
491 parent: 1:76dcf9fab855 tip
492 b
492 b
493 branch: default
493 branch: default
494 commit: 1 modified, 1 unknown, 1 unresolved
494 commit: 1 modified, 1 unknown, 1 unresolved
495 update: (current)
495 update: (current)
496 phases: 2 draft
496 phases: 2 draft
497 mq: 3 unapplied
497 mq: 3 unapplied
498
498
499 $ echo c > b
499 $ echo c > b
500 $ hg strip tip
500 $ hg strip tip
501 abort: local changes found
501 abort: local changes found
502 [255]
502 [255]
503 $ hg strip tip --keep
503 $ hg strip tip --keep
504 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
504 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
505 $ hg log --graph
505 $ hg log --graph
506 @ changeset: 0:9ab35a2d17cb
506 @ changeset: 0:9ab35a2d17cb
507 tag: tip
507 tag: tip
508 user: test
508 user: test
509 date: Thu Jan 01 00:00:00 1970 +0000
509 date: Thu Jan 01 00:00:00 1970 +0000
510 summary: a
510 summary: a
511
511
512 $ hg status
512 $ hg status
513 M bar
513 M bar
514 ? b
514 ? b
515 ? bar.orig
515 ? bar.orig
516
516
517 $ rm bar.orig
517 $ rm bar.orig
518 $ hg sum
518 $ hg sum
519 parent: 0:9ab35a2d17cb tip
519 parent: 0:9ab35a2d17cb tip
520 a
520 a
521 branch: default
521 branch: default
522 commit: 1 modified, 1 unknown
522 commit: 1 modified, 1 unknown
523 update: (current)
523 update: (current)
524 phases: 1 draft
524 phases: 1 draft
525 mq: 3 unapplied
525 mq: 3 unapplied
526
526
527 Strip adds, removes, modifies with --keep
527 Strip adds, removes, modifies with --keep
528
528
529 $ touch b
529 $ touch b
530 $ hg add b
530 $ hg add b
531 $ hg commit -mb
531 $ hg commit -mb
532 $ touch c
532 $ touch c
533
533
534 ... with a clean working dir
534 ... with a clean working dir
535
535
536 $ hg add c
536 $ hg add c
537 $ hg rm bar
537 $ hg rm bar
538 $ hg commit -mc
538 $ hg commit -mc
539 $ hg status
539 $ hg status
540 $ hg strip --keep tip
540 $ hg strip --keep tip
541 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
541 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
542 $ hg status
542 $ hg status
543 ! bar
543 ! bar
544 ? c
544 ? c
545
545
546 ... with a dirty working dir
546 ... with a dirty working dir
547
547
548 $ hg add c
548 $ hg add c
549 $ hg rm bar
549 $ hg rm bar
550 $ hg commit -mc
550 $ hg commit -mc
551 $ hg status
551 $ hg status
552 $ echo b > b
552 $ echo b > b
553 $ echo d > d
553 $ echo d > d
554 $ hg strip --keep tip
554 $ hg strip --keep tip
555 saved backup bundle to $TESTTMP/test/.hg/strip-backup/57e364c8a475-4cfed93c-backup.hg (glob)
555 saved backup bundle to $TESTTMP/test/.hg/strip-backup/57e364c8a475-4cfed93c-backup.hg (glob)
556 $ hg status
556 $ hg status
557 M b
557 M b
558 ! bar
558 ! bar
559 ? c
559 ? c
560 ? d
560 ? d
561 $ cd ..
561 $ cd ..
562
562
563 stripping many nodes on a complex graph (issue3299)
563 stripping many nodes on a complex graph (issue3299)
564
564
565 $ hg init issue3299
565 $ hg init issue3299
566 $ cd issue3299
566 $ cd issue3299
567 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
567 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
568 $ hg strip 'not ancestors(x)'
568 $ hg strip 'not ancestors(x)'
569 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
569 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
570
570
571 test hg strip -B bookmark
571 test hg strip -B bookmark
572
572
573 $ cd ..
573 $ cd ..
574 $ hg init bookmarks
574 $ hg init bookmarks
575 $ cd bookmarks
575 $ cd bookmarks
576 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b'
576 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
577 $ hg bookmark -r 'a' 'todelete'
577 $ hg bookmark -r 'a' 'todelete'
578 $ hg bookmark -r 'b' 'B'
578 $ hg bookmark -r 'b' 'B'
579 $ hg bookmark -r 'b' 'nostrip'
579 $ hg bookmark -r 'b' 'nostrip'
580 $ hg bookmark -r 'c' 'delete'
580 $ hg bookmark -r 'c' 'delete'
581 $ hg bookmark -r 'd' 'multipledelete1'
582 $ hg bookmark -r 'e' 'multipledelete2'
583 $ hg bookmark -r 'f' 'singlenode1'
584 $ hg bookmark -r 'f' 'singlenode2'
581 $ hg up -C todelete
585 $ hg up -C todelete
582 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
586 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 (activating bookmark todelete)
587 (activating bookmark todelete)
584 $ hg strip -B nostrip
588 $ hg strip -B nostrip
585 bookmark 'nostrip' deleted
589 bookmark 'nostrip' deleted
586 abort: empty revision set
590 abort: empty revision set
587 [255]
591 [255]
588 $ hg strip -B todelete
592 $ hg strip -B todelete
589 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
593 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
590 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
594 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
591 bookmark 'todelete' deleted
595 bookmark 'todelete' deleted
592 $ hg id -ir dcbb326fdec2
596 $ hg id -ir dcbb326fdec2
593 abort: unknown revision 'dcbb326fdec2'!
597 abort: unknown revision 'dcbb326fdec2'!
594 [255]
598 [255]
595 $ hg id -ir d62d843c9a01
599 $ hg id -ir d62d843c9a01
596 d62d843c9a01
600 d62d843c9a01
597 $ hg bookmarks
601 $ hg bookmarks
598 B 9:ff43616e5d0f
602 B 9:ff43616e5d0f
599 delete 6:2702dd0c91e7
603 delete 6:2702dd0c91e7
604 multipledelete1 11:e46a4836065c
605 multipledelete2 12:b4594d867745
606 singlenode1 13:43227190fef8
607 singlenode2 13:43227190fef8
608 $ hg strip -B multipledelete1 -B multipledelete2
609 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob)
610 bookmark 'multipledelete1' deleted
611 bookmark 'multipledelete2' deleted
612 $ hg id -ir e46a4836065c
613 abort: unknown revision 'e46a4836065c'!
614 [255]
615 $ hg id -ir b4594d867745
616 abort: unknown revision 'b4594d867745'!
617 [255]
618 $ hg strip -B singlenode1 -B singlenode2
619 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob)
620 bookmark 'singlenode1' deleted
621 bookmark 'singlenode2' deleted
622 $ hg id -ir 43227190fef8
623 abort: unknown revision '43227190fef8'!
624 [255]
625 $ hg strip -B unknownbookmark
626 abort: bookmark 'unknownbookmark' not found
627 [255]
628 $ hg strip -B unknownbookmark1 -B unknownbookmark2
629 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
630 [255]
631 $ hg strip -B delete -B unknownbookmark
632 abort: bookmark 'unknownbookmark' not found
633 [255]
600 $ hg strip -B delete
634 $ hg strip -B delete
601 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
635 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
602 bookmark 'delete' deleted
636 bookmark 'delete' deleted
603 $ hg id -ir 6:2702dd0c91e7
637 $ hg id -ir 6:2702dd0c91e7
604 abort: unknown revision '2702dd0c91e7'!
638 abort: unknown revision '2702dd0c91e7'!
605 [255]
639 [255]
606 $ hg update B
640 $ hg update B
607 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
608 (activating bookmark B)
642 (activating bookmark B)
609 $ echo a > a
643 $ echo a > a
610 $ hg add a
644 $ hg add a
611 $ hg strip -B B
645 $ hg strip -B B
612 abort: local changes found
646 abort: local changes found
613 [255]
647 [255]
614 $ hg bookmarks
648 $ hg bookmarks
615 * B 6:ff43616e5d0f
649 * B 6:ff43616e5d0f
616
650
617 Make sure no one adds back a -b option:
651 Make sure no one adds back a -b option:
618
652
619 $ hg strip -b tip
653 $ hg strip -b tip
620 hg strip: option -b not recognized
654 hg strip: option -b not recognized
621 hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...
655 hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...
622
656
623 strip changesets and all their descendants from the repository
657 strip changesets and all their descendants from the repository
624
658
625 (use "hg help -e strip" to show help for the strip extension)
659 (use "hg help -e strip" to show help for the strip extension)
626
660
627 options ([+] can be repeated):
661 options ([+] can be repeated):
628
662
629 -r --rev REV [+] strip specified revision (optional, can specify revisions
663 -r --rev REV [+] strip specified revision (optional, can specify
630 without this option)
664 revisions without this option)
631 -f --force force removal of changesets, discard uncommitted changes
665 -f --force force removal of changesets, discard uncommitted
632 (no backup)
666 changes (no backup)
633 --no-backup no backups
667 --no-backup no backups
634 -k --keep do not modify working directory during strip
668 -k --keep do not modify working directory during strip
635 -B --bookmark VALUE remove revs only reachable from given bookmark
669 -B --bookmark VALUE [+] remove revs only reachable from given bookmark
636 --mq operate on patch repository
670 --mq operate on patch repository
637
671
638 (use "hg strip -h" to show more help)
672 (use "hg strip -h" to show more help)
639 [255]
673 [255]
640
674
641 $ cd ..
675 $ cd ..
642
676
643 Verify bundles don't get overwritten:
677 Verify bundles don't get overwritten:
644
678
645 $ hg init doublebundle
679 $ hg init doublebundle
646 $ cd doublebundle
680 $ cd doublebundle
647 $ touch a
681 $ touch a
648 $ hg commit -Aqm a
682 $ hg commit -Aqm a
649 $ touch b
683 $ touch b
650 $ hg commit -Aqm b
684 $ hg commit -Aqm b
651 $ hg strip -r 0
685 $ hg strip -r 0
652 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
686 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
653 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob)
687 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg (glob)
654 $ ls .hg/strip-backup
688 $ ls .hg/strip-backup
655 3903775176ed-e68910bd-backup.hg
689 3903775176ed-e68910bd-backup.hg
656 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
690 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
657 $ hg strip -r 0
691 $ hg strip -r 0
658 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob)
692 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg (glob)
659 $ ls .hg/strip-backup
693 $ ls .hg/strip-backup
660 3903775176ed-54390173-backup.hg
694 3903775176ed-54390173-backup.hg
661 3903775176ed-e68910bd-backup.hg
695 3903775176ed-e68910bd-backup.hg
662 $ cd ..
696 $ cd ..
663
697
664 Test that we only bundle the stripped changesets (issue4736)
698 Test that we only bundle the stripped changesets (issue4736)
665 ------------------------------------------------------------
699 ------------------------------------------------------------
666
700
667 initialization (previous repo is empty anyway)
701 initialization (previous repo is empty anyway)
668
702
669 $ hg init issue4736
703 $ hg init issue4736
670 $ cd issue4736
704 $ cd issue4736
671 $ echo a > a
705 $ echo a > a
672 $ hg add a
706 $ hg add a
673 $ hg commit -m commitA
707 $ hg commit -m commitA
674 $ echo b > b
708 $ echo b > b
675 $ hg add b
709 $ hg add b
676 $ hg commit -m commitB
710 $ hg commit -m commitB
677 $ echo c > c
711 $ echo c > c
678 $ hg add c
712 $ hg add c
679 $ hg commit -m commitC
713 $ hg commit -m commitC
680 $ hg up 'desc(commitB)'
714 $ hg up 'desc(commitB)'
681 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
715 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
682 $ echo d > d
716 $ echo d > d
683 $ hg add d
717 $ hg add d
684 $ hg commit -m commitD
718 $ hg commit -m commitD
685 created new head
719 created new head
686 $ hg up 'desc(commitC)'
720 $ hg up 'desc(commitC)'
687 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
721 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
688 $ hg merge 'desc(commitD)'
722 $ hg merge 'desc(commitD)'
689 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
723 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
690 (branch merge, don't forget to commit)
724 (branch merge, don't forget to commit)
691 $ hg ci -m 'mergeCD'
725 $ hg ci -m 'mergeCD'
692 $ hg log -G
726 $ hg log -G
693 @ changeset: 4:d8db9d137221
727 @ changeset: 4:d8db9d137221
694 |\ tag: tip
728 |\ tag: tip
695 | | parent: 2:5c51d8d6557d
729 | | parent: 2:5c51d8d6557d
696 | | parent: 3:6625a5168474
730 | | parent: 3:6625a5168474
697 | | user: test
731 | | user: test
698 | | date: Thu Jan 01 00:00:00 1970 +0000
732 | | date: Thu Jan 01 00:00:00 1970 +0000
699 | | summary: mergeCD
733 | | summary: mergeCD
700 | |
734 | |
701 | o changeset: 3:6625a5168474
735 | o changeset: 3:6625a5168474
702 | | parent: 1:eca11cf91c71
736 | | parent: 1:eca11cf91c71
703 | | user: test
737 | | user: test
704 | | date: Thu Jan 01 00:00:00 1970 +0000
738 | | date: Thu Jan 01 00:00:00 1970 +0000
705 | | summary: commitD
739 | | summary: commitD
706 | |
740 | |
707 o | changeset: 2:5c51d8d6557d
741 o | changeset: 2:5c51d8d6557d
708 |/ user: test
742 |/ user: test
709 | date: Thu Jan 01 00:00:00 1970 +0000
743 | date: Thu Jan 01 00:00:00 1970 +0000
710 | summary: commitC
744 | summary: commitC
711 |
745 |
712 o changeset: 1:eca11cf91c71
746 o changeset: 1:eca11cf91c71
713 | user: test
747 | user: test
714 | date: Thu Jan 01 00:00:00 1970 +0000
748 | date: Thu Jan 01 00:00:00 1970 +0000
715 | summary: commitB
749 | summary: commitB
716 |
750 |
717 o changeset: 0:105141ef12d0
751 o changeset: 0:105141ef12d0
718 user: test
752 user: test
719 date: Thu Jan 01 00:00:00 1970 +0000
753 date: Thu Jan 01 00:00:00 1970 +0000
720 summary: commitA
754 summary: commitA
721
755
722
756
723 Check bundle behavior:
757 Check bundle behavior:
724
758
725 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
759 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
726 2 changesets found
760 2 changesets found
727 $ hg log -r 'bundle()' -R ../issue4736.hg
761 $ hg log -r 'bundle()' -R ../issue4736.hg
728 changeset: 3:6625a5168474
762 changeset: 3:6625a5168474
729 parent: 1:eca11cf91c71
763 parent: 1:eca11cf91c71
730 user: test
764 user: test
731 date: Thu Jan 01 00:00:00 1970 +0000
765 date: Thu Jan 01 00:00:00 1970 +0000
732 summary: commitD
766 summary: commitD
733
767
734 changeset: 4:d8db9d137221
768 changeset: 4:d8db9d137221
735 tag: tip
769 tag: tip
736 parent: 2:5c51d8d6557d
770 parent: 2:5c51d8d6557d
737 parent: 3:6625a5168474
771 parent: 3:6625a5168474
738 user: test
772 user: test
739 date: Thu Jan 01 00:00:00 1970 +0000
773 date: Thu Jan 01 00:00:00 1970 +0000
740 summary: mergeCD
774 summary: mergeCD
741
775
742
776
743 check strip behavior
777 check strip behavior
744
778
745 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
779 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
746 resolving manifests
780 resolving manifests
747 branchmerge: False, force: True, partial: False
781 branchmerge: False, force: True, partial: False
748 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
782 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
749 c: other deleted -> r
783 c: other deleted -> r
750 removing c
784 removing c
751 d: other deleted -> r
785 d: other deleted -> r
752 removing d
786 removing d
753 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
787 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
754 2 changesets found
788 2 changesets found
755 list of changesets:
789 list of changesets:
756 6625a516847449b6f0fa3737b9ba56e9f0f3032c
790 6625a516847449b6f0fa3737b9ba56e9f0f3032c
757 d8db9d1372214336d2b5570f20ee468d2c72fa8b
791 d8db9d1372214336d2b5570f20ee468d2c72fa8b
758 bundle2-output-bundle: "HG20", (1 params) 1 parts total
792 bundle2-output-bundle: "HG20", (1 params) 1 parts total
759 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
793 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
760 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
794 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
761 invalid branchheads cache (served): tip differs
795 invalid branchheads cache (served): tip differs
762 truncating cache/rbc-revs-v1 to 24
796 truncating cache/rbc-revs-v1 to 24
763 $ hg log -G
797 $ hg log -G
764 o changeset: 2:5c51d8d6557d
798 o changeset: 2:5c51d8d6557d
765 | tag: tip
799 | tag: tip
766 | user: test
800 | user: test
767 | date: Thu Jan 01 00:00:00 1970 +0000
801 | date: Thu Jan 01 00:00:00 1970 +0000
768 | summary: commitC
802 | summary: commitC
769 |
803 |
770 @ changeset: 1:eca11cf91c71
804 @ changeset: 1:eca11cf91c71
771 | user: test
805 | user: test
772 | date: Thu Jan 01 00:00:00 1970 +0000
806 | date: Thu Jan 01 00:00:00 1970 +0000
773 | summary: commitB
807 | summary: commitB
774 |
808 |
775 o changeset: 0:105141ef12d0
809 o changeset: 0:105141ef12d0
776 user: test
810 user: test
777 date: Thu Jan 01 00:00:00 1970 +0000
811 date: Thu Jan 01 00:00:00 1970 +0000
778 summary: commitA
812 summary: commitA
779
813
780
814
781 strip backup content
815 strip backup content
782
816
783 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
817 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
784 changeset: 3:6625a5168474
818 changeset: 3:6625a5168474
785 parent: 1:eca11cf91c71
819 parent: 1:eca11cf91c71
786 user: test
820 user: test
787 date: Thu Jan 01 00:00:00 1970 +0000
821 date: Thu Jan 01 00:00:00 1970 +0000
788 summary: commitD
822 summary: commitD
789
823
790 changeset: 4:d8db9d137221
824 changeset: 4:d8db9d137221
791 tag: tip
825 tag: tip
792 parent: 2:5c51d8d6557d
826 parent: 2:5c51d8d6557d
793 parent: 3:6625a5168474
827 parent: 3:6625a5168474
794 user: test
828 user: test
795 date: Thu Jan 01 00:00:00 1970 +0000
829 date: Thu Jan 01 00:00:00 1970 +0000
796 summary: mergeCD
830 summary: mergeCD
797
831
798
832
799 Error during post-close callback of the strip transaction
833 Error during post-close callback of the strip transaction
800 (They should be gracefully handled and reported)
834 (They should be gracefully handled and reported)
801
835
802 $ cat > ../crashstrip.py << EOF
836 $ cat > ../crashstrip.py << EOF
803 > from mercurial import error
837 > from mercurial import error
804 > def reposetup(ui, repo):
838 > def reposetup(ui, repo):
805 > class crashstriprepo(repo.__class__):
839 > class crashstriprepo(repo.__class__):
806 > def transaction(self, desc, *args, **kwargs):
840 > def transaction(self, desc, *args, **kwargs):
807 > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
841 > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
808 > if desc == 'strip':
842 > if desc == 'strip':
809 > def crash(tra): raise error.Abort('boom')
843 > def crash(tra): raise error.Abort('boom')
810 > tr.addpostclose('crash', crash)
844 > tr.addpostclose('crash', crash)
811 > return tr
845 > return tr
812 > repo.__class__ = crashstriprepo
846 > repo.__class__ = crashstriprepo
813 > EOF
847 > EOF
814 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
848 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
815 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
849 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
816 strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
850 strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob)
817 abort: boom
851 abort: boom
818 [255]
852 [255]
819
853
820
854
General Comments 0
You need to be logged in to leave comments. Login now