add doClean()
This commit is contained in:
parent
b09b86009e
commit
cd545c7c9f
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%s)
|
BUILDTIME = $(shell date +%s)
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
./forged --version
|
FORGE_VERBOSE=true ./forged clean
|
||||||
# FORGE_VERBOSE=true ./forged list
|
# FORGE_VERBOSE=true ./forged list
|
||||||
|
|
||||||
build: goimports
|
build: goimports
|
||||||
|
|
1
argv.go
1
argv.go
|
@ -21,6 +21,7 @@ var argv args
|
||||||
type args struct {
|
type args struct {
|
||||||
Pull *EmptyCmd `arg:"subcommand:pull" help:"'git pull' on the repos"`
|
Pull *EmptyCmd `arg:"subcommand:pull" help:"'git pull' on the repos"`
|
||||||
List *EmptyCmd `arg:"subcommand:list" help:"list 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"`
|
Gui *EmptyCmd `arg:"subcommand:gui" help:"show gui"`
|
||||||
Merge *EmptyCmd `arg:"subcommand:merge" help:"merge in new patchsets"`
|
Merge *EmptyCmd `arg:"subcommand:merge" help:"merge in new patchsets"`
|
||||||
Init *EmptyCmd `arg:"subcommand:init" help:"init the repo list"`
|
Init *EmptyCmd `arg:"subcommand:init" help:"init the repo list"`
|
||||||
|
|
|
@ -18,9 +18,15 @@ func doClean() error {
|
||||||
// show all the patchsets with Names
|
// show all the patchsets with Names
|
||||||
for pset := range me.forge.Patchsets.IterAll() {
|
for pset := range me.forge.Patchsets.IterAll() {
|
||||||
for patch := range pset.Patches.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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
main.go
8
main.go
|
@ -44,6 +44,14 @@ func main() {
|
||||||
okExit("")
|
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 argv.Merge != nil {
|
||||||
if err := doMerge(); err != nil {
|
if err := doMerge(); err != nil {
|
||||||
badExit(err)
|
badExit(err)
|
||||||
|
|
Loading…
Reference in New Issue