chiark / gitweb /
stgit.el: Add "d" for a few diff commands, similar to git.el
[stgit] / t / t1601-delete-many.sh
CommitLineData
87bcf96e
KH
1#!/bin/sh
2# Copyright (c) 2006 Karl Hasselström
3test_description='Test the delete command (deleting many patches at once).'
4. ./test-lib.sh
5
6test_expect_success \
7 'Initialize the StGIT repository' \
8 'stg init'
9
10test_expect_success \
11 'Create five applied and five unapplied patches' \
12 '
ddb1a259
KH
13 stg new p0 -m p0 &&
14 echo p0 > foo.txt &&
ea5b7bf3 15 git add foo.txt &&
87bcf96e
KH
16 stg refresh &&
17 for i in 1 2 3 4 5 6 7 8 9; do
ddb1a259
KH
18 stg new p$i -m p$i &&
19 echo p$i >> foo.txt &&
87bcf96e
KH
20 stg refresh;
21 done &&
22 stg pop -n 5
23 '
24
25test_expect_success \
26 'Delete some patches' \
27 '
f9d9a062
CM
28 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
29 [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p6 p7 p8 p9" ] &&
ddb1a259 30 stg delete p7 p6 p3 p4 &&
f9d9a062
CM
31 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
32 [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ]
87bcf96e
KH
33 '
34
35test_expect_success \
36 'Delete some more patches, some of which do not exist' \
37 '
f9d9a062
CM
38 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
39 [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
f03004e2 40 command_error stg delete p7 p8 p2 p0 &&
f9d9a062
CM
41 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
42 [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ]
87bcf96e
KH
43 '
44
45test_expect_success \
46 'Delete a range of patches' \
47 '
f9d9a062
CM
48 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
49 [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
ddb1a259 50 stg delete p1..p8 &&
f9d9a062
CM
51 [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
52 [ "$(echo $(stg series --unapplied --noprefix))" = "p9" ]
87bcf96e
KH
53 '
54
55test_done