3using Microsoft.Extensions.Logging;
26 readonly ILogger<GitRemoteFeaturesFactory>
logger;
37 ILogger<GitRemoteFeaturesFactory>
logger)
41 this.logger =
logger ??
throw new ArgumentNullException(nameof(
logger));
47 ArgumentNullException.ThrowIfNull(repository);
54 ArgumentNullException.ThrowIfNull(origin);
57 return remoteGitProvider
switch
67 _ =>
throw new InvalidOperationException($
"Unknown RemoteGitProvider: {remoteGitProvider}!"),
74 ArgumentNullException.ThrowIfNull(origin);
76 switch (origin.Host.ToUpperInvariant())
79 case "WWW.GITHUB.COM":
80 case "GIT.GITHUB.COM":
83 case "WWW.GITLAB.COM":
84 case "GIT.GITLAB.COM":
87 logger.LogDebug(
"Unknown git remote: {origin}", origin);
The IGitRemoteFeatures used for unknown providers.
GitHub IGitRemoteFeatures.
GitLab IGitRemoteFeatures.
RemoteGitProvider ParseRemoteGitProviderFromOrigin(Uri origin)
Gets the RemoteGitProvider for a given origin .The RemoteGitProvider of the origin .
IGitRemoteFeatures CreateGitRemoteFeatures(Uri origin)
Create the IGitRemoteFeatures for a given origin .A new IGitRemoteFeatures instance.
readonly ILoggerFactory loggerFactory
The ILoggerFactory for the GitRemoteFeaturesFactory.
readonly ILogger< GitRemoteFeaturesFactory > logger
The ILogger for the GitRemoteFeaturesFactory.
GitRemoteFeaturesFactory(IGitHubServiceFactory gitHubServiceFactory, ILoggerFactory loggerFactory, ILogger< GitRemoteFeaturesFactory > logger)
Initializes a new instance of the GitRemoteFeaturesFactory class.
IGitRemoteFeatures CreateGitRemoteFeatures(IRepository repository)
Create the IGitRemoteFeatures for a given repository .A new IGitRemoteFeatures instance.
readonly IGitHubServiceFactory gitHubServiceFactory
The IGitHubServiceFactory for the GitRemoteFeaturesFactory.
Factory for creating IGitRemoteFeatures.
Provides features for remote git services.
Represents an on-disk git repository.
Uri Origin
The current origin remote the IRepository is using.
Factory for IGitHubServices.
RemoteGitProvider
Indicates the remote git host.