Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgChangesetFileSneaker.java @ 427:31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 17:14:35 +0200 |
parents | 9c9c442b5f2e |
children | 7e1912b4ce99 |
comparison
equal
deleted
inserted
replaced
426:063b0663495a | 427:31a89587eb04 |
---|---|
16 */ | 16 */ |
17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import org.tmatesoft.hg.internal.ManifestRevision; | 19 import org.tmatesoft.hg.internal.ManifestRevision; |
20 import org.tmatesoft.hg.repo.HgDataFile; | 20 import org.tmatesoft.hg.repo.HgDataFile; |
21 import org.tmatesoft.hg.repo.HgInvalidControlFileException; | |
22 import org.tmatesoft.hg.repo.HgInvalidStateException; | 21 import org.tmatesoft.hg.repo.HgInvalidStateException; |
23 import org.tmatesoft.hg.repo.HgManifest; | 22 import org.tmatesoft.hg.repo.HgManifest; |
24 import org.tmatesoft.hg.repo.HgRepository; | 23 import org.tmatesoft.hg.repo.HgRepository; |
25 import org.tmatesoft.hg.repo.HgRuntimeException; | 24 import org.tmatesoft.hg.repo.HgRuntimeException; |
26 import org.tmatesoft.hg.util.Path; | 25 import org.tmatesoft.hg.util.Path; |
90 return this; | 89 return this; |
91 } | 90 } |
92 | 91 |
93 /** | 92 /** |
94 * Shortcut to perform {@link #check(Path)} and {@link #exists()}. Result of the check may be accessed via {@link #getCheckStatus()}. | 93 * Shortcut to perform {@link #check(Path)} and {@link #exists()}. Result of the check may be accessed via {@link #getCheckStatus()}. |
94 * Errors during the check, if any, are reported through exception. | |
95 * | 95 * |
96 * @param file name of the file in question | 96 * @param file name of the file in question |
97 * @return <code>true</code> if file is known at the selected changeset. | 97 * @return <code>true</code> if file is known at the selected changeset. |
98 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state | |
98 * @throws IllegalArgumentException if {@link #changeset(Nodeid)} not specified or file argument is bad. | 99 * @throws IllegalArgumentException if {@link #changeset(Nodeid)} not specified or file argument is bad. |
99 * @throws HgInvalidControlFileException if access to revlog index/data entry failed | 100 */ |
100 */ | 101 public boolean checkExists(Path file) throws HgException { |
101 public boolean checkExists(Path file) throws HgInvalidControlFileException { | |
102 check(file); | 102 check(file); |
103 if (!checkResult.isOk() && checkResult.getException() instanceof HgInvalidControlFileException) { | 103 // next seems reasonable, however renders boolean return value useless. perhaps void or distinct method? |
104 throw (HgInvalidControlFileException) checkResult.getException(); | 104 // if (checkResult.isOk() && !exists()) { |
105 // throw new HgPathNotFoundException(checkResult.getMessage(), file); | |
106 // } | |
107 if (!checkResult.isOk() && checkResult.getException() instanceof HgRuntimeException) { | |
108 throw new HgLibraryFailureException((HgRuntimeException) checkResult.getException()); | |
105 } | 109 } |
106 return checkResult.isOk() && exists(); | 110 return checkResult.isOk() && exists(); |
107 } | 111 } |
108 | 112 |
109 /** | 113 /** |