本文整理汇总了C#中NGit.Error方法的典型用法代码示例。如果您正苦于以下问题:C# NGit.Error方法的具体用法?C# NGit.Error怎么用?C# NGit.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit
的用法示例。
在下文中一共展示了NGit.Error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: ParseBody
internal override int ParseBody(NGit.Patch.Patch script, int end)
{
byte[] buf = file.buf;
int c = RawParseUtils.NextLF(buf, startOffset);
foreach (CombinedHunkHeader.CombinedOldImage o in old)
{
o.nDeleted = 0;
o.nAdded = 0;
o.nContext = 0;
}
nContext = 0;
int nAdded = 0;
for (int eol; c < end; c = eol)
{
eol = RawParseUtils.NextLF(buf, c);
if (eol - c < old.Length + 1)
{
// Line isn't long enough to mention the state of each
// ancestor. It must be the end of the hunk.
goto SCAN_break;
}
switch (buf[c])
{
case (byte)(' '):
case (byte)('-'):
case (byte)('+'):
{
break;
}
default:
{
// Line can't possibly be part of this hunk; the first
// ancestor information isn't recognizable.
//
goto SCAN_break;
break;
}
}
int localcontext = 0;
for (int ancestor = 0; ancestor < old.Length; ancestor++)
{
switch (buf[c + ancestor])
{
case (byte)(' '):
{
localcontext++;
old[ancestor].nContext++;
continue;
goto case (byte)('-');
}
case (byte)('-'):
{
old[ancestor].nDeleted++;
continue;
goto case (byte)('+');
}
case (byte)('+'):
{
old[ancestor].nAdded++;
nAdded++;
continue;
goto default;
}
default:
{
goto SCAN_break;
break;
}
}
}
if (localcontext == old.Length)
{
nContext++;
}
SCAN_continue: ;
}
SCAN_break: ;
for (int ancestor_1 = 0; ancestor_1 < old.Length; ancestor_1++)
{
CombinedHunkHeader.CombinedOldImage o_1 = old[ancestor_1];
int cmp = o_1.nContext + o_1.nDeleted;
if (cmp < o_1.lineCount)
{
int missingCnt = o_1.lineCount - cmp;
script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkLinesMissingForAncestor
, Sharpen.Extensions.ValueOf(missingCnt), Sharpen.Extensions.ValueOf(ancestor_1
+ 1)));
}
}
if (nContext + nAdded < newLineCount)
{
int missingCount = newLineCount - (nContext + nAdded);
script.Error(buf, startOffset, MessageFormat.Format(JGitText.Get().truncatedHunkNewLinesMissing
, Sharpen.Extensions.ValueOf(missingCount)));
}
return c;
//.........这里部分代码省略.........