Mercurial > hg4j
comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 348:a0864b2892cd
Expose errors reading mercurial control files with exception
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 24 Nov 2011 02:57:03 +0100 |
parents | f377f833b780 |
children | 189dc6dc1c3e |
comparison
equal
deleted
inserted
replaced
347:8da7ade36c57 | 348:a0864b2892cd |
---|---|
249 public PathRewrite getToRepoPathHelper() { | 249 public PathRewrite getToRepoPathHelper() { |
250 return normalizePath; | 250 return normalizePath; |
251 } | 251 } |
252 | 252 |
253 /** | 253 /** |
254 * @return pair of values, {@link Pair#first()} and {@link Pair#second()} are respective parents, never <code>null</code>. | 254 * @return pair of values, {@link Pair#first()} and {@link Pair#second()} are respective parents, never <code>null</code>. |
255 */ | 255 * @throws HgInvalidControlFileException if attempt to read information about working copy parents from dirstate failed |
256 public Pair<Nodeid,Nodeid> getWorkingCopyParents() { | 256 */ |
257 public Pair<Nodeid,Nodeid> getWorkingCopyParents() throws HgInvalidControlFileException { | |
257 return HgDirstate.readParents(this, new File(repoDir, "dirstate")); | 258 return HgDirstate.readParents(this, new File(repoDir, "dirstate")); |
258 } | 259 } |
259 | 260 |
260 /** | 261 /** |
261 * @return name of the branch associated with working directory, never <code>null</code>. | 262 * @return name of the branch associated with working directory, never <code>null</code>. |
262 */ | 263 * @throws HgInvalidControlFileException if attempt to read branch name failed. |
263 public String getWorkingCopyBranchName() { | 264 */ |
265 public String getWorkingCopyBranchName() throws HgInvalidControlFileException { | |
264 return HgDirstate.readBranch(this); | 266 return HgDirstate.readBranch(this); |
265 } | 267 } |
266 | 268 |
267 /** | 269 /** |
268 * @return location where user files (shall) reside | 270 * @return location where user files (shall) reside |
274 /** | 276 /** |
275 * Provides access to sub-repositories defined in this repository. Enumerated sub-repositories are those directly | 277 * Provides access to sub-repositories defined in this repository. Enumerated sub-repositories are those directly |
276 * known, not recursive collection of all nested sub-repositories. | 278 * known, not recursive collection of all nested sub-repositories. |
277 * @return list of all known sub-repositories in this repository, or empty list if none found. | 279 * @return list of all known sub-repositories in this repository, or empty list if none found. |
278 */ | 280 */ |
279 public List<HgSubrepoLocation> getSubrepositories() { | 281 public List<HgSubrepoLocation> getSubrepositories() throws HgInvalidControlFileException { |
280 if (subRepos == null) { | 282 if (subRepos == null) { |
281 subRepos = new SubrepoManager(this); | 283 subRepos = new SubrepoManager(this); |
284 subRepos.read(); | |
282 } | 285 } |
283 return subRepos.all(); | 286 return subRepos.all(); |
284 } | 287 } |
285 | 288 |
286 | 289 |
309 return dataPathHelper.rewrite(df.getPath().toString()).toString(); | 312 return dataPathHelper.rewrite(df.getPath().toString()).toString(); |
310 } | 313 } |
311 | 314 |
312 // XXX package-local, unless there are cases when required from outside (guess, working dir/revision walkers may hide dirstate access and no public visibility needed) | 315 // XXX package-local, unless there are cases when required from outside (guess, working dir/revision walkers may hide dirstate access and no public visibility needed) |
313 // XXX consider passing Path pool or factory to produce (shared) Path instead of Strings | 316 // XXX consider passing Path pool or factory to produce (shared) Path instead of Strings |
314 /*package-local*/ final HgDirstate loadDirstate(PathPool pathPool) { | 317 /*package-local*/ final HgDirstate loadDirstate(PathPool pathPool) throws HgInvalidControlFileException { |
315 PathRewrite canonicalPath = null; | 318 PathRewrite canonicalPath = null; |
316 if (!isCaseSensitiveFileSystem) { | 319 if (!isCaseSensitiveFileSystem) { |
317 canonicalPath = new PathRewrite() { | 320 canonicalPath = new PathRewrite() { |
318 | 321 |
319 public CharSequence rewrite(CharSequence path) { | 322 public CharSequence rewrite(CharSequence path) { |
320 return path.toString().toLowerCase(); | 323 return path.toString().toLowerCase(); |
321 } | 324 } |
322 }; | 325 }; |
323 } | 326 } |
324 return new HgDirstate(this, new File(repoDir, "dirstate"), pathPool, canonicalPath); | 327 HgDirstate ds = new HgDirstate(this, new File(repoDir, "dirstate"), pathPool, canonicalPath); |
328 ds.read(); | |
329 return ds; | |
325 } | 330 } |
326 | 331 |
327 /** | 332 /** |
328 * Access to configured set of ignored files. | 333 * Access to configured set of ignored files. |
329 * @see HgIgnore#isIgnored(Path) | 334 * @see HgIgnore#isIgnored(Path) |