comparison src/org/tmatesoft/hg/core/HgFileRevision.java @ 231:1792b37650f2

Introduced access to conflict resolution information (merge state)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 01 Jun 2011 05:44:25 +0200
parents
children 6e1373b54e9b
comparison
equal deleted inserted replaced
230:0dd9da7489dc 231:1792b37650f2
1 /*
2 * Copyright (c) 2011 TMate Software Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com
16 */
17 package org.tmatesoft.hg.core;
18
19 import java.io.IOException;
20
21 import org.tmatesoft.hg.repo.HgDataFile;
22 import org.tmatesoft.hg.repo.HgRepository;
23 import org.tmatesoft.hg.util.ByteChannel;
24 import org.tmatesoft.hg.util.CancelledException;
25 import org.tmatesoft.hg.util.Path;
26
27 /**
28 * Keeps together information about specific file revision
29 *
30 * @author Artem Tikhomirov
31 * @author TMate Software Ltd.
32 */
33 public final class HgFileRevision implements HgLogCommand.FileRevision {
34 private final HgRepository repo;
35 private final Nodeid revision;
36 private final Path path;
37
38 public HgFileRevision(HgRepository hgRepo, Nodeid rev, Path p) {
39 if (hgRepo == null || rev == null || p == null) {
40 // since it's package local, it is our code to blame for non validated arguments
41 throw new HgBadStateException();
42 }
43 repo = hgRepo;
44 revision = rev;
45 path = p;
46 }
47
48 public Path getPath() {
49 return path;
50 }
51 public Nodeid getRevision() {
52 return revision;
53 }
54 public void putContentTo(ByteChannel sink) throws HgDataStreamException, IOException, CancelledException {
55 HgDataFile fn = repo.getFileNode(path);
56 int localRevision = fn.getLocalRevision(revision);
57 fn.contentWithFilters(localRevision, sink);
58 }
59
60 }