summaryrefslogtreecommitdiff
path: root/repos.go
diff options
context:
space:
mode:
Diffstat (limited to 'repos.go')
-rw-r--r--repos.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/repos.go b/repos.go
index 07ee8e2..4222ab9 100644
--- a/repos.go
+++ b/repos.go
@@ -118,6 +118,23 @@ func (a ByRepoName) Len() int { return len(a) }
func (a ByRepoName) Less(i, j int) bool { return a[i].Name < a[j].Name }
func (a ByRepoName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+func (all *Repos) DeleteByName(name string) *Repo {
+ reposLock.Lock()
+ defer reposLock.Unlock()
+
+ var newr Repo
+
+ for i, _ := range all.Repos {
+ if all.Repos[i].Name == name {
+ newr = *all.Repos[i]
+ all.Repos[i] = all.Repos[len(all.Repos)-1]
+ all.Repos = all.Repos[:len(all.Repos)-1]
+ return &newr
+ }
+ }
+ return nil
+}
+
// safely returns a slice of pointers to the Repo protobufs
func (r *Repos) selectAllRepos() []*Repo {
reposLock.RLock()