Mercurial > hg4j
comparison src/com/tmate/hgkit/ll/HgDataFile.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 | 603806cd2dc6 |
| children | e34f90b9ded1 |
comparison
equal
deleted
inserted
replaced
| 36:205f9b59b400 | 37:e45e75e22523 |
|---|---|
| 37 return content.dataLength(revision); | 37 return content.dataLength(revision); |
| 38 } | 38 } |
| 39 | 39 |
| 40 public byte[] content() { | 40 public byte[] content() { |
| 41 return content(TIP); | 41 return content(TIP); |
| 42 } | |
| 43 | |
| 44 public byte[] content(Nodeid nodeid) { | |
| 45 int revision = content.findLocalRevisionNumber(nodeid); | |
| 46 return content(revision); | |
| 47 } | |
| 48 | |
| 49 /** | |
| 50 * @param revision - repo-local index of this file change (not a changelog revision number!) | |
| 51 */ | |
| 52 public byte[] content(int revision) { | |
| 53 final byte[][] dataPtr = new byte[1][]; | |
| 54 Revlog.Inspector insp = new Revlog.Inspector() { | |
| 55 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | |
| 56 dataPtr[0] = data; | |
| 57 } | |
| 58 }; | |
| 59 content.iterate(revision, revision, true, insp); | |
| 60 return dataPtr[0]; | |
| 61 } | 42 } |
| 62 | 43 |
| 63 public void history(Changeset.Inspector inspector) { | 44 public void history(Changeset.Inspector inspector) { |
| 64 if (!exists()) { | 45 if (!exists()) { |
| 65 throw new IllegalStateException("Can't get history of invalid repository file node"); | 46 throw new IllegalStateException("Can't get history of invalid repository file node"); |
