summaryrefslogtreecommitdiff
path: root/findRepos.go
diff options
context:
space:
mode:
Diffstat (limited to 'findRepos.go')
-rw-r--r--findRepos.go42
1 files changed, 36 insertions, 6 deletions
diff --git a/findRepos.go b/findRepos.go
index a55c2c3..03705a7 100644
--- a/findRepos.go
+++ b/findRepos.go
@@ -1,6 +1,16 @@
package main
-// by default, work against every repo
+import (
+ "go.wit.com/lib/protobuf/gitpb"
+)
+
+// this populates a slice of protobuf records representing each git repo
+// var me.found []*gitpb.Repo
+//
+// so, it makes a subset of repos that are then used performing actions on
+//
+// by default, it adds every repo
+
func (f *FindCmd) findRepos() {
if f == nil {
findMine()
@@ -8,7 +18,7 @@ func (f *FindCmd) findRepos() {
}
if f.All {
- findAll(f)
+ findAll()
return
}
@@ -21,21 +31,28 @@ func (f *FindCmd) findRepos() {
findMine()
return
}
+
if f.Favorites {
findFavorites()
return
}
- findAll(f)
+ if f.Dirty {
+ findDirty()
+ return
+ }
+
+ findAll()
}
+/*
func findRepos(fargv *FindCmd) {
if fargv == nil {
findMine()
return
}
if fargv.All {
- findAll(fargv)
+ findAll()
return
}
@@ -55,6 +72,7 @@ func findRepos(fargv *FindCmd) {
findMine()
}
+*/
func findPrivate() {
all := me.forge.Repos.SortByFullPath()
@@ -78,7 +96,7 @@ func findMine() {
}
}
-// finds repos that are writable
+// finds repos the user has marked as favorites in the forge .config
func findFavorites() {
// log.Printf("get favorites %s\n", me.forge.GetGoSrc())
all := me.forge.Repos.SortByFullPath()
@@ -90,7 +108,19 @@ func findFavorites() {
}
}
-func findAll(fargv *FindCmd) {
+// finds repos that git is reporting as dirty
+func findDirty() {
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ var repo *gitpb.Repo
+ repo = all.Next()
+ if repo.IsDirty() {
+ me.found.AppendUniqueGoPath(repo)
+ }
+ }
+}
+
+func findAll() {
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()