public ObservableReferencesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _reference = client.GitDatabase.Reference; _connection = client.Connection; }
public ObservableReferencesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _reference = client.Git.Reference; _connection = client.Connection; }
public ReferencesClientTests() { _github = Helper.GetAuthenticatedClient(); _fixture = _github.Git.Reference; _context = _github.CreateRepositoryContext("public-repo").Result; }
public ReferencesClientTests() { _client = Helper.GetAuthenticatedClient(); _fixture = _client.GitDatabase.Reference; var repoName = Helper.MakeNameWithTimestamp("public-repo"); _repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result; _owner = _repository.Owner.Login; }
public static async Task <Reference> CreateOrUpdate(this IReferencesClient client, string repoOwner, string repoName, string refName, string sha, bool force = false) { try { return(await client.Update(repoOwner, repoName, refName, new ReferenceUpdate(sha, force))); } catch (Exception) { return(await client.Create(repoOwner, repoName, new NewReference(refName, sha))); } }
public ReferencesClientTests() { _client = new GitHubClient(new ProductHeaderValue("OctokitTests")) { Credentials = Helper.Credentials }; _fixture = _client.GitDatabase.Reference; var repoName = Helper.MakeNameWithTimestamp("public-repo"); _repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result; _owner = _repository.Owner.Login; }
public ReferencesClientTests() { _client = Helper.GetAuthenticatedClient(); _fixture = _client.GitDatabase.Reference; var repoName = Helper.MakeNameWithTimestamp("public-repo"); _repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result; _owner = _repository.Owner.Login; }
/// <summary> /// Creates a branch, based off the branch specified. /// </summary> /// <param name="referencesClient">The <see cref="IReferencesClient" /> this method extends</param> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="branchName">The new branch name</param> /// <param name="baseReference">The <see cref="Reference" /> to base the branch from</param> public static async Task <Reference> CreateBranch(this IReferencesClient referencesClient, string owner, string name, string branchName, Reference baseReference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName"); Ensure.ArgumentNotNull(baseReference, "baseReference"); if (branchName.StartsWith("refs/heads")) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The specified branch name '{0}' appears to be a ref name and not a branch name because it starts with the string 'refs/heads'. Either specify just the branch name or use the Create method if you need to specify the full ref name", branchName), "branchName"); } return(await referencesClient.Create(owner, name, new NewReference("refs/heads/" + branchName, baseReference.Object.Sha))); }