comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 157:d5268ca7715b

Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 09 Mar 2011 05:22:17 +0100
parents 37a34044e6bd
children c9b305df0b89
comparison
equal deleted inserted replaced
156:643ddec3be36 157:d5268ca7715b
26 import java.util.List; 26 import java.util.List;
27 import java.util.Map; 27 import java.util.Map;
28 import java.util.TreeMap; 28 import java.util.TreeMap;
29 import java.util.TreeSet; 29 import java.util.TreeSet;
30 30
31 import org.tmatesoft.hg.core.HgDataStreamException;
31 import org.tmatesoft.hg.core.Nodeid; 32 import org.tmatesoft.hg.core.Nodeid;
32 import org.tmatesoft.hg.util.Path; 33 import org.tmatesoft.hg.util.Path;
33 import org.tmatesoft.hg.util.PathPool; 34 import org.tmatesoft.hg.util.PathPool;
34 import org.tmatesoft.hg.util.PathRewrite; 35 import org.tmatesoft.hg.util.PathRewrite;
35 36
162 inspector.clean(pp.path(fname)); 163 inspector.clean(pp.path(fname));
163 } else { 164 } else {
164 inspector.modified(pp.path(fname)); 165 inspector.modified(pp.path(fname));
165 } 166 }
166 } else { 167 } else {
167 Path copyTarget = pp.path(fname); 168 try {
168 Path copyOrigin = getOriginIfCopy(repo, copyTarget, r1Files, rev1); 169 Path copyTarget = pp.path(fname);
169 if (copyOrigin != null) { 170 Path copyOrigin = getOriginIfCopy(repo, copyTarget, r1Files, rev1);
170 inspector.copied(pp.path(copyOrigin) /*pipe through pool, just in case*/, copyTarget); 171 if (copyOrigin != null) {
171 } else { 172 inspector.copied(pp.path(copyOrigin) /*pipe through pool, just in case*/, copyTarget);
172 inspector.added(copyTarget); 173 } else {
174 inspector.added(copyTarget);
175 }
176 } catch (HgDataStreamException ex) {
177 ex.printStackTrace();
178 // FIXME perhaps, shall record this exception to dedicated mediator and continue
179 // for a single file not to be irresolvable obstacle for a status operation
173 } 180 }
174 } 181 }
175 } 182 }
176 for (String left : r1Files) { 183 for (String left : r1Files) {
177 inspector.removed(pp.path(left)); 184 inspector.removed(pp.path(left));
182 Record rv = new Record(); 189 Record rv = new Record();
183 walk(rev1, rev2, rv); 190 walk(rev1, rev2, rv);
184 return rv; 191 return rv;
185 } 192 }
186 193
187 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<String> originals, int originalChangelogRevision) { 194 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<String> originals, int originalChangelogRevision) throws HgDataStreamException {
188 HgDataFile df = hgRepo.getFileNode(fname); 195 HgDataFile df = hgRepo.getFileNode(fname);
189 while (df.isCopy()) { 196 while (df.isCopy()) {
190 Path original = df.getCopySourceName(); 197 Path original = df.getCopySourceName();
191 if (originals.contains(original.toString())) { 198 if (originals.contains(original.toString())) {
192 df = hgRepo.getFileNode(original); 199 df = hgRepo.getFileNode(original);