Mercurial > jhg
comparison src/com/tmate/hgkit/ll/RevlogStream.java @ 4:aa1912c70b36
Fix offset issue for inline revlogs. Commandline processing.
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Mon, 20 Dec 2010 04:20:52 +0100 | 
| parents | 24bb4f365164 | 
| children | fc265ddeab26 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 3:24bb4f365164 | 4:aa1912c70b36 | 
|---|---|
| 89 diIndex = getIndexStream(); | 89 diIndex = getIndexStream(); | 
| 90 if (needData && !inline) { | 90 if (needData && !inline) { | 
| 91 diData = getDataStream(); | 91 diData = getDataStream(); | 
| 92 } | 92 } | 
| 93 try { | 93 try { | 
| 94 diIndex.skipBytes(inline ? (int) index.get(start).offset : start * 64); | 94 int skipped = diIndex.skipBytes(inline ? (int) index.get(start).offset : start * 64); | 
| 95 byte[] lastData = null; | 95 byte[] lastData = null; | 
| 96 for (int i = start; i <= end; i++ ) { | 96 for (int i = start; i <= end; i++ ) { | 
| 97 IndexEntry ie = index.get(i); | 97 IndexEntry ie = index.get(i); | 
| 98 long l = diIndex.readLong(); | 98 long l = diIndex.readLong(); | 
| 99 long offset = l >>> 16; | 99 long offset = l >>> 16; | 
| 201 // int baseRevision = di.readInt(); | 201 // int baseRevision = di.readInt(); | 
| 202 // int linkRevision = di.readInt(); | 202 // int linkRevision = di.readInt(); | 
| 203 // int parent1Revision = di.readInt(); | 203 // int parent1Revision = di.readInt(); | 
| 204 // int parent2Revision = di.readInt(); | 204 // int parent2Revision = di.readInt(); | 
| 205 // byte[] nodeid = new byte[32]; | 205 // byte[] nodeid = new byte[32]; | 
| 206 res.add(new IndexEntry(offset, compressedLen)); | |
| 207 if (inline) { | 206 if (inline) { | 
| 207 res.add(new IndexEntry(offset + 64*res.size(), compressedLen)); | |
| 208 di.skipBytes(5*4 + 32 + compressedLen); // Check: 52 (skip) + 12 (read) = 64 (total RevlogNG record size) | 208 di.skipBytes(5*4 + 32 + compressedLen); // Check: 52 (skip) + 12 (read) = 64 (total RevlogNG record size) | 
| 209 } else { | 209 } else { | 
| 210 res.add(new IndexEntry(offset, compressedLen)); | |
| 210 di.skipBytes(5*4 + 32); | 211 di.skipBytes(5*4 + 32); | 
| 211 } | 212 } | 
| 212 long l = di.readLong(); | 213 long l = di.readLong(); | 
| 213 offset = l >>> 16; | 214 offset = l >>> 16; | 
| 214 } | 215 } | 
| 239 } | 240 } | 
| 240 | 241 | 
| 241 | 242 | 
| 242 // perhaps, package-local or protected, if anyone else from low-level needs them | 243 // perhaps, package-local or protected, if anyone else from low-level needs them | 
| 243 private static class IndexEntry { | 244 private static class IndexEntry { | 
| 244 public final long offset; | 245 public final long offset; // for separate .i and .d - copy of index record entry, for inline index - actual offset of the record in the .i file (record entry + revision * record size)) | 
| 245 public final int length; // data past fixed record (need to decide whether including header size or not), and whether length is of compressed data or not | 246 public final int length; // data past fixed record (need to decide whether including header size or not), and whether length is of compressed data or not | 
| 246 | 247 | 
| 247 public IndexEntry(long o, int l) { | 248 public IndexEntry(long o, int l) { | 
| 248 offset = o; | 249 offset = o; | 
| 249 length = l; | 250 length = l; | 
