more removal of old code

This commit is contained in:
Jeff Carr 2025-01-07 22:28:50 -06:00
parent fcb74ce2e8
commit a15d447fbd
Notes: Jeff Carr 2025-01-08 04:42:09 -06:00
// `autogen:go.mod`

module go.wit.com/lib/gui/repostatus

go 1.21

toolchain go1.23.4

require (
	go.wit.com/gui v0.22.20
	go.wit.com/lib/gadgets v0.22.5
	go.wit.com/lib/gui/shell v0.22.20
	go.wit.com/lib/protobuf/gitpb v0.0.46
	go.wit.com/lib/protobuf/virtbuf v0.2.17
	go.wit.com/log v0.22.9
)

require (
	github.com/destel/rill v0.6.0 // indirect
	github.com/go-cmd/cmd v1.4.3 // indirect
	github.com/google/uuid v1.6.0 // indirect
	go.wit.com/dev/alexflint/arg v1.5.5 // indirect
	go.wit.com/dev/alexflint/scalar v1.2.4 // indirect
	go.wit.com/widget v1.1.27 // indirect
	google.golang.org/protobuf v1.36.2 // indirect
)

// `autogen:go.sum`

github.com/destel/rill v0.6.0 h1:8MQRzS6k0akKmwNZFahKIhG1dkBeNxMoWKSfOxkaJNw=
github.com/destel/rill v0.6.0/go.mod h1:srKuXzvGqINUEGYR5b/iwvW+L9/S35RxVHWGYbXNoO4=
github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.wit.com/dev/alexflint/arg v1.5.5 h1:c4jgIb4OvHjnCMRNSjOa1sNLl6WDxV6tIkMVezR9hCk=
go.wit.com/dev/alexflint/arg v1.5.5/go.mod h1:nH3F6TJDaAUgnLkC0WgRN/H047YfN1TYKaWPYr6B8lo=
go.wit.com/dev/alexflint/scalar v1.2.4 h1:zmBeEkObwz1lcelwfGNYP2GS6SQ9e0tdv7JdHwMZEEk=
go.wit.com/dev/alexflint/scalar v1.2.4/go.mod h1:kCNO1Fo5LnnK6+qa+zYhP5fdgfC1C+vx1ti99Md+FAM=
go.wit.com/gui v0.22.20 h1:2B2zdHtHhiijBHugu8415p2o5z3DPUbrgjdkOGb/evo=
go.wit.com/gui v0.22.20/go.mod h1:U7Bw4dw+x+sfHhru/jKS9I5APxXdiQIF5B2luJH1cE8=
go.wit.com/lib/gadgets v0.22.5 h1:sDBSIVb+MflU705ImwKFvP9hnnZdLVrwy+Xsgp/w7dw=
go.wit.com/lib/gadgets v0.22.5/go.mod h1:Hiap8lateez6bts/DFmu+HSX9y8rgCfmusnG/CiTuGM=
go.wit.com/lib/gui/shell v0.22.20 h1:iVPXL1h1Qri1WrymjfgTy0gRGEepj6+w2e6kSVaBtUk=
go.wit.com/lib/gui/shell v0.22.20/go.mod h1:zduuMSWq+EE7w0xbXn+vkoGZ4HJhURVJpvXw8oK9WAU=
go.wit.com/lib/protobuf/gitpb v0.0.46 h1:4kyXt7/H5BzN8vsn1dQ7gh4hCeRCrgmUWMlP5BPFTz4=
go.wit.com/lib/protobuf/gitpb v0.0.46/go.mod h1:xsOTXiBxgCu82qG0z5B0qybzMIALf2T/LJ1nP5SSZLg=
go.wit.com/lib/protobuf/virtbuf v0.2.17 h1:cTOB0MvafTLuB4DnzOrPKzfD3m+ezz+p/N9TUhGneqY=
go.wit.com/lib/protobuf/virtbuf v0.2.17/go.mod h1:SzNaf2Gcux4cxfFPSIV2Gz8Dcu2hc2IIHXcmk9k7nPg=
go.wit.com/log v0.22.9 h1:aBM6SI2kxlJcBfS/osFTomJqNhO0hfEo1gk+LCqLk7Y=
go.wit.com/log v0.22.9/go.mod h1:4uNPFBqhsAh8zNF+zxVEmC3c/9AZ8JeTfUUvRpddvLQ=
go.wit.com/widget v1.1.27 h1:Yd+qp6GZVwLiTTepShXSeWSDqjaCxLyfhU0ch2FrPZ8=
go.wit.com/widget v1.1.27/go.mod h1:OXIdWk7GhVJRLnHTvf45LbPNXGYG/JjbkfnmXtkoiYE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

// `autogen:`
3 changed files with 6 additions and 32 deletions

28
git.go
View File

@ -89,20 +89,6 @@ func (rs *RepoStatus) gitDescribeByName(name string) (string, error) {
return strings.TrimSpace(output), r.Error return strings.TrimSpace(output), r.Error
} }
// todo: don't run git every time?
func (rs *RepoStatus) checkCurrentBranchVersion() string {
out := rs.pb.GetCurrentVersion()
rs.currentVersion.SetValue(out)
return out
}
// this should get the most recent tag
func (rs *RepoStatus) setLastTagVersion() {
name := rs.pb.GetLastTagVersion()
rs.lasttag.SetText(name)
return
}
func (rs *RepoStatus) populateTags() { func (rs *RepoStatus) populateTags() {
tmp := rs.realPath.String() + "/.git/refs/tags" tmp := rs.realPath.String() + "/.git/refs/tags"
log.Log(REPO, "populateTags() path =", tmp) log.Log(REPO, "populateTags() path =", tmp)
@ -115,17 +101,3 @@ func (rs *RepoStatus) populateTags() {
} }
// rs.tagsDrop.SetText(rs.lasttagrev) // rs.tagsDrop.SetText(rs.lasttagrev)
} }
// returns quickly based on the last time it was checked
func (rs *RepoStatus) IsDirty() bool {
return rs.pb.IsDirty()
}
func (rs *RepoStatus) CheckDirty() bool {
if rs.pb.IsDirty() {
rs.dirtyLabel.SetValue("dirty")
return true
}
rs.dirtyLabel.SetValue("")
return false
}

View File

@ -15,7 +15,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
}) })
newgrid.NewButton("CheckDirty()", func() { newgrid.NewButton("CheckDirty()", func() {
if rs.CheckDirty() { if rs.pb.CheckDirty() {
log.Log(WARN, "is dirty") log.Log(WARN, "is dirty")
} else { } else {
log.Log(WARN, "is not dirty") log.Log(WARN, "is not dirty")

View File

@ -17,7 +17,8 @@ func (rs *RepoStatus) Update() {
// store the current checked out branch name and version // store the current checked out branch name and version
rs.checkCurrentBranchName() rs.checkCurrentBranchName()
rs.checkCurrentBranchVersion() out := rs.pb.GetCurrentVersion()
rs.currentVersion.SetValue(out)
// read in the tags // read in the tags
rs.populateTags() rs.populateTags()
@ -25,8 +26,9 @@ func (rs *RepoStatus) Update() {
// record if the repo is dirty // record if the repo is dirty
pb.CheckDirty() pb.CheckDirty()
// store the last tag version // display the last tag version
rs.setLastTagVersion() name := rs.pb.GetLastTagVersion()
rs.lasttag.SetText(name)
// store the master branch version // store the master branch version
ver := pb.GetMasterVersion() ver := pb.GetMasterVersion()