// GetRepos will return (and cache) a hash map of repositories by name for some
// convenient O(n*log(n)) look up!
353600
func (s *GitServer) GetRepos() (map[string]provider.Repo, error) {
	providerRepos := make(map[string]provider.Repo)
	if len(s.repos) == 0 {
		opt := &github.RepositoryListOptions{
			ListOptions: github.ListOptions{PerPage: 100},
		}
		for {
			repos, resp, err := s.client.Repositories.List(s.ctx, s.username, opt)
			if err != nil {
				return providerRepos, err
			}
			for _, repo := range repos {
				r := &Repo{impl: repo}
				providerRepos[*r.impl.Name] = r
				// Here is where we look up forked repo information (if we have it)
				if *repo.Fork {
					rr, _, err := s.client.Repositories.Get(s.ctx, s.username, *r.impl.Name)
					if err != nil {
						return providerRepos, err
					}
					parent := &Repo{impl: rr.Parent}
					r.forkedFrom = parent
				}
			}
			if resp.NextPage == 0 {
				break
			}
			opt.ListOptions.Page = resp.NextPage
		}
		s.repos = providerRepos
	}
	local.Printf("Cached %d repositories in memory", len(s.repos))
	return s.repos, nil
}
158408
func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {
	result := new(RepositoriesSearchResult)
	resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opt, result)
	return result, resp, err
}
1325263
func remoteRepo() (result config.Repo, err error) {
	if !git.IsRepo() {
		return result, errors.New("current folder is not a git repository")
	}
	out, err := git.Run("config", "--get", "remote.origin.url")
	if err != nil {
		return result, fmt.Errorf("repository doesn't have an `origin` remote")
	}
	return extractRepoFromURL(out), nil
}
100358
func (client *peerRESTClient) GetLocks() (locks GetLocksResp, err error) {
	respBody, err := client.call(peerRESTMethodGetLocks, nil, nil, -1)
	if err != nil {
		return
	}
	defer http.DrainBody(respBody)
	err = gob.NewDecoder(respBody).Decode(&locks)
	return locks, err
}
445111
func (o *Organization) GetPublicRepos() int {
	if o == nil || o.PublicRepos == nil {
		return 0
	}
	return *o.PublicRepos
}
1319786
func GetLabelsByRepoID(repoID int64) ([]*Label, error) {
	labels := make([]*Label, 0, 10)
	return labels, x.Where("repo_id = ?", repoID).Asc("name").Find(&labels)
}
85297
func IsRepositoryExist(u *User, repoName string) (bool, error) {
	return isRepositoryExist(x, u, repoName)
}
24320
func (c *Client) ListMyRepos() ([]*Repository, error) {
	repos := make([]*Repository, 0, 10)
	return repos, c.getParsedResponse("GET", "/user/repos", nil, nil, &repos)
}
112382
func getOrgRepoCtx(c *context.Context) (*OrgRepoCtx, error) {
	if len(c.Repo.RepoLink) > 0 {
		c.Data["PageIsRepositoryContext"] = true
		return &OrgRepoCtx{
			RepoID:      c.Repo.Repository.ID,
			Link:        c.Repo.RepoLink,
			NewTemplate: WEBHOOK_NEW,
		}, nil
	}

	if len(c.Org.OrgLink) > 0 {
		c.Data["PageIsOrganizationContext"] = true
		return &OrgRepoCtx{
			OrgID:       c.Org.Organization.ID,
			Link:        c.Org.OrgLink,
			NewTemplate: ORG_WEBHOOK_NEW,
		}, nil
	}

	return nil, errors.New("Unable to set OrgRepo context")
}
782526
func (d *Deployment) GetRepositoryURL() string {
	if d == nil || d.RepositoryURL == nil {
		return ""
	}
	return *d.RepositoryURL
}
1063299
func (user *User) GetAccessibleRepositories(limit int) (repos []*Repository, _ error) {
	sess := x.Where("owner_id !=? ", user.ID).Desc("updated_unix")
	if limit > 0 {
		sess.Limit(limit)
		repos = make([]*Repository, 0, limit)
	} else {
		repos = make([]*Repository, 0, 10)
	}
	return repos, sess.Join("INNER", "access", "access.user_id = ? AND access.repo_id = repository.id", user.ID).Find(&repos)
}
946225
func (n *rootNode) GetKeys() (keys []string) {
	if err := n.genMapBuf(); err != nil {
		return
	}
	keys = make([]string, 0, len(n.mapBuf))
	for key := range n.mapBuf {
		keys = append(keys, key)
	}
	return
}
1208172
func (t *TeamsService) GetRepositories(uri *Hyperlink, uriParams M) (
	repos []Repository, result *Result) {
	if uri == nil {
		uri = &TeamRepositoriesURL
	}
	return t.client.Repositories().All(uri, uriParams)
}
852060
func NewRepo(repo eh.ReadWriteRepo) *Repo {
	return &Repo{
		ReadWriteRepo: repo,
		cache:         map[namespace]map[uuid.UUID]eh.Entity{},
	}
}
501500
func (i *Installation) GetRepositoriesURL() string {
	if i == nil || i.RepositoriesURL == nil {
		return ""
	}
	return *i.RepositoriesURL
}
404809
func GetRepositoryByRef(ref string) (*Repository, error) {
	n := strings.IndexByte(ref, byte('/'))
	if n < 2 {
		return nil, errors.InvalidRepoReference{ref}
	}

	userName, repoName := ref[:n], ref[n+1:]
	user, err := GetUserByName(userName)
	if err != nil {
		return nil, err
	}

	return GetRepositoryByName(user.ID, repoName)
}
723252
func (c *Client) SnapshotGetRepository(repositories ...string) *SnapshotGetRepositoryService {
	return NewSnapshotGetRepositoryService(c).Repository(repositories...)
}