diff options
| author | Jeff Carr <[email protected]> | 2025-03-11 12:00:27 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-11 12:00:27 -0500 |
| commit | 422d853020cf1725c14bd7a85477b68b8d90b31b (patch) | |
| tree | 52638ab6db6b747585ebf8c8f95b04f3cb300917 | |
| parent | 95d4e03ca44a2bff04d4722248f5dff84a137529 (diff) | |
start tracking patchset state
| -rw-r--r-- | windowNewPatchsets.go | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/windowNewPatchsets.go b/windowNewPatchsets.go index b077923..8fc8415 100644 --- a/windowNewPatchsets.go +++ b/windowNewPatchsets.go @@ -59,7 +59,9 @@ func makePatchsetsWin() *stdPatchsetTableWin { for all.Scan() { pset := all.Next() log.Info("What is up with?", pset.Name) + setPatchsetState(pset) } + savePatchsets(psets) }) // make a box at the bottom of the window for the protobuf table @@ -110,12 +112,8 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab } tp := t.AddButtonFunc("Analyze", testf) tp.Custom = func(p *forgepb.Patchset) { - log.Info("check patches here", p.Name) - all := p.Patches.All() - for all.Scan() { - patch := all.Next() - log.Info("What is up with patches:", patch.Filename) - } + setPatchsetState(p) + log.Info("patchset state", p.Name, "is", p.State) } vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string { @@ -133,6 +131,7 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab } t.AddComment() + t.AddState() ctimef := func(p *forgepb.Patchset) string { ctime := p.Ctime.AsTime() @@ -162,3 +161,48 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab t.ShowTable() return t } + +func setPatchsetState(p *forgepb.Patchset) { + var bad bool + var good bool + var done bool = true + + all := p.Patches.All() + for all.Scan() { + patch := all.Next() + // log.Info("patch:", patch.StartHash, patch.CommitHash, patch.RepoNamespace, patch.Filename) + repo := me.forge.FindByGoPath(patch.RepoNamespace) + if repo == nil { + log.Info("couldn't find repo", patch.RepoNamespace) + bad = true + continue + } + if _, err := repo.GetHashName(patch.CommitHash); err == nil { + // this patch has been applied + patch.Applied = true + done = true + continue + } + if name, err := repo.GetHashName(patch.StartHash); err == nil { + // it might be possible to apply this patch + log.Info("patch may be good:", patch.RepoNamespace, name, patch.CommitHash, patch.Filename) + good = true + } else { + // probably screwed up git trees + log.Info("patch with unknown origin:", patch.RepoNamespace, name, err, patch.CommitHash, patch.Filename) + bad = true + } + } + if bad { + p.State = "BAD" + return + } + if good { + p.State = "TRY" + return + } + if done { + p.State = "DONE" + return + } +} |
