using repolist
This commit is contained in:
parent
dfc28a04d6
commit
15f334b2d2
|
@ -52,10 +52,10 @@ func globalDisplayOptions(vbox *gui.Node) {
|
|||
|
||||
group1.NewButton("Show Repository Window", func() {
|
||||
globalDisplaySetRepoState()
|
||||
if me.repoView.Hidden() {
|
||||
me.repoView.Show()
|
||||
if me.repos.Hidden() {
|
||||
me.repos.Show()
|
||||
} else {
|
||||
me.repoView.Hide()
|
||||
me.repos.Hide()
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -78,9 +78,12 @@ func globalDisplayOptions(vbox *gui.Node) {
|
|||
}
|
||||
scanbox := group1.Box().Horizontal()
|
||||
me.autoScanReposCB = scanbox.NewCheckbox("auto scan").SetChecked(true)
|
||||
me.autoScanReposCB.Custom = func() {
|
||||
me.repos.View.SetAutoScan(me.autoScanReposCB.Checked())
|
||||
}
|
||||
scanbox.NewButton("scan now", func() {
|
||||
log.Info("re-scanning repos now")
|
||||
repolist.ScanRepositories()
|
||||
me.repos.View.ScanRepositories()
|
||||
})
|
||||
me.duration = scanbox.NewLabel("")
|
||||
|
||||
|
|
9
main.go
9
main.go
|
@ -6,7 +6,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/log"
|
||||
|
||||
|
@ -41,7 +40,7 @@ func main() {
|
|||
|
||||
globalResetOptions(me.mainbox)
|
||||
|
||||
me.repoView = repolist.AutotypistView()
|
||||
me.repos = makeRepoView()
|
||||
|
||||
usr, _ := user.Current()
|
||||
if args.OnlyMe {
|
||||
|
@ -53,19 +52,19 @@ func main() {
|
|||
path = strings.TrimPrefix(path, me.goSrcPwd.String())
|
||||
path = strings.Trim(path, "/")
|
||||
log.Info("addRepo()", i, path)
|
||||
me.repoView.AddRepo(path, "master", "devel", usr.Username)
|
||||
me.repos.View.AddRepo(path, "master", "devel", usr.Username)
|
||||
}
|
||||
}
|
||||
|
||||
// process everything on the command line
|
||||
handleCmdLine()
|
||||
|
||||
repolist.ScanRepositories()
|
||||
me.repos.View.ScanRepositories()
|
||||
me.Enable()
|
||||
|
||||
// processing is done. update the repo summary box
|
||||
me.summary.Update()
|
||||
|
||||
// intermittently scans the status indefinitly
|
||||
repolist.Watchdog()
|
||||
me.repos.View.Watchdog()
|
||||
}
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
type repoWindow struct {
|
||||
win *gadgets.BasicWindow
|
||||
box *gui.Node
|
||||
View *repolist.RepoList
|
||||
}
|
||||
|
||||
func (r *repoWindow) Hidden() bool {
|
||||
return r.win.Hidden()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Show() {
|
||||
r.win.Show()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Hide() {
|
||||
r.win.Hide()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Disable() {
|
||||
r.box.Disable()
|
||||
}
|
||||
|
||||
func (r *repoWindow) Enable() {
|
||||
r.box.Enable()
|
||||
}
|
||||
|
||||
// you can only have one of these
|
||||
func makeRepoView() *repoWindow {
|
||||
if me.repos != nil {
|
||||
return me.repos
|
||||
}
|
||||
r := new(repoWindow)
|
||||
r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
|
||||
r.win.Make()
|
||||
|
||||
r.box = r.win.Box().NewBox("bw vbox", false)
|
||||
// me.reposwin.Draw()
|
||||
r.win.Custom = func() {
|
||||
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
||||
log.Warn("Should I do something special here?")
|
||||
}
|
||||
|
||||
r.repoAllButtons()
|
||||
|
||||
r.View = repolist.AutotypistView(r.box)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *repoWindow) showApps() {
|
||||
for _, repo := range r.View.AllRepos() {
|
||||
switch repo.RepoType() {
|
||||
case "binary":
|
||||
//log.Info("compile here. Show()")
|
||||
repo.Show()
|
||||
case "library":
|
||||
//log.Info("library here. Hide()")
|
||||
repo.Hide()
|
||||
default:
|
||||
log.Info("showApps() unknown. Show()")
|
||||
repo.Hide()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (r *repoWindow) repoAllButtons() {
|
||||
// reposbox.SetExpand(false)
|
||||
group1 := r.box.NewGroup("Run on all repos:")
|
||||
|
||||
hbox := group1.Box()
|
||||
// hbox.Horizontal()
|
||||
hbox.Vertical()
|
||||
|
||||
box2 := hbox.Box().Vertical()
|
||||
box2.NewButton("merge all user to devel", func() {
|
||||
r.Disable()
|
||||
if !r.mergeAllUserToDevel() {
|
||||
return
|
||||
}
|
||||
r.Enable()
|
||||
})
|
||||
|
||||
box2.NewButton("merge all devel to main", func() {
|
||||
r.Disable()
|
||||
if !r.mergeAllDevelToMain() {
|
||||
return
|
||||
}
|
||||
r.Enable()
|
||||
})
|
||||
|
||||
box2.NewButton("merge it all", func() {
|
||||
r.Disable()
|
||||
if !r.mergeAllUserToDevel() {
|
||||
return
|
||||
}
|
||||
if !r.mergeAllDevelToMain() {
|
||||
return
|
||||
}
|
||||
r.Enable()
|
||||
})
|
||||
|
||||
box2.NewButton("test all builds", func() {
|
||||
r.Disable()
|
||||
defer r.Enable()
|
||||
r.showApps()
|
||||
for _, repo := range r.View.AllRepos() {
|
||||
if repo.Hidden() {
|
||||
// log.Info("skip hidden", repo.String())
|
||||
} else {
|
||||
log.Info("try to build", repo.String())
|
||||
if repo.Build() {
|
||||
log.Info("build worked", repo.String())
|
||||
} else {
|
||||
log.Info("build failed", repo.String())
|
||||
go repo.Xterm("bash")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Info("")
|
||||
log.Info("every build worked !!!")
|
||||
log.Info("")
|
||||
})
|
||||
}
|
||||
|
||||
func (r *repoWindow) mergeAllDevelToMain() bool {
|
||||
log.Info("merge all here")
|
||||
for _, repo := range r.View.AllRepos() {
|
||||
if repo.ReadOnly() {
|
||||
log.Info("skipping readonly", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
if repo.Status() != "merge to main" {
|
||||
log.Info("skipping. not merge to main", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
if repo.CheckDirty() {
|
||||
log.Info("skipping dirty", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
log.Info("found", repo.String(), repo.Status())
|
||||
repo.NewScan()
|
||||
if repo.MergeDevelToMaster() {
|
||||
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
||||
} else {
|
||||
log.Warn("last repo:", repo.Path())
|
||||
log.Warn("THINGS FAILED fullAutomation() returned false")
|
||||
return false
|
||||
}
|
||||
repo.NewScan()
|
||||
}
|
||||
log.Warn("EVERYTHING WORKED")
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *repoWindow) mergeAllUserToDevel() bool {
|
||||
log.Info("merge all here")
|
||||
for _, repo := range r.View.AllRepos() {
|
||||
if repo.ReadOnly() {
|
||||
log.Info("skipping readonly", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
if repo.Status() != "merge to devel" {
|
||||
log.Info("skipping. not merge to devel", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
if repo.CheckDirty() {
|
||||
log.Info("skipping dirty", repo.String(), repo.Status())
|
||||
continue
|
||||
}
|
||||
log.Info("found", repo.String(), repo.Status())
|
||||
repo.NewScan()
|
||||
if repo.MergeUserToDevel() {
|
||||
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
||||
} else {
|
||||
log.Warn("last repo:", repo.Path())
|
||||
log.Warn("THINGS FAILED fullAutomation() returned false")
|
||||
return false
|
||||
}
|
||||
repo.NewScan()
|
||||
}
|
||||
log.Warn("EVERYTHING WORKED")
|
||||
return true
|
||||
}
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
)
|
||||
|
||||
var me *autoType
|
||||
|
@ -30,7 +29,7 @@ type autoType struct {
|
|||
lw *gadgets.BasicWindow
|
||||
|
||||
// our view of the repositories
|
||||
repoView *repolist.RepoList
|
||||
repos *repoWindow
|
||||
|
||||
// #### autotypist Global Display Options
|
||||
autoHidePerfect *gui.Node
|
||||
|
|
Loading…
Reference in New Issue