use go-cmd/cmd
This commit is contained in:
parent
d0107ef034
commit
a26ae2bcc1
|
@ -10,7 +10,7 @@ import (
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repolist"
|
"go.wit.com/lib/gui/repolist"
|
||||||
"go.wit.com/lib/gui/repostatus"
|
"go.wit.com/lib/gui/shell"
|
||||||
)
|
)
|
||||||
|
|
||||||
func doesExist(path string) bool {
|
func doesExist(path string) bool {
|
||||||
|
@ -24,14 +24,6 @@ func doesExist(path string) bool {
|
||||||
|
|
||||||
// only errors on bad errors
|
// only errors on bad errors
|
||||||
func quickCmd(fullpath string, cmd []string) bool {
|
func quickCmd(fullpath string, cmd []string) bool {
|
||||||
var err error
|
|
||||||
var b bool
|
|
||||||
var output string
|
|
||||||
|
|
||||||
// if me.autoWorkingPwd.String() != fullpath {
|
|
||||||
// me.autoWorkingPwd.SetValue(fullpath)
|
|
||||||
// }
|
|
||||||
|
|
||||||
if me.autoDryRun.Checked() {
|
if me.autoDryRun.Checked() {
|
||||||
log.Warn("RUN --dry-run", fullpath, cmd)
|
log.Warn("RUN --dry-run", fullpath, cmd)
|
||||||
return false
|
return false
|
||||||
|
@ -39,19 +31,19 @@ func quickCmd(fullpath string, cmd []string) bool {
|
||||||
log.Warn("RUN:", fullpath, cmd)
|
log.Warn("RUN:", fullpath, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
result := shell.PathRun(fullpath, cmd)
|
||||||
if err != nil {
|
if result.Error != nil {
|
||||||
log.Warn("cmd =", cmd)
|
log.Warn("quickCmd() cmd =", cmd)
|
||||||
log.Warn("err =", err)
|
log.Warn("quickCmd() err =", result.Error)
|
||||||
log.Warn("b =", b)
|
log.Warn("quickCmd() b =", result.Exit)
|
||||||
log.Warn("output =", string(output))
|
log.Warn("quickCmd() output =", result.Stdout)
|
||||||
return false
|
return false
|
||||||
} else if !b {
|
} else if result.Exit != 0 {
|
||||||
log.Warn("b =", b)
|
log.Warn("quickCmd() b =", result.Exit)
|
||||||
log.Warn("output =", string(output))
|
log.Warn("quickCmd() output =", result.Stdout)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
log.Warn("output = ", string(output))
|
log.Warn("quickCmd() output = ", result.Stdout)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,78 +89,3 @@ func globalBuildOptions(vbox *gui.Node) {
|
||||||
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
|
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
}
|
}
|
||||||
|
|
||||||
// this code isn't ready yet
|
|
||||||
/*
|
|
||||||
s.gitPullB = grid.NewButton("git pull", func() {
|
|
||||||
me.Disable()
|
|
||||||
defer me.Enable()
|
|
||||||
for _, repo := range repolist.AllRepos() {
|
|
||||||
// gitcmd := []string{"git", "fetch", "origin"}
|
|
||||||
gitcmd := []string{"git", "pull"}
|
|
||||||
err, output := repo.RunCmd(gitcmd)
|
|
||||||
log.Info("output =", output)
|
|
||||||
if err == nil {
|
|
||||||
log.Info("git fetch worked", repo.Name())
|
|
||||||
} else {
|
|
||||||
log.Info("git fetch failed", repo.Name())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gitPullB.SetText("GOOD")
|
|
||||||
// update the stats
|
|
||||||
// s.Update()
|
|
||||||
})
|
|
||||||
|
|
||||||
s.gitPushB = grid.NewButton("git push", func() {
|
|
||||||
me.Disable()
|
|
||||||
defer me.Enable()
|
|
||||||
for _, repo := range repolist.AllRepos() {
|
|
||||||
gitcmd := []string{"git", "push"}
|
|
||||||
err, output := repo.RunCmd(gitcmd)
|
|
||||||
log.Info("output =", output)
|
|
||||||
if err == nil {
|
|
||||||
log.Info("git push worked", repo.Name())
|
|
||||||
} else {
|
|
||||||
log.Info("git push failed", repo.Name())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s.gitPushB.SetText("GOOD")
|
|
||||||
// update the stats
|
|
||||||
s.Update()
|
|
||||||
})
|
|
||||||
|
|
||||||
s.checkB = s.grid.NewButton("Check repos are working", func() {
|
|
||||||
me.Disable()
|
|
||||||
defer me.Enable()
|
|
||||||
for _, repo := range repolist.AllRepos() {
|
|
||||||
if repo.GitURL() != "" {
|
|
||||||
log.Info("repo already checked. do they match?")
|
|
||||||
log.Info("go.wit.com =", repo.GoURL())
|
|
||||||
log.Info("localurl =", repo.Path())
|
|
||||||
} else {
|
|
||||||
ok, giturl := gowit.CheckRegistered(repo)
|
|
||||||
if ok {
|
|
||||||
log.Info("is url correct?", repo.Path(), "vs", giturl)
|
|
||||||
repo.giturl = giturl
|
|
||||||
if giturl != repo.Path() {
|
|
||||||
log.Info("repo check failed", repo.String())
|
|
||||||
s.unknownOL.SetText(repo.String())
|
|
||||||
s.unknownOL.Show()
|
|
||||||
s.unknownSubmitB.Show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Info("repo check failed", repo.String())
|
|
||||||
repo.giturl = "look in .git/config"
|
|
||||||
s.unknownOL.SetText(repo.String())
|
|
||||||
s.unknownOL.Show()
|
|
||||||
s.unknownSubmitB.Show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s.checkB.SetText("GOOD")
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
|
|
|
@ -150,11 +150,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.submitB = s.grid.NewButton("Create Patch Set", func() {
|
s.submitB = s.grid.NewButton("Create Patch Set", 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) {
|
||||||
log.Info("patchset dir already exists", patchdir)
|
log.Info("patchset dir already exists", patchdir)
|
||||||
shell.RunCmd(me.userHomePwd.String(), []string{"rm", "-rf", dirname})
|
shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname})
|
||||||
}
|
}
|
||||||
shell.Mkdir(patchdir)
|
shell.Mkdir(patchdir)
|
||||||
if !shell.Exists(patchdir) {
|
if !shell.Exists(patchdir) {
|
||||||
|
|
Loading…
Reference in New Issue