summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-23 13:25:32 -0500
committerJeff Carr <[email protected]>2025-09-23 14:50:22 -0500
commitcd545c7c9f9ffe2159a4b6faa5b6451ffb9b4d02 (patch)
treeb0745315c3a079a915501b1344baa6cdd740447e
parentb09b86009ecb17c171aab400af73a568d084f49e (diff)
add doClean()
-rw-r--r--Makefile2
-rw-r--r--argv.go1
-rw-r--r--doList.go8
-rw-r--r--main.go8
4 files changed, 17 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index b533cd5..d9ddf76 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/argv.go b/argv.go
index 7baf9c8..5a73c26 100644
--- a/argv.go
+++ b/argv.go
@@ -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"`
diff --git a/doList.go b/doList.go
index beb6187..d6ff5f4 100644
--- a/doList.go
+++ b/doList.go
@@ -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() {
- log.Info("\t", patch.CommitHash, patch.PatchId, patch.Namespace)
+ 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
}
diff --git a/main.go b/main.go
index 760914a..a92e365 100644
--- a/main.go
+++ b/main.go
@@ -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)