public static Settings Parse(IGitModule gitModule, ISettingsSource settings, StashPlugin plugin) { var result = new Settings { Username = plugin.StashUsername.ValueOrDefault(settings), Password = plugin.StashPassword.ValueOrDefault(settings), StashUrl = plugin.StashBaseUrl.ValueOrDefault(settings), DisableSSL = plugin.StashDisableSsl.ValueOrDefault(settings) }; var module = ((GitModule)gitModule); var remotes = module.GetRemotes() .Select(r => module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, r))) .ToArray(); foreach (var url in remotes) { var pattern = url.Contains("http") ? StashHttpRegex : StashSshRegex; var match = Regex.Match(url, pattern); if (match.Success && result.StashUrl.Contains(match.Groups["url"].Value)) { result.ProjectKey = match.Groups["project"].Value; result.RepoSlug = match.Groups["repo"].Value; return result; } } return null; }
public static Settings Parse(IGitModule gitModule, ISettingsSource settings, StashPlugin plugin) { var result = new Settings { Username = plugin.StashUsername.ValueOrDefault(settings), Password = plugin.StashPassword.ValueOrDefault(settings), StashUrl = plugin.StashBaseUrl.ValueOrDefault(settings), DisableSSL = plugin.StashDisableSsl.ValueOrDefault(settings) }; var module = ((GitModule)gitModule); var remotes = module.GetRemotes() .Select(r => module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, r))) .ToArray(); foreach (var url in remotes) { var pattern = url.Contains("http") ? StashHttpRegex : StashSshRegex; var match = Regex.Match(url, pattern); if (match.Success && result.StashUrl.Contains(match.Groups["url"].Value)) { result.ProjectKey = match.Groups["project"].Value; result.RepoSlug = match.Groups["repo"].Value; return(result); } } return(null); }
public StashPullRequestForm(StashPlugin plugin, ISettingsSource settings, GitUIBaseEventArgs gitUiCommands) { InitializeComponent(); Translate(); _plugin = plugin; _settingsContainer = settings; _gitUiCommands = gitUiCommands; }