diff options
| author | Jeff Carr <[email protected]> | 2025-11-05 15:29:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-11-05 15:29:40 -0600 |
| commit | 12b751cc7fbaa09f205c6207c355300f15885441 (patch) | |
| tree | d1ba97cbdc5f6d9c86d94206dc89eb1c878f7c97 | |
| parent | b7efa450a8a220625174f21ae15f9b7ea1cd3a3b (diff) | |
compiles against stat.protov0.0.182
| -rw-r--r-- | compare.go | 44 | ||||
| -rw-r--r-- | gitTag.byAge.go | 74 | ||||
| -rw-r--r-- | gitTag.common.go | 60 | ||||
| -rw-r--r-- | gitTag.proto | 27 | ||||
| -rw-r--r-- | reload.go | 4 | ||||
| -rw-r--r-- | reloadBranches.go | 8 | ||||
| -rw-r--r-- | reloadTags.go | 22 | ||||
| -rw-r--r-- | repo.proto | 7 | ||||
| -rw-r--r-- | tableForged.go | 18 | ||||
| -rw-r--r-- | tableGowebd.go | 6 |
10 files changed, 117 insertions, 153 deletions
@@ -10,7 +10,7 @@ import ( type RepoTag struct { r *Repo - t *GitTag + t *Stat } func (r *Repo) NewCompareTag(refname string) *RepoTag { @@ -24,7 +24,7 @@ func (r *Repo) NewCompareTag(refname string) *RepoTag { return rt } -func (r *Repo) NewCompareRef(t *GitTag) *RepoTag { +func (r *Repo) NewCompareRef(t *Stat) *RepoTag { if t == nil { return nil } @@ -35,24 +35,24 @@ func (r *Repo) NewCompareRef(t *GitTag) *RepoTag { } func (rt *RepoTag) GetRefname() string { - return rt.t.Refname + return rt.t.Name } -func (rt *RepoTag) GetRef() *GitTag { +func (rt *RepoTag) GetRef() *Stat { return rt.t } func (t1 *RepoTag) CompareBranch(t2 *RepoTag) ([]string, []string, []string, []string, error) { - lines1, cmd1, err1 := t1.r.CountDiffObjectsNEWNEW(t1.t.Refname, t2.t.Refname) - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) + lines1, cmd1, err1 := t1.r.CountDiffObjectsNEWNEW(t1.t.Name, t2.t.Name) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath) if err1 != nil { - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath, err) return nil, nil, cmd1, nil, err1 } - lines2, cmd2, err2 := t1.r.CountDiffObjectsNEWNEW(t2.t.Refname, t1.t.Refname) - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) + lines2, cmd2, err2 := t1.r.CountDiffObjectsNEWNEW(t2.t.Name, t1.t.Name) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath) if err2 != nil { - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath, err) return nil, nil, cmd1, cmd2, err2 } if (len(lines1) != 0) || (len(lines2) != 0) { @@ -63,15 +63,15 @@ func (t1 *RepoTag) CompareBranch(t2 *RepoTag) ([]string, []string, []string, []s func (r *Repo) CompareHashes(keepHash string, deleteHash string) ([]string, []string, []string, []string, error) { lines1, cmd1, err1 := r.CountDiffObjectsNEWNEW(keepHash, deleteHash) - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath) if err1 != nil { - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath, err) return nil, nil, cmd1, nil, err1 } lines2, cmd2, err2 := r.CountDiffObjectsNEWNEW(deleteHash, keepHash) - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath) if err2 != nil { - // log.Info("lessthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) + // log.Info("lessthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath, err) return nil, nil, cmd1, cmd2, err2 } if (len(lines1) != 0) || (len(lines2) != 0) { @@ -82,10 +82,10 @@ func (r *Repo) CompareHashes(keepHash string, deleteHash string) ([]string, []st /* func (t1 *RepoTag) LessThanVerbose(t2 *RepoTag) []string { - count, err := t1.r.CountDiffObjectsNew(t1.t.Refname, t2.t.Refname) - log.Info("lessthan", t1.t.Refname, t2.t.Refname, len(count), t1.r.FullPath) + count, err := t1.r.CountDiffObjectsNew(t1.t.Name, t2.t.Name) + log.Info("lessthan", t1.t.Name, t2.t.Name, len(count), t1.r.FullPath) if err != nil { - log.Info("lessthan", t1.t.Refname, t2.t.Refname, len(count), t1.r.FullPath, err) + log.Info("lessthan", t1.t.Name, t2.t.Name, len(count), t1.r.FullPath, err) return nil } if len(count) == 0 { @@ -101,8 +101,8 @@ func (t1 *RepoTag) Equal(t2 *RepoTag) bool { // if t1 is user branch, and t2 is devel branch, true if 0 func (t1 *RepoTag) GreaterThan(t2 *RepoTag) []string { - lines, _, err := t1.r.CountDiffObjectsNEWNEW(t2.t.Refname, t1.t.Refname) - // log.Info("greaterthan", t1.t.Refname, t2.t.Refname, count, t1.r.FullPath, err) + lines, _, err := t1.r.CountDiffObjectsNEWNEW(t2.t.Name, t1.t.Name) + // log.Info("greaterthan", t1.t.Name, t2.t.Name, count, t1.r.FullPath, err) if err != nil { return nil } @@ -112,15 +112,15 @@ func (t1 *RepoTag) GreaterThan(t2 *RepoTag) []string { return nil } -func (r *Repo) GetLocalUserRef() *GitTag { +func (r *Repo) GetLocalUserRef() *Stat { return r.IsBranchLocal(r.GetUserBranchName()) } -func (r *Repo) GetLocalDevelRef() *GitTag { +func (r *Repo) GetLocalDevelRef() *Stat { return r.IsBranchLocal(r.GetDevelBranchName()) } -func (r *Repo) GetLocalMasterRef() *GitTag { +func (r *Repo) GetLocalMasterRef() *Stat { return r.IsBranchLocal(r.GetMasterBranchName()) } diff --git a/gitTag.byAge.go b/gitTag.byAge.go index aac234d..33e4f37 100644 --- a/gitTag.byAge.go +++ b/gitTag.byAge.go @@ -12,8 +12,8 @@ import ( // todo: probably switch to using slices. new things added in 1.23 // https://pkg.go.dev/slices -func (all *GitTags) newSort() *GitTagScanner { - slices.SortFunc(all.GitTags, func(a, b *GitTag) int { +func (all *Stats) newSort() *StatScanner { + slices.SortFunc(all.Stats, func(a, b *Stat) int { if n := strings.Compare(a.Name, b.Name); n != 0 { return n } @@ -25,62 +25,62 @@ func (all *GitTags) newSort() *GitTagScanner { // all this code below is junk and seamingly wrong -func (all *GitTags) GetAge(name string) time.Time { - packs := all.selectAllGitTags() +func (all *Stats) GetAge(name string) time.Time { + packs := all.selectAllStats() var newest time.Time for _, tag := range packs { - // log.Info("\t\ttag", i, tag.Refname, tag.Authordate.AsTime()) - _, rname := filepath.Split(tag.Refname) + // log.Info("\t\ttag", i, tag.Name, tag.AuthorTime.AsTime()) + _, rname := filepath.Split(tag.Name) if name == rname { - // log.Info("\t\tfound tag", i, rbase, rname, tag.Authordate.AsTime()) - newest = tag.Authordate.AsTime() + // log.Info("\t\tfound tag", i, rbase, rname, tag.AuthorTime.AsTime()) + newest = tag.AuthorTime.AsTime() return newest } - newest = tag.Authordate.AsTime() + newest = tag.AuthorTime.AsTime() } return newest } -func (all *GitTags) SortByAge() *GitTagScanner { - packs := all.selectAllGitTags() +func (all *Stats) SortByAge() *StatScanner { + packs := all.selectAllStats() - sort.Sort(GitTagAge(packs)) + sort.Sort(StatAge(packs)) - iterator := newGitTagScanner(packs) + iterator := newStatScanner(packs) return iterator } -type GitTagAge []*GitTag +type StatAge []*Stat -func (a GitTagAge) Len() int { return len(a) } +func (a StatAge) Len() int { return len(a) } // sorts in ? order -func (a GitTagAge) Less(i, j int) bool { - if time.Since(a[i].Authordate.AsTime()) < time.Since(a[j].Authordate.AsTime()) { +func (a StatAge) Less(i, j int) bool { + if time.Since(a[i].AuthorTime.AsTime()) < time.Since(a[j].AuthorTime.AsTime()) { return true } return false } -func (a GitTagAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a StatAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] } // biased code that gives out newer tag dates // even if the code hasn't been patched func (repo *Repo) NewestAge() time.Duration { - alltags := repo.Tags.selectAllGitTags() + alltags := repo.Tags.selectAllStats() var newest time.Time for _, tag := range alltags { // check the actual age of the patch - if newest.Before(tag.Authordate.AsTime()) { - newest = tag.Authordate.AsTime() + if newest.Before(tag.AuthorTime.AsTime()) { + newest = tag.AuthorTime.AsTime() } // check the age of the commit - if newest.Before(tag.Creatordate.AsTime()) { - newest = tag.Creatordate.AsTime() + if newest.Before(tag.CommitTime.AsTime()) { + newest = tag.CommitTime.AsTime() } } @@ -88,18 +88,18 @@ func (repo *Repo) NewestAge() time.Duration { } func (repo *Repo) NewestTime() time.Time { - alltags := repo.Tags.selectAllGitTags() + alltags := repo.Tags.selectAllStats() var newest time.Time for _, tag := range alltags { // check the actual age of the patch - if newest.Before(tag.Authordate.AsTime()) { - newest = tag.Authordate.AsTime() + if newest.Before(tag.AuthorTime.AsTime()) { + newest = tag.AuthorTime.AsTime() } // check the age of the commit - if newest.Before(tag.Creatordate.AsTime()) { - newest = tag.Creatordate.AsTime() + if newest.Before(tag.CommitTime.AsTime()) { + newest = tag.CommitTime.AsTime() } } @@ -107,15 +107,15 @@ func (repo *Repo) NewestTime() time.Time { } func (repo *Repo) NewestAgeVerbose() time.Duration { - alltags := repo.Tags.selectAllGitTags() + alltags := repo.Tags.selectAllStats() var newest time.Time var cur time.Time for i, tag := range alltags { - cur = tag.Authordate.AsTime() - rbase, rname := filepath.Split(tag.Refname) - log.Info("\t\tfound tag", i, rbase, rname, tag.Authordate.AsTime(), tag.Creatordate.AsTime()) + cur = tag.AuthorTime.AsTime() + rbase, rname := filepath.Split(tag.Name) + log.Info("\t\tfound tag", i, rbase, rname, tag.AuthorTime.AsTime(), tag.CommitTime.AsTime()) if newest.Before(cur) { newest = cur } @@ -126,17 +126,17 @@ func (repo *Repo) NewestAgeVerbose() time.Duration { // not really accurate. temprorary until git Config() parsing is better func (repo *Repo) BranchAge(branch string) time.Duration { - alltags := repo.Tags.selectAllGitTags() + alltags := repo.Tags.selectAllStats() var newest time.Time var cur time.Time var auth time.Time for _, tag := range alltags { - cur = tag.Creatordate.AsTime() - auth = tag.Authordate.AsTime() - if branch == filepath.Base(tag.Refname) { - // log.Info("\t\tfound tag", i, branch, tag.Authordate.AsTime(), tag.Creatordate.AsTime()) + cur = tag.CommitTime.AsTime() + auth = tag.AuthorTime.AsTime() + if branch == filepath.Base(tag.Name) { + // log.Info("\t\tfound tag", i, branch, tag.AuthorTime.AsTime(), tag.CommitTime.AsTime()) if cur.Before(auth) { return time.Since(auth) } diff --git a/gitTag.common.go b/gitTag.common.go index 66e45e9..f6e5d1f 100644 --- a/gitTag.common.go +++ b/gitTag.common.go @@ -11,8 +11,8 @@ func (repo *Repo) ActualDevelHash() string { brname := repo.GetDevelBranchName() refname := "refs/heads/" + brname for tag := range repo.Tags.IterAll() { - // log.Info("repo tag", tag.GetHash(), tag.GetRefname()) - if tag.GetRefname() == refname { + // log.Info("repo tag", tag.GetHash(), tag.GetName()) + if tag.GetName() == refname { return tag.GetHash() } } @@ -37,8 +37,8 @@ func (repo *Repo) ActualGetMasterHash() (string, string) { func (repo *Repo) GetLocalHash(brname string) string { refname := "refs/heads/" + brname for tag := range repo.Tags.IterAll() { - // log.Info("repo tag", tag.GetHash(), tag.GetRefname()) - if tag.GetRefname() == refname { + // log.Info("repo tag", tag.GetHash(), tag.GetName()) + if tag.GetName() == refname { return strings.TrimSpace(tag.GetHash()) } } @@ -48,19 +48,19 @@ func (repo *Repo) GetLocalHash(brname string) string { func (repo *Repo) GetRemoteHash(brname string) string { refname := "refs/remotes/origin/" + brname for tag := range repo.Tags.IterAll() { - // log.Info("repo tag", tag.GetHash(), tag.GetRefname()) - if tag.GetRefname() == refname { + // log.Info("repo tag", tag.GetHash(), tag.GetName()) + if tag.GetName() == refname { return strings.TrimSpace(tag.GetHash()) } } return "" } -func (repo *Repo) GetRemoteTag(brname string) *GitTag { +func (repo *Repo) GetRemoteTag(brname string) *Stat { refname := "refs/remotes/origin/" + brname for tag := range repo.Tags.IterAll() { - // log.Info("repo tag", tag.GetHash(), tag.GetRefname()) - if tag.GetRefname() == refname { + // log.Info("repo tag", tag.GetHash(), tag.GetName()) + if tag.GetName() == refname { return tag } } @@ -74,7 +74,7 @@ func (repo *Repo) IsBranchRemote(brname string) bool { } brname = "refs/remotes/origin/" + brname - ref := repo.Tags.FindByRefname(brname) + ref := repo.Tags.FindByName(brname) if ref == nil { // log.Info("did not found refname!!!!!!!!", brname) return false @@ -98,7 +98,7 @@ func (repo *Repo) IsDevelRemote() bool { // eventually this will be worked out by forge in some future code that hasn't been made yet func (repo *Repo) IsBranch(findname string) bool { for t := range repo.Tags.IterAll() { - tagname := t.Refname + tagname := t.Name if strings.HasPrefix(tagname, "refs/remotes") { continue } @@ -113,12 +113,12 @@ func (repo *Repo) IsBranch(findname string) bool { return false } -func (repo *Repo) IsBranchLocal(findname string) *GitTag { +func (repo *Repo) IsBranchLocal(findname string) *Stat { for t := range repo.Tags.IterAll() { - if !strings.HasPrefix(t.Refname, "refs/heads") { + if !strings.HasPrefix(t.Name, "refs/heads") { continue } - _, filename := filepath.Split(t.Refname) + _, filename := filepath.Split(t.Name) // log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) if filename == findname { // log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath()) @@ -130,10 +130,10 @@ func (repo *Repo) IsBranchLocal(findname string) *GitTag { func (repo *Repo) IsLocalBranch(findname string) bool { for t := range repo.Tags.IterAll() { - if !strings.HasPrefix(t.Refname, "refs/heads") { + if !strings.HasPrefix(t.Name, "refs/heads") { continue } - path, filename := filepath.Split(t.Refname) + path, filename := filepath.Split(t.Name) log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) if filename == findname { log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath()) @@ -146,10 +146,10 @@ func (repo *Repo) IsLocalBranch(findname string) bool { func (repo *Repo) IsLocalBranchVerbose(findname string) bool { for t := range repo.Tags.IterAll() { - if !strings.HasPrefix(t.Refname, "refs/heads") { + if !strings.HasPrefix(t.Name, "refs/heads") { continue } - path, filename := filepath.Split(t.Refname) + path, filename := filepath.Split(t.Name) log.Info("gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) if filename == findname { log.Info("gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath()) @@ -162,10 +162,10 @@ func (repo *Repo) IsLocalBranchVerbose(findname string) bool { func (repo *Repo) IsRemoteBranch(findname string) bool { for t := range repo.Tags.IterAll() { - if !strings.HasPrefix(t.Refname, "refs/remotes/origin") { + if !strings.HasPrefix(t.Name, "refs/remotes/origin") { continue } - path, filename := filepath.Split(t.Refname) + path, filename := filepath.Split(t.Name) log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath()) if filename == findname { log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath()) @@ -176,9 +176,9 @@ func (repo *Repo) IsRemoteBranch(findname string) bool { return false } -func (repo *Repo) IfRefExists(refname string) *GitTag { +func (repo *Repo) IfRefExists(refname string) *Stat { for t := range repo.Tags.IterAll() { - if _, filename := filepath.Split(t.Refname); filename == refname { + if _, filename := filepath.Split(t.Name); filename == refname { return t } } @@ -187,26 +187,26 @@ func (repo *Repo) IfRefExists(refname string) *GitTag { // finds the newest tag. used for deciding if master needs to be published func (repo *Repo) FindLastTag() string { - var newest *GitTag + var newest *Stat for tag := range repo.Tags.IterAll() { - if !strings.HasPrefix(tag.GetRefname(), "refs/tags/") { + if !strings.HasPrefix(tag.GetName(), "refs/tags/") { continue } if newest == nil { newest = tag continue } - cur := newest.Creatordate.AsTime() - if cur.Before(tag.Creatordate.AsTime()) { + cur := newest.CommitTime.AsTime() + if cur.Before(tag.CommitTime.AsTime()) { newest = tag } - // newtag := strings.TrimPrefix(tag.GetRefname(), "refs/tags/") - // log.Info("repo tag", tag.GetHash(), tag.Creatordate.AsTime(), tag.GetRefname(), newtag) + // newtag := strings.TrimPrefix(tag.GetName(), "refs/tags/") + // log.Info("repo tag", tag.GetHash(), tag.CommitTime.AsTime(), tag.GetName(), newtag) } if newest == nil { return "" } - // log.Info("repo newest tag", newest.GetHash(), newest.Creatordate.AsTime(), newest.GetRefname()) - newtag := strings.TrimPrefix(newest.GetRefname(), "refs/tags/") + // log.Info("repo newest tag", newest.GetHash(), newest.CommitTime.AsTime(), newest.GetName()) + newtag := strings.TrimPrefix(newest.GetName(), "refs/tags/") return newtag } diff --git a/gitTag.proto b/gitTag.proto deleted file mode 100644 index 6302229..0000000 --- a/gitTag.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; - -package gitpb; - -import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp - -message GitTag { // `autogenpb:nomutex` - enum BranchType { - ANY = 0; - PROD = 1; - DEVEL = 2; - USER = 3; - } - string hash = 1; // `autogenpb:unique` // git hash - string refname = 2; // `autogenpb:unique` `autogenpb:sort` // tag name. treated as unique - string subject = 3; // git tag subject - BranchType type = 4; // is set by git as the master branch - google.protobuf.Timestamp Authordate = 5; // git author date // should be when the patch was made - google.protobuf.Timestamp Creatordate = 6; // git creator date -} -message GitTags { // `autogenpb:marshal` `autogenpb:nomutex` `autogenpb:gui` - string uuid = 1; // `autogenpb:uuid:ffdff813-0316-4372-9e82-4c1c7d202526` - string version = 2; // `autogenpb:version:v0.0.47` - repeated GitTag gitTags = 3; - GitTag master = 4; - GitTag devel = 5; -} @@ -50,8 +50,8 @@ func (repo *Repo) ReloadForce() error { repo.RunVerbose(cmd) } // log.Info("in reload", repo.FullPath) - repo.Tags = new(GitTags) - repo.reloadGitTags() + repo.Tags = NewStats() + repo.reloadStats() if repo.GoInfo == nil { repo.GoInfo = new(GoInfo) diff --git a/reloadBranches.go b/reloadBranches.go index aaa2efc..3fff9e3 100644 --- a/reloadBranches.go +++ b/reloadBranches.go @@ -125,7 +125,7 @@ func (repo *Repo) checkUserBranch() error { return nil } -func (repo *Repo) ExamineBranches() *GitTag { +func (repo *Repo) ExamineBranches() *Stat { var hashCheck string all := repo.GetBranches() path := filepath.Join(repo.FullPath, ".git/refs/") @@ -166,12 +166,12 @@ func (repo *Repo) ExamineBranches() *GitTag { // log.Info("notsure why this git show is here", hash) } else { // log.Printf("UNKNOWN BRANCH %-50s %s %s %s\n", repo.GetFullPath(), r.Stdout, cmd, b) - tag := new(GitTag) - tag.Refname = b + tag := new(Stat) + tag.Name = b tag.Hash = hash if len(r.Stdout) > 0 { tagtime := parseDateRFC3339(r.Stdout[0]) - tag.Creatordate = timestamppb.New(tagtime) + tag.CommitTime = timestamppb.New(tagtime) } return tag } diff --git a/reloadTags.go b/reloadTags.go index a40f2de..76071a5 100644 --- a/reloadTags.go +++ b/reloadTags.go @@ -36,9 +36,9 @@ func (repo *Repo) AllCommits() error { */ // reload the tags -func (repo *Repo) reloadGitTags() error { +func (repo *Repo) reloadStats() error { // todo: look for changes in the tags? - repo.Tags = new(GitTags) + repo.Tags = NewStats() tags := []string{"%(objectname)", "%(creatordate)", "%(*authordate)", "%(refname)", "%(subject)"} format := strings.Join(tags, "_,,,_") @@ -87,12 +87,12 @@ func (repo *Repo) reloadGitTags() error { refname = parts[3] subject = parts[4] - newr := GitTag{ - Refname: refname, - Hash: hash, - Subject: subject, - Creatordate: ctime, - Authordate: atime, + newr := Stat{ + Name: refname, + Hash: hash, + Subject: subject, + CommitTime: ctime, + AuthorTime: atime, } repo.Tags.Append(&newr) @@ -162,11 +162,11 @@ func getGitDateStamp(gitdefault string) time.Time { return tagTime } -func (tag *GitTag) GetAge() time.Duration { - return time.Since(tag.GetAuthordate().AsTime()) +func (tag *Stat) GetAge() time.Duration { + return time.Since(tag.GetAuthorTime().AsTime()) } -func (repo *Repo) NewestTag() *GitTag { +func (repo *Repo) NewestTag() *Stat { loop := repo.Tags.SortByAge() for loop.Scan() { r := loop.Next() @@ -6,7 +6,6 @@ package gitpb; // If the project is in golang, also gets the go language dependacies import "stat.proto"; -import "gitTag.proto"; import "goDep.proto"; import "gitConfig.proto"; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp @@ -68,17 +67,15 @@ message Repo { // `autogenpb string state = 21; // status or state. useful for building tooling GitConfig config = 22; // protobuf of the current .git/config GoInfo goInfo = 23; // put all the go specifcs here - GitTag currentTag = 24; // used to examine repo branches - GitTags tags = 25; // known tags Stat masterStat = 26; // just store this for now Stat develStat = 27; // just store this for now Stat userStat = 28; // just store this for now - Stats refs = 29; // just store this for now + Stats tags = 29; // just store this for now } message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:gui` `autogenpb:nomutex` `autogenpb:http` string uuid = 1; // `autogenpb:uuid:8daaeba1-fb1f-4762-ae6e-95a55d352673` - string version = 2; // `autogenpb:version:v0.0.8 go.wit.com/protobuf/gitpb` + string version = 2; // `autogenpb:version:v0.1.0 go.wit.com/protobuf/gitpb` repeated Repo repos = 3; // `autogenpb:append` // generate AppendUnique() function for this bool hasFullScan = 4; // a full repo scan has been saved to disk google.protobuf.Timestamp fullScan = 5; // mtime of the last full scan saved to disk diff --git a/tableForged.go b/tableForged.go index fe86c08..721f9a5 100644 --- a/tableForged.go +++ b/tableForged.go @@ -25,13 +25,10 @@ func (pb *Repos) MakeForgedTable() *ReposTable { col.Width = 10 col = t.AddStringFunc("hash", func(r *Repo) string { - if r.Tags == nil { - return "nil" + if r.MasterStat != nil { + return r.MasterStat.Hash } - if r.Tags.Master == nil { - return "nil" - } - return r.Tags.Master.Hash + return "fixme []Stat" }) col.Width = 6 @@ -42,13 +39,10 @@ func (pb *Repos) MakeForgedTable() *ReposTable { col.Width = 10 col = t.AddStringFunc("hash", func(r *Repo) string { - if r.Tags == nil { - return "nil" - } - if r.Tags.Devel == nil { - return "nil" + if r.DevelStat != nil { + return r.DevelStat.Hash } - return r.Tags.Devel.Hash + return "fixme []Stat" }) col.Width = 6 diff --git a/tableGowebd.go b/tableGowebd.go index 40e56ef..1cf8be4 100644 --- a/tableGowebd.go +++ b/tableGowebd.go @@ -37,10 +37,10 @@ func (pb *Repos) MakeGowebdTable(name string) *ReposTable { col.Width = 9 col = t.AddStringFunc("cur tag", func(r *Repo) string { - if r.CurrentTag == nil { - return "nil" + if r.CurrentBranchName != "" { + return r.CurrentBranchName } - return "ok" + return "notsure" }) col.Width = 9 |
