summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--initRepoList.go46
-rw-r--r--repoview.go2
2 files changed, 3 insertions, 45 deletions
diff --git a/initRepoList.go b/initRepoList.go
index 9cf08b5..6d81149 100644
--- a/initRepoList.go
+++ b/initRepoList.go
@@ -3,35 +3,14 @@ package main
// this initializes the repos
import (
- "io/ioutil"
- "os"
- "os/user"
- "path/filepath"
"strings"
- "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
func (r *repoWindow) initRepoList() {
- usr, _ := user.Current()
-
- repos := parsecfg("~/.config/guireleaser")
- for _, line := range repos {
- log.Verbose("repo =", line)
- path, mbranch, dbranch, ubranch := splitLine(line)
- if mbranch == "" {
- mbranch = "master"
- }
- if dbranch == "" {
- dbranch = "devel"
- }
- if ubranch == "" {
- ubranch = usr.Username
- }
- r.View.AddRepo(path, mbranch, dbranch, ubranch)
- }
+ r.View.InitRepoList("~/.config/guireleaser")
log.Info("scanning everything in ~/go/src")
for i, path := range repostatus.ListGitDirectories() {
@@ -39,27 +18,6 @@ func (r *repoWindow) initRepoList() {
path = strings.TrimPrefix(path, me.goSrcPwd.String())
path = strings.Trim(path, "/")
log.Info("addRepo()", i, path)
- r.View.AddRepo(path, "master", "devel", usr.Username)
+ r.View.NewRepo(path)
}
}
-
-func parsecfg(f string) []string {
- homeDir, _ := os.UserHomeDir()
- cfgfile := filepath.Join(homeDir, f)
- content, _ := ioutil.ReadFile(cfgfile)
- out := string(content)
- out = strings.TrimSpace(out)
- lines := strings.Split(out, "\n")
- return lines
-}
-
-// returns path, master branch name, devel branch name, user branch name
-func splitLine(line string) (string, string, string, string) {
- var path, master, devel, user string
- parts := strings.Split(line, " ")
- path, parts = shell.RemoveFirstElement(parts)
- master, parts = shell.RemoveFirstElement(parts)
- devel, parts = shell.RemoveFirstElement(parts)
- user, parts = shell.RemoveFirstElement(parts)
- return path, master, devel, user
-}
diff --git a/repoview.go b/repoview.go
index 95dc288..2dfe6c3 100644
--- a/repoview.go
+++ b/repoview.go
@@ -2,8 +2,8 @@ package main
import (
"go.wit.com/lib/gadgets"
- "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/gowit"
+ "go.wit.com/lib/gui/repolist"
"go.wit.com/log"
"go.wit.com/gui"