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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
package repolist
// make human readable output
import (
"fmt"
"net/http"
"time"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
// makes a human readable thing for standard out.
func (r *RepoRow) StandardHeader() string {
lastTag := r.LastTag()
tag := r.Status.NewestTag()
gitAge, _ := tag.GetDate()
dur := time.Since(gitAge)
master := r.Status.GetMasterVersion()
devel := r.Status.GetDevelVersion()
user := r.Status.GetUserVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-10s %-15s", r.Name(), shell.FormatDuration(dur), lastTag, master, devel, user, r.State())
return header
}
// makes a human readable thing for standard out.
func (r *RepoRow) StandardReleaseHeader() string {
lastTag := r.LastTag()
tag := r.Status.NewestTag()
gitAge, _ := tag.GetDate()
dur := time.Since(gitAge)
master := r.Status.GetMasterVersion()
target := r.Status.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-15s %-15s",
r.Name(),
shell.FormatDuration(dur),
lastTag,
master,
target,
r.GoState(),
r.State())
return header
}
// send stuff to the socket and stdout
func msg(w http.ResponseWriter, s string) {
log.Info(s)
fmt.Fprintln(w, s)
}
func (v *RepoList) PrintReport(w http.ResponseWriter, readonly string, onlydirty string, perfect string) {
var count int
loop := v.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
count += 1
header := repo.StandardHeader()
if onlydirty == "true" {
if repo.CheckDirty() {
msg(w, header+"")
}
continue
}
if repo.ReadOnly() {
if readonly == "true" {
msg(w, header+"readonly")
}
continue
}
if repo.State() == "PERFECT" {
if perfect == "false" {
continue
}
}
if repo.State() != "merge to main" {
msg(w, header+"")
continue
}
if repo.CheckDirty() {
msg(w, header+"")
continue
}
msg(w, header+"")
}
msg(w, fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
}
func (v *RepoList) PrintReleaseReport(w http.ResponseWriter, readonly string, perfect string) {
var count int
loop := v.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() && (readonly == "true") {
continue
}
if (repo.State() == "PERFECT") && (perfect == "true") {
continue
}
count += 1
header := repo.StandardReleaseHeader()
msg(w, header)
}
msg(w, fmt.Sprintf("total repo count = %d", count))
}
|