private static IList <GithubHostedRemoteInformation> GetCurrentWorkingDirGithubRepos() { List <GithubHostedRemoteInformation> repoInfos = new List <GithubHostedRemoteInformation>(); var remoteNames = GitCommands.GitCommandHelpers.GetRemotes(); foreach (var remote in remoteNames.Where(r => !string.IsNullOrEmpty(r))) { var remoteUrl = GitCommands.GitCommandHelpers.GetSetting("remote." + remote + ".url"); if (string.IsNullOrEmpty(remoteUrl)) { continue; } var m = Regex.Match(remoteUrl, @"git(?:@|://)github.com[:/]([^/]+)/(\w+)\.git"); if (!m.Success) { m = Regex.Match(remoteUrl, @"https://(?:[^@:]+)?(?::[^/@:]+)?@?github.com/([^/]+)/([\w_\.]+).git"); } if (m.Success) { var t = new GithubHostedRemoteInformation() { Name = remote, Owner = m.Groups[1].Value, NameAtGithub = m.Groups[2].Value }; if (!repoInfos.Contains(t)) { repoInfos.Add(t); } } } return(repoInfos); }
public GithubHostedRemote(GithubHostedRemoteInformation info, GithubPlugin plugin) { _plugin = plugin; if (string.IsNullOrEmpty(info.NameAtGithub) || string.IsNullOrEmpty(info.Owner)) { throw new ArgumentException("Neither NameAtGithub or Owner can be null"); } Data = info.Owner + "/" + info.NameAtGithub; Name = info.Name; }
public override bool Equals(object obj) { GithubHostedRemoteInformation repoInfo = obj as GithubHostedRemoteInformation; return(repoInfo != null && Owner == repoInfo.Owner && Name == repoInfo.Name && NameAtGithub == repoInfo.NameAtGithub); }