Documentation ¶
Index ¶
Constants ¶
const ( // StatXRefs is the number of external references to any def defined in a // repository (i.e., references from other repositories). It is only // computed per-repository (and not per-repository-commit) because it is // not easy to determine which specific commit a ref references. StatXRefs = "xrefs" // StatAuthors is the number of resolved people who contributed code to any // def defined in a repository (i.e., references from other // repositories). It is only computed per-repository-commit. StatAuthors = "authors" // StatClients is the number of resolved people who have committed refs that // reference a def defined in the repository. It is only computed // per-repository (and not per-repository-commit) because it is not easy to // determine which specific commit a ref references. StatClients = "clients" // StatDependencies is the number of repositories that the repository // depends on. It is only computed per-repository-commit. StatDependencies = "dependencies" // StatDependents is the number of repositories containing refs to a def // defined in the repository. It is only computed per-repository (and not // per-repository-commit) because it is not easy to determine which specific // commit a ref references. StatDependents = "dependents" // StatDefs is the number of defs defined in a repository commit. It // is only computed per-repository-commit (or else it would count 1 def // for each revision of the repository that we have processed). StatDefs = "defs" // StatExportedDefs is the number of exported defs defined in a // repository commit. It is only computed per-repository-commit (or else it // would count 1 def for each revision of the repository that we have // processed). StatExportedDefs = "exported-defs" )
Variables ¶
var ErrForbidden = errors.New("repository is unavailable")
ErrForbidden is an error indicating that the repository can no longer be accessed due to server's refusal to serve it (possibly DMCA takedowns on github etc)
var ErrNoScheme = errors.New("clone URL has no scheme")
ErrNoScheme is an error indicating that a clone URL contained no scheme component (e.g., "http://").
var ErrNotExist = errors.New("repository does not exist on external host")
ErrNotExist is an error definitively indicating that no such repository exists.
var ErrNotPersisted = errors.New("repository is not persisted locally, but it might exist remotely (explicitly add it to check)")
ErrNotPersisted is an error indicating that no such repository is persisted locally. The repository might exist on a remote host, but it must be explicitly added (it will not be implicitly added via a Get call).
var ExternalHostTimeout = time.Second * 7
ExternalHostTimeout is the timeout for HTTP requests to external repository hosts.
var StatTypes = map[StatType]struct{}{StatXRefs: struct{}{}, StatAuthors: struct{}{}, StatClients: struct{}{}, StatDependencies: struct{}{}, StatDependents: struct{}{}, StatDefs: struct{}{}, StatExportedDefs: struct{}{}}
Functions ¶
func IsForbidden ¶
func IsNotPresent ¶
IsNotPresent returns whether err is one of ErrNotExist, ErrNotPersisted, or ErrRedirected.
func MapByURI ¶
func MapByURI(repos []*Repository) map[URI]*Repository
Types ¶
type ErrRenamed ¶
type ErrRenamed struct { // OldURI is the previous repository URI. OldURI URI // NewURI is the new URI that the repository was renamed to. NewURI URI }
ErrRenamed is an error type that indicates that a repository was renamed from OldURI to NewURI.
func (ErrRenamed) Error ¶
func (e ErrRenamed) Error() string
type Repositories ¶
type Repositories []*Repository
func (Repositories) URIs ¶
func (rs Repositories) URIs() (uris []URI)
type Repository ¶
type Repository struct { // RID is the numeric primary key for a repository. RID RID // URI is a normalized identifier for this repository based on its primary // clone URL. E.g., "github.com/user/repo". URI URI // Name is the base name (the final path component) of the repository, // typically the name of the directory that the repository would be cloned // into. (For example, for git://example.com/foo.git, the name is "foo".) Name string // OwnerUserID is the account that owns this repository. OwnerUserID person.UID `db:"owner_user_id"` // OwnerGitHubUserID is the GitHub user ID of this repository's owner, if this // is a GitHub repository. OwnerGitHubUserID nnz.Int `db:"owner_github_user_id" json:",omitempty"` // Description is a brief description of the repository. Description string `json:",omitempty"` // VCS is the short name of the VCS system that this repository uses: "git" // or "hg". VCS VCS `db:"vcs"` // CloneURL is the URL used to clone the repository from its original host. CloneURL string `db:"clone_url"` // HomepageURL is the URL to the repository's homepage, if any. HomepageURL nnz.String `db:"homepage_url"` // DefaultBranch is the default VCS branch used (typically "master" for git // repositories and "default" for hg repositories). DefaultBranch string `db:"default_branch"` // Language is the primary programming language used in this repository. Language string // GitHubStars is the number of stargazers this repository has on GitHub (or // 0 if it is not a GitHub repository). GitHubStars int `db:"github_stars"` // GitHubID is the GitHub ID of this repository. If a GitHub repository is // renamed, the ID remains the same and should be used to resolve across the // name change. GitHubID nnz.Int `db:"github_id" json:",omitempty"` // Disabled is whether this repo should not be downloaded and processed by the worker. Disabled bool `json:",omitempty"` // Deprecated repositories are labeled as such and hidden from global search results. Deprecated bool // Fork is whether this repository is a fork. Fork bool // Mirror is whether this repository is a mirror. Mirror bool // Private is whether this repository is private. Private bool }
func (*Repository) IsGitHubRepository ¶
func (r *Repository) IsGitHubRepository() bool
IsGitHubRepository returns true iff this repository is hosted on GitHub.
type StatType ¶
type StatType string
StatType is the name of a repository statistic (see below for a listing).
type URI ¶
type URI string
URI identifies a repository.
func MakeURI ¶
MakeURI converts a repository clone URL, such as "git://github.com/user/repo.git", to a normalized URI string, such as "github.com/user/repo".
func TryMakeURI ¶ added in v0.0.25
func (URI) GitHubURL ¶
GitHubURL returns the https://github.com/USER/REPO URL for this repository.
func (URI) IsGitHubRepository ¶
IsGitHubRepository returns true iff this repository is hosted on GitHub.
func (URI) IsGoogleCodeRepository ¶
IsGoogleCodeRepository returns true iff this repository is hosted on Google Code (code.google.com).