public void CanParseDiffForwards() { MockTracer tracer = new MockTracer(); DiffHelper diffForwards = new DiffHelper(tracer, new MockGVFSEnlistment(), new List <string>(), new List <string>(), includeSymLinks: this.IncludeSymLinks); diffForwards.ParseDiffFile(GetDataPath("forward.txt"), "xx:\\fakeRepo"); // File added, file edited, file renamed, folder => file, edit-rename file, SymLink added (if applicable) // Children of: Add folder, Renamed folder, edited folder, file => folder diffForwards.RequiredBlobs.Count.ShouldEqual(diffForwards.ShouldIncludeSymLinks ? 10 : 9); diffForwards.FileAddOperations.ContainsKey("3bd509d373734a9f9685d6a73ba73324f72931e3").ShouldEqual(diffForwards.ShouldIncludeSymLinks); // File deleted, folder deleted, file > folder, edit-rename diffForwards.FileDeleteOperations.Count.ShouldEqual(4); // Includes children of: Recursive delete folder, deleted folder, renamed folder, and folder => file diffForwards.TotalFileDeletes.ShouldEqual(8); // Folder created, folder edited, folder deleted, folder renamed (add + delete), // folder => file, file => folder, recursive delete (top-level only) diffForwards.DirectoryOperations.Count.ShouldEqual(8); // Should also include the deleted folder of recursive delete diffForwards.TotalDirectoryOperations.ShouldEqual(9); }
public void ParsesCaseChangesAsAdds() { MockTracer tracer = new MockTracer(); DiffHelper diffBackwards = new DiffHelper(tracer, new MockEnlistment(), new List <string>(), new List <string>()); diffBackwards.ParseDiffFile(GetDataPath("caseChange.txt"), "xx:\\fakeRepo"); diffBackwards.RequiredBlobs.Count.ShouldEqual(2); diffBackwards.FileAddOperations.Sum(list => list.Value.Count).ShouldEqual(2); diffBackwards.FileDeleteOperations.Count.ShouldEqual(0); diffBackwards.TotalFileDeletes.ShouldEqual(0); diffBackwards.DirectoryOperations.ShouldNotContain(entry => entry.Operation == DiffTreeResult.Operations.Delete); diffBackwards.TotalDirectoryOperations.ShouldEqual(3); }
public void ParsesCaseChangesAsRenames() { MockTracer tracer = new MockTracer(); DiffHelper diffBackwards = new DiffHelper(tracer, new Mock.Common.MockGVFSEnlistment(), new List <string>(), new List <string>(), includeSymLinks: this.IncludeSymLinks); diffBackwards.ParseDiffFile(GetDataPath("caseChange.txt")); diffBackwards.RequiredBlobs.Count.ShouldEqual(2); diffBackwards.FileAddOperations.Sum(list => list.Value.Count).ShouldEqual(2); diffBackwards.FileDeleteOperations.Count.ShouldEqual(0); diffBackwards.TotalFileDeletes.ShouldEqual(2); diffBackwards.DirectoryOperations.ShouldContain(entry => entry.Operation == DiffTreeResult.Operations.Add); diffBackwards.DirectoryOperations.ShouldContain(entry => entry.Operation == DiffTreeResult.Operations.Delete); diffBackwards.TotalDirectoryOperations.ShouldEqual(6); }
public void CanParseBackwardsDiff() { MockTracer tracer = new MockTracer(); DiffHelper diffBackwards = new DiffHelper(tracer, new MockEnlistment(), new List <string>(), new List <string>()); diffBackwards.ParseDiffFile(GetDataPath("backward.txt"), "xx:\\fakeRepo"); // File > folder, deleted file, edited file, renamed file, rename-edit file // Children of file > folder, renamed folder, deleted folder, recursive delete file, edited folder diffBackwards.RequiredBlobs.Count.ShouldEqual(10); // File added, folder > file, moved folder, added folder diffBackwards.FileDeleteOperations.Count.ShouldEqual(4); // Also includes, the children of: Folder added, folder renamed, file => folder diffBackwards.TotalFileDeletes.ShouldEqual(7); // Folder created, folder edited, folder deleted, folder renamed (add + delete), // folder => file, file => folder, recursive delete (include subfolder) diffBackwards.TotalDirectoryOperations.ShouldEqual(9); }
public void CanParseDiffForwards() { MockTracer tracer = new MockTracer(); DiffHelper diffForwards = new DiffHelper(tracer, new MockEnlistment(), new List <string>(), new List <string>()); diffForwards.ParseDiffFile(GetDataPath("forward.txt"), "xx:\\fakeRepo"); // File added, file edited, file renamed, folder => file, edit-rename file // Children of: Add folder, Renamed folder, edited folder, file => folder diffForwards.RequiredBlobs.Count.ShouldEqual(9); // File deleted, folder deleted, file > folder, edit-rename diffForwards.FileDeleteOperations.Count.ShouldEqual(4); // Includes children of: Recursive delete folder, deleted folder, renamed folder, and folder => file diffForwards.TotalFileDeletes.ShouldEqual(8); // Folder created, folder edited, folder deleted, folder renamed (add + delete), // folder => file, file => folder, recursive delete (top-level only) diffForwards.DirectoryOperations.Count.ShouldEqual(8); // Should also include the deleted folder of recursive delete diffForwards.TotalDirectoryOperations.ShouldEqual(9); }