diff options
Diffstat (limited to 'submitPatches.go')
| -rw-r--r-- | submitPatches.go | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/submitPatches.go b/submitPatches.go index 337d82a..32bedff 100644 --- a/submitPatches.go +++ b/submitPatches.go @@ -6,10 +6,19 @@ import ( "go.wit.com/gui" "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/gowit" "go.wit.com/lib/gui/repostatus" "go.wit.com/log" ) +type patch struct { + ref string + giturl string + comment string + rs *repostatus.RepoStatus +} + + type patchSummary struct { grid *gui.Node updateB *gui.Node @@ -20,6 +29,9 @@ type patchSummary struct { readonlyOL *gadgets.OneLiner totalPatchesOL *gadgets.OneLiner + unknownOL *gadgets.OneLiner + unknownSubmitB *gui.Node + reason *gadgets.BasicEntry submitB *gui.Node @@ -44,12 +56,49 @@ func submitPatchesBox(box *gui.Node) *patchSummary { }) s.updateB = s.grid.NewButton("Check repos are working", func() { + me.Disable() + defer me.Enable() for _, repo := range me.allrepos { - log.Info("Check repo here:", repo.String()) - return + // log.Info("Check repo here:", repo.String()) + ok, giturl := gowit.CheckRegistered(repo.status) + if ok { + log.Info("is url correct?", repo.String(), "vs", giturl) + repo.giturl = giturl + } 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.grid.NextRow() + s.unknownOL = gadgets.NewOneLiner(s.grid, "Unknown Repo:") + s.unknownSubmitB = s.grid.NewButton("Register Repo", func() { + log.Info("Submit repo:", s.unknownOL.String()) + repo, ok := me.allrepos[s.unknownOL.String()] + if ok { + log.Info("found repo:", repo.String(), "with giturl", repo.giturl) + localurl := repo.status.GitURL() + if localurl == "" { + log.Info("local repo check failed. repo is not uploaded?") + } else { + log.Info("local repo has", localurl) + // attempts to register the unknown repo + if gowit.Register(repo.String(), localurl) { + s.unknownOL.Hide() + s.unknownSubmitB.Hide() + } + } + } else { + log.Info("what is this?", s.unknownOL.String()) + } + }) + s.unknownOL.Hide() + s.unknownSubmitB.Hide() s.grid.NextRow() s.totalOL = gadgets.NewOneLiner(s.grid, "Total") @@ -113,12 +162,6 @@ func (s *patchSummary) Update() { } } -type patch struct { - ref string - comment string - rs *repostatus.RepoStatus -} - func (s *patchSummary) GetPatches() (int, []*patch) { var patchcount int patches := make([]*patch, 0, 0) |
