start working on the GUI again for this
This commit is contained in:
parent
30a4988f08
commit
cc55a5ad7a
9
Makefile
9
Makefile
|
@ -9,6 +9,9 @@ info:
|
||||||
@echo "make all # show all repos"
|
@echo "make all # show all repos"
|
||||||
@echo "make pull # run git pull on every repo"
|
@echo "make pull # run git pull on every repo"
|
||||||
@echo "make dirty # CheckDirty()"
|
@echo "make dirty # CheckDirty()"
|
||||||
|
@echo "make user # git checkout user"
|
||||||
|
@echo "make master # git checkout master"
|
||||||
|
forge --do-gui
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
|
@ -86,3 +89,9 @@ restart:
|
||||||
reset
|
reset
|
||||||
-rm ~/go/src/repos.pb
|
-rm ~/go/src/repos.pb
|
||||||
make private
|
make private
|
||||||
|
|
||||||
|
user: install
|
||||||
|
forge --user
|
||||||
|
|
||||||
|
master: install
|
||||||
|
forge --master
|
||||||
|
|
2
argv.go
2
argv.go
|
@ -30,6 +30,8 @@ type args struct {
|
||||||
URL string `arg:"--url" default:"http://go.wit.com/" help:"base url"`
|
URL string `arg:"--url" default:"http://go.wit.com/" help:"base url"`
|
||||||
Delete string `arg:"--delete" help:"delete this repo"`
|
Delete string `arg:"--delete" help:"delete this repo"`
|
||||||
Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
|
Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
|
||||||
|
User bool `arg:"--user" help:"git checkout user"`
|
||||||
|
Master bool `arg:"--master" help:"git checkout master"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (args) Version() string {
|
func (args) Version() string {
|
||||||
|
|
5
doGui.go
5
doGui.go
|
@ -12,7 +12,7 @@ func doGui() {
|
||||||
me.myGui = gui.New()
|
me.myGui = gui.New()
|
||||||
me.myGui.Default()
|
me.myGui.Default()
|
||||||
|
|
||||||
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
|
me.mainWindow = gadgets.RawBasicWindow("Forge: use this to submit patches")
|
||||||
me.mainWindow.Make()
|
me.mainWindow.Make()
|
||||||
me.mainWindow.Show()
|
me.mainWindow.Show()
|
||||||
me.mainbox = me.mainWindow.Box()
|
me.mainbox = me.mainWindow.Box()
|
||||||
|
@ -28,12 +28,13 @@ func doGui() {
|
||||||
|
|
||||||
// processing is done. update the repo summary box
|
// processing is done. update the repo summary box
|
||||||
me.summary.Update()
|
me.summary.Update()
|
||||||
|
me.summary.submitB.Disable()
|
||||||
|
|
||||||
me.Enable()
|
me.Enable()
|
||||||
|
|
||||||
// intermittently scans the status indefinitly
|
// intermittently scans the status indefinitly
|
||||||
me.repos.View.Watchdog(func() {
|
me.repos.View.Watchdog(func() {
|
||||||
log.Info("In main()")
|
log.Info("Watchdog in doGui()")
|
||||||
// processing is done. update the repo summary box
|
// processing is done. update the repo summary box
|
||||||
me.summary.Update()
|
me.summary.Update()
|
||||||
})
|
})
|
||||||
|
|
|
@ -46,7 +46,7 @@ func quickCmd(fullpath string, cmd []string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func globalBuildOptions(vbox *gui.Node) {
|
func globalBuildOptions(vbox *gui.Node) {
|
||||||
group1 := vbox.NewGroup("Global Build Options")
|
group1 := vbox.NewGroup("Forge Settings")
|
||||||
grid := group1.NewGrid("buildOptions", 0, 0)
|
grid := group1.NewGrid("buildOptions", 0, 0)
|
||||||
|
|
||||||
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||||
|
|
14
main.go
14
main.go
|
@ -4,8 +4,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -42,6 +44,16 @@ func main() {
|
||||||
configSave = false
|
configSave = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if argv.User {
|
||||||
|
me.forge.CheckoutUser()
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.Master {
|
||||||
|
me.forge.CheckoutMaster()
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
if argv.Delete != "" {
|
if argv.Delete != "" {
|
||||||
me.forge.DeleteByGoPath(argv.Delete)
|
me.forge.DeleteByGoPath(argv.Delete)
|
||||||
me.forge.SetConfigSave(true)
|
me.forge.SetConfigSave(true)
|
||||||
|
@ -49,6 +61,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Dirty {
|
if argv.Dirty {
|
||||||
|
now := time.Now()
|
||||||
all := me.forge.Repos.SortByFullPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
|
@ -65,6 +78,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doCobol()
|
doCobol()
|
||||||
|
log.Info("dirty check took:", shell.FormatDuration(time.Since(now)))
|
||||||
me.forge.SetConfigSave(configSave)
|
me.forge.SetConfigSave(configSave)
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ type patchSummary struct {
|
||||||
checkB *gui.Node
|
checkB *gui.Node
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
totalOL *gadgets.OneLiner
|
totalOL *gadgets.OneLiner
|
||||||
totalGoOL *gadgets.OneLiner
|
// totalGoOL *gadgets.OneLiner
|
||||||
dirtyOL *gadgets.OneLiner
|
dirtyOL *gadgets.OneLiner
|
||||||
readonlyOL *gadgets.OneLiner
|
readonlyOL *gadgets.OneLiner
|
||||||
totalPatchesOL *gadgets.OneLiner
|
totalPatchesOL *gadgets.OneLiner
|
||||||
|
@ -52,44 +52,47 @@ type patchSummary struct {
|
||||||
|
|
||||||
func submitPatchesBox(box *gui.Node) *patchSummary {
|
func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s := new(patchSummary)
|
s := new(patchSummary)
|
||||||
group1 := box.NewGroup("Submit Patches Summary")
|
group1 := box.NewGroup("Patch Summary")
|
||||||
s.grid = group1.RawGrid()
|
s.grid = group1.RawGrid()
|
||||||
|
|
||||||
s.grid.NewButton("Update Patch Counts", func() {
|
s.grid.NewButton("Update Patch Counts", func() {
|
||||||
var repocount, patchcount int
|
/*
|
||||||
// broken after move to forge protobuf
|
var repocount, patchcount int
|
||||||
all := me.forge.Repos.SortByFullPath()
|
// broken after move to forge protobuf
|
||||||
for all.Scan() {
|
all := me.forge.Repos.SortByFullPath()
|
||||||
repo := all.Next()
|
for all.Scan() {
|
||||||
if repo.GetReadOnly() {
|
repo := all.Next()
|
||||||
continue
|
if repo.GetReadOnly() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
i, _ := repo.GetMasterPatches()
|
||||||
|
patchcount += i
|
||||||
|
if i > 0 {
|
||||||
|
repocount += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i, _ := repo.GetMasterPatches()
|
s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches")
|
||||||
patchcount += i
|
s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos")
|
||||||
if i > 0 {
|
|
||||||
repocount += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches")
|
|
||||||
s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos")
|
|
||||||
|
|
||||||
repocount = 0
|
repocount = 0
|
||||||
patchcount = 0
|
patchcount = 0
|
||||||
// broken after move to forge protobuf
|
// broken after move to forge protobuf
|
||||||
all = me.forge.Repos.SortByFullPath()
|
all = me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if repo.GetReadOnly() {
|
if repo.GetReadOnly() {
|
||||||
continue
|
continue
|
||||||
|
}
|
||||||
|
i, _ := repo.GetUserPatches()
|
||||||
|
patchcount += i
|
||||||
|
if i > 0 {
|
||||||
|
repocount += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i, _ := repo.GetUserPatches()
|
s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches")
|
||||||
patchcount += i
|
s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos")
|
||||||
if i > 0 {
|
*/
|
||||||
repocount += 1
|
s.Update()
|
||||||
}
|
|
||||||
}
|
|
||||||
s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches")
|
|
||||||
s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* this used to be the way and should probably be revisited
|
/* this used to be the way and should probably be revisited
|
||||||
|
@ -105,8 +108,8 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
|
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO")
|
// s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO")
|
||||||
s.grid.NextRow()
|
// s.grid.NextRow()
|
||||||
|
|
||||||
s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty")
|
s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty")
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
@ -145,9 +148,9 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
})
|
})
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
group1 = box.NewGroup("Create GUI Patch Set")
|
group1 = box.NewGroup("Submit Patch Set")
|
||||||
s.grid = group1.RawGrid()
|
s.grid = group1.RawGrid()
|
||||||
s.reason = gadgets.NewBasicEntry(s.grid, "patch name:")
|
s.reason = gadgets.NewBasicEntry(s.grid, "set name:")
|
||||||
s.reason.Custom = func() {
|
s.reason.Custom = func() {
|
||||||
if s.reason.String() != "" {
|
if s.reason.String() != "" {
|
||||||
s.submitB.Enable()
|
s.submitB.Enable()
|
||||||
|
@ -155,7 +158,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.submitB.Disable()
|
s.submitB.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.submitB = s.grid.NewButton("Create Patch Set", func() {
|
s.submitB = s.grid.NewButton("Submit", func() {
|
||||||
dirname := "submit-patchset.quilt"
|
dirname := "submit-patchset.quilt"
|
||||||
patchdir := filepath.Join(me.userHomePwd.String(), dirname)
|
patchdir := filepath.Join(me.userHomePwd.String(), dirname)
|
||||||
if shell.Exists(patchdir) {
|
if shell.Exists(patchdir) {
|
||||||
|
@ -169,11 +172,13 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
}
|
}
|
||||||
me.repos.View.MakePatchset(patchdir)
|
me.repos.View.MakePatchset(patchdir)
|
||||||
})
|
})
|
||||||
s.submitB = s.grid.NewButton("Submit quilt", func() {
|
/*
|
||||||
log.Info("do a submit here")
|
s.submitB = s.grid.NewButton("Submit quilt", func() {
|
||||||
})
|
log.Info("do a submit here")
|
||||||
|
})
|
||||||
|
*/
|
||||||
// disable these until there are not dirty repos
|
// disable these until there are not dirty repos
|
||||||
s.reason.Disable()
|
// s.reason.Disable()
|
||||||
s.submitB.Disable()
|
s.submitB.Disable()
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
|
@ -186,7 +191,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
|
|
||||||
// does not run any commands
|
// does not run any commands
|
||||||
func (s *patchSummary) Update() {
|
func (s *patchSummary) Update() {
|
||||||
var total, totalgo, dirty, readonly int
|
var total, dirty, readonly int
|
||||||
var userT, develT, masterT int
|
var userT, develT, masterT int
|
||||||
// var userP, develP, masterP int
|
// var userP, develP, masterP int
|
||||||
// broken after move to forge protobuf
|
// broken after move to forge protobuf
|
||||||
|
@ -219,7 +224,7 @@ func (s *patchSummary) Update() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.totalOL.SetText(strconv.Itoa(total) + " repos")
|
s.totalOL.SetText(strconv.Itoa(total) + " repos")
|
||||||
s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos")
|
// s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos")
|
||||||
s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos")
|
s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos")
|
||||||
s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos")
|
s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos")
|
||||||
|
|
||||||
|
@ -233,7 +238,7 @@ func (s *patchSummary) Update() {
|
||||||
// s.unknownOL.Enable()
|
// s.unknownOL.Enable()
|
||||||
// s.unknownSubmitB.Enable()
|
// s.unknownSubmitB.Enable()
|
||||||
} else {
|
} else {
|
||||||
s.reason.Disable()
|
// s.reason.Disable()
|
||||||
s.submitB.Enable()
|
s.submitB.Enable()
|
||||||
// s.unknownOL.Enable()
|
// s.unknownOL.Enable()
|
||||||
// s.unknownSubmitB.Enable()
|
// s.unknownSubmitB.Enable()
|
||||||
|
|
Loading…
Reference in New Issue