diff options
| author | Jeff Carr <[email protected]> | 2025-08-20 11:44:32 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-20 11:44:32 -0500 |
| commit | 80dd77a6c8d0204d9e184b7290c008dc1221cdc2 (patch) | |
| tree | 51d8584da9e3ac3f6afac6adacc41ac8b1945ae4 /doClean.go | |
| parent | 12a66969603471c4686110cff53c102734054a41 (diff) | |
more cleanups on doClean()v0.22.127
Diffstat (limited to 'doClean.go')
| -rw-r--r-- | doClean.go | 57 |
1 files changed, 52 insertions, 5 deletions
@@ -44,7 +44,54 @@ func doClean() error { doRepoCleanDevel(repo) } - log.Info("finished attempt at cleaning devel branches") + found := gitpb.NewRepos() + + total := 0 + // find all repos that aren't "clean" + all = me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + total += 1 + + // find repos not on master branch + if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { + found.AppendByGoPath(repo) + continue + } + + // find dirty repos + if repo.IsDirty() { + found.AppendByGoPath(repo) + continue + } + + // find repos that still have a local user branch + if repo.IsLocalBranch(repo.GetUserBranchName()) { + found.AppendByGoPath(repo) + continue + } + + // find repos that still have a local devel branch + if repo.IsLocalBranch(repo.GetDevelBranchName()) { + found.AppendByGoPath(repo) + continue + } + } + + // display all the repos that aren't clean to the user + log.Printf("\n") // padding for now + if argv.Verbose { + me.forge.PrintHumanTableDirty(found) + } else { + me.forge.PrintHumanTable(found) + } + log.Printf("\n") // padding for now + + if found.Len() == 0 { + log.Printf("%d repos are not clean\n", found.Len()) + } else { + log.Info("All repos are clean", total, found.Len()) + } return nil } @@ -100,7 +147,7 @@ func doRepoCleanUser(repo *gitpb.Repo) error { if b1 == 0 { // every user branch exists in devel. delete user branch cmd := []string{"git", "branch", "-D", bruser} - log.Info("USER IS IN DEVEL", repo.GetGoPath(), cmd) + // log.Info("USER IS IN DEVEL", repo.GetGoPath(), cmd) err := repo.RunVerbose(cmd) return err } @@ -116,7 +163,7 @@ func doRepoCleanUser(repo *gitpb.Repo) error { b1 := repo.CountDiffObjects(bruser, "refs/heads/"+brmaster) // should be zero if b1 == 0 { cmd := []string{"git", "branch", "-D", bruser} - log.Info("USER IS IN DEVEL", repo.GetGoPath(), cmd) + // log.Info("USER IS IN DEVEL", repo.GetGoPath(), cmd) err := repo.RunVerbose(cmd) return err } @@ -143,7 +190,7 @@ func justDeleteTheDevelBranchAlready(repo *gitpb.Repo) error { b1 := repo.CountDiffObjects(branch, remote) // should be zero if b1 == 0 { cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()} - log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd) + // log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd) err := repo.RunVerbose(cmd) return err } @@ -158,7 +205,7 @@ func justDeleteTheDevelBranchAlready(repo *gitpb.Repo) error { b1 := repo.CountDiffObjects(branch, "refs/heads/"+master) // should be zero if b1 == 0 { cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()} - log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd) + // log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd) err := repo.RunVerbose(cmd) return err } |
