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
+187
+187
| --- a/test/stash.test | ||
| +++ b/test/stash.test | ||
| @@ -0,0 +1,206 @@ | ||
| 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 | +fossil stash show | |
| 26 | +test stash- Should be triggered by this s$diff_stash_ts {f0 f2 f3} -notexists {f1} | |
| 27 | +fo1-diff {[normaliz knownBug+++ f0 | |
| 28 | +@@ -0,0 +1,1 @@ | |
| 29 | ++f0pop | |
| 30 | + | |
| 31 | +stash-test 2 pop { | |
| 32 | + DELETE f1 | |
| 33 | + UPDATE f2 | |
| 34 | + UPDATE f3n | |
| 35 | + ADDED f0 | |
| 36 | +} -changes { | |
| 37 | + ADDED f0 | |
| 38 | + MISSING f 1 | |
| 39 | + { | |
| 40 | + DELETED f1 | |
| 41 | +} -exists {f0 f2 f3n} -notexists {f1 f3} | |
| 42 | + | |
| 43 | +# Confirm there is no longer a stash saved | |
| 44 | +fossil stash list | |
| 45 | +test stash-2-list {['fossil undo' isers | |
| 46 | +# from Warren You | |
| 47 | +#+ f3n | |
| 48 | +sum: Assertion '...' failed. | |
| 49 | +# S=========================== | |
| 50 | +--- f0 | |
| ++++ f0 | ||
| 51 | +@@ -0,0 +1,1 @@ | |
| 52 | ++f0} | |
| 53 | + | |
| 54 | +######## | |
| 55 | +# fossil stash show|cat ?STASHID? ?DIF | |
| 56 | + } $args] | |
| 57 | + huld be triggestasist | |
| 58 | +test stash-2-list {[first_ | |
| 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|cwithout touching the file system | |
| 82 | +# Issue reported by email to fossil-users | |
| 83 | +# from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 | |
| 84 | +# with checkin [b8c7af5bd9] plus a local patch on CentOS 5 | |
| 85 | +# 64 bit intel, 8-byte pointer, 4-byte integer | |
| 86 | +# Stashed renamed file said: | |
| 87 | +# fossil: ./src/delta.c:231: checksum: Assertion '...' faile this stash-WY-1 test. | |
| 88 | +fossil checkout --force c1 | |
| 89 | +fossil clean REVERT f1 | |
| 90 | + { | |
| 91 | + RENAMED f2 -> f2n | |
| 92 | +} -a | |
| 93 | +# fossil: ./src/f1newsf3 -knownbugs {-changescatch {exec $::fossilexe info} res | |
| 94 | +if {![regexp {use --repository} $res]} { | |
| 95 | + puts stderr "Cannot run this test within an open checkout" | |
| 96 | + return | |
| 97 | +} | |
| 98 | + | |
| 99 | +repo_init a 0,0 @@ | |
| 100 | +-f1 | |
| 101 | + | |
| 102 | +CHANGED f2 | |
| 103 | +--- f2 | |
| ++++ f2 | ||
| 104 | +@@ -1,1 +1,1 @@ | |
| 105 | +-f2 | |
| 106 | ++f2.1 | |
| 107 | + | |
| 108 | +CHANGED f3n | |
| 109 | +--- f3n | |
| ++++ f3n | ||
| 110 | +sum: Assertion '...' failed. | |
| 111 | +# S=========================== | |
| 112 | +--- f0 | |
| ++++ f0 | ||
| 113 | +@@ -0,0 +1,1 @@ | |
| 114 | ++f0} | |
| 115 | + | |
| 116 | +######## | |
| 117 | +# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? | |
| 118 | +# fossil stash [g]diff ?STASHID? ?D | |
| 119 | + set result [tash show | |
| 120 | +test stash- Sf1 checksum:stashuld be triggestash-red by this stash-WY-1 test. | |
| 121 | +fossil checkout --force c1 | |
| 122 | +fossil clean REVERT f1 | |
| 123 | +stash-ewsf3 -known bugs {-changes} | |
| 124 | + | |
| 125 | + MISSING f3 ADDED f3n | |
| 126 | + ADDED f2n | |
| 127 | + DELETED fstash-_init2 | |
| 128 | +--- f2 | |
| ++++repo_iniStashpo_init2 | ||
| 129 | +--- f2 | |
| ++++repo_init2 | ||
| 130 | +--- f2 | |
| ++++\ | ||
| 131 | + "RENAME f2 f2n\n MOVED_Frepo_init2 | |
| 132 | +--- f2 | |
| ++++ f2 | ||
| 133 | +@@ -1,1 +1,1 @@ | |
| 134 | +-f2 | |
| 135 | ++f2.1 | |
| 136 | + | |
| 137 | +CHANGED f3n | |
| 138 | +--- f3n | |
| ++++ f3n | ||
| 139 | + | |
| 140 | +ADDED f0 | |
| 141 | +Ind;#;#MISSING f3 ADDED f3n | |
| 142 | +4-mv "mv --hard f2 f2n" { | |
| 143 | + RENAM ADDED f2n | |
| 144 | + DELETED f2stash-Confirm there is no longer a stash saved | |
| 145 | +fossil stash list | |
| 146 | +test stash-2-list {[first_data_line] eq "empty stash"} | |
| 147 | + | |
| 148 | + | |
| 149 | +# Test stashed mv without touching the file system | |
| 150 | +# Issue reported by email to fossil-users | |
| 151 | +# from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 | |
| 152 | +# with checkin [b8c7af5bd9] plus a local patch on CentOS 5 | |
| 153 | +# 64 bstash-amed file said: | |
| 154 | +# fossil: ./src/delta.c:231: checksum: Assertion '...' fcatch {exec $::fossilexe info} res | |
| 155 | +if {![regexp {use --repository} $res]} { | |
| 156 | + puts stderr "Cannot run this test within an open checkout" | |
| 157 | + return | |
| 158 | +} | |
| 159 | + | |
| 160 | +repo_init a 0,0 @@ | |
| 161 | +-f1 | |
| 162 | + | |
| 163 | +CHANGED f2 | |
| 164 | +--- f2 | |
| ++++ f2 | ||
| 165 | +@@ -1,1 +1,1 @@ | |
| 166 | +-f2 | |
| 167 | ++f2.1 | |
| 168 | + | |
| 169 | +CHANGED f3n | |
| 170 | +--- f3n | |
| ++++ f3n | ||
| 171 | + | |
| 172 | +ADDED f0 | |
| 173 | +Index: f0 | |
| 174 | +================================================================== | |
| 175 | +--- f0 | |
| ++++ f0 | ||
| 176 | +@@ -0,0 +1,1 @@ | |
| 177 | ++f0} | |
| 178 | + | |
| 179 | +######## | |
| 180 | +# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? | |
| 181 | +# fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? | |
| 182 | + | |
| 183 | +fossil stash show | |
| 184 | +test stash- Sf1 checksum: Assertion '...' failed. | |
| 185 | +# Should be triggerif {false} { | |
| 186 | +# skip this test, what should stash actually do with a | |
| 187 | +# soft rename?B} |
| --- a/test/stash.test | |
| +++ b/test/stash.test | |
| @@ -0,0 +1,206 @@ | |
| ++++ 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,206 @@ | |
| 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 | fossil stash show |
| 26 | test stash- Should be triggered by this s$diff_stash_ts {f0 f2 f3} -notexists {f1} |
| 27 | fo1-diff {[normaliz knownBug+++ f0 |
| 28 | @@ -0,0 +1,1 @@ |
| 29 | +f0pop |
| 30 | |
| 31 | stash-test 2 pop { |
| 32 | DELETE f1 |
| 33 | UPDATE f2 |
| 34 | UPDATE f3n |
| 35 | ADDED f0 |
| 36 | } -changes { |
| 37 | ADDED f0 |
| 38 | MISSING f 1 |
| 39 | { |
| 40 | DELETED f1 |
| 41 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 42 | |
| 43 | # Confirm there is no longer a stash saved |
| 44 | fossil stash list |
| 45 | test stash-2-list {['fossil undo' isers |
| 46 | # from Warren You |
| 47 | #+ f3n |
| 48 | sum: Assertion '...' failed. |
| 49 | # S=========================== |
| 50 | --- f0 |
| ++++ f0 | |
| 51 | @@ -0,0 +1,1 @@ |
| 52 | +f0} |
| 53 | |
| 54 | ######## |
| 55 | # fossil stash show|cat ?STASHID? ?DIF |
| 56 | } $args] |
| 57 | huld be triggestasist |
| 58 | test stash-2-list {[first_ |
| 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|cwithout touching the file system |
| 82 | # Issue reported by email to fossil-users |
| 83 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 84 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 85 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 86 | # Stashed renamed file said: |
| 87 | # fossil: ./src/delta.c:231: checksum: Assertion '...' faile this stash-WY-1 test. |
| 88 | fossil checkout --force c1 |
| 89 | fossil clean REVERT f1 |
| 90 | { |
| 91 | RENAMED f2 -> f2n |
| 92 | } -a |
| 93 | # fossil: ./src/f1newsf3 -knownbugs {-changescatch {exec $::fossilexe info} res |
| 94 | if {![regexp {use --repository} $res]} { |
| 95 | puts stderr "Cannot run this test within an open checkout" |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | repo_init a 0,0 @@ |
| 100 | -f1 |
| 101 | |
| 102 | CHANGED f2 |
| 103 | --- f2 |
| ++++ f2 | |
| 104 | @@ -1,1 +1,1 @@ |
| 105 | -f2 |
| 106 | +f2.1 |
| 107 | |
| 108 | CHANGED f3n |
| 109 | --- f3n |
| ++++ f3n | |
| 110 | sum: Assertion '...' failed. |
| 111 | # S=========================== |
| 112 | --- f0 |
| ++++ f0 | |
| 113 | @@ -0,0 +1,1 @@ |
| 114 | +f0} |
| 115 | |
| 116 | ######## |
| 117 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 118 | # fossil stash [g]diff ?STASHID? ?D |
| 119 | set result [tash show |
| 120 | test stash- Sf1 checksum:stashuld be triggestash-red by this stash-WY-1 test. |
| 121 | fossil checkout --force c1 |
| 122 | fossil clean REVERT f1 |
| 123 | stash-ewsf3 -known bugs {-changes} |
| 124 | |
| 125 | MISSING f3 ADDED f3n |
| 126 | ADDED f2n |
| 127 | DELETED fstash-_init2 |
| 128 | --- f2 |
| ++++repo_iniStashpo_init2 | |
| 129 | --- f2 |
| ++++repo_init2 | |
| 130 | --- f2 |
| ++++\ | |
| 131 | "RENAME f2 f2n\n MOVED_Frepo_init2 |
| 132 | --- f2 |
| ++++ f2 | |
| 133 | @@ -1,1 +1,1 @@ |
| 134 | -f2 |
| 135 | +f2.1 |
| 136 | |
| 137 | CHANGED f3n |
| 138 | --- f3n |
| ++++ f3n | |
| 139 | |
| 140 | ADDED f0 |
| 141 | Ind;#;#MISSING f3 ADDED f3n |
| 142 | 4-mv "mv --hard f2 f2n" { |
| 143 | RENAM ADDED f2n |
| 144 | DELETED f2stash-Confirm there is no longer a stash saved |
| 145 | fossil stash list |
| 146 | test stash-2-list {[first_data_line] eq "empty stash"} |
| 147 | |
| 148 | |
| 149 | # Test stashed mv without touching the file system |
| 150 | # Issue reported by email to fossil-users |
| 151 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 152 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 153 | # 64 bstash-amed file said: |
| 154 | # fossil: ./src/delta.c:231: checksum: Assertion '...' fcatch {exec $::fossilexe info} res |
| 155 | if {![regexp {use --repository} $res]} { |
| 156 | puts stderr "Cannot run this test within an open checkout" |
| 157 | return |
| 158 | } |
| 159 | |
| 160 | repo_init a 0,0 @@ |
| 161 | -f1 |
| 162 | |
| 163 | CHANGED f2 |
| 164 | --- f2 |
| ++++ f2 | |
| 165 | @@ -1,1 +1,1 @@ |
| 166 | -f2 |
| 167 | +f2.1 |
| 168 | |
| 169 | CHANGED f3n |
| 170 | --- f3n |
| ++++ f3n | |
| 171 | |
| 172 | ADDED f0 |
| 173 | Index: f0 |
| 174 | ================================================================== |
| 175 | --- f0 |
| ++++ f0 | |
| 176 | @@ -0,0 +1,1 @@ |
| 177 | +f0} |
| 178 | |
| 179 | ######## |
| 180 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 181 | # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? |
| 182 | |
| 183 | fossil stash show |
| 184 | test stash- Sf1 checksum: Assertion '...' failed. |
| 185 | # Should be triggerif {false} { |
| 186 | # skip this test, what should stash actually do with a |
| 187 | # soft rename?B} |