--- change_set.cc +++ change_set.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -766,7 +767,7 @@ std::vector vec; std::vector rebuilt; - // L(F("reconstructing path '%s' under analysis\n") % input); + L(F("reconstructing path '%s' under analysis\n") % input); fs::path tmp = mkpath(input()); std::copy(tmp.begin(), tmp.end(), std::inserter(vec, vec.begin())); @@ -792,7 +793,7 @@ I(i != output_space.end()); if (null_name(path_item_name(path_state_item(i)))) { - // L(F("input path element '%s' is null in output space, mapping truncated\n") % *pth); + L(F("input path element '%s' is null in output space, mapping truncated\n") % *pth); break; } } @@ -1141,6 +1142,25 @@ delta_entry_dst(del)))); } + { + L(F("concatenated changeset after a's renamed under b: .................\n")); + std::ostringstream os; + basic_io::printer pr(os); + print_change_set(pr, concatenated); + L(F("\n%s\n") % os.str()); + L(F("...................................................................\n")); + } + + { + L(F("b changeset (to fuse) is now: .....................................\n")); + std::ostringstream os; + basic_io::printer pr(os); + print_change_set(pr, b); + L(F("\n%s\n") % os.str()); + L(F("...................................................................\n")); + } + + // next fuse any deltas id1->id2 and id2->id3 to id1->id3 for (change_set::delta_map::const_iterator del = b.deltas.begin(); del != b.deltas.end(); ++del) @@ -1149,17 +1169,31 @@ concatenated.deltas.find(delta_entry_path(del)); if (existing != concatenated.deltas.end()) { + L(F("del = %s -> %s\n") % delta_entry_src(del) % delta_entry_dst(del)); + L(F("delta_entry_path(del) = %s\n") % delta_entry_path(del)); + L(F("concatenated.deltas.find(delta_entry_path(del)) = %s -> %s\n") % + delta_entry_src(existing) % delta_entry_dst(existing)); + std::set::const_iterator badded = + b.rearrangement.added_files.find(delta_entry_path(del)); + if (badded != b.rearrangement.added_files.end()) { + L(F("b.rearrangement.added_files.find(delta_entry_path(del)) = %s\n") % *badded); + } + L(F("fusing deltas on %s : %s -> %s and %s -> %s\n") % delta_entry_path(del) % delta_entry_src(existing) % delta_entry_dst(existing) % delta_entry_src(del) % delta_entry_dst(del)); - I(delta_entry_dst(existing) == delta_entry_src(del)); - std::pair fused = std::make_pair(delta_entry_src(existing), - delta_entry_dst(del)); - concatenated.deltas.erase(delta_entry_path(del)); - concatenated.deltas.insert(std::make_pair(delta_entry_path(del), fused)); + + if (b.rearrangement.added_files.find(delta_entry_path(del)) == + b.rearrangement.added_files.end()) + I(delta_entry_dst(existing) == delta_entry_src(del)); + + std::pair fused = std::make_pair(delta_entry_src(existing), + delta_entry_dst(del)); + concatenated.deltas.erase(delta_entry_path(del)); + concatenated.deltas.insert(std::make_pair(delta_entry_path(del), fused)); } else { @@ -1169,9 +1203,19 @@ } } + L(F("about to call normalize_change_set(concatenated)\n")); normalize_change_set(concatenated); L(F("finished concatenation\n")); + { + L(F("concatenated changeset after finished concatenation: ..............\n")); + std::ostringstream os; + basic_io::printer pr(os); + print_change_set(pr, concatenated); + L(F("\n%s\n") % os.str()); + L(F("...................................................................\n\n\n\n")); + } + L(F("finished concatenation\n")); } // end stuff related to concatenation