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