Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Patch.java @ 618:7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 16 May 2013 19:46:13 +0200 |
parents | a52f4cc56f9c |
children |
comparison
equal
deleted
inserted
replaced
617:65c01508f002 | 618:7c0d2ce340b8 |
---|---|
17 package org.tmatesoft.hg.internal; | 17 package org.tmatesoft.hg.internal; |
18 | 18 |
19 import java.io.IOException; | 19 import java.io.IOException; |
20 import java.util.ArrayList; | 20 import java.util.ArrayList; |
21 import java.util.Formatter; | 21 import java.util.Formatter; |
22 | |
23 import org.tmatesoft.hg.core.HgIOException; | |
22 | 24 |
23 /** | 25 /** |
24 * @see http://mercurial.selenic.com/wiki/BundleFormat | 26 * @see http://mercurial.selenic.com/wiki/BundleFormat |
25 * in Changelog group description | 27 * in Changelog group description |
26 * | 28 * |
175 } | 177 } |
176 int prefix = 3 * 4 * count(); // 3 integer fields per entry * sizeof(int) * number of entries | 178 int prefix = 3 * 4 * count(); // 3 integer fields per entry * sizeof(int) * number of entries |
177 return prefix + totalDataLen; | 179 return prefix + totalDataLen; |
178 } | 180 } |
179 | 181 |
180 /*package-local*/ void serialize(DataSerializer out) throws IOException { | 182 /*package-local*/ void serialize(DataSerializer out) throws HgIOException { |
181 for (int i = 0, x = data.size(); i < x; i++) { | 183 for (int i = 0, x = data.size(); i < x; i++) { |
182 final int start = starts.get(i); | 184 final int start = starts.get(i); |
183 final int end = ends.get(i); | 185 final int end = ends.get(i); |
184 byte[] d = data.get(i); | 186 byte[] d = data.get(i); |
185 out.writeInt(start, end, d.length); | 187 out.writeInt(start, end, d.length); |
460 } | 462 } |
461 } | 463 } |
462 | 464 |
463 public class PatchDataSource implements DataSerializer.DataSource { | 465 public class PatchDataSource implements DataSerializer.DataSource { |
464 | 466 |
465 public void serialize(DataSerializer out) throws IOException { | 467 public void serialize(DataSerializer out) throws HgIOException { |
466 Patch.this.serialize(out); | 468 Patch.this.serialize(out); |
467 } | 469 } |
468 | 470 |
469 public int serializeLength() { | 471 public int serializeLength() { |
470 return Patch.this.serializedLength(); | 472 return Patch.this.serializedLength(); |