comparison src/org/tmatesoft/hg/internal/Internals.java @ 539:9edfd5a223b8

Commit: handle empty repository case
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 13 Feb 2013 18:44:58 +0100
parents 0f6fa88e2162
children 6ca3d0c5b4bc
comparison
equal deleted inserted replaced
538:dd4f6311af52 539:9edfd5a223b8
96 private final File repoDir; 96 private final File repoDir;
97 private final boolean isCaseSensitiveFileSystem; 97 private final boolean isCaseSensitiveFileSystem;
98 private final boolean shallCacheRevlogsInRepo; 98 private final boolean shallCacheRevlogsInRepo;
99 private final DataAccessProvider dataAccess; 99 private final DataAccessProvider dataAccess;
100 100
101 @SuppressWarnings("unused")
102 private final int requiresFlags; 101 private final int requiresFlags;
103 102
104 private final PathRewrite dataPathHelper; // access to file storage area (usually under .hg/store/data/), with filenames mangled 103 private final PathRewrite dataPathHelper; // access to file storage area (usually under .hg/store/data/), with filenames mangled
105 private final PathRewrite repoPathHelper; // access to system files (under .hg/store if requires has 'store' flag) 104 private final PathRewrite repoPathHelper; // access to system files (under .hg/store if requires has 'store' flag)
106 105
198 public boolean isCaseSensitiveFileSystem() { 197 public boolean isCaseSensitiveFileSystem() {
199 return isCaseSensitiveFileSystem; 198 return isCaseSensitiveFileSystem;
200 } 199 }
201 200
202 public EncodingHelper buildFileNameEncodingHelper() { 201 public EncodingHelper buildFileNameEncodingHelper() {
203 SessionContext ctx = repo.getSessionContext(); 202 return new EncodingHelper(getFilenameEncoding(), repo.getSessionContext());
204 return new EncodingHelper(getFileEncoding(ctx), ctx); 203 }
204
205 /*package-local*/ Charset getFilenameEncoding() {
206 return getFileEncoding(getSessionContext());
205 } 207 }
206 208
207 /*package-local*/ static Charset getFileEncoding(SessionContext ctx) { 209 /*package-local*/ static Charset getFileEncoding(SessionContext ctx) {
208 Object altEncoding = ctx.getConfigurationProperty(CFG_PROPERTY_FS_FILENAME_ENCODING, null); 210 Object altEncoding = ctx.getConfigurationProperty(CFG_PROPERTY_FS_FILENAME_ENCODING, null);
209 Charset cs; 211 Charset cs;
228 */ 230 */
229 public CharSequence getStoragePath(HgDataFile df) { 231 public CharSequence getStoragePath(HgDataFile df) {
230 return dataPathHelper.rewrite(df.getPath().toString()); 232 return dataPathHelper.rewrite(df.getPath().toString());
231 } 233 }
232 234
235 public int getRequiresFlags() {
236 return requiresFlags;
237 }
233 238
234 public static boolean runningOnWindows() { 239 public static boolean runningOnWindows() {
235 return System.getProperty("os.name").indexOf("Windows") != -1; 240 return System.getProperty("os.name").indexOf("Windows") != -1;
236 } 241 }
237 242