Currently I am trying to obtain the number of changed lines between two version of a source files, I currently do this by splitting the string I get from the Streamwriter.
var rev1 = new DiffItemVersionedFile(versionControl, path, VersionSpec.ParseSingleSpec(latestVersion, null));
var rev2 = new DiffItemVersionedFile(versionControl, path, VersionSpec.ParseSingleSpec(previousVersion, null));
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
{
var options = new DiffOptions();
options.Flags = DiffOptionFlags.EnablePreambleHandling;
options.OutputType = DiffOutputType.Unified;
options.TargetEncoding = Encoding.UTF8;
options.SourceEncoding = Encoding.UTF8;
options.StreamWriter = writer;
Difference.DiffFiles(versionControl, rev1, rev2, options, path, true);
writer.Flush();
var diff = Encoding.UTF8.GetString(stream.ToArray());
}
That's what I'm currently obtaining from the Stream, formating looks a bit awkward, but there should be a more easy way to do this, since there usally is a structured object behind thats accesable.
$/MainProject/Development/Client/SubFolder1/SubFolder2/interface/uEPagesShopInterfaceVariantenVorlagen.pas
CodeLines
@@ -994,7 +995,7 @@
moreCode
- deletedLine
addedLine
more code
@@ -1692,6 +1693,8 @@
some code- addedLine
- addedLine some more code