コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public StashPullRequestForm(StashPlugin plugin, ISettingsSource settings, GitUIBaseEventArgs gitUiCommands)
        {
            InitializeComponent();
            Translate();

            _plugin            = plugin;
            _settingsContainer = settings;
            _gitUiCommands     = gitUiCommands;
        }