summaryrefslogtreecommitdiff
path: root/ideas
diff options
context:
space:
mode:
Diffstat (limited to 'ideas')
-rw-r--r--ideas/pruneTags.go32
-rw-r--r--ideas/revert.go41
-rw-r--r--ideas/timer.go36
3 files changed, 109 insertions, 0 deletions
diff --git a/ideas/pruneTags.go b/ideas/pruneTags.go
new file mode 100644
index 0000000..85a2990
--- /dev/null
+++ b/ideas/pruneTags.go
@@ -0,0 +1,32 @@
+package repostatus
+
+import (
+ "strings"
+
+ "go.wit.com/log"
+)
+
+func (rs *RepoStatus) setGitCommands() {
+ var line1, line2, line3 []string
+ var all [][]string
+
+ newTag := rs.newversion.String()
+ line1 = append(line1, "git", "tag", "v"+newTag, "-m", rs.versionMessage.String())
+ all = append(all, line1)
+ line2 = append(line2, "git", "push", "--tags")
+ all = append(all, line2)
+ line3 = append(line3, "git", "push", "--prune", "--tags")
+ all = append(all, line3)
+
+ rs.versionCmds = all
+
+ var tmp []string
+ // convert to displayable to the user text
+ for _, line := range all {
+ s := strings.Join(line, " ")
+ log.Log(INFO, "s =", s)
+ tmp = append(tmp, s)
+ }
+
+ rs.versionCmdOutput.SetValue(strings.Join(tmp, "\n"))
+}
diff --git a/ideas/revert.go b/ideas/revert.go
new file mode 100644
index 0000000..5a080e9
--- /dev/null
+++ b/ideas/revert.go
@@ -0,0 +1,41 @@
+package repostatus
+
+// 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()
+ dName := rs.GetDevelBranchName()
+ 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())
+
+ var all [][]string
+ all = append(all, []string{"git", "checkout", dName}) // switch to the devel branch
+ all = append(all, []string{"git", "branch", "-D", mName})
+ all = append(all, []string{"git", "branch", mName}) // make a master branch based on devel
+ all = append(all, []string{"git", "checkout", mName})
+ all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
+
+ // don't do anything with tags here
+ // 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
+}
+*/
diff --git a/ideas/timer.go b/ideas/timer.go
new file mode 100644
index 0000000..3d18445
--- /dev/null
+++ b/ideas/timer.go
@@ -0,0 +1,36 @@
+package repostatus
+
+import (
+ "time"
+)
+
+// 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 (ls *RepoStatus) SetSpeedActual(s string) {
+ if !ls.Ready() {
+ return
+ }
+ ls.speedActual.SetValue(s)
+}
+
+func (rs *RepoStatus) setSpeed(duration time.Duration) {
+ s := fmt.Sprint(duration)
+ if rs.speedActual == nil {
+ log.Log(WARN, "rs.speedActual == nil")
+ return
+ }
+ rs.speedActual.SetValue(s)
+
+ if duration > 200*time.Millisecond {
+ rs.speed.SetValue("SLOW")
+ } else if duration > 50*time.Millisecond {
+ rs.speed.SetValue("OK")
+ } else {
+ rs.speed.SetValue("FAST")
+ }
+}