summaryrefslogtreecommitdiff
path: root/lookForUnwind.go
blob: b3be1ad63f488fa3ca7906fdd1c39db4b9fed9de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This is a simple example
package main

import (
	"go.wit.com/log"
)

func (r *repo) lookToUnwind() bool {
	goSumS := r.getGoSumStatus()
	dirtyS := r.dirtyLabel.String()
	currentS := r.status.GetCurrentBranchVersion()
	log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS)


	curName := r.status.GetCurrentBranchName()
	mName := r.status.GetMasterBranchName()

	if curName == mName {
		log.Info("\trepo is ready working from main branch", curName, "=", mName)
	} else {
		log.Info("\trepo is not ready main branch", curName, "!=", mName)
		r.setGoSumStatus("CAN NOT UNWIND")
		return false
	}

	if r.lastTag.String() != currentS {
		log.Info("\trepo version mismatch last vs current", r.lastTag.String(), "!=", currentS)
		r.setGoSumStatus("CAN NOT UNWIND")
		return false
	}

	if "v" + release.versionS != r.lastTag.String() {
		log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS)
		r.setGoSumStatus("CAN NOT UNWIND")
		return false
	}

	r.setGoSumStatus("UNWIND")
	return true
}