comparison src/com/tmate/hgkit/ll/HgDataFile.java @ 21:e929cecae4e1

Refactor to move revlog content to base class
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 05 Jan 2011 04:10:28 +0100
parents 571e1b2cc3f7
children 603806cd2dc6
comparison
equal deleted inserted replaced
20:11cfabe692b3 21:e929cecae4e1
1 /* 1 /*
2 * Copyright (c) 2010 Artem Tikhomirov 2 * Copyright (c) 2010, 2011 Artem Tikhomirov
3 */ 3 */
4 package com.tmate.hgkit.ll; 4 package com.tmate.hgkit.ll;
5 5
6 import static com.tmate.hgkit.ll.HgRepository.TIP; 6 import static com.tmate.hgkit.ll.HgRepository.TIP;
7 7
12 * ? name:HgFileNode? 12 * ? name:HgFileNode?
13 * @author artem 13 * @author artem
14 */ 14 */
15 public class HgDataFile extends Revlog { 15 public class HgDataFile extends Revlog {
16 16
17 private final RevlogStream content; // XXX move up to Revlog?
18
19 // absolute from repo root? 17 // absolute from repo root?
20 // slashes, unix-style? 18 // slashes, unix-style?
21 // repo location agnostic, just to give info to user, not to access real storage 19 // repo location agnostic, just to give info to user, not to access real storage
22 private final String path; 20 private final String path;
23 21
24 /*package-local*/HgDataFile(HgRepository hgRepo, String path, RevlogStream content) { 22 /*package-local*/HgDataFile(HgRepository hgRepo, String path, RevlogStream content) {
25 super(hgRepo); 23 super(hgRepo, content);
26 this.path = path; 24 this.path = path;
27 this.content = content;
28 } 25 }
29 26
30 public boolean exists() { 27 public boolean exists() {
31 return content != null; // XXX need better impl 28 return content != null; // XXX need better impl
32 } 29 }
33 30
34 public String getPath() { 31 public String getPath() {
35 return path; // hgRepo.backresolve(this) -> name? 32 return path; // hgRepo.backresolve(this) -> name?
36 }
37
38 public int getRevisionCount() {
39 return content.revisionCount();
40 } 33 }
41 34
42 public byte[] content() { 35 public byte[] content() {
43 return content(TIP); 36 return content(TIP);
44 } 37 }