comparison 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
comparison
equal deleted inserted replaced
5:fc265ddeab26 6:5abe5af181bd
163 patchElementIndex += 12 + len; 163 patchElementIndex += 12 + len;
164 patches.add(new PatchRecord(p1, p2, len, data, x+12)); 164 patches.add(new PatchRecord(p1, p2, len, data, x+12));
165 } while (patchElementIndex < data.length); 165 } while (patchElementIndex < data.length);
166 // 166 //
167 byte[] baseRevContent = lastData; 167 byte[] baseRevContent = lastData;
168 data = apply(baseRevContent, patches); 168 data = apply(baseRevContent, actualLen, patches);
169 } 169 }
170 } else { 170 } else {
171 if (inline) { 171 if (inline) {
172 diIndex.skipBytes(compressedLen); 172 diIndex.skipBytes(compressedLen);
173 } 173 }
259 } 259 }
260 } 260 }
261 261
262 // mpatch.c : apply() 262 // mpatch.c : apply()
263 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF 263 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF
264 private static byte[] apply(byte[] baseRevisionContent, List<PatchRecord> patch) { 264 private static byte[] apply(byte[] baseRevisionContent, int outcomeLen, List<PatchRecord> patch) {
265 byte[] tempBuf = new byte[512]; // XXX 265 byte[] tempBuf = new byte[outcomeLen]; // XXX
266 int last = 0, destIndex = 0; 266 int last = 0, destIndex = 0;
267 for (PatchRecord pr : patch) { 267 for (PatchRecord pr : patch) {
268 System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last); 268 System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last);
269 destIndex += pr.start - last; 269 destIndex += pr.start - last;
270 System.arraycopy(pr.data, 0, tempBuf, destIndex, pr.data.length); 270 System.arraycopy(pr.data, 0, tempBuf, destIndex, pr.data.length);