diff src/org/tmatesoft/hg/repo/HgRepository.java @ 91:c2ce1cfaeb9e

ignore file with regex and 'honest' glob support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 27 Jan 2011 06:06:42 +0100
parents c677e1593919
children ee2c750b036d
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Wed Jan 26 06:31:40 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Jan 27 06:06:42 2011 +0100
@@ -71,6 +71,7 @@
 	private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>();
 	
 	private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals();
+	private HgIgnore ignore;
 
 	HgRepository(String repositoryPath) {
 		repoDir = null;
@@ -150,8 +151,18 @@
 	}
 
 	// package-local, see comment for loadDirstate
-	/*package-local*/ final HgIgnore loadIgnore() {
-		return new HgIgnore(this);
+	/*package-local*/ final HgIgnore getIgnore() {
+		// TODO read config for additional locations
+		if (ignore == null) {
+			ignore = new HgIgnore();
+			try {
+				File ignoreFile = new File(repoDir.getParentFile(), ".hgignore");
+				ignore.read(ignoreFile);
+			} catch (IOException ex) {
+				ex.printStackTrace(); // log warn
+			}
+		}
+		return ignore;
 	}
 
 	/*package-local*/ DataAccessProvider getDataAccess() {