Mercurial > jhg
comparison src/com/tmate/hgkit/ll/HgDataFile.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 | 26e3eeaa3962 |
children |
comparison
equal
deleted
inserted
replaced
50:f1db8610da62 | 51:9429c7bd1920 |
---|---|
4 package com.tmate.hgkit.ll; | 4 package com.tmate.hgkit.ll; |
5 | 5 |
6 import static com.tmate.hgkit.ll.HgRepository.TIP; | 6 import static com.tmate.hgkit.ll.HgRepository.TIP; |
7 | 7 |
8 import java.util.Arrays; | 8 import java.util.Arrays; |
9 | |
10 import com.tmate.hgkit.fs.DataAccess; | |
9 | 11 |
10 /** | 12 /** |
11 * Extends Revlog/uses RevlogStream? | 13 * Extends Revlog/uses RevlogStream? |
12 * ? name:HgFileNode? | 14 * ? name:HgFileNode? |
13 * @author artem | 15 * @author artem |
50 } | 52 } |
51 final int[] commitRevisions = new int[end - start + 1]; | 53 final int[] commitRevisions = new int[end - start + 1]; |
52 Revlog.Inspector insp = new Revlog.Inspector() { | 54 Revlog.Inspector insp = new Revlog.Inspector() { |
53 int count = 0; | 55 int count = 0; |
54 | 56 |
55 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | 57 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { |
56 commitRevisions[count++] = linkRevision; | 58 commitRevisions[count++] = linkRevision; |
57 } | 59 } |
58 }; | 60 }; |
59 content.iterate(start, end, false, insp); | 61 content.iterate(start, end, false, insp); |
60 getRepo().getChangelog().range(inspector, commitRevisions); | 62 getRepo().getChangelog().range(inspector, commitRevisions); |
85 class ParentCollector implements Revlog.Inspector { | 87 class ParentCollector implements Revlog.Inspector { |
86 public int p1 = -1; | 88 public int p1 = -1; |
87 public int p2 = -1; | 89 public int p2 = -1; |
88 public byte[] nodeid; | 90 public byte[] nodeid; |
89 | 91 |
90 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | 92 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { |
91 p1 = parent1Revision; | 93 p1 = parent1Revision; |
92 p2 = parent2Revision; | 94 p2 = parent2Revision; |
93 this.nodeid = new byte[20]; | 95 this.nodeid = new byte[20]; |
94 // nodeid arg now comes in 32 byte from (as in file format description), however upper 12 bytes are zeros. | 96 // nodeid arg now comes in 32 byte from (as in file format description), however upper 12 bytes are zeros. |
95 System.arraycopy(nodeid, nodeid.length > 20 ? nodeid.length - 20 : 0, this.nodeid, 0, 20); | 97 System.arraycopy(nodeid, nodeid.length > 20 ? nodeid.length - 20 : 0, this.nodeid, 0, 20); |