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/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
)
|
||||
|
||||
func doesExist(path string) bool {
|
||||
|
@ -24,14 +24,6 @@ func doesExist(path string) bool {
|
|||
|
||||
// only errors on bad errors
|
||||
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() {
|
||||
log.Warn("RUN --dry-run", fullpath, cmd)
|
||||
return false
|
||||
|
@ -39,19 +31,19 @@ func quickCmd(fullpath string, cmd []string) bool {
|
|||
log.Warn("RUN:", fullpath, cmd)
|
||||
}
|
||||
|
||||
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
||||
if err != nil {
|
||||
log.Warn("cmd =", cmd)
|
||||
log.Warn("err =", err)
|
||||
log.Warn("b =", b)
|
||||
log.Warn("output =", string(output))
|
||||
result := shell.PathRun(fullpath, cmd)
|
||||
if result.Error != nil {
|
||||
log.Warn("quickCmd() cmd =", cmd)
|
||||
log.Warn("quickCmd() err =", result.Error)
|
||||
log.Warn("quickCmd() b =", result.Exit)
|
||||
log.Warn("quickCmd() output =", result.Stdout)
|
||||
return false
|
||||
} else if !b {
|
||||
log.Warn("b =", b)
|
||||
log.Warn("output =", string(output))
|
||||
} else if result.Exit != 0 {
|
||||
log.Warn("quickCmd() b =", result.Exit)
|
||||
log.Warn("quickCmd() output =", result.Stdout)
|
||||
return true
|
||||
}
|
||||
log.Warn("output = ", string(output))
|
||||
log.Warn("quickCmd() output = ", result.Stdout)
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -97,78 +89,3 @@ func globalBuildOptions(vbox *gui.Node) {
|
|||
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
|
||||
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")
|
||||
})
|
||||
*/
|
||||
|
|
|
@ -154,7 +154,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
|||
patchdir := filepath.Join(me.userHomePwd.String(), dirname)
|
||||
if shell.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)
|
||||
if !shell.Exists(patchdir) {
|
||||
|
|
Loading…
Reference in New Issue