Commit | Line | Data |
---|---|---|
64354a2d CM |
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 && | |
eff17c6b | 24 | stg refresh --annotate="foo notes" |
64354a2d CM |
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 | ' | |
eff17c6b CM |
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\] " | |
64354a2d CM |
49 | ' |
50 | ||
51 | test_expect_success \ | |
52 | 'Check the "push" log' \ | |
53 | ' | |
54 | stg pop && | |
55 | echo foo > test2 && stg add test2 && stg refresh && | |
56 | stg push && | |
eff17c6b | 57 | stg log --full | grep -q -e "^push " |
64354a2d CM |
58 | ' |
59 | ||
60 | test_expect_success \ | |
61 | 'Check the "push(f)" log' \ | |
62 | ' | |
63 | stg pop && | |
64 | stg refresh -m "Foo2 Patch" && | |
65 | stg push && | |
eff17c6b | 66 | stg log --full | grep -q -e "^push(f) " |
64354a2d CM |
67 | ' |
68 | ||
69 | test_expect_success \ | |
70 | 'Check the "push(m)" log' \ | |
71 | ' | |
72 | stg pop && | |
73 | echo foo2 > test && stg refresh && | |
74 | stg push && | |
eff17c6b | 75 | stg log --full | grep -q -e "^push(m) " |
64354a2d CM |
76 | ' |
77 | ||
78 | test_expect_success \ | |
0f4eba6a CM |
79 | 'Check the "push(c)" log' \ |
80 | ' | |
81 | echo bar > test && stg refresh && | |
82 | stg pop && | |
83 | echo foo > test && stg refresh && | |
84 | ! stg push && | |
eff17c6b | 85 | stg log --full | grep -q -e "^push(c) " |
0f4eba6a CM |
86 | ' |
87 | ||
88 | test_expect_success \ | |
64354a2d CM |
89 | 'Check the push "undo" log' \ |
90 | ' | |
91 | stg push --undo && | |
eff17c6b | 92 | stg log --full bar | grep -q -e "^undo " |
64354a2d CM |
93 | ' |
94 | ||
95 | test_expect_success \ | |
96 | 'Check the refresh "undo" log' \ | |
97 | ' | |
98 | stg refresh --undo && | |
eff17c6b | 99 | stg log --full | grep -q -e "^undo " |
64354a2d CM |
100 | ' |
101 | ||
102 | test_done |