# # # patch "ChangeLog" # from [dc1b51ef14de6d7aeddaf154b013e7329683378a] # to [c6b4b456b4baf38ffa9f2c83605fac9a67e94e74] # # patch "cmd_merging.cc" # from [54d9117904f8fe301f1f74b747410b664fc7475c] # to [1ddeea2f8c738677ecb9a3e256e215b1822416be] # # patch "roster.hh" # from [df9734188140268cc35c9476f1cd65630d60de3a] # to [5eaa63b6505d4dbaa4814ab1316e1148e224c45a] # # patch "tests/pluck_lifecycle/__driver__.lua" # from [fddb5a14e2762127c618fed0d12eb2aa2dc88c4b] # to [f5be8a837d2e51ec5fad7bf2abdbf105965b749a] # ============================================================ --- ChangeLog dc1b51ef14de6d7aeddaf154b013e7329683378a +++ ChangeLog c6b4b456b4baf38ffa9f2c83605fac9a67e94e74 @@ -1,3 +1,9 @@ +2006-07-09 Nathaniel Smith + + * cmd_merging.cc (pluck): Restructure to handle nids correctly. + * tests/pluck_lifecycle/__driver__.lua: Fix and un-xfail. + * roster.hh (make_roster_for_base_plus_cset): Fix typo. + 2006-07-08 Nathaniel Smith * roster.cc (mark_roster_with_no_parents) ============================================================ --- cmd_merging.cc 54d9117904f8fe301f1f74b747410b664fc7475c +++ cmd_merging.cc 1ddeea2f8c738677ecb9a3e256e215b1822416be @@ -673,63 +673,62 @@ // - merged is the result of the plucking, and achieved by running a // merge in the fictional graph seen above // + // To perform the merge, we use the real from roster, and the real working + // roster, but synthesize a temporary 'to' roster. This ensures that the + // 'from', 'working' and 'base' rosters all use the same nid namespace, + // while any additions that happened between 'from' and 'to' should be + // considered as new nodes, even if the file that was added is in fact in + // 'working' already -- so 'to' needs its own namespace. (Among other + // things, it is impossible with our merge formalism to have the above + // graph with a node that exists in 'to' and 'working', but not 'from'.) + // // finally, we take the cset from working -> merged, and apply that to the // workspace // and take the cset from the workspace's base, and write that to _MTN/work + // The node id source we'll use for the 'working' and 'to' rosters. + temp_node_id_source nis; + // Get the FROM roster and markings shared_ptr from_roster = shared_ptr(new roster_t()); MM(*from_roster); - marking_map from_markings; - app.db.get_roster(from_rid, *from_roster, from_markings); + app.db.get_roster(from_rid, *from_roster); - // Get the FROM->WORKING and FROM->TO csets, and also the base roster - // and working rid while we're at it - cset from_to_working, from_to_to; - MM(from_to_working); - MM(from_to_to); + // Get the WORKING roster, and also the base roster while we're at it + roster_t working_roster; MM(working_roster); roster_t base_roster; MM(base_roster); - revision_id working_rid; + get_base_and_current_roster_shape(base_roster, working_roster, + nis, app); + update_current_roster_from_filesystem(working_roster, app); + + // Get the FROM->TO cset + cset from_to_to; MM(from_to_to); { - // Get the workspace stuff - temp_node_id_source nis; - revision_id working_rid; - roster_t working_true_roster; - get_base_and_current_roster_shape(base_roster, working_true_roster, - nis, app); - update_current_roster_from_filesystem(working_true_roster, app); - make_cset(*from_roster, working_true_roster, from_to_working); - revision_id base_rid; - get_revision_id(base_rid); - revision_set working_rev; - make_revision_set(base_rid, base_roster, working_true_roster, working_rev); - calculate_ident(working_rev, working_rid); - } - { - // Get the TO roster roster_t to_true_roster; app.db.get_roster(to_rid, to_true_roster); make_cset(*from_roster, to_true_roster, from_to_to); } - // Recreate the working and to rosters with renumbered nids and fake - // markings. We have to go roster->cset->roster because our marking code - // works on csets, and we need our final roster and final markings to use - // compatible nids. - temp_node_id_source nis; - roster_t working_roster, to_roster; - MM(working_roster); - MM(to_roster); - marking_map working_markings, to_markings; - make_roster_for_base_plus_cset(from_rid, from_to_working, - working_rid, - working_roster, working_markings, - nis, app); - make_roster_for_base_plus_cset(from_rid, from_to_to, - to_rid, - to_roster, to_markings, - nis, app); + // Use a fake rid + revision_id working_rid(std::string("0000000000000000000000000000000000000001")); + // Mark up the FROM roster + marking_map from_markings; MM(from_markings); + mark_roster_with_no_parents(from_rid, *from_roster, from_markings); + + // Mark up the WORKING roster + marking_map working_markings; MM(working_markings); + mark_roster_with_one_parent(*from_roster, from_markings, + working_rid, working_roster, + working_markings); + + // Create and mark up the TO roster + roster_t to_roster; MM(to_roster); + marking_map to_markings; MM(to_markings); + make_roster_for_base_plus_cset(from_rid, from_to_to, to_rid, + to_roster, to_markings, nis, + app); + // Set up the synthetic graph, by creating uncommon ancestor sets std::set working_uncommon_ancestors, to_uncommon_ancestors; safe_insert(working_uncommon_ancestors, working_rid); ============================================================ --- roster.hh df9734188140268cc35c9476f1cd65630d60de3a +++ roster.hh 5eaa63b6505d4dbaa4814ab1316e1148e224c45a @@ -380,7 +380,7 @@ make_roster_for_base_plus_cset(revision_id const & base, cset const & cs, revision_id const & new_rid, - roster_t & new_rister, + roster_t & new_roster, marking_map & new_markings, node_id_source & nis, app_state & app); ============================================================ --- tests/pluck_lifecycle/__driver__.lua fddb5a14e2762127c618fed0d12eb2aa2dc88c4b +++ tests/pluck_lifecycle/__driver__.lua f5be8a837d2e51ec5fad7bf2abdbf105965b749a @@ -51,7 +51,7 @@ check(readfile("b") == "updated\n", 0, false, false) -- check the pending rev; we don't expect to see changes from two_rev -check(mtn("status"), 0, true, false) -xfail_if(true, grep("delete", "stdout")) -xfail_if(true, grep("add_file", "stdout")) +check(mtn("automate", "get_revision"), 0, true, false) +check(not qgrep("delete", "stdout")) +check(not qgrep("add_file", "stdout"))