简体   繁体   English

阅读Unified Diff并提取以取得卓越

[英]Read Unified Diff & extract to excel

I have extracted the Code difference in Unified format from TFS. 我从TFS中提取了统一格式的代码差异。 Now I want to read this diff text (unified format) and then extract it to an excel in a customized format. 现在,我想阅读此差异文本(统一格式),然后以自定义格式将其提取到excel。 So what I need is like a parser which can read the diff text and get me the deleted/added changes, line number etc. Here is what I want to achieve, let's say TFS generated the following difference 因此,我需要的是一个解析器,它可以读取diff文本并为我提供已删除/添加的更改,行号等。这就是我想要实现的功能,假设TFS产生了以下差异

@@ -212,8 +223,8 @@
          </XYZ>
           <modules>
            Some text ABC
              -        <New_tag_part1>AAAAAAA</New_tag_part1>
              -        <New_tag_part2>BBBBBBB </New_tag_part2>
              +        <New_tag_part1> CCCCCC </New_tag_part1>
              +        <New_tag_part2> DDDDDD </New_tag_part2>

Now I want to read this text & then move it to an excel which might have columns like this Changes_Added Changes_Deleted Line-No I have tried to use ParseDiff nuget package but due to lack of documentation I am not sure whether it can read the unified diff text or how to use it. 现在,我想阅读此文本,然后将其移至可能具有此类列的excel。Changes_Added Changes_Deleted Line-不,我尝试使用ParseDiff nuget包,但是由于缺乏文档,我不确定它是否可以读取统一的diff。文字或使用方式。 Is there any standard parsers available in .Net/C# which I can use? 我可以使用.Net / C#中的任何标准解析器吗? If not any alternatives would be appreciated. 如果没有,将不胜感激。

ParseDiff do read the unified diff text. ParseDiff会读取统一的diff文本。 The method to use it is included in the test code in its source code on GitHub, you can refer to this link for details: https://github.com/jkingry/ParseDiff/blob/master/src/ParseDiff.Tests/TestDiff.cs GitHub的源代码中的测试代码中包含使用它的方法,有关详细信息,您可以参考此链接: https : //github.com/jkingry/ParseDiff/blob/master/src/ParseDiff.Tests/TestDiff .cs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM