b0602ff159ec4ff0c712ef9573b6e182428c6ebd
[stgit] / t / t1400-patch-history.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Catalin Marinas
4 #
5
6 test_description='Test the patch history generation.
7
8 '
9
10 . ./test-lib.sh
11
12 test_expect_success \
13 'Initialize the StGIT repository' \
14 '
15 stg init
16 '
17
18 test_expect_success \
19 'Create the first patch' \
20 '
21 stg new foo -m "Foo Patch" &&
22 echo foo > test && echo foo2 >> test &&
23 stg add test &&
24 stg refresh --annotate="foo notes"
25 '
26
27 test_expect_success \
28 'Create the second patch' \
29 '
30 stg new bar -m "Bar Patch" &&
31 echo bar >> test &&
32 stg refresh
33 '
34
35 test_expect_success \
36 'Check the "new" and "refresh" logs' \
37 '
38 stg log --full foo | grep -q -e "^new" &&
39 stg log --full foo | grep -q -e "^refresh" &&
40 stg log --full | grep -q -e "^new" &&
41 stg log --full | grep -q -e "^refresh"
42 '
43
44 test_expect_success \
45 'Check the log annotation' \
46 '
47 stg log foo | grep -q -e "\[refresh\] foo notes " &&
48 stg log bar | grep -q -e "\[refresh\] " &&
49 stg refresh -p foo --annotate="foo notes 2" &&
50 stg log foo | grep -q -v -e "\[refresh\] foo notes " &&
51 stg log foo | grep -q -e "\[refresh\] foo notes 2"
52 '
53
54 test_expect_success \
55 'Check the "push" log' \
56 '
57 stg pop &&
58 echo foo > test2 && stg add test2 && stg refresh &&
59 stg push &&
60 stg log --full | grep -q -e "^push "
61 '
62
63 test_expect_success \
64 'Check the "push(f)" log' \
65 '
66 stg pop &&
67 stg refresh -m "Foo2 Patch" &&
68 stg push &&
69 stg log --full | grep -q -e "^push(f) "
70 '
71
72 test_expect_success \
73 'Check the "push(m)" log' \
74 '
75 stg pop &&
76 echo foo2 > test && stg refresh &&
77 stg push &&
78 stg log --full | grep -q -e "^push(m) "
79 '
80
81 test_expect_success \
82 'Check the "push(c)" log' \
83 '
84 echo bar > test && stg refresh &&
85 stg pop &&
86 echo foo > test && stg refresh &&
87 ! stg push &&
88 stg log --full | grep -q -e "^push(c) "
89 '
90
91 test_expect_success \
92 'Check the push "undo" log' \
93 '
94 stg push --undo &&
95 stg log --full bar | grep -q -e "^undo "
96 '
97
98 test_expect_success \
99 'Check the refresh "undo" log' \
100 '
101 stg refresh --undo &&
102 stg log --full | grep -q -e "^undo "
103 '
104
105 test_done