Fossil SCM
Create basic tests for fossil stash with a new file, an edited file, a renamed file and an untouched file. Use fossil stash subcommands to confirm that the right information got stored, and tests borrowed from revert.test to verify that the file system also has the expected content. Note that this does not currently cover the edge case created by fossil mv --soft, let alone the apparent assertion failure reported on list related to stash and fossil mv --soft. These tests pass on my Windows configuration as of [92877364].
Commit
3f3eada10014f184bc272f539383f7ad2ee2ddde
Parent
928773647c47450…
1 file changed
+190
+190
| --- a/test/stash.test | ||
| +++ b/test/stash.test | ||
| @@ -0,0 +1,209 @@ | ||
| 1 | +f1 | |
| 2 | +@@ -1,1 +0,0 @@ | |
| 3 | +-f1 | |
| 4 | + | |
| 5 | +CHANGED f2 | |
| 6 | +--- f2 | |
| ++++ f2 | ||
| 7 | +@@ -1,1 +1,1 @@ | |
| 8 | +-f2 | |
| 9 | ++f2.1 | |
| 10 | + | |
| 11 | +CHANGED f3n | |
| 12 | +--- f3n | |
| ++++ f3n | ||
| 13 | + | |
| 14 | +ADDED f0 | |
| 15 | +Index: f0 | |
| 16 | +================================================================== | |
| 17 | +--- f0 | |
| ++++ f0 | ||
| 18 | +@@ -0,0 +1,1 @@ | |
| 19 | ++f0} | |
| 20 | + | |
| 21 | +######## | |
| 22 | +# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? | |
| 23 | +# fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? | |
| 24 | + | |
| 25 | + Should be triggered by this s$diff_stash_1-diff {[normaliz knownBug+++ f0 | |
| 26 | +@@ -0,0 +1,1 @@ | |
| 27 | ++f0pop | |
| 28 | + | |
| 29 | +stash-test 2 pop { | |
| 30 | + DELETE f1 | |
| 31 | + UPDATE f2 | |
| 32 | + UPDATE f3n | |
| 33 | + ADDED f0 | |
| 34 | +} -changes { | |
| 35 | + ADDED f0 | |
| 36 | + MISSING f1 | |
| 37 | + EDITED f2 | |
| 38 | + RENAMED f3 -> f3n | |
| 39 | +} -addremove { | |
| 40 | + D ELETConfirm there is no longer a stash saved | |
| 41 | +fossil stash list | |
| 42 | +test stash-2-list {[first_data_line] eq "empty stash"} | |
| 43 | + | |
| 44 | + | |
| 45 | +# Test stashed mv withou'fossil undo' is00 | |
| 46 | +# with checkin [b8 | |
| 47 | +#+ f3n | |
| 48 | +ash-WY-1 test. | |
| 49 | +fossil chec{out -=========================== | |
| 50 | +--- f0 | |
| ++++ f0 | ||
| 51 | +@@ -0,0 +1,1 @@ | |
| 52 | ++f0} | |
| 53 | + | |
| 54 | +######## | |
| 55 | +# fossil stash show|cat ?STASHID? ?DIF | |
| 56 | + } $args] | |
| 57 | + horce c1 | |
| 58 | +fossistas# Test stashed mv without touc | |
| 59 | +--- f2 | |
| ++++ f2 | ||
| 60 | +@@ -1,1 +1,1 @f1 | |
| 61 | +@@ -1,1 +0,0 @@ | |
| 62 | +-f1 | |
| 63 | + | |
| 64 | +CHANGED f2 | |
| 65 | +--- f2 | |
| ++++ f2 | ||
| 66 | +@@ -1,1 +1,1 @@ | |
| 67 | +-f2 | |
| 68 | ++f2.1 | |
| 69 | + | |
| 70 | +CHANGED f3n | |
| 71 | +--- f3n | |
| ++++ f3n | ||
| 72 | + | |
| 73 | +ADDED f0 | |
| 74 | +Index: f0 | |
| 75 | +================================================================== | |
| 76 | +--- f0 | |
| ++++ f0 | ||
| 77 | +@@ -0,0 +1,1 @@ | |
| 78 | ++f0} | |
| 79 | + | |
| 80 | +######## | |
| 81 | +# fossil stash show|c fossil-users | |
| 82 | +# from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 | |
| 83 | +# with checkin [b8c7af5bd9] plus a local patch on CentOS 5 | |
| 84 | +# 64 bit intel, 8-byte pointer, 4-byte integer | |
| 85 | +# Stashed renamed file said: | |
| 86 | +# fossil: ./src/delta.c:231: checksum: Assertion '...' failed. | |
| 87 | +# Should be triggered by this stash-WY-1 test. | |
| 88 | +fossil checn REVERT f1 | |
| 89 | + ly ?STASHID? | |
| 90 | +# fossil stash goto | |
| 91 | +# fossil: ./src/f1newsh pop | |
| 92 | + | |
| 93 | +stash-test 2 pop { | |
| 94 | + DELETE f1 | |
| 95 | + UPDATE f2 | |
| 96 | + UPDATE f3f3 -knownbugs {-changescatch {exec $::fossilexe info} res | |
| 97 | +if {![regexp {use --repository} $res]} { | |
| 98 | + puts stderr "Cannot run this test within an open checkout" | |
| 99 | + return | |
| 100 | +} | |
| 101 | + | |
| 102 | +repo_initta_ 0,0 @@ | |
| 103 | +-f1 | |
| 104 | + | |
| 105 | +CHANGED f2 | |
| 106 | +--- f2 | |
| ++++ f2 | ||
| 107 | +@@ -1,1 +1,1 @@ | |
| 108 | +-f2 | |
| 109 | ++f2.1 | |
| 110 | + | |
| 111 | +CHANGED f3n | |
| 112 | +--- f3n | |
| ++++ f3n | ||
| 113 | +ash-WY-1 test. | |
| 114 | +fossil chec{out -=========================== | |
| 115 | +--- f0 | |
| ++++ f0 | ||
| 116 | +@@ -0,0 +1,1 @@ | |
| 117 | ++f0} | |
| 118 | + | |
| 119 | +######## | |
| 120 | +# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? | |
| 121 | +# fossil stash [g]diff ?STASHID? ?D | |
| 122 | + set result [be triggered by this s$f1his stash-stashorce c1 | |
| 123 | +fossistash-l clean REVERT f1 | |
| 124 | + ly ?STASHID? | |
| 125 | +# fossil stash goto | |
| 126 | +# fossil: ./src/f1newsh postash- f3f3 -known bugs {-changes} | |
| 127 | + | |
| 128 | + MISSING f3 ADDED f3n | |
| 129 | + ADDED f2n | |
| 130 | + DELETED fstash-_init2 | |
| 131 | +--- f2 | |
| ++++repo_iniStashpo_init2 | ||
| 132 | +--- f2 | |
| ++++repo_init2 | ||
| 133 | +--- f2 | |
| ++++\ | ||
| 134 | + "RENAME f2 f2n\n MOVED_Frepo_init2 | |
| 135 | +--- f2 | |
| ++++ f2 | ||
| 136 | +@@ -1,1 +1,1 @@ | |
| 137 | +-f2 | |
| 138 | ++f2.1 | |
| 139 | + | |
| 140 | +CHANGED f3n | |
| 141 | +--- f3n | |
| ++++ f3n | ||
| 142 | + | |
| 143 | +ADDED f0 | |
| 144 | +Ind;#;#MISSING f3 ADDED f3n | |
| 145 | +4-mv "mv --hard f2 f2n" { | |
| 146 | + RENAM ADDED f2n | |
| 147 | + DELETED f2stash-st stash-2-list {[first_data_line] eq "empty stash"} | |
| 148 | + | |
| 149 | + | |
| 150 | +# Test stashed mv without touching the file system | |
| 151 | +# Issue reported by email to fossil-users | |
| 152 | +# from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 | |
| 153 | +# with checkin [b8c7af5bd9] plus a local patch on CentOS 5 | |
| 154 | +# 64 bit intel, 8-byte pointer, 4-byte integer | |
| 155 | +# Stashed renamed fistash-ion '...' failed. | |
| 156 | +# Should be triggered by this stash-WY-1 test. | |
| 157 | +fossil catch {exec $::fossilexe info} res | |
| 158 | +if {![regexp {use --repository} $res]} { | |
| 159 | + puts stderr "Cannot run this test within an open checkout" | |
| 160 | + return | |
| 161 | +} | |
| 162 | + | |
| 163 | +repo_initta_ 0,0 @@ | |
| 164 | +-f1 | |
| 165 | + | |
| 166 | +CHANGED f2 | |
| 167 | +--- f2 | |
| ++++ f2 | ||
| 168 | +@@ -1,1 +1,1 @@ | |
| 169 | +-f2 | |
| 170 | ++f2.1 | |
| 171 | + | |
| 172 | +CHANGED f3n | |
| 173 | +--- f3n | |
| ++++ f3n | ||
| 174 | + | |
| 175 | +ADDED f0 | |
| 176 | +Index: f0 | |
| 177 | +================================================================== | |
| 178 | +--- f0 | |
| ++++ f0 | ||
| 179 | +@@ -0,0 +1,1 @@ | |
| 180 | ++f0} | |
| 181 | + | |
| 182 | +######## | |
| 183 | +# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? | |
| 184 | +# fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? | |
| 185 | + | |
| 186 | + Should be triggered by this s$f1his stash-WY-1 test. | |
| 187 | +fossil chec{out --force c1 | |
| 188 | +fossilif {false} { | |
| 189 | +# skip this test, what should stash actually do with a | |
| 190 | +# soft rename?B} |
| --- a/test/stash.test | |
| +++ b/test/stash.test | |
| @@ -0,0 +1,209 @@ | |
| ++++ f2 | |
| ++++ f3n | |
| ++++ f0 | |
| ++++ f0 | |
| ++++ f2 | |
| ++++ f2 | |
| ++++ f3n | |
| ++++ f0 | |
| ++++ f2 | |
| ++++ f3n | |
| ++++ f0 | |
| ++++repo_iniStashpo_init2 | |
| ++++repo_init2 | |
| ++++\ | |
| ++++ f2 | |
| ++++ f3n | |
| ++++ f2 | |
| ++++ f3n | |
| ++++ f0 | |
| --- a/test/stash.test | |
| +++ b/test/stash.test | |
| @@ -0,0 +1,209 @@ | |
| 1 | f1 |
| 2 | @@ -1,1 +0,0 @@ |
| 3 | -f1 |
| 4 | |
| 5 | CHANGED f2 |
| 6 | --- f2 |
| ++++ f2 | |
| 7 | @@ -1,1 +1,1 @@ |
| 8 | -f2 |
| 9 | +f2.1 |
| 10 | |
| 11 | CHANGED f3n |
| 12 | --- f3n |
| ++++ f3n | |
| 13 | |
| 14 | ADDED f0 |
| 15 | Index: f0 |
| 16 | ================================================================== |
| 17 | --- f0 |
| ++++ f0 | |
| 18 | @@ -0,0 +1,1 @@ |
| 19 | +f0} |
| 20 | |
| 21 | ######## |
| 22 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 23 | # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? |
| 24 | |
| 25 | Should be triggered by this s$diff_stash_1-diff {[normaliz knownBug+++ f0 |
| 26 | @@ -0,0 +1,1 @@ |
| 27 | +f0pop |
| 28 | |
| 29 | stash-test 2 pop { |
| 30 | DELETE f1 |
| 31 | UPDATE f2 |
| 32 | UPDATE f3n |
| 33 | ADDED f0 |
| 34 | } -changes { |
| 35 | ADDED f0 |
| 36 | MISSING f1 |
| 37 | EDITED f2 |
| 38 | RENAMED f3 -> f3n |
| 39 | } -addremove { |
| 40 | D ELETConfirm there is no longer a stash saved |
| 41 | fossil stash list |
| 42 | test stash-2-list {[first_data_line] eq "empty stash"} |
| 43 | |
| 44 | |
| 45 | # Test stashed mv withou'fossil undo' is00 |
| 46 | # with checkin [b8 |
| 47 | #+ f3n |
| 48 | ash-WY-1 test. |
| 49 | fossil chec{out -=========================== |
| 50 | --- f0 |
| ++++ f0 | |
| 51 | @@ -0,0 +1,1 @@ |
| 52 | +f0} |
| 53 | |
| 54 | ######## |
| 55 | # fossil stash show|cat ?STASHID? ?DIF |
| 56 | } $args] |
| 57 | horce c1 |
| 58 | fossistas# Test stashed mv without touc |
| 59 | --- f2 |
| ++++ f2 | |
| 60 | @@ -1,1 +1,1 @f1 |
| 61 | @@ -1,1 +0,0 @@ |
| 62 | -f1 |
| 63 | |
| 64 | CHANGED f2 |
| 65 | --- f2 |
| ++++ f2 | |
| 66 | @@ -1,1 +1,1 @@ |
| 67 | -f2 |
| 68 | +f2.1 |
| 69 | |
| 70 | CHANGED f3n |
| 71 | --- f3n |
| ++++ f3n | |
| 72 | |
| 73 | ADDED f0 |
| 74 | Index: f0 |
| 75 | ================================================================== |
| 76 | --- f0 |
| ++++ f0 | |
| 77 | @@ -0,0 +1,1 @@ |
| 78 | +f0} |
| 79 | |
| 80 | ######## |
| 81 | # fossil stash show|c fossil-users |
| 82 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 83 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 84 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 85 | # Stashed renamed file said: |
| 86 | # fossil: ./src/delta.c:231: checksum: Assertion '...' failed. |
| 87 | # Should be triggered by this stash-WY-1 test. |
| 88 | fossil checn REVERT f1 |
| 89 | ly ?STASHID? |
| 90 | # fossil stash goto |
| 91 | # fossil: ./src/f1newsh pop |
| 92 | |
| 93 | stash-test 2 pop { |
| 94 | DELETE f1 |
| 95 | UPDATE f2 |
| 96 | UPDATE f3f3 -knownbugs {-changescatch {exec $::fossilexe info} res |
| 97 | if {![regexp {use --repository} $res]} { |
| 98 | puts stderr "Cannot run this test within an open checkout" |
| 99 | return |
| 100 | } |
| 101 | |
| 102 | repo_initta_ 0,0 @@ |
| 103 | -f1 |
| 104 | |
| 105 | CHANGED f2 |
| 106 | --- f2 |
| ++++ f2 | |
| 107 | @@ -1,1 +1,1 @@ |
| 108 | -f2 |
| 109 | +f2.1 |
| 110 | |
| 111 | CHANGED f3n |
| 112 | --- f3n |
| ++++ f3n | |
| 113 | ash-WY-1 test. |
| 114 | fossil chec{out -=========================== |
| 115 | --- f0 |
| ++++ f0 | |
| 116 | @@ -0,0 +1,1 @@ |
| 117 | +f0} |
| 118 | |
| 119 | ######## |
| 120 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 121 | # fossil stash [g]diff ?STASHID? ?D |
| 122 | set result [be triggered by this s$f1his stash-stashorce c1 |
| 123 | fossistash-l clean REVERT f1 |
| 124 | ly ?STASHID? |
| 125 | # fossil stash goto |
| 126 | # fossil: ./src/f1newsh postash- f3f3 -known bugs {-changes} |
| 127 | |
| 128 | MISSING f3 ADDED f3n |
| 129 | ADDED f2n |
| 130 | DELETED fstash-_init2 |
| 131 | --- f2 |
| ++++repo_iniStashpo_init2 | |
| 132 | --- f2 |
| ++++repo_init2 | |
| 133 | --- f2 |
| ++++\ | |
| 134 | "RENAME f2 f2n\n MOVED_Frepo_init2 |
| 135 | --- f2 |
| ++++ f2 | |
| 136 | @@ -1,1 +1,1 @@ |
| 137 | -f2 |
| 138 | +f2.1 |
| 139 | |
| 140 | CHANGED f3n |
| 141 | --- f3n |
| ++++ f3n | |
| 142 | |
| 143 | ADDED f0 |
| 144 | Ind;#;#MISSING f3 ADDED f3n |
| 145 | 4-mv "mv --hard f2 f2n" { |
| 146 | RENAM ADDED f2n |
| 147 | DELETED f2stash-st stash-2-list {[first_data_line] eq "empty stash"} |
| 148 | |
| 149 | |
| 150 | # Test stashed mv without touching the file system |
| 151 | # Issue reported by email to fossil-users |
| 152 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 153 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 154 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 155 | # Stashed renamed fistash-ion '...' failed. |
| 156 | # Should be triggered by this stash-WY-1 test. |
| 157 | fossil catch {exec $::fossilexe info} res |
| 158 | if {![regexp {use --repository} $res]} { |
| 159 | puts stderr "Cannot run this test within an open checkout" |
| 160 | return |
| 161 | } |
| 162 | |
| 163 | repo_initta_ 0,0 @@ |
| 164 | -f1 |
| 165 | |
| 166 | CHANGED f2 |
| 167 | --- f2 |
| ++++ f2 | |
| 168 | @@ -1,1 +1,1 @@ |
| 169 | -f2 |
| 170 | +f2.1 |
| 171 | |
| 172 | CHANGED f3n |
| 173 | --- f3n |
| ++++ f3n | |
| 174 | |
| 175 | ADDED f0 |
| 176 | Index: f0 |
| 177 | ================================================================== |
| 178 | --- f0 |
| ++++ f0 | |
| 179 | @@ -0,0 +1,1 @@ |
| 180 | +f0} |
| 181 | |
| 182 | ######## |
| 183 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 184 | # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? |
| 185 | |
| 186 | Should be triggered by this s$f1his stash-WY-1 test. |
| 187 | fossil chec{out --force c1 |
| 188 | fossilif {false} { |
| 189 | # skip this test, what should stash actually do with a |
| 190 | # soft rename?B} |