comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 396:0ae53c32ecef

Straighten out exceptions thrown when file access failed - three is too much
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 23 Feb 2012 01:06:24 +0100
parents 2fadf8695f8a
children 2747b0723867
comparison
equal deleted inserted replaced
395:4732fffff58a 396:0ae53c32ecef
1 /* 1 /*
2 * Copyright (c) 2011 TMate Software Ltd 2 * Copyright (c) 2011-2012 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
26 import java.util.List; 26 import java.util.List;
27 import java.util.Map; 27 import java.util.Map;
28 import java.util.TreeSet; 28 import java.util.TreeSet;
29 29
30 import org.tmatesoft.hg.core.HgBadStateException; 30 import org.tmatesoft.hg.core.HgBadStateException;
31 import org.tmatesoft.hg.core.HgDataStreamException;
32 import org.tmatesoft.hg.core.HgException; 31 import org.tmatesoft.hg.core.HgException;
33 import org.tmatesoft.hg.core.HgInvalidControlFileException; 32 import org.tmatesoft.hg.core.HgInvalidControlFileException;
34 import org.tmatesoft.hg.core.Nodeid; 33 import org.tmatesoft.hg.core.Nodeid;
35 import org.tmatesoft.hg.internal.IntMap; 34 import org.tmatesoft.hg.internal.IntMap;
36 import org.tmatesoft.hg.internal.ManifestRevision; 35 import org.tmatesoft.hg.internal.ManifestRevision;
288 Record rv = new Record(); 287 Record rv = new Record();
289 walk(rev1, rev2, rv); 288 walk(rev1, rev2, rv);
290 return rv; 289 return rv;
291 } 290 }
292 291
293 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<Path> originals, int originalChangelogRevision) throws HgDataStreamException, HgInvalidControlFileException { 292 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<Path> originals, int originalChangelogRevision) throws HgException {
294 HgDataFile df = hgRepo.getFileNode(fname); 293 HgDataFile df = hgRepo.getFileNode(fname);
295 if (!df.exists()) { 294 if (!df.exists()) {
296 String msg = String.format("Didn't find file '%s' in the repo. Perhaps, bad storage name conversion?", fname); 295 String msg = String.format("Didn't find file '%s' in the repo. Perhaps, bad storage name conversion?", fname);
297 throw new HgDataStreamException(fname, msg, null).setRevisionIndex(originalChangelogRevision); 296 throw new HgException(msg).setFileName(fname).setRevisionIndex(originalChangelogRevision);
298 } 297 }
299 while (df.isCopy()) { 298 while (df.isCopy()) {
300 Path original = df.getCopySourceName(); 299 Path original = df.getCopySourceName();
301 if (originals.contains(original)) { 300 if (originals.contains(original)) {
302 df = hgRepo.getFileNode(original); 301 df = hgRepo.getFileNode(original);