Use list comprehension in uncommit.py for Python 2.3
[stgit/ydirson.git] / t / t1601-delete-many.sh
blob8eff308ebfa7e7477096522ac041b42a24df27f1
1 #!/bin/sh
2 # Copyright (c) 2006 Karl Hasselström
3 test_description='Test the delete command (deleting many patches at once).'
4 . ./test-lib.sh
6 test_expect_success \
7 'Initialize the StGIT repository' \
8 'stg init'
10 test_expect_success \
11 'Create five applied and five unapplied patches' \
13 stg new p0 -m p0 &&
14 echo p0 > foo.txt &&
15 stg add foo.txt &&
16 stg refresh &&
17 for i in 1 2 3 4 5 6 7 8 9; do
18 stg new p$i -m p$i &&
19 echo p$i >> foo.txt &&
20 stg refresh;
21 done &&
22 stg pop -n 5
25 test_expect_success \
26 'Delete some patches' \
28 [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
29 [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ] &&
30 stg delete p7 p6 p3 p4 &&
31 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
32 [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
35 test_expect_success \
36 'Delete some more patches, some of which do not exist' \
38 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
39 [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
40 ! stg delete p7 p8 p2 p0 &&
41 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
42 [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
45 test_expect_success \
46 'Delete a range of patches' \
48 [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
49 [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
50 stg delete p1..p8 &&
51 [ "$(echo $(stg applied))" = "p0" ] &&
52 [ "$(echo $(stg unapplied))" = "p9" ]
55 test_done