public bool ApplyDiff(IDiffResult diffResult) { // TODO: Make async Log.LogTrace("ApplyDiff: {0}", diffResult.ToString()); var store = GetStore(); if (!diffResult.Success) { Log.LogTrace("ApplyDiff: Aborting attempt to apply a failed diff command result"); return(false); } var updateGraph = new NonIndexedGraph { BaseUri = new Uri("http://example.org/") }; var parser = new NQuadsParser(); Log.LogTrace("ApplyDiff: Applying deletes"); parser.Parse(diffResult.FileDiffs.SelectMany(diff => diff.Deleted), triple => store.Retract(triple.Subject, triple.Predicate, triple.Object, triple.GraphUri), updateGraph); updateGraph.Clear(); Log.LogTrace("ApplyDiff: Applying inserts"); parser.Parse(diffResult.FileDiffs.SelectMany(diff => diff.Inserted), triple => store.Assert(triple.Subject, triple.Predicate, triple.Object, triple.GraphUri), updateGraph); Log.LogTrace("ApplyDiff: Flushing changes"); store.Flush(); Log.LogTrace("ApplyDiff: Completed"); return(true); }
public void ShowLogsBetweenDates( IActivityMonitor m, DateTimeOffset beginning, DateTimeOffset ending, IEnumerable <DiffRoot> diffRoot) { List <Commit> commits = GetCommitsBetweenDates(beginning, ending).ToList(); if (commits.Count == 0) { m.Info("No commits between the given dates."); } else { IDiffResult diffResult = GetReleaseDiff(m, diffRoot, commits); Console.WriteLine(diffResult.ToString()); } }
public void ParseDiff(IDiffResult diffResult, QuinceDiff quinceDiff) { // TODO: Make async Log.LogTrace("ParseDiff: {0}", diffResult.ToString()); if (!diffResult.Success) { Log.LogTrace("ParseDiff: Aborting attempt to apply a failed diff command result"); return; } var diffGraph = new NonIndexedGraph { BaseUri = new Uri("http://example.org/") }; var parser = new NQuadsParser(); Log.LogTrace("ParseDiff: Parsing deletes"); parser.Parse(diffResult.FileDiffs.Where(fd => fd.FilePath.StartsWith("_s")).SelectMany(diff => diff.Deleted), quinceDiff.Deleted, diffGraph); diffGraph.Clear(); Log.LogTrace("ParseDiff: Parsing inserts"); parser.Parse(diffResult.FileDiffs.Where(fd => fd.FilePath.StartsWith("_s")).SelectMany(diff => diff.Inserted), quinceDiff.Inserted, diffGraph); }