summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--doCheckout.go36
-rw-r--r--windowSummary.go2
3 files changed, 26 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index e97f825..24264d9 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ install: goimports vet plugin
plugin:
rm -f resources/*.so
- cp ~/go/lib/gocui.so resources/
+ -cp ~/go/lib/gocui.so resources/
goimports:
reset
diff --git a/doCheckout.go b/doCheckout.go
index 7f9a6fa..40522e7 100644
--- a/doCheckout.go
+++ b/doCheckout.go
@@ -36,9 +36,10 @@ func IsEverythingOnMaster() (int, int, int, error) {
return total, count, nope, nil
}
-func IsEverythingOnDevel() (int, int, error) {
+func IsEverythingOnDevel() (int, int, int, error) {
var total int
var count int
+ var nope int
// first make sure every repo is on the master branch
all := me.forge.Repos.All()
@@ -47,18 +48,20 @@ func IsEverythingOnDevel() (int, int, error) {
total += 1
if repo.GetDevelBranchName() == repo.GetCurrentBranchName() {
count += 1
+ } else {
+ nope += 1
}
}
- log.Printf("Devel branch check. %d total repos. %d repos on the devel branch\n", total, count)
if total != count {
- return total, count, ErrorNotAllReposOnDevel
+ return total, count, nope, ErrorNotAllReposOnDevel
}
- return total, count, nil
+ return total, count, nope, nil
}
-func IsEverythingOnUser() (int, int, error) {
+func IsEverythingOnUser() (int, int, int, error) {
var total int
var count int
+ var nope int
// first make sure every repo is on the master branch
all := me.forge.Repos.All()
@@ -67,13 +70,14 @@ func IsEverythingOnUser() (int, int, error) {
total += 1
if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
count += 1
+ } else {
+ nope += 1
}
}
- log.Printf("User branch check. %d total repos. %d repos on the user branch\n", total, count)
if total != count {
- return total, count, ErrorNotAllReposOnUser
+ return total, count, nope, ErrorNotAllReposOnUser
}
- return total, count, nil
+ return total, count, nope, nil
}
func doGitReset() {
@@ -108,13 +112,18 @@ func rillCheckoutUser(repo *gitpb.Repo) error {
return nil
}
+// trys to figure out if there is still something to update
func doAllCheckoutUser() error {
+ now := time.Now()
me.forge.RillFuncError(rillCheckoutUser)
count := me.forge.RillReload()
if count != 0 {
me.forge.ConfigSave()
}
- if _, _, err := IsEverythingOnUser(); err != nil {
+
+ total, count, nope, err := IsEverythingOnUser()
+ log.Printf("User branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if err != nil {
// display all repos not on user
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
@@ -144,13 +153,18 @@ func rillCheckoutDevel(repo *gitpb.Repo) error {
return nil
}
+// is every repo on the devel branch?
func doAllCheckoutDevel() error {
+ now := time.Now()
me.forge.RillFuncError(rillCheckoutDevel)
count := me.forge.RillReload()
if count != 0 {
me.forge.ConfigSave()
}
- if _, _, err := IsEverythingOnDevel(); err != nil {
+
+ total, count, nope, err := IsEverythingOnDevel()
+ log.Printf("Devel branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
+ if err != nil {
// display all repos not on user
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
@@ -198,8 +212,6 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
}
// trys to figure out if there is still something to update
-// todo: redo this logic as it is terrible
-
func doAllCheckoutMaster() error {
now := time.Now()
me.forge.RillFuncError(rillCheckoutMaster)
diff --git a/windowSummary.go b/windowSummary.go
index 30c34cb..ac066b7 100644
--- a/windowSummary.go
+++ b/windowSummary.go
@@ -104,7 +104,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
if err != nil {
return
}
- if _, _, err := IsEverythingOnDevel(); err != nil {
+ if _, _, _, err := IsEverythingOnDevel(); err != nil {
log.Info("You can only apply patches to the devel branch")
return
}