Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Internals.java @ 526:2f9ed6bcefa2
Initial support for Revert command with accompanying minor refactoring
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 15 Jan 2013 17:07:19 +0100 |
parents | 0be5be8d57e9 |
children | 0f6fa88e2162 |
comparison
equal
deleted
inserted
replaced
525:0be5be8d57e9 | 526:2f9ed6bcefa2 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011-2012 TMate Software Ltd | 2 * Copyright (c) 2011-2013 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 * |
30 import java.util.StringTokenizer; | 30 import java.util.StringTokenizer; |
31 | 31 |
32 import org.tmatesoft.hg.core.SessionContext; | 32 import org.tmatesoft.hg.core.SessionContext; |
33 import org.tmatesoft.hg.repo.HgDataFile; | 33 import org.tmatesoft.hg.repo.HgDataFile; |
34 import org.tmatesoft.hg.repo.HgInternals; | 34 import org.tmatesoft.hg.repo.HgInternals; |
35 import org.tmatesoft.hg.repo.HgRuntimeException; | |
36 import org.tmatesoft.hg.repo.HgRepoConfig.ExtensionsSection; | 35 import org.tmatesoft.hg.repo.HgRepoConfig.ExtensionsSection; |
37 import org.tmatesoft.hg.repo.HgRepository; | 36 import org.tmatesoft.hg.repo.HgRepository; |
37 import org.tmatesoft.hg.repo.HgRepositoryFiles; | |
38 import org.tmatesoft.hg.repo.HgRepositoryLock; | |
39 import org.tmatesoft.hg.repo.HgRuntimeException; | |
38 import org.tmatesoft.hg.util.PathRewrite; | 40 import org.tmatesoft.hg.util.PathRewrite; |
39 | 41 |
40 /** | 42 /** |
41 * Fields/members that shall not be visible | 43 * Fields/members that shall not be visible |
42 * | 44 * |
115 | 117 |
116 public boolean isInvalid() { | 118 public boolean isInvalid() { |
117 return !repoDir.exists() || !repoDir.isDirectory(); | 119 return !repoDir.exists() || !repoDir.isDirectory(); |
118 } | 120 } |
119 | 121 |
122 public File getRepositoryFile(HgRepositoryFiles f) { | |
123 return f.residesUnderRepositoryRoot() ? getFileFromRepoDir(f.getName()) : getFileFromDataDir(f.getName()); | |
124 } | |
125 | |
120 /** | 126 /** |
121 * Access files under ".hg/". | 127 * Access files under ".hg/". |
122 * File not necessarily exists, this method is merely a factory for Files at specific, configuration-dependent location. | 128 * File not necessarily exists, this method is merely a factory for Files at specific, configuration-dependent location. |
123 * | 129 * |
124 * @param name shall be normalized path | 130 * @param name shall be normalized path |
220 */ | 226 */ |
221 public CharSequence getStoragePath(HgDataFile df) { | 227 public CharSequence getStoragePath(HgDataFile df) { |
222 return dataPathHelper.rewrite(df.getPath().toString()); | 228 return dataPathHelper.rewrite(df.getPath().toString()); |
223 } | 229 } |
224 | 230 |
225 | 231 |
226 public static boolean runningOnWindows() { | 232 public static boolean runningOnWindows() { |
227 return System.getProperty("os.name").indexOf("Windows") != -1; | 233 return System.getProperty("os.name").indexOf("Windows") != -1; |
228 } | 234 } |
229 | 235 |
230 /** | 236 /** |
409 | 415 |
410 public boolean shallCacheRevlogs() { | 416 public boolean shallCacheRevlogs() { |
411 return shallCacheRevlogsInRepo; | 417 return shallCacheRevlogsInRepo; |
412 } | 418 } |
413 | 419 |
420 // marker method | |
421 public static IllegalStateException notImplemented() { | |
422 return new IllegalStateException("Not implemented"); | |
423 } | |
424 | |
414 public static Internals getInstance(HgRepository repo) { | 425 public static Internals getInstance(HgRepository repo) { |
415 return HgInternals.getImplementationRepo(repo); | 426 return HgInternals.getImplementationRepo(repo); |
416 } | 427 } |
417 | 428 |
418 public static <T> CharSequence join(Iterable<T> col, CharSequence separator) { | 429 public static <T> CharSequence join(Iterable<T> col, CharSequence separator) { |