diff src/org/tmatesoft/hg/repo/HgRepository.java @ 335:3d41dc148d14

Do not fail with exception on syntax errors in .hgignore
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 10 Nov 2011 05:44:12 +0100
parents a37ce7145c3f
children f377f833b780
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Wed Nov 09 05:22:26 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Nov 10 05:44:12 2011 +0100
@@ -323,15 +323,20 @@
 	 * Access to configured set of ignored files.
 	 * @see HgIgnore#isIgnored(Path)
 	 */
-	public HgIgnore getIgnore() {
+	public HgIgnore getIgnore() /*throws HgInvalidControlFileException */{
 		// TODO read config for additional locations
 		if (ignore == null) {
 			ignore = new HgIgnore();
+			File ignoreFile = new File(getWorkingDir(), ".hgignore");
 			try {
-				File ignoreFile = new File(getWorkingDir(), ".hgignore");
-				ignore.read(ignoreFile);
+				final List<String> errors = ignore.read(ignoreFile);
+				if (errors != null) {
+					getContext().getLog().warn(getClass(), "Syntax errors parsing .hgignore:\n%s", errors);
+				}
 			} catch (IOException ex) {
-				getContext().getLog().warn(getClass(), ex, null);
+				final String m = "Error reading .hgignore file";
+				getContext().getLog().warn(getClass(), ex, m);
+//				throw new HgInvalidControlFileException(m, ex, ignoreFile);
 			}
 		}
 		return ignore;