统一差异:在第二个@@之后的文本

时间:2016-04-26 06:06:36

标签: diff

我无法在网络上找到统一差异格式的规范。通常可以在大块的第二个 Dim sUrl As String = "https://subscriptions.zoho.com/api/v1/customers" Dim wHeader As WebHeaderCollection = New WebHeaderCollection() Dim wRequest As HttpWebRequest = DirectCast(System.Net.HttpWebRequest.Create(sUrl), HttpWebRequest) wHeader.Clear() wHeader.Add("Authorization: Zoho-authtoken 7ca5747efb3be868e155e707e679f9f5") wHeader.Add("X-com-zoho-subscriptions-organizationid: 397080968") wHeader.Add("Content-Type: application/json;charset=UTF-8") wRequest.Accept = "application/json" MsgBox(wHeader.ToString) wRequest.Headers = wHeader wRequest.Method = "POST" Dim postData As String = sw.ToString MsgBox(postData) Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData) wRequest.ContentLength = byteArray.Length Dim dataStream As Stream = wRequest.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = wRequest.GetResponse() Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() Console.WriteLine(responseFromServer) LblResponse.Text = sResponse Console.WriteLine(sResponse) reader.Close() dataStream.Close() response.Close() Catch ex As Exception If ex.InnerException IsNot Nothing Then LblResponse.Text = ex.Message + " >> " + ex.InnerException.ToString() Else LblResponse.Text = ex.Message End If End Try 之后看到来自差异文件的文本,如下所示:

@@

第二个@@ -209,4 +196,4 @@ cleanup: _TEMPLATE(T, vec) (X); } -#endif \ No newline at end of file +#endif 之后的文字是否重要?

1 个答案:

答案 0 :(得分:1)

这也让我感到难过,因为它破坏了我正在使用的开源补丁解析器。似乎工具制造商对此并不了解。

显然@@之后的文字由--show-c-function标志生成差异,记录为here。在你的情况下,标题有点用词不当,因为你的文本不是函数定义,但是(可能)当diff看起来在编辑的行的上方时,被捕获的标签是没有缩进的最大标识符。

您可以在此处查看此功能的工作原理示例:

<强>正常

diff --unified=3 <(curl -s https://raw.githubusercontent.com/gcc-mirror/gcc/97574c57cf26ace9b8609575bbab66465924fef7/gcc/config/sparc/sparc.c) <(curl -s https://raw.githubusercontent.com/gcc-mirror/gcc/17fc6eeba9352b97ba16d64fd1de9a5bdc081062/gcc/config/sparc/sparc.c) | sed -n '3p'

输出:@@ -648,7 +648,6 @@

<强> - 显示-C-功能

diff --show-c-function --unified=3 <(curl -s https://raw.githubusercontent.com/gcc-mirror/gcc/97574c57cf26ace9b8609575bbab66465924fef7/gcc/config/sparc/sparc.c) <(curl -s https://raw.githubusercontent.com/gcc-mirror/gcc/17fc6eeba9352b97ba16d64fd1de9a5bdc081062/gcc/config/sparc/sparc.c) | sed -n '3p'

输出:@@ -648,7 +648,6 @@ static reg_class_t sparc_secondary_reloa

据我所知,@@之后的文字主要供人食用,如果你愿意,你可以安全地忽略它。