comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 405:866fc3b597a0

Add an explicit constant instead of -1 to indicate 'no revision' case
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 14 Mar 2012 22:49:32 +0100
parents 2747b0723867
children bb278ccf9866
comparison
equal deleted inserted replaced
403:2747b0723867 405:866fc3b597a0
1 /* 1 /*
2 * Copyright (c) 2011 TMate Software Ltd 2 * Copyright (c) 2011-2012 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
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) { // FIXME guess, usages shall throw HgInvalidRevision. \ 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 // TODO Another method to check,throw and expand TIP at once
140 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION; 140 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION && rev != NO_REVISION;
141 } 141 }
142 142
143 // 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]
144 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 {
145 if (start < 0 || start > lastRevision) { 145 if (start < 0 || start > lastRevision) {