test-prune.t 20.2 KB
Newer Older
1
2
  $ cat >> $HGRCPATH <<EOF
  > [ui]
3
  > logtemplate={rev}:{node|short}[{bookmarks}] ({separate('/', obsolete ,phase)}) {desc|firstline}\n
4
5
  > [extensions]
  > EOF
6
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
7
8
9
10
11
12
13
14
15
16

  $ mkcommit() {
  >    echo "$1" > "$1"
  >    hg add "$1"
  >    hg ci -m "add $1"
  > }

  $ hg init repo
  $ cd repo
  $ mkcommit a
17
  $ hg phase --public .
18
19
20
21
  $ mkcommit b
  $ mkcommit c
  $ mkcommit d
  $ mkcommit e
Pierre-Yves David's avatar
Pierre-Yves David committed
22
  $ hg bookmarks BABAR
23
  $ hg log -G
24
  @  4:9d206ffc875e[BABAR] (draft) add e
25
  |
26
  o  3:47d2a3944de8[] (draft) add d
27
  |
28
  o  2:4538525df7e2[] (draft) add c
29
  |
30
  o  1:7c3bad9141dc[] (draft) add b
31
  |
32
  o  0:1f0dee641bb7[] (public) add a
33
34
  

35
36
37
Check arguments exclusive to each other
---------------------------------------

38
39
40
  $ hg prune --fold --pair
  abort: can only specify one of pair, fold
  [255]
41
  $ hg prune --fold --biject
42
  abort: no revisions specified to prune
43
44
45
46
  [255]
  $ hg prune --split --fold
  abort: can only specify one of fold, split
  [255]
47
48
49
  $ hg prune --split --fold --pair
  abort: can only specify one of pair, fold, split
  [255]
50
  $ hg prune --split --fold --biject
51
  abort: can only specify one of fold, split
52
53
  [255]

54
55
56
57
58
Check simple case
----------------------------

prune current and tip changeset

59
  $ hg prune --user blah --date '1979-12-15' .
60
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
61
  working directory is now at 47d2a3944de8
62
  1 changesets pruned
63
64
  $ hg bookmark
   * BABAR                     3:47d2a3944de8
65
  $ hg debugobsolete
66
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
67

68
prune leaving instability behind
69
70

  $ hg prune 1
71
  1 changesets pruned
72
  2 new orphan changesets
73
  $ hg book -i BABAR
74
  $ hg debugobsolete
75
76
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
77
78
79

pruning multiple changeset at once

80
81
82
83
(add color output to test it does not crash)

  $ hg prune 2: --color debug
  [ ui.status|0 files updated, 0 files merged, 3 files removed, 0 files unresolved]
84
  [ ui.status|working directory is now at [evolve.node|1f0dee641bb7]]
85
  [ ui.status|2 changesets pruned]
86
  $ hg debugobsolete
87
88
89
90
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
91

92
93
94
cannot prune public changesets

  $ hg prune 0
95
  abort: cannot prune public changesets: 1f0dee641bb7
96
  (see 'hg help phases' for details)
97
98
  [255]
  $ hg debugobsolete
99
100
101
102
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
Check successors addition
----------------------------

  $ mkcommit bb
  $ mkcommit cc
  $ mkcommit dd
  $ mkcommit ee
  $ hg up 0
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
  $ mkcommit nB
  created new head
  $ mkcommit nC
  $ mkcommit nD
  $ mkcommit nE

  $ hg log -G
120
  @  12:6e8148413dd5[] (draft) add nE
121
  |
122
  o  11:8ee176ff1d4b[] (draft) add nD
123
  |
124
  o  10:aa96dc3f04c2[] (draft) add nC
125
  |
126
  o  9:6f6f25e4f748[] (draft) add nB
127
  |
128
  | o  8:bb5e90a7ea1f[] (draft) add ee
129
  | |
130
  | o  7:00ded550b1e2[] (draft) add dd
131
  | |
132
  | o  6:354011cd103f[] (draft) add cc
133
  | |
134
  | o  5:814c38b95e72[] (draft) add bb
135
  |/
136
  o  0:1f0dee641bb7[BABAR] (public) add a
137
138
139
140
  

one old, one new

141
142
  $ hg up 'desc("add ee")'
  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
143
  $ hg prune 'desc("add ee")' -s 'desc("add nE")'
144
  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
145
  working directory is now at 6e8148413dd5
146
  1 changesets pruned
147
  $ hg debugobsolete
148
149
150
151
152
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
153
  $ hg log -G
154
  @  12:6e8148413dd5[] (draft) add nE
155
  |
156
  o  11:8ee176ff1d4b[] (draft) add nD
157
  |
158
  o  10:aa96dc3f04c2[] (draft) add nC
159
  |
160
  o  9:6f6f25e4f748[] (draft) add nB
161
  |
162
  | o  7:00ded550b1e2[] (draft) add dd
163
  | |
164
  | o  6:354011cd103f[] (draft) add cc
165
  | |
166
  | o  5:814c38b95e72[] (draft) add bb
167
  |/
168
  o  0:1f0dee641bb7[BABAR] (public) add a
169
170
171
172
173
  

one old, two new

  $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")'
174
175
176
  abort: please add --split if you want to do a split
  [255]
  $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")' --split
177
  1 changesets pruned
178
  $ hg debugobsolete
179
180
181
182
183
184
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
185
  $ hg log -G
186
  @  12:6e8148413dd5[] (draft) add nE
187
  |
188
  o  11:8ee176ff1d4b[] (draft) add nD
189
  |
190
  o  10:aa96dc3f04c2[] (draft) add nC
191
  |
192
  o  9:6f6f25e4f748[] (draft) add nB
193
  |
194
  | o  6:354011cd103f[] (draft) add cc
195
  | |
196
  | o  5:814c38b95e72[] (draft) add bb
197
  |/
198
  o  0:1f0dee641bb7[BABAR] (public) add a
199
200
201
202
203
204
  

two old, two new (should be denied)

  $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")'
  abort: Can't use multiple successors for multiple precursors
205
  (use --pair to mark a series as a replacement for another)
206
207
  [255]
  $ hg debugobsolete
208
209
210
211
212
213
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
214
215
216
217

two old, one new:

  $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")'
218
219
220
  abort: please add --fold if you want to do a fold
  [255]
  $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")' --fold
221
  2 changesets pruned
222
  $ hg debugobsolete
223
224
225
226
227
228
229
230
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
  354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
Levi Bard's avatar
Levi Bard committed
231

232
two old, two new with --pair (also test bookmark move)
Sean Farley's avatar
Sean Farley committed
233
234
235

  $ hg up 0
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
236
  $ hg bookmark prune-pair-book
Sean Farley's avatar
Sean Farley committed
237
238
239
240
  $ mkcommit n1
  created new head
  $ mkcommit n2

241
  $ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --pair
242
243
  4 files updated, 0 files merged, 2 files removed, 0 files unresolved
  working directory is now at 6e8148413dd5
244
  2 changesets pruned
Sean Farley's avatar
Sean Farley committed
245
  $ hg debugobsolete
246
247
248
249
250
251
252
253
254
255
  9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {7c3bad9141dcb46ff89abf5f61856facd56e476c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
  bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  814c38b95e72dfe2cbf675b1649ea9d780c89a80 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
  354011cd103f58bbbd9091a3cee6d6a6bd0dddf7 6f6f25e4f748d8f7571777e6e168aedf50350ce8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
  21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
256
257
  $ hg log --hidden -r 'desc("add n2") + desc("add nE") + bookmark("prune-pair-book")'
  14:21b6f2f1cece[] (obsolete/draft) add n2
258
  12:6e8148413dd5[prune-pair-book] (draft) add nE
Sean Farley's avatar
Sean Farley committed
259

260
261
262
test hg strip replacement

  $ hg up 10
263
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
264
  (leaving bookmark prune-pair-book)
265
266
267
268
269
  $ mkcommit n1
  created new head
  $ mkcommit n2
  $ hg --config extensions.strip= --config experimental.prunestrip=True strip -r .
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
270
  working directory is now at c7e58696a948
271
  1 changesets pruned
272
273
274
275
  $ hg --config extensions.strip= --config experimental.prunestrip=True strip -r . --bundle
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c7e58696a948-69ca36d3-backup.hg (glob)

276
277
278
279
280
281
282
283
284
285
286
287
288
289
test hg prune --keep
  $ mkcommit n1
  created new head
  $ hg diff -r .^
  diff -r aa96dc3f04c2 n1
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/n1	* +0000 (glob)
  @@ -0,0 +1,1 @@
  +n1
  $ hg prune -r . --keep
  1 changesets pruned
  $ hg status
  ? n1

Levi Bard's avatar
Levi Bard committed
290
291
292
293
294
295
test hg prune -B bookmark
yoinked from test-mq-strip.t

  $ cd ..
  $ hg init bookmarks
  $ cd bookmarks
296
  $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
Levi Bard's avatar
Levi Bard committed
297
298
299
300
  $ hg bookmark -r 'a' 'todelete'
  $ hg bookmark -r 'b' 'B'
  $ hg bookmark -r 'b' 'nostrip'
  $ hg bookmark -r 'c' 'delete'
301
302
303
304
  $ hg bookmark -r 'd' 'multipledelete1'
  $ hg bookmark -r 'e' 'multipledelete2'
  $ hg bookmark -r 'f' 'singlenode1'
  $ hg bookmark -r 'f' 'singlenode2'
Levi Bard's avatar
Levi Bard committed
305
306
  $ hg up -C todelete
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
307
  (activating bookmark todelete)
Levi Bard's avatar
Levi Bard committed
308
309
  $ hg prune -B nostrip
  bookmark 'nostrip' deleted
310
  abort: no revisions specified to prune
Levi Bard's avatar
Levi Bard committed
311
  [255]
312
  $ hg tag --remove --local a
Levi Bard's avatar
Levi Bard committed
313
314
  $ hg prune -B todelete
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
315
  (leaving bookmark todelete)
316
  working directory is now at d62d843c9a01
Levi Bard's avatar
Levi Bard committed
317
  bookmark 'todelete' deleted
318
  1 changesets pruned
Levi Bard's avatar
Levi Bard committed
319
  $ hg id -ir dcbb326fdec2
320
321
  abort: hidden revision 'dcbb326fdec2' is pruned!
  (use --hidden to access hidden revisions)
Levi Bard's avatar
Levi Bard committed
322
323
324
325
326
327
  [255]
  $ hg id -ir d62d843c9a01
  d62d843c9a01
  $ hg bookmarks
     B                         10:ff43616e5d0f
     delete                    6:2702dd0c91e7
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
     multipledelete1           12:e46a4836065c
     multipledelete2           13:b4594d867745
     singlenode1               14:43227190fef8
     singlenode2               14:43227190fef8
  $ hg prune -B multipledelete1 -B multipledelete2
  bookmark 'multipledelete1' deleted
  bookmark 'multipledelete2' deleted
  2 changesets pruned
  $ hg prune -B singlenode1 -B singlenode2
  bookmark 'singlenode1' deleted
  bookmark 'singlenode2' deleted
  1 changesets pruned
  $ hg prune -B unknownbookmark
  abort: bookmark 'unknownbookmark' not found
  [255]
  $ hg prune -B unknownbookmark1 -B unknownbookmark2
  abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
  [255]
  $ hg prune -B delete -B unknownbookmark
  abort: bookmark 'unknownbookmark' not found
  [255]
Levi Bard's avatar
Levi Bard committed
349
  $ hg prune -B delete
350
  bookmark 'delete' deleted
Levi Bard's avatar
Levi Bard committed
351
  3 changesets pruned
352
  $ hg tag --remove --local c
Levi Bard's avatar
Levi Bard committed
353
  $ hg id -ir 6:2702dd0c91e7
354
355
  abort: hidden revision '6' is pruned!
  (use --hidden to access hidden revisions)
Levi Bard's avatar
Levi Bard committed
356
357
  [255]

358
  $ hg debugobsstorestat
359
  markers total:                      7
360
      for known precursors:           7 (7/15 obsolete changesets)
361
      with parents data:              [04] (re)
362
  markers with no successors:         7
363
364
365
366
                1 successors:         0
                2 successors:         0
      more than 2 successors:         0
      available  keys:
367
                  ef1:                7
368
            operation:                7
369
                 user:                7
370
371
  marker size:
      format v1:
372
373
374
375
          smallest length:           91
          longer length:             91
          median length:             91
          mean length:               91
376
377
378
379
380
      format v0:
          smallest length:          * (glob)
          longer length:            * (glob)
          median length:            * (glob)
          mean length:              * (glob)
381
382
  disconnected clusters:              7
          any known node:             7
383
384
385
386
          smallest length:            1
          longer length:              1
          median length:              1
          mean length:                1
387
388
      using parents data:             7
          any known node:             7
389
          smallest length:            1
390
391
392
          longer length:              1
          median length:              1
          mean length:                1
393
394
395
396
397
398
399
400
401

  $ mkcommit rg
  created new head
  $ hg bookmark rg
  $ hg up 10
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  (leaving bookmark rg)
  $ hg bookmark r10
  $ hg log -G
402
  o  15:cd0038e05e1b[rg] (draft) add rg
403
  |
404
  | x  14:43227190fef8[] (obsolete/draft) r14
405
  | |
406
  | | x  13:b4594d867745[] (obsolete/draft) r13
407
  | | |
408
  | | | x  12:e46a4836065c[] (obsolete/draft) r12
409
  | | |/
410
  | | o  11:bab5d5bf48bd[] (draft) r11
411
  | |/
412
  +---@  10:ff43616e5d0f[B r10] (draft) r10
413
  | |
414
  o |  8:d62d843c9a01[] (draft) r8
415
  | |
416
  o |  7:e7d9710d9fc6[] (draft) r7
417
  |/
418
  o    3:2b6d669947cd[] (draft) r3
419
  |\
420
  | o  2:fa942426a6fd[] (draft) r2
421
  | |
422
  o |  1:66f7d451a68b[] (draft) r1
423
  |/
424
  o  0:1ea73414a91b[] (draft) r0
425
426
427
428
  
  $ hg prune 11
  1 changesets pruned
  $ hg log -G
429
  o  15:cd0038e05e1b[rg] (draft) add rg
430
  |
431
  | x  14:43227190fef8[] (obsolete/draft) r14
432
  | |
433
  | | x  13:b4594d867745[] (obsolete/draft) r13
434
  | | |
435
  | | | x  12:e46a4836065c[] (obsolete/draft) r12
436
  | | |/
437
  | | x  11:bab5d5bf48bd[] (obsolete/draft) r11
438
  | |/
439
  +---@  10:ff43616e5d0f[B r10] (draft) r10
440
  | |
441
  o |  8:d62d843c9a01[] (draft) r8
442
  | |
443
  o |  7:e7d9710d9fc6[] (draft) r7
444
  |/
445
  o    3:2b6d669947cd[] (draft) r3
446
  |\
447
  | o  2:fa942426a6fd[] (draft) r2
448
  | |
449
  o |  1:66f7d451a68b[] (draft) r1
450
  |/
451
  o  0:1ea73414a91b[] (draft) r0
452
  
453
454
455
456
457
458
459
  $ hg book CELESTE
  $ hg prune -r . --keep
  1 changesets pruned
  $ hg book
     B                         8:d62d843c9a01
   * CELESTE                   8:d62d843c9a01
     r10                       8:d62d843c9a01
460
     rg                        15:cd0038e05e1b
461

462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
  $ cd ..

Test that prune doesn't update off when pruning unrelated commit (issue6137)
----------------------------------------------------------------------------

  $ hg init issue6137
  $ cd issue6137
  $ echo a > a
  $ hg ci -Aqm "added a"
  $ echo b > b
  $ hg ci -Aqm "added b"

  $ hg prune .
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  working directory is now at 9092f1db7931
  1 changesets pruned

  $ echo c > c
  $ hg ci -Aqm "added c"

update to obsoleted revision and perform prune on unrelated revision:
  $ hg up -r "desc('added b')" --hidden -q
  updated to hidden changeset 5f6d8a4bf34a
  (hidden revision '5f6d8a4bf34a' is pruned)
  working directory parent is obsolete! (5f6d8a4bf34a)

  $ hg log -G
  o  2:29edef26570b[] (draft) added c
  |
  | @  1:5f6d8a4bf34a[] (obsolete/draft) added b
  |/
  o  0:9092f1db7931[] (draft) added a
  
  $ hg prune -r "desc('added c')"
  1 changesets pruned

  $ hg par
499
500
501
  1:5f6d8a4bf34a[] (obsolete/draft) added b
  working directory parent is obsolete! (5f6d8a4bf34a)
  (use 'hg evolve' to update to its parent successor)
502
503

  $ cd ..