remove perfect branches works
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
74502ed5fb
commit
e240e4149f
|
@ -3,3 +3,4 @@
|
||||||
!Makefile
|
!Makefile
|
||||||
!*.go
|
!*.go
|
||||||
!go.*
|
!go.*
|
||||||
|
!myrepolist
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -1,7 +1,11 @@
|
||||||
all:
|
all:
|
||||||
echo "build it!"
|
echo "build it!"
|
||||||
go build -v -x
|
-mkdir -p plugins/
|
||||||
./myrepos
|
-cp myrepolist plugins/
|
||||||
|
-cp ~/go/src/go.wit.com/gui/toolkits/*.so plugins/
|
||||||
|
go install -v -x
|
||||||
|
# go build -v -x
|
||||||
|
myrepos
|
||||||
# ./myrepos >/tmp/myrepos.stderr 2>&1
|
# ./myrepos >/tmp/myrepos.stderr 2>&1
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
|
|
118
main.go
118
main.go
|
@ -3,6 +3,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"embed"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
@ -11,11 +12,15 @@ import (
|
||||||
"go.wit.com/gui/gadgets/repostatus"
|
"go.wit.com/gui/gadgets/repostatus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed plugins/*
|
||||||
|
var resToolkit embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
myGui = gui.New().Default()
|
myGui = gui.New()
|
||||||
|
myGui.InitEmbed(resToolkit)
|
||||||
|
myGui.Default()
|
||||||
|
|
||||||
repoworld()
|
repoworld()
|
||||||
|
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +35,19 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
}
|
}
|
||||||
|
|
||||||
newRepo.path = path
|
newRepo.path = path
|
||||||
newRepo.pLabel = grid.NewLabel(path)
|
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||||
newRepo.bLabel = grid.NewLabel("")
|
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||||
newRepo.lastLabel = grid.NewLabel("")
|
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||||
newRepo.vLabel = grid.NewLabel("")
|
|
||||||
|
|
||||||
newRepo.masterName = grid.NewLabel("")
|
newRepo.masterName = grid.NewLabel("").SetProgName("masterName")
|
||||||
newRepo.masterVersion = grid.NewLabel("")
|
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
|
||||||
newRepo.develName = grid.NewLabel("")
|
newRepo.develName = grid.NewLabel("").SetProgName("develName")
|
||||||
newRepo.develVersion = grid.NewLabel("")
|
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||||
newRepo.userName = grid.NewLabel("")
|
newRepo.userName = grid.NewLabel("").SetProgName("userName")
|
||||||
newRepo.userVersion = grid.NewLabel("")
|
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||||
newRepo.dirtyLabel = grid.NewLabel("")
|
newRepo.dirtyLabel = grid.NewLabel("")
|
||||||
|
|
||||||
|
/*
|
||||||
newRepo.pButton = grid.NewButton("rescan", func () {
|
newRepo.pButton = grid.NewButton("rescan", func () {
|
||||||
newRepo.newScan()
|
newRepo.newScan()
|
||||||
})
|
})
|
||||||
|
@ -63,6 +68,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
log.Warn("status window exists. trying Hide() here")
|
log.Warn("status window exists. trying Hide() here")
|
||||||
newRepo.status.Hide()
|
newRepo.status.Hide()
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
grid.NewButton("Show()", func () {
|
grid.NewButton("Show()", func () {
|
||||||
if newRepo.status == nil {
|
if newRepo.status == nil {
|
||||||
log.Warn("status window doesn't exist")
|
log.Warn("status window doesn't exist")
|
||||||
|
@ -92,13 +98,11 @@ func repoworld() {
|
||||||
|
|
||||||
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
||||||
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
||||||
reposgrid = reposgroup.NewGrid("test", 15, 1)
|
reposgrid = reposgroup.NewGrid("test", 11, 1)
|
||||||
|
|
||||||
reposgrid.NewLabel("")
|
reposgrid.NewLabel("")
|
||||||
reposgrid.NewLabel("branch")
|
reposgrid.NewLabel("last tag").SetProgName("last tag")
|
||||||
reposgrid.NewLabel("last tag")
|
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||||
reposgrid.NewLabel("Current Version")
|
|
||||||
// reposgrid.NewLabel("tags")
|
|
||||||
reposgrid.NewLabel("master")
|
reposgrid.NewLabel("master")
|
||||||
reposgrid.NewLabel("version")
|
reposgrid.NewLabel("version")
|
||||||
reposgrid.NewLabel("devel")
|
reposgrid.NewLabel("devel")
|
||||||
|
@ -106,9 +110,6 @@ func repoworld() {
|
||||||
reposgrid.NewLabel("user")
|
reposgrid.NewLabel("user")
|
||||||
reposgrid.NewLabel("version")
|
reposgrid.NewLabel("version")
|
||||||
reposgrid.NewLabel("Status")
|
reposgrid.NewLabel("Status")
|
||||||
reposgrid.NewLabel("rescan")
|
|
||||||
reposgrid.NewLabel("Update()")
|
|
||||||
reposgrid.NewLabel("Hide()")
|
|
||||||
reposgrid.NewLabel("Show()")
|
reposgrid.NewLabel("Show()")
|
||||||
|
|
||||||
repos := myrepolist()
|
repos := myrepolist()
|
||||||
|
@ -123,24 +124,87 @@ func repoworld() {
|
||||||
}
|
}
|
||||||
|
|
||||||
box2 := reposwin.Box().NewBox("bw vbox", false)
|
box2 := reposwin.Box().NewBox("bw vbox", false)
|
||||||
box2.NewButton("reposgrid.Margin()", func () {
|
|
||||||
log.Warn("reposgrid.Margin() RUN NOW")
|
buildOptions := box2.NewGrid("buildOptions",2, 1)
|
||||||
reposgrid.Margin()
|
title := gadgets.NewOneLiner(buildOptions, "Branch and build")
|
||||||
log.Warn("reposgrid.Pad() RUN NOW")
|
title.Set("options")
|
||||||
reposgrid.Pad()
|
guiBranch := gadgets.NewBasicCombobox(buildOptions, "Select GUI branch")
|
||||||
|
guiBranch.Add("guimaster")
|
||||||
|
guiBranch.Add("guidevel")
|
||||||
|
guiBranch.Add("jcarr")
|
||||||
|
|
||||||
|
buildOptions.NewLabel("only PERFECT")
|
||||||
|
buildOptions.NewButton("Find", func () {
|
||||||
|
log.Warn("delete every repo marked PERFECT")
|
||||||
|
var newCmds [][]string
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
status := repo.getStatus()
|
||||||
|
if status == "PERFECT" {
|
||||||
|
var line []string
|
||||||
|
line = append(line, "rm", "-rf", "go/src/" + repo.path)
|
||||||
|
newCmds = append(newCmds, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
script = newCmds
|
||||||
|
doit.Enable()
|
||||||
|
setGitCommands()
|
||||||
})
|
})
|
||||||
|
|
||||||
box2.NewButton("status.Update() all", func () {
|
buildOptions.NewLabel("start over")
|
||||||
|
buildOptions.NewButton("rm src & pkgs", func () {
|
||||||
|
var newCmds [][]string
|
||||||
|
var dirty bool = false
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
status := repo.getStatus()
|
||||||
|
if status == "dirty" {
|
||||||
|
dirty = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
line := []string{"rm", "-rf", "go/src/"}
|
||||||
|
newCmds = append(newCmds, line)
|
||||||
|
newCmds = append(newCmds, []string{"rm", "-rf", "go/pkg/"})
|
||||||
|
if dirty {
|
||||||
|
line := []string{"can't do this with dirty repos"}
|
||||||
|
newCmds = append(newCmds, line)
|
||||||
|
doit.Disable()
|
||||||
|
} else {
|
||||||
|
doit.Enable()
|
||||||
|
}
|
||||||
|
script = newCmds
|
||||||
|
setGitCommands()
|
||||||
|
})
|
||||||
|
|
||||||
|
buildOptions.NewLabel("repo pkg's")
|
||||||
|
buildOptions.NewButton("rm ~/go/pkg/", func () {
|
||||||
|
log.Warn("delete every repo here but skip dirty ones")
|
||||||
|
cmds.Set("rm -rf ~/go/pkg/")
|
||||||
|
})
|
||||||
|
|
||||||
|
buildOptions.NewButton("status.Update() all", func () {
|
||||||
for _, repo := range allrepos {
|
for _, repo := range allrepos {
|
||||||
repo.status.Update()
|
repo.status.Update()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
box2.NewButton("rescan all", func () {
|
buildOptions.NewButton("rescan all", func () {
|
||||||
for _, repo := range allrepos {
|
for _, repo := range allrepos {
|
||||||
repo.newScan()
|
repo.newScan()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
buildOptions.NewLabel("cmd")
|
||||||
|
cmds = buildOptions.NewLabel("ls")
|
||||||
|
|
||||||
|
buildOptions.NewLabel("Doit")
|
||||||
|
doit = buildOptions.NewButton("run commands", func () {
|
||||||
|
doit.Disable()
|
||||||
|
log.Warn("should run the commands here")
|
||||||
|
if runCommands() {
|
||||||
|
log.Warn("EVERYTHING WORKED")
|
||||||
|
} else {
|
||||||
|
log.Warn("EVERYTHING DID NOT WORK")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
reposwin.Draw()
|
reposwin.Draw()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
go.wit.com/log
|
||||||
|
|
||||||
|
go.wit.com/gui/widget
|
||||||
|
go.wit.com/gui/gui
|
||||||
|
go.wit.com/gui/toolkits
|
||||||
|
go.wit.com/gui/debugger
|
||||||
|
|
||||||
|
go.wit.com/gui/gadgets
|
||||||
|
go.wit.com/gui/gadgets/repostatus
|
||||||
|
go.wit.com/gui/digitalocean
|
||||||
|
go.wit.com/gui/cloudflare
|
||||||
|
|
||||||
|
go.wit.com/apps/control-panel-dns main
|
||||||
|
go.wit.com/apps/control-panel-vpn
|
||||||
|
go.wit.com/apps/autotypist
|
41
scan.go
41
scan.go
|
@ -36,26 +36,37 @@ func (r *repo) newScan() bool {
|
||||||
|
|
||||||
cbname := r.status.GetCurrentBranchName()
|
cbname := r.status.GetCurrentBranchName()
|
||||||
cbversion := r.status.GetCurrentBranchVersion()
|
cbversion := r.status.GetCurrentBranchVersion()
|
||||||
ltversion := r.status.GetLastTagVersion()
|
lasttag := r.status.GetLastTagVersion()
|
||||||
r.lastLabel.Set(cbname + "\n" + cbversion)
|
r.lastTag.Set(lasttag)
|
||||||
r.vLabel.Set(cbname + "\n" + ltversion)
|
r.vLabel.Set(cbname + " " + cbversion)
|
||||||
|
|
||||||
if r.status.CheckDirty() {
|
status := r.getStatus()
|
||||||
log.Warn("CheckDirty() true")
|
if status == "dirty" {
|
||||||
r.dirtyLabel.Set("dirty")
|
r.dirtyLabel.Set(status)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
log.Warn("CheckDirty() no")
|
if status == "merge" {
|
||||||
r.dirtyLabel.Set("not dirty")
|
r.dirtyLabel.Set(status)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if status == "PERFECT" {
|
||||||
|
r.dirtyLabel.Set(status)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
r.dirtyLabel.Set("unknown " + status)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *repo) getStatus() string {
|
||||||
|
if r.status.CheckDirty() {
|
||||||
|
log.Warn("CheckDirty() true")
|
||||||
|
return "dirty"
|
||||||
|
}
|
||||||
|
|
||||||
if r.status.CheckBranches() {
|
if r.status.CheckBranches() {
|
||||||
log.Warn("Branches are Perfect")
|
log.Warn("Branches are Perfect")
|
||||||
r.dirtyLabel.SetText("PERFECT")
|
return "PERFECT"
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
log.Warn("Branches are not Perfect")
|
|
||||||
r.dirtyLabel.SetText("merge")
|
|
||||||
}
|
}
|
||||||
|
log.Warn("Branches are not Perfect")
|
||||||
return false
|
return "merge"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ var reposwin *gadgets.BasicWindow
|
||||||
var reposbox *gui.Node
|
var reposbox *gui.Node
|
||||||
var reposgrid *gui.Node
|
var reposgrid *gui.Node
|
||||||
var reposgroup *gui.Node
|
var reposgroup *gui.Node
|
||||||
|
var cmds *gui.Node
|
||||||
|
var script [][]string
|
||||||
|
var doit *gui.Node
|
||||||
|
|
||||||
var allrepos []*repo
|
var allrepos []*repo
|
||||||
|
|
||||||
|
@ -20,11 +23,11 @@ type repo struct {
|
||||||
path string
|
path string
|
||||||
lasttagrev string
|
lasttagrev string
|
||||||
lasttag string
|
lasttag string
|
||||||
tags []string
|
// tags []string
|
||||||
|
|
||||||
pLabel *gui.Node // path label
|
pLabel *gui.Node // path label
|
||||||
bLabel *gui.Node // branch label
|
// bLabel *gui.Node // branch label
|
||||||
lastLabel *gui.Node // last tagged version label
|
lastTag *gui.Node // last tagged version label
|
||||||
vLabel *gui.Node // version label
|
vLabel *gui.Node // version label
|
||||||
// tagsDrop *gui.Node // list of all tags
|
// tagsDrop *gui.Node // list of all tags
|
||||||
dirtyLabel *gui.Node // git state (dirty or not?)
|
dirtyLabel *gui.Node // git state (dirty or not?)
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
"go.wit.com/gui/gadgets/repostatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
var repopath string = "/home/jcarr/"
|
||||||
|
|
||||||
|
func runCommands() bool {
|
||||||
|
for _, line := range script {
|
||||||
|
s := strings.Join(line, " ")
|
||||||
|
log.Warn("NEED TO RUN:", s)
|
||||||
|
err, b, output := repostatus.RunCmd(repopath, line)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("ABEND EXECUTION")
|
||||||
|
log.Warn("error =", err)
|
||||||
|
log.Warn("output =", output)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
log.Warn("Returned with b =", b)
|
||||||
|
log.Warn("output was =", output)
|
||||||
|
log.Warn("RUN DONE")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func setGitCommands() {
|
||||||
|
var tmp []string
|
||||||
|
// convert to displayable to the user text
|
||||||
|
for _, line := range script {
|
||||||
|
s := strings.Join(line, " ")
|
||||||
|
log.Warn("s =", s)
|
||||||
|
tmp = append(tmp, s)
|
||||||
|
}
|
||||||
|
cmds.Set(strings.Join(tmp, "\n"))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue