diff options
| author | Jeff Carr <[email protected]> | 2025-01-29 16:18:32 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-29 16:18:32 -0600 |
| commit | 2395a4466e9c08112372c480b30ac0823eeeb549 (patch) | |
| tree | ae008b2eadf649efd3950307f3896af891f84c33 /new.go | |
| parent | 2b2de94eff3ec37566665a22804c58c1ce764665 (diff) | |
Diffstat (limited to 'new.go')
| -rw-r--r-- | new.go | 113 |
1 files changed, 0 insertions, 113 deletions
@@ -1,113 +0,0 @@ -package repostatus - -import ( - "os" - - "go.wit.com/lib/gadgets" - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" -) - -var windowMap map[string]*RepoStatus - -func init() { - windowMap = make(map[string]*RepoStatus) -} - -/* -// deprecate this -func ListAllOld() { -} - -// returns the object for the path -// deprecate this -func FindPathOld(path string) *RepoStatus { - if windowMap[path] == nil { - log.Log(INFO, "FindPath() not initialized yet", path) - return nil - } - return windowMap[path] -} - -func SetWorkPath(path string) { - os.Setenv("REPO_WORK_PATH", path) -} -*/ - -// makes a window of the status of the repo -// don't worry, you can think of it like Sierpinski carpet -// it's doesn't need to be displayed so it'll work fine even in an embedded space -func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) { - path := repo.GetGoPath() - if windowMap[path] == nil { - log.Log(INFO, "NewRepoStatusWindow() adding new", path) - } else { - log.Warn("This already exists for path", path) - log.Warn("should return windowMap[path] here") - return windowMap[path], nil - } - - rs := &RepoStatus{ - ready: false, - } - rs.pb = repo - // realpath := repo.FullPath - // isGoLang := true - - // rs.tags = make(map[string]string) - rs.window = gadgets.RawBasicWindow("GO Repo Details " + path) - rs.window.Horizontal() - rs.window.Make() - basebox := rs.window.Box() - group := basebox.NewGroup("stuff") - primarybox := group.Box() - primarybox.Horizontal() - box2 := group.Box() - rs.ready = true - rs.window.Custom = func() { - rs.Hide() - log.Warn("repostatus user closed the window()") - } - - // display the status of the git repository - rs.drawGitStatus(primarybox) - - // display the git branches and options - rs.makeBranchesBox(primarybox) - - // show standard git commit and merge controls - rs.drawGitCommands(primarybox) - - // save ~/go/src & the whole path strings - rs.path.SetValue(path) - rs.goSrcPath.SetValue(os.Getenv("FORGE_GOSRC")) - rs.realPath.SetValue(rs.pb.GetFullPath()) - - // add all the tags - rs.makeTagBox(box2) - - // rs.readGitConfig() - - if rs.pb.GetReadOnly() { - rs.readOnly.SetValue("true") - } else { - rs.readOnly.SetValue("false") - } - rs.mainWorkingName.SetText(rs.pb.GetMasterBranchName()) - rs.mainBranchVersion.SetLabel(rs.pb.GetMasterBranchName()) - - rs.develWorkingName.SetText(rs.pb.GetDevelBranchName()) - rs.develBranchVersion.SetLabel(rs.pb.GetDevelBranchName()) - - rs.userWorkingName.SetText(rs.pb.GetUserBranchName()) - rs.userBranchVersion.SetLabel(rs.pb.GetUserBranchName()) - - if rs.pb.GetGoPath() == "" { - // not golang repo - } else { - rs.isGoLang.SetText("true") - rs.goPath.SetText(rs.pb.GetGoPath()) - } - windowMap[path] = rs - return rs, nil -} |
