verify with go.wit.com repos work
This commit is contained in:
parent
3f5fcdf68b
commit
e30194627e
|
@ -145,6 +145,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
newRepo.status.Xterm([]string{"git add --all"})
|
newRepo.status.Xterm([]string{"git add --all"})
|
||||||
newRepo.status.XtermNohup([]string{"git diff --cached"})
|
newRepo.status.XtermNohup([]string{"git diff --cached"})
|
||||||
newRepo.status.Xterm([]string{"git commit -a"})
|
newRepo.status.Xterm([]string{"git commit -a"})
|
||||||
|
newRepo.status.Xterm([]string{"git push"})
|
||||||
if newRepo.status.CheckDirty() {
|
if newRepo.status.CheckDirty() {
|
||||||
// commit was not done, restore diff
|
// commit was not done, restore diff
|
||||||
newRepo.status.Xterm([]string{"git restore --staged ."})
|
newRepo.status.Xterm([]string{"git restore --staged ."})
|
||||||
|
|
|
@ -18,11 +18,13 @@ type patch struct {
|
||||||
rs *repostatus.RepoStatus
|
rs *repostatus.RepoStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type patchSummary struct {
|
type patchSummary struct {
|
||||||
grid *gui.Node
|
grid *gui.Node
|
||||||
updateB *gui.Node
|
updateB *gui.Node
|
||||||
docsB *gui.Node
|
docsB *gui.Node
|
||||||
|
gitPushB *gui.Node
|
||||||
|
gitPullB *gui.Node
|
||||||
|
checkB *gui.Node
|
||||||
|
|
||||||
totalOL *gadgets.OneLiner
|
totalOL *gadgets.OneLiner
|
||||||
dirtyOL *gadgets.OneLiner
|
dirtyOL *gadgets.OneLiner
|
||||||
|
@ -49,30 +51,78 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.Update()
|
s.Update()
|
||||||
})
|
})
|
||||||
|
|
||||||
s.updateB = s.grid.NewButton("List Patches", func() {
|
s.grid.NewButton("List Patches", func() {
|
||||||
for i, p := range s.allp {
|
for i, p := range s.allp {
|
||||||
log.Info(i, p.ref, p.rs.String())
|
log.Info(i, p.ref, p.rs.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
s.updateB = s.grid.NewButton("Check repos are working", func() {
|
s.gitPullB = s.grid.NewButton("git pull", func() {
|
||||||
me.Disable()
|
me.Disable()
|
||||||
defer me.Enable()
|
defer me.Enable()
|
||||||
for _, repo := range me.allrepos {
|
for _, repo := range me.allrepos {
|
||||||
// log.Info("Check repo here:", repo.String())
|
// gitcmd := []string{"git", "fetch", "origin"}
|
||||||
ok, giturl := gowit.CheckRegistered(repo.status)
|
gitcmd := []string{"git", "pull"}
|
||||||
if ok {
|
err, output := repo.status.RunCmd(gitcmd)
|
||||||
log.Info("is url correct?", repo.String(), "vs", giturl)
|
log.Info("output =", output)
|
||||||
repo.giturl = giturl
|
if err == nil {
|
||||||
|
log.Info("git fetch worked", repo.String())
|
||||||
} else {
|
} else {
|
||||||
log.Info("repo check failed", repo.String())
|
log.Info("git fetch failed", repo.String())
|
||||||
repo.giturl = "look in .git/config"
|
|
||||||
s.unknownOL.SetText(repo.String())
|
|
||||||
s.unknownOL.Show()
|
|
||||||
s.unknownSubmitB.Show()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s.gitPullB.SetText("GOOD")
|
||||||
|
})
|
||||||
|
|
||||||
|
s.gitPushB = s.grid.NewButton("git push", func() {
|
||||||
|
me.Disable()
|
||||||
|
defer me.Enable()
|
||||||
|
for _, repo := range me.allrepos {
|
||||||
|
gitcmd := []string{"git", "push"}
|
||||||
|
err, output := repo.status.RunCmd(gitcmd)
|
||||||
|
log.Info("output =", output)
|
||||||
|
if err == nil {
|
||||||
|
log.Info("git push worked", repo.String())
|
||||||
|
} else {
|
||||||
|
log.Info("git push failed", repo.String())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.gitPushB.SetText("GOOD")
|
||||||
|
})
|
||||||
|
|
||||||
|
s.checkB = s.grid.NewButton("Check repos are working", func() {
|
||||||
|
me.Disable()
|
||||||
|
defer me.Enable()
|
||||||
|
for _, repo := range me.allrepos {
|
||||||
|
if repo.giturl != "" {
|
||||||
|
log.Info("repo already checked. do they match?", repo.String())
|
||||||
|
log.Info("go.wit.com =", repo.giturl)
|
||||||
|
log.Info("localurl =", repo.status.GitURL())
|
||||||
|
} else {
|
||||||
|
ok, giturl := gowit.CheckRegistered(repo.status)
|
||||||
|
if ok {
|
||||||
|
log.Info("is url correct?", repo.String(), "vs", giturl)
|
||||||
|
repo.giturl = giturl
|
||||||
|
if giturl != repo.status.GitURL() {
|
||||||
|
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")
|
||||||
})
|
})
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
|
@ -94,7 +144,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Info("what is this?", s.unknownOL.String())
|
log.Info("what is this?", s.unknownOL.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
s.unknownOL.Hide()
|
s.unknownOL.Hide()
|
||||||
|
@ -155,8 +205,9 @@ func (s *patchSummary) Update() {
|
||||||
}
|
}
|
||||||
if dirty == 0 {
|
if dirty == 0 {
|
||||||
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches")
|
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches")
|
||||||
s.submitB.Enable()
|
|
||||||
s.reason.Enable()
|
s.reason.Enable()
|
||||||
|
// force the user to submit a reason to enable the submit button
|
||||||
|
// s.submitB.Enable()
|
||||||
} else {
|
} else {
|
||||||
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches + ? dirty")
|
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches + ? dirty")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue