Ask the planner what a pull request reaches; map a changed file onto modules in one place (hq ADR 0238)
touchedBy is now the only mapping of changed files onto modules — touched, added, and read by no build — and reachOfMerge the planner's whole answer with the dependency walk. The merge handler, the plan what-if, the merge gate's width and composition, and a pull request's check all ask it, so planning and gating cannot disagree. The gate composes the definitions of the modules a merge would rebuild or add, not every one in the tree, and the check says the dependents a merge would build after them.
This commit is contained in:
@@ -1357,18 +1357,20 @@ func planWhatIf(ctx context.Context, inv *inventory.Inventory, repository string
|
||||
for _, name := range modules {
|
||||
named[name] = true
|
||||
}
|
||||
for _, e := range entries {
|
||||
switch {
|
||||
case named[e.Manifest.Module]:
|
||||
from = append(from, e)
|
||||
case len(named) == 0 && sourceIs(e.Source, m):
|
||||
from = append(from, e)
|
||||
case readsFrom(read[e.Manifest.Module], m):
|
||||
packaging = append(packaging, e)
|
||||
}
|
||||
}
|
||||
if len(named) == 0 {
|
||||
from = whatTheMergeTouched(from, entries, m)
|
||||
// The changed files: the planner's own answer, as the merge handler, the merge gate and a pull
|
||||
// request's check ask it (novox/hq ADR 0238).
|
||||
r := reachOfMerge(m, entries, read, nil)
|
||||
from, packaging = append(append([]inventory.Entry{}, r.Touched...), r.Deleted...), r.Packaging
|
||||
} else {
|
||||
for _, e := range entries {
|
||||
switch {
|
||||
case named[e.Manifest.Module]:
|
||||
from = append(from, e)
|
||||
case readsFrom(read[e.Manifest.Module], m):
|
||||
packaging = append(packaging, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
moved := append(append([]inventory.Entry{}, from...), packaging...)
|
||||
if len(moved) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user