From b91475b55b93a87aabb63e661a46d85c28623eb9 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 Jan 2025 11:02:37 -0600 Subject: switching from the old way to using protobuf --- scan.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'scan.go') diff --git a/scan.go b/scan.go index 9249076..27b2e8c 100644 --- a/scan.go +++ b/scan.go @@ -12,14 +12,14 @@ func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) { me.hideFunction = f } -func (r *RepoList) ScanRepositories() (int, string) { +func (r *RepoList) ScanRepositoriesOld() (int, string) { var i int var shown int var total int t := TimeFunction(func() { for _, repo := range me.allrepos { i += 1 - changed := repo.NewScan() + changed := repo.Update() total += changed } var hidden int @@ -44,7 +44,7 @@ func (r *RepoRow) UpdatePb(newpb *gitpb.Repo) { r.pb = newpb } -func (r *RepoRow) NewScan() int { +func (r *RepoRow) Update() int { var changed int = 0 if r.Status == nil { log.Log(WARN, "repo.Status = nil. not initialized for some reason") @@ -61,7 +61,7 @@ func (r *RepoRow) NewScan() int { } // run the repostatus update - r.Status.Update() + // r.Status.Update() r.masterVersion.SetLabel(pb.GetMasterVersion()) r.develVersion.SetLabel(pb.GetDevelVersion()) @@ -70,6 +70,14 @@ func (r *RepoRow) NewScan() int { r.currentName.SetLabel(pb.GetCurrentBranchName()) r.currentVersion.SetLabel(pb.GetCurrentBranchVersion()) + // disable the commit button if the repo is not on the user branch + if pb.GetCurrentBranchName() == pb.GetUserBranchName() { + r.commitB.Enable() + } else { + r.commitB.Disable() + } + + // TODO: finally make this alot smarter if r.State() == "merge to main" { r.Hide() } -- cgit v1.2.3