# # # patch "ChangeLog" # from [3fb00791e847e02f14ae3dfdea9210406174ccde] # to [5c3691b05b484000a51e4b58845d070555eba25a] # # patch "rcs_import.cc" # from [1635c1a1cb1ef358f2ea774ae5c956de9cea5770] # to [e9c6eb75a9e8080fd1ad5c48f940941115bfee14] # ============================================================ --- ChangeLog 3fb00791e847e02f14ae3dfdea9210406174ccde +++ ChangeLog 5c3691b05b484000a51e4b58845d070555eba25a @@ -1,5 +1,10 @@ 2006-04-06 Markus Schiltknecht + * rcs_import.cc: Added the real branch time detection logic + and fixed some bugs in the previous commit. + +2006-04-06 Markus Schiltknecht + * rcs_import.cc: Improved branch time detection and some debug messages. ============================================================ --- rcs_import.cc 1635c1a1cb1ef358f2ea774ae5c956de9cea5770 +++ rcs_import.cc e9c6eb75a9e8080fd1ad5c48f940941115bfee14 @@ -601,7 +601,6 @@ cvs_history & cvs) { string curr_version = begin_version; - string prev_version; scoped_ptr< vector< piece > > next_lines(new vector); scoped_ptr< vector< piece > > curr_lines(new vector (begin_lines.begin(), @@ -662,9 +661,9 @@ // mark the ending-of-branch time of this file if we're just past a // branchpoint - range = cvs.branchpoints.equal_range(prev_version); + range = cvs.branchpoints.equal_range(next_version); if (range.first != cvs.branchpoints.end() - && range.first->first == prev_version) + && range.first->first == next_version) { for (ity i = range.first; i != range.second; i++) { @@ -714,7 +713,6 @@ // advance curr_data = next_data; curr_id = next_id; - prev_version = curr_version; curr_version = next_version; swap(next_lines, curr_lines); next_lines->clear(); @@ -1359,8 +1357,44 @@ I(cvs.stk.size() == 1); - //TODO here: check branch times + //check branch times + for(map >::const_iterator i = cvs.branches.begin(); + i != cvs.branches.end(); ++i) + { + string branchname = i->first; + shared_ptr branch = i->second; + L(FL("checking branch time of branch %s\n") % branchname); + + time_t branched_before = 0; + if (branch->has_a_commit) + branched_before = branch->first_commit; + + if (branch->first_commit_after_branching > 0) + if ((branch->first_commit_after_branching < branched_before) + || (branched_before == 0)) + { + branched_before = branch->first_commit_after_branching; + } + + if (branch->last_branchpoint < branched_before) + { + branch->branch_time = branch->last_branchpoint + + ((branched_before - branch->last_branchpoint) / 2); + L(FL("guessing branchpoint time for branch %s: %d") + % branchname + % branch->branch_time); + } + else + { + L(FL("unable to find a branchpoint time for branch %s") % branchname); + L(FL("last branchpoint: %d)") % branch->last_branchpoint); + L(FL("first commit in branch: %d)") % branch->first_commit); + L(FL("first commit after branching: %d)") % branch->first_commit_after_branching); + } + } + + ticker n_revs(_("revisions"), "r", 1); // first, sort the lineages of the trunk and all branches