diff options
| author | Jeff Carr <[email protected]> | 2025-01-30 11:02:37 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-30 11:02:37 -0600 | 
| commit | b91475b55b93a87aabb63e661a46d85c28623eb9 (patch) | |
| tree | d9dd098e1ce66e47aa21fa6e41d61ee83658677b | |
| parent | 8247d748bd26be6eb87a978573b0d435e83178a1 (diff) | |
| -rw-r--r-- | common.go | 7 | ||||
| -rw-r--r-- | newRepo.go | 6 | ||||
| -rw-r--r-- | scan.go | 16 | ||||
| -rw-r--r-- | structs.go | 47 | ||||
| -rw-r--r-- | watchdog.go | 2 | 
5 files changed, 40 insertions, 38 deletions
@@ -7,6 +7,7 @@ import (  	"sort"  	"github.com/go-cmd/cmd" +	"go.wit.com/lib/protobuf/gitpb"  	"go.wit.com/log"  ) @@ -62,7 +63,7 @@ func (r *RepoRow) State() string {  }  func (r *RepoRow) Scan() int { -	return r.NewScan() +	return r.Update()  }  // returns a name for human consuption only @@ -75,6 +76,10 @@ func (r *RepoRow) GetGoPath() string {  	return r.pb.GetGoPath()  } +func (r *RepoRow) GetPb() *gitpb.Repo { +	return r.pb +} +  func (r *RepoRow) CheckDirty() bool {  	return r.pb.CheckDirty()  } @@ -111,11 +111,11 @@ func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {  		newRepo.Xterm("git diff; bash")  		pb := newRepo.pb  		pb.Reload() -		newRepo.NewScan() +		newRepo.Update()  		r.reposbox.Enable()  	}) -	newRepo.endBox.NewButton("commit all", func() { +	newRepo.commitB = newRepo.endBox.NewButton("commit all", func() {  		pb := newRepo.pb  		if pb == nil {  			log.Info("the protobuf is nil. something went wrong in the forge/gitpb mappings") @@ -139,7 +139,7 @@ func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {  			pb.RunRealtimeVerbose([]string{"git", "restore", "--staged", "."})  		}  		pb.Reload() -		newRepo.NewScan() +		newRepo.Update()  		r.reposbox.Enable()  	}) @@ -12,14 +12,14 @@ func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) {  	me.hideFunction = f  } -func (r *RepoList) ScanRepositories() (int, string) { +func (r *RepoList) ScanRepositoriesOld() (int, string) {  	var i int  	var shown int  	var total int  	t := TimeFunction(func() {  		for _, repo := range me.allrepos {  			i += 1 -			changed := repo.NewScan() +			changed := repo.Update()  			total += changed  		}  		var hidden int @@ -44,7 +44,7 @@ func (r *RepoRow) UpdatePb(newpb *gitpb.Repo) {  	r.pb = newpb  } -func (r *RepoRow) NewScan() int { +func (r *RepoRow) Update() int {  	var changed int = 0  	if r.Status == nil {  		log.Log(WARN, "repo.Status = nil. not initialized for some reason") @@ -61,7 +61,7 @@ func (r *RepoRow) NewScan() int {  	}  	// run the repostatus update -	r.Status.Update() +	// r.Status.Update()  	r.masterVersion.SetLabel(pb.GetMasterVersion())  	r.develVersion.SetLabel(pb.GetDevelVersion()) @@ -70,6 +70,14 @@ func (r *RepoRow) NewScan() int {  	r.currentName.SetLabel(pb.GetCurrentBranchName())  	r.currentVersion.SetLabel(pb.GetCurrentBranchVersion()) +	// disable the commit button if the repo is not on the user branch +	if pb.GetCurrentBranchName() == pb.GetUserBranchName() { +		r.commitB.Enable() +	} else { +		r.commitB.Disable() +	} + +	// TODO: finally make this alot smarter  	if r.State() == "merge to main" {  		r.Hide()  	} @@ -39,39 +39,28 @@ type RepoList struct {  	reposgrid  *gui.Node  	reposgroup *gui.Node -	// put things here that can't be seen -	blind *gui.Node - +	blind        *gui.Node // put things here that can't be seen  	shownCount   *gui.Node  	hideFunction func(*RepoRow)  	duration     *gui.Node - -	rows []*RepoRow +	rows         []*RepoRow  }  type RepoRow struct { -	hidden     bool -	lasttagrev string -	// lasttag    string -	giturl string -	pb     *gitpb.Repo - -	pLabel *gui.Node // path label - -	targetV        *gui.Node // the target version -	lastTag        *gui.Node // last tagged version label -	currentName    *gui.Node // current branch name -	currentVersion *gui.Node // current branch version -	// gitState       *gui.Node // git state (dirty or not?) -	pbState *gui.Node // the state of the protobuf - -	masterVersion *gui.Node // the master branch version -	develVersion  *gui.Node // the devel branch version -	userVersion   *gui.Node // the user branch version - -	endBox       *gui.Node // a general box at the end of the row -	statusButton *gui.Node // opens up the status window -	diffButton   *gui.Node // opens up the status window - -	Status *repostatus.RepoStatus +	hidden         bool                   // is it currently hidden from view? +	pb             *gitpb.Repo            // the underlying protobuf +	pLabel         *gui.Node              // path label +	targetV        *gui.Node              // the target version +	lastTag        *gui.Node              // last tagged version label +	currentName    *gui.Node              // current branch name +	currentVersion *gui.Node              // current branch version +	pbState        *gui.Node              // the state of the protobuf +	masterVersion  *gui.Node              // the master branch version +	develVersion   *gui.Node              // the devel branch version +	userVersion    *gui.Node              // the user branch version +	endBox         *gui.Node              // a general box at the end of the row +	statusButton   *gui.Node              // opens up the status window +	diffButton     *gui.Node              // opens up the status window +	Status         *repostatus.RepoStatus // todo: move that code here? +	commitB        *gui.Node              // the git commit button  } diff --git a/watchdog.go b/watchdog.go index 87a2141..572f046 100644 --- a/watchdog.go +++ b/watchdog.go @@ -42,7 +42,7 @@ func (r *RepoList) Watchdog(f func()) {  			return  		}  		i = 0 -		r.ScanRepositories() +		r.ScanRepositoriesOld()  		f()  	})  }  | 
