repostatus/update.go

50 lines
1.0 KiB
Go
Raw Normal View History

2024-01-09 15:34:53 -06:00
package repostatus
import (
"errors"
2024-01-09 15:34:53 -06:00
"go.wit.com/log"
)
2025-01-07 20:39:30 -06:00
func (rs *RepoStatus) Update() {
2024-02-16 11:41:29 -06:00
if !rs.Ready() {
log.Log(WARN, "can't update yet. ready is false")
log.Error(errors.New("Update() is not ready yet"))
return
}
2024-02-16 17:55:13 -06:00
2025-01-07 04:58:05 -06:00
pb := rs.pb
2024-02-16 17:55:13 -06:00
// store the current checked out branch name and version
rs.checkCurrentBranchName()
2025-01-07 22:28:50 -06:00
out := rs.pb.GetCurrentVersion()
rs.currentVersion.SetValue(out)
2024-02-16 17:55:13 -06:00
// read in the tags
2025-01-18 15:48:52 -06:00
// rs.populateTags()
2024-02-16 17:55:13 -06:00
// record if the repo is dirty
2025-01-07 04:58:05 -06:00
pb.CheckDirty()
2024-02-16 11:41:29 -06:00
2025-01-07 22:28:50 -06:00
// display the last tag version
name := rs.pb.GetLastTagVersion()
rs.lasttag.SetText(name)
2024-02-16 17:55:13 -06:00
// store the master branch version
2025-01-07 04:58:05 -06:00
ver := pb.GetMasterVersion()
rs.mainBranchVersion.SetValue(ver)
2024-02-16 11:41:29 -06:00
2025-01-07 04:58:05 -06:00
rs.develBranchVersion.SetValue(pb.GetDevelVersion())
rs.userBranchVersion.SetValue(pb.GetUserVersion())
2024-02-19 16:29:10 -06:00
// populates a string into the rs.gitState widget
// todo: make the values from this function a bit cleaner
rs.CheckGitState()
2024-02-16 11:41:29 -06:00
}
2025-01-07 20:39:30 -06:00
func (rs *RepoStatus) CheckGitState() string {
state := rs.pb.GetState()
rs.gitState.SetText(state)
return state
2025-01-07 20:39:30 -06:00
}