# # # delete "tests/t_add_executable.at" # # delete "tests/t_add_stomp_file.at" # # delete "tests/t_add_vs_commit.at" # # delete "tests/t_attr_drop.at" # # delete "tests/t_attr_init.at" # # delete "tests/t_automate_inventory.at" # # delete "tests/t_bad_packets.at" # # delete "tests/t_cvsimport2.at" # # delete "tests/t_database_check_minor.at" # # delete "tests/t_db_kill_rev_locally.at" # # delete "tests/t_diff_currev.at" # # delete "tests/t_drop_attr.at" # # delete "tests/t_inodeprints_hook.at" # # delete "tests/t_lf_crlf.at" # # delete "tests/t_log_depth_single.at" # # delete "tests/t_multiple_heads_msg.at" # # delete "tests/t_normalized_filenames.at" # # delete "tests/t_override_author_date.at" # # delete "tests/t_rcs_import.at" # # delete "tests/t_rename_dir_add_dir_with_old_name.at" # # delete "tests/t_rename_file_to_dir.at" # # delete "tests/t_replace_file_with_dir.at" # # delete "tests/t_setup_checkout_modify_new_dir.at" # # delete "tests/t_update_nonexistent.at" # # delete "tests/t_update_off_branch.at" # # add_dir "tests/--author,_--date" # # add_dir "tests/add_executable" # # add_dir "tests/add_workspace_commit_in_another" # # add_dir "tests/attr_drop" # # add_dir "tests/attr_init_functions" # # add_dir "tests/bad_packet_args" # # add_dir "tests/commit_update_multiple_heads_message" # # add_dir "tests/cvs_import_with_file_added_on_a_branch" # # add_dir "tests/db_check_and_non-serious_errors" # # add_dir "tests/db_kill_rev_locally_command" # # add_dir "tests/diffing_with_explicit_rev_same_as_wc_rev" # # add_dir "tests/drop_removes_attributes" # # add_dir "tests/log_--last=N_FILENAME" # # add_dir "tests/normalized_filenames" # # add_dir "tests/rename_file_to_dir" # # add_dir "tests/renaming_a_directory_and_then_adding_a_new_with_the_old_name" # # add_dir "tests/replace_file_with_dir" # # add_dir "tests/setup_checkout_touch_new__MTN_options_only" # # add_dir "tests/test_problematic_cvs_import" # # add_dir "tests/update_does_not_stomp_non-monotone_files" # # add_dir "tests/update_to_non-existent_rev" # # add_dir "tests/update_to_off-branch_rev" # # add_dir "tests/use_get_linesep_conv_hook" # # add_dir "tests/use_inodeprints_hook" # # add_dir "tests/workspace_inventory" # # add_file "tests/--author,_--date/__driver__.lua" # content [685f83bbed927d9943df44647b3ed051b90aa213] # # add_file "tests/add_executable/__driver__.lua" # content [b9df814efd867b46e941fdf0c0968f6990c79ff7] # # add_file "tests/add_workspace_commit_in_another/__driver__.lua" # content [c15437969cd6f8c76c497cede0793c04d3a8ee8e] # # add_file "tests/add_workspace_commit_in_another/foo.alice" # content [7bdeec3a160412853894f4c74fd01f20ebb5038c] # # add_file "tests/add_workspace_commit_in_another/foo.bob" # content [c2ddd648ae69eca7bd0063bd0e766eda2bb15a7d] # # add_file "tests/attr_drop/__driver__.lua" # content [3dcfde38ad58c40817228561f88e593fd4ad97c9] # # add_file "tests/attr_init_functions/__driver__.lua" # content [506aba1a2b1799d9ad62c2d43df6bd0d9dc307bb] # # add_file "tests/attr_init_functions/hook.lua" # content [50672b14989948e1c8391a7a20c729ca2ec3b91a] # # add_file "tests/bad_packet_args/__driver__.lua" # content [2e38b18293ce1000d3cebc585cace9b7d5a3bb33] # # add_file "tests/commit_update_multiple_heads_message/__driver__.lua" # content [c4b15a47da1bda099901e5091836754154fdba3b] # # add_file "tests/cvs_import_with_file_added_on_a_branch/__driver__.lua" # content [a5ec6556f74851b3018f82b88d84f50d4d5857bd] # # add_file "tests/db_check_and_non-serious_errors/__driver__.lua" # content [d78635884288506a6fc5a74afffc0de3df58b637] # # add_file "tests/db_kill_rev_locally_command/__driver__.lua" # content [7e7b3aa9e42792245a60745ca257ac29f4d57b0c] # # add_file "tests/diffing_with_explicit_rev_same_as_wc_rev/__driver__.lua" # content [a1df3de124a4a9be9e891404f7edd62a3b40ec6e] # # add_file "tests/drop_removes_attributes/__driver__.lua" # content [2d617fcf68e52e4564f5f1ca3775138fc4571d9c] # # add_file "tests/log_--last=N_FILENAME/__driver__.lua" # content [b339d128b32b27cf104b7016ab1372a7bbe974d6] # # add_file "tests/normalized_filenames/__driver__.lua" # content [8c89c3b37cc2ae21b594a0551294d2234c450bc8] # # add_file "tests/rename_file_to_dir/__driver__.lua" # content [c1536b9905bd6d8dfe87cdce66e5e3e0415ef801] # # add_file "tests/renaming_a_directory_and_then_adding_a_new_with_the_old_name/__driver__.lua" # content [e2aa0980b891adfb61f0785e69c62bf82e5acf26] # # add_file "tests/replace_file_with_dir/__driver__.lua" # content [c408c6894041253c30e2dc6efd12b0bfefc52be5] # # add_file "tests/setup_checkout_touch_new__MTN_options_only/__driver__.lua" # content [548c40cf997f2549d60cc55547a69abda3d83e7c] # # add_file "tests/test_problematic_cvs_import/__driver__.lua" # content [f26942e465025f75e07acaea0e8ad77ea7880bc4] # # add_file "tests/test_problematic_cvs_import/rcsfile,v" # content [c22b5e7d376e629e8e4e833ca412a84be40ecc7a] # # add_file "tests/update_does_not_stomp_non-monotone_files/__driver__.lua" # content [3001c8acd928063b99fac8f01f54424d0e7ee630] # # add_file "tests/update_to_non-existent_rev/__driver__.lua" # content [a34b9f6b62bf3cd4d5b7442c44882de56e5d95ee] # # add_file "tests/update_to_off-branch_rev/__driver__.lua" # content [09660e5a0d63ff6671afc6a288be58071beecd2e] # # add_file "tests/use_get_linesep_conv_hook/__driver__.lua" # content [795b37572ca781a06e6097b6d48ba82a921054c6] # # add_file "tests/use_get_linesep_conv_hook/linesep.lua" # content [adb80ce1fb412710056c99833379820fd0e5d6d1] # # add_file "tests/use_inodeprints_hook/__driver__.lua" # content [07ead3d63cfc585cae4a229f9b1103c0e501b7fc] # # add_file "tests/use_inodeprints_hook/off.lua" # content [481189d908ab9f79eef9d34ace28b9717532f69f] # # add_file "tests/use_inodeprints_hook/on.lua" # content [baa05774088081b8b2b2e4aafcc97a98376e5271] # # add_file "tests/workspace_inventory/__driver__.lua" # content [520d87edeeb2cca37c6e8e2a733a988edc738aa7] # # add_file "tests/workspace_inventory/inventory_hooks.lua" # content [a16591bdd459974f0186eb84ce3050c932a0f885] # # patch "testsuite.at" # from [106a1b130cc6ac73d67e440f774b6ef75544f2b2] # to [e5b152248b57e3ac8d832332768b78b3ab506e7e] # # patch "testsuite.lua" # from [b83ad5558b02646a6fc3ade53cc0ebd7e4caaf8e] # to [290429519a074746762528fb37c5ffed326fe873] # ============================================================ --- tests/--author,_--date/__driver__.lua 685f83bbed927d9943df44647b3ed051b90aa213 +++ tests/--author,_--date/__driver__.lua 685f83bbed927d9943df44647b3ed051b90aa213 @@ -0,0 +1,13 @@ + +mtn_setup() + +addfile("testfile", "floooooo") +check(mtn("commit", "--author=the_author", "--date=1999-12-31T12:00:00", "--branch=foo", "--message=foo"), 0, false, false) +rev = base_revision() +check(mtn("log", "--revision", rev), 0, true, false) + +check(qgrep('^Author: the_author', "stdout")) +check(qgrep('^Date: 1999-12-31T12:00:00', "stdout")) + +writefile("testfile", "oovel") +check(mtn("commit", "--date=1999-12-31T12:00foo", "--branch=foo", "--message=foo"), 1, false, false) ============================================================ --- tests/add_executable/__driver__.lua b9df814efd867b46e941fdf0c0968f6990c79ff7 +++ tests/add_executable/__driver__.lua b9df814efd867b46e941fdf0c0968f6990c79ff7 @@ -0,0 +1,16 @@ + +skip_if(ostype == "Windows") +skip_if(not existsonpath("chmod")) +skip_if(not existsonpath("test")) +mtn_setup() + + +writefile("foo", "blah blah") +check({"chmod", "755", "foo"}) +-- Have to use RAW_MTN, because we're testing the standard hooks... +check(raw_mtn("--rcfile=test_hooks.lua", "add", "foo"), 0, false, false) +commit() + +-- Have to use RAW_MTN, because we're testing the standard hooks... +check(raw_mtn("--rcfile=test_hooks.lua", "checkout", "--branch=testbranch", "codir"), 0, false, false) +check({"test", "-x", "codir/foo"}) ============================================================ --- tests/add_workspace_commit_in_another/__driver__.lua c15437969cd6f8c76c497cede0793c04d3a8ee8e +++ tests/add_workspace_commit_in_another/__driver__.lua c15437969cd6f8c76c497cede0793c04d3a8ee8e @@ -0,0 +1,35 @@ + +mtn_setup() + +-- This test relies on file-suturing + +-- 1. Alice writes a file, does an add, *doesn't* do a commit, and sends patch +-- 2. Bob applies (modified) patch to tree, does the add, then a commit. +-- 3. Now Alice does an update (resolves the merge conflict, choosing Bob's changes). + +writefile("initial", "some initial data") + +getfile("foo.alice") + +getfile("foo.bob") + +-- Alice does her add +mkdir("alicewd") +copyfile("initial", "alicewd/initial") +check(mtn("--branch=testbranch", "setup", "alicewd"), 0, false, false) +check(indir("alicewd", mtn("--root=.", "add", "initial")), 0, false, false) +check(indir("alicewd", mtn("--root=.", "commit", "-m", 'initial commit')), 0, false, false) +copyfile("foo.alice", "alicewd/foo") +check(indir("alicewd", mtn("add", "--root=.", "foo")), 0, false, false) +-- Note, alice does not commit this add... + +-- Bob does add of same file, with edits, and commits +check(mtn("--branch=testbranch", "checkout", "bobwd"), 0, false, false) +copyfile("foo.bob", "bobwd/foo") +check(indir("bobwd", mtn("--root=.", "add", "foo")), 0, false, false) +check(indir("bobwd", mtn("--root=.", "commit", "-m", 'bob commit')), 0, false, false) +rev = indir("bobwd", {base_revision})[1]() + +-- Alice does her update, then attempts, eg., a diff +xfail_if(true, indir("alicewd", mtn("--root=.", "update", "--revision", rev)), 0, false, false) +check(indir("alicewd", mtn("--root=.", "diff")), 0, false, false) ============================================================ --- tests/add_workspace_commit_in_another/foo.alice 7bdeec3a160412853894f4c74fd01f20ebb5038c +++ tests/add_workspace_commit_in_another/foo.alice 7bdeec3a160412853894f4c74fd01f20ebb5038c @@ -0,0 +1,3 @@ +foo +change me +bar ============================================================ --- tests/add_workspace_commit_in_another/foo.bob c2ddd648ae69eca7bd0063bd0e766eda2bb15a7d +++ tests/add_workspace_commit_in_another/foo.bob c2ddd648ae69eca7bd0063bd0e766eda2bb15a7d @@ -0,0 +1,3 @@ +foo +me change +bar ============================================================ --- tests/attr_drop/__driver__.lua 3dcfde38ad58c40817228561f88e593fd4ad97c9 +++ tests/attr_drop/__driver__.lua 3dcfde38ad58c40817228561f88e593fd4ad97c9 @@ -0,0 +1,23 @@ + +mtn_setup() + +addfile("testfile", "foo bar") +check(mtn("attr", "set", "testfile", "test:first_key", "first_value"), 0, false, false) +check(mtn("attr", "set", "testfile", "test:second_key", "second_value"), 0, false, false) +check(mtn("attr", "get", "testfile"), 0, true, false) +check(qgrep("test:first_key", "stdout")) +check(qgrep("first_value", "stdout")) +check(qgrep("test:second_key", "stdout")) +check(qgrep("second_value", "stdout")) +check(mtn("attr", "drop", "testfile", "test:first_key"), 0, true, false) +check(mtn("attr", "get", "testfile"), 0, true, false) +check(not qgrep("test:first_key", "stdout")) +check(not qgrep("first_value", "stdout")) +check(qgrep("test:second_key", "stdout")) +check(qgrep("second_value", "stdout")) +check(mtn("attr", "drop", "testfile"), 0, true, false) +check(mtn("attr", "get", "testfile"), 0, true, false) +check(not qgrep("test:first_key", "stdout")) +check(not qgrep("first_value", "stdout")) +check(not qgrep("test:second_key", "stdout")) +check(not qgrep("second_value", "stdout")) ============================================================ --- tests/attr_init_functions/__driver__.lua 506aba1a2b1799d9ad62c2d43df6bd0d9dc307bb +++ tests/attr_init_functions/__driver__.lua 506aba1a2b1799d9ad62c2d43df6bd0d9dc307bb @@ -0,0 +1,17 @@ + +mtn_setup() + +getfile("hook.lua") + +writefile("testfile", "foo") +check(mtn("--rcfile=hook.lua", "add", "testfile"), 0, false, false) +writefile("magic", "stuff") +check(mtn("--rcfile=hook.lua", "add", "magic"), 0, false, false) + +check(mtn("attr", "get", "testfile"), 0, true, false) +check(not qgrep("test:test_attr", "stdout")) +check(not qgrep("bob", "stdout")) + +check(mtn("attr", "get", "magic"), 0, true, false) +check(qgrep("test:test_attr", "stdout")) +check(qgrep("bob", "stdout")) ============================================================ --- tests/attr_init_functions/hook.lua 50672b14989948e1c8391a7a20c729ca2ec3b91a +++ tests/attr_init_functions/hook.lua 50672b14989948e1c8391a7a20c729ca2ec3b91a @@ -0,0 +1,11 @@ +if (attr_init_functions == nil) then + attr_init_functions = {} +end +attr_init_functions["test:test_attr"] = + function(filename) + if filename == "magic" then + return "bob" + else + return nil + end + end ============================================================ --- tests/bad_packet_args/__driver__.lua 2e38b18293ce1000d3cebc585cace9b7d5a3bb33 +++ tests/bad_packet_args/__driver__.lua 2e38b18293ce1000d3cebc585cace9b7d5a3bb33 @@ -0,0 +1,11 @@ + +mtn_setup() + +check(mtn("automate", "packet_for_fdelta", "73070030f7b0d0f3d4ee02545d45ca4bbe5e189f", "6c704fbd4ef58f2447fd1a3e76911b2ebe97dc77"), 1, false, false) +check(mtn("automate", "packet_for_fdata", "73070030f7b0d0f3d4ee02545d45ca4bbe5e189f"), 1, false, false) +check(mtn("automate", "packet_for_rdata", "73070030f7b0d0f3d4ee02545d45ca4bbe5e189f"), 1, false, false) +check(mtn("pubkey", "address@hidden"), 1, false, false) +check(mtn("privkey", "address@hidden"), 1, false, false) + +check(mtn("automate", "packets_for_certs", "73070030f7b0d0f3d4ee02545d45ca4bbe5e189f"), 1, false, false) +check(mtn("db", "check"), 0, false, false) ============================================================ --- tests/commit_update_multiple_heads_message/__driver__.lua c4b15a47da1bda099901e5091836754154fdba3b +++ tests/commit_update_multiple_heads_message/__driver__.lua c4b15a47da1bda099901e5091836754154fdba3b @@ -0,0 +1,83 @@ + +mtn_setup() + +-- Create a single revision in branch1 +-- +-- root (branch1) +-- +-- branch1 heads: root +revs = {} + +-- like the normal commit function, except it catches the output +function local_ci(br) + check(mtn("commit", "--message=blah-blan", "--branch", br), 0, true, true) +end + +writefile("f", "base data") + +check(mtn("add", "f"), 0, false, false) +local_ci("branch1") +check(not qgrep('creates divergence', "stderr")) +revs.root = base_revision() + +check(mtn("--branch=branch1", "heads"), 0, true, false) +check(qgrep(revs.root, "stdout")) + +-- Create a child +-- +-- root (branch1) +-- / +-- child1 (branch1) +-- +-- branch1 heads: child1 + +writefile("f", "child1 data") +local_ci("branch1") +check(not qgrep('creates divergence', "stderr")) +revs.child1 = base_revision() + +check(mtn("--branch=branch1", "heads"), 0, true, false) +check(not qgrep(revs.root, "stdout")) +check(qgrep(revs.child1, "stdout")) + +-- Create another child +-- +-- root (branch1) +-- / \ +-- child1 (branch1) child2 (branch1) +-- +-- branch1 heads: child1, child2 + +revert_to(revs.root) +writefile("f", "child2 data") +local_ci("branch1") +revs.child2 = base_revision() +check(qgrep('this revision creates divergence', "stderr")) + +check(mtn("--branch=branch1", "update"), 0, false, true) +check(qgrep('has multiple heads', "stderr")) + +-- Create a new branch +-- +-- root (branch1) +-- / \ +-- child1 (branch1) child2 (branch1) +-- / +-- new1 (branch2) +-- +-- branch1 heads: child1, child2 +-- branch2 heads: new2 + +revert_to(revs.child1) + +writefile("f", "new1 data") +local_ci("branch2") +revs.new1 = base_revision() +check(not qgrep('this revision creates divergence', "stderr")) + +revert_to(revs.child2) + +writefile("f", "new2 data") +local_ci("branch2") +revs.new2 = base_revision() +check(qgrep('this revision creates divergence', "stderr")) ============================================================ --- tests/cvs_import_with_file_added_on_a_branch/__driver__.lua a5ec6556f74851b3018f82b88d84f50d4d5857bd +++ tests/cvs_import_with_file_added_on_a_branch/__driver__.lua a5ec6556f74851b3018f82b88d84f50d4d5857bd @@ -0,0 +1,27 @@ + +skip_if(not existsonpath("cvs")) +mtn_setup() + +-- This tests the case where a file was added on a branch in CVS; CVS +-- records this in a strange way (with a delete of the non-existent +-- file on mainline, followed by an add of the file on the branch). +-- Make sure we handle it correct. + +cvsroot = test_root.."/cvsroot" +function cvs(...) + return {"cvs", "-d", cvsroot, unpack(arg)} +end +check(cvs("init"), 0, false, false) +mkdir("src") +writefile("src/foo", "foo") +check(indir("src", cvs("import", "-m", "import", "mod", "vtag", "rtag")), 0, false, false) +remove_recursive("src") +mkdir("src") +check(indir("src", cvs("co", "mod")), 0, false, false) +check(indir("src/mod", cvs("tag", "-b", "branch")), 0, false, false) +check(indir("src/mod", cvs("up", "-r", "branch")), 0, false, false) +writefile("src/mod/bar", "bar") +check(indir("src/mod", cvs("add", "bar")), 0, false, false) +check(indir("src/mod", cvs("ci", "-m", "add bar")), 0, false, false) + +check(mtn("--branch=test", "cvs_import", cvsroot.."/mod"), 0, false, false) ============================================================ --- tests/db_check_and_non-serious_errors/__driver__.lua d78635884288506a6fc5a74afffc0de3df58b637 +++ tests/db_check_and_non-serious_errors/__driver__.lua d78635884288506a6fc5a74afffc0de3df58b637 @@ -0,0 +1,35 @@ + +mtn_setup() + +-- Make sure that db check detects minor problems, but doesn't complain +-- about them too loudly (and doesn't exit with error status). + +writefile("fileX", "blah blah") +writefile("fileY", "stuff stuff") + +addfile("testfile", "more stuff") +commit() +rev = base_revision() + +check(mtn("cert", rev, "author", "extra_author"), 0, false, false) + +-- if we drop the file, we'll have a roster that doesn't +-- reference its own revision. +-- we can then remove the revision to end up with a clean unreferenced roster. +check(mtn("drop", "testfile"), 0, false, false) +check(mtn("commit", "-m", "goingaway"), 0, false, false) +del_rev = base_revision() +for a,b in {revisions = "id", revision_certs = "id", revision_ancestry = "child"} do + local str = string.format("delete from %s where %s = '%s'", a, b, del_rev) + check(mtn("db", "execute", str), 0, false, false) +end + +-- and also a few unused files shall float about +check(mtn("fload"), 0, false, false, {"fileX"}) +check(mtn("fload"), 0, false, false, {"fileY"}) + +check(mtn("db", "check"), 0, false, true) + +check(qgrep('problems detected: 5', "stderr")) +check(qgrep('0 serious', "stderr")) +check(qgrep('minor problems detected', "stderr")) ============================================================ --- tests/db_kill_rev_locally_command/__driver__.lua 7e7b3aa9e42792245a60745ca257ac29f4d57b0c +++ tests/db_kill_rev_locally_command/__driver__.lua 7e7b3aa9e42792245a60745ca257ac29f4d57b0c @@ -0,0 +1,24 @@ + +mtn_setup() + +-- This tests the db kill_rev_locally command + +-- Prepare a db with two revisions +addfile("testfile", "blah blah") +commit() +ancestor = base_revision() + +writefile("testfile", "stuff stuff") +commit() +child = base_revision() + +-- trying to kill the ancestor. This *is supposed to fail* +check(mtn("db", "kill_rev_locally", ancestor), 1, false, false) +check(mtn("automate", "get_revision", ancestor), 0, false, false) +check(mtn("db", "check"), 0, false, false) + +-- killing children is ok, though :) +check(mtn("automate", "get_revision", child), 0, false, false) +check(mtn("db", "kill_rev_locally", child), 0, false, false) +check(mtn("automate", "get_revision", child), 1, false, false) +check(mtn("db", "check"), 0, false, false) ============================================================ --- tests/diffing_with_explicit_rev_same_as_wc_rev/__driver__.lua a1df3de124a4a9be9e891404f7edd62a3b40ec6e +++ tests/diffing_with_explicit_rev_same_as_wc_rev/__driver__.lua a1df3de124a4a9be9e891404f7edd62a3b40ec6e @@ -0,0 +1,16 @@ + +mtn_setup() + +writefile("foo1", "foo file 1") + +check(mtn("add", "foo1"), 0, false, false) +commit() +parent = base_revision() + +-- should return 'no changes' (i.e. same as diff without --revision=) +check_same_stdout(mtn("diff"), mtn("diff", "--revision", parent)) + +writefile("foo1", "foo changed file") + +-- should show local changes against wc's base rev +check_same_stdout(mtn("diff"), mtn("diff", "--revision", parent)) ============================================================ --- tests/drop_removes_attributes/__driver__.lua 2d617fcf68e52e4564f5f1ca3775138fc4571d9c +++ tests/drop_removes_attributes/__driver__.lua 2d617fcf68e52e4564f5f1ca3775138fc4571d9c @@ -0,0 +1,13 @@ + +mtn_setup() + +addfile("testfile", "foo bar") +check(mtn("attr", "set", "testfile", "some_key", "some_value"), 0, false, false) +check(mtn("attr", "get", "testfile"), 0, true, false) +check(qgrep("some_key", "stdout")) +check(qgrep("some_value", "stdout")) + +commit() + +check(mtn("drop", "testfile"), 0, false, false) +check(mtn("attr", "get", "testfile"), 1, true, false) ============================================================ --- tests/log_--last=N_FILENAME/__driver__.lua b339d128b32b27cf104b7016ab1372a7bbe974d6 +++ tests/log_--last=N_FILENAME/__driver__.lua b339d128b32b27cf104b7016ab1372a7bbe974d6 @@ -0,0 +1,15 @@ + +mtn_setup() + +addfile("foo", "foo") +commit("testbranch", "Addition of foo.") + +addfile("bar", "bar") +commit("testbranch", "Addition of bar.") + +addfile("baz", "baz") +commit("testbranch", "Addition of baz.") + +check(mtn("log", "--last=1", "foo"), 0, true, false) +check(grep("^Revision:", "stdout"), 0, true, false) +check(numlines("stdout") == 1) ============================================================ --- tests/normalized_filenames/__driver__.lua 8c89c3b37cc2ae21b594a0551294d2234c450bc8 +++ tests/normalized_filenames/__driver__.lua 8c89c3b37cc2ae21b594a0551294d2234c450bc8 @@ -0,0 +1,14 @@ + +mtn_setup() + +writefile("foo", "blah blah") +-- The UI used to fix these, while later code did not, so let's check +-- the inner code directly. +writefile("_MTN/work", 'add_dir "."') +check(mtn("automate", "get_manifest_of"), 3, false, false) + +writefile("_MTN/work", 'add_dir "./bar"') + +check(mtn("automate", "get_manifest_of"), 3, false, false) +check(mtn("automate", "get_revision"), 3, false, false) +check(mtn("commit", "--message=foo", "--branch=foo"), 3, false, false) ============================================================ --- tests/rename_file_to_dir/__driver__.lua c1536b9905bd6d8dfe87cdce66e5e3e0415ef801 +++ tests/rename_file_to_dir/__driver__.lua c1536b9905bd6d8dfe87cdce66e5e3e0415ef801 @@ -0,0 +1,14 @@ + +mtn_setup() + +-- this test is a bug report +-- the situation where a file is renamed to a dir should be trapped and +-- reported with N(...) or something + +addfile("file", "file") +commit() + +mkdir("dir") +xfail_if(true, mtn("rename", "file", "dir"), 1, false, false) +check(mtn("status"), 0, false, false) +check(mtn("diff"), 0, false, false) ============================================================ --- tests/renaming_a_directory_and_then_adding_a_new_with_the_old_name/__driver__.lua e2aa0980b891adfb61f0785e69c62bf82e5acf26 +++ tests/renaming_a_directory_and_then_adding_a_new_with_the_old_name/__driver__.lua e2aa0980b891adfb61f0785e69c62bf82e5acf26 @@ -0,0 +1,18 @@ + +mtn_setup() + +-- add 'foo/test' file +mkdir("foo") +writefile("foo/test", "test file in foo dir") +check(mtn("add", "foo"), 0, false, false) +commit() + +-- rename 'foo' dir to 'bar' +check(mtn("rename", "foo", "bar"), 0, false, false) +rename("foo", "bar") + +-- add new 'foo' dir +mkdir("foo") +writefile("foo/test", "test file in new foo dir") +check(mtn("add", "foo"), 0, false, false) +commit() ============================================================ --- tests/replace_file_with_dir/__driver__.lua c408c6894041253c30e2dc6efd12b0bfefc52be5 +++ tests/replace_file_with_dir/__driver__.lua c408c6894041253c30e2dc6efd12b0bfefc52be5 @@ -0,0 +1,10 @@ + +mtn_setup() + +addfile("file", "file") +commit() + +remove("file") +mkdir("file") +check(mtn("status"), 1, false, false) +check(mtn("diff"), 1, false, false) ============================================================ --- tests/setup_checkout_touch_new__MTN_options_only/__driver__.lua 548c40cf997f2549d60cc55547a69abda3d83e7c +++ tests/setup_checkout_touch_new__MTN_options_only/__driver__.lua 548c40cf997f2549d60cc55547a69abda3d83e7c @@ -0,0 +1,28 @@ + +mtn_setup() + +addfile("foo", "blah blah") +commit() + +-- okay, now wd is on testbranch + +-- setup a dir on otherbranch and make sure we stay on testbranch +check(mtn("setup", "setupdir", "--branch=otherbranch"), 0, false, false) +writefile("foo", "stuff stuff") +check(mtn("commit", "--message=foo"), 0, false, false) +check(mtn("automate", "heads", "testbranch"), 0, true, false) +rename("stdout", "headsout") +check(trim(readfile("headsout")) == base_revision()) + +-- now create a revision in otherbranch... +writefile("setupdir/blah", "yum yum") +check(indir("setupdir", mtn("add", "blah")), 0, false, false) +check(indir("setupdir", mtn("commit", "--message=foo")), 0, false, false) +-- and check it out +check(mtn("checkout", "codir", "--branch=otherbranch"), 0, false, false) +-- and make sure we still stayed on testbranch +writefile("foo", "more more") +check(mtn("commit", "--message=foo"), 0, false, false) +check(mtn("automate", "heads", "testbranch"), 0, true, false) +rename_over("stdout", "headsout") +check(trim(readfile("headsout")) == base_revision()) ============================================================ --- tests/test_problematic_cvs_import/__driver__.lua f26942e465025f75e07acaea0e8ad77ea7880bc4 +++ tests/test_problematic_cvs_import/__driver__.lua f26942e465025f75e07acaea0e8ad77ea7880bc4 @@ -0,0 +1,14 @@ + +mtn_setup() + +-- This test imports a rcs file which fails according to the mailing list +-- reporter: Carl Christian Kanne "Bug? in CVS import monotone 0.18" +-- Date: Fri, 15 Apr 2005 12:53:13 +0200 + +-- This test is a bug report. + +-- This rcs file fails to be imported correctly by monotone +mkdir("tmp") +getfile("rcsfile,v", "tmp/rcsfile,v") + +xfail_if(true, mtn("--branch=test", "cvs_import", "tmp"), 0, ignore, ignore) ============================================================ --- tests/test_problematic_cvs_import/rcsfile,v c22b5e7d376e629e8e4e833ca412a84be40ecc7a +++ tests/test_problematic_cvs_import/rcsfile,v c22b5e7d376e629e8e4e833ca412a84be40ecc7a @@ -0,0 +1,2029 @@ +head 1.21; +access; +symbols + lids:1.21.0.2 + natix-2_0_0-pre6:1.18 + natix-2_0_0:1.18 + natix-2_0-pre4:1.13 + natix-2_0-pre3:1.13 + viewxmlschema:1.6.0.4 + firstrecovery:1.5.0.6 + TESTED_adarkar_200110160317:1.5 + TESTED_adarkar_200110140306:1.5 + TESTED_adarkar_200110130307:1.5 + TESTED_adarkar_200110120319:1.5 + TESTED_adarkar_200110110307:1.5 + TESTED_adarkar_200110100306:1.5 + TESTED_adarkar_200110090306:1.5 + TESTED_adarkar_200110080307:1.5 + TESTED_adarkar_200110070307:1.5 + TESTED_adarkar_200110060308:1.5 + TESTED_adarkar_200110050307:1.5 + TESTED_adarkar_200110041131:1.5 + TESTED_adarkar_200110031747:1.5 + TESTED_adarkar_200108290303:1.5 + TESTED_adarkar_200108280306:1.5 + abusy_devel_mergepoint:1.5 + abusy_devel:1.5.0.4 + NATIXFS_DEMO_R1:1.5.0.2 + TESTED_adarkar_200103190358:1.5 + TESTED_adarkar_200103170357:1.5 + TESTED_manray_200103141332:1.5 + TESTED_adarkar_200103130435:1.5 + TESTED_manray_200103130240:1.5 + TESTED_manray_200103120238:1.5 + TESTED_manray_200103110239:1.5 + TESTED_manray_200103100240:1.5 + TESTED_manray_200103090252:1.5 + TESTED_manray_200103080246:1.5 + TESTED_adarkar_200103070435:1.5 + TESTED_manray_200103070240:1.5 + TESTED_adarkar_200103060434:1.5 + TESTED_manray_200103060240:1.5 + TESTED_adarkar_200103050433:1.5 + TESTED_manray_200103050239:1.5 + TESTED_adarkar_200103040437:1.5 + TESTED_manray_200103010240:1.5 + TESTED_adarkar_200102280435:1.5 + TESTED_manray_200102280239:1.5 + TESTED_adarkar_200102270433:1.5 + TESTED_manray_200102270238:1.5 + TESTED_adarkar_200102260433:1.5 + TESTED_manray_200102260240:1.5 + TESTED_adarkar_200102250435:1.5 + TESTED_manray:1.5 + TESTED_manray_200102250238:1.5 + TESTED_adarkar_200102070430:1.5 + TESTED_adarkar_200102060430:1.5 + TESTED_adarkar_200102050431:1.5 + TESTED_adarkar_200102040432:1.5 + TESTED_adarkar_200102030430:1.5 + TESTED_adarkar_200102020432:1.5 + TESTED_adarkar_200102010437:1.5 + TESTED_adarkar_200101310437:1.5 + TESTED_adarkar_200101240430:1.5 + REVIEW:1.5 + TESTED_adarkar_200101221147:1.5 + TESTED_adarkar_200101192055:1.5 + TESTED_adarkar_200101171217:1.5 + TESTED_adarkar_200101080424:1.5 + TESTED_adarkar:1.5 + TESTED_adarkar_200101050424:1.5 + before_sync:1.5 + sync:1.5 + start:1.1.1.1 + aodb:1.1.1; +locks; strict; +comment @// @; + + +1.21 +date 2005.02.25.15.46.29; author norman; state Exp; +branches; +next 1.20; + +1.20 +date 2005.02.19.17.52.18; author norman; state Exp; +branches; +next 1.19; + +1.19 +date 2005.01.07.17.35.37; author norman; state Exp; +branches; +next 1.18; + +1.18 +date 2004.09.17.11.43.47; author msb; state Exp; +branches; +next 1.17; + +1.17 +date 2004.08.02.09.14.24; author msb; state Exp; +branches; +next 1.16; + +1.16 +date 2004.07.29.08.46.17; author msb; state Exp; +branches; +next 1.15; + +1.15 +date 2004.07.22.16.12.51; author msb; state Exp; +branches; +next 1.14; + +1.14 +date 2004.04.19.20.19.56; author norman; state Exp; +branches; +next 1.13; + +1.13 +date 2003.10.07.14.32.45; author msb; state Exp; +branches; +next 1.12; + +1.12 +date 2003.09.24.12.15.51; author tneumann; state Exp; +branches; +next 1.11; + +1.11 +date 2003.04.03.12.56.48; author norman; state Exp; +branches; +next 1.10; + +1.10 +date 2003.03.13.17.51.24; author norman; state Exp; +branches; +next 1.9; + +1.9 +date 2003.02.05.15.24.08; author norman; state Exp; +branches; +next 1.8; + +1.8 +date 2002.08.20.15.16.45; author schiele; state Exp; +branches; +next 1.7; + +1.7 +date 2002.08.02.10.51.45; author norman; state Exp; +branches; +next 1.6; + +1.6 +date 2002.04.25.07.58.35; author schiele; state Exp; +branches + 1.6.4.1; +next 1.5; + +1.5 +date 2000.06.16.15.42.48; author westmann; state Exp; +branches; +next 1.4; + +1.4 +date 2000.06.01.12.39.57; author cc; state Exp; +branches; +next 1.3; + +1.3 +date 2000.04.13.15.11.44; author westmann; state Exp; +branches; +next 1.2; + +1.2 +date 99.12.09.12.06.41; author westmann; state Exp; +branches; +next 1.1; + +1.1 +date 98.11.26.13.01.34; author thorsten; state Exp; +branches + 1.1.1.1; +next ; + +1.1.1.1 +date 98.11.26.13.01.34; author thorsten; state Exp; +branches; +next ; + +1.6.4.1 +date 2003.02.12.14.53.35; author ah; state Exp; +branches; +next ; + + +desc +@@ + + +1.21 +log address@hidden standard iterator to ht_hashtable +@ +text +@/*********************************************************************** + + AODB-Project + + Lehrstuhl fuer Praktische Informatik III + Universitaet Mannheim + Germany + + Author: Sven Helmer and Till Westmann + + $Id: hashtable.hh,v 1.20 2005/02/19 17:52:18 norman Exp $ + +***********************************************************************/ + +#ifndef HASHTABLE +#define HASHTABLE + +#include "rts/infra/hashtable/hashtablebase.hh" + +/** + * The hash table uses closed hashing. The items of the buckets are stored + * in a buffer. The entries in the hash directory point to the first + * item in the bucket. Linking the elements within the buckets is done by + * appending a pointer to each item in the buffer which points to the next + * item in the bucket. + */ +class HashTable : public HashTableBase > { + +public: + + typedef ht_iterator iterator; + + HashTable(hash_t aDirSize, + uint32 aNoOfRegs, + uint32 aResultReg, + AVM::Prog* aInsertHashProg, + AVM::Prog* aLookupHashProg, + AVM::Prog* aLookupCmpProg, + AVM::Prog* aCopyProg, + AVM::Prog* aCleanUpProg, + StmtCB* aStmtCB, + const size_t aChunkSize, + const unsigned long aNumberOfBlocks = 0); + ~HashTable(); + + void initialize(ZReg* someAuxRegs); + ZReg* lookup(ZReg* zRegBank); + + inline void resetCurrentItem(); + ZReg* insert(register ZReg*); + +private: + /** + * the hash value for a item to be inserted + */ + HashValue theInsertHashValue; + + /** + * the current position in the hash directory during lookup. the + * iterator will only iterate through one bucket collecting + * duplicate entries in the hash table. + */ + CollisionList::iterator theCurrentItem; + +}; + +/** + * set theCurrentItem to an invalid position signalling that the + * next lookup must reset the iterator + */ +void HashTable::resetCurrentItem() { + LOGOBJECT; + theCurrentItem = theHashDir[theHashDirSize].begin(); +} + +#endif // HASHTABLE +@ + + +1.20 +log address@hidden HashTableBase +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.19 2005/01/07 17:35:37 norman Exp $ +d27 1 +a27 1 +class HashTable : public HashTableBase > { +d31 1 +a31 1 + typedef iterator iterator; +@ + + +1.19 +log address@hidden fill into gracejoin, unified interface for theHashTable->initialize +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.18 2004/09/17 11:43:47 msb Exp $ +a25 3 + * + * IMPORTANT: HashTable expects an opened PAL_Operator producer and + * will not close producer !! +d27 1 +a27 1 +class HashTable : public HashTableBase { +d31 2 +a58 5 + * the copy prog used in insert if the producer is a pipelinebreaker. + */ + AVM::Prog* theCopyProg; + + /** +@ + + +1.18 +log address@hidden parameter number in constructor +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.17 2004/08/02 09:14:24 msb Exp $ +a17 1 +#include "rts/algOp/iterator.hh" +a19 1 + +d47 1 +a47 3 + using HashTableBase::initialize; + void initialize(PAL_Operator* aProducer, ZReg* someAuxRegs); + +a49 3 + void fill(); + void clear(); + +a54 5 + * the data source for the hash table + */ + PAL_Operator* theProducer; + + /** +a69 1 + +@ + + +1.17 +log address@hidden documentation for the hashtables +- refactored mapmat operator + - do not copy into the hashtable because it is to expensive + - only if the producer is a pipelinebreaker +- renamed the materializedResultProgram into afterStepProgram +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.16 2004/07/29 08:46:17 msb Exp $ +d40 1 +@ + + +1.16 +log address@hidden refactored the MapMat Operator + - it now uses the HashTable and just avoids duplicates implicityl + - this should make the operator much cheaper +- added a cleanup program for the operator +- the HashTable handles Pipelinebreakers itself by using a copy program + - therefor the hash- and bnljoin operators don't need to do this +- new return value for the insert function of HashTable +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.15 2004/07/22 16:12:51 msb Exp $ +d36 24 +a59 24 + HashTable(hash_t aDirSize, + uint32 aNoOfRegs, + uint32 aResultReg, + AVM::Prog* aInsertHashProg, + AVM::Prog* aLookupHashProg, + AVM::Prog* aLookupCmpProg, + AVM::Prog* aCopyProg, + AVM::Prog* aCleanUpProg, + StmtCB* aStmtCB, + const size_t aChunkSize, + const unsigned long aNumberOfBlocks = 0); + ~HashTable(); + + using HashTableBase::initialize; + void initialize(PAL_Operator* aProducer, ZReg* someAuxRegs); + + ZReg* lookup(ZReg* zRegBank); + + void fill(); + void clear(); + + inline void resetCurrentItem(); + ZReg* insert(register ZReg*); + +d61 21 +a81 28 + /** + * the data source for the hash table + */ + PAL_Operator* theProducer; + /** + * number of entries to be stored in the buffer + */ + uint32 theNoEntries; + /** + * + */ + AVM::Prog* theInsertHashProg; + + /** + * + */ + AVM::Prog* theCopyProg; + + /** + * the current position in the hash directory during lookup. the + * iterator will only iterate through one bucket collecting + * duplicate entries in the hash table. + */ + CollisionList::iterator theCurrentItem; + /** + * the hash value for a item to be inserted + */ + HashValue theInsertHashValue; +d83 1 +a85 1 + +@ + + +1.15 +log address@hidden insert and lookup hashprogram for all operators using the semijoin hashtable +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.14 2004/04/19 20:19:56 norman Exp $ +d42 1 +d58 1 +a58 1 + bool insert(register ZReg*); +d75 5 +a102 58 + +/* + * $Log: hashtable.hh,v $ + * Revision 1.14 2004/04/19 20:19:56 norman + * moved isEqual into base class of hash tables + * + * Revision 1.13 2003/10/07 14:32:45 msb + * - changed interfaces of the hashtables + * - added initialize method which has to be called + * - AuxRegs are passed as parameter to the initialize method + * - deleted parameter AuxReg from Constructors + * - some cleanup + * + * Revision 1.12 2003/09/24 12:15:51 tneumann + * fixed warnings + * + * Revision 1.11 2003/04/03 12:56:48 norman + * the hash table explicitly assumes the producer not to be a pipeline breaker - or the inserting operator needs to handle this + * + * Revision 1.10 2003/03/13 17:51:24 norman + * refactoring of the hash table data structures: + * - seperated the data structure, memory managment, and hash table implementation + * - introduced abstract base class HashTableBase which contains common code + * - SJHashTable copies only register sets when the producer is pipeline breaker - copying + * needs to be done 1:1 now + * - SJHashTable applies duplicate elemination on insertion + * - all comparissons for group membership are based on the CMP-command instead of + * ORDER-command + * + * Revision 1.9 2003/02/05 15:24:08 norman + * added iterator to traverse the hashtable + * + * Revision 1.8 2002/08/20 15:16:45 schiele + * ISO-C++-fixes + * + * Revision 1.7 2002/08/02 10:51:45 norman + * extended data structures that are used by operators that are pipeline breakers with cleanup programs. The cleanup programs are used to release temporary data kept in the data structere + * + * Revision 1.6 2002/04/25 07:58:35 schiele + * ISO C++ fixes + * + * Revision 1.5 2000/06/16 15:42:48 westmann + * - bnljoin now gets separate hash-programs for the inner and the + * outer producer + * - moved the method definitions of bnljoin into bnljoin.cc + * + * Revision 1.4 2000/06/01 12:39:57 cc + * include files + * + * Revision 1.3 2000/04/13 15:11:44 westmann + * - the help-registers are now aux-registers + * - the result-registers for comparison-programs are now variable (and they + * have to be specified) + * + * Revision 1.2 1999/12/09 12:06:41 westmann + * renamed the class Iterator to PAL_Operator + * + */ +@ + + +1.14 +log address@hidden isEqual into base class of hash tables +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.13 2003/10/07 14:32:45 msb Exp $ +d39 1 +a39 1 + AVM::Prog* anInsertHashProg, +d72 1 +a72 4 + /** + * computes the hash value for the register + */ + AVM::Prog* theLookupHashProg; +d83 1 +a83 4 + /** + * the hash value for a item to be looked up + */ + HashValue theLookupHashValue; +d100 3 +@ + + +1.13 +log address@hidden changed interfaces of the hashtables + - added initialize method which has to be called + - AuxRegs are passed as parameter to the initialize method + - deleted parameter AuxReg from Constructors +- some cleanup +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.12 2003/09/24 12:15:51 tneumann Exp $ +a59 5 + + inline bool isEqual(register ZReg* currentRegBank, + register ZReg* itemRegBank) const; + +private: +d106 7 +@ + + +1.12 +log address@hidden warnings +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.11 2003/04/03 12:56:48 norman Exp $ +d47 2 +d50 1 +d55 1 +a96 3 +/*------------------------------------------------------------*/ +/* the implementations */ +/*------------------------------------------------------------*/ +d111 3 +@ + + +1.11 +log address@hidden hash table explicitly assumes the producer not to be a pipeline breaker - or the inserting operator needs to handle this +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.10 2003/03/13 17:51:24 norman Exp $ +d36 2 +a37 2 + HashTable(hash_t aDirSize, + uint32 aNoOfRegs, +d47 2 +a48 2 + inline void initialize(PAL_Operator* aProducer, ZReg* someAuxRegs); + inline ZReg* lookup(ZReg* zRegBank); +d50 1 +a50 11 + /** + * fill hashtable + * why cannot the producer be handed in here?, Why cannot initialization be done here? + */ + void fill() { + LOGOBJECT; + while(theProducer->next(theNextFreeItem)) { + // insert into hashtable, + insert(theNextFreeItem); + } + } +a97 70 + * initialize has to be called between construction and use of the + * hashtable + */ +inline void HashTable::initialize(PAL_Operator* aProducer, + ZReg* someAuxRegs) { + + theProducer = aProducer; + theAuxRegs = someAuxRegs; + clear(); + + resetCurrentItem(); // prepare for lookup +} + +/** + * return a value from the hash table with a hash value defined by + * zRegBank, duplicates are returned using an iterator through the + * collision list + */ +inline ZReg* HashTable::lookup(ZReg* zRegBank) { + LOGOBJECT; + + hash_t hv = theLookupHashValue(zRegBank); + if( /* check if theCurrentItem was not reset using resetCurrentItem */ + theCurrentItem != theHashDir[theHashDirSize].begin() && + /* check if next has already been called with the same set of registers */ + isEqual( zRegBank, *theCurrentItem ) ) { + /* take the next item from the collision list */ + ++theCurrentItem; + } else { + // otherwise look up new item + theCurrentItem = theHashDir[hv].begin(); + } + while( theCurrentItem != theHashDir[hv].end() ) { + if( isEqual( zRegBank, *theCurrentItem ) ) { + return *theCurrentItem; + } + ++theCurrentItem; + } + return 0; +} + +/** + * prepares the hashtable for reuse. It should be compared if it is + * cheaper to throw all chunks away (as it is done so far) or to keep + * the chunks for reuse and utilize the free memory menagement of the + * small chunk allocator + */ +inline void HashTable::clear() { + LOGOBJECT; + + /* + It would be nice to call doCleanUp here. But clear is also called + during the first initialization where the hash table is empty. + */ + + /* initialize table and buffer */ + for(unsigned int i = 0; i < theHashDirSize; ++i) { + theHashDir[i].clear(); + } + theAllocator.clear(); + + /* prepare for insertion of the first entry */ + createNewEntry(); + +#ifdef DEBUG + theCounter = 0; +#endif +} + +/** +d101 1 +a101 1 +inline void HashTable::resetCurrentItem() { +a105 36 +/** + * insert a new zReg into the hash table, the hash table asumes that + * the producer inserts only ZRegs, that have been handed to the + * producer by the method nextFreeZRegs() + */ +inline bool HashTable::insert(register ZReg*) { + LOGOBJECT; + + // add the new item into the hash table + register hash_t hv = theInsertHashValue( theNextFreeItem ); + theHashDir[hv].push_front( theNextFreeItem ); + + // allocate space for the next entry + createNewEntry(); + +#ifdef DEBUG + ++theCounter; +#endif + + return true; +} + +/** + * compares the hash values of two ZRegs + * @@returns true if the have equal hash values + */ +inline bool HashTable::isEqual(register ZReg* currentRegBank, + register ZReg* itemRegBank) const { + LOGOBJECT; + AVM::run(theCmpProg, + theAuxRegs, + currentRegBank, + itemRegBank, theStmtCB); + return (theAuxRegs[theCmpReg].bo4); +} + +d110 3 +@ + + +1.10 +log address@hidden of the hash table data structures: +- seperated the data structure, memory managment, and hash table implementation +- introduced abstract base class HashTableBase which contains common code +- SJHashTable copies only register sets when the producer is pipeline breaker - copying +needs to be done 1:1 now +- SJHashTable applies duplicate elemination on insertion +- all comparissons for group membership are based on the CMP-command instead of +ORDER-command +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.9 2003/02/05 15:24:08 norman Exp $ +d56 3 +a58 5 + register ZReg* currentRegBank = 0; + while(theProducer->next(currentRegBank = nextFreeZRegs())) { + // insert into hashtable + /* what happens, if the producer is a pipline breaker? */ + insert(currentRegBank); +d63 1 +a63 1 + bool insert(register ZReg* zRegBank); +d187 3 +a189 1 + * insert a new zReg into the hash table +d191 1 +a191 1 +inline bool HashTable::insert(register ZReg* zRegBank) { +d195 1 +a195 1 + register hash_t hv = theInsertHashValue(zRegBank); +d226 10 +@ + + +1.9 +log address@hidden iterator to traverse the hashtable +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.8 2002/08/20 15:16:45 schiele Exp $ +a17 1 +#ifndef ITERATOR +d19 2 +a20 4 +#endif +#ifndef HASHVALUE +#include "rts/infra/hashtable/hashvalue.hh" +#endif +d32 1 +a32 1 +class HashTable { +d36 1 +a36 15 + /** + * @@params aNoOfentries - the maximum number of entries to be stored + * in the buffer + * @@params aDirSize - the size of the hash directory + * @@params aNoOfRegs - the size of each register stored in the hash table + * @@params aResultReg + * @@params anInsertHashProg + * @@params aLookupHashProg - a AVM program which computes the + * hash value for the register + * @@params aLookupCmpProg - a AVM Program to compare the content + * of two RegSets + * @@params aStmtCB + */ + HashTable(uint32 aNoOfEntries, + hash_t aDirSize, +d43 6 +a48 109 + StmtCB* aStmtCB) + : theHashDirSize(aDirSize), + theProducer(0), + theNoRegs(aNoOfRegs), + theAuxRegs(0), + theResultReg(aResultReg), + theNoEntries(aNoOfEntries), + theLookupCmpProg(aLookupCmpProg), + theCleanUpProg(aCleanUpProg), + theStmtCB(aStmtCB), +#ifdef DEBUG + theCounter(0), +#endif + theInsertHashValue(theHashDirSize, anInsertHashProg), + theLookupHashValue(theHashDirSize, aLookupHashProg) { + LOGOBJECT; + + if(theHashDirSize < 1) { + error_handle("HashTable::HashTable", + "theHashDirSize was initialized by " << theHashDirSize, + false); + theHashDirSize = 1; + } + + // allocate memory for hashtable + theHashDir = new char*[theHashDirSize]; + + // allocate memory for hash items + + // theNoRegs + 1 because we need space for the next-pointer and we + // want to stay aligned + theItemSize = (theNoRegs + 1) * sizeof(ZReg); + theBufferSize = theItemSize * theNoEntries; + + theBuffer = new char[theBufferSize]; + } + + /** + * + */ + ~HashTable() { + LOGOBJECT; + // clean up + doCleanUp(); + + if(theHashDir) { + delete [] theHashDir; + } + if(theBuffer) { + delete [] theBuffer; + } + } + + /** + * initialize has to be called between construction and use of the + * hashtable + */ + void initialize(PAL_Operator* aProducer, + ZReg* someAuxRegs) { + + theProducer = aProducer; + + theAuxRegs = someAuxRegs; + + // initialize table and buffer + theEndOfBuffer = theBuffer + theBufferSize; + clear(); + + // prepare for lookup + theCurrentItem = 0; + theCurrentEntry = 0; + } + + /** + * return a value from the hash table with a hash value defined by zRegBank + */ + ZReg* lookup(ZReg* zRegBank) { + LOGOBJECT; + register hash_t hv; + +#ifdef DEBUG + // std::cerr << "lookup: "; + // check(std::cerr); +#endif + + if(theCurrentItem && isEqual(zRegBank, zregs(theCurrentItem))) { + // if next has already been called with the same set of registers, + // take the next item from the collision list + theCurrentItem = getNextItem(theCurrentItem); + } else { + // otherwise look up new item + hv = theLookupHashValue(zRegBank); + theCurrentItem = theHashDir[hv]; + } + while(theCurrentItem) { +#ifdef DEBUG + if (theCurrentItem > theEndOfBuffer) { + error_handle("HashTable::lookup", + "trying to lookup item outside hash table space", true); + } +#endif + if(isEqual(zRegBank, zregs(theCurrentItem))) { + return zregs(theCurrentItem); + } + theCurrentItem = getNextItem(theCurrentItem); + } + return 0; + } + +d52 1 +d63 3 +a65 202 + + /** + * prepares the hashtable for reuse without new memory allocation + */ + void clear() { + LOGOBJECT; + unsigned int i; + + /* + It would be nice to call doCleanUp here. But clear is also called + during the first initialization where the hash table is empty. + */ + + // initialize table and buffer + for(i = 0; i < theHashDirSize; ++i) { + theHashDir[i] = 0; + } + theNextFreeItem = theBuffer - theItemSize; + + register char* cleaner = theBuffer; + // std::cerr << "cleaning ... "; + while(cleaner < theEndOfBuffer) { + *cleaner = 0; + ++cleaner; + } + // std::cerr << "ready" << std::endl; + +#ifdef DEBUG + theCounter = 0; +#endif + } + + /** + * runs theCleanUp on each item stored in the hash table + */ + void doCleanUp() { + LOGOBJECT; +#ifdef DEBUG + // check(std::cerr); +#endif + char* curElement; + for(unsigned int i = 0; i < theHashDirSize; ++i) { + curElement = theHashDir[i]; + while(curElement) { + ZReg* lRegs = zregs(curElement); + AVM::run(theCleanUpProg, theAuxRegs, lRegs, 0, theStmtCB); + curElement = getNextItem(curElement); + } + } + } + + /** + * + */ + void resetCurrentItem() { + LOGOBJECT; + theCurrentItem = 0; + } + + /** + * insert a new zReg into the hash table + */ + void insert(register ZReg* zRegBank) { + LOGOBJECT; + register hash_t hv; + + // advance theNextFreeItem + advanceFreeItem(); + + // calculate hash value + hv = theInsertHashValue(zRegBank); + + // insert into collision list + setNextItem(theNextFreeItem, theHashDir[hv]); + theHashDir[hv] = theNextFreeItem; + +#ifdef DEBUG + ++theCounter; + // check(std::cerr); +#endif + } + + /** + * returns space from the buffer to put a new value into + */ + ZReg* nextFreeZRegs() { + LOGOBJECT; + return zregs(theNextFreeItem + theItemSize); + } + + /** + * + */ + void check(std::ostream& os) { + LOGOBJECT; + int realCounter = 0; + char* curElement; + for(unsigned int i = 0; i < theHashDirSize; ++i) { + curElement = theHashDir[i]; + while(curElement) { + if(theNextFreeItem >= theEndOfBuffer) { + error_handle("HashTable::advanceFreeItem", + "overflow handling not yet implemented", true); + } + ++realCounter; + curElement = getNextItem(curElement); + } + } +#ifdef DEBUG + if (theCounter != realCounter) { + os + << "number of inserted elements : " << theCounter << std::endl + << "number of existing elements : " << realCounter << std::endl; + } +#endif + } + + /* the iterator was introduced, because the PAL_HashOuterJoin needs + to find all unmatched tuples in this hash table */ + friend class iterator; + + class iterator { + private: + /** + * the hash table + */ + HashTable* theHashTable; + /** + * the currently inpected bucket in the hash directory + */ + hash_t theCurrentBucket; + /** + * the current position in the hash directory + */ + char* theCurrentItem; + public: + /** + * default constructor + */ + iterator() : theHashTable(0), theCurrentBucket(0), theCurrentItem(0) + {} + + /** + * constructor + */ + iterator(HashTable* aHashTable, hash_t aBucket, char* aItem) + : theHashTable(aHashTable), theCurrentBucket(aBucket), theCurrentItem(aItem) + { /* hopefully aItem is an element of the hash table!!! */ } + + /** + * go to the next valid item in the hash table + */ + iterator& operator++() { + theCurrentItem = getNextItem(theCurrentItem); + while( !theCurrentItem && (theCurrentBucket < theHashTable->theHashDirSize) ) { + ++theCurrentBucket; + theCurrentItem = theHashTable->theHashDir[theCurrentBucket]; + } + + return *this; + } + + ZReg* operator*() const { + if ( theCurrentItem ) { + return zregs(theCurrentItem); + } else { + error_handle("HashTable::iterator::operator*", + "iterator points to invalid item - not initialized?", true); + } + return 0; + } + + bool operator==(const iterator& i) const { + return ( (theCurrentBucket == i.theCurrentBucket) && + (theCurrentItem == i.theCurrentItem) ); + } + + bool operator!=(const iterator& i) const { + return ( (theCurrentBucket != i.theCurrentBucket) || + (theCurrentItem != i.theCurrentItem) ); + } + }; + + /** + * set the cursor on the first valid item in the hash table + */ + iterator begin() const { + hash_t lFirstBucket = 0; + char* lFirstItem = theHashDir[lFirstBucket]; + + while( !lFirstItem && (lFirstBucket < theHashDirSize) ) { + ++lFirstBucket; + lFirstItem = theHashDir[lFirstBucket]; + } + + return iterator(const_cast(this), lFirstBucket, lFirstItem); + } + + iterator end() const { + return iterator( const_cast(this), theHashDirSize, + theHashDir[theHashDirSize] ); + } +a68 40 + /** + * + */ + static char* getNextItem(char* item) { + LOGOBJECT; + return *((char**) item); + } + + /** + * + */ + static void setNextItem(char* item, char* nextItem) { + LOGOBJECT; + *((char**) item) = nextItem; + } + + /** + * + */ + void advanceFreeItem() { + LOGOBJECT; + theNextFreeItem += theItemSize; + if(theNextFreeItem >= theEndOfBuffer) { + error_handle("HashTable::advanceFreeItem", + "overflow handling not yet implemented", true); + } + } + + /** + * converts a item in the buffer back into a ZReg + */ + static ZReg* zregs(char* item) { + LOGOBJECT; + return (ZReg*) (item + sizeof(ZReg)); + } + + /** + * compares the hash values of two ZRegs + * @@returns true if the have equal hash values + */ +d70 1 +a70 8 + register ZReg* itemRegBank) { + LOGOBJECT; + AVM::run(theLookupCmpProg, + theAuxRegs, + currentRegBank, + itemRegBank, theStmtCB); + return (theAuxRegs[theResultReg].bo4); + } +a72 9 + + /** + * the size of the hash directory + */ + hash_t theHashDirSize; + /** + * the hash directory + */ + char** theHashDir; +a77 16 + * the number of registers of each item to be stored in the hash table + */ + unsigned int theNoRegs; + /** + * + */ + ZReg* theAuxRegs; + /** + * + */ + uint32 theResultReg; + /** + * pointer to the buffer + */ + char* theBuffer; + /** +a81 17 + * size of each item in the buffer, this is the size for one Regset + + * a pointer to the next item in the bucket + */ + uint32 theItemSize; + /** + * the Size of the Buffer, this is theItemSize * theNoEntries + */ + uint32 theBufferSize; + /** + * pointer to the end of the buffer + */ + char* theEndOfBuffer; + /** + * pointer to the next space in the buffer to insert a item into + */ + char* theNextFreeItem; + /** +d90 3 +a92 1 + * compare the content of two RegSets +d94 1 +a94 1 + AVM::Prog* theLookupCmpProg; +d96 1 +a96 1 + * releases resources held by the RegSets stored in the hash table +d98 1 +a98 1 + AVM::Prog* theCleanUpProg; +d100 1 +a100 1 + * +d102 76 +a177 1 + StmtCB* theStmtCB; +d179 8 +d188 13 +a200 9 + // for next + /** + * pointer to the next item to be read from the Hash Table + */ + char* theCurrentItem; + /** + * seems not to be used any where ? + */ + int theCurrentEntry; +d202 1 +a202 4 + /** + * + */ + int theCounter; +a203 8 + /** + * the hash value for a item to be inserted + */ + HashValue theInsertHashValue; + /** + * the hash value for a item to be looked up + */ + HashValue theLookupHashValue; +d205 2 +d208 13 +a220 1 +}; +d226 3 +@ + + +1.8 +log address@hidden +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.7 2002/08/02 10:51:45 norman Exp $ +d299 85 +d541 3 +@ + + +1.7 +log address@hidden data structures that are used by operators that are pipeline breakers with cleanup programs. The cleanup programs are used to release temporary data kept in the data structere +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.6 2002/04/25 07:58:35 schiele Exp $ +d275 1 +a275 1 + void check(ostream& os) { +d456 3 +@ + + +1.6 +log address@hidden C++ fixes +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.5 2000/06/16 15:42:48 westmann Exp $ +d26 6 +d40 11 +a50 1 + * +d59 1 +d68 1 +d103 2 +d134 1 +a134 1 + * +d139 6 +d155 6 +d175 1 +a175 1 + register ZReg* currentRegBank; +d178 1 +d189 6 +d202 1 +a202 1 + //cerr << "cleaning ... "; +d207 1 +a207 1 + //cerr << "ready" << std::endl; +d215 19 +d242 1 +a242 1 + * +d259 2 +a260 1 + ++theCounter; +d265 1 +a265 1 + * +d282 4 +d290 2 +a292 1 +#ifdef DEBUG +d294 2 +a296 1 + << "number of existing elements : " << realCounter << std::endl; +d303 1 +a303 1 + * +d331 1 +a331 1 + * +d339 2 +a340 1 + * +d349 1 +a349 1 + return (theAuxRegs[theResultReg].si4 == 0); +d355 1 +a355 1 + * +d359 1 +a359 1 + * +d363 1 +a363 1 + * +d367 1 +a367 1 + * +d379 1 +a379 1 + * +d383 1 +a383 1 + * +d387 2 +a388 1 + * +d392 1 +a392 1 + * +d396 1 +a396 1 + * +d400 1 +a400 1 + * +d408 1 +a408 1 + * +d412 1 +a412 1 + * +d416 4 +d427 1 +a427 1 + * +d431 1 +a431 1 + * +d441 1 +a441 1 + * +d445 1 +a445 1 + * +d456 3 +@ + + +1.6.4.1 +log +@ +Changes from the HEAD branch. +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.8 2002/08/20 15:16:45 schiele Exp $ +a25 6 + * The hash table uses closed hashing. The items of the buckets are stored + * in a buffer. The entries in the hash directory point to the first + * item in the bucket. Linking the elements within the buckets is done by + * appending a pointer to each item in the buffer which points to the next + * item in the bucket. + * +d34 1 +a34 11 + * @@params aNoOfentries - the maximum number of entries to be stored + * in the buffer + * @@params aDirSize - the size of the hash directory + * @@params aNoOfRegs - the size of each register stored in the hash table + * @@params aResultReg + * @@params anInsertHashProg + * @@params aLookupHashProg - a AVM program which computes the + * hash value for the register + * @@params aLookupCmpProg - a AVM Program to compare the content + * of two RegSets + * @@params aStmtCB +a42 1 + AVM::Prog* aCleanUpProg, +a50 1 + theCleanUpProg(aCleanUpProg), +a84 2 + doCleanUp(); + +d114 1 +a114 1 + * return a value from the hash table with a hash value defined by zRegBank +a118 6 + +#ifdef DEBUG + // std::cerr << "lookup: "; + // check(std::cerr); +#endif + +a128 6 +#ifdef DEBUG + if (theCurrentItem > theEndOfBuffer) { + error_handle("HashTable::lookup", + "trying to lookup item outside hash table space", true); + } +#endif +d143 1 +a143 1 + register ZReg* currentRegBank = 0; +a145 1 + /* what happens, if the producer is a pipline breaker? */ +a155 6 + + /* + It would be nice to call doCleanUp here. But clear is also called + during the first initialization where the hash table is empty. + */ + +d163 1 +a163 1 + // std::cerr << "cleaning ... "; +d168 1 +a168 1 + // std::cerr << "ready" << std::endl; +a175 19 + * runs theCleanUp on each item stored in the hash table + */ + void doCleanUp() { + LOGOBJECT; +#ifdef DEBUG + // check(std::cerr); +#endif + char* curElement; + for(unsigned int i = 0; i < theHashDirSize; ++i) { + curElement = theHashDir[i]; + while(curElement) { + ZReg* lRegs = zregs(curElement); + AVM::run(theCleanUpProg, theAuxRegs, lRegs, 0, theStmtCB); + curElement = getNextItem(curElement); + } + } + } + + /** +d184 1 +a184 1 + * insert a new zReg into the hash table +d201 1 +a201 2 + ++theCounter; + // check(std::cerr); +d206 1 +a206 1 + * returns space from the buffer to put a new value into +d216 1 +a216 1 + void check(std::ostream& os) { +a222 4 + if(theNextFreeItem >= theEndOfBuffer) { + error_handle("HashTable::advanceFreeItem", + "overflow handling not yet implemented", true); + } +d227 1 +a228 2 + if (theCounter != realCounter) { + os +d230 1 +a231 2 + } +#endif +d238 1 +a238 1 + * +d266 1 +a266 1 + * converts a item in the buffer back into a ZReg +d274 1 +a274 2 + * compares the hash values of two ZRegs + * @@returns true if the have equal hash values +d283 1 +a283 1 + return (theAuxRegs[theResultReg].bo4); +d289 1 +a289 1 + * the size of the hash directory +d293 1 +a293 1 + * the hash directory +d297 1 +a297 1 + * the data source for the hash table +d301 1 +a301 1 + * the number of registers of each item to be stored in the hash table +d313 1 +a313 1 + * pointer to the buffer +d317 1 +a317 1 + * number of entries to be stored in the buffer +d321 1 +a321 2 + * size of each item in the buffer, this is the size for one Regset + + * a pointer to the next item in the bucket +d325 1 +a325 1 + * the Size of the Buffer, this is theItemSize * theNoEntries +d329 1 +a329 1 + * pointer to the end of the buffer +d333 1 +a333 1 + * pointer to the next space in the buffer to insert a item into +d341 1 +a341 1 + * computes the hash value for the register +d345 1 +a345 1 + * compare the content of two RegSets +a348 4 + * releases resources held by the RegSets stored in the hash table + */ + AVM::Prog* theCleanUpProg; + /** +d356 1 +a356 1 + * pointer to the next item to be read from the Hash Table +d360 1 +a360 1 + * seems not to be used any where ? +d370 1 +a370 1 + * the hash value for a item to be inserted +d374 1 +a374 1 + * the hash value for a item to be looked up +a384 9 + * Revision 1.8 2002/08/20 15:16:45 schiele + * ISO-C++-fixes + * + * Revision 1.7 2002/08/02 10:51:45 norman + * extended data structures that are used by operators that are pipeline breakers with cleanup programs. The cleanup programs are used to release temporary data kept in the data structere + * + * Revision 1.6 2002/04/25 07:58:35 schiele + * ISO C++ fixes + * +@ + + +1.5 +log +@ - bnljoin now gets separate hash-programs for the inner and the + outer producer + - moved the method definitions of bnljoin into bnljoin.cc +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.4 2000/06/01 12:39:57 cc Exp $ +d168 1 +a168 1 + //cerr << "ready" << endl; +d229 1 +a229 1 + << "number of inserted elements : " << theCounter << endl +d231 1 +a231 1 + << "number of existing elements : " << realCounter << endl; +d385 5 +@ + + +1.4 +log address@hidden files +@ +text address@hidden 1 +a11 1 + $Id: hashtable.hh,v 1.3 2000/04/13 15:11:44 westmann Exp $ +a30 85 +private: + + /** + * + */ + hash_t theHashDirSize; + /** + * + */ + char** theHashDir; + /** + * + */ + PAL_Operator* theProducer; + /** + * + */ + unsigned int theNoRegs; + /** + * + */ + ZReg* theAuxRegs; + /** + * + */ + uint32 theResultReg; + /** + * + */ + char* theBuffer; + /** + * + */ + uint32 theNoEntries; + /** + * + */ + uint32 theItemSize; + /** + * + */ + uint32 theBufferSize; + /** + * + */ + char* theEndOfBuffer; + /** + * + */ + char* theNextFreeItem; + /** + * + */ + AVM::Prog* theHashProg; + /** + * + */ + AVM::Prog* theCmpProg; + /** + * + */ + StmtCB* theStmtCB; + + + // for next + /** + * + */ + char* theCurrentItem; + /** + * + */ + int theCurrentEntry; +#ifdef DEBUG + /** + * + */ + int theCounter; +#endif + /** + * + */ + HashValue theHashValue; + + +d40 3 +a42 2 + AVM::Prog* aHashProg, + AVM::Prog* aCmpProg, +d50 1 +a50 1 + theCmpProg(aCmpProg), +d55 2 +a56 1 + theHashValue(theHashDirSize, aHashProg) { +d125 1 +a125 1 + hv = theHashValue(zRegBank); +d194 1 +a194 1 + hv = theHashValue(zRegBank); +d279 4 +a282 1 + AVM::run(theCmpProg, theAuxRegs, currentRegBank, itemRegBank, theStmtCB); +d286 93 +d385 3 +@ + + +1.3 +log +@ - the help-registers are now aux-registers + - the result-registers for comparison-programs are now variable (and they + have to be specified) +@ +text address@hidden 4 +a8 4 + Lehrstuhl fuer Praktische Informatik III + Universitaet Mannheim + Germany + +d11 1 +a11 1 + $Id: hashtable.hh,v 1.2 1999/12/09 12:06:41 westmann Exp $ +d22 1 +a22 1 +#include "hashvalue.hh" +d30 1 +a30 1 + +d32 1 +a32 1 + +d117 1 +a117 1 + +d141 1 +a141 1 + +d148 1 +a148 1 + +d151 1 +a151 1 + +d153 2 +a154 2 + + // theNoRegs + 1 because we need space for the next-pointer and we +d158 1 +a158 1 + +d161 1 +a161 1 + +d216 1 +a216 1 + } +d219 2 +a220 2 + + +d232 1 +a232 1 + +d244 1 +a244 1 + +d252 1 +a252 1 + +d257 1 +a257 1 + +d265 1 +a265 1 + +d272 1 +a272 1 + +d275 1 +a275 1 + +d278 1 +a278 1 + +d282 1 +a282 1 + +d287 1 +a287 1 + +d295 1 +a295 1 + +d310 1 +a310 1 + os +d316 2 +a317 2 + + +d319 1 +a319 1 + +d327 1 +a327 1 + +d335 1 +a335 1 + +d343 1 +a343 1 + error_handle("HashTable::advanceFreeItem", +d347 1 +a347 1 + +d355 1 +a355 1 + +d359 1 +a359 1 + inline bool isEqual(register ZReg* currentRegBank, +d365 1 +a365 1 + +d372 5 +@ + + +1.2 +log address@hidden the class Iterator to PAL_Operator +@ +text address@hidden 1 +a11 1 + $Id$ +d52 5 +a56 1 + ZReg* theHelpRegs; +d64 1 +a64 1 + unsigned int theNoEntries; +d68 1 +a68 1 + unsigned int theItemSize; +d72 1 +a72 1 + unsigned int theBufferSize; +d121 7 +a127 8 + HashTable(unsigned int aNoOfEntries, + unsigned int aDirSize, + PAL_Operator* aProducer, + unsigned int aNoOfRegs, + ZReg* someHelpRegs, + AVM::Prog* aHashProg, + AVM::Prog* aCmpProg, + StmtCB* aStmtCB) +d129 1 +a129 1 + theProducer(aProducer), +d131 2 +a132 1 + theHelpRegs(someHelpRegs), +a159 8 + + // initialize table and buffer + theEndOfBuffer = theBuffer + theBufferSize; + clear(); + + // prepare for lookup + theCurrentItem = 0; + theCurrentEntry = 0; +d165 1 +a165 1 + virtual ~HashTable() { +d177 20 +d199 1 +a199 1 + virtual ZReg* lookup(ZReg* zRegBank) { +d224 1 +a224 1 + virtual void fill() { +d236 1 +a236 1 + virtual void clear() { +d269 1 +a269 1 + virtual void insert(register ZReg* zRegBank) { +d362 2 +a363 2 + AVM::run(theCmpProg, theHelpRegs, currentRegBank, itemRegBank, theStmtCB); + return (theHelpRegs[0].si4 == 0); +d371 4 +a374 1 + * $Log$ +@ + + +1.1 +log address@hidden revision +@ +text address@hidden 14 +a17 3 +// IMPORTANT: HashTable expects an opened Iterator producer and +// will not close producer !! + +d25 4 +d33 56 +a88 14 + hash_t theHashDirSize; + char** theHashDir; + Iterator* theIter; + unsigned int theNoRegs; + ZReg* theHelpRegs; + char* theBuffer; + unsigned int theNoEntries; + unsigned int theItemSize; + unsigned int theBufferSize; + char* theEndOfBuffer; + char* theNextFreeItem; + AVM::Prog* theHashProg; + AVM::Prog* theCmpProg; + StmtCB* theStmtCB; +d92 8 +a99 2 + char* theCurrentItem; + int theCurrentEntry; +d101 4 +a104 1 + int theCounter; +d106 4 +a109 1 + HashValue theHashValue; +d114 11 +a124 8 + HashTable(unsigned int aNoOfEntries, + unsigned int aDirSize, + Iterator* aProducer, + unsigned int aNoOfRegs, + ZReg* someHelpRegs, + AVM::Prog* aHashProg, + AVM::Prog* aCmpProg, + StmtCB* aStmtCB) +d126 1 +a126 1 + theIter(aProducer), +d166 3 +d180 3 +d205 3 +a207 1 + /// fill hashtable +d211 1 +a211 1 + while(theIter->next(currentRegBank = nextFreeZRegs())) { +d217 3 +a219 1 + /// prepares the hashtable for reuse without new memory allocation +d242 3 +d250 3 +d272 3 +d280 3 +d304 3 +d312 3 +d320 3 +d332 3 +d340 3 +d353 4 +@ + + +1.1.1.1 +log address@hidden +@ +text +@@ ============================================================ --- tests/update_does_not_stomp_non-monotone_files/__driver__.lua 3001c8acd928063b99fac8f01f54424d0e7ee630 +++ tests/update_does_not_stomp_non-monotone_files/__driver__.lua 3001c8acd928063b99fac8f01f54424d0e7ee630 @@ -0,0 +1,35 @@ + +mtn_setup() + +-- This test is a bug report + +-- 1. Alice checks out project, creates file foo +-- 2. Bob checks out project, creates foo, adds foo, and commits +-- 3. Now Alice does an update +-- +-- monotone should warn her before stomping her non-revision controlled 'foo' file +-- + +writefile("initial", "some initial data") + +writefile("foo.alice", "foo not revision controlled") +writefile("foo.bob", "foo checked into project") + +-- Alice make project, writes foo, but doesn't check it in +mkdir("alicewd") +copyfile("initial", "alicewd/initial") +check(mtn("--branch=testbranch", "setup", "alicewd"), 0, false, false) +check(indir("alicewd", mtn("--root=.", "add", "initial")), 0, false, false) +check(indir("alicewd", mtn("--branch=testbranch", "--root=.", "commit", "-m", 'initial commit')), 0, false, false) +copyfile("foo.alice", "alicewd/foo") + +-- Bob does add of file foo, and commits +check(mtn("--branch=testbranch", "checkout", "bobwd"), 0, false, false) +copyfile("foo.bob", "bobwd/foo") +check(indir("bobwd", mtn("--root=.", "add", "foo")), 0, false, false) +check(indir("bobwd", mtn("--branch=testbranch", "--root=.", "commit", "-m", 'bob commit')), 0, false, false) +rev = indir("bobwd", {base_revision})[1]() + +-- Alice does her update, discovers foo has been stomped! +check(indir("alicewd", mtn("--branch=testbranch", "--root=.", "update", "--revision", rev)), 0, false, false) +xfail_if(true, samefile("foo.alice", "alicewd/foo")) ============================================================ --- tests/update_to_non-existent_rev/__driver__.lua a34b9f6b62bf3cd4d5b7442c44882de56e5d95ee +++ tests/update_to_non-existent_rev/__driver__.lua a34b9f6b62bf3cd4d5b7442c44882de56e5d95ee @@ -0,0 +1,7 @@ + +mtn_setup() + +addfile("testfile", "blah blah") +commit() + +check(mtn("update", "--revision=73070030f7b0d0f3d4ee02545d45ca4bbe5e189f"), 1, false, false) ============================================================ --- tests/update_to_off-branch_rev/__driver__.lua 09660e5a0d63ff6671afc6a288be58071beecd2e +++ tests/update_to_off-branch_rev/__driver__.lua 09660e5a0d63ff6671afc6a288be58071beecd2e @@ -0,0 +1,43 @@ + +mtn_setup() +revs = {} + +addfile("testfile", "blah blah") +commit() +revs.t = base_revision() + +writefile("testfile", "other other") +commit("otherbranch") +revs.o = base_revision() + +writefile("testfile", "third third") +commit("somebranch") +revs.s = base_revision() +check(mtn("cert", revs.s, "branch", "otherbranch"), 0, false, false) + +writefile("testfile", "double double") +commit("nobranch") +revs.n = base_revision() +check(mtn("db", "kill_branch_certs_locally", "nobranch")) + +check(mtn("checkout", "--branch=testbranch", "--revision", revs.t, "codir"), 0, false, false) +check(grep('^ *branch "testbranch"', "codir/_MTN/options"), 0, false, false) +-- make sure that updating to a rev in one other branch puts us in that branch +check(indir("codir", mtn("update", "--revision", revs.o)), 0, false, false) +check(grep('^ *branch "otherbranch"', "codir/_MTN/options"), 0, false, false) + +-- updating to a rev in multiple branches, including current branch, leaves branch alone +check(indir("codir", mtn("update", "-r", revs.s)), 0, false, false) +check(grep('^ *branch "otherbranch"', "codir/_MTN/options"), 0, false, false) + +-- but updating to a rev in multiple branches that _don't_ include the current one, fails +-- first go back out to TR +check(indir("codir", mtn("update", "-r", revs.t)), 0, false, false) +check(grep('^ *branch "testbranch"', "codir/_MTN/options"), 0, false, false) +-- and now jumping to SR directly should fail +check(indir("codir", mtn("update", "-r", revs.s)), 1, false, false) +check(grep('^ *branch "testbranch"', "codir/_MTN/options"), 0, false, false) + +-- updating to a rev in no branches at all succeeds, and leaves current branch alone +check(indir("codir", mtn("update", "-r", revs.n)), 0, false, false) +check(grep('^ *branch "testbranch"', "codir/_MTN/options"), 0, false, false) ============================================================ --- tests/use_get_linesep_conv_hook/__driver__.lua 795b37572ca781a06e6097b6d48ba82a921054c6 +++ tests/use_get_linesep_conv_hook/__driver__.lua 795b37572ca781a06e6097b6d48ba82a921054c6 @@ -0,0 +1,41 @@ + +mtn_setup() +revs = {} + +-- This test excercises the common case of wanting to do newline +-- character conversion so that win32 users can have native line endings +-- in their workspace. + +writefile("foo.crlf", "foo\r\n") +writefile("foo.lf", "foo\n") + +writefile("foofoo.crlf", "foo\r\nfoo\r\n") +writefile("foofoo.lf", "foo\nfoo\n") + +getfile("linesep.lua") + +copyfile("foo.crlf", "foo") +check(mtn("--rcfile=linesep.lua", "add", "foo"), 0, false, false) +check(mtn("--rcfile=linesep.lua", "--branch=foo", "commit", "-m", "foo"), 0, false, false) +revs.foo = base_revision() + +copyfile("foofoo.crlf", "foo") +check(mtn("--rcfile=linesep.lua", "commit", "-m", "foofoo"), 0, false, false) +revs.foofoo = base_revision() + +remove_recursive("_MTN") +check(mtn("--rcfile=linesep.lua", "co", "--revision", revs.foo, "."), 0, false, false) +check(samefile("foo", "foo.crlf")) + +check(mtn("--rcfile=linesep.lua", "checkout", "--revision", revs.foo, "foo_crlf"), 0, false, false) +check(samefile("foo.crlf", "foo_crlf/foo")) + +check(mtn("--rcfile=linesep.lua", "checkout", "--revision", revs.foofoo, "foo_foo_crlf"), 0, false, false) +check(samefile("foofoo.crlf", "foo_foo_crlf/foo")) + +-- no rcfile here +check(mtn("checkout", "--revision", revs.foo, "foo_lf"), 0, false, false) +check(samefile("foo.lf", "foo_lf/foo")) + +check(mtn("checkout", "--revision", revs.foofoo, "foo_foo_lf"), 0, false, false) +check(samefile("foofoo.lf", "foo_foo_lf/foo")) ============================================================ --- tests/use_get_linesep_conv_hook/linesep.lua adb80ce1fb412710056c99833379820fd0e5d6d1 +++ tests/use_get_linesep_conv_hook/linesep.lua adb80ce1fb412710056c99833379820fd0e5d6d1 @@ -0,0 +1,3 @@ +function get_linesep_conv(name) + return {"LF", "CRLF"} +end ============================================================ --- tests/use_inodeprints_hook/__driver__.lua 07ead3d63cfc585cae4a229f9b1103c0e501b7fc +++ tests/use_inodeprints_hook/__driver__.lua 07ead3d63cfc585cae4a229f9b1103c0e501b7fc @@ -0,0 +1,26 @@ + +mtn_setup() + +getfile("on.lua") +getfile("off.lua") + +check(not exists("_MTN/inodeprints")) +addfile("testfile", "blah blah") +commit() +rev = base_revision() + +check(mtn("setup", "--branch=testbranch", "setup_default"), 0, false, false) +check(not exists("setup_default/_MTN/inodeprints")) +check(mtn("checkout", "--revision", rev, "co_default"), 0, false, false) +check(not exists("co_default/_MTN/inodeprints")) + +check(mtn("--rcfile=off.lua", "setup", "--branch=testbranch", "setup_off"), 0, false, false) +check(not exists("setup_off/_MTN/inodeprints")) +check(mtn("--rcfile=off.lua", "checkout", "--revision", rev, "co_off"), 0, false, false) +check(not exists("co_off/_MTN/inodeprints")) + +check(mtn("--rcfile=on.lua", "setup", "--branch=testbranch", "setup_on"), 0, false, false) +check(exists("setup_on/_MTN/inodeprints")) +check(mtn("--rcfile=on.lua", "checkout", "--revision", rev, "co_on"), 0, false, false) +check(exists("co_on/_MTN/inodeprints")) +check(fsize("co_on/_MTN/inodeprints") ~= 0) ============================================================ --- tests/use_inodeprints_hook/off.lua 481189d908ab9f79eef9d34ace28b9717532f69f +++ tests/use_inodeprints_hook/off.lua 481189d908ab9f79eef9d34ace28b9717532f69f @@ -0,0 +1,3 @@ +function use_inodeprints() + return false +end ============================================================ --- tests/use_inodeprints_hook/on.lua baa05774088081b8b2b2e4aafcc97a98376e5271 +++ tests/use_inodeprints_hook/on.lua baa05774088081b8b2b2e4aafcc97a98376e5271 @@ -0,0 +1,3 @@ +function use_inodeprints() + return true +end ============================================================ --- tests/workspace_inventory/__driver__.lua 520d87edeeb2cca37c6e8e2a733a988edc738aa7 +++ tests/workspace_inventory/__driver__.lua 520d87edeeb2cca37c6e8e2a733a988edc738aa7 @@ -0,0 +1,153 @@ + +mtn_setup() + +getfile("inventory_hooks.lua") + +addfile("missing", "missing") +addfile("dropped", "dropped") +addfile("original", "original") +addfile("unchanged", "unchanged") +addfile("patched", "patched") +commit() + +-- single status changes + +addfile("added", "added") +writefile("unknown", "unknown") +writefile("ignored~", "ignored~") + +remove("missing") +remove("dropped") +rename("original", "renamed") +writefile("patched", "something has changed") + +check(mtn("add", "added"), 0, false, false) +check(mtn("rename", "original", "renamed"), 0, false, false) +check(mtn("drop", "dropped"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ M 0 0 missing$', "stdout"), 0, false, false) +check(grep('^ A 0 0 added$', "stdout"), 0, false, false) +check(grep('^D 0 0 dropped$', "stdout"), 0, false, false) +check(grep('^R 1 0 original$', "stdout"), 0, false, false) +check(grep('^ R 0 1 renamed$', "stdout"), 0, false, false) +check(grep('^ P 0 0 patched$', "stdout"), 0, false, false) +check(grep('^ 0 0 unchanged$', "stdout"), 0, false, false) +check(grep('^ U 0 0 unknown$', "stdout"), 0, false, false) +check(grep('^ I 0 0 ignored~$', "stdout"), 0, false, false) + +-- swapped but not moved + +check(mtn("revert", "."), 0, false, false) + +check(mtn("rename", "unchanged", "temporary"), 0, false, false) +check(mtn("rename", "original", "unchanged"), 0, false, false) +check(mtn("rename", "temporary", "original"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^RRP 1 2 original$', "stdout"), 0, false, false) +check(grep('^RRP 2 1 unchanged$', "stdout"), 0, false, false) + +-- swapped and moved + +rename("unchanged", "temporary") +rename("original", "unchanged") +rename("temporary", "original") + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^RR 1 2 original$', "stdout"), 0, false, false) +check(grep('^RR 2 1 unchanged$', "stdout"), 0, false, false) + +-- rename foo bar; add foo + +check(mtn("revert", "."), 0, false, false) + +check(mtn("rename", "original", "renamed"), 0, false, false) +check(mtn("add", "original"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^RA 1 0 original$', "stdout"), 0, false, false) +check(grep('^ R 0 1 renamed$', "stdout"), 0, false, false) + +-- rotated but not moved +-- - note that things are listed and numbered in path collating order +-- dropped -> missing -> original -> dropped + +check(mtn("revert", "."), 0, false, false) + +check(mtn("rename", "original", "temporary"), 0, false, false) +check(mtn("rename", "missing", "original"), 0, false, false) +check(mtn("rename", "dropped", "missing"), 0, false, false) +check(mtn("rename", "temporary", "dropped"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^RRP 1 3 dropped$', "stdout"), 0, false, false) +check(grep('^RRP 2 1 missing$', "stdout"), 0, false, false) +check(grep('^RRP 3 2 original$', "stdout"), 0, false, false) + +-- rotated and moved + +rename("original", "temporary") +rename("missing", "original") +rename("dropped", "missing") +rename("temporary", "dropped") + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^RR 1 3 dropped$', "stdout"), 0, false, false) +check(grep('^RR 2 1 missing$', "stdout"), 0, false, false) +check(grep('^RR 3 2 original$', "stdout"), 0, false, false) + +-- dropped but not removed and thus unknown + +check(mtn("revert", "."), 0, false, false) + +check(mtn("drop", "dropped"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^D U 0 0 dropped$', "stdout"), 0, false, false) + +-- added but removed and thus missing + +check(mtn("revert", "."), 0, false, false) + +check(mtn("add", "added"), 0, false, false) +remove("added") + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ AM 0 0 added$', "stdout"), 0, false, false) + +-- renamed but not moved and thus unknown source and missing target + +check(mtn("revert", "."), 0, false, false) + +remove("renamed") +check(mtn("rename", "original", "renamed"), 0, false, false) + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(qgrep('^R U 1 0 original$', "stdout")) +check(qgrep('^ RM 0 1 renamed$', "stdout")) + +-- moved but not renamed and thus missing source and unknown target + +check(mtn("revert", "."), 0, false, false) + +rename("original", "renamed") + +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) +check(grep('^ M 0 0 original$', "stdout"), 0, false, false) +check(grep('^ U 0 0 renamed$', "stdout"), 0, false, false) + +-- renamed and patched + +check(mtn("revert", "."), 0, false, false) + +writefile("renamed", "renamed and patched") +remove("original") + +check(mtn("rename", "original", "renamed"), 0, false, false) +check(mtn("automate", "inventory", "--rcfile=inventory_hooks.lua"), 0, true, false) + +check(grep('^R 1 0 original$', "stdout"), 0, false, false) +check(grep('^ RP 0 1 renamed$', "stdout"), 0, false, false) + +-- need tests for deleted and renamed directories, once these actually work! ============================================================ --- tests/workspace_inventory/inventory_hooks.lua a16591bdd459974f0186eb84ce3050c932a0f885 +++ tests/workspace_inventory/inventory_hooks.lua a16591bdd459974f0186eb84ce3050c932a0f885 @@ -0,0 +1,4 @@ +function ignore_file(name) +if (string.find(name, "%~$")) then return true end +return false +end ============================================================ --- testsuite.at 106a1b130cc6ac73d67e440f774b6ef75544f2b2 +++ testsuite.at e5b152248b57e3ac8d832332768b78b3ab506e7e @@ -608,31 +608,6 @@ # include all the sub-tests we're going to use -m4_include(tests/t_update_off_branch.at) -m4_include(tests/t_setup_checkout_modify_new_dir.at) -m4_include(tests/t_rename_dir_add_dir_with_old_name.at) -m4_include(tests/t_rcs_import.at) -m4_include(tests/t_cvsimport2.at) -m4_include(tests/t_lf_crlf.at) -m4_include(tests/t_add_vs_commit.at) -m4_include(tests/t_update_nonexistent.at) -m4_include(tests/t_override_author_date.at) -m4_include(tests/t_add_stomp_file.at) -m4_include(tests/t_database_check_minor.at) -m4_include(tests/t_db_kill_rev_locally.at) -m4_include(tests/t_drop_attr.at) -m4_include(tests/t_attr_drop.at) -m4_include(tests/t_log_depth_single.at) -m4_include(tests/t_attr_init.at) -m4_include(tests/t_add_executable.at) -m4_include(tests/t_inodeprints_hook.at) -m4_include(tests/t_bad_packets.at) -m4_include(tests/t_multiple_heads_msg.at) -m4_include(tests/t_diff_currev.at) -m4_include(tests/t_normalized_filenames.at) -m4_include(tests/t_automate_inventory.at) -m4_include(tests/t_rename_file_to_dir.at) -m4_include(tests/t_replace_file_with_dir.at) m4_include(tests/t_replace_dir_with_file.at) m4_include(tests/t_parents_children.at) m4_include(tests/t_automate_graph.at) ============================================================ --- testsuite.lua b83ad5558b02646a6fc3ade53cc0ebd7e4caaf8e +++ testsuite.lua 290429519a074746762528fb37c5ffed326fe873 @@ -511,3 +511,28 @@ table.insert(tests, "tests/sticky_branches") table.insert(tests, "tests/checkout_without_--branch_sets_branch") table.insert(tests, "tests/netsync_largish_file") +table.insert(tests, "tests/update_to_off-branch_rev") +table.insert(tests, "tests/setup_checkout_touch_new__MTN_options_only") +table.insert(tests, "tests/renaming_a_directory_and_then_adding_a_new_with_the_old_name") +table.insert(tests, "tests/test_problematic_cvs_import") +table.insert(tests, "tests/cvs_import_with_file_added_on_a_branch") +table.insert(tests, "tests/use_get_linesep_conv_hook") +table.insert(tests, "tests/add_workspace_commit_in_another") +table.insert(tests, "tests/update_to_non-existent_rev") +table.insert(tests, "tests/--author,_--date") +table.insert(tests, "tests/update_does_not_stomp_non-monotone_files") +table.insert(tests, "tests/db_check_and_non-serious_errors") +table.insert(tests, "tests/db_kill_rev_locally_command") +table.insert(tests, "tests/drop_removes_attributes") +table.insert(tests, "tests/attr_drop") +table.insert(tests, "tests/log_--last=N_FILENAME") +table.insert(tests, "tests/attr_init_functions") +table.insert(tests, "tests/add_executable") +table.insert(tests, "tests/use_inodeprints_hook") +table.insert(tests, "tests/bad_packet_args") +table.insert(tests, "tests/commit_update_multiple_heads_message") +table.insert(tests, "tests/diffing_with_explicit_rev_same_as_wc_rev") +table.insert(tests, "tests/normalized_filenames") +table.insert(tests, "tests/workspace_inventory") +table.insert(tests, "tests/rename_file_to_dir") +table.insert(tests, "tests/replace_file_with_dir")