示例#1
0
        TemplateElement Macro_Commit_FullDiff(TemplateFragmentMacro fragment)
        {
            return(new TemplateElementSynthetic <Commit> (GetElementArgumentList(fragment), (Commit data, List <TemplateElementArgument> args) =>
            {
                CommitWithDiff diff = data.Diff;
                if (diff != null)
                {
                    return diff.GetFullDiff();
                }

                return null;
            })
            {
                SkipNewlineIfLineEmpty = true
            });
        }
示例#2
0
        public static void RemoveCommitsFromCache(string commitSource, List <Commit> commits)
        {
            if (commits == null || commits.Count == 0 || String.IsNullOrEmpty(commitSource))
            {
                return;
            }

            foreach (Commit commit in commits)
            {
                if (commit == null || String.IsNullOrEmpty(commit.ID))
                {
                    continue;
                }

                CommitWithDiff cwd = commit.Diff;
                if (cwd != null)
                {
                    try {
                        RemoveBlobsFromCache(commitSource, cwd.Tree, cwd.AddedBlobs);
                    } catch (Exception ex) {
                        Log(ex);
                    }
                }
                string cachedCommitPath = GetCachedFilePath(commitSource, commit.ID, ".commit", false);
                if (!File.Exists(cachedCommitPath))
                {
                    continue;
                }
                try {
                    File.Delete(cachedCommitPath);
                    Log(LogSeverity.Debug, "Removed cached commit file '{0}'", cachedCommitPath);
                } catch (Exception ex) {
                    Log(ex, "Failed to remove commit file '{4}' from disk cache. Please do it manually.", cachedCommitPath);
                }
            }
        }