allow more fields to be mirrored
This commit is contained in:
parent
ad21d5d5db
commit
ae7e9ba42c
20
common.go
20
common.go
|
@ -192,3 +192,23 @@ func (rs *RepoStatus) MirrorCurrentVersion() *gui.Node {
|
|||
func (rs *RepoStatus) MirrorCurrentName() *gui.Node {
|
||||
return rs.currentBranch.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorGitState() *gui.Node {
|
||||
return rs.gitState.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorGoState() *gui.Node {
|
||||
return rs.goSumStatus.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorMasterVersion() *gui.Node {
|
||||
return rs.mainBranchVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorDevelVersion() *gui.Node {
|
||||
return rs.develBranchVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorUserVersion() *gui.Node {
|
||||
return rs.userBranchVersion.MirrorValue()
|
||||
}
|
||||
|
|
1
draw.go
1
draw.go
|
@ -25,6 +25,7 @@ func (rs *RepoStatus) drawGitStatus(box *gui.Node) {
|
|||
rs.userWorkingName.SetValue("uid")
|
||||
|
||||
rs.dirtyLabel = gadgets.NewOneLiner(newgrid, "dirty")
|
||||
rs.gitState = gadgets.NewOneLiner(newgrid, "git state")
|
||||
rs.readOnly = gadgets.NewOneLiner(newgrid, "read only")
|
||||
rs.goSumStatus = gadgets.NewOneLiner(newgrid, "go mod status")
|
||||
rs.targetReleaseVersion = gadgets.NewOneLiner(newgrid, "target release version")
|
||||
|
|
30
git.go
30
git.go
|
@ -408,28 +408,46 @@ func (rs *RepoStatus) setUserVersion(s string) {
|
|||
rs.userBranchVersion.SetValue(s)
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) GitState() string {
|
||||
return rs.gitState.String()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) CheckGitState() string {
|
||||
rs.setState()
|
||||
return rs.gitState.String()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) GetStatus() string {
|
||||
return rs.gitState.String()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) setState() {
|
||||
rs.changed = false
|
||||
if rs.CheckDirty() {
|
||||
log.Log(INFO, "CheckDirty() true")
|
||||
return "dirty"
|
||||
rs.gitState.SetText("dirty")
|
||||
return
|
||||
}
|
||||
if rs.GetUserVersion() != rs.GetDevelVersion() {
|
||||
return "merge to devel"
|
||||
rs.gitState.SetText("merge to devel")
|
||||
return
|
||||
}
|
||||
if rs.GetDevelVersion() != rs.GetMasterVersion() {
|
||||
return "merge to main"
|
||||
rs.gitState.SetText("merge to main")
|
||||
return
|
||||
}
|
||||
if rs.lasttag.String() != rs.GetMasterVersion() {
|
||||
return "unchanged"
|
||||
rs.gitState.SetText("unchanged")
|
||||
return
|
||||
}
|
||||
|
||||
if rs.CheckBranches() {
|
||||
log.Log(INFO, "Branches are Perfect")
|
||||
return "PERFECT"
|
||||
rs.gitState.SetText("PERFECT")
|
||||
return
|
||||
}
|
||||
log.Log(INFO, rs.String(), "Branches are not Perfect")
|
||||
return "unknown branches"
|
||||
rs.gitState.SetText("unknown branches")
|
||||
}
|
||||
|
||||
// TODO: make this report the error somewhere
|
||||
|
|
|
@ -25,6 +25,7 @@ type RepoStatus struct {
|
|||
dirtyLabel *gadgets.OneLiner
|
||||
readOnly *gadgets.OneLiner
|
||||
goSumStatus *gadgets.OneLiner
|
||||
gitState *gadgets.OneLiner
|
||||
|
||||
path *gadgets.OneLiner
|
||||
goSrcPath *gadgets.OneLiner
|
||||
|
|
41
update.go
41
update.go
|
@ -65,11 +65,13 @@ func (rs *RepoStatus) UpdateNew() {
|
|||
out, _ = rs.gitDescribeByName(uName)
|
||||
rs.setUserVersion(out)
|
||||
}
|
||||
|
||||
// populates a string into the rs.gitState widget
|
||||
// todo: make the values from this function a bit cleaner
|
||||
rs.CheckGitState()
|
||||
}
|
||||
|
||||
/*
|
||||
// deprecate / redo what is left of this
|
||||
func (rs *RepoStatus) UpdateOld() {
|
||||
func (rs *RepoStatus) Update() {
|
||||
if !rs.Ready() {
|
||||
log.Log(WARN, "can't update yet. ready is false")
|
||||
log.Error(errors.New("Update() is not ready yet"))
|
||||
|
@ -78,39 +80,10 @@ func (rs *RepoStatus) UpdateOld() {
|
|||
log.Log(INFO, "Update() START")
|
||||
duration := timeFunction(func() {
|
||||
rs.UpdateNew()
|
||||
|
||||
if rs.dirtyLabel.String() != "no" {
|
||||
log.Warn("dirty label != no. actual value:", rs.dirtyLabel.String())
|
||||
rs.DisableEverything()
|
||||
rs.CheckBranches()
|
||||
return
|
||||
}
|
||||
|
||||
master := rs.mainWorkingName.String()
|
||||
devel := rs.develWorkingName.String()
|
||||
user := rs.userWorkingName.String()
|
||||
|
||||
// rs.CheckDirty() this runs
|
||||
log.Log(INFO, "checkoutBranch", master)
|
||||
rs.checkoutBranch("master", master)
|
||||
log.Log(INFO, "checkoutBranch", devel)
|
||||
rs.checkoutBranch("devel", devel)
|
||||
log.Log(INFO, "checkoutBranch", user)
|
||||
rs.checkoutBranch("user", user)
|
||||
|
||||
rs.recommend()
|
||||
rs.CheckBranches()
|
||||
|
||||
label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String()
|
||||
rs.develMergeB.SetLabel(label)
|
||||
|
||||
label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String()
|
||||
rs.mainMergeB.SetLabel(label)
|
||||
})
|
||||
rs.setSpeed(duration)
|
||||
log.Log(INFO, "Update() END")
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) setSpeed(duration time.Duration) {
|
||||
s := fmt.Sprint(duration)
|
||||
|
@ -120,9 +93,9 @@ func (rs *RepoStatus) setSpeed(duration time.Duration) {
|
|||
}
|
||||
rs.speedActual.SetValue(s)
|
||||
|
||||
if duration > 500*time.Millisecond {
|
||||
if duration > 200*time.Millisecond {
|
||||
rs.speed.SetValue("SLOW")
|
||||
} else if duration > 100*time.Millisecond {
|
||||
} else if duration > 50*time.Millisecond {
|
||||
rs.speed.SetValue("OK")
|
||||
} else {
|
||||
rs.speed.SetValue("FAST")
|
||||
|
|
Loading…
Reference in New Issue