| 1648 | } |
| 1649 | |
| 1650 | static void compute_reachable_generation_numbers( |
| 1651 | struct compute_generation_info *info, |
| 1652 | int generation_version) |
| 1653 | { |
| 1654 | int i; |
| 1655 | struct commit_list *list = NULL; |
| 1656 | |
| 1657 | for (i = 0; i < info->commits->nr; i++) { |
| 1658 | struct commit *c = info->commits->items[i]; |
| 1659 | timestamp_t gen; |
| 1660 | repo_parse_commit(info->r, c); |
| 1661 | gen = info->get_generation(c, info->data); |
| 1662 | display_progress(info->progress, ++info->progress_cnt); |
| 1663 | |
| 1664 | if (gen != GENERATION_NUMBER_ZERO && gen != GENERATION_NUMBER_INFINITY) |
| 1665 | continue; |
| 1666 | |
| 1667 | commit_list_insert(c, &list); |
| 1668 | while (list) { |
| 1669 | struct commit *current = list->item; |
| 1670 | struct commit_list *parent; |
| 1671 | int all_parents_computed = 1; |
| 1672 | timestamp_t max_gen = 0; |
| 1673 | |
| 1674 | for (parent = current->parents; parent; parent = parent->next) { |
| 1675 | repo_parse_commit(info->r, parent->item); |
| 1676 | gen = info->get_generation(parent->item, info->data); |
| 1677 | |
| 1678 | if (gen == GENERATION_NUMBER_ZERO) { |
| 1679 | all_parents_computed = 0; |
| 1680 | commit_list_insert(parent->item, &list); |
| 1681 | break; |
| 1682 | } |
| 1683 | |
| 1684 | if (gen > max_gen) |
| 1685 | max_gen = gen; |
| 1686 | } |
| 1687 | |
| 1688 | if (all_parents_computed) { |
| 1689 | pop_commit(&list); |
| 1690 | gen = compute_generation_from_max( |
| 1691 | current, max_gen, |
| 1692 | generation_version); |
| 1693 | info->set_generation(current, gen, info->data); |
| 1694 | } |
| 1695 | } |
| 1696 | } |
| 1697 | } |
| 1698 | |
| 1699 | static timestamp_t get_topo_level(struct commit *c, void *data) |
| 1700 | { |
no test coverage detected