Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Internals.java @ 647:c75297c17867
Location of repository files as enumeration, use file constants instead of plain names
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 25 Jun 2013 18:53:18 +0200 |
parents | a8ce405da1f5 |
children | 46b56864b483 |
comparison
equal
deleted
inserted
replaced
646:3b7d51ed4c65 | 647:c75297c17867 |
---|---|
148 public boolean isInvalid() { | 148 public boolean isInvalid() { |
149 return !repoDir.exists() || !repoDir.isDirectory(); | 149 return !repoDir.exists() || !repoDir.isDirectory(); |
150 } | 150 } |
151 | 151 |
152 public File getRepositoryFile(HgRepositoryFiles f) { | 152 public File getRepositoryFile(HgRepositoryFiles f) { |
153 return f.residesUnderRepositoryRoot() ? getFileFromRepoDir(f.getName()) : new File(repo.getWorkingDir(), f.getName()); | 153 switch (f.getHome()) { |
154 case Store : return getFileFromStoreDir(f.getName()); | |
155 case Repo : return getFileFromRepoDir(f.getName()); | |
156 default : return new File(repo.getWorkingDir(), f.getName()); | |
157 } | |
154 } | 158 } |
155 | 159 |
156 /** | 160 /** |
157 * Access files under ".hg/". | 161 * Access files under ".hg/". |
158 * File not necessarily exists, this method is merely a factory for Files at specific, configuration-dependent location. | 162 * File not necessarily exists, this method is merely a factory for {@link File files} at specific, configuration-dependent location. |
159 * | 163 * |
160 * @param name shall be normalized path | 164 * @param name shall be normalized path |
161 */ | 165 */ |
162 public File getFileFromRepoDir(String name) { | 166 public File getFileFromRepoDir(String name) { |
163 return new File(repoDir, name); | 167 return new File(repoDir, name); |