summaryrefslogtreecommitdiff
path: root/mergeAll.go
blob: 7a606bed0131c08581b01b553982bfb2276e43fa (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main

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

func mergeAllDevelToMain() bool {
	log.Info("merge all here")
	loop := me.repos.View.ReposSortByName()
	for loop.Scan() {
		repo := loop.Repo()

		if repo.ReadOnly() {
			log.Info("skipping readonly", repo.Name(), repo.State())
			continue
		}
		if repo.State() != "merge to main" {
			log.Info("skipping. not merge to main", repo.Name(), repo.State())
			continue
		}
		if repo.CheckDirty() {
			log.Info("skipping dirty", repo.Name(), repo.State())
			continue
		}
		log.Info("found", repo.Name(), repo.State())
		repo.NewScan()
		if repo.Status.MergeDevelToMaster() {
			log.Warn("THINGS SEEM OK fullAutomation() returned true.")
		} else {
			log.Warn("last repo:", repo.Name())
			log.Warn("THINGS FAILED fullAutomation() returned false")
			return false
		}
		repo.NewScan()
	}
	log.Warn("EVERYTHING WORKED")
	return true
}

func mergeAllUserToDevel() bool {
	log.Info("merge all here")
	loop := me.repos.View.ReposSortByName()
	for loop.Scan() {
		repo := loop.Repo()

		if repo.ReadOnly() {
			log.Info("skipping readonly", repo.Name(), repo.State())
			continue
		}
		if repo.State() != "merge to devel" {
			log.Info("skipping. not merge to devel", repo.Name(), repo.State())
			continue
		}
		if repo.CheckDirty() {
			log.Info("skipping dirty", repo.Name(), repo.State())
			continue
		}
		log.Info("found", repo.Name(), repo.State())
		repo.NewScan()
		if repo.Status.MergeUserToDevel() {
			log.Warn("THINGS SEEM OK fullAutomation() returned true.")
		} else {
			log.Warn("last repo:", repo.Status.Path())
			log.Warn("THINGS FAILED fullAutomation() returned false")
			return false
		}
		repo.NewScan()
	}
	log.Warn("EVERYTHING WORKED")
	return true
}