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"`
Force *EmptyCmd `arg:"subcommand:force" help:"do destructive stuff"`
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"`
Verify *VerifyCmd `arg:"subcommand:verify" help:"verify branches"`
Repo string `arg:"--repo" help:"which repo to look at"`
@ -101,12 +102,13 @@ type DirtyCmd struct {
}
type FindCmd struct {
All bool `arg:"--all" help:"select every repo (the default)"`
Mine bool `arg:"--mine" help:"your repos as defined in the forge config"`
Favorites bool `arg:"--favorites" help:"your repos configured as favorites"`
Private bool `arg:"--private" help:"your private repos from your .config/forge/"`
Dirty bool `arg:"--dirty" help:"only use dirty git repos"`
User bool `arg:"--user" help:"show repos on the user branch"`
Pub *EmptyCmd `arg:"subcommand:pub" help:"fix .config/forge/ and/or repos.pb protobuf file"`
All bool `arg:"--all" help:"select every repo (the default)"`
Mine bool `arg:"--mine" help:"your repos as defined in the forge config"`
Favorites bool `arg:"--favorites" help:"your repos configured as favorites"`
Private bool `arg:"--private" help:"your private repos from your .config/forge/"`
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"`
}

View File

@ -39,7 +39,7 @@ func (args) doBashAuto() {
case "examine":
fmt.Println("fix")
case "list":
fmt.Println("--all --mine --favorites --private")
fmt.Println("--all --mine --favorites --private pub")
case "pull":
fmt.Println("--verbose")
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")
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 err := doCleanDevel(); err != nil {
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, " "))
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
}
if f.Pub != nil {
findPublishable()
return
}
if f.All {
findAll()
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() {
all := me.forge.Repos.SortByFullPath()
for all.Scan() {