Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 403:2747b0723867
FIXMEs: work on exceptions and javadoc
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 05 Mar 2012 14:50:51 +0100 |
parents | 82336b7c54f4 |
children | 866fc3b597a0 |
comparison
equal
deleted
inserted
replaced
402:1fcc7f7b6d65 | 403:2747b0723867 |
---|---|
126 // even if they might get reused (i.e. after FileIterator#reset() and walking once again), | 126 // even if they might get reused (i.e. after FileIterator#reset() and walking once again), |
127 // path caching is better to be done in the code which knows that path are being reused | 127 // path caching is better to be done in the code which knows that path are being reused |
128 return new FileWalker(repoRoot, pathSrc, workindDirScope); | 128 return new FileWalker(repoRoot, pathSrc, workindDirScope); |
129 } | 129 } |
130 | 130 |
131 // expose othewise package-local information primarily to use in our own o.t.hg.core package | 131 // expose otherwise package-local information primarily to use in our own o.t.hg.core package |
132 public static SessionContext getContext(HgRepository repo) { | 132 public static SessionContext getContext(HgRepository repo) { |
133 return repo.getContext(); | 133 return repo.getContext(); |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 // Convenient check of revision index for validity (not all negative values are wrong as long as we use negative constants) | 137 // Convenient check of revision index for validity (not all negative values are wrong as long as we use negative constants) |
138 public static boolean wrongRevisionIndex(int rev) { | 138 public static boolean wrongRevisionIndex(int rev) { // FIXME guess, usages shall throw HgInvalidRevision. \ |
139 // TODO Another method to check,throw and expand TIP at once | |
139 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION; | 140 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION; |
140 } | 141 } |
141 | 142 |
142 // throws HgInvalidRevisionException or IllegalArgumentException if [start..end] range is not a subrange of [0..lastRevision] | 143 // throws HgInvalidRevisionException or IllegalArgumentException if [start..end] range is not a subrange of [0..lastRevision] |
143 public static void checkRevlogRange(int start, int end, int lastRevision) throws HgInvalidRevisionException { | 144 public static void checkRevlogRange(int start, int end, int lastRevision) throws HgInvalidRevisionException { |
144 if (start < 0 || start > lastRevision) { | 145 if (start < 0 || start > lastRevision) { |
145 final String m = String.format("Bad left range boundary %d in [0..%d]", start, lastRevision); | 146 final String m = String.format("Bad left range boundary %d in [0..%d]", start, lastRevision); |
146 throw new HgInvalidRevisionException(m, null, start).setRevisionIndex(start, 0, lastRevision); | 147 throw new HgInvalidRevisionException(m, null, start).setRevisionIndex(start, 0, lastRevision); |