# # # patch "rcs_import.cc" # from [f13578a5143788f857b57fa5f88e1914f03bc1df] # to [f722349fdc06db5ebf90e6128fe363ff6c83c065] # ============================================================ --- rcs_import.cc f13578a5143788f857b57fa5f88e1914f03bc1df +++ rcs_import.cc f722349fdc06db5ebf90e6128fe363ff6c83c065 @@ -1978,70 +1978,78 @@ cluster_consumer::consume_blob(cvs_blob } } - if (dep_branches.size() > 0) - { - set< shared_ptr< cvs_event_branch > >::const_iterator i; + if (dep_branches.size() > 0) + { + set< shared_ptr< cvs_event_branch > >::const_iterator i; - // this is only for debug information - L(FL("This blob depends on the following branches:")); - for (i = dep_branches.begin(); i != dep_branches.end(); ++i) - { - L(FL(" branch %s") % cvs.branchname_interner.lookup((*i)->branchname)); - } + // this is only for debug information + L(FL("This blob depends on the following branches:")); + for (i = dep_branches.begin(); i != dep_branches.end(); ++i) + { + L(FL(" branch %s") % cvs.branchname_interner.lookup((*i)->branchname)); + } - // eliminate direct parent branches - bool set_modified; - do + // eliminate direct parent branches + bool set_modified; + do + { + set_modified = false; + cvs_blob_index bi; + shared_ptr< cvs_event_branch > cbe; + for (i = dep_branches.begin(); i != dep_branches.end(); ++i) { - set_modified = false; - cvs_blob_index bi; - shared_ptr< cvs_event_branch > cbe; - for (i = dep_branches.begin(); i != dep_branches.end(); ++i) + cbe = *i; + + bi = cvs.get_blob_of( + boost::static_pointer_cast(cbe)); + while (cvs.blobs[bi].in_branch) { - cbe = *i; + L(FL(" checking branch %d: %s") % bi + % cvs.branchname_interner.lookup( + boost::static_pointer_cast( + *cvs.blobs[bi].begin())->branchname)); - bi = cvs.get_blob_of(boost::static_pointer_cast(cbe)); - while (cvs.blobs[bi].in_branch) + if (dep_branches.find(cvs.blobs[bi].in_branch) != + dep_branches.end()) { - L(FL(" checking branch %d: %s") % bi % cvs.branchname_interner.lookup(boost::static_pointer_cast(*cvs.blobs[bi].begin())->branchname)); + // remove that branch, since it's a parent of another + // branch this blob depends on. + dep_branches.erase(cvs.blobs[bi].in_branch); + set_modified = true; + } - if (dep_branches.find(cvs.blobs[bi].in_branch) != - dep_branches.end()) - { - // remove that branch, since it's a parent of another - // branch this blob depends on. - dep_branches.erase(cvs.blobs[bi].in_branch); - set_modified = true; - } + // continue to remove grand-parents + cvs_blob_index new_bi = cvs.get_blob_of( + boost::static_pointer_cast( + cvs.blobs[bi].in_branch)); - // continue to remove grand-parents - cvs_blob_index new_bi = cvs.get_blob_of(boost::static_pointer_cast( - cvs.blobs[bi].in_branch)); + I((bi != new_bi)); + I((boost::static_pointer_cast( + *(cvs.blobs[bi].begin()))->branchname != + boost::static_pointer_cast( + *(cvs.blobs[new_bi].begin()))->branchname)); - I((bi != new_bi)); - I((boost::static_pointer_cast(*(cvs.blobs[bi].begin()))->branchname != - boost::static_pointer_cast(*(cvs.blobs[new_bi].begin()))->branchname)); - - bi = new_bi; - } - - if (set_modified) - break; + bi = new_bi; } - } while (set_modified); + if (set_modified) + break; + } - // this is only for debug information - L(FL("After elimination of parent branches, this blob depends on:")); - for (i = dep_branches.begin(); i != dep_branches.end(); ++i) - { - L(FL(" branch %s") % cvs.branchname_interner.lookup((*i)->branchname)); - } + } while (set_modified); - I(dep_branches.size() <= 1); - blob.in_branch = *dep_branches.begin(); + // this is only for debug information + L(FL("After elimination of parent branches, this blob depends on:")); + for (i = dep_branches.begin(); i != dep_branches.end(); ++i) + { + L(FL(" branch %s") % cvs.branchname_interner.lookup( + (*i)->branchname)); } + I(dep_branches.size() <= 1); + blob.in_branch = *dep_branches.begin(); + } + if (blob.get_digest().is_commit()) { // we should never have an empty blob; it's *possible* to have