| 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 | git 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 "^refresh" && |
| 39 | stg log --full | grep -q -e "^refresh" |
| 40 | ' |
| 41 | |
| 42 | test_expect_success \ |
| 43 | 'Check the log annotation' \ |
| 44 | ' |
| 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" |
| 50 | ' |
| 51 | |
| 52 | test_expect_success \ |
| 53 | 'Check the "push" log' \ |
| 54 | ' |
| 55 | stg pop && |
| 56 | echo foo > test2 && git add test2 && stg refresh && |
| 57 | stg push && |
| 58 | stg log --full | grep -q -e "^push " |
| 59 | ' |
| 60 | |
| 61 | test_expect_success \ |
| 62 | 'Check the "push(f)" log' \ |
| 63 | ' |
| 64 | stg pop && |
| 65 | stg edit -m "Foo2 Patch" && |
| 66 | stg push && |
| 67 | stg log --full | grep -q -e "^push(f) " |
| 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 && |
| 76 | stg log --full | grep -q -e "^push(m) " |
| 77 | ' |
| 78 | |
| 79 | test_expect_success \ |
| 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 && |
| 86 | stg log --full | grep -q -e "^push(c) " |
| 87 | ' |
| 88 | |
| 89 | test_expect_success \ |
| 90 | 'Check the push "undo" log' \ |
| 91 | ' |
| 92 | stg push --undo && |
| 93 | stg log --full bar | grep -q -e "^undo " |
| 94 | ' |
| 95 | |
| 96 | test_expect_success \ |
| 97 | 'Check the refresh "undo" log' \ |
| 98 | ' |
| 99 | stg refresh --undo && |
| 100 | stg log --full | grep -q -e "^undo " |
| 101 | ' |
| 102 | |
| 103 | test_done |