46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
|
package repostatus
|
||
|
|
||
|
import "go.wit.com/log"
|
||
|
|
||
|
// reverts master to devel
|
||
|
// used in the unwind process of making GUI releases
|
||
|
func (rs *RepoStatus) RevertMasterToDevel() bool {
|
||
|
if rs.CheckDirty() {
|
||
|
log.Info("sorry, it's still dirty")
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
curName := rs.GetCurrentBranchName()
|
||
|
mName := rs.GetMasterBranchName()
|
||
|
if curName != mName {
|
||
|
log.Info("repo is not working from main branch", curName, "!=", mName)
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
log.Info("reset master to devel", curName, rs.String())
|
||
|
|
||
|
// git checkout devel
|
||
|
// git branch -D master
|
||
|
// git branch master
|
||
|
// git checkout master
|
||
|
// git push --set-upstream --force origin master
|
||
|
|
||
|
var all [][]string
|
||
|
all = append(all, []string{"git", "checkout", "devel"})
|
||
|
all = append(all, []string{"git", "branch", "-D", mName})
|
||
|
all = append(all, []string{"git", "branch", mName})
|
||
|
all = append(all, []string{"git", "checkout", mName})
|
||
|
all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
|
||
|
|
||
|
// all = append(all, []string{"git", "tag", "--delete", release.version.String()})
|
||
|
// all = append(all, []string{"git", "push", "--delete", "origin", release.version.String()})
|
||
|
|
||
|
if rs.DoAll(all) {
|
||
|
log.Info("EVERYTHING OK. RERELEASED", rs.String())
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
log.Info("SOMETHING FAILED")
|
||
|
return false
|
||
|
}
|