more "commit" tests
This commit is contained in:
parent
650ecc6aab
commit
47cd26fbab
54
doClean.go
54
doClean.go
|
@ -28,13 +28,15 @@ func doClean() error {
|
|||
if repo.IsDirty() {
|
||||
continue
|
||||
}
|
||||
|
||||
// when publishing, clean out the details of that if it's still there
|
||||
if repo.GetTargetVersion() != "" {
|
||||
repo.SetTargetVersion("")
|
||||
configSave = true
|
||||
}
|
||||
|
||||
// try to delete user
|
||||
if err := doCleanUserRepo(repo); err != nil {
|
||||
if err := doRepoCleanUser(repo); err != nil {
|
||||
log.Info(repo.GetGoPath(), err)
|
||||
}
|
||||
|
||||
|
@ -70,38 +72,8 @@ func doRepoCleanDevel(repo *gitpb.Repo) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func doCleanDevel() error {
|
||||
var total int
|
||||
var count int
|
||||
all := me.forge.Repos.SortByFullPath()
|
||||
for all.Scan() {
|
||||
repo := all.Next()
|
||||
total += 1
|
||||
if !repo.IsLocalBranch(repo.GetDevelBranchName()) {
|
||||
// there is no local branch named 'devel'
|
||||
continue
|
||||
}
|
||||
|
||||
if repo.GetCurrentBranchName() != repo.GetMasterBranchName() {
|
||||
log.Info("Repo not on master branch:", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
if repo.IsDirty() {
|
||||
log.Info("Repo is dirty:", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
count += 1
|
||||
if err := justDeleteTheDevelBranchAlready(repo); err != nil {
|
||||
log.Info("justDeleteTheDevel() err", repo.GetGoPath(), err)
|
||||
}
|
||||
}
|
||||
log.Info("")
|
||||
log.Printf("attempted cleaning %d devel branches of %d total branches\n", count, total)
|
||||
return nil
|
||||
}
|
||||
|
||||
// removes all local branches
|
||||
func doCleanUserRepo(repo *gitpb.Repo) error {
|
||||
// removes all local user branches
|
||||
func doRepoCleanUser(repo *gitpb.Repo) error {
|
||||
if repo.IsDirty() {
|
||||
return nil
|
||||
}
|
||||
|
@ -153,22 +125,6 @@ func doCleanUserRepo(repo *gitpb.Repo) error {
|
|||
return fmt.Errorf("%s branch has unique commits", bruser)
|
||||
}
|
||||
|
||||
// hack to cleanup release versioning info
|
||||
func doCleanPub() error {
|
||||
total := 0
|
||||
all := me.forge.Repos.SortByFullPath()
|
||||
for all.Scan() {
|
||||
repo := all.Next()
|
||||
if repo.GetTargetVersion() != "" {
|
||||
repo.SetTargetVersion("")
|
||||
configSave = true
|
||||
total += 1
|
||||
}
|
||||
}
|
||||
log.Printf("clearing %d total repos\n", total)
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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