Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgFileRevision.java @ 628:6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 22 May 2013 15:52:31 +0200 |
parents | 934037edbea0 |
children | 5050ee565bd1 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgFileRevision.java Tue May 21 20:17:33 2013 +0200 +++ b/src/org/tmatesoft/hg/core/HgFileRevision.java Wed May 22 15:52:31 2013 +0200 @@ -107,7 +107,11 @@ return flags; } - public boolean wasCopied() throws HgException { + /** + * @return <code>true</code> if this file revision was created as a result of a copy/rename + * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> + */ + public boolean wasCopied() throws HgRuntimeException { if (isCopy == null) { checkCopy(); } @@ -115,8 +119,9 @@ } /** * @return <code>null</code> if {@link #wasCopied()} is <code>false</code>, name of the copy source otherwise. + * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> */ - public Path getOriginIfCopy() throws HgException { + public Path getOriginIfCopy() throws HgRuntimeException { if (wasCopied()) { return origin; } @@ -145,7 +150,13 @@ return parents; } - public void putContentTo(ByteChannel sink) throws HgException, CancelledException { + /** + * Pipe content of this file revision into the sink + * @param sink accepts file revision content + * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> + * @throws CancelledException if execution of the operation was cancelled + */ + public void putContentTo(ByteChannel sink) throws HgRuntimeException, CancelledException { HgDataFile fn = repo.getFileNode(path); int revisionIndex = fn.getRevisionIndex(revision); fn.contentWithFilters(revisionIndex, sink); @@ -156,7 +167,7 @@ return String.format("HgFileRevision(%s, %s)", getPath().toString(), revision.shortNotation()); } - private void checkCopy() throws HgException { + private void checkCopy() throws HgRuntimeException { HgDataFile fn = repo.getFileNode(path); if (fn.isCopy()) { if (fn.getRevision(0).equals(revision)) {