comparison src/org/tmatesoft/hg/core/HgChangesetFileSneaker.java @ 423:9c9c442b5f2e

Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 23 Mar 2012 22:51:18 +0100
parents ccd7d25e5aea
children 31a89587eb04
comparison
equal deleted inserted replaced
422:5d1cc7366d04 423:9c9c442b5f2e
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.HgManifest; 23 import org.tmatesoft.hg.repo.HgManifest;
22 import org.tmatesoft.hg.repo.HgRepository; 24 import org.tmatesoft.hg.repo.HgRepository;
25 import org.tmatesoft.hg.repo.HgRuntimeException;
23 import org.tmatesoft.hg.util.Path; 26 import org.tmatesoft.hg.util.Path;
24 import org.tmatesoft.hg.util.Status; 27 import org.tmatesoft.hg.util.Status;
25 28
26 /** 29 /**
27 * Primary purpose is to provide information about file revisions at specific changeset. Multiple {@link #check(Path)} calls 30 * Primary purpose is to provide information about file revisions at specific changeset. Multiple {@link #check(Path)} calls
143 dataFile = repo.getFileNode(file); 146 dataFile = repo.getFileNode(file);
144 toExtract = cachedManifest.nodeid(file); 147 toExtract = cachedManifest.nodeid(file);
145 extractRevFlags = cachedManifest.flags(file); 148 extractRevFlags = cachedManifest.flags(file);
146 } 149 }
147 } 150 }
148 } catch (HgException ex) { 151 } catch (HgRuntimeException ex) {
149 checkResult = new Status(Status.Kind.ERROR, phaseMsg, ex); 152 checkResult = new Status(Status.Kind.ERROR, phaseMsg, ex);
150 return checkResult; 153 return checkResult;
151 } 154 }
152 if (toExtract != null) { 155 if (toExtract != null) {
153 fileRevision = new HgFileRevision(repo, toExtract, extractRevFlags, dataFile.getPath()); 156 fileRevision = new HgFileRevision(repo, toExtract, extractRevFlags, dataFile.getPath());
210 return fileRevision.getRevision(); 213 return fileRevision.getRevision();
211 } 214 }
212 215
213 private void assertCheckRan() { 216 private void assertCheckRan() {
214 if (checkResult == null) { 217 if (checkResult == null) {
215 throw new HgBadStateException("Shall invoke #check(Path) first"); 218 throw new HgInvalidStateException("Shall invoke #check(Path) first");
216 } 219 }
217 } 220 }
218 221
219 } 222 }