Exemple #1
0
        protected override string BuildSourceLinkUrl(Uri contentUri, Uri gitUri, string relativeUrl, string revisionId, ITaskItem hostItem)
        {
            if (!TeamFoundationUrlParser.TryParseHostedHttp(gitUri.Host, relativeUrl, out var projectPath, out var repositoryName))
            {
                Log.LogError(CommonResources.ValueOfWithIdentityIsInvalid, Names.SourceRoot.RepositoryUrlFullName, SourceRoot.ItemSpec, gitUri);
                return(null);
            }

            return
                (UriUtilities.Combine(
                     UriUtilities.Combine(contentUri.ToString(), projectPath), $"_apis/git/repositories/{repositoryName}/items") +
                 $"?api-version=1.0&versionType=commit&version={revisionId}&path=/*");
        }
Exemple #2
0
 public void TryParseHostedHttp_Success(string host, string relativeUrl, string repositoryPath, string repositoryName)
 {
     Assert.True(TeamFoundationUrlParser.TryParseHostedHttp(host, relativeUrl, out var actualRepositoryPath, out var actualRepositoryName));
     Assert.Equal(repositoryPath, actualRepositoryPath);
     Assert.Equal(repositoryName, actualRepositoryName);
 }
Exemple #3
0
 public void TryParseHostedHttp_Error(string host, string relativeUrl)
 {
     Assert.False(TeamFoundationUrlParser.TryParseHostedHttp(host, relativeUrl, out _, out _));
 }