Fossil SCM
More fossil stash cases, this time with snapshot and interesting results of fossil stash diff in when a DELETE was snapshotted.
Commit
94b95307741d72392aae427eebc46ccaf08fa87a
Parent
34cf38b0974fa51…
1 file changed
+115
-28
+115
-28
| --- test/stash.test | ||
| +++ test/stash.test | ||
| @@ -40,40 +40,39 @@ | ||
| 40 | 40 | # -exists One or more listed files don't exist |
| 41 | 41 | # -notexists One or more listed files do exist |
| 42 | 42 | # |
| 43 | 43 | # Also, if the exit status of fossil stash does not match |
| 44 | 44 | # expectations, the rest of the areas are not tested. |
| 45 | -proc stash-test {testid stashArgs expectedStashOutput args} { | |
| 45 | +proc test_result_state {testid cmdArgs expectedOutput args} { | |
| 46 | 46 | global RESULT |
| 47 | 47 | set passed 1 |
| 48 | 48 | |
| 49 | 49 | set args [dict merge { |
| 50 | 50 | -changes {} -addremove {} -exists {} -notexists {} -knownbugs {} |
| 51 | 51 | } $args] |
| 52 | 52 | |
| 53 | 53 | set knownbugs [dict get $args "-knownbugs"] |
| 54 | - | |
| 55 | - set result [fossil stash {*}$stashArgs] | |
| 54 | + set result $::RESULT | |
| 56 | 55 | set code $::CODE |
| 57 | - if {[lindex $stashArgs end] eq "-expectError"} { | |
| 58 | - test stash-$testid-CODE {$code} [knownBug "-code" $knownbugs] | |
| 56 | + if {[lindex $cmdArgs end] eq "-expectError"} { | |
| 57 | + test $testid-CODE {$code} [knownBug "-code" $knownbugs] | |
| 59 | 58 | if {!$code} { |
| 60 | 59 | return |
| 61 | 60 | } |
| 62 | 61 | } else { |
| 63 | - test stash-$testid-CODE {!$code} [knownBug "-code" $knownbugs] | |
| 62 | + test $testid-CODE {!$code} [knownBug "-code" $knownbugs] | |
| 64 | 63 | if {$code} { |
| 65 | 64 | return |
| 66 | 65 | } |
| 67 | 66 | } |
| 68 | - test_status_list stash-$testid $result $expectedStashOutput [knownBug "-result" $knownbugs] | |
| 67 | + test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs] | |
| 69 | 68 | |
| 70 | 69 | set statusListTests [list -changes changes -addremove {addremove -n}] |
| 71 | 70 | foreach {key fossilArgs} $statusListTests { |
| 72 | 71 | set expected [dict get $args $key] |
| 73 | 72 | set result [fossil {*}$fossilArgs] |
| 74 | - test_status_list stash-$testid$key $result $expected [knownBug $key $knownbugs] | |
| 73 | + test_status_list $testid$key $result $expected [knownBug $key $knownbugs] | |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | set fileExistsTests [list -exists 1 does -notexists 0 should] |
| 78 | 77 | foreach {key expected verb} $fileExistsTests { |
| 79 | 78 | foreach path [dict get $args $key] { |
| @@ -80,15 +79,20 @@ | ||
| 80 | 79 | if {[file exists $path] != $expected} { |
| 81 | 80 | set passed 0 |
| 82 | 81 | protOut " Failure: File $verb not exist: $path" |
| 83 | 82 | } |
| 84 | 83 | } |
| 85 | - test stash-$testid$key $passed [knownBug $key $knownbugs] | |
| 84 | + test $testid$key $passed [knownBug $key $knownbugs] | |
| 86 | 85 | } |
| 87 | 86 | |
| 88 | 87 | #fossil undo |
| 89 | 88 | } |
| 89 | + | |
| 90 | +proc stash-test {testid stashArgs expectedStashOutput args} { | |
| 91 | + fossil stash {*}$stashArgs | |
| 92 | + return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args] | |
| 93 | +} | |
| 90 | 94 | |
| 91 | 95 | catch {exec $::fossilexe info} res |
| 92 | 96 | if {![regexp {use --repository} $res]} { |
| 93 | 97 | puts stderr "Cannot run this test within an open checkout" |
| 94 | 98 | return |
| @@ -199,28 +203,30 @@ | ||
| 199 | 203 | fossil stash list |
| 200 | 204 | test stash-2-list {[first_data_line] eq "empty stash"} |
| 201 | 205 | |
| 202 | 206 | |
| 203 | 207 | # Test stashed mv without touching the file system |
| 204 | -fossil checkout --force c1 | |
| 205 | -fossil clean | |
| 206 | -fossil mv --soft f1 f1new | |
| 207 | -#no such file: c:/Users/Ross/Documents/tmp/ftest/stash/f1b | |
| 208 | -stash-test x1 {save -m "Reported 2016-02-09"} { | |
| 209 | - REVERT f1 | |
| 210 | - DELETE f1new | |
| 211 | -} -changes { | |
| 212 | -} -addremove { | |
| 213 | -} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result} | |
| 214 | - | |
| 215 | 208 | # Issue reported by email to fossil-users |
| 216 | 209 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 217 | 210 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 218 | 211 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 219 | 212 | # Stashed renamed file said: |
| 220 | 213 | # fossil: ./src/delta.c:231: checksum: Assertion '...' failed. |
| 221 | -# Should be triggered by the above stash-x1 test. | |
| 214 | +# Should be triggered by this stash-WY-1 test. | |
| 215 | +fossil checkout --force c1 | |
| 216 | +fossil clean | |
| 217 | +fossil mv --soft f1 f1new | |
| 218 | +stash-test WY-1 {save -m "Reported 2016-02-09"} { | |
| 219 | + REVERT f1 | |
| 220 | + DELETE f1new | |
| 221 | +} -changes { | |
| 222 | +} -addremove { | |
| 223 | +} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result} | |
| 224 | +# TODO: add tests that verify the saved stash is sensible. Possibly | |
| 225 | +# by applying it and checking results. But until the SQLITE_CONSTRAINT | |
| 226 | +# error is fixed, there is nothing stashed to test. | |
| 227 | + | |
| 222 | 228 | |
| 223 | 229 | |
| 224 | 230 | # Test stashing the combination of a renamed file and an added file that |
| 225 | 231 | # uses the renamed file's original filename. I expect to see the same |
| 226 | 232 | # behavior as fossil revert: calmly back out both the rename and the |
| @@ -240,13 +246,18 @@ | ||
| 240 | 246 | stash-test 2-1 {save -m "f1b"} { |
| 241 | 247 | REVERT f1 |
| 242 | 248 | DELETE f1n |
| 243 | 249 | } -exists {f1} -notexists {f1n} -knownbugs {-code -result} |
| 244 | 250 | # TODO: add tests that verify the saved stash is sensible. Possibly |
| 245 | -# by applying it and checking results. | |
| 251 | +# by applying it and checking results. But until the MISSING file | |
| 252 | +# error is fixed, there is nothing stashed to test. | |
| 253 | + | |
| 246 | 254 | |
| 247 | - | |
| 255 | +# Test stashing a newly added (but never committed) file. As with | |
| 256 | +# fossil revert, fossil stash save unmanages the new file, but | |
| 257 | +# leaves the copy present on disk. This is undocumented, but | |
| 258 | +# probably sensible. | |
| 248 | 259 | repo_init |
| 249 | 260 | write_file f1 "f1" |
| 250 | 261 | write_file f2 "f2" |
| 251 | 262 | fossil add f1 f2 |
| 252 | 263 | fossil commit -m "baseline" |
| @@ -274,26 +285,35 @@ | ||
| 274 | 285 | } -addremove { |
| 275 | 286 | } -exists {f1 f2 f3} -notexists {} |
| 276 | 287 | fossil status |
| 277 | 288 | |
| 278 | 289 | |
| 279 | - | |
| 290 | +# Test stashing a rename of one file with at least one file | |
| 291 | +# unchanged. This should stash (and revert) just the rename | |
| 292 | +# operation. Instead it also stores and touches the unchanged file. | |
| 280 | 293 | repo_init |
| 281 | 294 | write_file f1 "f1" |
| 282 | 295 | write_file f2 "f2" |
| 283 | 296 | fossil add f1 f2 |
| 284 | 297 | fossil commit -m "baseline" |
| 298 | + | |
| 285 | 299 | fossil mv --hard f2 f2n |
| 286 | -fossil changes | |
| 300 | +test_result_state stash-3-4-mv "mv --hard f2 f2n" { | |
| 301 | + RENAME f2 f2n | |
| 302 | + MOVED_FILE f2 | |
| 303 | +} -changes { | |
| 304 | + RENAMED f2n | |
| 305 | +} -addremove { | |
| 306 | +} -exists {f1 f2n} -notexists {f2} | |
| 307 | + | |
| 287 | 308 | stash-test 3-2 {save -m f2n} { |
| 288 | 309 | REVERT f2 |
| 289 | 310 | DELETE f2n |
| 290 | 311 | } -exists {f1 f2} -notexists {f2n} -knownbugs {-result} |
| 291 | -#fossil status | |
| 292 | 312 | fossil stash show |
| 293 | -test 3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug | |
| 294 | -test 3-2-show-2 {[regexp {\sf2n} $RESULT]} | |
| 313 | +test stash-3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug | |
| 314 | +test stash-3-2-show-2 {[regexp {\sf2n} $RESULT]} | |
| 295 | 315 | stash-test 3-2-pop {pop} { |
| 296 | 316 | UPDATE f1 |
| 297 | 317 | UPDATE f2n |
| 298 | 318 | } -changes { |
| 299 | 319 | RENAMED f2n |
| @@ -300,12 +320,79 @@ | ||
| 300 | 320 | } -addremove { |
| 301 | 321 | ADDED f2n |
| 302 | 322 | DELETED f2 |
| 303 | 323 | } -exists {f1 f2n} -notexists {f2} -knownbugs {-changes} |
| 304 | 324 | |
| 325 | + | |
| 326 | + | |
| 327 | +######## | |
| 305 | 328 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 329 | + | |
| 330 | +repo_init | |
| 331 | +write_file f1 "f1" | |
| 332 | +write_file f2 "f2" | |
| 333 | +write_file f3 "f3" | |
| 334 | +fossil add f1 f2 f3 | |
| 335 | +fossil commit -m "c1" --tag c1 | |
| 336 | + | |
| 337 | +# Make simple changes and snapshot them | |
| 338 | +# Add f0, edit f2 | |
| 339 | +write_file f0 "f0" | |
| 340 | +fossil add f0 | |
| 341 | +write_file f2 "f2.1" | |
| 342 | + | |
| 343 | +# Snapshot these changes and confirm | |
| 344 | +stash-test 4-1 {snapshot -m "snap 1"} { | |
| 345 | +} -changes { | |
| 346 | + ADDED f0 | |
| 347 | + EDITED f2 | |
| 348 | +} -addremove { | |
| 349 | +} -exists {f0 f1 f2 f3} -notexists {} | |
| 350 | +fossil stash diff | |
| 351 | +test stash-4-1-diff-CODE {!$::CODE} | |
| 352 | +fossil stash show | |
| 353 | +test stash-4-1-show-1 {[regexp {CHANGED f2} $RESULT]} | |
| 354 | +test stash-4-1-show-2 {[regexp {ADDED f0} $RESULT]} | |
| 355 | + | |
| 356 | +# remove f1 and snapshot | |
| 357 | +file delete f1 | |
| 358 | +fossil rm f1 | |
| 359 | +stash-test 4-2 {snapshot -m "snap 2"} { | |
| 360 | +} -changes { | |
| 361 | + ADDED f0 | |
| 362 | + DELETED f1 | |
| 363 | + EDITED f2 | |
| 364 | +} -addremove { | |
| 365 | +} -exists {f0 f2 f3} -notexists {f1} | |
| 366 | +fossil stash diff | |
| 367 | +test stash-4-2-diff-CODE {!$::CODE} ;# knownBug | |
| 368 | +fossil stash show | |
| 369 | +test stash-4-2-show-1 {[regexp {DELETE f1} $RESULT]} | |
| 370 | +test stash-4-2-show-2 {[regexp {CHANGED f2} $RESULT]} | |
| 371 | +test stash-4-2-show-3 {[regexp {ADDED f0} $RESULT]} | |
| 372 | + | |
| 373 | + | |
| 374 | +# rename f3 to f3n and snapshot | |
| 375 | +file rename -force f3 f3n | |
| 376 | +fossil mv f3 f3n | |
| 377 | +stash-test 4-3 {snapshot -m "snap 3"} { | |
| 378 | +} -changes { | |
| 379 | + ADDED f0 | |
| 380 | + DELETED f1 | |
| 381 | + EDITED f2 | |
| 382 | + RENAMED f3n | |
| 383 | +} -addremove { | |
| 384 | +} -exists {f0 f2 f3n} -notexists {f1 f3} | |
| 385 | +fossil stash diff | |
| 386 | +test stash-4-3-diff-CODE {!$::CODE} ;# knownBug | |
| 387 | +fossil stash show | |
| 388 | +test stash-4-3-show-1 {[regexp {DELETE f1} $RESULT]} | |
| 389 | +test stash-4-3-show-2 {[regexp {CHANGED f2} $RESULT]} | |
| 390 | +test stash-4-3-show-2 {[regexp {CHANGED f3n} $RESULT]} | |
| 391 | +test stash-4-3-show-3 {[regexp {ADDED f0} $RESULT]} | |
| 392 | + | |
| 306 | 393 | # fossil stash apply ?STASHID? |
| 307 | 394 | # fossil stash goto ?STASHID? |
| 308 | 395 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 309 | 396 | |
| 310 | 397 | #fossil checkout --force c1 |
| 311 | 398 | #fossil clean |
| 312 | 399 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -40,40 +40,39 @@ | |
| 40 | # -exists One or more listed files don't exist |
| 41 | # -notexists One or more listed files do exist |
| 42 | # |
| 43 | # Also, if the exit status of fossil stash does not match |
| 44 | # expectations, the rest of the areas are not tested. |
| 45 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 46 | global RESULT |
| 47 | set passed 1 |
| 48 | |
| 49 | set args [dict merge { |
| 50 | -changes {} -addremove {} -exists {} -notexists {} -knownbugs {} |
| 51 | } $args] |
| 52 | |
| 53 | set knownbugs [dict get $args "-knownbugs"] |
| 54 | |
| 55 | set result [fossil stash {*}$stashArgs] |
| 56 | set code $::CODE |
| 57 | if {[lindex $stashArgs end] eq "-expectError"} { |
| 58 | test stash-$testid-CODE {$code} [knownBug "-code" $knownbugs] |
| 59 | if {!$code} { |
| 60 | return |
| 61 | } |
| 62 | } else { |
| 63 | test stash-$testid-CODE {!$code} [knownBug "-code" $knownbugs] |
| 64 | if {$code} { |
| 65 | return |
| 66 | } |
| 67 | } |
| 68 | test_status_list stash-$testid $result $expectedStashOutput [knownBug "-result" $knownbugs] |
| 69 | |
| 70 | set statusListTests [list -changes changes -addremove {addremove -n}] |
| 71 | foreach {key fossilArgs} $statusListTests { |
| 72 | set expected [dict get $args $key] |
| 73 | set result [fossil {*}$fossilArgs] |
| 74 | test_status_list stash-$testid$key $result $expected [knownBug $key $knownbugs] |
| 75 | } |
| 76 | |
| 77 | set fileExistsTests [list -exists 1 does -notexists 0 should] |
| 78 | foreach {key expected verb} $fileExistsTests { |
| 79 | foreach path [dict get $args $key] { |
| @@ -80,15 +79,20 @@ | |
| 80 | if {[file exists $path] != $expected} { |
| 81 | set passed 0 |
| 82 | protOut " Failure: File $verb not exist: $path" |
| 83 | } |
| 84 | } |
| 85 | test stash-$testid$key $passed [knownBug $key $knownbugs] |
| 86 | } |
| 87 | |
| 88 | #fossil undo |
| 89 | } |
| 90 | |
| 91 | catch {exec $::fossilexe info} res |
| 92 | if {![regexp {use --repository} $res]} { |
| 93 | puts stderr "Cannot run this test within an open checkout" |
| 94 | return |
| @@ -199,28 +203,30 @@ | |
| 199 | fossil stash list |
| 200 | test stash-2-list {[first_data_line] eq "empty stash"} |
| 201 | |
| 202 | |
| 203 | # Test stashed mv without touching the file system |
| 204 | fossil checkout --force c1 |
| 205 | fossil clean |
| 206 | fossil mv --soft f1 f1new |
| 207 | #no such file: c:/Users/Ross/Documents/tmp/ftest/stash/f1b |
| 208 | stash-test x1 {save -m "Reported 2016-02-09"} { |
| 209 | REVERT f1 |
| 210 | DELETE f1new |
| 211 | } -changes { |
| 212 | } -addremove { |
| 213 | } -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result} |
| 214 | |
| 215 | # Issue reported by email to fossil-users |
| 216 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 217 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 218 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 219 | # Stashed renamed file said: |
| 220 | # fossil: ./src/delta.c:231: checksum: Assertion '...' failed. |
| 221 | # Should be triggered by the above stash-x1 test. |
| 222 | |
| 223 | |
| 224 | # Test stashing the combination of a renamed file and an added file that |
| 225 | # uses the renamed file's original filename. I expect to see the same |
| 226 | # behavior as fossil revert: calmly back out both the rename and the |
| @@ -240,13 +246,18 @@ | |
| 240 | stash-test 2-1 {save -m "f1b"} { |
| 241 | REVERT f1 |
| 242 | DELETE f1n |
| 243 | } -exists {f1} -notexists {f1n} -knownbugs {-code -result} |
| 244 | # TODO: add tests that verify the saved stash is sensible. Possibly |
| 245 | # by applying it and checking results. |
| 246 | |
| 247 | |
| 248 | repo_init |
| 249 | write_file f1 "f1" |
| 250 | write_file f2 "f2" |
| 251 | fossil add f1 f2 |
| 252 | fossil commit -m "baseline" |
| @@ -274,26 +285,35 @@ | |
| 274 | } -addremove { |
| 275 | } -exists {f1 f2 f3} -notexists {} |
| 276 | fossil status |
| 277 | |
| 278 | |
| 279 | |
| 280 | repo_init |
| 281 | write_file f1 "f1" |
| 282 | write_file f2 "f2" |
| 283 | fossil add f1 f2 |
| 284 | fossil commit -m "baseline" |
| 285 | fossil mv --hard f2 f2n |
| 286 | fossil changes |
| 287 | stash-test 3-2 {save -m f2n} { |
| 288 | REVERT f2 |
| 289 | DELETE f2n |
| 290 | } -exists {f1 f2} -notexists {f2n} -knownbugs {-result} |
| 291 | #fossil status |
| 292 | fossil stash show |
| 293 | test 3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug |
| 294 | test 3-2-show-2 {[regexp {\sf2n} $RESULT]} |
| 295 | stash-test 3-2-pop {pop} { |
| 296 | UPDATE f1 |
| 297 | UPDATE f2n |
| 298 | } -changes { |
| 299 | RENAMED f2n |
| @@ -300,12 +320,79 @@ | |
| 300 | } -addremove { |
| 301 | ADDED f2n |
| 302 | DELETED f2 |
| 303 | } -exists {f1 f2n} -notexists {f2} -knownbugs {-changes} |
| 304 | |
| 305 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 306 | # fossil stash apply ?STASHID? |
| 307 | # fossil stash goto ?STASHID? |
| 308 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 309 | |
| 310 | #fossil checkout --force c1 |
| 311 | #fossil clean |
| 312 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -40,40 +40,39 @@ | |
| 40 | # -exists One or more listed files don't exist |
| 41 | # -notexists One or more listed files do exist |
| 42 | # |
| 43 | # Also, if the exit status of fossil stash does not match |
| 44 | # expectations, the rest of the areas are not tested. |
| 45 | proc test_result_state {testid cmdArgs expectedOutput args} { |
| 46 | global RESULT |
| 47 | set passed 1 |
| 48 | |
| 49 | set args [dict merge { |
| 50 | -changes {} -addremove {} -exists {} -notexists {} -knownbugs {} |
| 51 | } $args] |
| 52 | |
| 53 | set knownbugs [dict get $args "-knownbugs"] |
| 54 | set result $::RESULT |
| 55 | set code $::CODE |
| 56 | if {[lindex $cmdArgs end] eq "-expectError"} { |
| 57 | test $testid-CODE {$code} [knownBug "-code" $knownbugs] |
| 58 | if {!$code} { |
| 59 | return |
| 60 | } |
| 61 | } else { |
| 62 | test $testid-CODE {!$code} [knownBug "-code" $knownbugs] |
| 63 | if {$code} { |
| 64 | return |
| 65 | } |
| 66 | } |
| 67 | test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs] |
| 68 | |
| 69 | set statusListTests [list -changes changes -addremove {addremove -n}] |
| 70 | foreach {key fossilArgs} $statusListTests { |
| 71 | set expected [dict get $args $key] |
| 72 | set result [fossil {*}$fossilArgs] |
| 73 | test_status_list $testid$key $result $expected [knownBug $key $knownbugs] |
| 74 | } |
| 75 | |
| 76 | set fileExistsTests [list -exists 1 does -notexists 0 should] |
| 77 | foreach {key expected verb} $fileExistsTests { |
| 78 | foreach path [dict get $args $key] { |
| @@ -80,15 +79,20 @@ | |
| 79 | if {[file exists $path] != $expected} { |
| 80 | set passed 0 |
| 81 | protOut " Failure: File $verb not exist: $path" |
| 82 | } |
| 83 | } |
| 84 | test $testid$key $passed [knownBug $key $knownbugs] |
| 85 | } |
| 86 | |
| 87 | #fossil undo |
| 88 | } |
| 89 | |
| 90 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 91 | fossil stash {*}$stashArgs |
| 92 | return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args] |
| 93 | } |
| 94 | |
| 95 | catch {exec $::fossilexe info} res |
| 96 | if {![regexp {use --repository} $res]} { |
| 97 | puts stderr "Cannot run this test within an open checkout" |
| 98 | return |
| @@ -199,28 +203,30 @@ | |
| 203 | fossil stash list |
| 204 | test stash-2-list {[first_data_line] eq "empty stash"} |
| 205 | |
| 206 | |
| 207 | # Test stashed mv without touching the file system |
| 208 | # Issue reported by email to fossil-users |
| 209 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| 210 | # with checkin [b8c7af5bd9] plus a local patch on CentOS 5 |
| 211 | # 64 bit intel, 8-byte pointer, 4-byte integer |
| 212 | # Stashed renamed file said: |
| 213 | # fossil: ./src/delta.c:231: checksum: Assertion '...' failed. |
| 214 | # Should be triggered by this stash-WY-1 test. |
| 215 | fossil checkout --force c1 |
| 216 | fossil clean |
| 217 | fossil mv --soft f1 f1new |
| 218 | stash-test WY-1 {save -m "Reported 2016-02-09"} { |
| 219 | REVERT f1 |
| 220 | DELETE f1new |
| 221 | } -changes { |
| 222 | } -addremove { |
| 223 | } -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result} |
| 224 | # TODO: add tests that verify the saved stash is sensible. Possibly |
| 225 | # by applying it and checking results. But until the SQLITE_CONSTRAINT |
| 226 | # error is fixed, there is nothing stashed to test. |
| 227 | |
| 228 | |
| 229 | |
| 230 | # Test stashing the combination of a renamed file and an added file that |
| 231 | # uses the renamed file's original filename. I expect to see the same |
| 232 | # behavior as fossil revert: calmly back out both the rename and the |
| @@ -240,13 +246,18 @@ | |
| 246 | stash-test 2-1 {save -m "f1b"} { |
| 247 | REVERT f1 |
| 248 | DELETE f1n |
| 249 | } -exists {f1} -notexists {f1n} -knownbugs {-code -result} |
| 250 | # TODO: add tests that verify the saved stash is sensible. Possibly |
| 251 | # by applying it and checking results. But until the MISSING file |
| 252 | # error is fixed, there is nothing stashed to test. |
| 253 | |
| 254 | |
| 255 | # Test stashing a newly added (but never committed) file. As with |
| 256 | # fossil revert, fossil stash save unmanages the new file, but |
| 257 | # leaves the copy present on disk. This is undocumented, but |
| 258 | # probably sensible. |
| 259 | repo_init |
| 260 | write_file f1 "f1" |
| 261 | write_file f2 "f2" |
| 262 | fossil add f1 f2 |
| 263 | fossil commit -m "baseline" |
| @@ -274,26 +285,35 @@ | |
| 285 | } -addremove { |
| 286 | } -exists {f1 f2 f3} -notexists {} |
| 287 | fossil status |
| 288 | |
| 289 | |
| 290 | # Test stashing a rename of one file with at least one file |
| 291 | # unchanged. This should stash (and revert) just the rename |
| 292 | # operation. Instead it also stores and touches the unchanged file. |
| 293 | repo_init |
| 294 | write_file f1 "f1" |
| 295 | write_file f2 "f2" |
| 296 | fossil add f1 f2 |
| 297 | fossil commit -m "baseline" |
| 298 | |
| 299 | fossil mv --hard f2 f2n |
| 300 | test_result_state stash-3-4-mv "mv --hard f2 f2n" { |
| 301 | RENAME f2 f2n |
| 302 | MOVED_FILE f2 |
| 303 | } -changes { |
| 304 | RENAMED f2n |
| 305 | } -addremove { |
| 306 | } -exists {f1 f2n} -notexists {f2} |
| 307 | |
| 308 | stash-test 3-2 {save -m f2n} { |
| 309 | REVERT f2 |
| 310 | DELETE f2n |
| 311 | } -exists {f1 f2} -notexists {f2n} -knownbugs {-result} |
| 312 | fossil stash show |
| 313 | test stash-3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug |
| 314 | test stash-3-2-show-2 {[regexp {\sf2n} $RESULT]} |
| 315 | stash-test 3-2-pop {pop} { |
| 316 | UPDATE f1 |
| 317 | UPDATE f2n |
| 318 | } -changes { |
| 319 | RENAMED f2n |
| @@ -300,12 +320,79 @@ | |
| 320 | } -addremove { |
| 321 | ADDED f2n |
| 322 | DELETED f2 |
| 323 | } -exists {f1 f2n} -notexists {f2} -knownbugs {-changes} |
| 324 | |
| 325 | |
| 326 | |
| 327 | ######## |
| 328 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 329 | |
| 330 | repo_init |
| 331 | write_file f1 "f1" |
| 332 | write_file f2 "f2" |
| 333 | write_file f3 "f3" |
| 334 | fossil add f1 f2 f3 |
| 335 | fossil commit -m "c1" --tag c1 |
| 336 | |
| 337 | # Make simple changes and snapshot them |
| 338 | # Add f0, edit f2 |
| 339 | write_file f0 "f0" |
| 340 | fossil add f0 |
| 341 | write_file f2 "f2.1" |
| 342 | |
| 343 | # Snapshot these changes and confirm |
| 344 | stash-test 4-1 {snapshot -m "snap 1"} { |
| 345 | } -changes { |
| 346 | ADDED f0 |
| 347 | EDITED f2 |
| 348 | } -addremove { |
| 349 | } -exists {f0 f1 f2 f3} -notexists {} |
| 350 | fossil stash diff |
| 351 | test stash-4-1-diff-CODE {!$::CODE} |
| 352 | fossil stash show |
| 353 | test stash-4-1-show-1 {[regexp {CHANGED f2} $RESULT]} |
| 354 | test stash-4-1-show-2 {[regexp {ADDED f0} $RESULT]} |
| 355 | |
| 356 | # remove f1 and snapshot |
| 357 | file delete f1 |
| 358 | fossil rm f1 |
| 359 | stash-test 4-2 {snapshot -m "snap 2"} { |
| 360 | } -changes { |
| 361 | ADDED f0 |
| 362 | DELETED f1 |
| 363 | EDITED f2 |
| 364 | } -addremove { |
| 365 | } -exists {f0 f2 f3} -notexists {f1} |
| 366 | fossil stash diff |
| 367 | test stash-4-2-diff-CODE {!$::CODE} ;# knownBug |
| 368 | fossil stash show |
| 369 | test stash-4-2-show-1 {[regexp {DELETE f1} $RESULT]} |
| 370 | test stash-4-2-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 371 | test stash-4-2-show-3 {[regexp {ADDED f0} $RESULT]} |
| 372 | |
| 373 | |
| 374 | # rename f3 to f3n and snapshot |
| 375 | file rename -force f3 f3n |
| 376 | fossil mv f3 f3n |
| 377 | stash-test 4-3 {snapshot -m "snap 3"} { |
| 378 | } -changes { |
| 379 | ADDED f0 |
| 380 | DELETED f1 |
| 381 | EDITED f2 |
| 382 | RENAMED f3n |
| 383 | } -addremove { |
| 384 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 385 | fossil stash diff |
| 386 | test stash-4-3-diff-CODE {!$::CODE} ;# knownBug |
| 387 | fossil stash show |
| 388 | test stash-4-3-show-1 {[regexp {DELETE f1} $RESULT]} |
| 389 | test stash-4-3-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 390 | test stash-4-3-show-2 {[regexp {CHANGED f3n} $RESULT]} |
| 391 | test stash-4-3-show-3 {[regexp {ADDED f0} $RESULT]} |
| 392 | |
| 393 | # fossil stash apply ?STASHID? |
| 394 | # fossil stash goto ?STASHID? |
| 395 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 396 | |
| 397 | #fossil checkout --force c1 |
| 398 | #fossil clean |
| 399 |