comparison src/org/tmatesoft/hg/internal/GeneratePatchInspector.java @ 551:4ea0351ca878

Better (precise) name for diff facility, tests
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Feb 2013 18:19:52 +0100
parents 7f5998a9619d
children 7839ff0bfd78
comparison
equal deleted inserted replaced
550:c1478cc31f45 551:4ea0351ca878
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18 18
19 import org.tmatesoft.hg.internal.PatchGenerator.DeltaInspector; 19 import org.tmatesoft.hg.internal.DiffHelper.DeltaInspector;
20 import org.tmatesoft.hg.internal.PatchGenerator.LineSequence; 20 import org.tmatesoft.hg.internal.DiffHelper.LineSequence;
21 21
22 class GeneratePatchInspector extends DeltaInspector<LineSequence> { 22 class GeneratePatchInspector extends DeltaInspector<LineSequence> {
23 private final Patch deltaCollector; 23 private final Patch deltaCollector;
24 24
25 GeneratePatchInspector(Patch p) { 25 GeneratePatchInspector(Patch p) {
27 deltaCollector = p; 27 deltaCollector = p;
28 } 28 }
29 29
30 public static Patch delta(byte[] prev, byte[] content) { 30 public static Patch delta(byte[] prev, byte[] content) {
31 Patch rv = new Patch(); 31 Patch rv = new Patch();
32 PatchGenerator<LineSequence> pg = new PatchGenerator<LineSequence>(); 32 DiffHelper<LineSequence> pg = new DiffHelper<LineSequence>();
33 pg.init(new LineSequence(prev).splitByNewlines(), new LineSequence(content).splitByNewlines()); 33 pg.init(new LineSequence(prev).splitByNewlines(), new LineSequence(content).splitByNewlines());
34 pg.findMatchingBlocks(new GeneratePatchInspector(rv)); 34 pg.findMatchingBlocks(new GeneratePatchInspector(rv));
35 return rv; 35 return rv;
36 } 36 }
37 37