本文整理汇总了C#中NGit.Warn方法的典型用法代码示例。如果您正苦于以下问题:C# NGit.Warn方法的具体用法?C# NGit.Warn怎么用?C# NGit.Warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit
的用法示例。
在下文中一共展示了NGit.Warn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseBody
internal virtual int ParseBody(NGit.Patch.Patch script, int end)
{
byte[] buf = file.buf;
int c = RawParseUtils.NextLF(buf, startOffset);
int last = c;
old.nDeleted = 0;
old.nAdded = 0;
for (; c < end; last = c, c = RawParseUtils.NextLF(buf, c))
{
switch (buf[c])
{
case (byte)(' '):
case (byte)('\n'):
{
nContext++;
continue;
goto case (byte)('-');
}
case (byte)('-'):
{
old.nDeleted++;
continue;
goto case (byte)('+');
}
case (byte)('+'):
{
old.nAdded++;
continue;
goto case (byte)('\\');
}
case (byte)('\\'):
{
// Matches "\ No newline at end of file"
continue;
goto default;
}
default:
{
goto SCAN_break;
break;
}
}
SCAN_continue: ;
}
SCAN_break: ;
if (last < end && nContext + old.nDeleted - 1 == old.lineCount && nContext + old.
nAdded == newLineCount && RawParseUtils.Match(buf, last, NGit.Patch.Patch.SIG_FOOTER
) >= 0)
{
// This is an extremely common occurrence of "corruption".
// Users add footers with their signatures after this mark,
// and git diff adds the git executable version number.
// Let it slide; the hunk otherwise looked sound.
//
old.nDeleted--;
return last;
}
if (nContext + old.nDeleted < old.lineCount)
{
int missingCount = old.lineCount - (nContext + old.nDeleted);
script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkOldLinesMissing
, missingCount));
}
else
{
if (nContext + old.nAdded < newLineCount)
{
int missingCount = newLineCount - (nContext + old.nAdded);
script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkNewLinesMissing
, missingCount));
}
else
{
if (nContext + old.nDeleted > old.lineCount || nContext + old.nAdded > newLineCount)
{
string oldcnt = old.lineCount + ":" + newLineCount;
string newcnt = (nContext + old.nDeleted) + ":" + (nContext + old.nAdded);
script.Warn(buf, startOffset, MessageFormat.Format(JGitText.Get().hunkHeaderDoesNotMatchBodyLineCountOf
, oldcnt, newcnt));
}
}
}
return c;
}