remove noninclusive language
This commit is contained in:
Родитель
8f341f8e33
Коммит
af8d8fbbe6
|
@ -1,6 +1,6 @@
|
|||
### Sample snippet contributions
|
||||
|
||||
For client library sample snippets, review and follow the [snippet contribution guidance](https://github.com/Microsoft/vsts-dotnet-samples/blob/master/ClientLibrary/Snippets/contribute.md)
|
||||
For client library sample snippets, review and follow the [snippet contribution guidance](https://github.com/Microsoft/azure-devops-dotnet-samples/blob/HEAD/ClientLibrary/Snippets/contribute.md)
|
||||
|
||||
* [ ] Follow organization guidelines
|
||||
* [ ] Use real types (avoids `var`)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/HEAD/debugger-launchjson.md
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
|
||||
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/HEAD/debugger-launchjson.md#console-terminal-window
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false,
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
public List<GitCommitRef> GetCommitsOnABranch()
|
||||
{
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepositoryOnAnyProject(this.Context);
|
||||
string branchName = repo.DefaultBranch;
|
||||
string branchNameWithoutRefsHeads = branchName.Remove(0, "refs/heads/".Length);
|
||||
|
||||
return this.Context.Connection.GetClient<GitHttpClient>()
|
||||
.GetCommitsAsync(repo.Id, new GitQueryCommitsCriteria()
|
||||
|
@ -52,7 +54,7 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
{
|
||||
VersionType = GitVersionType.Branch,
|
||||
VersionOptions = GitVersionOptions.None,
|
||||
Version = "master"
|
||||
Version = branchNameWithoutRefsHeads
|
||||
}
|
||||
}).Result;
|
||||
}
|
||||
|
@ -61,6 +63,8 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
public List<GitCommitRef> GetCommitsOnABranchAndInAPath()
|
||||
{
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepositoryOnAnyProject(this.Context);
|
||||
string branchName = repo.DefaultBranch;
|
||||
string branchNameWithoutRefsHeads = branchName.Remove(0, "refs/heads/".Length);
|
||||
|
||||
return this.Context.Connection.GetClient<GitHttpClient>()
|
||||
.GetCommitsAsync(repo.Id, new GitQueryCommitsCriteria()
|
||||
|
@ -69,7 +73,7 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
{
|
||||
VersionType = GitVersionType.Branch,
|
||||
VersionOptions = GitVersionOptions.None,
|
||||
Version = "master"
|
||||
Version = branchNameWithoutRefsHeads
|
||||
},
|
||||
ItemPath = "/debug.log"
|
||||
}).Result;
|
||||
|
@ -105,11 +109,20 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
public List<GitCommitRef> GetCommitsReachableFromACommitAndInPath()
|
||||
{
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepositoryOnAnyProject(this.Context);
|
||||
string branchName = repo.DefaultBranch;
|
||||
string branchNameWithoutRefsHeads = branchName.Remove(0, "refs/heads/".Length);
|
||||
GitVersionDescriptor tipCommitDescriptor = new GitVersionDescriptor()
|
||||
{
|
||||
VersionType = GitVersionType.Branch,
|
||||
VersionOptions = GitVersionOptions.None,
|
||||
Version = branchNameWithoutRefsHeads
|
||||
};
|
||||
|
||||
|
||||
return this.Context.Connection.GetClient<GitHttpClient>()
|
||||
.GetCommitsAsync(repo.Id, new GitQueryCommitsCriteria()
|
||||
{
|
||||
CompareVersion = m_tipCommitDescriptor,
|
||||
CompareVersion = tipCommitDescriptor,
|
||||
ItemVersion = m_oldestDescriptor,
|
||||
ItemPath = "/README.md",
|
||||
}).Result;
|
||||
|
@ -130,12 +143,5 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
VersionOptions = GitVersionOptions.None,
|
||||
Version = "4fa42e1a7b0215cc70cd4e927cb70c422123af84"
|
||||
};
|
||||
|
||||
private GitVersionDescriptor m_tipCommitDescriptor = new GitVersionDescriptor()
|
||||
{
|
||||
VersionType = GitVersionType.Branch,
|
||||
VersionOptions = GitVersionOptions.None,
|
||||
Version = "master"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,19 +13,20 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
public class PullRequestsSample : ClientSample
|
||||
{
|
||||
[ClientSampleMethod]
|
||||
public IEnumerable<GitPullRequest> ListPullRequestsIntoMaster()
|
||||
public IEnumerable<GitPullRequest> ListPullRequestsIntoDefault()
|
||||
{
|
||||
VssConnection connection = this.Context.Connection;
|
||||
GitHttpClient gitClient = connection.GetClient<GitHttpClient>();
|
||||
|
||||
TeamProjectReference project = ClientSampleHelpers.FindAnyProject(this.Context);
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepository(this.Context, project.Id);
|
||||
string branchName = repo.DefaultBranch;
|
||||
|
||||
List<GitPullRequest> prs = gitClient.GetPullRequestsAsync(
|
||||
repo.Id,
|
||||
new GitPullRequestSearchCriteria()
|
||||
{
|
||||
TargetRefName = "refs/heads/master",
|
||||
TargetRefName = branchName,
|
||||
}).Result;
|
||||
|
||||
Console.WriteLine("project {0}, repo {1}", project.Name, repo.Name);
|
||||
|
|
|
@ -13,20 +13,21 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
public class PushesSample : ClientSample
|
||||
{
|
||||
[ClientSampleMethod]
|
||||
public IEnumerable<GitPush> ListPushesIntoMaster()
|
||||
public IEnumerable<GitPush> ListPushesIntoDefault()
|
||||
{
|
||||
VssConnection connection = this.Context.Connection;
|
||||
GitHttpClient gitClient = connection.GetClient<GitHttpClient>();
|
||||
|
||||
TeamProjectReference project = ClientSampleHelpers.FindAnyProject(this.Context);
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepository(this.Context, project.Id);
|
||||
string branchName = repo.DefaultBranch;
|
||||
|
||||
List<GitPush> pushes = gitClient.GetPushesAsync(
|
||||
repo.Id,
|
||||
searchCriteria: new GitPushSearchCriteria()
|
||||
{
|
||||
IncludeRefUpdates = true,
|
||||
RefName = "refs/heads/master",
|
||||
RefName = branchName,
|
||||
}).Result;
|
||||
|
||||
Console.WriteLine("project {0}, repo {1}", project.Name, repo.Name);
|
||||
|
|
|
@ -19,34 +19,36 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Git
|
|||
|
||||
Guid projectId = ClientSampleHelpers.FindAnyProject(this.Context).Id;
|
||||
GitRepository repo = GitSampleHelpers.FindAnyRepository(this.Context, projectId);
|
||||
string branchName = repo.DefaultBranch;
|
||||
string branchNameWithoutRefsHeads = branchName.Remove(0, "refs/heads/".Length);
|
||||
|
||||
// find the latest commit on master
|
||||
GitCommitRef latestCommitOnMaster = gitClient.GetCommitsAsync(repo.Id, new GitQueryCommitsCriteria()
|
||||
// find the latest commit on default
|
||||
GitCommitRef latestCommitOnDefault = gitClient.GetCommitsAsync(repo.Id, new GitQueryCommitsCriteria()
|
||||
{
|
||||
ItemVersion = new GitVersionDescriptor()
|
||||
{
|
||||
Version = "master",
|
||||
Version = branchNameWithoutRefsHeads,
|
||||
VersionType = GitVersionType.Branch
|
||||
},
|
||||
Top = 1
|
||||
}).Result.First();
|
||||
|
||||
// generate a unique name to suggest for the branch
|
||||
string suggestedBranchName = "refs/heads/vsts-dotnet-samples/" + GitSampleHelpers.ChooseRefsafeName();
|
||||
string suggestedBranchName = "refs/heads/azure-devops-dotnet-samples/" + GitSampleHelpers.ChooseRefsafeName();
|
||||
|
||||
// write down the name for a later sample
|
||||
this.Context.SetValue<string>("$gitSamples.suggestedRevertBranchName", suggestedBranchName);
|
||||
|
||||
// revert it relative to master
|
||||
// revert it relative to default branch
|
||||
GitRevert revert = gitClient.CreateRevertAsync(
|
||||
new GitAsyncRefOperationParameters()
|
||||
{
|
||||
OntoRefName = "refs/heads/master",
|
||||
OntoRefName = branchName,
|
||||
GeneratedRefName = suggestedBranchName,
|
||||
Repository = repo,
|
||||
Source = new GitAsyncRefOperationSource()
|
||||
{
|
||||
CommitList = new GitCommitRef[] { new GitCommitRef() { CommitId = latestCommitOnMaster.CommitId } }
|
||||
CommitList = new GitCommitRef[] { new GitCommitRef() { CommitId = latestCommitOnDefault.CommitId } }
|
||||
},
|
||||
},
|
||||
projectId,
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Wiki
|
|||
MappedPath = "/", // any folder path in the repository
|
||||
Version = new GitVersionDescriptor()
|
||||
{
|
||||
Version = "master"
|
||||
Version = "main"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Microsoft.Azure.DevOps.ClientSamples.Wiki
|
|||
MappedPath = "/", // any folder path in the repository
|
||||
Version = new GitVersionDescriptor()
|
||||
{
|
||||
Version = "master"
|
||||
Version = "main"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# .NET samples for Azure DevOps
|
||||
|
||||
[![Build Status](https://dev.azure.com/ms/azure-devops-dotnet-samples/_apis/build/status/Microsoft.azure-devops-dotnet-samples?branchName=master)](https://dev.azure.com/ms/azure-devops-dotnet-samples/_build/latest?definitionId=82&branchName=master)
|
||||
[![Build Status](https://dev.azure.com/ms/azure-devops-dotnet-samples/_apis/build/status/Microsoft.azure-devops-dotnet-samples?branchName=main)](https://dev.azure.com/ms/azure-devops-dotnet-samples/_build/latest?definitionId=82&branchName=main)
|
||||
|
||||
This repository contains C# samples that show how to integrate with Azure DevOps Services and Azure using our [public client libraries](https://www.nuget.org/profiles/nugetvss), service hooks, and more.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче