merge automation

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-30 13:32:04 -06:00
parent 3516829fe4
commit 36fb1bb1da
1 changed files with 119 additions and 57 deletions

View File

@ -77,63 +77,6 @@ func (r *repo) Show() {
r.hidden = false
}
// This creates a window
func repolistWindow() {
reposwin = gadgets.NewBasicWindow(me.myGui, "All git repositories in ~/go/src/")
reposwin.Make()
reposbox = reposwin.Box().NewBox("bw vbox", false)
reposwin.Draw()
reposwin.Custom = func() {
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
log.Warn("Should I do something special here?")
}
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
reposgrid = reposgroup.NewGrid("test", 9, 1)
reposgrid.NewLabel("") // path goes here
reposgrid.NewLabel("last tag").SetProgName("last tag")
reposgrid.NewLabel("master version")
reposgrid.NewLabel("devel version")
reposgrid.NewLabel("user version")
reposgrid.NewLabel("Status")
reposgrid.NewLabel("go.sum")
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
reposgrid.NewLabel("Show()")
repos := myrepolist()
for _, line := range repos {
log.Verbose("repo =", line)
path, mbranch, dbranch, ubranch := splitLine(line)
if mbranch == "" {
mbranch = "master"
}
if dbranch == "" {
dbranch = "devel"
}
usr, _ := user.Current()
if ubranch == "" {
ubranch = usr.Username
}
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
}
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
tmp := strings.TrimPrefix(path, "/home/jcarr/go/src/")
log.Info("addRepo()", i, tmp)
addRepo(reposgrid, tmp, "master", "master", "master")
}
reposwin.Toggle()
}
func addRepo(grid *gui.Node, path string, master string, devel string, user string) {
_, ok := me.allrepos[path]
if ok {
@ -194,3 +137,122 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
*/
me.allrepos[path] = newRepo
}
// This creates a window
func repolistWindow() {
reposwin = gadgets.NewBasicWindow(me.myGui, "All git repositories in ~/go/src/")
reposwin.Make()
reposbox = reposwin.Box().NewBox("bw vbox", false)
reposwin.Draw()
reposwin.Custom = func() {
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
log.Warn("Should I do something special here?")
}
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
reposgrid = reposgroup.NewGrid("test", 9, 1)
reposgrid.NewLabel("") // path goes here
reposgrid.NewLabel("last tag").SetProgName("last tag")
reposgrid.NewLabel("master version")
reposgrid.NewLabel("devel version")
reposgrid.NewLabel("user version")
reposgrid.NewLabel("Status")
reposgrid.NewLabel("go.sum")
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
reposgrid.NewLabel("Show()")
repos := myrepolist()
for _, line := range repos {
log.Verbose("repo =", line)
path, mbranch, dbranch, ubranch := splitLine(line)
if mbranch == "" {
mbranch = "master"
}
if dbranch == "" {
dbranch = "devel"
}
usr, _ := user.Current()
if ubranch == "" {
ubranch = usr.Username
}
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
}
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
tmp := strings.TrimPrefix(path, "/home/jcarr/go/src/")
log.Info("addRepo()", i, tmp)
addRepo(reposgrid, tmp, "master", "master", "master")
}
reposgroup.NewButton("merge all user to devel", func() {
reposwin.Disable()
log.Info("merge all here")
for _, repo := range me.allrepos {
if repo.status.ReadOnly() {
log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.dirtyLabel.String() != "merge to devel" {
log.Info("skipping. not merge to devel", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.status.CheckDirty() {
log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String())
continue
}
log.Info("found", repo.String(), repo.dirtyLabel.String())
// repo.status.Update()
if repo.status.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
return
}
repo.status.Update()
repo.newScan()
}
log.Warn("EVERYTHING WORKED")
reposwin.Enable()
})
reposgroup.NewButton("merge all devel to main", func() {
reposwin.Disable()
log.Info("merge all here")
for _, repo := range me.allrepos {
if repo.status.ReadOnly() {
log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.dirtyLabel.String() != "merge to main" {
log.Info("skipping. not merge to main", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.status.CheckDirty() {
log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String())
continue
}
log.Info("found", repo.String(), repo.dirtyLabel.String())
// repo.status.Update()
if repo.status.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
return
}
repo.status.Update()
repo.newScan()
}
log.Warn("EVERYTHING WORKED")
reposwin.Enable()
})
reposwin.Toggle()
}