comparison src/org/tmatesoft/hg/internal/DirstateReader.java @ 606:5daa42067e7c

Avoid mmap files when only few bytes are to be read
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 07 May 2013 14:16:35 +0200
parents 243202f1bda5
children 5c68567b3645
comparison
equal deleted inserted replaced
605:c56edf42be64 606:5daa42067e7c
64 parents = new Pair<Nodeid,Nodeid>(Nodeid.NULL, Nodeid.NULL); 64 parents = new Pair<Nodeid,Nodeid>(Nodeid.NULL, Nodeid.NULL);
65 File dirstateFile = getDirstateFile(repo); 65 File dirstateFile = getDirstateFile(repo);
66 if (dirstateFile == null || !dirstateFile.exists()) { 66 if (dirstateFile == null || !dirstateFile.exists()) {
67 return; 67 return;
68 } 68 }
69 DataAccess da = repo.getDataAccess().createReader(dirstateFile); 69 DataAccess da = repo.getDataAccess().createReader(dirstateFile, false);
70 try { 70 try {
71 if (da.isEmpty()) { 71 if (da.isEmpty()) {
72 return; 72 return;
73 } 73 }
74 parents = internalReadParents(da); 74 parents = internalReadParents(da);
140 // do not read whole dirstate if all we need is WC parent information 140 // do not read whole dirstate if all we need is WC parent information
141 File dirstateFile = getDirstateFile(internalRepo); 141 File dirstateFile = getDirstateFile(internalRepo);
142 if (dirstateFile == null || !dirstateFile.exists()) { 142 if (dirstateFile == null || !dirstateFile.exists()) {
143 return new Pair<Nodeid,Nodeid>(NULL, NULL); 143 return new Pair<Nodeid,Nodeid>(NULL, NULL);
144 } 144 }
145 DataAccess da = internalRepo.getDataAccess().createReader(dirstateFile); 145 DataAccess da = internalRepo.getDataAccess().createReader(dirstateFile, false);
146 try { 146 try {
147 if (da.isEmpty()) { 147 if (da.isEmpty()) {
148 return new Pair<Nodeid,Nodeid>(NULL, NULL); 148 return new Pair<Nodeid,Nodeid>(NULL, NULL);
149 } 149 }
150 return internalReadParents(da); 150 return internalReadParents(da);