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 Diff_Exceptions() { // Arrange IDiffResult <TestClass> diff = null; Action act1 = () => diff = _TestClassesBefore.Diff <TestClass, Guid, int>(_TestClassesAfter, null, x => x.Data); Action act2 = () => diff = _TestClassesBefore.Diff <TestClass, Guid, int>(_TestClassesAfter, x => x.Key, null); // Act // Assert act1.Should().Throw <ArgumentNullException>().Where(ex => "keySelector".Equals(ex.ParamName)); diff.Should().BeNull(); act2.Should().Throw <ArgumentNullException>().Where(ex => "dataSelector".Equals(ex.ParamName)); diff.Should().BeNull(); }
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); }
public bool CanAppend(IDiffResult diffResultRecord) { return(diffResultRecord.DiffStatus != EDiffStatus.None); }
public bool CanAppend(IDiffResult diffResultRecord) { return(true); }