diff src/com/tmate/hgkit/ll/RevlogStream.java @ 6:5abe5af181bd

Ant script to build commands and run sample
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 Dec 2010 03:33:37 +0100
parents fc265ddeab26
children d6d2a630f4a6
line wrap: on
line diff
--- a/src/com/tmate/hgkit/ll/RevlogStream.java	Tue Dec 21 05:11:06 2010 +0100
+++ b/src/com/tmate/hgkit/ll/RevlogStream.java	Wed Dec 22 03:33:37 2010 +0100
@@ -165,7 +165,7 @@
 						} while (patchElementIndex < data.length);
 						//
 						byte[] baseRevContent = lastData;
-						data = apply(baseRevContent, patches);
+						data = apply(baseRevContent, actualLen, patches);
 					}
 				} else {
 					if (inline) {
@@ -261,8 +261,8 @@
 
 	// mpatch.c : apply()
 	// FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF
-	private static byte[] apply(byte[] baseRevisionContent, List<PatchRecord> patch) {
-		byte[] tempBuf = new byte[512]; // XXX
+	private static byte[] apply(byte[] baseRevisionContent, int outcomeLen, List<PatchRecord> patch) {
+		byte[] tempBuf = new byte[outcomeLen]; // XXX
 		int last = 0, destIndex = 0;
 		for (PatchRecord pr : patch) {
 			System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last);