diff options
| author | Jeff Carr <[email protected]> | 2024-12-01 00:48:07 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-01 00:48:07 -0600 | 
| commit | afe21d3c626200fa647f9597f6037535d2d8554c (patch) | |
| tree | 7828ce4cdcf11e80f1d54e6e30344682df9cbaec | |
| parent | b1cdb841bc7240fc9aa929ad15a09f0ae618777b (diff) | |
| -rw-r--r-- | addRepo.go | 36 | ||||
| -rw-r--r-- | buildPackage.go | 2 | ||||
| -rw-r--r-- | controlBox.go | 3 | ||||
| -rw-r--r-- | main.go | 23 | ||||
| -rw-r--r-- | stateWindow.go | 5 | 
5 files changed, 29 insertions, 40 deletions
@@ -1,12 +1,10 @@  package main  import ( -	"os"  	"strings"  	"time"  	"go.wit.com/lib/gadgets" -	"go.wit.com/lib/gui/repostatus"  	"go.wit.com/log"  ) @@ -55,39 +53,23 @@ func (c *controlBox) addRepo(path string) {  	c.tagDate = gadgets.NewBasicEntry(c.grid, "git tag Date")  	c.grid.NextRow() -	err, repo := repostatus.NewRepoStatusWindow(path) -	if err != nil { -		log.Info("path did not work", path, err) -		return -	} -	if repo == nil { -		log.Info("repo == nil", path, err) -		os.Exit(-1) -		return -	} -	c.status = repo -	// c.status.SetMainWorkingName("master") -	// c.status.SetDevelWorkingName("devel") -	// c.status.SetUserWorkingName("jcarr") -	c.status.Update() +	cbname := repo.GetCurrentBranchName() +	cbversion := repo.GetCurrentBranchVersion() +	debversion := repo.DebianCurrentVersion() -	cbname := c.status.GetCurrentBranchName() -	cbversion := c.status.GetCurrentBranchVersion() -	debversion := c.status.DebianCurrentVersion() - -	if c.status.CheckDirty() { +	if repo.CheckDirty() {  		c.dirtyL.SetText("true")  	} else {  		c.dirtyL.SetText("false")  	}  	if c.GoPath.String() == "" { -		c.GoPath.SetText(c.status.GoPath()) +		c.GoPath.SetText(repo.GoPath)  	} -	lasttag := c.status.GetLastTagVersion() +	lasttag := repo.GetLastTagVersion()  	if argv.Release { -		debversion = c.status.DebianReleaseVersion() +		debversion = repo.DebianReleaseVersion()  		c.dirtyL.SetText("false")  	} @@ -99,9 +81,5 @@ func (c *controlBox) addRepo(path string) {  	tagDate := c.getDateStamp(lasttag)  	c.tagDate.SetText(tagDate) -	if s, ok := c.status.Changed(); ok { -		log.Warn("should scan here", s) -	} -  	return  } diff --git a/buildPackage.go b/buildPackage.go index 31d7faf..a3ab9ef 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -289,7 +289,7 @@ func (c *controlBox) computeControlValues() bool {  // stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")  func (c *controlBox) getDateStamp(tag string) string { -	r := c.status.Run([]string{"git", "log", "-1", "--format=%at", tag}) +	r := repo.Run([]string{"git", "log", "-1", "--format=%at", tag})  	out := strings.Join(r.Stdout, "\n")  	out = strings.TrimSpace(out) diff --git a/controlBox.go b/controlBox.go index ce86ad9..3edacb7 100644 --- a/controlBox.go +++ b/controlBox.go @@ -3,7 +3,6 @@ package main  import (  	"go.wit.com/gui"  	"go.wit.com/lib/gadgets" -	"go.wit.com/lib/gui/repostatus"  )  type controlBox struct { @@ -33,7 +32,7 @@ type controlBox struct {  	currentL  *gadgets.OneLiner  	buildDate *gadgets.OneLiner  	tagDate   *gadgets.BasicEntry -	status    *repostatus.RepoStatus +	// status    *repostatus.RepoStatus  }  // This initializes the control box @@ -9,6 +9,8 @@ import (  	"go.wit.com/lib/debugger"  	"go.wit.com/lib/gadgets"  	"go.wit.com/lib/gui/shell" +	"go.wit.com/lib/protobuf/gitpb" +	"go.wit.com/lib/protobuf/forgepb"  	"go.wit.com/log"  ) @@ -19,6 +21,10 @@ var DATE string  // This is the beginning of the binary tree of GUI widgets  var myGui *gui.Node +// this scans in the repos +var forge *forgepb.Forge +var repo *gitpb.Repo +  var cBox *controlBox  // this is a basic window. the user can open and close it @@ -34,6 +40,17 @@ func main() {  		println("go-deb --repo go.wit.com/apps/helloworld")  		os.Exit(0)  	} +	forge = forgepb.Init() +	os.Setenv("REPO_WORK_PATH", forge.GetGoSrc()) + +	repo = forge.Repos.FindByGoPath(argv.Repo) +	if repo == nil { +		log.Info("repo not found. you need to clone", argv.Repo) +		os.Exit(-1) +	} +	log.Info("found repo", argv.Repo) +	// build() +  	myGui = gui.New()  	if !argv.Auto {  		myGui.InitEmbed(resources) @@ -65,7 +82,7 @@ func main() {  	cBox.computeControlValues()  	// verify the values for the package -	if cBox.status == nil { +	if repo == nil {  		if argv.Repo == "." {  			// this means try the local directory for a custom 'control' file  		} else { @@ -79,8 +96,8 @@ func main() {  	}  	// set the working directory to argv.Repo -	log.Info("cd", cBox.status.Path()) -	os.Chdir(cBox.status.Path()) +	log.Info("cd", repo.FullPath) +	os.Chdir(repo.FullPath)  	if argv.Auto {  		shell.TestTerminalColor() diff --git a/stateWindow.go b/stateWindow.go index 7c4cd83..194f220 100644 --- a/stateWindow.go +++ b/stateWindow.go @@ -43,10 +43,5 @@ func makebasicWindow() *gadgets.BasicWindow {  		basicWindow.Enable()  	}) -	group1.NewButton("open repo", func() { -		cBox.status.Update() -		cBox.status.Toggle() -	}) -  	return basicWindow  }  | 
