mod merge_order

module merge_order

Order open pull requests so a shared module is built once.

  1. Edge A -> B when a module in B’s to_build is an easystack entry A adds (A asks for it by name; B only reaches it), or when a depends-on row names A as from and B as to. An easyconfigs record has no easystack entries, so its edges are those rows: a pull request that adds a module, or one that patches a module another pull request builds a dependent of. Edges both ways form a cycle.

  2. Among pull requests with no remaining incoming edge, pick the one whose residual build set is smallest, then the lowest pull request number.

  3. After picking, add its residual builds to the installed set and recompute residuals for the rest. saves is that difference.

  4. A strongly connected component is reported in cycles. Edges inside it are dropped, and rule 2 orders its pull requests with every other pull request that has no remaining incoming edge.

Variables

const MERGE_IMPACT_SCHEMA_VERSION: u32

Schema of MergeImpactReport.

const MERGE_ORDER_SCHEMA_VERSION: u32

Schema of MergeOrder.

Functions

fn conflicts_from_records(records: &[PrRecord]) -> Vec<EasystackConflict>

Same collisions, read from the text stored on each record.

fn easystack_conflicts(prs: &[PrInput]) -> Vec<EasystackConflict>

Collisions on one easystack. The insertion point is the 0-based index of the base line before the first added line, or -1 when the addition starts at the top of the file. Identical added lines are same-entry.

fn entry_module(file: &str) -> Option<String>

Lib-1.0-GCCcore-15.2.0.eb asks for Lib/1.0-GCCcore-15.2.0.

fn impact(records: &[PrRecord], index: &OverlapIndex, pr: u64, merged: &[u64]) -> Option<MergeImpact>

Pull requests a merge of pr changes. None when pr is not a record.

merged pull requests are already installed. Their to_build is removed from both sides before the intersection, and they are omitted from affected. That is the same installed set plan uses.

A depends-on row whose to is this pull request names modules the other pull request builds. Closing over that head puts them in to_build here, but merging this pull request does not install them, so they are not a shrink of the provider.

fn impact_report(records: &[PrRecord], index: &OverlapIndex, numbers: &[u64], generated_at: &str, merged: &[u64]) -> Result<MergeImpactReport, u64>

One report for every requested pull request, in ascending number order.

The first unknown number is Err.

fn plan(records: &[PrRecord], index: &OverlapIndex, merged: &[u64]) -> MergeOrder

Order records. merged pull requests are already installed: their to_build modules seed the residual, and they are not steps. index supplies the timestamp and the installed-list label.

fn render_section(order: &MergeOrder, repo_url: &str) -> String

Markdown table appended to overlap.md when --merge-order is set.

fn unknown_merged(inputs: &[u64], merged: &[u64]) -> Option<u64>

The first --merged number that is not one of inputs, if any.

Structs and Unions

struct ArchImpact

What merging the named pull requests does on one architecture.

arch: String
impacts: Vec<MergeImpact>
struct ArchMerge

Merge order for one architecture.

arch: String
steps: Vec<MergeStep>
cycles: Vec<Vec<u64>>
struct EasystackConflict

Easystack edits that collide. kind is same-insertion or same-entry.

easystack: String
prs: Vec<u64>
kind: String
struct MergeEffect

Another pull request whose build set or depends-on edge changes.

pr: u64
shrinks: Vec<String>

Modules that leave the other pull request’s to_build.

resolves: Vec<String>

Modules of a depends-on edge from the merged pull request to this one.

The edge is the same one plan draws: an easystack entry the provider asks for, or a depends-on row from the provider.

struct MergeImpact

One pull request judged on its own.

pr: u64
affected: Vec<MergeEffect>
struct MergeImpactReport

What merging one pull request does to the others, on its own.

This is not the residual after earlier steps of plan. It treats this pull request’s to_build as newly installed, after removing every module a --merged pull request already builds. Those pull requests are not listed in affected.

schema_version: u32
generated_at: String
impacts: Vec<MergeImpact>
arches: Vec<ArchImpact>

Per-architecture impacts. Empty when the run used one installed list, in which case impacts is that list.

struct MergeOrder

One merge order. merged and conflicts stay empty until those flags run.

schema_version: u32
generated_at: String
installed_source: String
merged: Vec<u64>
steps: Vec<MergeStep>
cycles: Vec<Vec<u64>>
conflicts: Vec<EasystackConflict>
arches: Vec<ArchMerge>

Per-architecture orders. Empty when the run used one installed list, in which case steps is that list’s order.

struct MergeStep

One pull request after every earlier step has merged.

position: usize

1-based.

pr: u64
after: Vec<u64>

Direct predecessors in the binding graph, ascending.

builds: Vec<String>

Residual to_build, sorted.

saves: Vec<Saved>
reason: String
struct Saved

Modules one later pull request no longer builds.

pr: u64
modules: Vec<String>