예제 #1
0
        public static List <Patch> MakePatches(List <Diff> diffs, int numContextLines = DefaultContext, bool collate = true)
        {
            var p = new Patch {
                diffs = diffs
            };

            p.RecalculateLength();
            p.Trim(numContextLines);
            if (p.length1 == 0)
            {
                return(new List <Patch>());
            }
            if (!collate)
            {
                p.Uncollate();
            }

            return(p.Split(numContextLines));
        }
예제 #2
0
        public List <Patch> Diff(int numContextLines = DefaultContext)
        {
            if (matches == null)
            {
                Match();
            }

            var p = new Patch {
                diffs = LineMatching.MakeDiffList(matches, lines1, lines2)
            };

            p.RecalculateLength();
            p.Trim(numContextLines);
            if (p.length1 == 0)
            {
                return(new List <Patch>());
            }

            return(p.Split(numContextLines));
        }