예제 #1
0
        /// <summary>
        /// Get the Git config
        /// </summary>
        /// <remarks>Cached for 1m</remarks>
        /// <returns></returns>
        public GitConfig GetGitConfig()
        {
            if (_cache.Contains(CacheKeyEnum.GitConfig.ToString()))
            {
                return((GitConfig)_cache.Get(CacheKeyEnum.GitConfig.ToString()));
            }

            var gitConfig = GitHelper.GetGitConfig(this);

            if (gitConfig != null)
            {
                _cache.Set(CacheKeyEnum.GitConfig.ToString(), gitConfig, DateTimeOffset.Now.AddMinutes(1));
            }
            return(gitConfig);
        }
예제 #2
0
        /// <summary>
        /// Get the Git branch name eg. 'feature/tgit'
        /// </summary>
        /// <remarks>Cached for 15s</remarks>
        /// <returns></returns>
        private string GetBranchName()
        {
            if (_cache.Contains(CacheKeyEnum.BranchName.ToString()))
            {
                return(_cache.Get(CacheKeyEnum.BranchName.ToString()).ToString());
            }

            var branchName = GitHelper.GetCurrentBranchName(false, this);

            if (!string.IsNullOrEmpty(branchName))
            {
                _cache.Set(CacheKeyEnum.BranchName.ToString(), branchName, DateTimeOffset.Now.AddSeconds(15));
            }
            return(branchName);
        }
예제 #3
0
 public static async void GitSvn_BeforeQueryStatus(object sender, EventArgs e)
 => ((OleMenuCommand)sender).Visible = await FileHelper.HasSolutionDir() && await GitHelper.IsGitSvn();
예제 #4
0
 public static void GetBranchName() => BranchName = GitHelper.GetCurrentBranchName(false);
예제 #5
0
 public static void GetGitConfig()
 {
     GitConfig = GitHelper.GetGitConfig();
     IsGitFlow = !string.IsNullOrEmpty(GitConfig.MasterBranch);
 }