add doClean()

This commit is contained in:
Jeff Carr 2025-09-23 13:25:32 -05:00
parent b09b86009e
commit cd545c7c9f
4 changed files with 17 additions and 2 deletions

View File

@ -5,7 +5,7 @@ VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)
all: build
./forged --version
FORGE_VERBOSE=true ./forged clean
# FORGE_VERBOSE=true ./forged list
build: goimports

View File

@ -21,6 +21,7 @@ var argv args
type args struct {
Pull *EmptyCmd `arg:"subcommand:pull" help:"'git pull' on the repos"`
List *EmptyCmd `arg:"subcommand:list" help:"list the repos"`
Clean *EmptyCmd `arg:"subcommand:clean" help:"clean the repos"`
Gui *EmptyCmd `arg:"subcommand:gui" help:"show gui"`
Merge *EmptyCmd `arg:"subcommand:merge" help:"merge in new patchsets"`
Init *EmptyCmd `arg:"subcommand:init" help:"init the repo list"`

View File

@ -18,9 +18,15 @@ func doClean() error {
// show all the patchsets with Names
for pset := range me.forge.Patchsets.IterAll() {
for patch := range pset.Patches.IterAll() {
if patch.PatchId == "" {
log.Info("Delete", patch.CommitHash, patch.PatchId, patch.Namespace)
pset.Patches.Delete(patch)
} else {
log.Info("\t", patch.CommitHash, patch.PatchId, patch.Namespace)
}
}
}
me.forge.SavePatchsets()
return nil
}

View File

@ -44,6 +44,14 @@ func main() {
okExit("")
}
if argv.Clean != nil {
log.Printf("forge.Init() %s len()=%d\n", me.forge.Config.Filename, me.forge.Repos.Len())
fhelp.DumpENV("finit:")
me.forge.Config.DumpENV()
doClean()
okExit("")
}
if argv.Merge != nil {
if err := doMerge(); err != nil {
badExit(err)