Mercurial > jhg
comparison src/com/tmate/hgkit/ll/Changelog.java @ 2:08db726a0fb7
Shaping out low-level Hg structures
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sun, 19 Dec 2010 05:41:31 +0100 |
| parents | dbd663faec1f |
| children | 24bb4f365164 |
comparison
equal
deleted
inserted
replaced
| 1:a3576694a4d1 | 2:08db726a0fb7 |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright (c) 2010 Artem Tikhomirov | 2 * Copyright (c) 2010 Artem Tikhomirov |
| 3 */ | 3 */ |
| 4 package com.tmate.hgkit.ll; | 4 package com.tmate.hgkit.ll; |
| 5 | 5 |
| 6 import java.io.DataInput; | |
| 7 import java.io.EOFException; | |
| 8 import java.io.IOException; | |
| 9 import java.util.ArrayList; | |
| 10 import java.util.Collections; | |
| 11 import java.util.List; | |
| 12 | |
| 6 /** | 13 /** |
| 7 * Representation of the Mercurial changelog file (list of ChangeSets) | 14 * Representation of the Mercurial changelog file (list of ChangeSets) |
| 8 * @author artem | 15 * @author artem |
| 9 */ | 16 */ |
| 10 public class Changelog { | 17 public class Changelog extends Revlog { |
| 11 | 18 |
| 19 private RevlogStream content; | |
| 20 | |
| 21 /*package-local*/ Changelog(HgRepository hgRepo) { | |
| 22 super(hgRepo); | |
| 23 content = hgRepo.resolve(".hg/store/00changelog.i"); | |
| 24 } | |
| 25 | |
| 26 public List<Changeset> all() { | |
| 27 throw HgRepository.notImplemented(); | |
| 28 } | |
| 29 | |
| 30 public void all(Changeset.Callback callback) { | |
| 31 throw HgRepository.notImplemented(); | |
| 32 } | |
| 33 | |
| 34 public List<Changeset> range(int start, int end) { | |
| 35 //read from outline[start].start .. (outline[end].start + outline[end].length) | |
| 36 // parse changesets | |
| 37 final ArrayList<Changeset> rv = new ArrayList<Changeset>(end - start + 1); | |
| 38 Revlog.Inspector i = new Revlog.Inspector() { | |
| 39 | |
| 40 public void next(int compressedLen, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | |
| 41 // TODO Auto-generated method stub | |
| 42 Changeset.parse(data); | |
| 43 i.add(); | |
| 44 throw HgRepository.notImplemented(); | |
| 45 } | |
| 46 }; | |
| 47 content.iterate(start, end, true, i); | |
| 48 return rv; | |
| 49 } | |
| 12 } | 50 } |
