repostatus/update.go

58 lines
1.2 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 05:59:12 -06:00
func (rs *RepoStatus) UpdateNew() {
log.Info("gui update", rs.pb.GetFullPath())
rs.updateNew()
}
2024-02-20 14:45:43 -06:00
func (rs *RepoStatus) updateNew() {
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()
rs.checkCurrentBranchVersion()
// read in the tags
2024-02-16 11:41:29 -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
2024-02-16 17:55:13 -06:00
// store the last tag version
rs.setLastTagVersion()
// 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
}
2024-02-19 16:29:10 -06:00
func (rs *RepoStatus) Update() {
if !rs.Ready() {
2024-01-09 15:34:53 -06:00
log.Log(WARN, "can't update yet. ready is false")
log.Error(errors.New("Update() is not ready yet"))
return
}
log.Log(INFO, "Update() START")
2025-01-07 19:29:46 -06:00
rs.updateNew()
log.Log(INFO, "Update() END")
2024-01-09 15:34:53 -06:00
}