Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgFileRevision.java @ 354:5f9073eabf06
Propagate errors with exceptions up to a end client
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 01 Dec 2011 05:21:40 +0100 |
| parents | 58725dd511b3 |
| children | ac8e1ce67730 |
comparison
equal
deleted
inserted
replaced
| 353:0f3687e79f5a | 354:5f9073eabf06 |
|---|---|
| 82 * Note, these revisions are records in the file history, not that of the whole repository (aka changeset revisions) | 82 * Note, these revisions are records in the file history, not that of the whole repository (aka changeset revisions) |
| 83 * In most cases, only one parent revision would be present, only for merge revisions one can expect both. | 83 * In most cases, only one parent revision would be present, only for merge revisions one can expect both. |
| 84 * | 84 * |
| 85 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values. | 85 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values. |
| 86 */ | 86 */ |
| 87 public Pair<Nodeid, Nodeid> getParents() { | 87 public Pair<Nodeid, Nodeid> getParents() throws HgInvalidControlFileException { |
| 88 if (parents == null) { | 88 if (parents == null) { |
| 89 HgDataFile fn = repo.getFileNode(path); | 89 HgDataFile fn = repo.getFileNode(path); |
| 90 int localRevision = fn.getLocalRevision(revision); | 90 int localRevision = fn.getLocalRevision(revision); |
| 91 int[] pr = new int[2]; | 91 int[] pr = new int[2]; |
| 92 byte[] p1 = new byte[20], p2 = new byte[20]; | 92 byte[] p1 = new byte[20], p2 = new byte[20]; |
| 96 parents = new Pair<Nodeid, Nodeid>(Nodeid.fromBinary(p1, 0), Nodeid.fromBinary(p2, 0)); | 96 parents = new Pair<Nodeid, Nodeid>(Nodeid.fromBinary(p1, 0), Nodeid.fromBinary(p2, 0)); |
| 97 } | 97 } |
| 98 return parents; | 98 return parents; |
| 99 } | 99 } |
| 100 | 100 |
| 101 public void putContentTo(ByteChannel sink) throws HgDataStreamException, CancelledException { | 101 public void putContentTo(ByteChannel sink) throws HgDataStreamException, HgInvalidControlFileException, CancelledException { |
| 102 HgDataFile fn = repo.getFileNode(path); | 102 HgDataFile fn = repo.getFileNode(path); |
| 103 int localRevision = fn.getLocalRevision(revision); | 103 int localRevision = fn.getLocalRevision(revision); |
| 104 fn.contentWithFilters(localRevision, sink); | 104 fn.contentWithFilters(localRevision, sink); |
| 105 } | 105 } |
| 106 | 106 |
| 114 origin = fn.getCopySourceName(); | 114 origin = fn.getCopySourceName(); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } catch (HgDataStreamException ex) { | 118 } catch (HgDataStreamException ex) { |
| 119 // FIXME rather throw an exception than log silently | |
| 120 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); | |
| 121 } catch (HgInvalidControlFileException ex) { | |
| 119 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); | 122 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); |
| 120 } | 123 } |
| 121 isCopy = Boolean.FALSE; | 124 isCopy = Boolean.FALSE; |
| 122 } | 125 } |
| 123 } | 126 } |
