# # # add_dir "tests/two_parent_workspace_commands_that_fail" # # add_dir "tests/two_parent_workspace_pluck" # # add_file "tests/two_parent_workspace_commands_that_fail/__driver__.lua" # content [a1b540beddc4f9c24881c22e9fd26f9f6e88a706] # # add_file "tests/two_parent_workspace_pluck/__driver__.lua" # content [1e1602a94d6554e34fe774ad65044d25843c2d97] # # patch "ChangeLog" # from [7ba2a1d1b4619b2fffbe6c16472a4a5bada912de] # to [35e146a9c36218f8f55750f957fb14bc489cccbf] # # patch "cmd_merging.cc" # from [7a29c3e480f80cd4dd4ee83c3888069aa4331b77] # to [3199f210b63b2f88248d416f45fad9cb7494229b] # # patch "testsuite.lua" # from [ac59c2a75d6ff5cbda9c6c43f3ecd47c52e189bb] # to [6f6eddbbe8b4d18f0cc5018e16b85aeef5a83627] # ============================================================ --- tests/two_parent_workspace_commands_that_fail/__driver__.lua a1b540beddc4f9c24881c22e9fd26f9f6e88a706 +++ tests/two_parent_workspace_commands_that_fail/__driver__.lua a1b540beddc4f9c24881c22e9fd26f9f6e88a706 @@ -0,0 +1,35 @@ +-- Create a simple two-parent workspace and then run a bunch of +-- commands all of which should give errors (but not I()s). +-- see http://venge.net/monotone/wiki/MultiParentWorkspaceFallout +-- for rationales for failures + +mtn_setup() + +addfile("testfile", "ancestor\nancestor") +commit() +anc = base_revision() + +writefile("testfile", "left\nancestor") +commit() +left = base_revision() + +revert_to(anc) +writefile("testfile", "ancestor\nright") +commit() +right = base_revision() + +check(mtn("merge_into_workspace", left), 0, false, false) +check(qgrep("left", "testfile")) +check(qgrep("right", "testfile")) +check(not qgrep("ancestor", "testfile")) + +diag = "mtn: misuse: this command can only be used in a single-parent workspace\n" + +check(mtn("merge_into_workspace", anc), 1, nil, diag) + +xfail(mtn("diff"), 1, nil, diag) +xfail(mtn("revert"), 1, nil, diag) +xfail(mtn("update"), 1, nil, diag) + +xfail(mtn("automate", "get_base_revision_id"), 1, nil, diag) +xfail(mtn("automate", "inventory"), 1, nil, diag) ============================================================ --- tests/two_parent_workspace_pluck/__driver__.lua 1e1602a94d6554e34fe774ad65044d25843c2d97 +++ tests/two_parent_workspace_pluck/__driver__.lua 1e1602a94d6554e34fe774ad65044d25843c2d97 @@ -0,0 +1,29 @@ +mtn_setup() + +addfile("testfile", "ancestor\nancestor") +addfile("pluckfile", "quack quack") +commit() +anc = base_revision() + +writefile("pluckfile", "brawwk brawwk") +commit() +pluckrev = base_revision() + +revert_to(anc) +writefile("testfile", "left\nancestor") +commit() +left = base_revision() + +revert_to(anc) +writefile("testfile", "ancestor\nright") +commit() +right = base_revision() + +check(mtn("merge_into_workspace", left), 0, false, false) +check(qgrep("left", "testfile")) +check(qgrep("right", "testfile")) +check(not qgrep("ancestor", "testfile")) +check(qgrep("quack quack", "pluckfile")) + +xfail(mtn("pluck", "-r", pluckrev), 0, false, false) +xfail(qgrep("brawwk brawwk", "pluckfile")) ============================================================ --- ChangeLog 7ba2a1d1b4619b2fffbe6c16472a4a5bada912de +++ ChangeLog 35e146a9c36218f8f55750f957fb14bc489cccbf @@ -1,3 +1,10 @@ +2007-02-07 Zack Weinberg + + * tests/two_parent_workspace_commands_that_fail + * tests/two_parent_workspace_pluck: New tests (expected to fail). + * testsuite.lua: Add them. + * cmd_merging.cc (merge_into_workspace): Standardize a diagnostic. + 2006-09-25 Zack Weinberg * work.cc (workspace::get_work_rev): Fold into sole caller, @@ -214,7 +221,7 @@ 2007-01-29 Thomas Keller - * added some lua hooks to run a script after revs or certs have + * added some lua hooks to run a script after revs or certs have arrived via netsync for a particular branch 2007-01-29 Matthew Gregan ============================================================ --- cmd_merging.cc 7a29c3e480f80cd4dd4ee83c3888069aa4331b77 +++ cmd_merging.cc 3199f210b63b2f88248d416f45fad9cb7494229b @@ -609,14 +609,12 @@ CMD(merge_into_workspace, N_("tree"), // Get the current state of the workspace. // This command cannot be applied to a workspace with more than one parent - // (revs can have no more than two parents) but we use the multiparent-safe - // interface anyway so we can give an N() instead of an invariant failure. - // (Also, it gives us the cached_roster we want with no special handling.) + // (revs can have no more than two parents). { parent_map parents; app.work.get_parent_rosters(parents); N(parents.size() == 1, - F("'%s' can only be used in a single-parent workspace") % name); + F("this command can only be used in a single-parent workspace")); temp_node_id_source nis; roster_t working_roster; ============================================================ --- testsuite.lua ac59c2a75d6ff5cbda9c6c43f3ecd47c52e189bb +++ testsuite.lua 6f6eddbbe8b4d18f0cc5018e16b85aeef5a83627 @@ -707,3 +707,5 @@ table.insert(tests, "merge_into_workspac table.insert(tests, "merge_into_workspace_no_changes") table.insert(tests, "merge_into_workspace_files_added") table.insert(tests, "merge_into_workspace_attr_corpse") +table.insert(tests, "two_parent_workspace_commands_that_fail") +table.insert(tests, "two_parent_workspace_pluck")