Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/RevlogStream.java @ 280:35125450c804
Erroneous and slow status for working copies based on non-tip revision
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Fri, 02 Sep 2011 13:40:09 +0200 | 
| parents | 6bb5e7ed051a | 
| children | b11f6a08f748 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 279:23e3ea855097 | 280:35125450c804 | 
|---|---|
| 61 this.dataAccess = dap; | 61 this.dataAccess = dap; | 
| 62 this.indexFile = indexFile; | 62 this.indexFile = indexFile; | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 /*package*/ DataAccess getIndexStream() { | 65 /*package*/ DataAccess getIndexStream() { | 
| 66 // XXX may supply a hint that I'll need really few bytes of data (perhaps, at some offset) | |
| 67 // to avoid mmap files when only few bytes are to be read (i.e. #dataLength()) | |
| 66 return dataAccess.create(indexFile); | 68 return dataAccess.create(indexFile); | 
| 67 } | 69 } | 
| 68 | 70 | 
| 69 /*package*/ DataAccess getDataStream() { | 71 /*package*/ DataAccess getDataStream() { | 
| 70 final String indexName = indexFile.getName(); | 72 final String indexName = indexFile.getName(); | 
| 79 | 81 | 
| 80 public int dataLength(int revision) { | 82 public int dataLength(int revision) { | 
| 81 // XXX in fact, use of iterate() instead of this implementation may be quite reasonable. | 83 // XXX in fact, use of iterate() instead of this implementation may be quite reasonable. | 
| 82 // | 84 // | 
| 83 final int indexSize = revisionCount(); | 85 final int indexSize = revisionCount(); | 
| 84 DataAccess daIndex = getIndexStream(); // XXX may supply a hint that I'll need really few bytes of data (although at some offset) | 86 DataAccess daIndex = getIndexStream(); | 
| 85 if (revision == TIP) { | 87 if (revision == TIP) { | 
| 86 revision = indexSize - 1; | 88 revision = indexSize - 1; | 
| 87 } | 89 } | 
| 88 try { | 90 try { | 
| 89 int recordOffset = getIndexOffsetInt(revision); | 91 int recordOffset = getIndexOffsetInt(revision); | 
