Mercurial > hg4j
diff src/com/tmate/hgkit/ll/Changelog.java @ 51:9429c7bd1920 wrap-data-access
Try DataAccess to reach revision data instead of plain byte arrays
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sun, 16 Jan 2011 01:20:26 +0100 |
parents | e34f90b9ded1 |
children |
line wrap: on
line diff
--- a/src/com/tmate/hgkit/ll/Changelog.java Sat Jan 15 01:41:49 2011 +0100 +++ b/src/com/tmate/hgkit/ll/Changelog.java Sun Jan 16 01:20:26 2011 +0100 @@ -7,6 +7,8 @@ import java.util.Arrays; import java.util.List; +import com.tmate.hgkit.fs.DataAccess; + /** * Representation of the Mercurial changelog file (list of ChangeSets) * @author artem @@ -24,7 +26,8 @@ public void range(int start, int end, final Changeset.Inspector inspector) { Revlog.Inspector i = new Revlog.Inspector() { - public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { + public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) { + byte[] data = da.byteArray(); Changeset cset = Changeset.parse(data, 0, data.length); // XXX there's no guarantee for Changeset.Callback that distinct instance comes each time, consider instance reuse inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset); @@ -37,7 +40,8 @@ final ArrayList<Changeset> rv = new ArrayList<Changeset>(end - start + 1); Revlog.Inspector i = new Revlog.Inspector() { - public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { + public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) { + byte[] data = da.byteArray(); Changeset cset = Changeset.parse(data, 0, data.length); rv.add(cset); } @@ -52,8 +56,9 @@ } Revlog.Inspector i = new Revlog.Inspector() { - public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { + public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) { if (Arrays.binarySearch(revisions, revisionNumber) >= 0) { + byte[] data = da.byteArray(); Changeset cset = Changeset.parse(data, 0, data.length); inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset); }