gets jcarr,devel and master branch info
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1f52d3083e
commit
0d01d82766
26
git.go
26
git.go
|
@ -12,12 +12,24 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *repo) checkoutBranch(branch string) {
|
func (r *repo) checkoutBranch(branch string) {
|
||||||
if ! r.checkDirty() {
|
if r.checkDirty() {
|
||||||
out := run(r.path, "git", "checkout " + branch)
|
return
|
||||||
log.Warn(r.path, "git checkout " + branch, "returned", out)
|
}
|
||||||
|
out := run(r.path, "git", "checkout " + branch)
|
||||||
|
log.Warn(r.path, "git checkout " + branch, "returned", out)
|
||||||
|
|
||||||
|
realname := r.getCurrentBranchName()
|
||||||
|
realversion := r.getCurrentBranchVersion()
|
||||||
|
log.Warn(r.path, "realname =", realname, "realversion =", realversion)
|
||||||
|
if realname == "jcarr" {
|
||||||
|
r.jcarrVersion.Set(realversion)
|
||||||
|
}
|
||||||
|
if realname == "devel" {
|
||||||
|
r.develVersion.Set(realversion)
|
||||||
|
}
|
||||||
|
if realname == "master" {
|
||||||
|
r.masterVersion.Set(realversion)
|
||||||
}
|
}
|
||||||
r.getCurrentBranchName()
|
|
||||||
r.getCurrentBranchVersion()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) getBranch() {
|
func (r *repo) getBranch() {
|
||||||
|
@ -28,11 +40,11 @@ func (r *repo) getBranch() {
|
||||||
func (r *repo) checkDirty() bool {
|
func (r *repo) checkDirty() bool {
|
||||||
out := run(r.path, "git", "diff-index HEAD")
|
out := run(r.path, "git", "diff-index HEAD")
|
||||||
if out == "" {
|
if out == "" {
|
||||||
r.sLabel.SetText("")
|
r.dirtyLabel.SetText("")
|
||||||
r.pButton.Disable()
|
r.pButton.Disable()
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
r.sLabel.SetText("dirty")
|
r.dirtyLabel.SetText("dirty")
|
||||||
r.pButton.Enable()
|
r.pButton.Enable()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
28
main.go
28
main.go
|
@ -24,7 +24,11 @@ type repo struct {
|
||||||
lastLabel *gui.Node // last tagged version label
|
lastLabel *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
|
||||||
sLabel *gui.Node // git state (dirty or not?)
|
dirtyLabel *gui.Node // git state (dirty or not?)
|
||||||
|
|
||||||
|
masterVersion *gui.Node // the master branch version
|
||||||
|
develVersion *gui.Node // the devel branch version
|
||||||
|
jcarrVersion *gui.Node // the jcarr branch version
|
||||||
|
|
||||||
cButton *gui.Node // commit button
|
cButton *gui.Node // commit button
|
||||||
pButton *gui.Node // push button
|
pButton *gui.Node // push button
|
||||||
|
@ -34,6 +38,12 @@ func main() {
|
||||||
myGui = gui.New().Default()
|
myGui = gui.New().Default()
|
||||||
|
|
||||||
helloworld()
|
helloworld()
|
||||||
|
checkrepos()
|
||||||
|
for _, r := range allrepos {
|
||||||
|
r.checkoutBranch("master")
|
||||||
|
r.checkoutBranch("devel")
|
||||||
|
r.checkoutBranch("jcarr")
|
||||||
|
}
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +56,11 @@ func addRepo(grid *gui.Node, path string) *repo {
|
||||||
newRepo.lastLabel = grid.NewLabel("")
|
newRepo.lastLabel = grid.NewLabel("")
|
||||||
newRepo.tagsDrop = grid.NewDropdown("tags")
|
newRepo.tagsDrop = grid.NewDropdown("tags")
|
||||||
newRepo.vLabel = grid.NewLabel("")
|
newRepo.vLabel = grid.NewLabel("")
|
||||||
newRepo.sLabel = grid.NewLabel("")
|
|
||||||
|
newRepo.masterVersion = grid.NewLabel("")
|
||||||
|
newRepo.develVersion = grid.NewLabel("")
|
||||||
|
newRepo.jcarrVersion = grid.NewLabel("")
|
||||||
|
newRepo.dirtyLabel = grid.NewLabel("")
|
||||||
|
|
||||||
newRepo.cButton = grid.NewButton("commit", func () {
|
newRepo.cButton = grid.NewButton("commit", func () {
|
||||||
log.Println("commit")
|
log.Println("commit")
|
||||||
|
@ -66,13 +80,16 @@ func helloworld() {
|
||||||
box := win.Box().NewBox("bw vbox", false)
|
box := win.Box().NewBox("bw vbox", false)
|
||||||
box2 := win.Box().NewBox("bw vbox", false)
|
box2 := win.Box().NewBox("bw vbox", false)
|
||||||
group := box.NewGroup("test")
|
group := box.NewGroup("test")
|
||||||
grid := group.NewGrid("test", 8, 1)
|
grid := group.NewGrid("test", 11, 1)
|
||||||
|
|
||||||
grid.NewLabel("go repo")
|
grid.NewLabel("go repo")
|
||||||
grid.NewLabel("branch")
|
grid.NewLabel("branch")
|
||||||
grid.NewLabel("last tag")
|
grid.NewLabel("last tag")
|
||||||
grid.NewLabel("tags")
|
|
||||||
grid.NewLabel("Version")
|
grid.NewLabel("Version")
|
||||||
|
grid.NewLabel("tags")
|
||||||
|
grid.NewLabel("master")
|
||||||
|
grid.NewLabel("devel")
|
||||||
|
grid.NewLabel("jcarr")
|
||||||
grid.NewLabel("is dirty?")
|
grid.NewLabel("is dirty?")
|
||||||
grid.NewLabel("commit")
|
grid.NewLabel("commit")
|
||||||
grid.NewLabel("push to")
|
grid.NewLabel("push to")
|
||||||
|
@ -90,9 +107,6 @@ func helloworld() {
|
||||||
addRepo(grid, "go.wit.com/gui/digitalocean")
|
addRepo(grid, "go.wit.com/gui/digitalocean")
|
||||||
addRepo(grid, "go.wit.com/gui/cloudflare")
|
addRepo(grid, "go.wit.com/gui/cloudflare")
|
||||||
|
|
||||||
box2.NewButton("checkrepos()", func () {
|
|
||||||
checkrepos()
|
|
||||||
})
|
|
||||||
box2.NewButton("checkout jcarr (all repos)", func () {
|
box2.NewButton("checkout jcarr (all repos)", func () {
|
||||||
for _, r := range allrepos {
|
for _, r := range allrepos {
|
||||||
r.checkoutBranch("jcarr")
|
r.checkoutBranch("jcarr")
|
||||||
|
|
8
unix.go
8
unix.go
|
@ -32,9 +32,13 @@ func run(path string, thing string, cmdline string) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp := string(output)
|
||||||
|
|
||||||
|
tmp = strings.TrimSpace(tmp)
|
||||||
|
|
||||||
// Print the output
|
// Print the output
|
||||||
log.Info(string(output))
|
log.Info("run()", path, thing, cmdline, "=", tmp)
|
||||||
return string(output)
|
return tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
func listFiles(directory string) []string {
|
func listFiles(directory string) []string {
|
||||||
|
|
Loading…
Reference in New Issue