本文整理汇总了C#中Octokit.RepositoryUpdate类的典型用法代码示例。如果您正苦于以下问题:C# RepositoryUpdate类的具体用法?C# RepositoryUpdate怎么用?C# RepositoryUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryUpdate类属于Octokit命名空间,在下文中一共展示了RepositoryUpdate类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAsync
public async Task<string> CreateAsync(string name)
{
var newRepo = new NewRepository(name) { AutoInit = true };
var repository = await Client.Repository.Create(newRepo).ConfigureAwait(false);
var newLabels =
Configuration.repository.labels.Select(label => new NewLabel(label.name, label.color)).ToList();
foreach (var newLabel in newLabels)
{
await Client.Issue.Labels.Create(repository.Owner.Login, repository.Name, newLabel).ConfigureAwait(false);
}
foreach (var branch in Configuration.repository.branches)
{
var master =
await
Client.GitDatabase.Reference.Get(repository.Owner.Login, repository.Name, "heads/master")
.ConfigureAwait(false);
var reference = new NewReference($"refs/heads/{branch.Name}", master.Object.Sha);
var createdReference = await
Client.GitDatabase.Reference.Create(repository.Owner.Login, repository.Name, reference)
.ConfigureAwait(false);
if (branch.IsDefault)
{
var repositoryUpdate = new RepositoryUpdate();
repositoryUpdate.Name = repository.Name;
repositoryUpdate.DefaultBranch = branch.Name;
await Client.Repository.Edit(repository.Owner.Login, repository.Name, repositoryUpdate).ConfigureAwait(false);
}
}
return repository.HtmlUrl;
}
示例2: Edit
/// <summary>
/// Updates the specified repository with the values given in <paramref name="update"/>
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="update">New values to update the repository with</param>
/// <returns>The updated <see cref="T:Octokit.Repository"/></returns>
public Task<Repository> Edit(int repositoryId, RepositoryUpdate update)
{
Ensure.ArgumentNotNull(update, "update");
return ApiConnection.Patch<Repository>(ApiUrls.Repository(repositoryId), update);
}
示例3: UpdatesMergeMethodWithRepositoryId
public async Task UpdatesMergeMethodWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
using (var context = await github.CreateRepositoryContext("public-repo"))
{
var updateRepository = new RepositoryUpdate(context.RepositoryName)
{
AllowMergeCommit = true,
AllowSquashMerge = true,
AllowRebaseMerge = false
};
var editedRepository = await github.Repository.Edit(context.RepositoryId, updateRepository);
Assert.True(editedRepository.AllowMergeCommit);
Assert.True(editedRepository.AllowSquashMerge);
Assert.False(editedRepository.AllowRebaseMerge);
var repository = await github.Repository.Get(context.RepositoryId);
Assert.True(repository.AllowMergeCommit);
Assert.True(repository.AllowSquashMerge);
Assert.False(repository.AllowRebaseMerge);
}
}
示例4: UpdatesHasWikiWithRepositoryId
public async Task UpdatesHasWikiWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
_repository = await github.Repository.Edit(_repository.Id, update);
Assert.Equal(false, _repository.HasWiki);
}
示例5: UpdatesPrivateWithRepositoryId
public async Task UpdatesPrivateWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
var userDetails = await github.User.Current();
if (userDetails.Plan.PrivateRepos == 0)
{
throw new Exception("Test cannot complete, account is on free plan");
}
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, Private = true };
_repository = await github.Repository.Edit(_repository.Id, update);
Assert.Equal(true, _repository.Private);
}
示例6: UpdatesHomepageWithRepositoryId
public async Task UpdatesHomepageWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
_repository = await github.Repository.Edit(_repository.Id, update);
Assert.Equal("http://aUrl.to/nowhere", _repository.Homepage);
}
示例7: UpdatesDescriptionWithRepositoryId
public async Task UpdatesDescriptionWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
_repository = await github.Repository.Edit(_repository.Id, update);
Assert.Equal("Updated description", _repository.Description);
}
示例8: UpdatesName
public async Task UpdatesName()
{
var github = Helper.GetAuthenticatedClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate { Name = updatedName };
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
Assert.Equal(update.Name, _repository.Name);
}
示例9: EnsuresNonNullArguments
public void EnsuresNonNullArguments()
{
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
var update = new RepositoryUpdate();
Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Edit("", "repo", update));
Assert.Throws<ArgumentException>(() => client.Edit("owner", "", update));
}
示例10: PatchesCorrectUrl
public void PatchesCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
var update = new RepositoryUpdate();
client.Edit("owner", "repo", update);
connection.Received()
.Patch<Repository>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo"), Arg.Any<RepositoryUpdate>());
}
示例11: Edit
/// <summary>
/// Updates the specified repository with the values given in <paramref name="update"/>
/// </summary>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="update">New values to update the repository with</param>
/// <returns>The updated <see cref="T:Octokit.Repository"/></returns>
public Task<Repository> Edit(long repositoryId, RepositoryUpdate update)
{
Ensure.ArgumentNotNull(update, "update");
return ApiConnection.Patch<Repository>(ApiUrls.Repository(repositoryId), update, AcceptHeaders.SquashCommitPreview);
}
示例12: UpdatesHasWiki
public async Task UpdatesHasWiki()
{
var github = CreateGitHubClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
Assert.Equal(false, _repository.HasWiki);
}
示例13: UpdatesHomepage
public async Task UpdatesHomepage()
{
var github = CreateGitHubClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
Assert.Equal("http://aUrl.to/nowhere", _repository.Homepage);
}
示例14: UpdatesDescription
public async Task UpdatesDescription()
{
var github = CreateGitHubClient();
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
Assert.Equal("Updated description", _repository.Description);
}