Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgFileRevision.java @ 364:ac8e1ce67730
Expose errors dealign with Mercurial internals with Exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 09 Dec 2011 02:09:22 +0100 |
parents | 5f9073eabf06 |
children | 2fadf8695f8a |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgFileRevision.java Fri Dec 09 02:08:09 2011 +0100 +++ b/src/org/tmatesoft/hg/core/HgFileRevision.java Fri Dec 09 02:09:22 2011 +0100 @@ -17,7 +17,6 @@ package org.tmatesoft.hg.core; import org.tmatesoft.hg.repo.HgDataFile; -import org.tmatesoft.hg.repo.HgInternals; import org.tmatesoft.hg.repo.HgRepository; import org.tmatesoft.hg.util.ByteChannel; import org.tmatesoft.hg.util.CancelledException; @@ -58,10 +57,12 @@ public Path getPath() { return path; } + public Nodeid getRevision() { return revision; } - public boolean wasCopied() { + + public boolean wasCopied() throws HgException { if (isCopy == null) { checkCopy(); } @@ -70,7 +71,7 @@ /** * @return <code>null</code> if {@link #wasCopied()} is <code>false</code>, name of the copy source otherwise. */ - public Path getOriginIfCopy() { + public Path getOriginIfCopy() throws HgException { if (wasCopied()) { return origin; } @@ -104,22 +105,15 @@ fn.contentWithFilters(localRevision, sink); } - private void checkCopy() { + private void checkCopy() throws HgInvalidControlFileException, HgDataStreamException { HgDataFile fn = repo.getFileNode(path); - try { - if (fn.isCopy()) { - if (fn.getRevision(0).equals(revision)) { - // this HgFileRevision represents first revision of the copy - isCopy = Boolean.TRUE; - origin = fn.getCopySourceName(); - return; - } + if (fn.isCopy()) { + if (fn.getRevision(0).equals(revision)) { + // this HgFileRevision represents first revision of the copy + isCopy = Boolean.TRUE; + origin = fn.getCopySourceName(); + return; } - } catch (HgDataStreamException ex) { - // FIXME rather throw an exception than log silently - HgInternals.getContext(repo).getLog().error(getClass(), ex, null); - } catch (HgInvalidControlFileException ex) { - HgInternals.getContext(repo).getLog().error(getClass(), ex, null); } isCopy = Boolean.FALSE; }