comparison src/org/tmatesoft/hg/core/HgCloneCommand.java @ 358:fc8bc2f1edbe v0.7.0

Clean internal classes from public API
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 06 Dec 2011 20:02:48 +0100
parents 981f9f50bb6c
children 6952d9ce97f1
comparison
equal deleted inserted replaced
357:dfb8405d996f 358:fc8bc2f1edbe
252 Nodeid p2 = ge.secondParent(); 252 Nodeid p2 = ge.secondParent();
253 if (p1.isNull() && p2.isNull() /* or forced flag, does REVIDX_PUNCHED_FLAG indicate that? */) { 253 if (p1.isNull() && p2.isNull() /* or forced flag, does REVIDX_PUNCHED_FLAG indicate that? */) {
254 prevRevContent = new ByteArrayDataAccess(new byte[0]); 254 prevRevContent = new ByteArrayDataAccess(new byte[0]);
255 writeComplete = true; 255 writeComplete = true;
256 } 256 }
257 byte[] content = ge.apply(prevRevContent); 257 byte[] content = ge.apply(prevRevContent.byteArray());
258 byte[] calculated = dh.sha1(p1, p2, content).asBinary(); 258 byte[] calculated = dh.sha1(p1, p2, content).asBinary();
259 final Nodeid node = ge.node(); 259 final Nodeid node = ge.node();
260 if (!node.equalsTo(calculated)) { 260 if (!node.equalsTo(calculated)) {
261 throw new HgBadStateException(String.format("Checksum failed: expected %s, calculated %s. File %s", node, calculated, filename)); 261 throw new HgBadStateException(String.format("Checksum failed: expected %s, calculated %s. File %s", node, calculated, filename));
262 } 262 }
270 throw new HgBadStateException(String.format("Changelog doesn't contain revision %s of %s", ge.cset().shortNotation(), filename)); 270 throw new HgBadStateException(String.format("Changelog doesn't contain revision %s of %s", ge.cset().shortNotation(), filename));
271 } 271 }
272 link = csRev.intValue(); 272 link = csRev.intValue();
273 } 273 }
274 final int p1Rev = knownRevision(p1), p2Rev = knownRevision(p2); 274 final int p1Rev = knownRevision(p1), p2Rev = knownRevision(p2);
275 DataAccess patchContent = ge.rawData(); 275 byte[] patchContent = ge.rawDataByteArray();
276 writeComplete = writeComplete || patchContent.length() >= (/* 3/4 of actual */content.length - (content.length >>> 2)); 276 writeComplete = writeComplete || patchContent.length >= (/* 3/4 of actual */content.length - (content.length >>> 2));
277 if (writeComplete) { 277 if (writeComplete) {
278 base = revisionSequence.size(); 278 base = revisionSequence.size();
279 } 279 }
280 final byte[] sourceData = writeComplete ? content : patchContent.byteArray(); 280 final byte[] sourceData = writeComplete ? content : patchContent;
281 final byte[] data; 281 final byte[] data;
282 ByteArrayOutputStream bos = new ByteArrayOutputStream(content.length); 282 ByteArrayOutputStream bos = new ByteArrayOutputStream(content.length);
283 DeflaterOutputStream dos = new DeflaterOutputStream(bos); 283 DeflaterOutputStream dos = new DeflaterOutputStream(bos);
284 dos.write(sourceData); 284 dos.write(sourceData);
285 dos.close(); 285 dos.close();