# HG changeset patch # User Artem Tikhomirov # Date 1323392962 -3600 # Node ID ac8e1ce67730862dcfd99cd75811d103e3c4f40d # Parent d9dfa9fe9cecf1fda509df410f2a31028128acfd Expose errors dealign with Mercurial internals with Exceptions diff -r d9dfa9fe9cec -r ac8e1ce67730 src/org/tmatesoft/hg/core/ChangesetTransformer.java --- a/src/org/tmatesoft/hg/core/ChangesetTransformer.java Fri Dec 09 02:08:09 2011 +0100 +++ b/src/org/tmatesoft/hg/core/ChangesetTransformer.java Fri Dec 09 02:09:22 2011 +0100 @@ -30,7 +30,7 @@ /** * Bridges {@link HgChangelog.RawChangeset} with high-level {@link HgChangeset} API - * FIXME move to .internal + * FIXME move to .internal once access to package-local HgChangeset cons is resolved * * @author Artem Tikhomirov * @author TMate Software Ltd. diff -r d9dfa9fe9cec -r ac8e1ce67730 src/org/tmatesoft/hg/core/HgFileRevision.java --- 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 null if {@link #wasCopied()} is false, 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; }