comparison src/org/tmatesoft/hg/core/HgFileRevision.java @ 367:2fadf8695f8a

Use 'revision index' instead of the vague 'local revision number' concept in the API
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Dec 2011 15:37:27 +0100
parents ac8e1ce67730
children 0ae53c32ecef
comparison
equal deleted inserted replaced
366:189dc6dc1c3e 367:2fadf8695f8a
86 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values. 86 * @return parent revisions of this file revision, with {@link Nodeid#NULL} for missing values.
87 */ 87 */
88 public Pair<Nodeid, Nodeid> getParents() throws HgInvalidControlFileException { 88 public Pair<Nodeid, Nodeid> getParents() throws HgInvalidControlFileException {
89 if (parents == null) { 89 if (parents == null) {
90 HgDataFile fn = repo.getFileNode(path); 90 HgDataFile fn = repo.getFileNode(path);
91 int localRevision = fn.getLocalRevision(revision); 91 int revisionIndex = fn.getRevisionIndex(revision);
92 int[] pr = new int[2]; 92 int[] pr = new int[2];
93 byte[] p1 = new byte[20], p2 = new byte[20]; 93 byte[] p1 = new byte[20], p2 = new byte[20];
94 // XXX Revlog#parents is not the best method to use here 94 // XXX Revlog#parents is not the best method to use here
95 // need smth that gives Nodeids (piped through Pool<Nodeid> from repo's context) 95 // need smth that gives Nodeids (piped through Pool<Nodeid> from repo's context)
96 fn.parents(localRevision, pr, p1, p2); 96 fn.parents(revisionIndex, pr, p1, p2);
97 parents = new Pair<Nodeid, Nodeid>(Nodeid.fromBinary(p1, 0), Nodeid.fromBinary(p2, 0)); 97 parents = new Pair<Nodeid, Nodeid>(Nodeid.fromBinary(p1, 0), Nodeid.fromBinary(p2, 0));
98 } 98 }
99 return parents; 99 return parents;
100 } 100 }
101 101
102 public void putContentTo(ByteChannel sink) throws HgDataStreamException, HgInvalidControlFileException, CancelledException { 102 public void putContentTo(ByteChannel sink) throws HgDataStreamException, HgInvalidControlFileException, CancelledException {
103 HgDataFile fn = repo.getFileNode(path); 103 HgDataFile fn = repo.getFileNode(path);
104 int localRevision = fn.getLocalRevision(revision); 104 int revisionIndex = fn.getRevisionIndex(revision);
105 fn.contentWithFilters(localRevision, sink); 105 fn.contentWithFilters(revisionIndex, sink);
106 } 106 }
107 107
108 private void checkCopy() throws HgInvalidControlFileException, HgDataStreamException { 108 private void checkCopy() throws HgInvalidControlFileException, HgDataStreamException {
109 HgDataFile fn = repo.getFileNode(path); 109 HgDataFile fn = repo.getFileNode(path);
110 if (fn.isCopy()) { 110 if (fn.isCopy()) {