summaryrefslogtreecommitdiff
path: root/scan.go
diff options
context:
space:
mode:
Diffstat (limited to 'scan.go')
-rw-r--r--scan.go103
1 files changed, 0 insertions, 103 deletions
diff --git a/scan.go b/scan.go
deleted file mode 100644
index 6b6b6b8..0000000
--- a/scan.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package main
-
-import (
- "fmt"
- "os/user"
- "strings"
- "time"
-
- "go.wit.com/log"
-)
-
-func scanRepositories() {
- log.Info("Scanned", me.summary.totalOL.String(), "repositories. todo: count/show changes")
- t := timeFunction(func() {
- for _, repo := range me.allrepos {
- repo.newScan()
- }
- })
- s := fmt.Sprint(t)
- me.duration.SetText(s)
-}
-
-func (r *repo) newScan() bool {
- if r.status == nil {
- log.Warn("repo.status = nil. not initialized for some reason")
- return false
- }
-
- // first run the repostatus update
- r.status.UpdateNew()
-
- // now read those values and display them in our table
- mname := r.status.GetMasterBranchName()
- mver := r.status.GetMasterVersion()
- mver = mver + " (" + mname + ")"
- r.masterVersion.SetLabel(mver)
-
- dname := r.status.GetDevelBranchName()
- dver := r.status.GetDevelVersion()
- if dname != "devel" {
- dver = dver + " (" + dname + ")"
- }
- r.develVersion.SetLabel(dver)
-
- uname := r.status.GetUserBranchName()
- uver := r.status.GetUserVersion()
- usr, _ := user.Current()
- if uname != usr.Username {
- uver = uver + " (" + uname + ")"
- }
- r.userVersion.SetLabel(uver)
-
- cbname := r.status.GetCurrentBranchName()
- cbversion := r.status.GetCurrentBranchVersion()
- lasttag := r.status.GetLastTagVersion()
- r.lastTag.SetLabel(lasttag)
- r.vLabel.SetLabel(cbname + " " + cbversion)
-
- if c, ok := r.status.Changed(); ok {
- c := strings.TrimSpace(c)
- for _, line := range strings.Split(c, "\n") {
- log.Info(r.status.Path(), line)
- }
- }
- status := r.status.GetStatus()
- r.dirtyLabel.SetLabel(status)
- if status == "PERFECT" {
- if me.autoHidePerfect.Checked() {
- r.Hide()
- }
- return true
- }
- return false
-}
-
-// timeFunction takes a function as an argument and returns the execution time.
-func timeFunction(f func()) time.Duration {
- startTime := time.Now() // Record the start time
- f() // Execute the function
- return time.Since(startTime) // Calculate the elapsed time
-}
-
-func myTicker(t time.Duration, name string, f func()) {
- ticker := time.NewTicker(t)
- defer ticker.Stop()
- done := make(chan bool)
- /*
- go func() {
- time.Sleep(10 * time.Second)
- done <- true
- }()
- */
- for {
- select {
- case <-done:
- fmt.Println("Done!")
- return
- case t := <-ticker.C:
- log.Verbose(name, "Current time: ", t)
- f()
- }
- }
-}