diff options
| author | Jeff Carr <[email protected]> | 2025-10-16 02:21:32 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-16 02:21:32 -0500 |
| commit | 246771554e3b9abc8d070864c0c90de3d4647b58 (patch) | |
| tree | 18b1d5d6c7e6a038b537e42130c25278d70db842 | |
| parent | 43750a33995434b6e699bd1fbcc6ea442f238d12 (diff) | |
argv cleanups for doVerify
| -rw-r--r-- | argv.go | 10 | ||||
| -rw-r--r-- | doStats.go | 10 | ||||
| -rw-r--r-- | doVerify.go | 38 | ||||
| -rw-r--r-- | windowPatches.go | 4 | ||||
| -rw-r--r-- | windowViewRepoPatches.go | 2 |
5 files changed, 54 insertions, 10 deletions
@@ -70,8 +70,14 @@ type FixCmd struct { } type VerifyCmd struct { - All *EmptyCmd `arg:"subcommand:all" help:"show mtime changes"` - List bool `arg:"--list" help:"list all stats"` + Namespace *EmptyCmd `arg:"subcommand:namespace" help:"check the namespaces"` + Stats *StatsCmd `arg:"subcommand:stats" help:"generate origin.pb"` +} + +type StatsCmd struct { + All bool `arg:"--all" help:"process all stats"` + Sizes bool `arg:"--sizes" help:"show sizes"` + List bool `arg:"--list" help:"list all stats"` } func (ShowCmd) Examples() string { @@ -14,12 +14,12 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" ) -func doVerify() (string, error) { +func doStats() (string, error) { var allerr error - if argv.Verify.All != nil { + if argv.All { for r := range me.forge.Repos.IterByFullPath() { if r.Stats().Len() == 0 { - _, err := doStats(r) + _, err := doStatsRepo(r) allerr = errors.Join(allerr, err) } } @@ -31,7 +31,7 @@ func doVerify() (string, error) { return "no repo", errors.New("working dir isn't a repo I know about") } - s, err := doStats(repo) + s, err := doStatsRepo(repo) allerr = errors.Join(allerr, err) user, err := refHash(repo, "heads/"+repo.GetUserBranchName()) @@ -48,7 +48,7 @@ func doVerify() (string, error) { return s, allerr } -func doStats(r *gitpb.Repo) (string, error) { +func doStatsRepo(r *gitpb.Repo) (string, error) { var allerr error pb, err := r.LoadStats() if err == nil { diff --git a/doVerify.go b/doVerify.go new file mode 100644 index 0000000..79231f7 --- /dev/null +++ b/doVerify.go @@ -0,0 +1,38 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "strings" + + "go.wit.com/log" +) + +func doVerify() (string, error) { + var s string = "doVerify()" + var err error + + if argv.Verify.Stats != nil { + s, err = doStats() + } + + if argv.Verify.Namespace != nil { + s, err = doVerifyNamespace() + } + + return s, err +} + +// checks to see if the r.Namespace seems right +func doVerifyNamespace() (string, error) { + var s string = "doVerifyNamespace()" + var err error + for r := range me.forge.Repos.IterAll() { + if strings.HasPrefix(r.FullPath, r.Namespace) { + log.Info("look at:", r.FullPath, r.Namespace) + } + } + + return s, err +} diff --git a/windowPatches.go b/windowPatches.go index 65f54b7..362c0ca 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -84,7 +84,7 @@ func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin { func applyPatchNew(p *forgepb.Patch) error { rn := p.Namespace - repo := me.forge.FindByGoPath(rn) + repo := me.forge.FindByNamespace(rn) if repo == nil { log.Info("Could not figure out repo path", rn) return log.Errorf("%s namespace?\n", rn) @@ -117,7 +117,7 @@ func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) { // used by the PB table func applyPatchLabel(p *forgepb.Patch) string { rn := p.Namespace - if repo := me.forge.FindByGoPath(rn); repo == nil { + if repo := me.forge.FindByNamespace(rn); repo == nil { // log.Info("Could not figure out repo path", rn) return "" } diff --git a/windowViewRepoPatches.go b/windowViewRepoPatches.go index 425241d..0f8a38e 100644 --- a/windowViewRepoPatches.go +++ b/windowViewRepoPatches.go @@ -118,7 +118,7 @@ func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Set) { for all.Scan() { p := all.Next() s := p.Namespace - repo := me.forge.FindByGoPath(s) + repo := me.forge.FindByNamespace(s) if repo == nil { log.Info("COULD NOT FIND", s) continue |
