comparison src/org/tmatesoft/hg/repo/HgDataFile.java @ 420:6c22bdc0bdfd

Respect long offsets in revlogs
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 22:56:01 +0100
parents ccd7d25e5aea
children 9c9c442b5f2e
comparison
equal deleted inserted replaced
419:7f136a3fa671 420:6c22bdc0bdfd
39 import org.tmatesoft.hg.core.Nodeid; 39 import org.tmatesoft.hg.core.Nodeid;
40 import org.tmatesoft.hg.internal.DataAccess; 40 import org.tmatesoft.hg.internal.DataAccess;
41 import org.tmatesoft.hg.internal.FilterByteChannel; 41 import org.tmatesoft.hg.internal.FilterByteChannel;
42 import org.tmatesoft.hg.internal.FilterDataAccess; 42 import org.tmatesoft.hg.internal.FilterDataAccess;
43 import org.tmatesoft.hg.internal.IntMap; 43 import org.tmatesoft.hg.internal.IntMap;
44 import org.tmatesoft.hg.internal.Internals;
44 import org.tmatesoft.hg.internal.RevlogStream; 45 import org.tmatesoft.hg.internal.RevlogStream;
45 import org.tmatesoft.hg.util.ByteChannel; 46 import org.tmatesoft.hg.util.ByteChannel;
46 import org.tmatesoft.hg.util.CancelSupport; 47 import org.tmatesoft.hg.util.CancelSupport;
47 import org.tmatesoft.hg.util.CancelledException; 48 import org.tmatesoft.hg.util.CancelledException;
48 import org.tmatesoft.hg.util.LogFacility; 49 import org.tmatesoft.hg.util.LogFacility;
127 if (fileRevisionIndex == TIP) { 128 if (fileRevisionIndex == TIP) {
128 fileRevisionIndex = getLastRevision(); 129 fileRevisionIndex = getLastRevision();
129 } else if (fileRevisionIndex == WORKING_COPY) { 130 } else if (fileRevisionIndex == WORKING_COPY) {
130 File f = getRepo().getFile(this); 131 File f = getRepo().getFile(this);
131 if (f.exists()) { 132 if (f.exists()) {
132 return (int) /*FIXME long!*/ f.length(); 133 // single revision can't be greater than 2^32, shall be safe to cast to int
134 return Internals.ltoi(f.length());
133 } 135 }
134 Nodeid fileRev = getWorkingCopyRevision(); 136 Nodeid fileRev = getWorkingCopyRevision();
135 if (fileRev == null) { 137 if (fileRev == null) {
136 throw new HgInvalidRevisionException(String.format("File %s is not part of working copy", getPath()), null, fileRevisionIndex); 138 throw new HgInvalidRevisionException(String.format("File %s is not part of working copy", getPath()), null, fileRevisionIndex);
137 } 139 }