try to fix weird things with doClean()
This commit is contained in:
parent
a377c2ed27
commit
a8184b8c9e
54
argv.go
54
argv.go
|
@ -67,25 +67,25 @@ type RepoCmd struct {
|
|||
}
|
||||
|
||||
type NormalCmd struct {
|
||||
On *EmptyCmd `arg:"subcommand:on" help:"turn normal mode on"`
|
||||
Off *EmptyCmd `arg:"subcommand:off" help:"turn normal mode off"`
|
||||
On *EmptyCmd `arg:"subcommand:on" help:"turn normal mode on"`
|
||||
Off *EmptyCmd `arg:"subcommand:off" help:"turn normal mode off"`
|
||||
}
|
||||
|
||||
type CommitCmd struct {
|
||||
// Submit bool `arg:"--submit" help:"submit the patches to forge"`
|
||||
All bool `arg:"--all" help:"git commit in all dirty repos"`
|
||||
All bool `arg:"--all" help:"git commit in all dirty repos"`
|
||||
}
|
||||
|
||||
type DevCmd struct {
|
||||
Build string `arg:"--build" help:"build a repo"`
|
||||
Install string `arg:"--install" help:"install a repo"`
|
||||
BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
|
||||
URL string `arg:"--connect" help:"forge url"`
|
||||
Build string `arg:"--build" help:"build a repo"`
|
||||
Install string `arg:"--install" help:"install a repo"`
|
||||
BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
|
||||
URL string `arg:"--connect" help:"forge url"`
|
||||
}
|
||||
|
||||
type CleanCmd struct {
|
||||
Verify *EmptyCmd `arg:"subcommand:fix" help:"try to fix problems"`
|
||||
Repo string `arg:"--repo" help:"which repo to look at"`
|
||||
Fix *EmptyCmd `arg:"subcommand:fix" help:"try to fix problems"`
|
||||
Repo string `arg:"--repo" help:"which repo to look at"`
|
||||
}
|
||||
|
||||
// matches
|
||||
|
@ -95,7 +95,7 @@ func (c CleanCmd) Match(partial string) []string {
|
|||
}
|
||||
|
||||
type CleanDevelCmd struct {
|
||||
Force bool `arg:"--force" help:"try to strong arm things"`
|
||||
Force bool `arg:"--force" help:"try to strong arm things"`
|
||||
}
|
||||
|
||||
type PatchCmd struct {
|
||||
|
@ -112,37 +112,37 @@ type SubmitCmd struct {
|
|||
}
|
||||
|
||||
type PullCmd struct {
|
||||
Force bool `arg:"--force" help:"try to strong-arm things"`
|
||||
Force bool `arg:"--force" help:"try to strong-arm things"`
|
||||
// Check *EmptyCmd `arg:"subcommand:check" help:"check repo versions"`
|
||||
// Dirty *EmptyCmd `arg:"subcommand:dirty" help:"only check dirty repos"`
|
||||
// Patches *EmptyCmd `arg:"subcommand:patches" help:"only check repos with patches"`
|
||||
}
|
||||
|
||||
type TagCmd struct {
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"list the tags"`
|
||||
Clean *EmptyCmd `arg:"subcommand:clean" help:"clean out old and duplicate tags"`
|
||||
Delete string `arg:"--delete" help:"delete a tag"`
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"list the tags"`
|
||||
Clean *EmptyCmd `arg:"subcommand:clean" help:"clean out old and duplicate tags"`
|
||||
Delete string `arg:"--delete" help:"delete a tag"`
|
||||
}
|
||||
|
||||
type CheckoutCmd struct {
|
||||
User *EmptyCmd `arg:"subcommand:user" help:"git checkout user"`
|
||||
Devel *EmptyCmd `arg:"subcommand:devel" help:"git checkout devel"`
|
||||
Master *EmptyCmd `arg:"subcommand:master" help:"git checkout master"`
|
||||
User *EmptyCmd `arg:"subcommand:user" help:"git checkout user"`
|
||||
Devel *EmptyCmd `arg:"subcommand:devel" help:"git checkout devel"`
|
||||
Master *EmptyCmd `arg:"subcommand:master" help:"git checkout master"`
|
||||
}
|
||||
|
||||
type MergeCmd struct {
|
||||
All bool `arg:"--all" help:"merge all"`
|
||||
Devel *EmptyCmd `arg:"subcommand:devel" help:"merge user to devel"`
|
||||
Master *EmptyCmd `arg:"subcommand:master" help:"merge devel to master"`
|
||||
Publish *EmptyCmd `arg:"subcommand:publish" help:"increment versions and publish master branch"`
|
||||
All bool `arg:"--all" help:"merge all"`
|
||||
Devel *EmptyCmd `arg:"subcommand:devel" help:"merge user to devel"`
|
||||
Master *EmptyCmd `arg:"subcommand:master" help:"merge devel to master"`
|
||||
Publish *EmptyCmd `arg:"subcommand:publish" help:"increment versions and publish master branch"`
|
||||
}
|
||||
|
||||
type ConfigCmd struct {
|
||||
Add *ConfigAddCmd `arg:"subcommand:add" help:"add a config setting"`
|
||||
Fix *EmptyCmd `arg:"subcommand:fix" help:"fix .config/forge/ and/or repos.pb protobuf file"`
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"list your config settings"`
|
||||
Delete string `arg:"--delete" help:"delete this repo"`
|
||||
Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
|
||||
Add *ConfigAddCmd `arg:"subcommand:add" help:"add a config setting"`
|
||||
Fix *EmptyCmd `arg:"subcommand:fix" help:"fix .config/forge/ and/or repos.pb protobuf file"`
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"list your config settings"`
|
||||
Delete string `arg:"--delete" help:"delete this repo"`
|
||||
Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
|
||||
}
|
||||
|
||||
type ConfigAddCmd struct {
|
||||
|
@ -151,7 +151,7 @@ type ConfigAddCmd struct {
|
|||
Directory bool `arg:"--directory" help:"repo is a directory to match against"`
|
||||
ReadOnly bool `arg:"--readonly" help:"repo is readonly"`
|
||||
Writable bool `arg:"--writable" help:"repo is writable"`
|
||||
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
||||
Favorite bool `arg:"--favorite" help:"forge will always go-clone or git clone this" default:"false"`
|
||||
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
||||
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
||||
DebName string `arg:"--debname" help:"the name of the debian package (or rpm, etc)"`
|
||||
|
|
20
doClean.go
20
doClean.go
|
@ -4,9 +4,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"go.wit.com/lib/fhelp"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -97,7 +99,16 @@ func doClean() error {
|
|||
|
||||
// try to delete user
|
||||
if err := doRepoCleanUser(repo); err != nil {
|
||||
log.Info(repo.GetGoPath(), err)
|
||||
if err == ErrorBranchUnique {
|
||||
bname := repo.GetUserBranchName()
|
||||
s := fmt.Sprintf("delete this odd user %bname branch %s?", bname, repo.FullPath)
|
||||
if fhelp.QuestionUser(s) {
|
||||
repo.RunVerbose([]string{"git", "branch", "-D", bname})
|
||||
// repo.RunVerbose([]string{"git", "checkout", bname})
|
||||
}
|
||||
} else {
|
||||
log.Info(repo.GetGoPath(), err)
|
||||
}
|
||||
}
|
||||
|
||||
// try to delete devel
|
||||
|
@ -232,9 +243,14 @@ func doRepoCleanUser(repo *gitpb.Repo) error {
|
|||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%s branch has unique commits", bruser)
|
||||
if argv.Clean.Fix != nil {
|
||||
}
|
||||
|
||||
return ErrorBranchUnique
|
||||
}
|
||||
|
||||
var ErrorBranchUnique error = errors.New("branch has unique commits")
|
||||
|
||||
// if you call this, there is no going back. no checks anymore. nothing
|
||||
// it deletes the 'devel' branch. git branch -D "devel". END OF STORY
|
||||
func justDeleteTheDevelBranchAlready(repo *gitpb.Repo) error {
|
||||
|
|
Loading…
Reference in New Issue