# # patch "annotate.cc" # from [613ae82123687d6e26b088c8f769d4efe9abd3fa] # to [db9f3b6f48220a312ab403aadd6b7c45cc624b66] # # patch "tests/t_annotate_renames.at" # from [d4e5bae99ae78d94c788825c3507a0f9cfb5de32] # to [d87797cbda3513789cc18f756eb61ff8b79eb1c5] # ======================================================================== --- annotate.cc 613ae82123687d6e26b088c8f769d4efe9abd3fa +++ annotate.cc db9f3b6f48220a312ab403aadd6b7c45cc624b66 @@ -534,19 +534,21 @@ added_in_parent_count++; continue; } - - file_path parent_fpath = apply_change_set_inverse(cs, work_unit.node_fpath); - L(F("file %s in parent revision %s is %s\n") % work_unit.node_fpath % parent_revision % parent_fpath); + + // even if the file was renamed in the parent, that's represented as 'rename oldname -> newname' + // plus 'patch newname -> newname', so we don't have to find the oldname in the parent before + // checking the delta + I(!work_unit.node_fpath.empty()); - I(!parent_fpath.empty()); - - change_set::delta_map::const_iterator fdelta_iter = cs.deltas.find(parent_fpath); + change_set::delta_map::const_iterator fdelta_iter = cs.deltas.find(work_unit.node_fpath); file_id parent_fid = work_unit.node_fid; boost::shared_ptr parent_lineage; if (fdelta_iter != cs.deltas.end()) // then the file changed { + L(F("delta_entry_dst(fdelta_iter) = %s, work_unit.node_fid = %s\n") + % delta_entry_dst(fdelta_iter) % work_unit.node_fid); I(delta_entry_dst(fdelta_iter) == work_unit.node_fid); parent_fid = delta_entry_src(fdelta_iter); file_data data; @@ -568,17 +570,20 @@ std::map::iterator lmn = pending_merge_nodes.find(parent_revision); if (lmn == pending_merge_nodes.end()) { - annotate_node_work newunit(work_unit.annotations, parent_lineage, parent_revision, parent_fid, parent_fpath); + // once we move on to processing the parent that this file was renamed from, we'll need the old name + file_path parent_fpath_orig = apply_change_set_inverse(cs, work_unit.node_fpath); + annotate_node_work newunit(work_unit.annotations, parent_lineage, parent_revision, parent_fid, parent_fpath_orig); std::map::const_iterator ptn = paths_to_nodes.find(parent_revision); if (ptn->second > 1) { lineage_merge_node nmn(newunit, ptn->second); pending_merge_nodes.insert(std::make_pair(parent_revision, nmn)); + L(F("put new merge node on pending_merge_nodes for parent %s\n") % parent_revision); // just checking... //(pending_merge_nodes.find(parent_revision))->second.dump(); } else { - //L(F("single path to node, just stick work on the queue\n")); + L(F("single path to node, just stick work on the queue for parent %s\n") % parent_revision); nodes_to_process.push_back(newunit); } } ======================================================================== --- tests/t_annotate_renames.at d4e5bae99ae78d94c788825c3507a0f9cfb5de32 +++ tests/t_annotate_renames.at d87797cbda3513789cc18f756eb61ff8b79eb1c5 @@ -1,9 +1,6 @@ AT_SETUP([annotate file whose name changed]) MONOTONE_SETUP -# This test is a bug report -AT_XFAIL_IF(true) - ADD_FILE(foo, [a b c @@ -14,11 +11,6 @@ x ]) -AT_DATA(foo.merged, [aa -b -x -]) - COMMIT(testbranch) REV0=`BASE_REVISION` @@ -43,13 +35,13 @@ # # annotate foo should now be -# REV1: aa +# REV0: a # REV0: b # REVR: x # AT_CHECK(MONOTONE annotate foo.new, [], [stdout], [ignore]) -AT_CHECK(head -n 1 stdout | grep $REV1, [0], [ignore], [ignore]) +AT_CHECK(head -n 1 stdout | grep $REV0, [0], [ignore], [ignore]) AT_CHECK(head -n 2 stdout | TAIL(1) | grep $REV0, [0], [ignore], [ignore]) AT_CHECK(head -n 3 stdout | TAIL(1) | grep $REVR, [0], [ignore], [ignore])