comparison src/org/tmatesoft/hg/repo/HgRepository.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
25 import java.util.HashMap; 25 import java.util.HashMap;
26 import java.util.List; 26 import java.util.List;
27 27
28 import org.tmatesoft.hg.core.HgException; 28 import org.tmatesoft.hg.core.HgException;
29 import org.tmatesoft.hg.core.HgInvalidControlFileException; 29 import org.tmatesoft.hg.core.HgInvalidControlFileException;
30 import org.tmatesoft.hg.core.HgInvalidRevisionException;
30 import org.tmatesoft.hg.core.Nodeid; 31 import org.tmatesoft.hg.core.Nodeid;
31 import org.tmatesoft.hg.core.SessionContext; 32 import org.tmatesoft.hg.core.SessionContext;
32 import org.tmatesoft.hg.internal.ByteArrayChannel; 33 import org.tmatesoft.hg.internal.ByteArrayChannel;
33 import org.tmatesoft.hg.internal.ConfigFile; 34 import org.tmatesoft.hg.internal.ConfigFile;
34 import org.tmatesoft.hg.internal.DataAccessProvider; 35 import org.tmatesoft.hg.internal.DataAccessProvider;
51 * @author Artem Tikhomirov 52 * @author Artem Tikhomirov
52 * @author TMate Software Ltd. 53 * @author TMate Software Ltd.
53 */ 54 */
54 public final class HgRepository { 55 public final class HgRepository {
55 56
56 // if new constants added, consider fixing HgInternals#wrongRevisionIndex 57 // IMPORTANT: if new constants added, consider fixing HgInternals#wrongRevisionIndex and HgInvalidRevisionException#getMessage
57 public static final int TIP = -3; 58
59 /**
60 * Revision index constant to indicate most recent revision
61 */
62 public static final int TIP = -3; // XXX TIP_REVISION?
63
64 /**
65 * Revision index constant to indicate invalid revision index value.
66 * Primary use is default/uninitialized values where user input is expected and as return value where
67 * an exception (e.g. {@link HgInvalidRevisionException}) is not desired
68 */
58 public static final int BAD_REVISION = Integer.MIN_VALUE; // XXX INVALID_REVISION? 69 public static final int BAD_REVISION = Integer.MIN_VALUE; // XXX INVALID_REVISION?
59 public static final int WORKING_COPY = -2; 70
60 71 /**
72 * Revision index constant to indicate working copy
73 */
74 public static final int WORKING_COPY = -2; // XXX WORKING_COPY_REVISION?
75
76 /**
77 * Constant ({@value #NO_REVISION}) to indicate revision absence (e.g. missing parent in from {@link HgChangelog#parents(int, int[], byte[], byte[])} call)
78 * or a fictitious revision of an empty repository, to use as an argument (contrary to {@link #BAD_REVISION})
79 * e.g in a status operation to visit changes from the very beginning of a repository.
80 */
81 public static final int NO_REVISION = -1;
82
83 /**
84 * Name of the primary branch, "default".
85 */
61 public static final String DEFAULT_BRANCH_NAME = "default"; 86 public static final String DEFAULT_BRANCH_NAME = "default";
62 87
63 // temp aux marker method 88 // temp aux marker method
64 public static IllegalStateException notImplemented() { 89 public static IllegalStateException notImplemented() {
65 return new IllegalStateException("Not implemented"); 90 return new IllegalStateException("Not implemented");