comparison src/com/tmate/hgkit/ll/RevlogStream.java @ 49:26e3eeaa3962

branch and user filtering for log operation
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 15 Jan 2011 01:15:38 +0100
parents b79cf0118dd3
children 9429c7bd1920 30bd38978846
comparison
equal deleted inserted replaced
48:e34f90b9ded1 49:26e3eeaa3962
71 } finally { 71 } finally {
72 daIndex.done(); 72 daIndex.done();
73 } 73 }
74 } 74 }
75 75
76 public int findLocalRevisionNumber(Nodeid nodeid) { 76 // Perhaps, RevlogStream should be limited to use of plain int revisions for access,
77 // while Nodeids should be kept on the level up, in Revlog. Guess, Revlog better keep
78 // map of nodeids, and once this comes true, we may get rid of this method.
79 // Unlike its counterpart, Revlog#getLocalRevisionNumber, doesn't fail with exception if node not found,
80 // returns a predefined constant instead
81 /*package-local*/ int findLocalRevisionNumber(Nodeid nodeid) {
77 // XXX this one may be implemented with iterate() once there's mechanism to stop iterations 82 // XXX this one may be implemented with iterate() once there's mechanism to stop iterations
78 final int indexSize = revisionCount(); 83 final int indexSize = revisionCount();
79 DataAccess daIndex = getIndexStream(); 84 DataAccess daIndex = getIndexStream();
80 try { 85 try {
81 byte[] nodeidBuf = new byte[20]; 86 byte[] nodeidBuf = new byte[20];
93 ex.printStackTrace(); // log error. FIXME better handling 98 ex.printStackTrace(); // log error. FIXME better handling
94 throw new IllegalStateException(ex); 99 throw new IllegalStateException(ex);
95 } finally { 100 } finally {
96 daIndex.done(); 101 daIndex.done();
97 } 102 }
98 throw new IllegalArgumentException(String.format("%s doesn't represent a revision of %s", nodeid.toString(), indexFile.getName() /*XXX HgDataFile.getPath might be more suitable here*/)); 103 return Integer.MIN_VALUE;
99 } 104 }
100 105
101 106
102 private final int REVLOGV1_RECORD_SIZE = 64; 107 private final int REVLOGV1_RECORD_SIZE = 64;
103 108
141 } 146 }
142 147
143 daIndex.seek(inline ? (int) index.get(i).offset : i * REVLOGV1_RECORD_SIZE); 148 daIndex.seek(inline ? (int) index.get(i).offset : i * REVLOGV1_RECORD_SIZE);
144 for (; i <= end; i++ ) { 149 for (; i <= end; i++ ) {
145 long l = daIndex.readLong(); 150 long l = daIndex.readLong();
151 @SuppressWarnings("unused")
146 long offset = l >>> 16; 152 long offset = l >>> 16;
153 @SuppressWarnings("unused")
147 int flags = (int) (l & 0X0FFFF); 154 int flags = (int) (l & 0X0FFFF);
148 int compressedLen = daIndex.readInt(); 155 int compressedLen = daIndex.readInt();
149 int actualLen = daIndex.readInt(); 156 int actualLen = daIndex.readInt();
150 int baseRevision = daIndex.readInt(); 157 int baseRevision = daIndex.readInt();
151 int linkRevision = daIndex.readInt(); 158 int linkRevision = daIndex.readInt();
231 inline = (versionField & INLINEDATA) != 0; 238 inline = (versionField & INLINEDATA) != 0;
232 long offset = 0; // first offset is always 0, thus Hg uses it for other purposes 239 long offset = 0; // first offset is always 0, thus Hg uses it for other purposes
233 while(true) { 240 while(true) {
234 int compressedLen = da.readInt(); 241 int compressedLen = da.readInt();
235 // 8+4 = 12 bytes total read here 242 // 8+4 = 12 bytes total read here
243 @SuppressWarnings("unused")
236 int actualLen = da.readInt(); 244 int actualLen = da.readInt();
237 int baseRevision = da.readInt(); 245 int baseRevision = da.readInt();
238 // 12 + 8 = 20 bytes read here 246 // 12 + 8 = 20 bytes read here
239 // int linkRevision = di.readInt(); 247 // int linkRevision = di.readInt();
240 // int parent1Revision = di.readInt(); 248 // int parent1Revision = di.readInt();