The runner, the toolchain guard, the fetch, the parsers, buildcpu, the conformance kit and mesh-pack move from mesh-sdk's buildstep into modules/mesh-build-go/buildstep (own go.mod). mesh-build-go, mesh-build-node and mesh-build-image require it by a same-repository replace; what the delivery parts read (the failure contract, the fetch request, the stale sweep, the module tree shape, NewID, CapacitySetting) stays imported from mesh-sdk as sdkstep. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package main
|
|
|
|
// The merge preview of a fetch (novox/hq ADR 0484 clause 3; issue 1676), as build_go_fetch answers it. The merge itself
|
|
// is the SDK's (buildstep.MergeInto), the one every build module's fetch step makes.
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
|
|
"git.novox.be/novox/mesh-sdk/go/forgekey"
|
|
)
|
|
|
|
// remote is the address a repository is fetched from: the forge over ssh as the account, or RemoteBase when a test set it.
|
|
func (m *Module) remote(repository string) string {
|
|
base := m.RemoteBase
|
|
if base == "" {
|
|
base = "ssh://" + ForgeAlias + "/"
|
|
}
|
|
return base + repository + ".git"
|
|
}
|
|
|
|
// merge makes the merge preview of the head onto base and writes the answer into res.
|
|
func (m *Module) merge(ctx context.Context, run forgekey.Runner, res *FetchResult, tree, remote, base, commit string) error {
|
|
mr, err := buildstep.MergeInto(ctx, run, tree, remote, base, commit, m.FetchOptions...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
res.Base = mr.Base
|
|
res.Conflicts, res.Merge, res.Changed = mr.Conflicts, mr.Merge, mr.Changed
|
|
if mr.Merge != "" {
|
|
res.Programs = &mr.Programs
|
|
}
|
|
if res.Merge == "" {
|
|
return nil
|
|
}
|
|
res.Trees, err = buildstep.ModuleTrees(ctx, m.Run, m.baseEnv(), tree, res.Merge)
|
|
return err
|
|
}
|