comparison src/com/tmate/hgkit/ll/Changelog.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 b01500fe2604
children 9429c7bd1920
comparison
equal deleted inserted replaced
47:b01500fe2604 48:e34f90b9ded1
16 /*package-local*/ Changelog(HgRepository hgRepo, RevlogStream content) { 16 /*package-local*/ Changelog(HgRepository hgRepo, RevlogStream content) {
17 super(hgRepo, content); 17 super(hgRepo, content);
18 } 18 }
19 19
20 public void all(final Changeset.Inspector inspector) { 20 public void all(final Changeset.Inspector inspector) {
21 range(0, content.revisionCount() - 1, inspector);
22 }
23
24 public void range(int start, int end, final Changeset.Inspector inspector) {
21 Revlog.Inspector i = new Revlog.Inspector() { 25 Revlog.Inspector i = new Revlog.Inspector() {
22 26
23 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { 27 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) {
24 Changeset cset = Changeset.parse(data, 0, data.length); 28 Changeset cset = Changeset.parse(data, 0, data.length);
25 // XXX there's no guarantee for Changeset.Callback that distinct instance comes each time, consider instance reuse 29 // XXX there's no guarantee for Changeset.Callback that distinct instance comes each time, consider instance reuse
26 inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset); 30 inspector.next(revisionNumber, Nodeid.fromBinary(nodeid, 0), cset);
27 } 31 }
28 }; 32 };
29 content.iterate(0, content.revisionCount() - 1, true, i); 33 content.iterate(start, end, true, i);
30 } 34 }
31 35
32 public List<Changeset> range(int start, int end) { 36 public List<Changeset> range(int start, int end) {
33 final ArrayList<Changeset> rv = new ArrayList<Changeset>(end - start + 1); 37 final ArrayList<Changeset> rv = new ArrayList<Changeset>(end - start + 1);
34 Revlog.Inspector i = new Revlog.Inspector() { 38 Revlog.Inspector i = new Revlog.Inspector() {