comparison src/org/tmatesoft/hg/core/HgFileRevision.java @ 427:31a89587eb04

FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 29 Mar 2012 17:14:35 +0200
parents 9c9c442b5f2e
children 12f668401613
comparison
equal deleted inserted replaced
426:063b0663495a 427:31a89587eb04
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.core; 17 package org.tmatesoft.hg.core;
18 18
19 import org.tmatesoft.hg.repo.HgDataFile; 19 import org.tmatesoft.hg.repo.HgDataFile;
20 import org.tmatesoft.hg.repo.HgInvalidControlFileException;
21 import org.tmatesoft.hg.repo.HgInvalidRevisionException;
22 import org.tmatesoft.hg.repo.HgManifest; 20 import org.tmatesoft.hg.repo.HgManifest;
23 import org.tmatesoft.hg.repo.HgManifest.Flags; 21 import org.tmatesoft.hg.repo.HgManifest.Flags;
24 import org.tmatesoft.hg.repo.HgRepository; 22 import org.tmatesoft.hg.repo.HgRepository;
23 import org.tmatesoft.hg.repo.HgRuntimeException;
25 import org.tmatesoft.hg.util.ByteChannel; 24 import org.tmatesoft.hg.util.ByteChannel;
26 import org.tmatesoft.hg.util.CancelledException; 25 import org.tmatesoft.hg.util.CancelledException;
27 import org.tmatesoft.hg.util.Pair; 26 import org.tmatesoft.hg.util.Pair;
28 import org.tmatesoft.hg.util.Path; 27 import org.tmatesoft.hg.util.Path;
29 28
76 return revision; 75 return revision;
77 } 76 }
78 77
79 /** 78 /**
80 * Executable or symbolic link, or <code>null</code> if regular file 79 * Executable or symbolic link, or <code>null</code> if regular file
81 * @throws HgInvalidRevisionException if supplied nodeid doesn't identify any revision from this revlog 80 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
82 * @throws HgInvalidControlFileException if access to revlog index/data entry failed
83 */ 81 */
84 public HgManifest.Flags getFileFlags() throws HgInvalidControlFileException, HgInvalidRevisionException { 82 public HgManifest.Flags getFileFlags() throws HgRuntimeException {
85 if (flags == null) { 83 if (flags == null) {
86 HgDataFile df = repo.getFileNode(path); 84 HgDataFile df = repo.getFileNode(path);
87 int revIdx = df.getRevisionIndex(revision); 85 int revIdx = df.getRevisionIndex(revision);
88 flags = df.getFlags(revIdx); 86 flags = df.getFlags(revIdx);
89 } 87 }
110 * Access revisions this file revision originates from. 108 * Access revisions this file revision originates from.
111 * Note, these revisions are records in the file history, not that of the whole repository (aka changeset revisions) 109 * Note, these revisions are records in the file history, not that of the whole repository (aka changeset revisions)
112 * In most cases, only one parent revision would be present, only for merge revisions one can expect both. 110 * In most cases, only one parent revision would be present, only for merge revisions one can expect both.
113 * 111 *
114 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values. 112 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values.
113 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
115 */ 114 */
116 public Pair<Nodeid, Nodeid> getParents() throws HgInvalidControlFileException { 115 public Pair<Nodeid, Nodeid> getParents() throws HgRuntimeException {
117 if (parents == null) { 116 if (parents == null) {
118 HgDataFile fn = repo.getFileNode(path); 117 HgDataFile fn = repo.getFileNode(path);
119 int revisionIndex = fn.getRevisionIndex(revision); 118 int revisionIndex = fn.getRevisionIndex(revision);
120 int[] pr = new int[2]; 119 int[] pr = new int[2];
121 byte[] p1 = new byte[20], p2 = new byte[20]; 120 byte[] p1 = new byte[20], p2 = new byte[20];