move Revert() here
This commit is contained in:
parent
233f7bca76
commit
10cc012a12
|
@ -0,0 +1,42 @@
|
||||||
|
package gitpb
|
||||||
|
|
||||||
|
import "go.wit.com/log"
|
||||||
|
|
||||||
|
// reverts master to devel
|
||||||
|
// used in the unwind process of making GUI releases
|
||||||
|
func (repo *Repo) RevertMasterToDevel() bool {
|
||||||
|
if repo.CheckDirty() {
|
||||||
|
log.Info("sorry, it's still dirty")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
curName := repo.GetCurrentBranchName()
|
||||||
|
dName := repo.GetDevelBranchName()
|
||||||
|
mName := repo.GetMasterBranchName()
|
||||||
|
if curName != mName {
|
||||||
|
log.Info("repo is not working from main branch", curName, "!=", mName)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("reset master to devel", curName, repo.GetGoPath())
|
||||||
|
|
||||||
|
var all [][]string
|
||||||
|
all = append(all, []string{"git", "checkout", dName}) // switch to the devel branch
|
||||||
|
all = append(all, []string{"git", "branch", "-D", mName})
|
||||||
|
all = append(all, []string{"git", "branch", mName}) // make a master branch based on devel
|
||||||
|
all = append(all, []string{"git", "checkout", mName})
|
||||||
|
all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
|
||||||
|
|
||||||
|
// don't do anything with tags here
|
||||||
|
// all = append(all, []string{"git", "tag", "--delete", release.version.String()})
|
||||||
|
// all = append(all, []string{"git", "push", "--delete", "origin", release.version.String()})
|
||||||
|
|
||||||
|
if repo.RunAll(all) {
|
||||||
|
log.Info("EVERYTHING OK. RERELEASED", repo.GetGoPath())
|
||||||
|
repo.Reload()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("SOMETHING FAILED")
|
||||||
|
return false
|
||||||
|
}
|
13
shell.go
13
shell.go
|
@ -108,3 +108,16 @@ func (repo *Repo) IsDirectory() bool {
|
||||||
}
|
}
|
||||||
return info.IsDir()
|
return info.IsDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repo) RunAll(all [][]string) bool {
|
||||||
|
for _, cmd := range all {
|
||||||
|
log.Log(GITPBWARN, "doAll() RUNNING: cmd =", cmd)
|
||||||
|
r := repo.Run(cmd)
|
||||||
|
if r.Error != nil {
|
||||||
|
log.Log(GITPBWARN, "doAll() err =", r.Error)
|
||||||
|
log.Log(GITPBWARN, "doAll() out =", r.Stdout)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue