Mercurial > jhg
comparison src/com/tmate/hgkit/ll/Revlog.java @ 37:e45e75e22523
Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 14 Jan 2011 00:49:58 +0100 |
parents | 346b66add79d |
children | 4e9b66b07a28 |
comparison
equal
deleted
inserted
replaced
36:205f9b59b400 | 37:e45e75e22523 |
---|---|
32 } | 32 } |
33 | 33 |
34 public int getRevisionCount() { | 34 public int getRevisionCount() { |
35 return content.revisionCount(); | 35 return content.revisionCount(); |
36 } | 36 } |
37 | |
38 /** | |
39 * Access to revision data as is (decompressed, but otherwise unprocessed, i.e. not parsed for e.g. changeset or manifest entries) | |
40 * @param nodeid | |
41 */ | |
42 public byte[] content(Nodeid nodeid) { | |
43 int revision = content.findLocalRevisionNumber(nodeid); | |
44 return content(revision); | |
45 } | |
37 | 46 |
47 /** | |
48 * @param revision - repo-local index of this file change (not a changelog revision number!) | |
49 */ | |
50 public byte[] content(int revision) { | |
51 final byte[][] dataPtr = new byte[1][]; | |
52 Revlog.Inspector insp = new Revlog.Inspector() { | |
53 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | |
54 dataPtr[0] = data; | |
55 } | |
56 }; | |
57 content.iterate(revision, revision, true, insp); | |
58 return dataPtr[0]; | |
59 } | |
60 | |
38 // FIXME byte[] data might be too expensive, for few usecases it may be better to have intermediate Access object (when we don't need full data | 61 // FIXME byte[] data might be too expensive, for few usecases it may be better to have intermediate Access object (when we don't need full data |
39 // instantly - e.g. calculate hash, or comparing two revisions | 62 // instantly - e.g. calculate hash, or comparing two revisions |
40 // XXX seems that RevlogStream is better place for this class. | 63 // XXX seems that RevlogStream is better place for this class. |
41 public interface Inspector { | 64 public interface Inspector { |
42 // XXX boolean retVal to indicate whether to continue? | 65 // XXX boolean retVal to indicate whether to continue? |