comparison src/com/tmate/hgkit/ll/HgDataFile.java @ 48:e34f90b9ded1

Limit option for history/log
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 14 Jan 2011 23:22:20 +0100
parents e45e75e22523
children 26e3eeaa3962
comparison
equal deleted inserted replaced
47:b01500fe2604 48:e34f90b9ded1
40 public byte[] content() { 40 public byte[] content() {
41 return content(TIP); 41 return content(TIP);
42 } 42 }
43 43
44 public void history(Changeset.Inspector inspector) { 44 public void history(Changeset.Inspector inspector) {
45 history(0, content.revisionCount() - 1, inspector);
46 }
47
48 public void history(int start, int end, Changeset.Inspector inspector) {
45 if (!exists()) { 49 if (!exists()) {
46 throw new IllegalStateException("Can't get history of invalid repository file node"); 50 throw new IllegalStateException("Can't get history of invalid repository file node");
47 } 51 }
48 final int[] commitRevisions = new int[content.revisionCount()]; 52 final int[] commitRevisions = new int[end - start + 1];
49 Revlog.Inspector insp = new Revlog.Inspector() { 53 Revlog.Inspector insp = new Revlog.Inspector() {
50 int count = 0; 54 int count = 0;
51 55
52 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { 56 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) {
53 commitRevisions[count++] = linkRevision; 57 commitRevisions[count++] = linkRevision;
54 } 58 }
55 }; 59 };
56 content.iterate(0, -1, false, insp); 60 content.iterate(start, end, false, insp);
57 getRepo().getChangelog().range(inspector, commitRevisions); 61 getRepo().getChangelog().range(inspector, commitRevisions);
58 }
59
60 public void history(int start, int end, Changeset.Inspector i) {
61 throw HgRepository.notImplemented();
62 } 62 }
63 63
64 /** 64 /**
65 * XXX perhaps, return value Nodeid[2] and boolean needNodeids is better (and higher level) API for this query? 65 * XXX perhaps, return value Nodeid[2] and boolean needNodeids is better (and higher level) API for this query?
66 * 66 *