experiment with widget 'mirror'
This commit is contained in:
parent
be73f6af0e
commit
ad21d5d5db
36
common.go
36
common.go
|
@ -3,6 +3,7 @@ package repostatus
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
// "go.wit.com/gui/gui"
|
||||
)
|
||||
|
@ -41,7 +42,7 @@ func (rs *RepoStatus) GoName() string {
|
|||
|
||||
// not sure which name is easier to remember. probably this one
|
||||
func (rs *RepoStatus) GoPath() string {
|
||||
return rs.goSrcPath.String()
|
||||
return rs.goPath.String()
|
||||
}
|
||||
|
||||
// returns the filesystem path to the repo
|
||||
|
@ -49,22 +50,6 @@ func (rs *RepoStatus) Path() string {
|
|||
return rs.realPath.String()
|
||||
}
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) GetPath() string {
|
||||
return rs.path.String()
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) Draw() {
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "Draw() window ready =", rs.ready)
|
||||
rs.window.TestDraw()
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) Show() {
|
||||
if !rs.Ready() {
|
||||
return
|
||||
|
@ -190,3 +175,20 @@ func (rs *RepoStatus) SetTargetVersion(s string) {
|
|||
// func (rs *RepoStatus) setTag() bool {
|
||||
rs.targetReleaseVersion.SetText(s)
|
||||
}
|
||||
|
||||
// returns a widget of the last tag that acts as a mirror
|
||||
func (rs *RepoStatus) MirrorLastTag() *gui.Node {
|
||||
return rs.lasttag.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorTargetVersion() *gui.Node {
|
||||
return rs.targetReleaseVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorCurrentVersion() *gui.Node {
|
||||
return rs.currentVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorCurrentName() *gui.Node {
|
||||
return rs.currentBranch.MirrorValue()
|
||||
}
|
||||
|
|
1
draw.go
1
draw.go
|
@ -13,6 +13,7 @@ func (rs *RepoStatus) drawGitStatus(box *gui.Node) {
|
|||
|
||||
rs.path = gadgets.NewOneLiner(newgrid, "path")
|
||||
rs.goSrcPath = gadgets.NewOneLiner(newgrid, "~/go/src")
|
||||
rs.goPath = gadgets.NewOneLiner(newgrid, "go path")
|
||||
rs.realPath = gadgets.NewOneLiner(newgrid, "full path")
|
||||
rs.isGoLang = gadgets.NewOneLiner(newgrid, "Is GO Lang?")
|
||||
rs.isGoLang.SetText("false")
|
||||
|
|
44
merge.go
44
merge.go
|
@ -79,30 +79,30 @@ func (rs *RepoStatus) runFullAutomation() bool {
|
|||
}
|
||||
log.Warn("THINGS SEEM OK returned true. can run this again?")
|
||||
/*
|
||||
log.Warn("develMerge =", rs.develMergeB.String())
|
||||
label := "merge devel into " + rs.GetMasterBranchName()
|
||||
if label == rs.develMergeB.String() {
|
||||
log.Warn("LABELS MATCH", label, rs.develMergeB.String())
|
||||
if !rs.RunDevelMergeB() {
|
||||
log.Warn("THINGS FAILED returned false")
|
||||
return false
|
||||
}
|
||||
}
|
||||
if rs.develMergeB.String() == "ready to release" {
|
||||
log.Warn("THINGS SEEM OK ready to release")
|
||||
if rs.releaseVersion.String() == "Release!" {
|
||||
log.Warn("releaseVersion == 'Release!'. safe to do release version HERE?")
|
||||
log.Warn("rs.newversion =", rs.newversion.String())
|
||||
log.Warn("rs.targetReleaseVersion =", rs.targetReleaseVersion.String())
|
||||
log.Warn("Are these equal?")
|
||||
if rs.newversion.String() == rs.targetReleaseVersion.String() {
|
||||
log.Warn("THEY ARE EQUAL!")
|
||||
rs.runReleaseVersionB()
|
||||
} else {
|
||||
log.Warn("THEY ARE NOT EQUAL")
|
||||
log.Warn("develMerge =", rs.develMergeB.String())
|
||||
label := "merge devel into " + rs.GetMasterBranchName()
|
||||
if label == rs.develMergeB.String() {
|
||||
log.Warn("LABELS MATCH", label, rs.develMergeB.String())
|
||||
if !rs.RunDevelMergeB() {
|
||||
log.Warn("THINGS FAILED returned false")
|
||||
return false
|
||||
}
|
||||
}
|
||||
if rs.develMergeB.String() == "ready to release" {
|
||||
log.Warn("THINGS SEEM OK ready to release")
|
||||
if rs.releaseVersion.String() == "Release!" {
|
||||
log.Warn("releaseVersion == 'Release!'. safe to do release version HERE?")
|
||||
log.Warn("rs.newversion =", rs.newversion.String())
|
||||
log.Warn("rs.targetReleaseVersion =", rs.targetReleaseVersion.String())
|
||||
log.Warn("Are these equal?")
|
||||
if rs.newversion.String() == rs.targetReleaseVersion.String() {
|
||||
log.Warn("THEY ARE EQUAL!")
|
||||
rs.runReleaseVersionB()
|
||||
} else {
|
||||
log.Warn("THEY ARE NOT EQUAL")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true
|
||||
}
|
||||
|
|
17
new.go
17
new.go
|
@ -33,6 +33,9 @@ func FindPathOld(path string) *RepoStatus {
|
|||
}
|
||||
|
||||
func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
||||
var realpath string
|
||||
var isGoLang bool = false
|
||||
|
||||
if windowMap[path] == nil {
|
||||
log.Log(INFO, "NewRepoStatusWindow() adding new", path)
|
||||
} else {
|
||||
|
@ -41,8 +44,6 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
|||
return nil, windowMap[path]
|
||||
}
|
||||
|
||||
var realpath string
|
||||
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Log(WARN, "Error getting home directory:", err)
|
||||
|
@ -50,6 +51,10 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
|||
}
|
||||
goSrcDir := filepath.Join(homeDir, "go/src")
|
||||
|
||||
rs := &RepoStatus{
|
||||
ready: false,
|
||||
}
|
||||
|
||||
// allow arbitrary paths, otherwise, assume the repo is in ~/go/src
|
||||
if strings.HasPrefix(path, "/") {
|
||||
realpath = path
|
||||
|
@ -59,6 +64,7 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
|||
realpath = filepath.Join(homeDir, tmp)
|
||||
} else {
|
||||
realpath = filepath.Join(goSrcDir, path)
|
||||
isGoLang = true
|
||||
}
|
||||
|
||||
filename := filepath.Join(realpath, ".git/config")
|
||||
|
@ -70,9 +76,6 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
|||
return err, nil
|
||||
}
|
||||
|
||||
rs := &RepoStatus{
|
||||
ready: false,
|
||||
}
|
||||
rs.tags = make(map[string]string)
|
||||
rs.window = gadgets.RawBasicWindow("GO Repo Details " + path)
|
||||
rs.window.Horizontal()
|
||||
|
@ -123,6 +126,10 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) {
|
|||
// sets this to os.Username
|
||||
rs.setUserWorkingName()
|
||||
|
||||
if isGoLang {
|
||||
rs.isGoLang.SetText("true")
|
||||
rs.goPath.SetText(path)
|
||||
}
|
||||
windowMap[path] = rs
|
||||
return nil, rs
|
||||
}
|
||||
|
|
|
@ -28,16 +28,17 @@ type RepoStatus struct {
|
|||
|
||||
path *gadgets.OneLiner
|
||||
goSrcPath *gadgets.OneLiner
|
||||
goPath *gadgets.OneLiner
|
||||
realPath *gadgets.OneLiner
|
||||
isGoLang *gadgets.OneLiner
|
||||
|
||||
currentBranch *gadgets.OneLiner
|
||||
currentVersion *gadgets.OneLiner
|
||||
|
||||
lasttag *gadgets.OneLiner
|
||||
mainBranchVersion *gadgets.OneLiner
|
||||
develBranchVersion *gadgets.OneLiner
|
||||
userBranchVersion *gadgets.OneLiner
|
||||
lasttag *gadgets.OneLiner
|
||||
mainBranchVersion *gadgets.OneLiner
|
||||
develBranchVersion *gadgets.OneLiner
|
||||
userBranchVersion *gadgets.OneLiner
|
||||
|
||||
mainWorkingName *gadgets.OneLiner
|
||||
develWorkingName *gadgets.OneLiner
|
||||
|
|
Loading…
Reference in New Issue