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 && | |
ea5b7bf3 | 23 | git 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 | 38 | stg log --full foo | grep -q -e "^refresh" && |
eff17c6b CM |
39 | stg log --full | grep -q -e "^refresh" |
40 | ' | |
41 | ||
42 | test_expect_success \ | |
43 | 'Check the log annotation' \ | |
44 | ' | |
ea7634bb CM |
45 | stg log foo | grep -q -e "\[refresh\] foo notes " && |
46 | stg log bar | grep -q -e "\[refresh\] " && | |
47 | stg refresh -p foo --annotate="foo notes 2" && | |
48 | stg log foo | grep -q -v -e "\[refresh\] foo notes " && | |
49 | stg log foo | grep -q -e "\[refresh\] foo notes 2" | |
64354a2d CM |
50 | ' |
51 | ||
52 | test_expect_success \ | |
53 | 'Check the "push" log' \ | |
54 | ' | |
55 | stg pop && | |
ea5b7bf3 | 56 | echo foo > test2 && git add test2 && stg refresh && |
64354a2d | 57 | stg push && |
eff17c6b | 58 | stg log --full | grep -q -e "^push " |
64354a2d CM |
59 | ' |
60 | ||
61 | test_expect_success \ | |
62 | 'Check the "push(f)" log' \ | |
63 | ' | |
64 | stg pop && | |
ed60fdae | 65 | stg edit -m "Foo2 Patch" && |
64354a2d | 66 | stg push && |
eff17c6b | 67 | stg log --full | grep -q -e "^push(f) " |
64354a2d CM |
68 | ' |
69 | ||
70 | test_expect_success \ | |
71 | 'Check the "push(m)" log' \ | |
72 | ' | |
73 | stg pop && | |
74 | echo foo2 > test && stg refresh && | |
75 | stg push && | |
eff17c6b | 76 | stg log --full | grep -q -e "^push(m) " |
64354a2d CM |
77 | ' |
78 | ||
79 | test_expect_success \ | |
0f4eba6a CM |
80 | 'Check the "push(c)" log' \ |
81 | ' | |
82 | echo bar > test && stg refresh && | |
83 | stg pop && | |
84 | echo foo > test && stg refresh && | |
85 | ! stg push && | |
eff17c6b | 86 | stg log --full | grep -q -e "^push(c) " |
0f4eba6a CM |
87 | ' |
88 | ||
89 | test_expect_success \ | |
64354a2d CM |
90 | 'Check the push "undo" log' \ |
91 | ' | |
92 | stg push --undo && | |
eff17c6b | 93 | stg log --full bar | grep -q -e "^undo " |
64354a2d CM |
94 | ' |
95 | ||
96 | test_expect_success \ | |
97 | 'Check the refresh "undo" log' \ | |
98 | ' | |
99 | stg refresh --undo && | |
eff17c6b | 100 | stg log --full | grep -q -e "^undo " |
64354a2d CM |
101 | ' |
102 | ||
103 | test_done |