Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/RevlogStream.java @ 297:e7ca6f16d074
Better message for incorrect range requested
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sat, 17 Sep 2011 00:48:34 +0200 |
| parents | 981f9f50bb6c |
| children | 650b45d290b1 |
comparison
equal
deleted
inserted
replaced
| 296:02f2963c70fa | 297:e7ca6f16d074 |
|---|---|
| 205 start = indexSize - 1; | 205 start = indexSize - 1; |
| 206 } | 206 } |
| 207 if (start < 0 || start >= indexSize) { | 207 if (start < 0 || start >= indexSize) { |
| 208 throw new IllegalArgumentException(String.format("Bad left range boundary %d in [0..%d]", start, indexSize-1)); | 208 throw new IllegalArgumentException(String.format("Bad left range boundary %d in [0..%d]", start, indexSize-1)); |
| 209 } | 209 } |
| 210 if (end < start || end >= indexSize) { | 210 if (end >= indexSize) { |
| 211 throw new IllegalArgumentException(String.format("Bad right range boundary %d in [0..%d]", end, indexSize-1)); | 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)); | |
| 212 } | 215 } |
| 213 // XXX may cache [start .. end] from index with a single read (pre-read) | 216 // XXX may cache [start .. end] from index with a single read (pre-read) |
| 214 | 217 |
| 215 ReaderN1 r = new ReaderN1(needData, inspector); | 218 ReaderN1 r = new ReaderN1(needData, inspector); |
| 216 try { | 219 try { |
| 519 return true; | 522 return true; |
| 520 } | 523 } |
| 521 } | 524 } |
| 522 | 525 |
| 523 | 526 |
| 524 private static int[] toArray(List<Integer> l) { | |
| 525 int[] rv = new int[l.size()]; | |
| 526 for (int i = 0; i < rv.length; i++) { | |
| 527 rv[i] = l.get(i); | |
| 528 } | |
| 529 return rv; | |
| 530 } | |
| 531 | |
| 532 | |
| 533 // mpatch.c : apply() | 527 // mpatch.c : apply() |
| 534 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF | 528 // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF |
| 535 public/*for HgBundle; until moved to better place*/static byte[] apply(DataAccess baseRevisionContent, int outcomeLen, List<PatchRecord> patch) throws IOException { | 529 public/*for HgBundle; until moved to better place*/static byte[] apply(DataAccess baseRevisionContent, int outcomeLen, List<PatchRecord> patch) throws IOException { |
| 536 int last = 0, destIndex = 0; | 530 int last = 0, destIndex = 0; |
| 537 if (outcomeLen == -1) { | 531 if (outcomeLen == -1) { |
