diff --git a/human.go b/human.go index 6e1dece..ec2997c 100644 --- a/human.go +++ b/human.go @@ -36,7 +36,7 @@ func msg(w http.ResponseWriter, s string) { func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty string, perfect string) { var count int - header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s", + header := fmt.Sprintf("%-35s %5s %-20s %-20s %-20s %-20s %-15s", "REPO", "AGE", "LAST", "MASTER", "DEVEL", "USER", "STATE") @@ -88,7 +88,7 @@ func (r *RepoRow) StandardReleaseHeader() string { curname := r.Status.GetCurrentBranchName() master := r.Status.GetMasterVersion() - user := r.Status.GetUserVersion() + user := r.Status.GetUserVersion() target := r.Status.GetTargetVersion() header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s", @@ -103,12 +103,11 @@ func (r *RepoRow) StandardReleaseHeader() string { return header } - func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) { var count int - header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s", - "REPO", "AGE", "CUR BR", + header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-20s %-15s", + "REPO", "AGE", "CUR BR", "LAST", "MASTER", "TARGET", "USER", "STATE") msg(w, header) diff --git a/newRepo.go b/newRepo.go index ec68be8..1069e28 100644 --- a/newRepo.go +++ b/newRepo.go @@ -23,9 +23,6 @@ func (r *RepoRow) Hide() { r.gitState.Hide() r.endBox.Hide() - // r.statusButton.Hide() - // r.diffButton.Hide() - // r.goState.Hide() r.targetV.Hide() r.hidden = true } @@ -42,9 +39,22 @@ func (r *RepoRow) Show() { r.gitState.Show() r.endBox.Show() - // r.statusButton.Show() - // r.diffButton.Show() - // r.goState.Show() + r.targetV.Show() + r.hidden = false +} + +func (r *RepoRow) Show2() { + r.pLabel.Show() + r.lastTag.Show() + r.currentName.Show() + r.currentVersion.Show() + + r.masterVersion.Show() + r.develVersion.Show() + r.userVersion.Show() + + r.gitState.Show() + r.endBox.Show() r.targetV.Show() r.hidden = false } @@ -80,9 +90,30 @@ func (r *RepoList) NewRepo(path string) (*RepoRow, error) { } r.reposgrid.NextRow() newRepo.Status.InitOk = true + newRepo.Hide() return newRepo, nil } +func (r *RepoList) ShowRepo(repo *RepoRow) error { + newRow := new(RepoRow) + + newRow.pLabel = r.reposgrid.NewLabel(repo.Status.Path()) + newRow.targetV = r.reposgrid.NewLabel(repo.Status.GetTargetVersion()) + newRow.lastTag = r.reposgrid.NewLabel(repo.Status.LastTag()) + + newRow.currentName = r.reposgrid.NewLabel(repo.Status.GetCurrentBranchName()) + newRow.currentVersion = r.reposgrid.NewLabel(repo.Status.GetCurrentVersion()) + + newRow.gitState = r.reposgrid.NewLabel(repo.Status.GitState()) + newRow.masterVersion = r.reposgrid.NewLabel(repo.Status.GetMasterVersion()) + newRow.develVersion = r.reposgrid.NewLabel(repo.Status.GetDevelVersion()) + newRow.userVersion = r.reposgrid.NewLabel(repo.Status.GetUserVersion()) + + newRow.hidden = false + r.reposgrid.NextRow() + return nil +} + func (r *RepoList) makeAutotypistView(newRepo *RepoRow) { grid := r.reposgrid diff --git a/scanIterator.go b/scanIterator.go index 7f347b2..6ca2970 100644 --- a/scanIterator.go +++ b/scanIterator.go @@ -63,6 +63,16 @@ func (r *RepoList) ReposSortByName() *RepoIterator { return iterator } +func (r *RepoList) UnmergedRepos() *RepoIterator { + repoPointers := r.selectRepoAll() + + sort.Sort(ByName(repoPointers)) + + iterator := NewRepoIterator(repoPointers) + + return iterator +} + type ByName []*RepoRow func (a ByName) Len() int { return len(a) } @@ -92,3 +102,36 @@ func (r *RepoList) selectRepoAll() []*RepoRow { return repoPointers } + +// SelectRepoPointers safely returns a slice of pointers to Repo records. +func (r *RepoList) selectUnmergedRepos() []*RepoRow { + r.RLock() + defer r.RUnlock() + + // Create a new slice to hold pointers to each Repo + // repoPointers := make([]*Repo, len(c.E.Repos)) + var repoPointers []*RepoRow + for _, repo := range me.allrepos { + if repo == nil { + continue + } + if repo.Status == nil { + continue + } + if !repo.Status.InitOk { + continue + } + if repo.ReadOnly() { + continue + } + if repo.State() == "PERFECT" { + continue + } + if repo.Status.IsReleased() { + continue + } + repoPointers = append(repoPointers, repo) // Copy pointers for safe iteration + } + + return repoPointers +} diff --git a/viewTempWindow.go b/viewTempWindow.go new file mode 100644 index 0000000..1d66992 --- /dev/null +++ b/viewTempWindow.go @@ -0,0 +1,31 @@ +package repolist + +import "go.wit.com/gui" + +// This creates a view of the repos +// you can only have one at this point +func TempWindowView(parent *gui.Node) *RepoList { + tmp := new(RepoList) + tmp.viewName = "autotypist" + + // me.reposbox = gui.RawBox() + tmp.reposbox = parent + + tmp.reposgroup = tmp.reposbox.NewGroup("git repositories that are not merged") + tmp.reposgrid = tmp.reposgroup.NewGrid("mergegrid", 0, 0) + + tmp.reposgrid.NewLabel("") // path goes here + tmp.reposgrid.NewLabel("last tag").SetProgName("last tag") + tmp.reposgrid.NewLabel("master version") + tmp.reposgrid.NewLabel("devel version") + tmp.reposgrid.NewLabel("user version") + tmp.reposgrid.NewLabel("Status") + tmp.reposgrid.NewLabel("Current").SetProgName("CurrentName") + tmp.reposgrid.NewLabel("Version").SetProgName("CurrentVersion") + + tmp.reposgrid.NextRow() + + tmp.shownCount = me.blind.NewLabel("showCount") + tmp.duration = me.blind.NewLabel("duration") + return tmp +}