Package com.cloudbees.jenkins
Class GitHubRepositoryName
java.lang.Object
com.cloudbees.jenkins.GitHubRepositoryName
Uniquely identifies a repository on GitHub.
- Author:
- Kohsuke Kawaguchi
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic GitHubRepositoryName
create
(GithubProjectProperty projectProperty) static GitHubRepositoryName
CreateGitHubRepositoryName
from URLboolean
getHost()
int
hashCode()
boolean
matches
(org.kohsuke.github.GHCommitPointer commit) Does this repository match the repository referenced in the givenGHCommitPointer
?boolean
matches
(org.kohsuke.github.GHRepository repo) Does this repository match the repository referenced in the givenGHCommitPointer
?Iterable
<org.kohsuke.github.GHRepository> resolve()
Resolves this name to the actual reference byGHRepository
Shortcut forresolve(Predicate)
with always true predicate (Predicates.alwaysTrue()
) as argumentIterable
<org.kohsuke.github.GHRepository> resolve
(com.google.common.base.Predicate<GitHubServerConfig> predicate) Resolves this name to the actual reference byGHRepository
.org.kohsuke.github.GHRepository
Variation ofresolve()
method that just returns the first valid repository object.toString()
-
Field Details
-
host
-
userName
-
repositoryName
-
-
Constructor Details
-
GitHubRepositoryName
-
-
Method Details
-
create
CreateGitHubRepositoryName
from URL- Parameters:
url
- repo url. Can be null- Returns:
- parsed
GitHubRepositoryName
or null if it cannot be parsed from the specified URL
-
create
- Parameters:
projectProperty
- project property to extract url. Can be null- Returns:
- parsed as
GitHubRepositoryName
object url to GitHub project - Since:
- 1.14.1
- See Also:
-
getHost
-
getUserName
-
getRepositoryName
-
resolve
Resolves this name to the actual reference byGHRepository
Shortcut forresolve(Predicate)
with always true predicate (Predicates.alwaysTrue()
) as argument -
resolve
public Iterable<org.kohsuke.github.GHRepository> resolve(com.google.common.base.Predicate<GitHubServerConfig> predicate) Resolves this name to the actual reference byGHRepository
. Since the system can store multiple credentials, and only some of them might be able to see this name in question, this method usesGitHubPluginConfig.findGithubConfig(Predicate)
and attempt to find the right credential that can access this repository. Any predicate as argument will be combined withGitHubServerConfig.withHost(String)
to find only corresponding for this repo name authenticated github repository This method walks multiple repositories for each credential that can access the repository. Depending on what you are trying to do with the repository, you might have to keep trying until aGHRepository
with suitable permission is returned.- Parameters:
predicate
- helps to filter only useful for resolveGitHubServerConfig
s- Returns:
- iterable with lazy login process for getting authenticated repos
- Since:
- 1.13.0
-
resolveOne
@CheckForNull public org.kohsuke.github.GHRepository resolveOne()Variation ofresolve()
method that just returns the first valid repository object. This is useful if the caller only relies on the read access to the repository and doesn't need to walk possible candidates. -
matches
public boolean matches(org.kohsuke.github.GHCommitPointer commit) Does this repository match the repository referenced in the givenGHCommitPointer
? -
matches
Does this repository match the repository referenced in the givenGHCommitPointer
?- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-