##// END OF EJS Templates
tests: replace `hg id --debug -i` command substitution with non-debug command...
Matt Harbison -
r52837:2eeca9a8 default
parent child Browse files
Show More
@@ -1,795 +1,795
1 1 $ hg init repo
2 2 $ cd repo
3 3
4 4 committing changes
5 5
6 6 $ count=0
7 7 $ echo > a
8 8 $ while test $count -lt 32 ; do
9 9 > echo 'a' >> a
10 10 > test $count -eq 0 && hg add
11 11 > hg ci -m "msg $count" -d "$count 0"
12 12 > count=`expr $count + 1`
13 13 > done
14 14 adding a
15 15
16 16
17 17 $ hg log -G
18 18 @ changeset: 31:58c80a7c8a40
19 19 | tag: tip
20 20 | user: test
21 21 | date: Thu Jan 01 00:00:31 1970 +0000
22 22 | summary: msg 31
23 23 |
24 24 o changeset: 30:ed2d2f24b11c
25 25 | user: test
26 26 | date: Thu Jan 01 00:00:30 1970 +0000
27 27 | summary: msg 30
28 28 |
29 29 o changeset: 29:b5bd63375ab9
30 30 | user: test
31 31 | date: Thu Jan 01 00:00:29 1970 +0000
32 32 | summary: msg 29
33 33 |
34 34 o changeset: 28:8e0c2264c8af
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:28 1970 +0000
37 37 | summary: msg 28
38 38 |
39 39 o changeset: 27:288867a866e9
40 40 | user: test
41 41 | date: Thu Jan 01 00:00:27 1970 +0000
42 42 | summary: msg 27
43 43 |
44 44 o changeset: 26:3efc6fd51aeb
45 45 | user: test
46 46 | date: Thu Jan 01 00:00:26 1970 +0000
47 47 | summary: msg 26
48 48 |
49 49 o changeset: 25:02a84173a97a
50 50 | user: test
51 51 | date: Thu Jan 01 00:00:25 1970 +0000
52 52 | summary: msg 25
53 53 |
54 54 o changeset: 24:10e0acd3809e
55 55 | user: test
56 56 | date: Thu Jan 01 00:00:24 1970 +0000
57 57 | summary: msg 24
58 58 |
59 59 o changeset: 23:5ec79163bff4
60 60 | user: test
61 61 | date: Thu Jan 01 00:00:23 1970 +0000
62 62 | summary: msg 23
63 63 |
64 64 o changeset: 22:06c7993750ce
65 65 | user: test
66 66 | date: Thu Jan 01 00:00:22 1970 +0000
67 67 | summary: msg 22
68 68 |
69 69 o changeset: 21:e5db6aa3fe2a
70 70 | user: test
71 71 | date: Thu Jan 01 00:00:21 1970 +0000
72 72 | summary: msg 21
73 73 |
74 74 o changeset: 20:7128fb4fdbc9
75 75 | user: test
76 76 | date: Thu Jan 01 00:00:20 1970 +0000
77 77 | summary: msg 20
78 78 |
79 79 o changeset: 19:52798545b482
80 80 | user: test
81 81 | date: Thu Jan 01 00:00:19 1970 +0000
82 82 | summary: msg 19
83 83 |
84 84 o changeset: 18:86977a90077e
85 85 | user: test
86 86 | date: Thu Jan 01 00:00:18 1970 +0000
87 87 | summary: msg 18
88 88 |
89 89 o changeset: 17:03515f4a9080
90 90 | user: test
91 91 | date: Thu Jan 01 00:00:17 1970 +0000
92 92 | summary: msg 17
93 93 |
94 94 o changeset: 16:a2e6ea4973e9
95 95 | user: test
96 96 | date: Thu Jan 01 00:00:16 1970 +0000
97 97 | summary: msg 16
98 98 |
99 99 o changeset: 15:e7fa0811edb0
100 100 | user: test
101 101 | date: Thu Jan 01 00:00:15 1970 +0000
102 102 | summary: msg 15
103 103 |
104 104 o changeset: 14:ce8f0998e922
105 105 | user: test
106 106 | date: Thu Jan 01 00:00:14 1970 +0000
107 107 | summary: msg 14
108 108 |
109 109 o changeset: 13:9d7d07bc967c
110 110 | user: test
111 111 | date: Thu Jan 01 00:00:13 1970 +0000
112 112 | summary: msg 13
113 113 |
114 114 o changeset: 12:1941b52820a5
115 115 | user: test
116 116 | date: Thu Jan 01 00:00:12 1970 +0000
117 117 | summary: msg 12
118 118 |
119 119 o changeset: 11:7b4cd9578619
120 120 | user: test
121 121 | date: Thu Jan 01 00:00:11 1970 +0000
122 122 | summary: msg 11
123 123 |
124 124 o changeset: 10:7c5eff49a6b6
125 125 | user: test
126 126 | date: Thu Jan 01 00:00:10 1970 +0000
127 127 | summary: msg 10
128 128 |
129 129 o changeset: 9:eb44510ef29a
130 130 | user: test
131 131 | date: Thu Jan 01 00:00:09 1970 +0000
132 132 | summary: msg 9
133 133 |
134 134 o changeset: 8:453eb4dba229
135 135 | user: test
136 136 | date: Thu Jan 01 00:00:08 1970 +0000
137 137 | summary: msg 8
138 138 |
139 139 o changeset: 7:03750880c6b5
140 140 | user: test
141 141 | date: Thu Jan 01 00:00:07 1970 +0000
142 142 | summary: msg 7
143 143 |
144 144 o changeset: 6:a3d5c6fdf0d3
145 145 | user: test
146 146 | date: Thu Jan 01 00:00:06 1970 +0000
147 147 | summary: msg 6
148 148 |
149 149 o changeset: 5:7874a09ea728
150 150 | user: test
151 151 | date: Thu Jan 01 00:00:05 1970 +0000
152 152 | summary: msg 5
153 153 |
154 154 o changeset: 4:9b2ba8336a65
155 155 | user: test
156 156 | date: Thu Jan 01 00:00:04 1970 +0000
157 157 | summary: msg 4
158 158 |
159 159 o changeset: 3:b53bea5e2fcb
160 160 | user: test
161 161 | date: Thu Jan 01 00:00:03 1970 +0000
162 162 | summary: msg 3
163 163 |
164 164 o changeset: 2:db07c04beaca
165 165 | user: test
166 166 | date: Thu Jan 01 00:00:02 1970 +0000
167 167 | summary: msg 2
168 168 |
169 169 o changeset: 1:5cd978ea5149
170 170 | user: test
171 171 | date: Thu Jan 01 00:00:01 1970 +0000
172 172 | summary: msg 1
173 173 |
174 174 o changeset: 0:b99c7b9c8e11
175 175 user: test
176 176 date: Thu Jan 01 00:00:00 1970 +0000
177 177 summary: msg 0
178 178
179 179
180 180 $ hg up -C
181 181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 182
183 183 bisect test
184 184
185 185 $ hg bisect -r
186 186 $ hg bisect -b
187 187 $ hg status -v
188 188 # The repository is in an unfinished *bisect* state.
189 189
190 190 # To mark the changeset good: hg bisect --good
191 191 # To mark the changeset bad: hg bisect --bad
192 192 # To abort: hg bisect --reset
193 193
194 194 $ hg status -v --config commands.status.skipstates=bisect
195 195 $ hg summary
196 196 parent: 31:58c80a7c8a40 tip
197 197 msg 31
198 198 branch: default
199 199 commit: (clean)
200 200 update: (current)
201 201 phases: 32 draft
202 202 $ hg bisect -g 1
203 203 Testing changeset 16:a2e6ea4973e9 "msg 16" (30 changesets remaining, ~4 tests)
204 204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 205 $ hg bisect -g
206 206 Testing changeset 23:5ec79163bff4 "msg 23" (15 changesets remaining, ~3 tests)
207 207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 208
209 209 skip
210 210
211 211 $ hg bisect -s
212 212 Testing changeset 24:10e0acd3809e "msg 24" (15 changesets remaining, ~3 tests)
213 213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 214 $ hg bisect -g
215 215 Testing changeset 27:288867a866e9 "msg 27" (7 changesets remaining, ~2 tests)
216 216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 217 $ hg bisect -g
218 218 Testing changeset 29:b5bd63375ab9 "msg 29" (4 changesets remaining, ~2 tests)
219 219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 220 $ hg bisect -b
221 221 Testing changeset 28:8e0c2264c8af "msg 28" (2 changesets remaining, ~1 tests)
222 222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 223 $ hg bisect -g
224 224 The first bad revision is:
225 225 changeset: 29:b5bd63375ab9
226 226 user: test
227 227 date: Thu Jan 01 00:00:29 1970 +0000
228 228 summary: msg 29
229 229
230 230
231 231 mark revsets instead of single revs
232 232
233 233 $ hg bisect -r
234 234 $ hg bisect -b "0::3"
235 235 $ hg bisect -s "13::16"
236 236 $ hg bisect -g "26::tip"
237 237 Testing changeset 12:1941b52820a5 "msg 12" (23 changesets remaining, ~4 tests)
238 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 239 $ cat .hg/bisect.state
240 240 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
241 241 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
242 242 bad db07c04beaca44cf24832541e7f4a2346a95275b
243 243 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
244 244 current 1941b52820a544549596820a8ae006842b0e2c64
245 245 good 3efc6fd51aeb8594398044c6c846ca59ae021203
246 246 good 288867a866e9adb7a29880b66936c874b80f4651
247 247 good 8e0c2264c8af790daf3585ada0669d93dee09c83
248 248 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
249 249 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
250 250 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
251 251 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
252 252 skip ce8f0998e922c179e80819d5066fbe46e2998784
253 253 skip e7fa0811edb063f6319531f0d0a865882138e180
254 254 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
255 255
256 256 bisect reverse test
257 257
258 258 $ hg bisect -r
259 259 $ hg bisect -b null
260 260 $ hg bisect -g tip
261 261 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
262 262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 263 $ hg bisect -g
264 264 Testing changeset 7:03750880c6b5 "msg 7" (16 changesets remaining, ~4 tests)
265 265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 266
267 267 skip
268 268
269 269 $ hg bisect -s
270 270 Testing changeset 6:a3d5c6fdf0d3 "msg 6" (16 changesets remaining, ~4 tests)
271 271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 272 $ hg bisect -g
273 273 Testing changeset 2:db07c04beaca "msg 2" (7 changesets remaining, ~2 tests)
274 274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 275 $ hg bisect -g
276 276 Testing changeset 0:b99c7b9c8e11 "msg 0" (3 changesets remaining, ~1 tests)
277 277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 278 $ hg bisect -b
279 279 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
280 280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 281 $ hg bisect -g
282 282 The first good revision is:
283 283 changeset: 1:5cd978ea5149
284 284 user: test
285 285 date: Thu Jan 01 00:00:01 1970 +0000
286 286 summary: msg 1
287 287
288 288
289 289 $ hg bisect -r
290 290 $ hg bisect -g tip
291 291 $ hg bisect -b tip
292 292 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
293 293 [255]
294 294
295 295 $ hg bisect -r
296 296 $ hg bisect -g null
297 297 $ hg bisect -bU tip
298 298 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
299 299 $ hg id
300 300 5cd978ea5149
301 301
302 302
303 303 Issue1228: hg bisect crashes when you skip the last rev in bisection
304 304 Issue1182: hg bisect exception
305 305
306 306 $ hg bisect -r
307 307 $ hg bisect -b 4
308 308 $ hg bisect -g 0
309 309 Testing changeset 2:db07c04beaca "msg 2" (4 changesets remaining, ~2 tests)
310 310 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 311 $ hg bisect -s
312 312 Testing changeset 1:5cd978ea5149 "msg 1" (4 changesets remaining, ~2 tests)
313 313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 314 $ hg bisect -s
315 315 Testing changeset 3:b53bea5e2fcb "msg 3" (4 changesets remaining, ~2 tests)
316 316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 317 $ hg bisect -s
318 318 Due to skipped revisions, the first bad revision could be any of:
319 319 changeset: 1:5cd978ea5149
320 320 user: test
321 321 date: Thu Jan 01 00:00:01 1970 +0000
322 322 summary: msg 1
323 323
324 324 changeset: 2:db07c04beaca
325 325 user: test
326 326 date: Thu Jan 01 00:00:02 1970 +0000
327 327 summary: msg 2
328 328
329 329 changeset: 3:b53bea5e2fcb
330 330 user: test
331 331 date: Thu Jan 01 00:00:03 1970 +0000
332 332 summary: msg 3
333 333
334 334 changeset: 4:9b2ba8336a65
335 335 user: test
336 336 date: Thu Jan 01 00:00:04 1970 +0000
337 337 summary: msg 4
338 338
339 339
340 340
341 341 reproduce non converging bisect, issue1182
342 342
343 343 $ hg bisect -r
344 344 $ hg bisect -g 0
345 345 $ hg bisect -b 2
346 346 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
347 347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 348 $ hg bisect -s
349 349 Due to skipped revisions, the first bad revision could be any of:
350 350 changeset: 1:5cd978ea5149
351 351 user: test
352 352 date: Thu Jan 01 00:00:01 1970 +0000
353 353 summary: msg 1
354 354
355 355 changeset: 2:db07c04beaca
356 356 user: test
357 357 date: Thu Jan 01 00:00:02 1970 +0000
358 358 summary: msg 2
359 359
360 360
361 361
362 362 test no action
363 363
364 364 $ hg bisect -r
365 365 $ hg bisect
366 366 abort: cannot bisect (no known good revisions)
367 367 [20]
368 368
369 369
370 370 reproduce AssertionError, issue1445
371 371
372 372 $ hg bisect -r
373 373 $ hg bisect -b 6
374 374 $ hg bisect -g 0
375 375 Testing changeset 3:b53bea5e2fcb "msg 3" (6 changesets remaining, ~2 tests)
376 376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 377 $ hg bisect -s
378 378 Testing changeset 2:db07c04beaca "msg 2" (6 changesets remaining, ~2 tests)
379 379 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 380 $ hg bisect -s
381 381 Testing changeset 4:9b2ba8336a65 "msg 4" (6 changesets remaining, ~2 tests)
382 382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 383 $ hg bisect -s
384 384 Testing changeset 1:5cd978ea5149 "msg 1" (6 changesets remaining, ~2 tests)
385 385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 386 $ hg bisect -s
387 387 Testing changeset 5:7874a09ea728 "msg 5" (6 changesets remaining, ~2 tests)
388 388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 389 $ hg bisect -g
390 390 The first bad revision is:
391 391 changeset: 6:a3d5c6fdf0d3
392 392 user: test
393 393 date: Thu Jan 01 00:00:06 1970 +0000
394 394 summary: msg 6
395 395
396 396 $ hg log -r "bisect(good)"
397 397 changeset: 0:b99c7b9c8e11
398 398 user: test
399 399 date: Thu Jan 01 00:00:00 1970 +0000
400 400 summary: msg 0
401 401
402 402 changeset: 5:7874a09ea728
403 403 user: test
404 404 date: Thu Jan 01 00:00:05 1970 +0000
405 405 summary: msg 5
406 406
407 407 $ hg log -r "bisect(bad)"
408 408 changeset: 6:a3d5c6fdf0d3
409 409 user: test
410 410 date: Thu Jan 01 00:00:06 1970 +0000
411 411 summary: msg 6
412 412
413 413 $ hg log -r "bisect(current)"
414 414 changeset: 5:7874a09ea728
415 415 user: test
416 416 date: Thu Jan 01 00:00:05 1970 +0000
417 417 summary: msg 5
418 418
419 419 $ hg log -r "bisect(skip)"
420 420 changeset: 1:5cd978ea5149
421 421 user: test
422 422 date: Thu Jan 01 00:00:01 1970 +0000
423 423 summary: msg 1
424 424
425 425 changeset: 2:db07c04beaca
426 426 user: test
427 427 date: Thu Jan 01 00:00:02 1970 +0000
428 428 summary: msg 2
429 429
430 430 changeset: 3:b53bea5e2fcb
431 431 user: test
432 432 date: Thu Jan 01 00:00:03 1970 +0000
433 433 summary: msg 3
434 434
435 435 changeset: 4:9b2ba8336a65
436 436 user: test
437 437 date: Thu Jan 01 00:00:04 1970 +0000
438 438 summary: msg 4
439 439
440 440
441 441 test legacy bisected() keyword
442 442
443 443 $ hg log -r "bisected(bad)"
444 444 changeset: 6:a3d5c6fdf0d3
445 445 user: test
446 446 date: Thu Jan 01 00:00:06 1970 +0000
447 447 summary: msg 6
448 448
449 449
450 450 $ set +e
451 451
452 452 test invalid command
453 453 assuming that the shell returns 127 if command not found ...
454 454
455 455 $ hg bisect -r
456 456 $ hg bisect --command 'exit 127'
457 457 abort: failed to execute exit 127
458 458 [255]
459 459
460 460
461 461 test bisecting command
462 462
463 463 $ cat > "$TESTTMP/script.py" <<EOF
464 464 > #!$PYTHON
465 465 > import sys
466 466 > from mercurial import hg, ui as uimod
467 467 > repo = hg.repository(uimod.ui.load(), b'.')
468 468 > if repo[b'.'].rev() < 6:
469 469 > sys.exit(1)
470 470 > EOF
471 471 $ chmod +x "$TESTTMP/script.py"
472 472 $ hg bisect -r
473 473 $ hg up -qr tip
474 474 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
475 475 changeset 31:58c80a7c8a40 tip "msg 31": good
476 476 abort: cannot bisect (no known bad revisions)
477 477 [20]
478 478 $ hg up -qr 0
479 479 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
480 480 changeset 0:b99c7b9c8e11 "msg 0": bad
481 481 changeset 15:e7fa0811edb0 "msg 15": good
482 482 changeset 7:03750880c6b5 "msg 7": good
483 483 changeset 3:b53bea5e2fcb "msg 3": bad
484 484 changeset 5:7874a09ea728 "msg 5": bad
485 485 changeset 6:a3d5c6fdf0d3 "msg 6": good
486 486 The first good revision is:
487 487 changeset: 6:a3d5c6fdf0d3
488 488 user: test
489 489 date: Thu Jan 01 00:00:06 1970 +0000
490 490 summary: msg 6
491 491
492 492
493 493
494 494 test bisecting via a command without updating the working dir, and
495 495 ensure that the bisect state file is updated before running a test
496 496 command
497 497
498 498 $ hg update null
499 499 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
500 500 $ cat > "$TESTTMP/script.sh" <<'EOF'
501 501 > #!/bin/sh
502 502 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
503 503 > current="`hg log -r \"bisect(current)\" --template {node}`"
504 504 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
505 505 > rev="`hg log -r $HG_NODE --template {rev}`"
506 506 > test "$rev" -ge 6
507 507 > EOF
508 508 $ chmod +x "$TESTTMP/script.sh"
509 509 $ hg bisect -r
510 510 $ hg bisect --good tip --noupdate
511 511 $ hg bisect --bad 0 --noupdate
512 512 Testing changeset 15:e7fa0811edb0 "msg 15" (31 changesets remaining, ~4 tests)
513 513 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
514 514 changeset 15:e7fa0811edb0 "msg 15": good
515 515 changeset 7:03750880c6b5 "msg 7": good
516 516 changeset 3:b53bea5e2fcb "msg 3": bad
517 517 changeset 5:7874a09ea728 "msg 5": bad
518 518 changeset 6:a3d5c6fdf0d3 "msg 6": good
519 519 The first good revision is:
520 520 changeset: 6:a3d5c6fdf0d3
521 521 user: test
522 522 date: Thu Jan 01 00:00:06 1970 +0000
523 523 summary: msg 6
524 524
525 525
526 526 ensure that we still don't have a working dir
527 527
528 528 $ hg parents
529 529
530 530
531 531 test the same case, this time with updating
532 532
533 533 $ cat > "$TESTTMP/script.sh" <<'EOF'
534 534 > #!/bin/sh
535 535 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
536 536 > current="`hg log -r \"bisect(current)\" --template {node}`"
537 537 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
538 538 > rev="`hg log -r . --template {rev}`"
539 539 > test "$rev" -ge 6
540 540 > EOF
541 541 $ chmod +x "$TESTTMP/script.sh"
542 542 $ hg bisect -r
543 543 $ hg up -qr tip
544 544 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
545 545 changeset 31:58c80a7c8a40 tip "msg 31": good
546 546 abort: cannot bisect (no known bad revisions)
547 547 [20]
548 548 $ hg up -qr 0
549 549 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
550 550 changeset 0:b99c7b9c8e11 "msg 0": bad
551 551 changeset 15:e7fa0811edb0 "msg 15": good
552 552 changeset 7:03750880c6b5 "msg 7": good
553 553 changeset 3:b53bea5e2fcb "msg 3": bad
554 554 changeset 5:7874a09ea728 "msg 5": bad
555 555 changeset 6:a3d5c6fdf0d3 "msg 6": good
556 556 The first good revision is:
557 557 changeset: 6:a3d5c6fdf0d3
558 558 user: test
559 559 date: Thu Jan 01 00:00:06 1970 +0000
560 560 summary: msg 6
561 561
562 562 $ hg graft -q 15
563 563 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
564 564 abort: unresolved conflicts, can't continue
565 565 (use 'hg resolve' and 'hg graft --continue')
566 566 [1]
567 567 $ hg bisect --reset
568 568 $ hg up -C .
569 569 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
570 570
571 571 Check that bisect does not break on obsolete changesets
572 572 =========================================================
573 573
574 574 $ cat >> $HGRCPATH << EOF
575 575 > [experimental]
576 576 > evolution.createmarkers=True
577 577 > EOF
578 578
579 579 tip is obsolete
580 580 ---------------------
581 581
582 $ hg debugobsolete `hg id --debug -i -r tip`
582 $ hg debugobsolete `hg id -T "{node}" -r tip`
583 583 1 new obsolescence markers
584 584 obsoleted 1 changesets
585 585 $ hg bisect --reset
586 586 $ hg bisect --good 15
587 587 $ hg bisect --bad 30
588 588 Testing changeset 22:06c7993750ce "msg 22" (15 changesets remaining, ~3 tests)
589 589 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
590 590 $ hg bisect --command true
591 591 changeset 22:06c7993750ce "msg 22": good
592 592 changeset 26:3efc6fd51aeb "msg 26": good
593 593 changeset 28:8e0c2264c8af "msg 28": good
594 594 changeset 29:b5bd63375ab9 "msg 29": good
595 595 The first bad revision is:
596 596 changeset: 30:ed2d2f24b11c
597 597 tag: tip
598 598 user: test
599 599 date: Thu Jan 01 00:00:30 1970 +0000
600 600 summary: msg 30
601 601
602 602
603 603 Rewritten commits should not crash
604 604
605 605 $ hg co 29
606 606 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 607 $ hg revert --all -r 30
608 608 reverting a
609 609 $ hg commit -m 'msg 30 -- fixed'
610 610 created new head
611 $ hg debugobsolete `hg id --debug -i -r 30` `hg id --debug -i -r .`
611 $ hg debugobsolete `hg id -T "{node}" -r 30` `hg id -T "{node}" -r .`
612 612 1 new obsolescence markers
613 613 obsoleted 1 changesets
614 614 $ hg bisect
615 615 The first bad revision is:
616 616 changeset: 30:ed2d2f24b11c
617 617 user: test
618 618 date: Thu Jan 01 00:00:30 1970 +0000
619 619 obsolete: rewritten as 32:8a638ebd1122
620 620 summary: msg 30
621 621
622 622
623 623 Log template does not crash
624 624
625 625 $ hg log -GTbisect -r 15::
626 626 @ changeset: 32:8a638ebd1122
627 627 | bisect: good (implicit)
628 628 | tag: tip
629 629 | parent: 29:b5bd63375ab9
630 630 | user: test
631 631 | date: Thu Jan 01 00:00:00 1970 +0000
632 632 | summary: msg 30 -- fixed
633 633 |
634 634 o changeset: 29:b5bd63375ab9
635 635 | bisect: good
636 636 | user: test
637 637 | date: Thu Jan 01 00:00:29 1970 +0000
638 638 | summary: msg 29
639 639 |
640 640 o changeset: 28:8e0c2264c8af
641 641 | bisect: good
642 642 | user: test
643 643 | date: Thu Jan 01 00:00:28 1970 +0000
644 644 | summary: msg 28
645 645 |
646 646 o changeset: 27:288867a866e9
647 647 | bisect: ignored
648 648 | user: test
649 649 | date: Thu Jan 01 00:00:27 1970 +0000
650 650 | summary: msg 27
651 651 |
652 652 o changeset: 26:3efc6fd51aeb
653 653 | bisect: good
654 654 | user: test
655 655 | date: Thu Jan 01 00:00:26 1970 +0000
656 656 | summary: msg 26
657 657 |
658 658 o changeset: 25:02a84173a97a
659 659 | bisect: ignored
660 660 | user: test
661 661 | date: Thu Jan 01 00:00:25 1970 +0000
662 662 | summary: msg 25
663 663 |
664 664 o changeset: 24:10e0acd3809e
665 665 | bisect: ignored
666 666 | user: test
667 667 | date: Thu Jan 01 00:00:24 1970 +0000
668 668 | summary: msg 24
669 669 |
670 670 o changeset: 23:5ec79163bff4
671 671 | bisect: ignored
672 672 | user: test
673 673 | date: Thu Jan 01 00:00:23 1970 +0000
674 674 | summary: msg 23
675 675 |
676 676 o changeset: 22:06c7993750ce
677 677 | bisect: good
678 678 | user: test
679 679 | date: Thu Jan 01 00:00:22 1970 +0000
680 680 | summary: msg 22
681 681 |
682 682 o changeset: 21:e5db6aa3fe2a
683 683 | bisect: ignored
684 684 | user: test
685 685 | date: Thu Jan 01 00:00:21 1970 +0000
686 686 | summary: msg 21
687 687 |
688 688 o changeset: 20:7128fb4fdbc9
689 689 | bisect: ignored
690 690 | user: test
691 691 | date: Thu Jan 01 00:00:20 1970 +0000
692 692 | summary: msg 20
693 693 |
694 694 o changeset: 19:52798545b482
695 695 | bisect: ignored
696 696 | user: test
697 697 | date: Thu Jan 01 00:00:19 1970 +0000
698 698 | summary: msg 19
699 699 |
700 700 o changeset: 18:86977a90077e
701 701 | bisect: ignored
702 702 | user: test
703 703 | date: Thu Jan 01 00:00:18 1970 +0000
704 704 | summary: msg 18
705 705 |
706 706 o changeset: 17:03515f4a9080
707 707 | bisect: ignored
708 708 | user: test
709 709 | date: Thu Jan 01 00:00:17 1970 +0000
710 710 | summary: msg 17
711 711 |
712 712 o changeset: 16:a2e6ea4973e9
713 713 | bisect: ignored
714 714 | user: test
715 715 | date: Thu Jan 01 00:00:16 1970 +0000
716 716 | summary: msg 16
717 717 |
718 718 o changeset: 15:e7fa0811edb0
719 719 | bisect: good
720 720 ~ user: test
721 721 date: Thu Jan 01 00:00:15 1970 +0000
722 722 summary: msg 15
723 723
724 724 $ hg debugobsolete --delete `hg debugobsolete --index -T'{index}\n' | tail -1`
725 725 deleted 1 obsolescence markers
726 726
727 727 Changeset in the bad:good range is obsolete
728 728 ---------------------------------------------
729 729
730 730 $ hg up 30
731 731 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
732 732 $ echo 'a' >> a
733 733 $ hg ci -m "msg 32" -d "32 0"
734 734 $ hg bisect --reset
735 735 $ hg bisect --good .
736 736 $ hg bisect --bad 25
737 737 Testing changeset 28:8e0c2264c8af "msg 28" (6 changesets remaining, ~2 tests)
738 738 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
739 739 $ hg bisect --command true
740 740 changeset 28:8e0c2264c8af "msg 28": good
741 741 changeset 26:3efc6fd51aeb "msg 26": good
742 742 The first good revision is:
743 743 changeset: 26:3efc6fd51aeb
744 744 user: test
745 745 date: Thu Jan 01 00:00:26 1970 +0000
746 746 summary: msg 26
747 747
748 748 Test the validation message when exclusive options are used:
749 749
750 750 $ hg bisect -r
751 751 $ hg bisect -b -c false
752 752 abort: --bad and --command are incompatible
753 753 [10]
754 754 $ hg bisect -b -e
755 755 abort: --bad and --extend are incompatible
756 756 [10]
757 757 $ hg bisect -b -g
758 758 abort: --bad and --good are incompatible
759 759 [10]
760 760 $ hg bisect -b -r
761 761 abort: --bad and --reset are incompatible
762 762 [10]
763 763 $ hg bisect -b -s
764 764 abort: --bad and --skip are incompatible
765 765 [10]
766 766 $ hg bisect -c false -e
767 767 abort: --command and --extend are incompatible
768 768 [10]
769 769 $ hg bisect -c false -g
770 770 abort: --command and --good are incompatible
771 771 [10]
772 772 $ hg bisect -c false -r
773 773 abort: --command and --reset are incompatible
774 774 [10]
775 775 $ hg bisect -c false -s
776 776 abort: --command and --skip are incompatible
777 777 [10]
778 778 $ hg bisect -e -g
779 779 abort: --extend and --good are incompatible
780 780 [10]
781 781 $ hg bisect -e -r
782 782 abort: --extend and --reset are incompatible
783 783 [10]
784 784 $ hg bisect -e -s
785 785 abort: --extend and --skip are incompatible
786 786 [10]
787 787 $ hg bisect -g -r
788 788 abort: --good and --reset are incompatible
789 789 [10]
790 790 $ hg bisect -g -s
791 791 abort: --good and --skip are incompatible
792 792 [10]
793 793 $ hg bisect -r -s
794 794 abort: --reset and --skip are incompatible
795 795 [10]
@@ -1,665 +1,665
1 1 #require no-reposimplestore
2 2 #testcases revlogv1 revlogv2
3 3
4 4 #if revlogv2
5 5
6 6 $ cat >> $HGRCPATH <<EOF
7 7 > [experimental]
8 8 > revlogv2=enable-unstable-format-and-corrupt-my-data
9 9 > EOF
10 10
11 11 #endif
12 12
13 13 $ cp $HGRCPATH $HGRCPATH.orig
14 14
15 15 Create repo with unimpeachable content
16 16
17 17 $ hg init r
18 18 $ cd r
19 19 $ echo 'Initially untainted file' > target
20 20 $ echo 'Normal file here' > bystander
21 21 $ hg add target bystander
22 22 $ hg ci -m init
23 23
24 24 Clone repo so we can test pull later
25 25
26 26 $ cd ..
27 27 $ hg clone r rpull
28 28 updating to branch default
29 29 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30 $ cd r
31 31
32 32 Introduce content which will ultimately require censorship. Name the first
33 33 censored node C1, second C2, and so on
34 34
35 35 $ echo 'Tainted file' > target
36 36 $ echo 'Passwords: hunter2' >> target
37 37 $ hg ci -m taint target
38 $ C1=`hg id --debug -i`
38 $ C1=`hg id -r . -T "{node}"`
39 39
40 40 $ echo 'hunter3' >> target
41 41 $ echo 'Normal file v2' > bystander
42 42 $ hg ci -m moretaint target bystander
43 $ C2=`hg id --debug -i`
43 $ C2=`hg id -r . -T "{node}"`
44 44
45 45 Add a new sanitized versions to correct our mistake. Name the first head H1,
46 46 the second head H2, and so on
47 47
48 48 $ echo 'Tainted file is now sanitized' > target
49 49 $ hg ci -m sanitized target
50 $ H1=`hg id --debug -i`
50 $ H1=`hg id -r . -T "{node}"`
51 51
52 52 $ hg update -r $C2
53 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 54 $ echo 'Tainted file now super sanitized' > target
55 55 $ hg ci -m 'super sanitized' target
56 56 created new head
57 $ H2=`hg id --debug -i`
57 $ H2=`hg id -r . -T "{node}"`
58 58
59 59 Verify target contents before censorship at each revision
60 60
61 61 $ hg cat -r $H1 target | head -n 10
62 62 Tainted file is now sanitized
63 63 $ hg cat -r $H2 target | head -n 10
64 64 Tainted file now super sanitized
65 65 $ hg cat -r $C2 target | head -n 10
66 66 Tainted file
67 67 Passwords: hunter2
68 68 hunter3
69 69 $ hg cat -r $C1 target | head -n 10
70 70 Tainted file
71 71 Passwords: hunter2
72 72 $ hg cat -r 0 target | head -n 10
73 73 Initially untainted file
74 74
75 75 Censor revision with 2 offenses
76 76
77 77 (this also tests file pattern matching: path relative to cwd case)
78 78
79 79 $ mkdir -p foo/bar/baz
80 80 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target
81 81 checking for the censored content in 2 heads
82 82 checking for the censored content in the working directory
83 83 censoring 1 file revisions
84 84 $ hg cat -r $H1 target | head -n 10
85 85 Tainted file is now sanitized
86 86 $ hg cat -r $H2 target | head -n 10
87 87 Tainted file now super sanitized
88 88 $ hg cat -r $C2 target | head -n 10
89 89 abort: censored node: 1e0247a9a4b7
90 90 (set censor.policy to ignore errors)
91 91 $ hg cat -r $C1 target | head -n 10
92 92 Tainted file
93 93 Passwords: hunter2
94 94 $ hg cat -r 0 target | head -n 10
95 95 Initially untainted file
96 96
97 97 Censor revision with 1 offense
98 98
99 99 (this also tests file pattern matching: with 'path:' scheme)
100 100
101 101 $ hg --config extensions.censor= --cwd foo/bar/baz censor -r $C1 path:target
102 102 checking for the censored content in 2 heads
103 103 checking for the censored content in the working directory
104 104 censoring 1 file revisions
105 105 $ hg cat -r $H1 target | head -n 10
106 106 Tainted file is now sanitized
107 107 $ hg cat -r $H2 target | head -n 10
108 108 Tainted file now super sanitized
109 109 $ hg cat -r $C2 target | head -n 10
110 110 abort: censored node: 1e0247a9a4b7
111 111 (set censor.policy to ignore errors)
112 112 $ hg cat -r $C1 target | head -n 10
113 113 abort: censored node: 613bc869fceb
114 114 (set censor.policy to ignore errors)
115 115 $ hg cat -r 0 target | head -n 10
116 116 Initially untainted file
117 117
118 118 Can only checkout target at uncensored revisions, -X is workaround for --all
119 119
120 120 $ hg revert -r $C2 target | head -n 10
121 121 abort: censored node: 1e0247a9a4b7
122 122 (set censor.policy to ignore errors)
123 123 $ hg revert -r $C1 target | head -n 10
124 124 abort: censored node: 613bc869fceb
125 125 (set censor.policy to ignore errors)
126 126 $ hg revert -r $C1 --all
127 127 reverting bystander
128 128 reverting target
129 129 abort: censored node: 613bc869fceb
130 130 (set censor.policy to ignore errors)
131 131 [255]
132 132 $ hg revert -r $C1 --all -X target
133 133 $ cat target | head -n 10
134 134 Tainted file now super sanitized
135 135 $ hg revert -r 0 --all
136 136 reverting target
137 137 $ cat target | head -n 10
138 138 Initially untainted file
139 139 $ hg revert -r $H2 --all
140 140 reverting bystander
141 141 reverting target
142 142 $ cat target | head -n 10
143 143 Tainted file now super sanitized
144 144
145 145 Uncensored file can be viewed at any revision
146 146
147 147 $ hg cat -r $H1 bystander | head -n 10
148 148 Normal file v2
149 149 $ hg cat -r $C2 bystander | head -n 10
150 150 Normal file v2
151 151 $ hg cat -r $C1 bystander | head -n 10
152 152 Normal file here
153 153 $ hg cat -r 0 bystander | head -n 10
154 154 Normal file here
155 155
156 156 Can update to children of censored revision
157 157
158 158 $ hg update -r $H1
159 159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 160 $ cat target | head -n 10
161 161 Tainted file is now sanitized
162 162 $ hg update -r $H2
163 163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
164 164 $ cat target | head -n 10
165 165 Tainted file now super sanitized
166 166
167 167 Set censor policy to abort in trusted $HGRC so hg verify fails
168 168
169 169 $ cp $HGRCPATH.orig $HGRCPATH
170 170 $ cat >> $HGRCPATH <<EOF
171 171 > [censor]
172 172 > policy = abort
173 173 > EOF
174 174
175 175 Repo fails verification due to censorship
176 176
177 177 $ hg verify
178 178 checking changesets
179 179 checking manifests
180 180 crosschecking files in changesets and manifests
181 181 checking files
182 182 target@1: censored file data
183 183 target@2: censored file data
184 184 not checking dirstate because of previous errors
185 185 checked 5 changesets with 7 changes to 2 files
186 186 2 integrity errors encountered!
187 187 (first damaged changeset appears to be 1)
188 188 [1]
189 189
190 190 Cannot update to revision with censored data
191 191
192 192 $ hg update -r $C2
193 193 abort: censored node: 1e0247a9a4b7
194 194 (set censor.policy to ignore errors)
195 195 [255]
196 196 $ hg update -r $C1
197 197 abort: censored node: 613bc869fceb
198 198 (set censor.policy to ignore errors)
199 199 [255]
200 200 $ hg update -r 0
201 201 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 202 $ hg update -r $H2
203 203 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 204
205 205 Set censor policy to ignore in trusted $HGRC so hg verify passes
206 206
207 207 $ cp $HGRCPATH.orig $HGRCPATH
208 208 $ cat >> $HGRCPATH <<EOF
209 209 > [censor]
210 210 > policy = ignore
211 211 > EOF
212 212
213 213 Repo passes verification with warnings with explicit config
214 214
215 215 $ hg verify -q
216 216
217 217 May update to revision with censored data with explicit config
218 218
219 219 $ hg update -r $C2
220 220 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 221 $ cat target | head -n 10
222 222 $ hg update -r $C1
223 223 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 224 $ cat target | head -n 10
225 225 $ hg update -r 0
226 226 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 227 $ cat target | head -n 10
228 228 Initially untainted file
229 229 $ hg update -r $H2
230 230 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 231 $ cat target | head -n 10
232 232 Tainted file now super sanitized
233 233
234 234 Can merge in revision with censored data. Test requires one branch of history
235 235 with the file censored, but we can't censor at a head, so advance H1.
236 236
237 237 $ hg update -r $H1
238 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 239 $ C3=$H1
240 240 $ echo 'advanced head H1' > target
241 241 $ hg ci -m 'advance head H1' target
242 $ H1=`hg id --debug -i`
242 $ H1=`hg id -r . -T "{node}"`
243 243 $ hg --config extensions.censor= censor -r $C3 target
244 244 checking for the censored content in 2 heads
245 245 checking for the censored content in the working directory
246 246 censoring 1 file revisions
247 247 $ hg update -r $H2
248 248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 249 $ hg merge -r $C3
250 250 merging target
251 251 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
252 252 (branch merge, don't forget to commit)
253 253
254 254 Revisions present in repository heads may not be censored
255 255
256 256 $ hg update -C -r $H2
257 257 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 258 $ hg --config extensions.censor= censor -r $H2 target
259 259 checking for the censored content in 2 heads
260 260 abort: cannot censor file in heads (78a8fc215e79)
261 261 (clean/delete and commit first)
262 262 [255]
263 263 $ echo 'twiddling thumbs' > bystander
264 264 $ hg ci -m 'bystander commit'
265 $ H2=`hg id --debug -i`
265 $ H2=`hg id -r . -T "{node}"`
266 266 $ hg --config extensions.censor= censor -r "$H2^" target
267 267 checking for the censored content in 2 heads
268 268 abort: cannot censor file in heads (efbe78065929)
269 269 (clean/delete and commit first)
270 270 [255]
271 271
272 272 Cannot censor working directory
273 273
274 274 $ echo 'seriously no passwords' > target
275 275 $ hg ci -m 'extend second head arbitrarily' target
276 $ H2=`hg id --debug -i`
276 $ H2=`hg id -r . -T "{node}"`
277 277 $ hg update -r "$H2^"
278 278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 279 $ hg --config extensions.censor= censor -r . target
280 280 checking for the censored content in 2 heads
281 281 checking for the censored content in the working directory
282 282 abort: cannot censor working directory
283 283 (clean/delete/update first)
284 284 [255]
285 285 $ hg update -r $H2
286 286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 287
288 288 Can re-add file after being deleted + censored
289 289
290 290 $ C4=$H2
291 291 $ hg rm target
292 292 $ hg ci -m 'delete target so it may be censored'
293 $ H2=`hg id --debug -i`
293 $ H2=`hg id -r . -T "{node}"`
294 294 $ hg --config extensions.censor= censor -r $C4 target
295 295 checking for the censored content in 2 heads
296 296 checking for the censored content in the working directory
297 297 censoring 1 file revisions
298 298 $ hg cat -r $C4 target | head -n 10
299 299 $ hg cat -r "$H2^^" target | head -n 10
300 300 Tainted file now super sanitized
301 301 $ echo 'fresh start' > target
302 302 $ hg add target
303 303 $ hg ci -m reincarnated target
304 $ H2=`hg id --debug -i`
304 $ H2=`hg id -r . -T "{node}"`
305 305 $ hg cat -r $H2 target | head -n 10
306 306 fresh start
307 307 $ hg cat -r "$H2^" target | head -n 10
308 308 target: no such file in rev 452ec1762369
309 309 $ hg cat -r $C4 target | head -n 10
310 310 $ hg cat -r "$H2^^^" target | head -n 10
311 311 Tainted file now super sanitized
312 312
313 313 Can censor enough revision to move back to inline storage
314 314
315 315 $ hg debugrevlogstats | grep target
316 316 rev-count data-size inl type target
317 317 8 ??? no file target (glob) (revlogv2 !)
318 318 8 ??? yes file target (glob) (revlogv1 !)
319 319 $ $TESTDIR/seq.py 4000 | $TESTDIR/sha256line.py > target
320 320 $ hg ci -m 'add 100k passwords'
321 $ H2=`hg id --debug -i`
321 $ H2=`hg id -r . -T "{node}"`
322 322 $ C5=$H2
323 323 $ hg revert -r "$H2^" target
324 324 $ hg ci -m 'cleaned 100k passwords'
325 $ H2=`hg id --debug -i`
325 $ H2=`hg id -r . -T "{node}"`
326 326 $ hg debugrevlogstats | grep target
327 327 rev-count data-size inl type target
328 328 10 ?????? no file target (glob)
329 329 $ hg --config extensions.censor= censor -r $C5 target
330 330 checking for the censored content in 2 heads
331 331 checking for the censored content in the working directory
332 332 censoring 1 file revisions
333 333
334 334 The important part is for the censor operation to not crash and the repository
335 335 to not be corrupted. Right now this involve keeping the revlog split.
336 336
337 337 $ hg debugrevlogstats | grep target
338 338 rev-count data-size inl type target
339 339 10 ??? no file target (glob)
340 340 $ hg cat -r $C5 target | head -n 10
341 341 $ hg cat -r $H2 target | head -n 10
342 342 fresh start
343 343 $ hg verify
344 344 checking changesets
345 345 checking manifests
346 346 crosschecking files in changesets and manifests
347 347 checking files
348 348 checking dirstate
349 349 checked 12 changesets with 13 changes to 2 files
350 350
351 351 Repo with censored nodes can be cloned and cloned nodes are censored
352 352
353 353 $ cd ..
354 354 $ hg clone r rclone
355 355 updating to branch default
356 356 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
357 357 $ cd rclone
358 358 $ hg cat -r $H1 target | head -n 10
359 359 advanced head H1
360 360 $ hg cat -r $H2~5 target | head -n 10
361 361 Tainted file now super sanitized
362 362 $ hg cat -r $C2 target | head -n 10
363 363 $ hg cat -r $C1 target | head -n 10
364 364 $ hg cat -r 0 target | head -n 10
365 365 Initially untainted file
366 366 $ hg verify -q
367 367
368 368 Repo cloned before tainted content introduced can pull censored nodes
369 369
370 370 $ cd ../rpull
371 371 $ hg cat -r tip target | head -n 10
372 372 Initially untainted file
373 373 $ hg verify -q
374 374 $ hg pull -r $H1 -r $H2
375 375 pulling from $TESTTMP/r
376 376 searching for changes
377 377 adding changesets
378 378 adding manifests
379 379 adding file changes
380 380 added 11 changesets with 11 changes to 2 files (+1 heads)
381 381 new changesets * (glob)
382 382 (run 'hg heads' to see heads, 'hg merge' to merge)
383 383 $ hg update 4
384 384 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 385 $ cat target | head -n 10
386 386 Tainted file now super sanitized
387 387 $ hg cat -r $H1 target | head -n 10
388 388 advanced head H1
389 389 $ hg cat -r $H2~5 target | head -n 10
390 390 Tainted file now super sanitized
391 391 $ hg cat -r $C2 target | head -n 10
392 392 $ hg cat -r $C1 target | head -n 10
393 393 $ hg cat -r 0 target | head -n 10
394 394 Initially untainted file
395 395 $ hg verify -q
396 396
397 397 Censored nodes can be pushed if they censor previously unexchanged nodes
398 398
399 399 $ echo 'Passwords: hunter2hunter2' > target
400 400 $ hg ci -m 're-add password from clone' target
401 401 created new head
402 $ H3=`hg id --debug -i`
402 $ H3=`hg id -r . -T "{node}"`
403 403 $ REV=$H3
404 404 $ echo 'Re-sanitized; nothing to see here' > target
405 405 $ hg ci -m 're-sanitized' target
406 $ H2=`hg id --debug -i`
406 $ H2=`hg id -r . -T "{node}"`
407 407 $ CLEANREV=$H2
408 408 $ hg cat -r $REV target | head -n 10
409 409 Passwords: hunter2hunter2
410 410 $ hg --config extensions.censor= censor -r $REV target
411 411 checking for the censored content in 3 heads
412 412 checking for the censored content in the working directory
413 413 censoring 1 file revisions
414 414 $ hg cat -r $REV target | head -n 10
415 415 $ hg cat -r $CLEANREV target | head -n 10
416 416 Re-sanitized; nothing to see here
417 417 $ hg push -f -r $H2
418 418 pushing to $TESTTMP/r
419 419 searching for changes
420 420 adding changesets
421 421 adding manifests
422 422 adding file changes
423 423 added 2 changesets with 2 changes to 1 files (+1 heads)
424 424
425 425 $ cd ../r
426 426 $ hg cat -r $REV target | head -n 10
427 427 $ hg cat -r $CLEANREV target | head -n 10
428 428 Re-sanitized; nothing to see here
429 429 $ hg update $CLEANREV
430 430 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 431 $ cat target | head -n 10
432 432 Re-sanitized; nothing to see here
433 433
434 434 Censored nodes can be bundled up and unbundled in another repo
435 435
436 436 $ hg bundle --base 0 ../pwbundle
437 437 13 changesets found
438 438 $ cd ../rclone
439 439 $ hg unbundle ../pwbundle
440 440 adding changesets
441 441 adding manifests
442 442 adding file changes
443 443 added 2 changesets with 2 changes to 2 files (+1 heads)
444 444 new changesets * (glob)
445 445 (run 'hg heads .' to see heads, 'hg merge' to merge)
446 446 $ hg cat -r $REV target | head -n 10
447 447 $ hg cat -r $CLEANREV target | head -n 10
448 448 Re-sanitized; nothing to see here
449 449 $ hg update $CLEANREV
450 450 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
451 451 $ cat target | head -n 10
452 452 Re-sanitized; nothing to see here
453 453 $ hg verify -q
454 454
455 455 Grepping only warns, doesn't error out
456 456
457 457 $ cd ../rpull
458 458 $ hg grep 'Normal file'
459 459 bystander:Normal file v2
460 460 $ hg grep nothing
461 461 target:Re-sanitized; nothing to see here
462 462 $ hg grep --diff 'Normal file'
463 463 cannot search in censored file: target:7
464 464 cannot search in censored file: target:10
465 465 cannot search in censored file: target:12
466 466 bystander:6:-:Normal file v2
467 467 cannot search in censored file: target:1
468 468 cannot search in censored file: target:2
469 469 cannot search in censored file: target:3
470 470 bystander:2:-:Normal file here
471 471 bystander:2:+:Normal file v2
472 472 bystander:0:+:Normal file here
473 473 $ hg grep --diff nothing
474 474 cannot search in censored file: target:7
475 475 cannot search in censored file: target:10
476 476 cannot search in censored file: target:12
477 477 target:13:+:Re-sanitized; nothing to see here
478 478 cannot search in censored file: target:1
479 479 cannot search in censored file: target:2
480 480 cannot search in censored file: target:3
481 481
482 482 Censored nodes can be imported on top of censored nodes, consecutively
483 483
484 484 $ hg init ../rimport
485 485 $ hg bundle --base 1 ../rimport/splitbundle
486 486 12 changesets found
487 487 $ cd ../rimport
488 488 $ hg pull -r $H1 -r $H2 ../r
489 489 pulling from ../r
490 490 adding changesets
491 491 adding manifests
492 492 adding file changes
493 493 added 8 changesets with 10 changes to 2 files (+1 heads)
494 494 new changesets e97f55b2665a:dcbaf17bf3a1
495 495 (run 'hg heads' to see heads, 'hg merge' to merge)
496 496 $ hg unbundle splitbundle
497 497 adding changesets
498 498 adding manifests
499 499 adding file changes
500 500 added 6 changesets with 5 changes to 2 files (+1 heads)
501 501 new changesets * (glob)
502 502 (run 'hg heads .' to see heads, 'hg merge' to merge)
503 503 $ hg update $H2
504 504 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
505 505 $ cat target | head -n 10
506 506 Re-sanitized; nothing to see here
507 507 $ hg verify -q
508 508 $ cd ../r
509 509
510 510 Can import bundle where first revision of a file is censored
511 511
512 512 $ hg init ../rinit
513 513 $ hg --config extensions.censor= censor -r 0 target
514 514 checking for the censored content in 3 heads
515 515 checking for the censored content in the working directory
516 516 censoring 1 file revisions
517 517 $ hg bundle -r 0 --base null ../rinit/initbundle
518 518 1 changesets found
519 519 $ cd ../rinit
520 520 $ hg unbundle initbundle
521 521 adding changesets
522 522 adding manifests
523 523 adding file changes
524 524 added 1 changesets with 2 changes to 2 files
525 525 new changesets e97f55b2665a (1 drafts)
526 526 (run 'hg update' to get a working copy)
527 527 $ hg cat -r 0 target | head -n 10
528 528
529 529 Can skip the head checking steps
530 530
531 531 $ hg --config extensions.censor= censor -r 0 --no-check-heads target
532 532 checking for the censored content in the working directory
533 533 censoring 1 file revisions
534 534
535 535 Can censor multiple revision in one go.
536 536
537 537 $ cd ../r
538 538 $ hg --config extensions.censor= censor -r 0+1 target
539 539 checking for the censored content in 3 heads
540 540 checking for the censored content in the working directory
541 541 censoring 2 file revisions
542 542
543 543
544 544
545 545 #if revlogv2
546 546
547 547 Testing feature that does not work in revlog v1
548 548 ===============================================
549 549
550 550 Censoring a revision that is used as delta base
551 551 -----------------------------------------------
552 552
553 553 $ cd ..
554 554 $ hg init censor-with-delta
555 555 $ cd censor-with-delta
556 556 $ echo root > target
557 557 $ hg add target
558 558 $ hg commit -m root
559 $ B0=`hg id --debug -i`
559 $ B0=`hg id -r . -T "{node}"`
560 560 $ for x in `"$PYTHON" $TESTDIR/seq.py 0 50000`
561 561 > do
562 562 > echo "Password: hunter$x" >> target
563 563 > done
564 564 $ hg ci -m 'write a long file'
565 $ B1=`hg id --debug -i`
565 $ B1=`hg id -r . -T "{node}"`
566 566 $ echo 'small change (should create a delta)' >> target
567 567 $ hg ci -m 'create a delta over the password'
568 568 (should show that the last revision is a delta, not a snapshot)
569 $ B2=`hg id --debug -i`
569 $ B2=`hg id -r . -T "{node}"`
570 570
571 571 Make sure the last revision is a delta against the revision we will censor
572 572
573 573 $ hg debugdeltachain target -T '{rev} {chainid} {chainlen} {prevrev}\n'
574 574 0 1 1 -1
575 575 1 2 1 -1
576 576 2 2 2 1
577 577
578 578 Censor the file
579 579
580 580 $ hg cat -r $B1 target | wc -l
581 581 *50002 (re)
582 582 $ hg --config extensions.censor= censor -r $B1 target
583 583 checking for the censored content in 1 heads
584 584 checking for the censored content in the working directory
585 585 censoring 1 file revisions
586 586 $ hg cat -r $B1 target | wc -l
587 587 *0 (re)
588 588
589 589 Check the children is fine
590 590
591 591 $ hg cat -r $B2 target | wc -l
592 592 *50003 (re)
593 593
594 594 #endif
595 595
596 596 Testing repository upgrade with censors revision
597 597 ================================================
598 598
599 599 $ cd ../rclone
600 600
601 601 With the "abort" policy
602 602 =======================
603 603
604 604 $ hg verify --config censor.policy=ignore
605 605 checking changesets
606 606 checking manifests
607 607 crosschecking files in changesets and manifests
608 608 checking files
609 609 checking dirstate
610 610 checked 14 changesets with 15 changes to 2 files
611 611 $ hg debugupgraderepo --run --quiet \
612 612 > --optimize re-delta-parent \
613 613 > --config censor.policy=abort
614 614 upgrade will perform the following actions:
615 615
616 616 requirements
617 617 preserved: * (glob)
618 618
619 619 optimisations: re-delta-parent
620 620
621 621 processed revlogs:
622 622 - all-filelogs
623 623 - changelog
624 624 - manifest
625 625
626 626 $ hg verify --config censor.policy=ignore
627 627 checking changesets
628 628 checking manifests
629 629 crosschecking files in changesets and manifests
630 630 checking files
631 631 checking dirstate
632 632 checked 14 changesets with 15 changes to 2 files
633 633
634 634 With the "ignore" policy
635 635 ========================
636 636
637 637 $ hg verify --config censor.policy=ignore
638 638 checking changesets
639 639 checking manifests
640 640 crosschecking files in changesets and manifests
641 641 checking files
642 642 checking dirstate
643 643 checked 14 changesets with 15 changes to 2 files
644 644 $ hg debugupgraderepo --run --quiet \
645 645 > --optimize re-delta-parent \
646 646 > --config censor.policy=ignore
647 647 upgrade will perform the following actions:
648 648
649 649 requirements
650 650 preserved: * (glob)
651 651
652 652 optimisations: re-delta-parent
653 653
654 654 processed revlogs:
655 655 - all-filelogs
656 656 - changelog
657 657 - manifest
658 658
659 659 $ hg verify --config censor.policy=ignore
660 660 checking changesets
661 661 checking manifests
662 662 crosschecking files in changesets and manifests
663 663 checking files
664 664 checking dirstate
665 665 checked 14 changesets with 15 changes to 2 files
@@ -1,241 +1,241
1 1
2 2 $ echo "[extensions]" >> $HGRCPATH
3 3 $ echo "convert=" >> $HGRCPATH
4 4 $ glog()
5 5 > {
6 6 > hg log -G --template '{rev}:{node|short} "{desc|firstline}"\
7 7 > files: {files}\n' "$@"
8 8 > }
9 9 $ hg init repo1
10 10 $ cd repo1
11 11 $ echo a > a
12 12 $ hg ci -Am adda
13 13 adding a
14 14 $ echo b > b
15 15 $ echo a >> a
16 16 $ hg ci -Am addb
17 17 adding b
18 $ PARENTID1=`hg id --debug -i`
18 $ PARENTID1=`hg id -r . -T "{node}"`
19 19 $ echo c > c
20 20 $ hg ci -Am addc
21 21 adding c
22 $ PARENTID2=`hg id --debug -i`
22 $ PARENTID2=`hg id -r . -T "{node}"`
23 23 $ cd ..
24 24 $ glog -R repo1
25 25 @ 2:e55c719b85b6 "addc" files: c
26 26 |
27 27 o 1:6d4c2037ddc2 "addb" files: a b
28 28 |
29 29 o 0:07f494440405 "adda" files: a
30 30
31 31
32 32 $ hg init repo2
33 33 $ cd repo2
34 34 $ echo b > a
35 35 $ echo d > d
36 36 $ hg ci -Am addaandd
37 37 adding a
38 38 adding d
39 39 $ INVALIDID1=afd12345af
40 40 $ INVALIDID2=28173x36ddd1e67bf7098d541130558ef5534a86
41 $ CHILDID1=`hg id --debug -i`
41 $ CHILDID1=`hg id -r . -T "{node}"`
42 42 $ echo d >> d
43 43 $ hg ci -Am changed
44 $ CHILDID2=`hg id --debug -i`
44 $ CHILDID2=`hg id -r . -T "{node}"`
45 45 $ echo e > e
46 46 $ hg ci -Am adde
47 47 adding e
48 48 $ cd ..
49 49 $ glog -R repo2
50 50 @ 2:a39b65753b0a "adde" files: e
51 51 |
52 52 o 1:e4ea00df9189 "changed" files: d
53 53 |
54 54 o 0:527cdedf31fb "addaandd" files: a d
55 55
56 56
57 57 test invalid splicemap1
58 58
59 59 $ cat > splicemap <<EOF
60 60 > $CHILDID2
61 61 > EOF
62 62 $ hg convert --splicemap splicemap repo2 repo1
63 63 abort: syntax error in splicemap(1): child parent1[,parent2] expected
64 64 [255]
65 65
66 66 test invalid splicemap2
67 67
68 68 $ cat > splicemap <<EOF
69 69 > $CHILDID2 $PARENTID1, $PARENTID2, $PARENTID2
70 70 > EOF
71 71 $ hg convert --splicemap splicemap repo2 repo1
72 72 abort: syntax error in splicemap(1): child parent1[,parent2] expected
73 73 [255]
74 74
75 75 test invalid splicemap3
76 76
77 77 $ cat > splicemap <<EOF
78 78 > $INVALIDID1 $INVALIDID2
79 79 > EOF
80 80 $ hg convert --splicemap splicemap repo2 repo1
81 81 abort: splicemap entry afd12345af is not a valid revision identifier
82 82 [255]
83 83
84 84 splice repo2 on repo1
85 85
86 86 $ cat > splicemap <<EOF
87 87 > $CHILDID1 $PARENTID1
88 88 > $CHILDID2 $PARENTID2,$CHILDID1
89 89 >
90 90 > EOF
91 91 $ cat splicemap
92 92 527cdedf31fbd5ea708aa14eeecf53d4676f38db 6d4c2037ddc2cb2627ac3a244ecce35283268f8e
93 93 e4ea00df91897da3079a10fab658c1eddba6617b e55c719b85b60e5102fac26110ba626e7cb6b7dc,527cdedf31fbd5ea708aa14eeecf53d4676f38db
94 94
95 95 $ hg clone repo1 target1
96 96 updating to branch default
97 97 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 98 $ hg convert --splicemap splicemap repo2 target1
99 99 scanning source...
100 100 sorting...
101 101 converting...
102 102 2 addaandd
103 103 spliced in 6d4c2037ddc2cb2627ac3a244ecce35283268f8e as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db
104 104 1 changed
105 105 spliced in e55c719b85b60e5102fac26110ba626e7cb6b7dc and 527cdedf31fbd5ea708aa14eeecf53d4676f38db as parents of e4ea00df91897da3079a10fab658c1eddba6617b
106 106 0 adde
107 107 $ glog -R target1
108 108 o 5:16bc847b02aa "adde" files: e
109 109 |
110 110 o 4:e30e4fee3418 "changed" files: d
111 111 |\
112 112 | o 3:e673348c3a3c "addaandd" files: a d
113 113 | |
114 114 @ | 2:e55c719b85b6 "addc" files: c
115 115 |/
116 116 o 1:6d4c2037ddc2 "addb" files: a b
117 117 |
118 118 o 0:07f494440405 "adda" files: a
119 119
120 120
121 121
122 122
123 123 Test splicemap and conversion order
124 124
125 125 $ hg init ordered
126 126 $ cd ordered
127 127 $ echo a > a
128 128 $ hg ci -Am adda
129 129 adding a
130 130 $ hg branch branch
131 131 marked working directory as branch branch
132 132 (branches are permanent and global, did you want a bookmark?)
133 133 $ echo a >> a
134 134 $ hg ci -Am changea
135 135 $ echo a >> a
136 136 $ hg ci -Am changeaagain
137 137 $ hg up 0
138 138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 139 $ echo b > b
140 140 $ hg ci -Am addb
141 141 adding b
142 142
143 143 We want 2 to depend on 1 and 3. Since 3 is always converted after 2,
144 144 the bug should be exhibited with all conversion orders.
145 145
146 146 $ cat > ../splicemap <<EOF
147 147 > `(hg id -r 2 -i --debug)` `(hg id -r 1 -i --debug)`, `(hg id -r 3 -i --debug)`
148 148 > EOF
149 149 $ cd ..
150 150 $ cat splicemap
151 151 7c364e7fa7d70ae525610c016317ed717b519d97 717d54d67e6c31fd75ffef2ff3042bdd98418437, 102a90ea7b4a3361e4082ed620918c261189a36a
152 152
153 153 Test regular conversion
154 154
155 155 $ hg convert --splicemap splicemap ordered ordered-hg1
156 156 initializing destination ordered-hg1 repository
157 157 scanning source...
158 158 sorting...
159 159 converting...
160 160 3 adda
161 161 2 changea
162 162 1 addb
163 163 0 changeaagain
164 164 spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97
165 165 $ glog -R ordered-hg1
166 166 o 3:4cb04b9afbf2 "changeaagain" files: a
167 167 |\
168 168 | o 2:102a90ea7b4a "addb" files: b
169 169 | |
170 170 o | 1:717d54d67e6c "changea" files: a
171 171 |/
172 172 o 0:07f494440405 "adda" files: a
173 173
174 174
175 175 Test conversion with parent revisions already in dest, using source
176 176 and destination identifiers. Test unknown splicemap target.
177 177
178 178 $ hg convert -r1 ordered ordered-hg2
179 179 initializing destination ordered-hg2 repository
180 180 scanning source...
181 181 sorting...
182 182 converting...
183 183 1 adda
184 184 0 changea
185 185 $ hg convert -r3 ordered ordered-hg2
186 186 scanning source...
187 187 sorting...
188 188 converting...
189 189 0 addb
190 190 $ cat > splicemap <<EOF
191 191 > `(hg -R ordered id -r 2 -i --debug)` \
192 192 > `(hg -R ordered-hg2 id -r 1 -i --debug)`,\
193 193 > `(hg -R ordered-hg2 id -r 2 -i --debug)`
194 194 > deadbeef102a90ea7b4a3361e4082ed620918c26 deadbeef102a90ea7b4a3361e4082ed620918c27
195 195 > EOF
196 196 $ hg convert --splicemap splicemap ordered ordered-hg2
197 197 scanning source...
198 198 splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring
199 199 sorting...
200 200 converting...
201 201 0 changeaagain
202 202 spliced in 717d54d67e6c31fd75ffef2ff3042bdd98418437 and 102a90ea7b4a3361e4082ed620918c261189a36a as parents of 7c364e7fa7d70ae525610c016317ed717b519d97
203 203 $ glog -R ordered-hg2
204 204 o 3:4cb04b9afbf2 "changeaagain" files: a
205 205 |\
206 206 | o 2:102a90ea7b4a "addb" files: b
207 207 | |
208 208 o | 1:717d54d67e6c "changea" files: a
209 209 |/
210 210 o 0:07f494440405 "adda" files: a
211 211
212 212
213 213 Test empty conversion
214 214
215 215 $ hg convert --splicemap splicemap ordered ordered-hg2
216 216 scanning source...
217 217 splice map revision deadbeef102a90ea7b4a3361e4082ed620918c26 is not being converted, ignoring
218 218 sorting...
219 219 converting...
220 220
221 221 Test clonebranches
222 222
223 223 $ hg --config convert.hg.clonebranches=true convert \
224 224 > --splicemap splicemap ordered ordered-hg3
225 225 initializing destination ordered-hg3 repository
226 226 scanning source...
227 227 abort: revision 717d54d67e6c31fd75ffef2ff3042bdd98418437 not found in destination repository (lookups with clonebranches=true are not implemented)
228 228 [255]
229 229
230 230 Test invalid dependency
231 231
232 232 $ cat > splicemap <<EOF
233 233 > `(hg -R ordered id -r 2 -i --debug)` \
234 234 > deadbeef102a90ea7b4a3361e4082ed620918c26,\
235 235 > `(hg -R ordered-hg2 id -r 2 -i --debug)`
236 236 > EOF
237 237 $ hg convert --splicemap splicemap ordered ordered-hg4
238 238 initializing destination ordered-hg4 repository
239 239 scanning source...
240 240 abort: unknown splice map parent: deadbeef102a90ea7b4a3361e4082ed620918c26
241 241 [255]
@@ -1,1163 +1,1163
1 1 $ cat > $TESTTMP/hook.sh << 'EOF'
2 2 > echo "test-hook-close-phase: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
3 3 > EOF
4 4
5 5 $ cat >> $HGRCPATH << EOF
6 6 > [extensions]
7 7 > phasereport=$TESTDIR/testlib/ext-phase-report.py
8 8 > [hooks]
9 9 > txnclose-phase.test = sh $TESTTMP/hook.sh
10 10 > EOF
11 11
12 12 $ hglog() { hg log -G --template "{rev} {phaseidx} {desc}\n" $*; }
13 13 $ mkcommit() {
14 14 > echo "$1" > "$1"
15 15 > hg add "$1"
16 16 > message="$1"
17 17 > shift
18 18 > hg ci -m "$message" $*
19 19 > }
20 20
21 21 $ hg init initialrepo
22 22 $ cd initialrepo
23 23
24 24 Cannot change null revision phase
25 25
26 26 $ hg phase --force --secret null
27 27 abort: cannot change null revision phase
28 28 [255]
29 29 $ hg phase null
30 30 -1: public
31 31
32 32 $ mkcommit A
33 33 test-debug-phase: new rev 0: x -> 1
34 34 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
35 35
36 36 New commit are draft by default
37 37
38 38 $ hglog
39 39 @ 0 1 A
40 40
41 41
42 42 Following commit are draft too
43 43
44 44 $ mkcommit B
45 45 test-debug-phase: new rev 1: x -> 1
46 46 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> draft
47 47
48 48 $ hglog
49 49 @ 1 1 B
50 50 |
51 51 o 0 1 A
52 52
53 53
54 54 Working directory phase is secret when its parent is secret.
55 55
56 56 $ hg phase --force --secret .
57 57 test-debug-phase: move rev 1: 1 -> 2
58 58 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> secret
59 59 $ hg log -r 'wdir()' -T '{phase}\n'
60 60 secret
61 61 $ hg log -r 'wdir() and public()' -T '{phase}\n'
62 62 $ hg log -r 'wdir() and draft()' -T '{phase}\n'
63 63 $ hg log -r 'wdir() and secret()' -T '{phase}\n'
64 64 secret
65 65
66 66 Working directory phase is draft when its parent is draft.
67 67
68 68 $ hg phase --draft .
69 69 test-debug-phase: move rev 1: 2 -> 1
70 70 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: secret -> draft
71 71 $ hg log -r 'wdir()' -T '{phase}\n'
72 72 draft
73 73 $ hg log -r 'wdir() and public()' -T '{phase}\n'
74 74 $ hg log -r 'wdir() and draft()' -T '{phase}\n'
75 75 draft
76 76 $ hg log -r 'wdir() and secret()' -T '{phase}\n'
77 77
78 78 Working directory phase is secret when a new commit will be created as secret,
79 79 even if the parent is draft.
80 80
81 81 $ hg log -r 'wdir() and secret()' -T '{phase}\n' \
82 82 > --config phases.new-commit='secret'
83 83 secret
84 84
85 85 Working directory phase is draft when its parent is public.
86 86
87 87 $ hg phase --public .
88 88 test-debug-phase: move rev 0: 1 -> 0
89 89 test-debug-phase: move rev 1: 1 -> 0
90 90 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: draft -> public
91 91 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
92 92 $ hg log -r 'wdir()' -T '{phase}\n'
93 93 draft
94 94 $ hg log -r 'wdir() and public()' -T '{phase}\n'
95 95 $ hg log -r 'wdir() and draft()' -T '{phase}\n'
96 96 draft
97 97 $ hg log -r 'wdir() and secret()' -T '{phase}\n'
98 98 $ hg log -r 'wdir() and secret()' -T '{phase}\n' \
99 99 > --config phases.new-commit='secret'
100 100 secret
101 101
102 102 Draft commit are properly created over public one:
103 103
104 104 $ hg phase
105 105 1: public
106 106 $ hglog
107 107 @ 1 0 B
108 108 |
109 109 o 0 0 A
110 110
111 111
112 112 $ mkcommit C
113 113 test-debug-phase: new rev 2: x -> 1
114 114 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
115 115 $ mkcommit D
116 116 test-debug-phase: new rev 3: x -> 1
117 117 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
118 118
119 119 $ hglog
120 120 @ 3 1 D
121 121 |
122 122 o 2 1 C
123 123 |
124 124 o 1 0 B
125 125 |
126 126 o 0 0 A
127 127
128 128
129 129 Test creating changeset as secret
130 130
131 131 $ mkcommit E --config phases.new-commit='secret'
132 132 test-debug-phase: new rev 4: x -> 2
133 133 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> secret
134 134 $ hglog
135 135 @ 4 2 E
136 136 |
137 137 o 3 1 D
138 138 |
139 139 o 2 1 C
140 140 |
141 141 o 1 0 B
142 142 |
143 143 o 0 0 A
144 144
145 145
146 146 Test the secret property is inherited
147 147
148 148 $ mkcommit H
149 149 test-debug-phase: new rev 5: x -> 2
150 150 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
151 151 $ hglog
152 152 @ 5 2 H
153 153 |
154 154 o 4 2 E
155 155 |
156 156 o 3 1 D
157 157 |
158 158 o 2 1 C
159 159 |
160 160 o 1 0 B
161 161 |
162 162 o 0 0 A
163 163
164 164
165 165 Even on merge
166 166
167 167 $ hg up -q 1
168 168 $ mkcommit "B'"
169 169 test-debug-phase: new rev 6: x -> 1
170 170 created new head
171 171 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
172 172 $ hglog
173 173 @ 6 1 B'
174 174 |
175 175 | o 5 2 H
176 176 | |
177 177 | o 4 2 E
178 178 | |
179 179 | o 3 1 D
180 180 | |
181 181 | o 2 1 C
182 182 |/
183 183 o 1 0 B
184 184 |
185 185 o 0 0 A
186 186
187 187 $ hg merge 4 # E
188 188 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 (branch merge, don't forget to commit)
190 190 $ hg phase
191 191 6: draft
192 192 4: secret
193 193 $ hg ci -m "merge B' and E"
194 194 test-debug-phase: new rev 7: x -> 2
195 195 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> secret
196 196
197 197 $ hglog
198 198 @ 7 2 merge B' and E
199 199 |\
200 200 | o 6 1 B'
201 201 | |
202 202 +---o 5 2 H
203 203 | |
204 204 o | 4 2 E
205 205 | |
206 206 o | 3 1 D
207 207 | |
208 208 o | 2 1 C
209 209 |/
210 210 o 1 0 B
211 211 |
212 212 o 0 0 A
213 213
214 214
215 215 Test secret changeset are not pushed
216 216
217 217 $ hg init ../push-dest
218 218 $ cat > ../push-dest/.hg/hgrc << EOF
219 219 > [phases]
220 220 > publish=False
221 221 > EOF
222 222 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
223 223 comparing with ../push-dest
224 224 searching for changes
225 225 0 public A
226 226 1 public B
227 227 2 draft C
228 228 3 draft D
229 229 6 draft B'
230 230 $ hg outgoing -r 'branch(default)' ../push-dest --template='{rev} {phase} {desc|firstline}\n'
231 231 comparing with ../push-dest
232 232 searching for changes
233 233 0 public A
234 234 1 public B
235 235 2 draft C
236 236 3 draft D
237 237 6 draft B'
238 238
239 239 $ hg push ../push-dest -f # force because we push multiple heads
240 240 pushing to ../push-dest
241 241 searching for changes
242 242 adding changesets
243 243 adding manifests
244 244 adding file changes
245 245 added 5 changesets with 5 changes to 5 files (+1 heads)
246 246 test-debug-phase: new rev 0: x -> 0
247 247 test-debug-phase: new rev 1: x -> 0
248 248 test-debug-phase: new rev 2: x -> 1
249 249 test-debug-phase: new rev 3: x -> 1
250 250 test-debug-phase: new rev 4: x -> 1
251 251 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
252 252 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
253 253 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
254 254 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
255 255 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
256 256 $ hglog
257 257 @ 7 2 merge B' and E
258 258 |\
259 259 | o 6 1 B'
260 260 | |
261 261 +---o 5 2 H
262 262 | |
263 263 o | 4 2 E
264 264 | |
265 265 o | 3 1 D
266 266 | |
267 267 o | 2 1 C
268 268 |/
269 269 o 1 0 B
270 270 |
271 271 o 0 0 A
272 272
273 273 $ cd ../push-dest
274 274 $ hglog
275 275 o 4 1 B'
276 276 |
277 277 | o 3 1 D
278 278 | |
279 279 | o 2 1 C
280 280 |/
281 281 o 1 0 B
282 282 |
283 283 o 0 0 A
284 284
285 285
286 286 (Issue3303)
287 287 Check that remote secret changeset are ignore when checking creation of remote heads
288 288
289 289 We add a secret head into the push destination. This secret head shadows a
290 290 visible shared between the initial repo and the push destination.
291 291
292 292 $ hg up -q 4 # B'
293 293 $ mkcommit Z --config phases.new-commit=secret
294 294 test-debug-phase: new rev 5: x -> 2
295 295 test-hook-close-phase: 2713879da13d6eea1ff22b442a5a87cb31a7ce6a: -> secret
296 296 $ hg phase .
297 297 5: secret
298 298
299 299 We now try to push a new public changeset that descend from the common public
300 300 head shadowed by the remote secret head.
301 301
302 302 $ cd ../initialrepo
303 303 $ hg up -q 6 #B'
304 304 $ mkcommit I
305 305 test-debug-phase: new rev 8: x -> 1
306 306 created new head
307 307 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
308 308 $ hg push ../push-dest
309 309 pushing to ../push-dest
310 310 searching for changes
311 311 adding changesets
312 312 adding manifests
313 313 adding file changes
314 314 added 1 changesets with 1 changes to 1 files (+1 heads)
315 315 test-debug-phase: new rev 6: x -> 1
316 316 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
317 317
318 318 :note: The "(+1 heads)" is wrong as we do not had any visible head
319 319
320 320 check that branch cache with "served" filter are properly computed and stored
321 321
322 322 $ ls ../push-dest/.hg/cache/branch2*
323 323 ../push-dest/.hg/cache/branch2-base
324 324 ../push-dest/.hg/cache/branch2-served
325 325 $ cat ../push-dest/.hg/cache/branch2-served
326 326 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
327 327 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
328 328 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
329 329 $ hg heads -R ../push-dest --template '{rev}:{node} {phase}\n' #update visible cache too
330 330 6:6d6770faffce199f1fddd1cf87f6f026138cf061 draft
331 331 5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
332 332 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
333 333 $ ls ../push-dest/.hg/cache/branch2*
334 334 ../push-dest/.hg/cache/branch2-base
335 335 ../push-dest/.hg/cache/branch2-served
336 336 ../push-dest/.hg/cache/branch2-visible
337 337 $ cat ../push-dest/.hg/cache/branch2-served
338 338 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
339 339 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
340 340 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
341 341 $ cat ../push-dest/.hg/cache/branch2-visible
342 342 6d6770faffce199f1fddd1cf87f6f026138cf061 6
343 343 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
344 344 2713879da13d6eea1ff22b442a5a87cb31a7ce6a o default
345 345 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
346 346
347 347
348 348 Restore condition prior extra insertion.
349 349 $ hg -q --config extensions.mq= strip .
350 350 $ hg up -q 7
351 351 $ cd ..
352 352
353 353 Test secret changeset are not pull
354 354
355 355 $ hg init pull-dest
356 356 $ cd pull-dest
357 357 $ hg pull ../initialrepo
358 358 pulling from ../initialrepo
359 359 requesting all changes
360 360 adding changesets
361 361 adding manifests
362 362 adding file changes
363 363 added 5 changesets with 5 changes to 5 files (+1 heads)
364 364 new changesets 4a2df7238c3b:cf9fe039dfd6
365 365 test-debug-phase: new rev 0: x -> 0
366 366 test-debug-phase: new rev 1: x -> 0
367 367 test-debug-phase: new rev 2: x -> 0
368 368 test-debug-phase: new rev 3: x -> 0
369 369 test-debug-phase: new rev 4: x -> 0
370 370 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
371 371 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
372 372 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
373 373 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
374 374 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
375 375 (run 'hg heads' to see heads, 'hg merge' to merge)
376 376 $ hglog
377 377 o 4 0 B'
378 378 |
379 379 | o 3 0 D
380 380 | |
381 381 | o 2 0 C
382 382 |/
383 383 o 1 0 B
384 384 |
385 385 o 0 0 A
386 386
387 387 $ cd ..
388 388
389 389 But secret can still be bundled explicitly
390 390
391 391 $ cd initialrepo
392 392 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
393 393 4 changesets found
394 394 $ cd ..
395 395
396 396 Test secret changeset are not cloned
397 397 (during local clone)
398 398
399 399 $ hg clone -qU initialrepo clone-dest
400 400 test-debug-phase: new rev 0: x -> 0
401 401 test-debug-phase: new rev 1: x -> 0
402 402 test-debug-phase: new rev 2: x -> 0
403 403 test-debug-phase: new rev 3: x -> 0
404 404 test-debug-phase: new rev 4: x -> 0
405 405 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
406 406 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
407 407 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
408 408 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
409 409 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
410 410 $ hglog -R clone-dest
411 411 o 4 0 B'
412 412 |
413 413 | o 3 0 D
414 414 | |
415 415 | o 2 0 C
416 416 |/
417 417 o 1 0 B
418 418 |
419 419 o 0 0 A
420 420
421 421
422 422 Test summary
423 423
424 424 $ hg summary -R clone-dest --verbose
425 425 parent: -1:000000000000 (no revision checked out)
426 426 branch: default
427 427 commit: (clean)
428 428 update: 5 new changesets (update)
429 429 $ hg summary -R initialrepo
430 430 parent: 7:17a481b3bccb tip
431 431 merge B' and E
432 432 branch: default
433 433 commit: (clean) (secret)
434 434 update: 1 new changesets, 2 branch heads (merge)
435 435 phases: 3 draft, 3 secret
436 436 $ hg summary -R initialrepo --quiet
437 437 parent: 7:17a481b3bccb tip
438 438 update: 1 new changesets, 2 branch heads (merge)
439 439
440 440 Test revset
441 441
442 442 $ cd initialrepo
443 443 $ hglog -r 'public()'
444 444 o 1 0 B
445 445 |
446 446 o 0 0 A
447 447
448 448 $ hglog -r 'draft()'
449 449 o 6 1 B'
450 450 |
451 451 ~
452 452 o 3 1 D
453 453 |
454 454 o 2 1 C
455 455 |
456 456 ~
457 457 $ hglog -r 'secret()'
458 458 @ 7 2 merge B' and E
459 459 |\
460 460 | ~
461 461 | o 5 2 H
462 462 |/
463 463 o 4 2 E
464 464 |
465 465 ~
466 466
467 467 test that phase are displayed in log at debug level
468 468
469 469 $ hg log --debug
470 470 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
471 471 tag: tip
472 472 phase: secret
473 473 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
474 474 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
475 475 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
476 476 user: test
477 477 date: Thu Jan 01 00:00:00 1970 +0000
478 478 extra: branch=default
479 479 description:
480 480 merge B' and E
481 481
482 482
483 483 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
484 484 phase: draft
485 485 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
486 486 parent: -1:0000000000000000000000000000000000000000
487 487 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
488 488 user: test
489 489 date: Thu Jan 01 00:00:00 1970 +0000
490 490 files+: B'
491 491 extra: branch=default
492 492 description:
493 493 B'
494 494
495 495
496 496 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
497 497 phase: secret
498 498 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
499 499 parent: -1:0000000000000000000000000000000000000000
500 500 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
501 501 user: test
502 502 date: Thu Jan 01 00:00:00 1970 +0000
503 503 files+: H
504 504 extra: branch=default
505 505 description:
506 506 H
507 507
508 508
509 509 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
510 510 phase: secret
511 511 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
512 512 parent: -1:0000000000000000000000000000000000000000
513 513 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
514 514 user: test
515 515 date: Thu Jan 01 00:00:00 1970 +0000
516 516 files+: E
517 517 extra: branch=default
518 518 description:
519 519 E
520 520
521 521
522 522 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
523 523 phase: draft
524 524 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
525 525 parent: -1:0000000000000000000000000000000000000000
526 526 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
527 527 user: test
528 528 date: Thu Jan 01 00:00:00 1970 +0000
529 529 files+: D
530 530 extra: branch=default
531 531 description:
532 532 D
533 533
534 534
535 535 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
536 536 phase: draft
537 537 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
538 538 parent: -1:0000000000000000000000000000000000000000
539 539 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
540 540 user: test
541 541 date: Thu Jan 01 00:00:00 1970 +0000
542 542 files+: C
543 543 extra: branch=default
544 544 description:
545 545 C
546 546
547 547
548 548 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
549 549 phase: public
550 550 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
551 551 parent: -1:0000000000000000000000000000000000000000
552 552 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
553 553 user: test
554 554 date: Thu Jan 01 00:00:00 1970 +0000
555 555 files+: B
556 556 extra: branch=default
557 557 description:
558 558 B
559 559
560 560
561 561 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
562 562 phase: public
563 563 parent: -1:0000000000000000000000000000000000000000
564 564 parent: -1:0000000000000000000000000000000000000000
565 565 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
566 566 user: test
567 567 date: Thu Jan 01 00:00:00 1970 +0000
568 568 files+: A
569 569 extra: branch=default
570 570 description:
571 571 A
572 572
573 573
574 574
575 575
576 576 (Issue3707)
577 577 test invalid phase name
578 578
579 579 $ mkcommit I --config phases.new-commit='babar'
580 580 transaction abort!
581 581 rollback completed
582 582 config error: phases.new-commit: not a valid phase name ('babar')
583 583 [30]
584 584 Test phase command
585 585 ===================
586 586
587 587 initial picture
588 588
589 589 $ hg log -G --template "{rev} {phase} {desc}\n"
590 590 @ 7 secret merge B' and E
591 591 |\
592 592 | o 6 draft B'
593 593 | |
594 594 +---o 5 secret H
595 595 | |
596 596 o | 4 secret E
597 597 | |
598 598 o | 3 draft D
599 599 | |
600 600 o | 2 draft C
601 601 |/
602 602 o 1 public B
603 603 |
604 604 o 0 public A
605 605
606 606
607 607 display changesets phase
608 608
609 609 (mixing -r and plain rev specification)
610 610
611 611 $ hg phase 1::4 -r 7
612 612 1: public
613 613 2: draft
614 614 3: draft
615 615 4: secret
616 616 7: secret
617 617
618 618
619 619 move changeset forward
620 620
621 621 (with -r option)
622 622
623 623 $ hg phase --public -r 2
624 624 test-debug-phase: move rev 2: 1 -> 0
625 625 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
626 626 $ hg log -G --template "{rev} {phase} {desc}\n"
627 627 @ 7 secret merge B' and E
628 628 |\
629 629 | o 6 draft B'
630 630 | |
631 631 +---o 5 secret H
632 632 | |
633 633 o | 4 secret E
634 634 | |
635 635 o | 3 draft D
636 636 | |
637 637 o | 2 public C
638 638 |/
639 639 o 1 public B
640 640 |
641 641 o 0 public A
642 642
643 643
644 644 move changeset backward
645 645
646 646 (without -r option)
647 647
648 648 $ hg phase --draft --force 2
649 649 test-debug-phase: move rev 2: 0 -> 1
650 650 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: public -> draft
651 651 $ hg log -G --template "{rev} {phase} {desc}\n"
652 652 @ 7 secret merge B' and E
653 653 |\
654 654 | o 6 draft B'
655 655 | |
656 656 +---o 5 secret H
657 657 | |
658 658 o | 4 secret E
659 659 | |
660 660 o | 3 draft D
661 661 | |
662 662 o | 2 draft C
663 663 |/
664 664 o 1 public B
665 665 |
666 666 o 0 public A
667 667
668 668
669 669 move changeset forward and backward
670 670
671 671 $ hg phase --draft --force 1::4
672 672 test-debug-phase: move rev 1: 0 -> 1
673 673 test-debug-phase: move rev 4: 2 -> 1
674 674 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: public -> draft
675 675 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
676 676 $ hg log -G --template "{rev} {phase} {desc}\n"
677 677 @ 7 secret merge B' and E
678 678 |\
679 679 | o 6 draft B'
680 680 | |
681 681 +---o 5 secret H
682 682 | |
683 683 o | 4 draft E
684 684 | |
685 685 o | 3 draft D
686 686 | |
687 687 o | 2 draft C
688 688 |/
689 689 o 1 draft B
690 690 |
691 691 o 0 public A
692 692
693 693 test partial failure
694 694
695 695 $ hg phase --public 7
696 696 test-debug-phase: move rev 1: 1 -> 0
697 697 test-debug-phase: move rev 2: 1 -> 0
698 698 test-debug-phase: move rev 3: 1 -> 0
699 699 test-debug-phase: move rev 4: 1 -> 0
700 700 test-debug-phase: move rev 6: 1 -> 0
701 701 test-debug-phase: move rev 7: 2 -> 0
702 702 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
703 703 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
704 704 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: draft -> public
705 705 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: draft -> public
706 706 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: draft -> public
707 707 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> public
708 708 $ hg log -G --template "{rev} {phase} {desc}\n"
709 709 @ 7 public merge B' and E
710 710 |\
711 711 | o 6 public B'
712 712 | |
713 713 +---o 5 secret H
714 714 | |
715 715 o | 4 public E
716 716 | |
717 717 o | 3 public D
718 718 | |
719 719 o | 2 public C
720 720 |/
721 721 o 1 public B
722 722 |
723 723 o 0 public A
724 724
725 725 $ hg phase --draft '5 or 7'
726 726 test-debug-phase: move rev 5: 2 -> 1
727 727 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: secret -> draft
728 728 cannot move 1 changesets to a higher phase, use --force
729 729 phase changed for 1 changesets
730 730 [1]
731 731 $ hg log -G --template "{rev} {phase} {desc}\n"
732 732 @ 7 public merge B' and E
733 733 |\
734 734 | o 6 public B'
735 735 | |
736 736 +---o 5 draft H
737 737 | |
738 738 o | 4 public E
739 739 | |
740 740 o | 3 public D
741 741 | |
742 742 o | 2 public C
743 743 |/
744 744 o 1 public B
745 745 |
746 746 o 0 public A
747 747
748 748
749 749 test complete failure
750 750
751 751 $ hg phase --draft 7
752 752 cannot move 1 changesets to a higher phase, use --force
753 753 no phases changed
754 754 [1]
755 755
756 756 $ cd ..
757 757
758 758 test hidden changeset are not cloned as public (issue3935)
759 759
760 760 $ cd initialrepo
761 761
762 762 (enabling evolution)
763 763 $ cat >> $HGRCPATH << EOF
764 764 > [experimental]
765 765 > evolution.createmarkers=True
766 766 > EOF
767 767
768 768 (making a changeset hidden; H in that case)
769 $ hg debugobsolete `hg id --debug -r 5`
769 $ hg debugobsolete `hg id -T "{node}" -r 5`
770 770 1 new obsolescence markers
771 771 obsoleted 1 changesets
772 772
773 773 $ cd ..
774 774 $ hg clone initialrepo clonewithobs
775 775 requesting all changes
776 776 adding changesets
777 777 adding manifests
778 778 adding file changes
779 779 added 7 changesets with 6 changes to 6 files
780 780 new changesets 4a2df7238c3b:17a481b3bccb
781 781 test-debug-phase: new rev 0: x -> 0
782 782 test-debug-phase: new rev 1: x -> 0
783 783 test-debug-phase: new rev 2: x -> 0
784 784 test-debug-phase: new rev 3: x -> 0
785 785 test-debug-phase: new rev 4: x -> 0
786 786 test-debug-phase: new rev 5: x -> 0
787 787 test-debug-phase: new rev 6: x -> 0
788 788 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
789 789 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
790 790 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
791 791 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
792 792 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> public
793 793 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
794 794 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> public
795 795 updating to branch default
796 796 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
797 797 $ cd clonewithobs
798 798 $ hg log -G --template "{rev} {phase} {desc}\n"
799 799 @ 6 public merge B' and E
800 800 |\
801 801 | o 5 public B'
802 802 | |
803 803 o | 4 public E
804 804 | |
805 805 o | 3 public D
806 806 | |
807 807 o | 2 public C
808 808 |/
809 809 o 1 public B
810 810 |
811 811 o 0 public A
812 812
813 813
814 814 test verify repo containing hidden changesets, which should not abort just
815 815 because repo.cancopy() is False
816 816
817 817 $ cd ../initialrepo
818 818 $ hg verify -q
819 819
820 820 $ cd ..
821 821
822 822 check whether HG_PENDING makes pending changes only in related
823 823 repositories visible to an external hook.
824 824
825 825 (emulate a transaction running concurrently by copied
826 826 .hg/phaseroots.pending in subsequent test)
827 827
828 828 $ cat > $TESTTMP/savepending.sh <<EOF
829 829 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
830 830 > exit 1 # to avoid changing phase for subsequent tests
831 831 > EOF
832 832 $ cd push-dest
833 833 $ hg phase 6
834 834 6: draft
835 835 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
836 836 abort: pretxnclose hook exited with status 1
837 837 [40]
838 838 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
839 839
840 840 (check (in)visibility of phaseroot while transaction running in repo)
841 841
842 842 $ cat > $TESTTMP/checkpending.sh <<EOF
843 843 > echo '@initialrepo'
844 844 > hg -R "$TESTTMP/initialrepo" phase 7
845 845 > echo '@push-dest'
846 846 > hg -R "$TESTTMP/push-dest" phase 6
847 847 > exit 1 # to avoid changing phase for subsequent tests
848 848 > EOF
849 849 $ cd ../initialrepo
850 850 $ hg phase 7
851 851 7: public
852 852 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
853 853 @initialrepo
854 854 7: secret
855 855 @push-dest
856 856 6: draft
857 857 abort: pretxnclose hook exited with status 1
858 858 [40]
859 859
860 860 Check that pretxnclose-phase hook can control phase movement
861 861
862 862 $ hg phase --force b3325c91a4d9 --secret
863 863 test-debug-phase: move rev 3: 0 -> 2
864 864 test-debug-phase: move rev 4: 0 -> 2
865 865 test-debug-phase: move rev 5: 1 -> 2
866 866 test-debug-phase: move rev 7: 0 -> 2
867 867 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: public -> secret
868 868 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: public -> secret
869 869 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: draft -> secret
870 870 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: public -> secret
871 871 $ hg log -G -T phases
872 872 @ changeset: 7:17a481b3bccb
873 873 |\ tag: tip
874 874 | | phase: secret
875 875 | | parent: 6:cf9fe039dfd6
876 876 | | parent: 4:a603bfb5a83e
877 877 | | user: test
878 878 | | date: Thu Jan 01 00:00:00 1970 +0000
879 879 | | summary: merge B' and E
880 880 | |
881 881 | o changeset: 6:cf9fe039dfd6
882 882 | | phase: public
883 883 | | parent: 1:27547f69f254
884 884 | | user: test
885 885 | | date: Thu Jan 01 00:00:00 1970 +0000
886 886 | | summary: B'
887 887 | |
888 888 o | changeset: 4:a603bfb5a83e
889 889 | | phase: secret
890 890 | | user: test
891 891 | | date: Thu Jan 01 00:00:00 1970 +0000
892 892 | | summary: E
893 893 | |
894 894 o | changeset: 3:b3325c91a4d9
895 895 | | phase: secret
896 896 | | user: test
897 897 | | date: Thu Jan 01 00:00:00 1970 +0000
898 898 | | summary: D
899 899 | |
900 900 o | changeset: 2:f838bfaca5c7
901 901 |/ phase: public
902 902 | user: test
903 903 | date: Thu Jan 01 00:00:00 1970 +0000
904 904 | summary: C
905 905 |
906 906 o changeset: 1:27547f69f254
907 907 | phase: public
908 908 | user: test
909 909 | date: Thu Jan 01 00:00:00 1970 +0000
910 910 | summary: B
911 911 |
912 912 o changeset: 0:4a2df7238c3b
913 913 phase: public
914 914 user: test
915 915 date: Thu Jan 01 00:00:00 1970 +0000
916 916 summary: A
917 917
918 918
919 919 Install a hook that prevent b3325c91a4d9 to become public
920 920
921 921 $ cat >> .hg/hgrc << EOF
922 922 > [hooks]
923 923 > pretxnclose-phase.nopublish_D = sh -c "(echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]"
924 924 > EOF
925 925
926 926 Try various actions. only the draft move should succeed
927 927
928 928 $ hg phase --public b3325c91a4d9
929 929 abort: pretxnclose-phase.nopublish_D hook exited with status 1
930 930 [40]
931 931 $ hg phase --public a603bfb5a83e
932 932 abort: pretxnclose-phase.nopublish_D hook exited with status 1
933 933 [40]
934 934 $ hg phase --draft 17a481b3bccb
935 935 test-debug-phase: move rev 3: 2 -> 1
936 936 test-debug-phase: move rev 4: 2 -> 1
937 937 test-debug-phase: move rev 7: 2 -> 1
938 938 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: secret -> draft
939 939 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
940 940 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
941 941 $ hg phase --public 17a481b3bccb
942 942 abort: pretxnclose-phase.nopublish_D hook exited with status 1
943 943 [40]
944 944
945 945 $ cd ..
946 946
947 947 Test for the "internal" phase
948 948 =============================
949 949
950 950 Check we deny its usage on older repository
951 951
952 952 $ hg init no-internal-phase --config format.use-internal-phase=no
953 953 $ cd no-internal-phase
954 954 $ hg debugrequires | grep internal-phase
955 955 [1]
956 956 $ echo X > X
957 957 $ hg add X
958 958 $ hg status
959 959 A X
960 960 $ hg --config "phases.new-commit=internal" commit -m "my test internal commit" 2>&1 | grep ProgrammingError
961 961 ** ProgrammingError: this repository does not support the internal phase
962 962 raise error.ProgrammingError(msg) (no-pyoxidizer !)
963 963 *ProgrammingError: this repository does not support the internal phase (glob)
964 964 $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" 2>&1 | grep ProgrammingError
965 965 ** ProgrammingError: this repository does not support the archived phase
966 966 raise error.ProgrammingError(msg) (no-pyoxidizer !)
967 967 *ProgrammingError: this repository does not support the archived phase (glob)
968 968
969 969 $ cd ..
970 970
971 971 Check it works fine with repository that supports it.
972 972
973 973 $ hg init internal-phase --config format.use-internal-phase=yes
974 974 $ cd internal-phase
975 975 $ hg debugrequires | grep internal-phase
976 976 internal-phase-2
977 977 $ mkcommit A
978 978 test-debug-phase: new rev 0: x -> 1
979 979 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
980 980
981 981 Commit an internal changesets
982 982
983 983 $ echo B > B
984 984 $ hg add B
985 985 $ hg status
986 986 A B
987 987 $ hg --config "phases.new-commit=internal" commit -m "my test internal commit"
988 988 test-debug-phase: new rev 1: x -> 96
989 989 test-hook-close-phase: c01c42dffc7f81223397e99652a0703f83e1c5ea: -> internal
990 990
991 991 The changeset is a working parent descendant.
992 992 Per the usual visibility rules, it is made visible.
993 993
994 994 $ hg log -G -l 3
995 995 @ changeset: 1:c01c42dffc7f
996 996 | tag: tip
997 997 | user: test
998 998 | date: Thu Jan 01 00:00:00 1970 +0000
999 999 | summary: my test internal commit
1000 1000 |
1001 1001 o changeset: 0:4a2df7238c3b
1002 1002 user: test
1003 1003 date: Thu Jan 01 00:00:00 1970 +0000
1004 1004 summary: A
1005 1005
1006 1006
1007 1007 Commit is hidden as expected
1008 1008
1009 1009 $ hg up 0
1010 1010 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1011 1011 $ hg log -G
1012 1012 @ changeset: 0:4a2df7238c3b
1013 1013 tag: tip
1014 1014 user: test
1015 1015 date: Thu Jan 01 00:00:00 1970 +0000
1016 1016 summary: A
1017 1017
1018 1018 The hidden commit is an orphan but doesn't show up without --hidden
1019 1019 And internal changesets are not considered for unstability.
1020 1020
1021 $ hg debugobsolete `hg id --debug -ir 0`
1021 $ hg debugobsolete `hg id -T "{node}" -r 0`
1022 1022 1 new obsolescence markers
1023 1023 obsoleted 1 changesets
1024 1024 $ hg --hidden log -G -r '(0::) - 0'
1025 1025 o changeset: 1:c01c42dffc7f
1026 1026 | tag: tip
1027 1027 ~ user: test
1028 1028 date: Thu Jan 01 00:00:00 1970 +0000
1029 1029 summary: my test internal commit
1030 1030
1031 1031 $ hg --hidden log -G -r 'unstable()'
1032 1032
1033 1033 $ hg log -G -r 'unstable()'
1034 1034
1035 1035
1036 1036 Test for archived phase
1037 1037 -----------------------
1038 1038
1039 1039 Commit an archived changesets
1040 1040
1041 1041 $ cd ..
1042 1042 $ hg clone --quiet --pull internal-phase archived-phase \
1043 1043 > --config format.exp-archived-phase=yes \
1044 1044 > --config extensions.phasereport='!' \
1045 1045 > --config hooks.txnclose-phase.test=
1046 1046
1047 1047 $ cd archived-phase
1048 1048
1049 1049 $ echo B > B
1050 1050 $ hg add B
1051 1051 $ hg status
1052 1052 A B
1053 1053 $ hg --config "phases.new-commit=archived" commit -m "my test archived commit"
1054 1054 test-debug-phase: new rev 1: x -> 32
1055 1055 test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125: -> archived
1056 1056
1057 1057 The changeset is a working parent descendant.
1058 1058 Per the usual visibility rules, it is made visible.
1059 1059
1060 1060 $ hg log -G -l 3
1061 1061 @ changeset: 1:8df5997c3361
1062 1062 | tag: tip
1063 1063 | user: test
1064 1064 | date: Thu Jan 01 00:00:00 1970 +0000
1065 1065 | summary: my test archived commit
1066 1066 |
1067 1067 o changeset: 0:4a2df7238c3b
1068 1068 user: test
1069 1069 date: Thu Jan 01 00:00:00 1970 +0000
1070 1070 summary: A
1071 1071
1072 1072
1073 1073 Commit is hidden as expected
1074 1074
1075 1075 $ hg up 0
1076 1076 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1077 1077 $ hg log -G
1078 1078 @ changeset: 0:4a2df7238c3b
1079 1079 tag: tip
1080 1080 user: test
1081 1081 date: Thu Jan 01 00:00:00 1970 +0000
1082 1082 summary: A
1083 1083
1084 1084 $ cd ..
1085 1085
1086 1086 Recommitting an exact match of a public commit shouldn't change it to
1087 1087 draft:
1088 1088
1089 1089 $ cd initialrepo
1090 1090 $ hg phase -r 2
1091 1091 2: public
1092 1092 $ hg up -C 1
1093 1093 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
1094 1094 $ mkcommit C
1095 1095 warning: commit already existed in the repository!
1096 1096 $ hg phase -r 2
1097 1097 2: public
1098 1098
1099 1099 Same, but for secret:
1100 1100
1101 1101 $ hg up 7
1102 1102 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1103 1103 $ mkcommit F -s
1104 1104 test-debug-phase: new rev 8: x -> 2
1105 1105 test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret
1106 1106 $ hg up 7
1107 1107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1108 1108 $ hg phase
1109 1109 7: draft
1110 1110 $ mkcommit F
1111 1111 test-debug-phase: new rev 8: x -> 2
1112 1112 warning: commit already existed in the repository!
1113 1113 test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret
1114 1114 $ hg phase -r tip
1115 1115 8: secret
1116 1116
1117 1117 But what about obsoleted changesets?
1118 1118
1119 1119 $ hg up 4
1120 1120 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1121 1121 $ mkcommit H
1122 1122 test-debug-phase: new rev 5: x -> 2
1123 1123 warning: commit already existed in the repository!
1124 1124 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
1125 1125 $ hg phase -r 5
1126 1126 5: secret
1127 1127 $ hg par
1128 1128 changeset: 5:a030c6be5127
1129 1129 user: test
1130 1130 date: Thu Jan 01 00:00:00 1970 +0000
1131 1131 obsolete: pruned
1132 1132 summary: H
1133 1133
1134 1134 $ hg up tip
1135 1135 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1136 1136 $ cd ..
1137 1137
1138 1138 Testing that command line flags override configuration
1139 1139
1140 1140 $ hg init commit-overrides
1141 1141 $ cd commit-overrides
1142 1142
1143 1143 `hg commit --draft` overrides new-commit=secret
1144 1144
1145 1145 $ mkcommit A --config phases.new-commit='secret' --draft
1146 1146 test-debug-phase: new rev 0: x -> 1
1147 1147 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
1148 1148 $ hglog
1149 1149 @ 0 1 A
1150 1150
1151 1151
1152 1152 `hg commit --secret` overrides new-commit=draft
1153 1153
1154 1154 $ mkcommit B --config phases.new-commit='draft' --secret
1155 1155 test-debug-phase: new rev 1: x -> 2
1156 1156 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> secret
1157 1157 $ hglog
1158 1158 @ 1 2 B
1159 1159 |
1160 1160 o 0 1 A
1161 1161
1162 1162
1163 1163 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now