# # # patch "cmd_merging.cc" # from [7a441305bb48f878eee5d5febaad2e99d781b212] # to [6f7293c9f832b0a5ac5aa91e21164df2787381c3] # # patch "roster.cc" # from [a67920123605b12886b28cbd4c097f60a38f7b43] # to [9989ba61bf9d98cdc3551daaa3666cd37a752695] # # patch "roster.hh" # from [897cd92c82cf0a4a9506428bafe3ca94f959e747] # to [e752044dc5fb4183c3118daa8c8da40ef86ee3c7] # # patch "work.cc" # from [a01164a4e32079091f126c5018a187cea96e0dcd] # to [c63f3ae3c3e6f7f24ffd23e49e83f4283f788ceb] # # patch "work.hh" # from [cd117c8295b2bdf48db35e92aaf29842c27a1b7f] # to [4cfe384959018bee9efae3c232ad5e64615b8bb9] # ============================================================ --- cmd_merging.cc 7a441305bb48f878eee5d5febaad2e99d781b212 +++ cmd_merging.cc 6f7293c9f832b0a5ac5aa91e21164df2787381c3 @@ -239,8 +239,7 @@ CMD(update, "update", "", CMD_REF(worksp MM(working_markings); temp_node_id_source nis; - work.get_current_roster_shape(db, nis, *working_roster); - work.update_current_roster_from_filesystem(*working_roster); + work.get_current_roster(db, nis, working_rid, *working_roster, working_markings); roster_t chosen_roster; marking_map chosen_markings; @@ -259,17 +258,6 @@ CMD(update, "update", "", CMD_REF(worksp // local changes to the selected revision in the new branch. if (!switched_branch) { - // we apply the base to working cset to base_marking to obtain an up-to-date - // marking map, then merge working with chosen. - - // We need a working_rid to put in the marking map, and the caller - // probably needs it later use in conflict resolution. But it doesn't have - // to be real in any sense, because this particular revision will never be - // committed to the database, so make one up. - working_rid = revision_id("00000000000000000042"); - - make_working_markings(db, nis, base_rid, working_rid, *working_roster, working_markings); - // working is an immediate child of base, so working_uncommon_ancestors = // base_uncommon_ancestors + working. set chosen_uncommon_ancestors, working_uncommon_ancestors; ============================================================ --- roster.cc a67920123605b12886b28cbd4c097f60a38f7b43 +++ roster.cc 9989ba61bf9d98cdc3551daaa3666cd37a752695 @@ -2245,32 +2245,6 @@ make_roster_for_revision(database & db, } -void -make_working_markings(database & db, - temp_node_id_source & nis, - revision_id const base_rid, - revision_id const working_rid, - roster_t const & working_roster, - marking_map & working_markings) -{ - roster_t base_roster; - marking_map base_markings; - - db.get_roster(base_rid, base_roster, base_markings); - - cset base_to_work; - make_cset(base_roster, working_roster, base_to_work); - - // We need to apply the cset to base_markings to get working_markings; - // base_to_work.apply does that. It also recomputes temp_roster; could - // save time by not doing that. - roster_t temp_roster = base_roster; - working_markings = base_markings; - editable_roster_for_nonmerge editable_working_roster(temp_roster, nis, working_rid, working_markings); - base_to_work.apply_to(editable_working_roster); -} - - //////////////////////////////////////////////////////////////////// // Calculation of a cset //////////////////////////////////////////////////////////////////// ============================================================ --- roster.hh 897cd92c82cf0a4a9506428bafe3ca94f959e747 +++ roster.hh e752044dc5fb4183c3118daa8c8da40ef86ee3c7 @@ -407,17 +407,7 @@ make_roster_for_revision(database & db, roster_t & result, marking_map & marking); -// Compute working_markings by applying the changeset from base to working -// to base markings void -make_working_markings(database & db, - temp_node_id_source & nis, - revision_id const base_rid, - revision_id const working_rid, - roster_t const & working_roster, - marking_map & working_markings); - -void read_roster_and_marking(roster_data const & dat, roster_t & ros, marking_map & mm); ============================================================ --- work.cc a01164a4e32079091f126c5018a187cea96e0dcd +++ work.cc c63f3ae3c3e6f7f24ffd23e49e83f4283f788ceb @@ -295,6 +295,33 @@ workspace::get_current_roster_shape(data } } +void +workspace::get_current_roster(database & db, + node_id_source & nis, + revision_id & rid, + roster_t & ros, + marking_map & markings) +{ + revision_t rev; + + get_work_rev(rev); + + rid = revision_id(fake_id()); + + if (rev.edges.size() == 1 && null_id(edge_old_revision(rev.edges.begin()))) + { + // There is just one parent and it is the null ID, which + // make_roster_for_revision does not handle correctly. Not clear we + // need this case, so abort. + I(false); + } + else + { + make_roster_for_revision(db, nis, rev, rid, ros, markings); + update_current_roster_from_filesystem(ros); + } +} + bool workspace::has_changes(database & db) { ============================================================ --- work.hh cd117c8295b2bdf48db35e92aaf29842c27a1b7f +++ work.hh 4cfe384959018bee9efae3c232ad5e64615b8bb9 @@ -1,7 +1,7 @@ #ifndef __WORK_HH__ #define __WORK_HH__ -// Copyright (C) 2002 Graydon Hoare +// Copyright (C) 2002, 2008 Graydon Hoare // // This program is made available under the GNU GPL version 2.0 or // greater. See the accompanying file COPYING for details. @@ -131,7 +131,7 @@ public: void perform_deletions(database & db, std::set const & targets, - bool recursive, + bool recursive, bool bookkeep_only); void perform_rename(database & db, @@ -174,6 +174,13 @@ public: void get_current_roster_shape(database & db, node_id_source & nis, roster_t & ros); + // Return the current roster and marking map + void get_current_roster(database & db, + node_id_source & nis, + revision_id & new_rid, + roster_t & ros, + marking_map & mark_map); + // This returns a map whose keys are revision_ids and whose values are // rosters, there being one such pair for each parent of the current // revision. @@ -255,4 +262,4 @@ public: // vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s: #endif // __WORK_HH__ + -