comparison src/com/tmate/hgkit/ll/RevlogStream.java @ 37:e45e75e22523

Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 14 Jan 2011 00:49:58 +0100
parents 205f9b59b400
children 1b26247d7367
comparison
equal deleted inserted replaced
36:205f9b59b400 37:e45e75e22523
282 } 282 }
283 } 283 }
284 284
285 // mpatch.c : apply() 285 // mpatch.c : apply()
286 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF 286 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF
287 private static byte[] apply(byte[] baseRevisionContent, int outcomeLen, List<PatchRecord> patch) { 287 // FIXME why 2 arrays (rv and tempBuf)???. Think over in-place merging (perhaps some sparse byte chunk list?) - to minimize mem use.
288 /*package-local for HgBundle; until moved to better place*/static byte[] apply(byte[] baseRevisionContent, int outcomeLen, List<PatchRecord> patch) {
288 byte[] tempBuf = new byte[outcomeLen]; // XXX 289 byte[] tempBuf = new byte[outcomeLen]; // XXX
289 int last = 0, destIndex = 0; 290 int last = 0, destIndex = 0;
290 for (PatchRecord pr : patch) { 291 for (PatchRecord pr : patch) {
291 System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last); 292 System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last);
292 destIndex += pr.start - last; 293 destIndex += pr.start - last;