diff src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 320:678e326fd27c

Issue 15: Exception accessing oddly named file from history
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 30 Sep 2011 06:22:11 +0200
parents ee6b467c1a5f
children 5f9073eabf06
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Thu Sep 29 04:37:52 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Fri Sep 30 06:22:11 2011 +0200
@@ -290,6 +290,10 @@
 	
 	/*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<Path> originals, int originalChangelogRevision) throws HgDataStreamException {
 		HgDataFile df = hgRepo.getFileNode(fname);
+		if (!df.exists()) {
+			String msg = String.format("Didn't find file '%s' in the repo. Perhaps, bad storage name conversion?", fname);
+			throw new HgDataStreamException(fname, msg, null).setRevisionNumber(originalChangelogRevision);
+		}
 		while (df.isCopy()) {
 			Path original = df.getCopySourceName();
 			if (originals.contains(original)) {