shows all the patches

This commit is contained in:
Jeff Carr 2025-01-29 09:43:42 -06:00
parent f2281a2102
commit f61891ca88
2 changed files with 40 additions and 18 deletions

View File

@ -94,10 +94,15 @@ func (r *patchesWindow) initWindow() {
return return
} }
slices.Reverse(lines) slices.Reverse(lines)
count := 0
for i, line := range lines { for i, line := range lines {
log.Info(i, line) log.Info(i, line)
count += 1
if count < 10 {
r.addPatchset(line) r.addPatchset(line)
} }
}
log.Info("Total patchsets:", count)
} }
func (r *patchesWindow) addPatchset(line string) { func (r *patchesWindow) addPatchset(line string) {
@ -109,6 +114,7 @@ func (r *patchesWindow) addPatchset(line string) {
r.setgrid.NewLabel(name) r.setgrid.NewLabel(name)
r.setgrid.NewLabel(subject) r.setgrid.NewLabel(subject)
r.setgrid.NewLabel(author) r.setgrid.NewLabel(author)
/*
r.setgrid.NewButton("Download", func() { r.setgrid.NewButton("Download", func() {
pset, err := savePatch(name) pset, err := savePatch(name)
if err != nil { if err != nil {
@ -117,6 +123,7 @@ func (r *patchesWindow) addPatchset(line string) {
} }
r.setlist[name] = pset r.setlist[name] = pset
}) })
*/
r.setgrid.NewButton("View", func() { r.setgrid.NewButton("View", func() {
// has the window already been created? // has the window already been created?
win := r.setwin[name] win := r.setwin[name]
@ -134,6 +141,7 @@ func (r *patchesWindow) addPatchset(line string) {
} }
r.setlist[name] = pset r.setlist[name] = pset
r.setwin[name] = makePatchWindow(pset) r.setwin[name] = makePatchWindow(pset)
r.setwin[name].Show()
}) })
r.setgrid.NewButton("Dump", func() { r.setgrid.NewButton("Dump", func() {
pset := r.setlist[name] pset := r.setlist[name]
@ -146,7 +154,7 @@ func (r *patchesWindow) addPatchset(line string) {
return return
} }
}) })
r.setgrid.NewButton("Save", func() { r.setgrid.NewButton("Extract", func() {
pset := r.setlist[name] pset := r.setlist[name]
if pset == nil { if pset == nil {
log.Info(name, "was nil") log.Info(name, "was nil")

View File

@ -62,7 +62,7 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
pw := new(patchWindow) pw := new(patchWindow)
// sync.Once() // sync.Once()
pw.win = gadgets.RawBasicWindow("Patcheset for") pw.win = gadgets.RawBasicWindow("Patcheset for " + pset.Name + " (" + pset.Comment + ")")
pw.win.Make() pw.win.Make()
pw.stack = pw.win.Box().NewBox("bw vbox", false) 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 := pw.stack.NewGrid("", 0, 0)
grid.NewLabel(pset.GitAuthorName) 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() r.shelf = r.initGroup()
@ -86,14 +93,21 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
g := pw.stack.NewGroup("PatchSet List") g := pw.stack.NewGroup("PatchSet List")
// add the patch grid // add the patch grid
g.NewGrid("", 0, 0) filegrid := g.NewGrid("", 0, 0)
/* all := pset.Patches.SortByFilename()
for i, line := range lines { for all.Scan() {
log.Info(i, line) p := all.Next()
r.addFile(line) // 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()
} }
*/
return pw return pw
} }