comparison src/com/tmate/hgkit/ll/HgManifest.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 b2251b7a9823
children
comparison
equal deleted inserted replaced
50:f1db8610da62 51:9429c7bd1920
1 /* 1 /*
2 * Copyright (c) 2010, 2011 Artem Tikhomirov 2 * Copyright (c) 2010, 2011 Artem Tikhomirov
3 */ 3 */
4 package com.tmate.hgkit.ll; 4 package com.tmate.hgkit.ll;
5
6 import com.tmate.hgkit.fs.DataAccess;
5 7
6 /** 8 /**
7 * 9 *
8 * @author artem 10 * @author artem
9 */ 11 */
16 public void walk(int start, int end, final Inspector inspector) { 18 public void walk(int start, int end, final Inspector inspector) {
17 Revlog.Inspector insp = new Revlog.Inspector() { 19 Revlog.Inspector insp = new Revlog.Inspector() {
18 20
19 private boolean gtg = true; // good to go 21 private boolean gtg = true; // good to go
20 22
21 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { 23 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess da) {
22 if (!gtg) { 24 if (!gtg) {
23 return; 25 return;
24 } 26 }
25 gtg = gtg && inspector.begin(revisionNumber, new Nodeid(nodeid, true)); 27 gtg = gtg && inspector.begin(revisionNumber, new Nodeid(nodeid, true));
26 int i; 28 int i;
27 String fname = null; 29 String fname = null;
28 String flags = null; 30 String flags = null;
29 Nodeid nid = null; 31 Nodeid nid = null;
32 byte[] data = da.byteArray();
30 for (i = 0; gtg && i < actualLen; i++) { 33 for (i = 0; gtg && i < actualLen; i++) {
31 int x = i; 34 int x = i;
32 for( ; data[i] != '\n' && i < actualLen; i++) { 35 for( ; data[i] != '\n' && i < actualLen; i++) {
33 if (fname == null && data[i] == 0) { 36 if (fname == null && data[i] == 0) {
34 fname = new String(data, x, i - x); 37 fname = new String(data, x, i - x);