Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgDataFile.java @ 77:c677e1593919
Moved RevlogStream implementation into .internal
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 24 Jan 2011 05:33:47 +0100 |
parents | 6f1b88693d48 |
children | c25c5c348d1b |
comparison
equal
deleted
inserted
replaced
76:658fa6b3a371 | 77:c677e1593919 |
---|---|
18 | 18 |
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 19 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 | 20 |
21 import org.tmatesoft.hg.core.Nodeid; | 21 import org.tmatesoft.hg.core.Nodeid; |
22 import org.tmatesoft.hg.core.Path; | 22 import org.tmatesoft.hg.core.Path; |
23 import org.tmatesoft.hg.internal.RevlogStream; | |
23 | 24 |
24 | 25 |
25 | 26 |
26 /** | 27 /** |
27 * ? name:HgFileNode? | 28 * ? name:HgFileNode? |
43 | 44 |
44 public boolean exists() { | 45 public boolean exists() { |
45 return content != null; // XXX need better impl | 46 return content != null; // XXX need better impl |
46 } | 47 } |
47 | 48 |
49 // human-readable (i.e. "COPYING", not "store/data/_c_o_p_y_i_n_g.i") | |
48 public Path getPath() { | 50 public Path getPath() { |
49 return path; // hgRepo.backresolve(this) -> name? | 51 return path; // hgRepo.backresolve(this) -> name? |
50 } | 52 } |
51 | 53 |
52 public int length(Nodeid nodeid) { | 54 public int length(Nodeid nodeid) { |
63 | 65 |
64 public void history(int start, int end, Changeset.Inspector inspector) { | 66 public void history(int start, int end, Changeset.Inspector inspector) { |
65 if (!exists()) { | 67 if (!exists()) { |
66 throw new IllegalStateException("Can't get history of invalid repository file node"); | 68 throw new IllegalStateException("Can't get history of invalid repository file node"); |
67 } | 69 } |
70 final int last = content.revisionCount() - 1; | |
71 if (start < 0 || start > last) { | |
72 throw new IllegalArgumentException(); | |
73 } | |
74 if (end == TIP) { | |
75 end = last; | |
76 } else if (end < start || end > last) { | |
77 throw new IllegalArgumentException(); | |
78 } | |
68 final int[] commitRevisions = new int[end - start + 1]; | 79 final int[] commitRevisions = new int[end - start + 1]; |
69 Revlog.Inspector insp = new Revlog.Inspector() { | 80 RevlogStream.Inspector insp = new RevlogStream.Inspector() { |
70 int count = 0; | 81 int count = 0; |
71 | 82 |
72 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | 83 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { |
73 commitRevisions[count++] = linkRevision; | 84 commitRevisions[count++] = linkRevision; |
74 } | 85 } |