本文整理汇总了C#中NGit.ClearRegionList方法的典型用法代码示例。如果您正苦于以下问题:C# NGit.ClearRegionList方法的具体用法?C# NGit.ClearRegionList怎么用?C# NGit.ClearRegionList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit
的用法示例。
在下文中一共展示了NGit.ClearRegionList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Blame
private static void Blame(EditList editList, NGit.Blame.Candidate a, NGit.Blame.Candidate
b)
{
Region r = b.ClearRegionList();
Region aTail = null;
Region bTail = null;
for (int eIdx = 0; eIdx < editList.Count; )
{
// If there are no more regions left, neither side has any
// more responsibility for the result. Remaining edits can
// be safely ignored.
if (r == null)
{
return;
}
Edit e = editList[eIdx];
// Edit ends before the next candidate region. Skip the edit.
if (e.GetEndB() <= r.sourceStart)
{
eIdx++;
continue;
}
// Next candidate region starts before the edit. Assign some
// of the blame onto A, but possibly split and also on B.
if (r.sourceStart < e.GetBeginB())
{
int d = e.GetBeginB() - r.sourceStart;
if (r.length <= d)
{
// Pass the blame for this region onto A.
Region next = r.next;
r.sourceStart = e.GetBeginA() - d;
aTail = Add(aTail, a, r);
r = next;
continue;
}
// Split the region and assign some to A, some to B.
aTail = Add(aTail, a, r.SplitFirst(e.GetBeginA() - d, d));
r.SlideAndShrink(d);
}
// At this point e.getBeginB() <= r.sourceStart.
// An empty edit on the B side isn't relevant to this split,
// as it does not overlap any candidate region.
if (e.GetLengthB() == 0)
{
eIdx++;
continue;
}
// If the region ends before the edit, blame on B.
int rEnd = r.sourceStart + r.length;
if (rEnd <= e.GetEndB())
{
Region next = r.next;
bTail = Add(bTail, b, r);
r = next;
if (rEnd == e.GetEndB())
{
eIdx++;
}
continue;
}
// This region extends beyond the edit. Blame the first
// half of the region on B, and process the rest after.
int len = e.GetEndB() - r.sourceStart;
bTail = Add(bTail, b, r.SplitFirst(r.sourceStart, len));
r.SlideAndShrink(len);
eIdx++;
}
if (r == null)
{
return;
}
// For any remaining region, pass the blame onto A after shifting
// the source start to account for the difference between the two.
Edit e_1 = editList[editList.Count - 1];
int endB = e_1.GetEndB();
int d_1 = endB - e_1.GetEndA();
if (aTail == null)
{
a.regionList = r;
}
else
{
aTail.next = r;
}
do
{
if (endB <= r.sourceStart)
{
r.sourceStart -= d_1;
}
r = r.next;
}
while (r != null);
}