debugging releaser

This commit is contained in:
Jeff Carr 2025-01-29 19:59:55 -06:00
parent bab84d7c90
commit d493a55cfa
4 changed files with 47 additions and 7 deletions

14
argv.go
View File

@ -47,6 +47,7 @@ type CleanCmd struct {
Examine *ExamineCmd `arg:"subcommand:examine" help:"examine branches"` Examine *ExamineCmd `arg:"subcommand:examine" help:"examine branches"`
Force *EmptyCmd `arg:"subcommand:force" help:"do destructive stuff"` Force *EmptyCmd `arg:"subcommand:force" help:"do destructive stuff"`
GitReset *EmptyCmd `arg:"subcommand:git-reset" help:"git reset --hard"` GitReset *EmptyCmd `arg:"subcommand:git-reset" help:"git reset --hard"`
Pub *EmptyCmd `arg:"subcommand:pub" help:"clean target version numbers"`
User *EmptyCmd `arg:"subcommand:user" help:"clean the user branches"` User *EmptyCmd `arg:"subcommand:user" help:"clean the user branches"`
Verify *VerifyCmd `arg:"subcommand:verify" help:"verify branches"` Verify *VerifyCmd `arg:"subcommand:verify" help:"verify branches"`
Repo string `arg:"--repo" help:"which repo to look at"` Repo string `arg:"--repo" help:"which repo to look at"`
@ -101,12 +102,13 @@ type DirtyCmd struct {
} }
type FindCmd struct { type FindCmd struct {
All bool `arg:"--all" help:"select every repo (the default)"` Pub *EmptyCmd `arg:"subcommand:pub" help:"fix .config/forge/ and/or repos.pb protobuf file"`
Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` All bool `arg:"--all" help:"select every repo (the default)"`
Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` Mine bool `arg:"--mine" help:"your repos as defined in the forge config"`
Private bool `arg:"--private" help:"your private repos from your .config/forge/"` Favorites bool `arg:"--favorites" help:"your repos configured as favorites"`
Dirty bool `arg:"--dirty" help:"only use dirty git repos"` Private bool `arg:"--private" help:"your private repos from your .config/forge/"`
User bool `arg:"--user" help:"show repos on the user branch"` Dirty bool `arg:"--dirty" help:"only use dirty git repos"`
User bool `arg:"--user" help:"show repos on the user branch"`
// ReadOnly bool `arg:"--readonly" help:"include read-only repos"` // ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
} }

View File

@ -39,7 +39,7 @@ func (args) doBashAuto() {
case "examine": case "examine":
fmt.Println("fix") fmt.Println("fix")
case "list": case "list":
fmt.Println("--all --mine --favorites --private") fmt.Println("--all --mine --favorites --private pub")
case "pull": case "pull":
fmt.Println("--verbose") fmt.Println("--verbose")
case "patch": case "patch":

View File

@ -14,6 +14,13 @@ var ErrorMergeBranch error = fmt.Errorf("trunk has things not in the branch")
var ErrorMergeTrunk error = fmt.Errorf("branch has things not in trunk") var ErrorMergeTrunk error = fmt.Errorf("branch has things not in trunk")
func doClean() error { func doClean() error {
if argv.Clean.Pub != nil {
if err := doCleanPub(); err != nil {
badExit(err)
}
log.Info("finished attempt at cleaning devel branches")
return nil
}
if argv.Clean.Devel != nil { if argv.Clean.Devel != nil {
if err := doCleanDevel(); err != nil { if err := doCleanDevel(); err != nil {
badExit(err) badExit(err)
@ -535,3 +542,18 @@ func countGitDiffLog(repo *gitpb.Repo, branch1, branch2 string) int {
// log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " ")) // log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " "))
return len(r.Stdout) return len(r.Stdout)
} }
func doCleanPub() error {
total := 0
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if repo.GetTargetVersion() != "" {
repo.SetTargetVersion("")
configSave = true
total += 1
}
}
log.Printf("clearing %d total repos\n", total)
return nil
}

16
find.go
View File

@ -17,6 +17,11 @@ func (f *FindCmd) findRepos() {
return return
} }
if f.Pub != nil {
findPublishable()
return
}
if f.All { if f.All {
findAll() findAll()
return return
@ -114,6 +119,17 @@ func findUser() {
} }
} }
func findPublishable() {
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if repo.GetTargetVersion() == "" {
continue
}
me.found.AppendByGoPath(repo)
}
}
func findReposWithPatches() { func findReposWithPatches() {
all := me.forge.Repos.SortByFullPath() all := me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {