Fossil SCM
Add tests for the 'unversioned revert' and 'unversioned sync' commands.
Commit
1c99c13398f38b2e2d8839b8a5350d71831ecec4
Parent
a6eb6510756fdda…
2 files changed
+77
-3
+122
-9
+77
-3
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -560,14 +560,14 @@ | ||
| 560 | 560 | # NOTE: Check if we can use any of the environment variables. |
| 561 | 561 | # |
| 562 | 562 | foreach name $names { |
| 563 | 563 | set value [getEnvironmentVariable $name] |
| 564 | 564 | |
| 565 | - if {[string length $value] > 0} then { | |
| 565 | + if {[string length $value] > 0} { | |
| 566 | 566 | set value [file normalize $value] |
| 567 | 567 | |
| 568 | - if {[file exists $value] && [file isdirectory $value]} then { | |
| 568 | + if {[file exists $value] && [file isdirectory $value]} { | |
| 569 | 569 | return $value |
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | |
| @@ -575,11 +575,11 @@ | ||
| 575 | 575 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 576 | 576 | # |
| 577 | 577 | if {$::tcl_platform(platform) ne "windows"} { |
| 578 | 578 | set value /tmp |
| 579 | 579 | |
| 580 | - if {[file exists $value] && [file isdirectory $value]} then { | |
| 580 | + if {[file exists $value] && [file isdirectory $value]} { | |
| 581 | 581 | return $value |
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | # |
| @@ -732,10 +732,84 @@ | ||
| 732 | 732 | } |
| 733 | 733 | append out \n$line |
| 734 | 734 | } |
| 735 | 735 | return [string range $out 1 end] |
| 736 | 736 | } |
| 737 | + | |
| 738 | +# This procedure executes the "fossil server" command. The return value | |
| 739 | +# is the new process identifier. The varName argument refers to a variable | |
| 740 | +# where the "stop argument" is to be stored. This value must eventually be | |
| 741 | +# passed to the [test_stop_server] procedure. | |
| 742 | +proc test_start_server { repository {varName ""} } { | |
| 743 | + global fossilexe | |
| 744 | + set command [list exec $fossilexe server] | |
| 745 | + if {[string length $varName] > 0} { | |
| 746 | + upvar 1 $varName stopArg | |
| 747 | + } | |
| 748 | + if {$::tcl_platform(platform) eq "windows"} { | |
| 749 | + set stopArg [file join [getTemporaryPath] [appendArgs \ | |
| 750 | + [string trim [clock seconds] -] _ [getSeqNo] .stopper]] | |
| 751 | + lappend command --stopper $stopArg | |
| 752 | + } | |
| 753 | + lappend command $repository & | |
| 754 | + set pid [eval $command] | |
| 755 | + if {$::tcl_platform(platform) ne "windows"} { | |
| 756 | + set stopArg $pid | |
| 757 | + } | |
| 758 | + return $pid | |
| 759 | +} | |
| 760 | + | |
| 761 | +# This procedure stops a Fossil server instance that was previously started | |
| 762 | +# by the [test_start_server] procedure. The value of the "stop argument" | |
| 763 | +# will vary by platform as will the exact method used to stop the server. | |
| 764 | +proc test_stop_server { stopArg pid } { | |
| 765 | + if {$::tcl_platform(platform) eq "windows"} { | |
| 766 | + # | |
| 767 | + # NOTE: On Windows, the "stop argument" must be the name of a file | |
| 768 | + # that does NOT already exist. | |
| 769 | + # | |
| 770 | + if {![file exists $stopArg] && \ | |
| 771 | + [catch {write_file $stopArg [clock seconds]}] == 0} then { | |
| 772 | + while {1} { | |
| 773 | + if {[catch { | |
| 774 | + # | |
| 775 | + # NOTE: Using the TaskList utility requires Windows XP or | |
| 776 | + # later. | |
| 777 | + # | |
| 778 | + exec tasklist.exe /FI "PID eq $pid" | |
| 779 | + } result] != 0 || ![regexp -- " $pid " $result]} then { | |
| 780 | + break | |
| 781 | + } | |
| 782 | + after 1000; # wait a bit... | |
| 783 | + } | |
| 784 | + file delete $stopArg | |
| 785 | + return true | |
| 786 | + } | |
| 787 | + } else { | |
| 788 | + # | |
| 789 | + # NOTE: On Unix, the "stop argument" must be an integer identifier | |
| 790 | + # that refers to an existing process. | |
| 791 | + # | |
| 792 | + if {[regexp {^(?:-)?\d+$} $stopArg] && \ | |
| 793 | + [catch {exec kill -TERM $stopArg}] == 0} then { | |
| 794 | + while {1} { | |
| 795 | + if {[catch { | |
| 796 | + # | |
| 797 | + # TODO: Is this portable to all the supported variants of | |
| 798 | + # Unix? It should be, it's POSIX. | |
| 799 | + # | |
| 800 | + exec ps -p $pid | |
| 801 | + } result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} then { | |
| 802 | + break | |
| 803 | + } | |
| 804 | + after 1000; # wait a bit... | |
| 805 | + } | |
| 806 | + return true | |
| 807 | + } | |
| 808 | + } | |
| 809 | + return false | |
| 810 | +} | |
| 737 | 811 | |
| 738 | 812 | # Executes the "fossil http" command. The entire content of the HTTP request |
| 739 | 813 | # is read from the data file name, with [subst] being performed on it prior to |
| 740 | 814 | # submission. Temporary input and output files are created and deleted. The |
| 741 | 815 | # result will be the contents of the temoprary output file. |
| 742 | 816 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -560,14 +560,14 @@ | |
| 560 | # NOTE: Check if we can use any of the environment variables. |
| 561 | # |
| 562 | foreach name $names { |
| 563 | set value [getEnvironmentVariable $name] |
| 564 | |
| 565 | if {[string length $value] > 0} then { |
| 566 | set value [file normalize $value] |
| 567 | |
| 568 | if {[file exists $value] && [file isdirectory $value]} then { |
| 569 | return $value |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | |
| @@ -575,11 +575,11 @@ | |
| 575 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 576 | # |
| 577 | if {$::tcl_platform(platform) ne "windows"} { |
| 578 | set value /tmp |
| 579 | |
| 580 | if {[file exists $value] && [file isdirectory $value]} then { |
| 581 | return $value |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | # |
| @@ -732,10 +732,84 @@ | |
| 732 | } |
| 733 | append out \n$line |
| 734 | } |
| 735 | return [string range $out 1 end] |
| 736 | } |
| 737 | |
| 738 | # Executes the "fossil http" command. The entire content of the HTTP request |
| 739 | # is read from the data file name, with [subst] being performed on it prior to |
| 740 | # submission. Temporary input and output files are created and deleted. The |
| 741 | # result will be the contents of the temoprary output file. |
| 742 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -560,14 +560,14 @@ | |
| 560 | # NOTE: Check if we can use any of the environment variables. |
| 561 | # |
| 562 | foreach name $names { |
| 563 | set value [getEnvironmentVariable $name] |
| 564 | |
| 565 | if {[string length $value] > 0} { |
| 566 | set value [file normalize $value] |
| 567 | |
| 568 | if {[file exists $value] && [file isdirectory $value]} { |
| 569 | return $value |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | |
| @@ -575,11 +575,11 @@ | |
| 575 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 576 | # |
| 577 | if {$::tcl_platform(platform) ne "windows"} { |
| 578 | set value /tmp |
| 579 | |
| 580 | if {[file exists $value] && [file isdirectory $value]} { |
| 581 | return $value |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | # |
| @@ -732,10 +732,84 @@ | |
| 732 | } |
| 733 | append out \n$line |
| 734 | } |
| 735 | return [string range $out 1 end] |
| 736 | } |
| 737 | |
| 738 | # This procedure executes the "fossil server" command. The return value |
| 739 | # is the new process identifier. The varName argument refers to a variable |
| 740 | # where the "stop argument" is to be stored. This value must eventually be |
| 741 | # passed to the [test_stop_server] procedure. |
| 742 | proc test_start_server { repository {varName ""} } { |
| 743 | global fossilexe |
| 744 | set command [list exec $fossilexe server] |
| 745 | if {[string length $varName] > 0} { |
| 746 | upvar 1 $varName stopArg |
| 747 | } |
| 748 | if {$::tcl_platform(platform) eq "windows"} { |
| 749 | set stopArg [file join [getTemporaryPath] [appendArgs \ |
| 750 | [string trim [clock seconds] -] _ [getSeqNo] .stopper]] |
| 751 | lappend command --stopper $stopArg |
| 752 | } |
| 753 | lappend command $repository & |
| 754 | set pid [eval $command] |
| 755 | if {$::tcl_platform(platform) ne "windows"} { |
| 756 | set stopArg $pid |
| 757 | } |
| 758 | return $pid |
| 759 | } |
| 760 | |
| 761 | # This procedure stops a Fossil server instance that was previously started |
| 762 | # by the [test_start_server] procedure. The value of the "stop argument" |
| 763 | # will vary by platform as will the exact method used to stop the server. |
| 764 | proc test_stop_server { stopArg pid } { |
| 765 | if {$::tcl_platform(platform) eq "windows"} { |
| 766 | # |
| 767 | # NOTE: On Windows, the "stop argument" must be the name of a file |
| 768 | # that does NOT already exist. |
| 769 | # |
| 770 | if {![file exists $stopArg] && \ |
| 771 | [catch {write_file $stopArg [clock seconds]}] == 0} then { |
| 772 | while {1} { |
| 773 | if {[catch { |
| 774 | # |
| 775 | # NOTE: Using the TaskList utility requires Windows XP or |
| 776 | # later. |
| 777 | # |
| 778 | exec tasklist.exe /FI "PID eq $pid" |
| 779 | } result] != 0 || ![regexp -- " $pid " $result]} then { |
| 780 | break |
| 781 | } |
| 782 | after 1000; # wait a bit... |
| 783 | } |
| 784 | file delete $stopArg |
| 785 | return true |
| 786 | } |
| 787 | } else { |
| 788 | # |
| 789 | # NOTE: On Unix, the "stop argument" must be an integer identifier |
| 790 | # that refers to an existing process. |
| 791 | # |
| 792 | if {[regexp {^(?:-)?\d+$} $stopArg] && \ |
| 793 | [catch {exec kill -TERM $stopArg}] == 0} then { |
| 794 | while {1} { |
| 795 | if {[catch { |
| 796 | # |
| 797 | # TODO: Is this portable to all the supported variants of |
| 798 | # Unix? It should be, it's POSIX. |
| 799 | # |
| 800 | exec ps -p $pid |
| 801 | } result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} then { |
| 802 | break |
| 803 | } |
| 804 | after 1000; # wait a bit... |
| 805 | } |
| 806 | return true |
| 807 | } |
| 808 | } |
| 809 | return false |
| 810 | } |
| 811 | |
| 812 | # Executes the "fossil http" command. The entire content of the HTTP request |
| 813 | # is read from the data file name, with [subst] being performed on it prior to |
| 814 | # submission. Temporary input and output files are created and deleted. The |
| 815 | # result will be the contents of the temoprary output file. |
| 816 |
+122
-9
| --- test/unversioned.test | ||
| +++ test/unversioned.test | ||
| @@ -26,17 +26,28 @@ | ||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | require_no_open_checkout |
| 29 | 29 | |
| 30 | 30 | test_setup; set rootDir [file normalize [pwd]] |
| 31 | + | |
| 32 | +fossil test-th-eval --open-config {repository} | |
| 33 | +set repository [normalize_result] | |
| 34 | + | |
| 35 | +if {[string length $repository] == 0} { | |
| 36 | + puts "Detection of the open repository file failed." | |
| 37 | + test_cleanup_then_return | |
| 38 | +} | |
| 31 | 39 | |
| 32 | 40 | write_file unversioned1.txt "This is unversioned file #1." |
| 33 | 41 | write_file unversioned2.txt " This is unversioned file #2. " |
| 34 | 42 | write_file "unversioned space.txt" "\nThis is unversioned file #3.\n" |
| 35 | 43 | write_file unversioned4.txt "This is unversioned file #4." |
| 36 | 44 | write_file unversioned5.txt "This is unversioned file #5." |
| 37 | 45 | |
| 46 | +set env(VISUAL) [appendArgs \ | |
| 47 | + [info nameofexecutable] " " [file join $path fake-editor.tcl]] | |
| 48 | + | |
| 38 | 49 | ############################################################################### |
| 39 | 50 | |
| 40 | 51 | fossil unversioned |
| 41 | 52 | test unversioned-1 {[normalize_result] eq \ |
| 42 | 53 | [string map [list %fossil% [file nativename $fossilexe]] {Usage: %fossil%\ |
| @@ -190,13 +201,10 @@ | ||
| 190 | 201 | test unversioned-27 {$hash(before) eq \ |
| 191 | 202 | {b48ba8e2d0b498321dfd13de84867effda399af5}} |
| 192 | 203 | |
| 193 | 204 | ############################################################################### |
| 194 | 205 | |
| 195 | -set env(VISUAL) [appendArgs \ | |
| 196 | - [info nameofexecutable] " " [file join $path fake-editor.tcl]] | |
| 197 | - | |
| 198 | 206 | fossil unversioned edit unversioned4.txt |
| 199 | 207 | test unversioned-28 {[normalize_result] eq {}} |
| 200 | 208 | |
| 201 | 209 | ############################################################################### |
| 202 | 210 | |
| @@ -295,14 +303,119 @@ | ||
| 295 | 303 | {^[0-9a-f]{12} 2016-10-01 00:00:00 30 30 unversioned2\.txt |
| 296 | 304 | [0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 28 28\ |
| 297 | 305 | unversioned5\.txt$} [normalize_result]]} |
| 298 | 306 | |
| 299 | 307 | ############################################################################### |
| 300 | -# | |
| 301 | -# TODO: Add tests for the unversioned "revert" and "sync" sub-commands. | |
| 302 | -# | |
| 303 | -# revert --verbose --dryrun | |
| 304 | -# sync | |
| 305 | -# | |
| 308 | + | |
| 309 | +set password [string trim [clock seconds] -] | |
| 310 | +set remote [appendArgs http://uvtester: $password @localhost:8080/] | |
| 311 | + | |
| 312 | +fossil user new uvtester "Unversioned Test User" $password | |
| 313 | +fossil user capabilities uvtester oy | |
| 314 | + | |
| 315 | +############################################################################### | |
| 316 | + | |
| 317 | +set pid [test_start_server $repository stopArg] | |
| 318 | +puts [appendArgs "Started Fossil server, pid \"" $pid \".] | |
| 319 | + | |
| 320 | +############################################################################### | |
| 321 | + | |
| 322 | +set clientDir [file join $tempPath [appendArgs \ | |
| 323 | + uvtest_ [string trim [clock seconds] -] _ [getSeqNo]]] | |
| 324 | + | |
| 325 | +set savedPwd [pwd] | |
| 326 | +file mkdir $clientDir; cd $clientDir | |
| 327 | +puts [appendArgs "Now in client directory \"" [pwd] \".] | |
| 328 | + | |
| 329 | +############################################################################### | |
| 330 | + | |
| 331 | +fossil_maybe_answer y clone $remote uvrepo.fossil | |
| 332 | +fossil open uvrepo.fossil | |
| 333 | + | |
| 334 | +############################################################################### | |
| 335 | + | |
| 336 | +fossil unversioned list | |
| 337 | +test unversioned-45 {[normalize_result] eq {}} | |
| 338 | + | |
| 339 | +############################################################################### | |
| 340 | + | |
| 341 | +fossil_maybe_answer y unversioned sync $remote | |
| 342 | +test unversioned-46 {[regexp \ | |
| 343 | +{Round-trips: 1 Artifacts sent: 0 received: 0 | |
| 344 | +Round-trips: 1 Artifacts sent: 0 received: 0 | |
| 345 | +Round-trips: 2 Artifacts sent: 0 received: 0 | |
| 346 | +Round-trips: 2 Artifacts sent: 0 received: 2 | |
| 347 | + | |
| 348 | + done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]} | |
| 349 | + | |
| 350 | +############################################################################### | |
| 351 | + | |
| 352 | +fossil unversioned ls | |
| 353 | +test unversioned-47 {[normalize_result] eq {unversioned2.txt | |
| 354 | +unversioned5.txt}} | |
| 355 | + | |
| 356 | +############################################################################### | |
| 357 | + | |
| 358 | +set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic | |
| 359 | + | |
| 360 | +fossil unversioned edit unversioned2.txt | |
| 361 | +test unversioned-48 {[normalize_result] eq {}} | |
| 362 | + | |
| 363 | +unset env(FAKE_EDITOR_SCRIPT) | |
| 364 | + | |
| 365 | +############################################################################### | |
| 366 | + | |
| 367 | +fossil unversioned remove unversioned5.txt | |
| 368 | +test unversioned-49 {[normalize_result] eq {}} | |
| 369 | + | |
| 370 | +############################################################################### | |
| 371 | + | |
| 372 | +fossil unversioned list --all | |
| 373 | +test unversioned-50 {[regexp \ | |
| 374 | +{^[0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 44 44\ | |
| 375 | +unversioned2\.txt | |
| 376 | + \(deleted\) \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 0 0\ | |
| 377 | +unversioned5\.txt$} [normalize_result]]} | |
| 378 | + | |
| 379 | +############################################################################### | |
| 380 | + | |
| 381 | +fossil_maybe_answer y unversioned revert $remote | |
| 382 | +test unversioned-51 {[regexp \ | |
| 383 | +{Round-trips: 1 Artifacts sent: 0 received: 0 | |
| 384 | +Round-trips: 1 Artifacts sent: 0 received: 0 | |
| 385 | +Round-trips: 2 Artifacts sent: 0 received: 0 | |
| 386 | +Round-trips: 2 Artifacts sent: 0 received: 2 | |
| 387 | + | |
| 388 | + done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]} | |
| 389 | + | |
| 390 | +############################################################################### | |
| 391 | + | |
| 392 | +fossil unversioned list | |
| 393 | +test unversioned-52 {[regexp \ | |
| 394 | +{^[0-9a-f]{12} 2016-10-01 00:00:00 30 30\ | |
| 395 | +unversioned2\.txt | |
| 396 | +[0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 28 28\ | |
| 397 | +unversioned5\.txt$} [normalize_result]]} | |
| 398 | + | |
| 399 | +############################################################################### | |
| 400 | + | |
| 401 | +fossil close | |
| 402 | +test unversioned-53 {[normalize_result] eq {}} | |
| 403 | + | |
| 404 | +############################################################################### | |
| 405 | + | |
| 406 | +cd $savedPwd; unset savedPwd | |
| 407 | +file delete -force $clientDir | |
| 408 | +puts [appendArgs "Now in server directory \"" [pwd] \".] | |
| 409 | + | |
| 410 | +############################################################################### | |
| 411 | + | |
| 412 | +set stopped [test_stop_server $stopArg $pid] | |
| 413 | + | |
| 414 | +puts [appendArgs \ | |
| 415 | + [expr {$stopped ? "Stopped" : "Could not stop"}] \ | |
| 416 | + " Fossil server, pid \"" $pid "\", using argument \"" \ | |
| 417 | + $stopArg \".] | |
| 418 | + | |
| 306 | 419 | ############################################################################### |
| 307 | 420 | |
| 308 | 421 | test_cleanup |
| 309 | 422 |
| --- test/unversioned.test | |
| +++ test/unversioned.test | |
| @@ -26,17 +26,28 @@ | |
| 26 | } |
| 27 | |
| 28 | require_no_open_checkout |
| 29 | |
| 30 | test_setup; set rootDir [file normalize [pwd]] |
| 31 | |
| 32 | write_file unversioned1.txt "This is unversioned file #1." |
| 33 | write_file unversioned2.txt " This is unversioned file #2. " |
| 34 | write_file "unversioned space.txt" "\nThis is unversioned file #3.\n" |
| 35 | write_file unversioned4.txt "This is unversioned file #4." |
| 36 | write_file unversioned5.txt "This is unversioned file #5." |
| 37 | |
| 38 | ############################################################################### |
| 39 | |
| 40 | fossil unversioned |
| 41 | test unversioned-1 {[normalize_result] eq \ |
| 42 | [string map [list %fossil% [file nativename $fossilexe]] {Usage: %fossil%\ |
| @@ -190,13 +201,10 @@ | |
| 190 | test unversioned-27 {$hash(before) eq \ |
| 191 | {b48ba8e2d0b498321dfd13de84867effda399af5}} |
| 192 | |
| 193 | ############################################################################### |
| 194 | |
| 195 | set env(VISUAL) [appendArgs \ |
| 196 | [info nameofexecutable] " " [file join $path fake-editor.tcl]] |
| 197 | |
| 198 | fossil unversioned edit unversioned4.txt |
| 199 | test unversioned-28 {[normalize_result] eq {}} |
| 200 | |
| 201 | ############################################################################### |
| 202 | |
| @@ -295,14 +303,119 @@ | |
| 295 | {^[0-9a-f]{12} 2016-10-01 00:00:00 30 30 unversioned2\.txt |
| 296 | [0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 28 28\ |
| 297 | unversioned5\.txt$} [normalize_result]]} |
| 298 | |
| 299 | ############################################################################### |
| 300 | # |
| 301 | # TODO: Add tests for the unversioned "revert" and "sync" sub-commands. |
| 302 | # |
| 303 | # revert --verbose --dryrun |
| 304 | # sync |
| 305 | # |
| 306 | ############################################################################### |
| 307 | |
| 308 | test_cleanup |
| 309 |
| --- test/unversioned.test | |
| +++ test/unversioned.test | |
| @@ -26,17 +26,28 @@ | |
| 26 | } |
| 27 | |
| 28 | require_no_open_checkout |
| 29 | |
| 30 | test_setup; set rootDir [file normalize [pwd]] |
| 31 | |
| 32 | fossil test-th-eval --open-config {repository} |
| 33 | set repository [normalize_result] |
| 34 | |
| 35 | if {[string length $repository] == 0} { |
| 36 | puts "Detection of the open repository file failed." |
| 37 | test_cleanup_then_return |
| 38 | } |
| 39 | |
| 40 | write_file unversioned1.txt "This is unversioned file #1." |
| 41 | write_file unversioned2.txt " This is unversioned file #2. " |
| 42 | write_file "unversioned space.txt" "\nThis is unversioned file #3.\n" |
| 43 | write_file unversioned4.txt "This is unversioned file #4." |
| 44 | write_file unversioned5.txt "This is unversioned file #5." |
| 45 | |
| 46 | set env(VISUAL) [appendArgs \ |
| 47 | [info nameofexecutable] " " [file join $path fake-editor.tcl]] |
| 48 | |
| 49 | ############################################################################### |
| 50 | |
| 51 | fossil unversioned |
| 52 | test unversioned-1 {[normalize_result] eq \ |
| 53 | [string map [list %fossil% [file nativename $fossilexe]] {Usage: %fossil%\ |
| @@ -190,13 +201,10 @@ | |
| 201 | test unversioned-27 {$hash(before) eq \ |
| 202 | {b48ba8e2d0b498321dfd13de84867effda399af5}} |
| 203 | |
| 204 | ############################################################################### |
| 205 | |
| 206 | fossil unversioned edit unversioned4.txt |
| 207 | test unversioned-28 {[normalize_result] eq {}} |
| 208 | |
| 209 | ############################################################################### |
| 210 | |
| @@ -295,14 +303,119 @@ | |
| 303 | {^[0-9a-f]{12} 2016-10-01 00:00:00 30 30 unversioned2\.txt |
| 304 | [0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 28 28\ |
| 305 | unversioned5\.txt$} [normalize_result]]} |
| 306 | |
| 307 | ############################################################################### |
| 308 | |
| 309 | set password [string trim [clock seconds] -] |
| 310 | set remote [appendArgs http://uvtester: $password @localhost:8080/] |
| 311 | |
| 312 | fossil user new uvtester "Unversioned Test User" $password |
| 313 | fossil user capabilities uvtester oy |
| 314 | |
| 315 | ############################################################################### |
| 316 | |
| 317 | set pid [test_start_server $repository stopArg] |
| 318 | puts [appendArgs "Started Fossil server, pid \"" $pid \".] |
| 319 | |
| 320 | ############################################################################### |
| 321 | |
| 322 | set clientDir [file join $tempPath [appendArgs \ |
| 323 | uvtest_ [string trim [clock seconds] -] _ [getSeqNo]]] |
| 324 | |
| 325 | set savedPwd [pwd] |
| 326 | file mkdir $clientDir; cd $clientDir |
| 327 | puts [appendArgs "Now in client directory \"" [pwd] \".] |
| 328 | |
| 329 | ############################################################################### |
| 330 | |
| 331 | fossil_maybe_answer y clone $remote uvrepo.fossil |
| 332 | fossil open uvrepo.fossil |
| 333 | |
| 334 | ############################################################################### |
| 335 | |
| 336 | fossil unversioned list |
| 337 | test unversioned-45 {[normalize_result] eq {}} |
| 338 | |
| 339 | ############################################################################### |
| 340 | |
| 341 | fossil_maybe_answer y unversioned sync $remote |
| 342 | test unversioned-46 {[regexp \ |
| 343 | {Round-trips: 1 Artifacts sent: 0 received: 0 |
| 344 | Round-trips: 1 Artifacts sent: 0 received: 0 |
| 345 | Round-trips: 2 Artifacts sent: 0 received: 0 |
| 346 | Round-trips: 2 Artifacts sent: 0 received: 2 |
| 347 | |
| 348 | done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]} |
| 349 | |
| 350 | ############################################################################### |
| 351 | |
| 352 | fossil unversioned ls |
| 353 | test unversioned-47 {[normalize_result] eq {unversioned2.txt |
| 354 | unversioned5.txt}} |
| 355 | |
| 356 | ############################################################################### |
| 357 | |
| 358 | set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic |
| 359 | |
| 360 | fossil unversioned edit unversioned2.txt |
| 361 | test unversioned-48 {[normalize_result] eq {}} |
| 362 | |
| 363 | unset env(FAKE_EDITOR_SCRIPT) |
| 364 | |
| 365 | ############################################################################### |
| 366 | |
| 367 | fossil unversioned remove unversioned5.txt |
| 368 | test unversioned-49 {[normalize_result] eq {}} |
| 369 | |
| 370 | ############################################################################### |
| 371 | |
| 372 | fossil unversioned list --all |
| 373 | test unversioned-50 {[regexp \ |
| 374 | {^[0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 44 44\ |
| 375 | unversioned2\.txt |
| 376 | \(deleted\) \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 0 0\ |
| 377 | unversioned5\.txt$} [normalize_result]]} |
| 378 | |
| 379 | ############################################################################### |
| 380 | |
| 381 | fossil_maybe_answer y unversioned revert $remote |
| 382 | test unversioned-51 {[regexp \ |
| 383 | {Round-trips: 1 Artifacts sent: 0 received: 0 |
| 384 | Round-trips: 1 Artifacts sent: 0 received: 0 |
| 385 | Round-trips: 2 Artifacts sent: 0 received: 0 |
| 386 | Round-trips: 2 Artifacts sent: 0 received: 2 |
| 387 | |
| 388 | done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]} |
| 389 | |
| 390 | ############################################################################### |
| 391 | |
| 392 | fossil unversioned list |
| 393 | test unversioned-52 {[regexp \ |
| 394 | {^[0-9a-f]{12} 2016-10-01 00:00:00 30 30\ |
| 395 | unversioned2\.txt |
| 396 | [0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 28 28\ |
| 397 | unversioned5\.txt$} [normalize_result]]} |
| 398 | |
| 399 | ############################################################################### |
| 400 | |
| 401 | fossil close |
| 402 | test unversioned-53 {[normalize_result] eq {}} |
| 403 | |
| 404 | ############################################################################### |
| 405 | |
| 406 | cd $savedPwd; unset savedPwd |
| 407 | file delete -force $clientDir |
| 408 | puts [appendArgs "Now in server directory \"" [pwd] \".] |
| 409 | |
| 410 | ############################################################################### |
| 411 | |
| 412 | set stopped [test_stop_server $stopArg $pid] |
| 413 | |
| 414 | puts [appendArgs \ |
| 415 | [expr {$stopped ? "Stopped" : "Could not stop"}] \ |
| 416 | " Fossil server, pid \"" $pid "\", using argument \"" \ |
| 417 | $stopArg \".] |
| 418 | |
| 419 | ############################################################################### |
| 420 | |
| 421 | test_cleanup |
| 422 |