Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/RevlogStream.java @ 300:650b45d290b1
Share range check code
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Sat, 17 Sep 2011 13:41:04 +0200 | 
| parents | e7ca6f16d074 | 
| children | 694ebabb5cb3 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 299:45dc79e545f5 | 300:650b45d290b1 | 
|---|---|
| 25 import java.util.List; | 25 import java.util.List; | 
| 26 import java.util.zip.Inflater; | 26 import java.util.zip.Inflater; | 
| 27 | 27 | 
| 28 import org.tmatesoft.hg.core.HgBadStateException; | 28 import org.tmatesoft.hg.core.HgBadStateException; | 
| 29 import org.tmatesoft.hg.core.Nodeid; | 29 import org.tmatesoft.hg.core.Nodeid; | 
| 30 import org.tmatesoft.hg.repo.HgInternals; | |
| 30 import org.tmatesoft.hg.repo.HgRepository; | 31 import org.tmatesoft.hg.repo.HgRepository; | 
| 31 | 32 | 
| 32 | 33 | 
| 33 /** | 34 /** | 
| 34 * ? Single RevlogStream per file per repository with accessor to record access session (e.g. with back/forward operations), | 35 * ? Single RevlogStream per file per repository with accessor to record access session (e.g. with back/forward operations), | 
| 202 end = indexSize - 1; | 203 end = indexSize - 1; | 
| 203 } | 204 } | 
| 204 if (start == TIP) { | 205 if (start == TIP) { | 
| 205 start = indexSize - 1; | 206 start = indexSize - 1; | 
| 206 } | 207 } | 
| 207 if (start < 0 || start >= indexSize) { | 208 HgInternals.checkRevlogRange(start, end, indexSize-1); | 
| 208 throw new IllegalArgumentException(String.format("Bad left range boundary %d in [0..%d]", start, indexSize-1)); | |
| 209 } | |
| 210 if (end >= indexSize) { | |
| 211 throw new IllegalArgumentException(String.format("Bad right range boundary %d in [0..%d]", end, indexSize-1)); | |
| 212 } | |
| 213 if (end < start) { | |
| 214 throw new IllegalArgumentException(String.format("Bad range [%d..%d]", start, end)); | |
| 215 } | |
| 216 // XXX may cache [start .. end] from index with a single read (pre-read) | 209 // XXX may cache [start .. end] from index with a single read (pre-read) | 
| 217 | 210 | 
| 218 ReaderN1 r = new ReaderN1(needData, inspector); | 211 ReaderN1 r = new ReaderN1(needData, inspector); | 
| 219 try { | 212 try { | 
| 220 r.start(end - start + 1); | 213 r.start(end - start + 1); | 
