comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 148:1a7a9a20e1f9

Exceptions, javadoc. Initial cancel and progress support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Feb 2011 22:36:28 +0100
parents acc6151b1b7a
children 3a7696fb457c
comparison
equal deleted inserted replaced
147:a05145db4d0c 148:1a7a9a20e1f9
43 * @author Artem Tikhomirov 43 * @author Artem Tikhomirov
44 * @author TMate Software Ltd. 44 * @author TMate Software Ltd.
45 */ 45 */
46 public final class HgRepository { 46 public final class HgRepository {
47 47
48 // if new constants added, consider fixing HgInternals#badLocalRevision
48 public static final int TIP = -1; 49 public static final int TIP = -1;
49 public static final int BAD_REVISION = Integer.MIN_VALUE; 50 public static final int BAD_REVISION = Integer.MIN_VALUE;
50 public static final int WORKING_COPY = -2; 51 public static final int WORKING_COPY = -2;
51 52
52 // temp aux marker method 53 // temp aux marker method
53 public static IllegalStateException notImplemented() { 54 public static IllegalStateException notImplemented() {
54 return new IllegalStateException("Not implemented"); 55 return new IllegalStateException("Not implemented");
55 } 56 }
56 57
57 private final File repoDir; // .hg folder 58 private final File repoDir; // .hg folder
58 private final String repoLocation; 59 private final String repoLocation;
59 private final DataAccessProvider dataAccess; 60 private final DataAccessProvider dataAccess;
60 private final PathRewrite normalizePath; 61 private final PathRewrite normalizePath;
61 private final PathRewrite dataPathHelper; 62 private final PathRewrite dataPathHelper;
77 dataAccess = null; 78 dataAccess = null;
78 dataPathHelper = repoPathHelper = null; 79 dataPathHelper = repoPathHelper = null;
79 normalizePath = null; 80 normalizePath = null;
80 } 81 }
81 82
82 HgRepository(File repositoryRoot) throws IOException { 83 HgRepository(String repositoryPath, File repositoryRoot) {
83 assert ".hg".equals(repositoryRoot.getName()) && repositoryRoot.isDirectory(); 84 assert ".hg".equals(repositoryRoot.getName()) && repositoryRoot.isDirectory();
85 assert repositoryPath != null;
86 assert repositoryRoot != null;
84 repoDir = repositoryRoot; 87 repoDir = repositoryRoot;
85 repoLocation = repositoryRoot.getParentFile().getCanonicalPath(); 88 repoLocation = repositoryPath;
86 dataAccess = new DataAccessProvider(); 89 dataAccess = new DataAccessProvider();
87 final boolean runningOnWindows = System.getProperty("os.name").indexOf("Windows") != -1; 90 final boolean runningOnWindows = System.getProperty("os.name").indexOf("Windows") != -1;
88 if (runningOnWindows) { 91 if (runningOnWindows) {
89 normalizePath = new PathRewrite() { 92 normalizePath = new PathRewrite() {
90 93