A late merge is named however its modules read since the cut; a walk builds the commits it carries (hq ADR 0276 review)

This commit is contained in:
jochen
2026-10-10 13:39:21 +02:00
parent 96fc4209d3
commit e1499d4196
6 changed files with 229 additions and 60 deletions
+15
View File
@@ -94,6 +94,21 @@ func (p Plan) CommitOf(repository string) string {
return ""
}
// CommitOn is the commit of a repository's branch the walk carries; empty when it carries none of it. A
// commit kept without its branch matches any branch.
func (p Plan) CommitOn(repository, branch string) string {
for _, c := range p.Commits {
if strings.EqualFold(c.Repository, repository) && (branch == "" || c.Branch == "" || c.Branch == branch) {
return c.Commit
}
}
if len(p.Commits) == 0 && strings.EqualFold(p.Repository, repository) &&
(branch == "" || p.Branch == "" || p.Branch == branch) {
return p.Commit
}
return ""
}
// Carried is every repository's commit the walk carries: Commits, or its one repository and commit.
func (p Plan) Carried() []PlanCommit {
if len(p.Commits) > 0 {