comparison src/org/tmatesoft/hg/core/HgCatCommand.java @ 215:41a778e3fd31

Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 17 May 2011 00:56:54 +0200
parents d5268ca7715b
children b7347daa50e3
comparison
equal deleted inserted replaced
214:4252faa556cd 215:41a778e3fd31
33 * Command to obtain content of a file, 'hg cat' counterpart. 33 * Command to obtain content of a file, 'hg cat' counterpart.
34 * 34 *
35 * @author Artem Tikhomirov 35 * @author Artem Tikhomirov
36 * @author TMate Software Ltd. 36 * @author TMate Software Ltd.
37 */ 37 */
38 public class HgCatCommand { 38 public class HgCatCommand extends HgAbstractCommand<HgCatCommand> {
39 39
40 private final HgRepository repo; 40 private final HgRepository repo;
41 private Path file; 41 private Path file;
42 private int localRevision = TIP; 42 private int localRevision = TIP;
43 private Nodeid revision; 43 private Nodeid revision;
108 if (sink == null) { 108 if (sink == null) {
109 throw new IllegalArgumentException("Need an output channel"); 109 throw new IllegalArgumentException("Need an output channel");
110 } 110 }
111 HgDataFile dataFile = repo.getFileNode(file); 111 HgDataFile dataFile = repo.getFileNode(file);
112 if (!dataFile.exists()) { 112 if (!dataFile.exists()) {
113 throw new HgDataStreamException(file.toString(), new FileNotFoundException(file.toString())); 113 throw new HgDataStreamException(file, new FileNotFoundException(file.toString()));
114 } 114 }
115 int revToExtract; 115 int revToExtract;
116 if (revision != null) { 116 if (revision != null) {
117 revToExtract = dataFile.getLocalRevision(revision); 117 revToExtract = dataFile.getLocalRevision(revision);
118 } else { 118 } else {