Exemplo n.º 1
0
        internal static Conflict Create(List <DiffWithOrigin> potentialConflict, SyntaxTree ancestorTree, SyntaxTree localTree, SyntaxTree remoteTree)
        {
            var fllocal  = FindStartEnd(potentialConflict.Where(c => c.Origin == DiffWithOrigin.OriginEnum.Local).Select(c => c.Diff));
            var flremote = FindStartEnd(potentialConflict.Where(c => c.Origin == DiffWithOrigin.OriginEnum.Remote).Select(c => c.Diff));

            var localStartOffset = fllocal.Item1.OffsetStart;
            var localEndOffset   = fllocal.Item2.OffsetEnd;

            var remoteStartOffset = flremote.Item1.OffsetStart;
            var remoteEndOffset   = flremote.Item2.OffsetEnd;

            var first = MinAncestorStart(fllocal.Item1, flremote.Item1).Ancestor.Span.Start;
            var last  = MaxAncestorEnd(fllocal.Item2, flremote.Item2).Ancestor.Span.End;

            var con = new Conflict
            {
                Ancestor = SpanDetails.Create(first, last, ancestorTree),
                Local    = SpanDetails.Create(first + localStartOffset, last + localEndOffset, localTree),
                Remote   = SpanDetails.Create(first + remoteStartOffset, last + remoteEndOffset, remoteTree)
            };

            return(con);
        }