diff options
| author | Jeff Carr <[email protected]> | 2025-11-03 06:49:58 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-11-03 06:49:58 -0600 |
| commit | 5849f18a91fd7877ad5fb8165b29a3df8c5f3ed1 (patch) | |
| tree | 798519fc048713675cab470fe6d1fcdf92dc6097 | |
| parent | fbd8440780da37e6e4cc94a7713b7815e85ad2e4 (diff) | |
show remote refs table
| -rw-r--r-- | argv.go | 4 | ||||
| -rw-r--r-- | doShow.go | 32 | ||||
| -rw-r--r-- | doStats.go | 14 | ||||
| -rw-r--r-- | find.go | 16 |
4 files changed, 45 insertions, 21 deletions
@@ -42,7 +42,8 @@ type ShowCmd struct { Mtime *EmptyCmd `arg:"subcommand:mtime" help:"show mtime changes"` ENV *EmptyCmd `arg:"subcommand:ENV" help:"show lib/env"` Tag *TagCmd `arg:"subcommand:tag" help:"show the git tag table"` - Repo *RepoCmd `arg:"subcommand:repos" help:"show repos by type. deprecate."` + Repos *RepoCmd `arg:"subcommand:repos" help:"show repos by type. deprecate."` + Repo string `arg:"--repo" help:"lookup this repo namespace"` // MasterDefault *EmptyCmd `arg:"subcommand:masterdefault" help:"run the default behavior for master branches"` } @@ -140,6 +141,7 @@ type PullCmd struct { type TagCmd struct { List *EmptyCmd `arg:"subcommand:list" help:"list the tags"` Clean *EmptyCmd `arg:"subcommand:clean" help:"clean out old and duplicate tags"` + Remote *EmptyCmd `arg:"subcommand:remote" help:"show remote tags"` Delete string `arg:"--delete" help:"delete a tag"` } @@ -3,7 +3,12 @@ package main -import "go.wit.com/lib/env" +import ( + "errors" + + "go.wit.com/lib/env" + "go.wit.com/log" +) func doShow() (string, error) { if argv.Show.Dirty != nil { @@ -26,6 +31,27 @@ func doShow() (string, error) { return s, err } + if argv.Show.Repo != "" { + r := me.forge.Repos.FindByNamespace(argv.Show.Repo) + if r == nil { + return "no repo " + argv.Show.Repo, errors.New("no repo " + argv.Show.Repo) + } + for _, rmote := range r.Config.Remotes { + stats, err := r.LoadRemoteRefs(rmote.Name) + if err != nil { + // return err + } + if env.True("resort") { + stats.SaveByHash() + log.Info("stats should have been resorted and saved") + } else { + footer := stats.PrintTable() + log.Info("full remote refs footer:", footer) + } + } + return "remote refs table", nil + } + found := findRepos() if showUrls() { found.SortNamespace() @@ -42,10 +68,10 @@ func showUrls() bool { if argv.Show == nil { return false } - if argv.Show.Repo == nil { + if argv.Show.Repos == nil { return false } - if argv.Show.Repo.Urls != nil { + if argv.Show.Repos.Urls != nil { return true } return false @@ -166,8 +166,8 @@ func last100(r *gitpb.Repo, pb *gitpb.Stats) (int, error) { ctime, err := cobol.GetTime(parts[2]) allerr = errors.Join(allerr, err) astat.Ctime = timestamppb.New(*ctime) - astat.Subject = parts[4] - astat.Type = gitpb.Stat_REMOTE + // astat.Subject = parts[4] + // astat.Type = gitpb.Stat_REMOTE pb.Append(astat) } return counter, allerr @@ -215,7 +215,7 @@ func safeDelete(r *gitpb.Repo, deleteHash string, keepHash string) error { searchResult := log.Sprintf("NOPE(%d)", r.Stats().Len()) stat := findPatchIdInStats(r.Stats(), patchId) if stat != nil { - searchResult = log.Sprintf("FOUND %10.10s %s", stat.PatchId, stat.Subject) + searchResult = log.Sprintf("FOUND %10.10s %s", stat.PatchId, "todo: []slice") } else { ACTUALLYOK = false } @@ -290,8 +290,8 @@ func updateStats(r *gitpb.Repo, pb *gitpb.Stats, remoteName string) (int, error) ctime, err := cobol.GetTime(parts[2]) allerr = errors.Join(allerr, err) astat.Ctime = timestamppb.New(*ctime) - astat.Subject = parts[4] - astat.Type = gitpb.Stat_REMOTE + // astat.Subject = parts[4] + // astat.Type = gitpb.Stat_REMOTE pb.Append(astat) } return counter, allerr @@ -368,9 +368,9 @@ func makeRefs(r *gitpb.Repo, remoteName string) error { // } counter += 1 newstat := new(gitpb.Stat) - newstat.Type = gitpb.Stat_REMOTE + // newstat.Type = gitpb.Stat_REMOTE newstat.Hash = parts[0] - newstat.Name = parts[1] + // newstat.Name = parts[1] if stats.Len() == 0 { stats.Append(newstat) continue @@ -22,10 +22,6 @@ func doFind() *gitpb.Repos { return findAll() } - if argv.Show.Repo.Mine { - return findMine() - } - if argv.Show.Dirty != nil { return me.forge.FindDirty() } @@ -42,27 +38,27 @@ func findRepos() *gitpb.Repos { return me.forge.FindDirty() } - if argv.Show.Repo == nil { + if argv.Show.Repos == nil { return findAll() } - if argv.Show.Repo.All { + if argv.Show.Repos.All { return findAll() } - if argv.Show.Repo.Private { + if argv.Show.Repos.Private { return findPrivate() } - if argv.Show.Repo.Mine { + if argv.Show.Repos.Mine { return findMine() } - if argv.Show.Repo.Favorites { + if argv.Show.Repos.Favorites { return findFavorites() } - if argv.Show.Repo.User { + if argv.Show.Repos.User { return findUser() } |
