still rm old code
This commit is contained in:
parent
9221f83aaf
commit
d9a54a6c31
|
@ -26,17 +26,19 @@ func (rs *RepoStatus) makeBranchesBox(parent *gui.Node) {
|
||||||
newgrid.NextRow()
|
newgrid.NextRow()
|
||||||
|
|
||||||
rs.switchBranchB = newgrid.NewButton("Switch Branch", func() { // `progname:"SWITCH"`
|
rs.switchBranchB = newgrid.NewButton("Switch Branch", func() { // `progname:"SWITCH"`
|
||||||
bname := rs.targetBranch.String()
|
/*
|
||||||
log.Info("Should switch to branch", bname, "here")
|
bname := rs.targetBranch.String()
|
||||||
|
log.Info("Should switch to branch", bname, "here")
|
||||||
|
|
||||||
var all [][]string
|
var all [][]string
|
||||||
all = append(all, []string{"git", "checkout", bname})
|
all = append(all, []string{"git", "checkout", bname})
|
||||||
if rs.DoAll(all) {
|
if rs.DoAll(all) {
|
||||||
log.Info("branch switched to", bname)
|
log.Info("branch switched to", bname)
|
||||||
} else {
|
} else {
|
||||||
log.Info("branch switched to", bname, "failed")
|
log.Info("branch switched to", bname, "failed")
|
||||||
}
|
}
|
||||||
rs.updateNew()
|
rs.updateNew()
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
rs.targetBranch = newgrid.NewDropdown() // `progname:"TARGET"`
|
rs.targetBranch = newgrid.NewDropdown() // `progname:"TARGET"`
|
||||||
|
|
2
git.go
2
git.go
|
@ -18,9 +18,11 @@ func (rs *RepoStatus) GetCurrentBranchVersion() string {
|
||||||
return rs.currentVersion.String()
|
return rs.currentVersion.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) LastGitPull() (time.Time, error) {
|
func (rs *RepoStatus) LastGitPull() (time.Time, error) {
|
||||||
return rs.mtime(".git/FETCH_HEAD")
|
return rs.mtime(".git/FETCH_HEAD")
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (rs *RepoStatus) Age() time.Duration {
|
func (rs *RepoStatus) Age() time.Duration {
|
||||||
var t *Tag
|
var t *Tag
|
||||||
|
|
|
@ -223,6 +223,7 @@ func (rs *RepoStatus) GitURL() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) GitLsFiles() (bool, string) {
|
func (rs *RepoStatus) GitLsFiles() (bool, string) {
|
||||||
r := rs.Run([]string{"git", "ls-files"})
|
r := rs.Run([]string{"git", "ls-files"})
|
||||||
output := strings.Join(r.Stdout, "\n")
|
output := strings.Join(r.Stdout, "\n")
|
||||||
|
@ -233,6 +234,7 @@ func (rs *RepoStatus) GitLsFiles() (bool, string) {
|
||||||
}
|
}
|
||||||
return true, output
|
return true, output
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (rs *RepoStatus) ReadOnly() bool {
|
func (rs *RepoStatus) ReadOnly() bool {
|
||||||
if rs.readOnly.String() == "true" {
|
if rs.readOnly.String() == "true" {
|
||||||
|
|
|
@ -2,10 +2,7 @@ package repostatus
|
||||||
|
|
||||||
// does processing on the go.mod and go.sum files
|
// does processing on the go.mod and go.sum files
|
||||||
|
|
||||||
import (
|
/*
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
// for now, even check cmd.Exit
|
// for now, even check cmd.Exit
|
||||||
func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
||||||
r := rs.Run(cmd)
|
r := rs.Run(cmd)
|
||||||
|
@ -19,6 +16,7 @@ func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func (rs *RepoStatus) IsReleased() bool {
|
func (rs *RepoStatus) IsReleased() bool {
|
||||||
|
|
2
merge.go
2
merge.go
|
@ -75,6 +75,7 @@ func (rs *RepoStatus) generateCmd() bool {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) runGitCommands(verbose bool) bool {
|
func (rs *RepoStatus) runGitCommands(verbose bool) bool {
|
||||||
var line []string
|
var line []string
|
||||||
for _, line = range rs.versionCmds {
|
for _, line = range rs.versionCmds {
|
||||||
|
@ -99,6 +100,7 @@ func (rs *RepoStatus) runGitCommands(verbose bool) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (rs *RepoStatus) setGitCommands() {
|
func (rs *RepoStatus) setGitCommands() {
|
||||||
var line1, line2, line3 []string
|
var line1, line2, line3 []string
|
||||||
|
|
40
tagWindow.go
40
tagWindow.go
|
@ -70,14 +70,16 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tagB.group.NewButton("delete all", func() {
|
tagB.group.NewButton("delete all", func() {
|
||||||
for i, t := range tagB.tags {
|
/*
|
||||||
if t.hidden {
|
for i, t := range tagB.tags {
|
||||||
// log.Info("tag is hidden", i, t.tag.String())
|
if t.hidden {
|
||||||
continue
|
// log.Info("tag is hidden", i, t.tag.String())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Info("tag is shown", i, t.tag.String())
|
||||||
|
// rs.DeleteTag(t)
|
||||||
}
|
}
|
||||||
log.Info("tag is shown", i, t.tag.String())
|
*/
|
||||||
rs.DeleteTag(t)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
grid := tagB.group.NewGrid("tags", 0, 0)
|
grid := tagB.group.NewGrid("tags", 0, 0)
|
||||||
|
@ -104,17 +106,19 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) error {
|
||||||
|
|
||||||
rTag.subject = grid.NewLabel(tag.GetSubject())
|
rTag.subject = grid.NewLabel(tag.GetSubject())
|
||||||
rTag.deleteB = grid.NewButton("delete", func() {
|
rTag.deleteB = grid.NewButton("delete", func() {
|
||||||
tagversion := tag.GetRefname()
|
/*
|
||||||
log.Info("remove tag", tagversion)
|
tagversion := tag.GetRefname()
|
||||||
var all [][]string
|
log.Info("remove tag", tagversion)
|
||||||
all = append(all, []string{"git", "tag", "--delete", tagversion})
|
var all [][]string
|
||||||
all = append(all, []string{"git", "push", "--delete", "origin", tagversion})
|
all = append(all, []string{"git", "tag", "--delete", tagversion})
|
||||||
|
all = append(all, []string{"git", "push", "--delete", "origin", tagversion})
|
||||||
|
|
||||||
if rs.DoAll(all) {
|
if rs.DoAll(all) {
|
||||||
log.Info("TAG DELETED", rs.Path(), tagversion)
|
log.Info("TAG DELETED", rs.Path(), tagversion)
|
||||||
} else {
|
} else {
|
||||||
log.Info("TAG DELETE FAILED", rs.Path(), tagversion)
|
log.Info("TAG DELETE FAILED", rs.Path(), tagversion)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
tagB.tags = append(tagB.tags, rTag)
|
tagB.tags = append(tagB.tags, rTag)
|
||||||
|
@ -216,6 +220,7 @@ func (rtags *GitTagBox) PruneSmart() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// deleting it locally triggers some but when
|
// deleting it locally triggers some but when
|
||||||
// the git server was uncontactable (over IPv6 if that matters, probably it doesn't)
|
// the git server was uncontactable (over IPv6 if that matters, probably it doesn't)
|
||||||
// and then the local delete re-added it into the tag
|
// and then the local delete re-added it into the tag
|
||||||
|
@ -241,6 +246,7 @@ func (rs *RepoStatus) DeleteTag(rt *Tag) {
|
||||||
log.Info("output:", output)
|
log.Info("output:", output)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (rt *Tag) TagString() string {
|
func (rt *Tag) TagString() string {
|
||||||
return rt.tag.String()
|
return rt.tag.String()
|
||||||
|
|
48
unix.go
48
unix.go
|
@ -3,15 +3,13 @@ package repostatus
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-cmd/cmd"
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) Run(cmd []string) cmd.Status {
|
func (rs *RepoStatus) Run(cmd []string) cmd.Status {
|
||||||
path := rs.realPath.String()
|
path := rs.realPath.String()
|
||||||
r := shell.PathRun(path, cmd)
|
r := shell.PathRun(path, cmd)
|
||||||
|
@ -73,48 +71,6 @@ func Exists(file string) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func getDurationStamp(t time.Time) string {
|
|
||||||
|
|
||||||
// Get the current time
|
|
||||||
currentTime := time.Now()
|
|
||||||
|
|
||||||
// Calculate the duration between t current time
|
|
||||||
duration := currentTime.Sub(t)
|
|
||||||
|
|
||||||
return formatDuration(duration)
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatDuration(d time.Duration) string {
|
|
||||||
seconds := int(d.Seconds()) % 60
|
|
||||||
minutes := int(d.Minutes()) % 60
|
|
||||||
hours := int(d.Hours()) % 24
|
|
||||||
days := int(d.Hours()) / 24
|
|
||||||
years := int(d.Hours()) / (24 * 365)
|
|
||||||
|
|
||||||
result := ""
|
|
||||||
if years > 0 {
|
|
||||||
result += fmt.Sprintf("%dy ", years)
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if days > 0 {
|
|
||||||
result += fmt.Sprintf("%dd ", days)
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if hours > 0 {
|
|
||||||
result += fmt.Sprintf("%dh ", hours)
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if minutes > 0 {
|
|
||||||
result += fmt.Sprintf("%dm ", minutes)
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
if seconds > 0 {
|
|
||||||
result += fmt.Sprintf("%ds", seconds)
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (rs *RepoStatus) XtermNohup(cmdline string) {
|
func (rs *RepoStatus) XtermNohup(cmdline string) {
|
||||||
|
@ -149,6 +105,7 @@ func (rs *RepoStatus) XtermBash(args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) DoAll(all [][]string) bool {
|
func (rs *RepoStatus) DoAll(all [][]string) bool {
|
||||||
for _, cmd := range all {
|
for _, cmd := range all {
|
||||||
log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
|
log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
|
||||||
|
@ -161,3 +118,4 @@ func (rs *RepoStatus) DoAll(all [][]string) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
func (rs *RepoStatus) gitBranchAll() {
|
func (rs *RepoStatus) gitBranchAll() {
|
||||||
r := rs.Run([]string{"git", "branch", "--all"})
|
r := rs.Run([]string{"git", "branch", "--all"})
|
||||||
if r.Error != nil {
|
if r.Error != nil {
|
||||||
|
@ -19,6 +20,7 @@ func (rs *RepoStatus) gitBranchAll() {
|
||||||
rs.targetBranch.AddText(s)
|
rs.targetBranch.AddText(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (rs *RepoStatus) UpdateNew() {
|
func (rs *RepoStatus) UpdateNew() {
|
||||||
log.Info("gui update", rs.pb.GetFullPath())
|
log.Info("gui update", rs.pb.GetFullPath())
|
||||||
|
|
Loading…
Reference in New Issue