Mercurial > jhg
diff 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 |
line wrap: on
line diff
--- a/src/com/tmate/hgkit/ll/HgDataFile.java Sun Dec 19 05:41:31 2010 +0100 +++ b/src/com/tmate/hgkit/ll/HgDataFile.java Mon Dec 20 02:50:36 2010 +0100 @@ -10,10 +10,21 @@ */ public class HgDataFile extends Revlog { + private final RevlogStream content; // XXX move up to Revlog? + + // absolute from repo root? + // slashes, unix-style? + // repo location agnostic, just to give info to user, not to access real storage private final String path; - /*package-local*/HgDataFile(HgRepository hgRepo) { + /*package-local*/HgDataFile(HgRepository hgRepo, String path, RevlogStream content) { super(hgRepo); + this.path = path; + this.content = content; + } + + public boolean exists() { + return content != null; // XXX need better impl } public String getPath() { @@ -29,4 +40,24 @@ public byte[] content(int revision) { throw HgRepository.notImplemented(); } + + public void history(Changeset.Inspector inspector) { + if (!exists()) { + throw new IllegalStateException("Can't get history of invalid repository file node"); + } + final int[] commitRevisions = new int[content.revisionCount()]; + Revlog.Inspector insp = new Revlog.Inspector() { + int count = 0; + + public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { + commitRevisions[count++] = linkRevision; + } + }; + content.iterate(0, -1, false, insp); + getRepo().getChangelog().range(inspector, commitRevisions); + } + + public void history(int start, int end, Changeset.Inspector i) { + throw HgRepository.notImplemented(); + } }