change to use gitpb
This commit is contained in:
parent
b1cdb841bc
commit
afe21d3c62
36
addRepo.go
36
addRepo.go
|
@ -1,12 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repostatus"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -55,39 +53,23 @@ func (c *controlBox) addRepo(path string) {
|
||||||
c.tagDate = gadgets.NewBasicEntry(c.grid, "git tag Date")
|
c.tagDate = gadgets.NewBasicEntry(c.grid, "git tag Date")
|
||||||
c.grid.NextRow()
|
c.grid.NextRow()
|
||||||
|
|
||||||
err, repo := repostatus.NewRepoStatusWindow(path)
|
cbname := repo.GetCurrentBranchName()
|
||||||
if err != nil {
|
cbversion := repo.GetCurrentBranchVersion()
|
||||||
log.Info("path did not work", path, err)
|
debversion := repo.DebianCurrentVersion()
|
||||||
return
|
|
||||||
}
|
|
||||||
if repo == nil {
|
|
||||||
log.Info("repo == nil", path, err)
|
|
||||||
os.Exit(-1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.status = repo
|
|
||||||
// c.status.SetMainWorkingName("master")
|
|
||||||
// c.status.SetDevelWorkingName("devel")
|
|
||||||
// c.status.SetUserWorkingName("jcarr")
|
|
||||||
c.status.Update()
|
|
||||||
|
|
||||||
cbname := c.status.GetCurrentBranchName()
|
if repo.CheckDirty() {
|
||||||
cbversion := c.status.GetCurrentBranchVersion()
|
|
||||||
debversion := c.status.DebianCurrentVersion()
|
|
||||||
|
|
||||||
if c.status.CheckDirty() {
|
|
||||||
c.dirtyL.SetText("true")
|
c.dirtyL.SetText("true")
|
||||||
} else {
|
} else {
|
||||||
c.dirtyL.SetText("false")
|
c.dirtyL.SetText("false")
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.GoPath.String() == "" {
|
if c.GoPath.String() == "" {
|
||||||
c.GoPath.SetText(c.status.GoPath())
|
c.GoPath.SetText(repo.GoPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
lasttag := c.status.GetLastTagVersion()
|
lasttag := repo.GetLastTagVersion()
|
||||||
if argv.Release {
|
if argv.Release {
|
||||||
debversion = c.status.DebianReleaseVersion()
|
debversion = repo.DebianReleaseVersion()
|
||||||
c.dirtyL.SetText("false")
|
c.dirtyL.SetText("false")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +81,5 @@ func (c *controlBox) addRepo(path string) {
|
||||||
tagDate := c.getDateStamp(lasttag)
|
tagDate := c.getDateStamp(lasttag)
|
||||||
c.tagDate.SetText(tagDate)
|
c.tagDate.SetText(tagDate)
|
||||||
|
|
||||||
if s, ok := c.status.Changed(); ok {
|
|
||||||
log.Warn("should scan here", s)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ func (c *controlBox) computeControlValues() bool {
|
||||||
// stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
|
// stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
|
||||||
|
|
||||||
func (c *controlBox) getDateStamp(tag string) string {
|
func (c *controlBox) getDateStamp(tag string) string {
|
||||||
r := c.status.Run([]string{"git", "log", "-1", "--format=%at", tag})
|
r := repo.Run([]string{"git", "log", "-1", "--format=%at", tag})
|
||||||
out := strings.Join(r.Stdout, "\n")
|
out := strings.Join(r.Stdout, "\n")
|
||||||
out = strings.TrimSpace(out)
|
out = strings.TrimSpace(out)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repostatus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type controlBox struct {
|
type controlBox struct {
|
||||||
|
@ -33,7 +32,7 @@ type controlBox struct {
|
||||||
currentL *gadgets.OneLiner
|
currentL *gadgets.OneLiner
|
||||||
buildDate *gadgets.OneLiner
|
buildDate *gadgets.OneLiner
|
||||||
tagDate *gadgets.BasicEntry
|
tagDate *gadgets.BasicEntry
|
||||||
status *repostatus.RepoStatus
|
// status *repostatus.RepoStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
// This initializes the control box
|
// This initializes the control box
|
||||||
|
|
23
main.go
23
main.go
|
@ -9,6 +9,8 @@ import (
|
||||||
"go.wit.com/lib/debugger"
|
"go.wit.com/lib/debugger"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,6 +21,10 @@ var DATE string
|
||||||
// This is the beginning of the binary tree of GUI widgets
|
// This is the beginning of the binary tree of GUI widgets
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
|
||||||
|
// this scans in the repos
|
||||||
|
var forge *forgepb.Forge
|
||||||
|
var repo *gitpb.Repo
|
||||||
|
|
||||||
var cBox *controlBox
|
var cBox *controlBox
|
||||||
|
|
||||||
// this is a basic window. the user can open and close it
|
// this is a basic window. the user can open and close it
|
||||||
|
@ -34,6 +40,17 @@ func main() {
|
||||||
println("go-deb --repo go.wit.com/apps/helloworld")
|
println("go-deb --repo go.wit.com/apps/helloworld")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
forge = forgepb.Init()
|
||||||
|
os.Setenv("REPO_WORK_PATH", forge.GetGoSrc())
|
||||||
|
|
||||||
|
repo = forge.Repos.FindByGoPath(argv.Repo)
|
||||||
|
if repo == nil {
|
||||||
|
log.Info("repo not found. you need to clone", argv.Repo)
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
log.Info("found repo", argv.Repo)
|
||||||
|
// build()
|
||||||
|
|
||||||
myGui = gui.New()
|
myGui = gui.New()
|
||||||
if !argv.Auto {
|
if !argv.Auto {
|
||||||
myGui.InitEmbed(resources)
|
myGui.InitEmbed(resources)
|
||||||
|
@ -65,7 +82,7 @@ func main() {
|
||||||
cBox.computeControlValues()
|
cBox.computeControlValues()
|
||||||
// verify the values for the package
|
// verify the values for the package
|
||||||
|
|
||||||
if cBox.status == nil {
|
if repo == nil {
|
||||||
if argv.Repo == "." {
|
if argv.Repo == "." {
|
||||||
// this means try the local directory for a custom 'control' file
|
// this means try the local directory for a custom 'control' file
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,8 +96,8 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the working directory to argv.Repo
|
// set the working directory to argv.Repo
|
||||||
log.Info("cd", cBox.status.Path())
|
log.Info("cd", repo.FullPath)
|
||||||
os.Chdir(cBox.status.Path())
|
os.Chdir(repo.FullPath)
|
||||||
|
|
||||||
if argv.Auto {
|
if argv.Auto {
|
||||||
shell.TestTerminalColor()
|
shell.TestTerminalColor()
|
||||||
|
|
|
@ -43,10 +43,5 @@ func makebasicWindow() *gadgets.BasicWindow {
|
||||||
basicWindow.Enable()
|
basicWindow.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
group1.NewButton("open repo", func() {
|
|
||||||
cBox.status.Update()
|
|
||||||
cBox.status.Toggle()
|
|
||||||
})
|
|
||||||
|
|
||||||
return basicWindow
|
return basicWindow
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue