| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 Catalin Marinas |
| 4 | # |
| 5 | |
| 6 | test_description='Test the uncommit command. |
| 7 | |
| 8 | ' |
| 9 | |
| 10 | . ./test-lib.sh |
| 11 | |
| 12 | test_expect_success \ |
| 13 | 'Initialize the StGIT repository' \ |
| 14 | 'stg init |
| 15 | ' |
| 16 | |
| 17 | test_expect_success \ |
| 18 | 'Create the first patch' \ |
| 19 | ' |
| 20 | stg new foo -m "Foo Patch" && |
| 21 | echo foo > test && |
| 22 | stg add test && |
| 23 | stg refresh |
| 24 | ' |
| 25 | |
| 26 | test_expect_success \ |
| 27 | 'Create the second patch' \ |
| 28 | ' |
| 29 | stg new bar -m "Bar Patch" && |
| 30 | echo bar > test && |
| 31 | stg add test && |
| 32 | stg refresh |
| 33 | ' |
| 34 | |
| 35 | test_expect_success \ |
| 36 | 'Commit the patches' \ |
| 37 | ' |
| 38 | stg commit |
| 39 | ' |
| 40 | |
| 41 | test_expect_success \ |
| 42 | 'Uncommit the patches using names' \ |
| 43 | ' |
| 44 | stg uncommit bar foo && |
| 45 | [ "$(stg id foo//top)" == "$(stg id bar//bottom)" ] && |
| 46 | stg commit |
| 47 | ' |
| 48 | |
| 49 | test_expect_success \ |
| 50 | 'Uncommit the patches using prefix' \ |
| 51 | ' |
| 52 | stg uncommit --number=2 foobar && |
| 53 | [ "$(stg id foobar1//top)" == "$(stg id foobar2//bottom)" ] && |
| 54 | stg commit |
| 55 | ' |
| 56 | |
| 57 | test_expect_success \ |
| 58 | 'Uncommit the patches using auto names' \ |
| 59 | ' |
| 60 | stg uncommit --number=2 && |
| 61 | [ "$(stg id foo-patch//top)" == "$(stg id bar-patch//bottom)" ] && |
| 62 | stg commit |
| 63 | ' |
| 64 | |
| 65 | test_expect_success \ |
| 66 | 'Uncommit the patches one by one' \ |
| 67 | ' |
| 68 | stg uncommit && |
| 69 | stg uncommit && |
| 70 | [ "$(stg id foo-patch//top)" == "$(stg id bar-patch//bottom)" ] && |
| 71 | stg commit |
| 72 | ' |
| 73 | test_done |