From f61891ca88c8073466ab8e43d8feffbf5f1bb913 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 29 Jan 2025 09:43:42 -0600 Subject: [PATCH] shows all the patches --- windowPatches.go | 28 ++++++++++++++++++---------- windowViewPatch.go | 30 ++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/windowPatches.go b/windowPatches.go index 4839f3d..4642d4d 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -94,10 +94,15 @@ func (r *patchesWindow) initWindow() { return } slices.Reverse(lines) + count := 0 for i, line := range lines { log.Info(i, line) - r.addPatchset(line) + count += 1 + if count < 10 { + r.addPatchset(line) + } } + log.Info("Total patchsets:", count) } func (r *patchesWindow) addPatchset(line string) { @@ -109,14 +114,16 @@ func (r *patchesWindow) addPatchset(line string) { r.setgrid.NewLabel(name) r.setgrid.NewLabel(subject) r.setgrid.NewLabel(author) - r.setgrid.NewButton("Download", func() { - pset, err := savePatch(name) - if err != nil { - log.Info(name, "failed to download", err) - return - } - r.setlist[name] = pset - }) + /* + r.setgrid.NewButton("Download", func() { + pset, err := savePatch(name) + if err != nil { + log.Info(name, "failed to download", err) + return + } + r.setlist[name] = pset + }) + */ r.setgrid.NewButton("View", func() { // has the window already been created? win := r.setwin[name] @@ -134,6 +141,7 @@ func (r *patchesWindow) addPatchset(line string) { } r.setlist[name] = pset r.setwin[name] = makePatchWindow(pset) + r.setwin[name].Show() }) r.setgrid.NewButton("Dump", func() { pset := r.setlist[name] @@ -146,7 +154,7 @@ func (r *patchesWindow) addPatchset(line string) { return } }) - r.setgrid.NewButton("Save", func() { + r.setgrid.NewButton("Extract", func() { pset := r.setlist[name] if pset == nil { log.Info(name, "was nil") diff --git a/windowViewPatch.go b/windowViewPatch.go index a59baa7..eeac7c7 100644 --- a/windowViewPatch.go +++ b/windowViewPatch.go @@ -62,7 +62,7 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow { pw := new(patchWindow) // sync.Once() - pw.win = gadgets.RawBasicWindow("Patcheset for") + pw.win = gadgets.RawBasicWindow("Patcheset for " + pset.Name + " (" + pset.Comment + ")") pw.win.Make() pw.stack = pw.win.Box().NewBox("bw vbox", false) @@ -75,6 +75,13 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow { grid := pw.stack.NewGrid("", 0, 0) grid.NewLabel(pset.GitAuthorName) + grid.NewLabel(pset.GitAuthorEmail) + grid.NextRow() + grid.NewLabel("start branch: " + pset.StartBranchName) + grid.NewLabel(pset.StartBranchHash) + grid.NextRow() + grid.NewLabel("end branch: " + pset.EndBranchName) + grid.NewLabel(pset.EndBranchHash) /* r.shelf = r.initGroup() @@ -86,14 +93,21 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow { g := pw.stack.NewGroup("PatchSet List") // add the patch grid - g.NewGrid("", 0, 0) + filegrid := g.NewGrid("", 0, 0) + + all := pset.Patches.SortByFilename() + for all.Scan() { + p := all.Next() + // if IsValidPatch(p) { + filegrid.NewLabel(p.Filename) + filegrid.NewLabel(p.RepoPath) + filegrid.NewLabel(p.BranchName) + filegrid.NewLabel(p.BranchHash) + filegrid.NewLabel(p.CommitHash) + filegrid.NewLabel(p.StartHash) + filegrid.NextRow() + } - /* - for i, line := range lines { - log.Info(i, line) - r.addFile(line) - } - */ return pw }