Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 5a01995

Browse files
committed
🎨 Rename ToWebUri to ToRepositoryUrl
This method name makes more sense.
1 parent f09fb86 commit 5a01995

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ bool ParseScpSyntax(string scpString)
119119

120120
public bool IsValidUri => url != null;
121121

122-
public Uri ToWebUri()
122+
/// <summary>
123+
/// Attempts a best-effort to convert the remote origin to a GitHub Repository URL.
124+
/// </summary>
125+
/// <returns></returns>
126+
public Uri ToRepositoryUrl()
123127
{
124128
var scheme = url != null && IsHypertextTransferProtocol
125129
? url.Scheme

src/GitHub.Exports/Services/Services.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static Uri GetRepoUrlFromSolution(IVsSolution solution)
128128
return null;
129129
using (var repo = new Repository(repoPath))
130130
{
131-
return GetUriFromRepository(repo)?.ToWebUri();
131+
return GetUriFromRepository(repo)?.ToRepositoryUrl();
132132
}
133133
}
134134

src/GitHub.VisualStudio/Base/TeamExplorerItemBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected async Task<bool> IsAGitHubRepo()
6666

6767
SimpleApiClient = apiFactory.Create(uri);
6868

69-
if (!HostAddress.IsGitHubDotComUri(uri.ToWebUri()))
69+
if (!HostAddress.IsGitHubDotComUri(uri.ToRepositoryUrl()))
7070
{
7171
var repo = await SimpleApiClient.GetRepository();
7272
return repo.FullName == ActiveRepoName && SimpleApiClient.IsEnterprise();

src/GitHub.VisualStudio/Base/TeamExplorerNavigationItemBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected void OpenInBrowser(Lazy<IVisualStudioBrowser> browser, string endpoint
7474
if (uri == null)
7575
return;
7676
#endif
77-
var browseUrl = uri.ToWebUri().Append(endpoint);
77+
var browseUrl = uri.ToRepositoryUrl().Append(endpoint);
7878

7979
OpenInBrowser(browser, browseUrl);
8080
}

src/UnitTests/GitHub.Primitives/UriStringTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void ReturnWhetherTheUriIsParseableByUri(string uriString, bool expected)
159159
}
160160
}
161161

162-
public class TheToUriMethod
162+
public class TheToRepositoryUrlMethod
163163
{
164164
[Theory]
165165
[InlineData("http://example.com/", "http://example.com/")]
@@ -174,7 +174,7 @@ public class TheToUriMethod
174174
[InlineData("ssh://[email protected]:23/haacked/encourage", "https://example.com:23/haacked/encourage")]
175175
public void ConvertsToWebUrl(string uriString, string expected)
176176
{
177-
Assert.Equal(new Uri(expected), new UriString(uriString).ToWebUri());
177+
Assert.Equal(new Uri(expected), new UriString(uriString).ToRepositoryUrl());
178178
}
179179
}
180180

0 commit comments

Comments
 (0)