comparison src/org/tmatesoft/hg/internal/Patch.java @ 533:e6f72c9829a6

Generate patches using diff algorithm
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 30 Jan 2013 15:48:36 +0100
parents 688c1ab113bb
children 243202f1bda5
comparison
equal deleted inserted replaced
532:688c1ab113bb 533:e6f72c9829a6
1 /* 1 /*
2 * Copyright (c) 2011-2012 TMate Software Ltd 2 * Copyright (c) 2011-2013 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
22 22
23 /** 23 /**
24 * @see http://mercurial.selenic.com/wiki/BundleFormat 24 * @see http://mercurial.selenic.com/wiki/BundleFormat
25 * in Changelog group description 25 * in Changelog group description
26 * 26 *
27 * range [start..end] in original source gets replaced with data of length (do not keep, use data.length instead) 27 * range [start..end) in original source gets replaced with data of length (do not keep, use data.length instead)
28 * range [end(i)..start(i+1)] is copied from the source 28 * range [end(i)..start(i+1)) is copied from the source
29 * 29 *
30 * @author Artem Tikhomirov 30 * @author Artem Tikhomirov
31 * @author TMate Software Ltd. 31 * @author TMate Software Ltd.
32 */ 32 */
33 public final class Patch { 33 public final class Patch {
157 157
158 private void add(Patch p, int i) { 158 private void add(Patch p, int i) {
159 add(p.starts.get(i), p.ends.get(i), p.data.get(i)); 159 add(p.starts.get(i), p.ends.get(i), p.data.get(i));
160 } 160 }
161 161
162 private void add(int start, int end, byte[] d) { 162 /*package-local*/ void add(int start, int end, byte[] d) {
163 starts.add(start); 163 starts.add(start);
164 ends.add(end); 164 ends.add(end);
165 data.add(d); 165 data.add(d);
166 } 166 }
167 167