Mercurial > jhg
comparison src/com/tmate/hgkit/ll/HgDataFile.java @ 3:24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 20 Dec 2010 02:50:36 +0100 |
parents | 08db726a0fb7 |
children | fc265ddeab26 |
comparison
equal
deleted
inserted
replaced
2:08db726a0fb7 | 3:24bb4f365164 |
---|---|
8 * ? name:HgFileNode? | 8 * ? name:HgFileNode? |
9 * @author artem | 9 * @author artem |
10 */ | 10 */ |
11 public class HgDataFile extends Revlog { | 11 public class HgDataFile extends Revlog { |
12 | 12 |
13 private final RevlogStream content; // XXX move up to Revlog? | |
14 | |
15 // absolute from repo root? | |
16 // slashes, unix-style? | |
17 // repo location agnostic, just to give info to user, not to access real storage | |
13 private final String path; | 18 private final String path; |
14 | 19 |
15 /*package-local*/HgDataFile(HgRepository hgRepo) { | 20 /*package-local*/HgDataFile(HgRepository hgRepo, String path, RevlogStream content) { |
16 super(hgRepo); | 21 super(hgRepo); |
22 this.path = path; | |
23 this.content = content; | |
24 } | |
25 | |
26 public boolean exists() { | |
27 return content != null; // XXX need better impl | |
17 } | 28 } |
18 | 29 |
19 public String getPath() { | 30 public String getPath() { |
20 return path; // hgRepo.backresolve(this) -> name? | 31 return path; // hgRepo.backresolve(this) -> name? |
21 } | 32 } |
27 } | 38 } |
28 | 39 |
29 public byte[] content(int revision) { | 40 public byte[] content(int revision) { |
30 throw HgRepository.notImplemented(); | 41 throw HgRepository.notImplemented(); |
31 } | 42 } |
43 | |
44 public void history(Changeset.Inspector inspector) { | |
45 if (!exists()) { | |
46 throw new IllegalStateException("Can't get history of invalid repository file node"); | |
47 } | |
48 final int[] commitRevisions = new int[content.revisionCount()]; | |
49 Revlog.Inspector insp = new Revlog.Inspector() { | |
50 int count = 0; | |
51 | |
52 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | |
53 commitRevisions[count++] = linkRevision; | |
54 } | |
55 }; | |
56 content.iterate(0, -1, false, insp); | |
57 getRepo().getChangelog().range(inspector, commitRevisions); | |
58 } | |
59 | |
60 public void history(int start, int end, Changeset.Inspector i) { | |
61 throw HgRepository.notImplemented(); | |
62 } | |
32 } | 63 } |