comparison src/org/tmatesoft/hg/internal/RevlogStream.java @ 170:71ddbf8603e8

Initial clone: populate given directory from a bundle. Everything but remote server access is there, albeit prototype code style
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Mar 2011 20:46:00 +0100
parents b413b16d10a5
children 33a7d76f067b
comparison
equal deleted inserted replaced
169:8c8e3f372fa1 170:71ddbf8603e8
239 streamOffset += REVLOGV1_RECORD_SIZE; // don't need to do seek as it's actual position in the index stream 239 streamOffset += REVLOGV1_RECORD_SIZE; // don't need to do seek as it's actual position in the index stream
240 } else { 240 } else {
241 streamDataAccess = daData; 241 streamDataAccess = daData;
242 daData.seek(streamOffset); 242 daData.seek(streamOffset);
243 } 243 }
244 final boolean patchToPrevious = baseRevision != i; // XXX not sure if this is the right way to detect a patch 244 final boolean patchToPrevious = baseRevision != i; // the only way I found to tell if it's a patch
245 firstByte = streamDataAccess.readByte(); 245 firstByte = streamDataAccess.readByte();
246 if (firstByte == 0x78 /* 'x' */) { 246 if (firstByte == 0x78 /* 'x' */) {
247 userDataAccess = new InflaterDataAccess(streamDataAccess, streamOffset, compressedLen, patchToPrevious ? -1 : actualLen); 247 userDataAccess = new InflaterDataAccess(streamDataAccess, streamOffset, compressedLen, patchToPrevious ? -1 : actualLen);
248 } else if (firstByte == 0x75 /* 'u' */) { 248 } else if (firstByte == 0x75 /* 'u' */) {
249 userDataAccess = new FilterDataAccess(streamDataAccess, streamOffset+1, compressedLen-1); 249 userDataAccess = new FilterDataAccess(streamDataAccess, streamOffset+1, compressedLen-1);
298 } 298 }
299 ArrayList<IndexEntry> res = new ArrayList<IndexEntry>(); 299 ArrayList<IndexEntry> res = new ArrayList<IndexEntry>();
300 DataAccess da = getIndexStream(); 300 DataAccess da = getIndexStream();
301 try { 301 try {
302 int versionField = da.readInt(); 302 int versionField = da.readInt();
303 da.readInt(); // just to skip next 2 bytes of offset + flags 303 da.readInt(); // just to skip next 4 bytes of offset + flags
304 final int INLINEDATA = 1 << 16; 304 final int INLINEDATA = 1 << 16;
305 inline = (versionField & INLINEDATA) != 0; 305 inline = (versionField & INLINEDATA) != 0;
306 long offset = 0; // first offset is always 0, thus Hg uses it for other purposes 306 long offset = 0; // first offset is always 0, thus Hg uses it for other purposes
307 while(true) { 307 while(true) {
308 int compressedLen = da.readInt(); 308 int compressedLen = da.readInt();