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()
|
||||
|
||||
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
|
||||
all = append(all, []string{"git", "checkout", bname})
|
||||
if rs.DoAll(all) {
|
||||
log.Info("branch switched to", bname)
|
||||
} else {
|
||||
log.Info("branch switched to", bname, "failed")
|
||||
}
|
||||
rs.updateNew()
|
||||
var all [][]string
|
||||
all = append(all, []string{"git", "checkout", bname})
|
||||
if rs.DoAll(all) {
|
||||
log.Info("branch switched to", bname)
|
||||
} else {
|
||||
log.Info("branch switched to", bname, "failed")
|
||||
}
|
||||
rs.updateNew()
|
||||
*/
|
||||
})
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) LastGitPull() (time.Time, error) {
|
||||
return rs.mtime(".git/FETCH_HEAD")
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) Age() time.Duration {
|
||||
var t *Tag
|
||||
|
|
|
@ -223,6 +223,7 @@ func (rs *RepoStatus) GitURL() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) GitLsFiles() (bool, string) {
|
||||
r := rs.Run([]string{"git", "ls-files"})
|
||||
output := strings.Join(r.Stdout, "\n")
|
||||
|
@ -233,6 +234,7 @@ func (rs *RepoStatus) GitLsFiles() (bool, string) {
|
|||
}
|
||||
return true, output
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) ReadOnly() bool {
|
||||
if rs.readOnly.String() == "true" {
|
||||
|
|
|
@ -2,10 +2,7 @@ package repostatus
|
|||
|
||||
// does processing on the go.mod and go.sum files
|
||||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
// for now, even check cmd.Exit
|
||||
func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
||||
r := rs.Run(cmd)
|
||||
|
@ -19,6 +16,7 @@ func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
|||
}
|
||||
return true, nil
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
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 {
|
||||
var line []string
|
||||
for _, line = range rs.versionCmds {
|
||||
|
@ -99,6 +100,7 @@ func (rs *RepoStatus) runGitCommands(verbose bool) bool {
|
|||
}
|
||||
return true
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) setGitCommands() {
|
||||
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() {
|
||||
for i, t := range tagB.tags {
|
||||
if t.hidden {
|
||||
// log.Info("tag is hidden", i, t.tag.String())
|
||||
continue
|
||||
/*
|
||||
for i, t := range tagB.tags {
|
||||
if t.hidden {
|
||||
// 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)
|
||||
|
@ -104,17 +106,19 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) error {
|
|||
|
||||
rTag.subject = grid.NewLabel(tag.GetSubject())
|
||||
rTag.deleteB = grid.NewButton("delete", func() {
|
||||
tagversion := tag.GetRefname()
|
||||
log.Info("remove tag", tagversion)
|
||||
var all [][]string
|
||||
all = append(all, []string{"git", "tag", "--delete", tagversion})
|
||||
all = append(all, []string{"git", "push", "--delete", "origin", tagversion})
|
||||
/*
|
||||
tagversion := tag.GetRefname()
|
||||
log.Info("remove tag", tagversion)
|
||||
var all [][]string
|
||||
all = append(all, []string{"git", "tag", "--delete", tagversion})
|
||||
all = append(all, []string{"git", "push", "--delete", "origin", tagversion})
|
||||
|
||||
if rs.DoAll(all) {
|
||||
log.Info("TAG DELETED", rs.Path(), tagversion)
|
||||
} else {
|
||||
log.Info("TAG DELETE FAILED", rs.Path(), tagversion)
|
||||
}
|
||||
if rs.DoAll(all) {
|
||||
log.Info("TAG DELETED", rs.Path(), tagversion)
|
||||
} else {
|
||||
log.Info("TAG DELETE FAILED", rs.Path(), tagversion)
|
||||
}
|
||||
*/
|
||||
})
|
||||
|
||||
tagB.tags = append(tagB.tags, rTag)
|
||||
|
@ -216,6 +220,7 @@ func (rtags *GitTagBox) PruneSmart() {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// deleting it locally triggers some but when
|
||||
// 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
|
||||
|
@ -241,6 +246,7 @@ func (rs *RepoStatus) DeleteTag(rt *Tag) {
|
|||
log.Info("output:", output)
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
func (rt *Tag) TagString() string {
|
||||
return rt.tag.String()
|
||||
|
|
48
unix.go
48
unix.go
|
@ -3,15 +3,13 @@ package repostatus
|
|||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-cmd/cmd"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) Run(cmd []string) cmd.Status {
|
||||
path := rs.realPath.String()
|
||||
r := shell.PathRun(path, cmd)
|
||||
|
@ -73,48 +71,6 @@ func Exists(file string) bool {
|
|||
}
|
||||
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) {
|
||||
|
@ -149,6 +105,7 @@ func (rs *RepoStatus) XtermBash(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) DoAll(all [][]string) bool {
|
||||
for _, cmd := range all {
|
||||
log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
|
||||
|
@ -161,3 +118,4 @@ func (rs *RepoStatus) DoAll(all [][]string) bool {
|
|||
}
|
||||
return true
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) gitBranchAll() {
|
||||
r := rs.Run([]string{"git", "branch", "--all"})
|
||||
if r.Error != nil {
|
||||
|
@ -19,6 +20,7 @@ func (rs *RepoStatus) gitBranchAll() {
|
|||
rs.targetBranch.AddText(s)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) UpdateNew() {
|
||||
log.Info("gui update", rs.pb.GetFullPath())
|
||||
|
|
Loading…
Reference in New Issue