Rather than doing string parsing, I'd prefer having diff hunks available to mess with.
cc @nulltoken
Should we expose the hunks themselves together with the text patch? Inside PatchEntryChanges or something similar?
@Therzok, I was wondering if ContentChanges, rather than PatchEntryChanges, could be a more convenient place.
I would try extending the HunkCallback, or LineCallBack: they receive the GitDiffHunk which already contains the line indexes:
internal class GitDiffHunk
{
public int OldStart;
public int OldLines;
public int NewStart;
public int NewLines;
public UIntPtr HeaderLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] Header;
}
So far, they only append the patch chunk to the string builder, and increment LinesAdded and LinesDeleted. They could also append the chunk beginning and ending line to a collection.
Sounds good to me!
Are there any news on this?
Sorry, @ransagy, I completely moved to other topics. But right, I should complete what I promised. @ale7canna, would you like to help me with this?
Is there any progress on this? We need this for a new feature we're building at https://github.com/stryker-mutator/stryker-net
Most helpful comment
@Therzok, I was wondering if
ContentChanges, rather thanPatchEntryChanges, could be a more convenient place.I would try extending the HunkCallback, or
LineCallBack: they receive theGitDiffHunkwhich already contains the line indexes:So far, they only append the patch chunk to the string builder, and increment
LinesAddedandLinesDeleted. They could also append the chunk beginning and ending line to a collection.