# HG changeset patch
# User Artem Tikhomirov <tikhomirov.artem@gmail.com>
# Date 1296783872 -3600
# Node ID 68ba22a2133a2a7252e93a46506ad4f0e0f93f54
# Parent  6c0be854d14999ac58fd2a146fb243bb10049f82
Defects in the filter initialization

diff -r 6c0be854d149 -r 68ba22a2133a src/org/tmatesoft/hg/internal/KeywordFilter.java
--- a/src/org/tmatesoft/hg/internal/KeywordFilter.java	Fri Feb 04 02:12:30 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/KeywordFilter.java	Fri Feb 04 02:44:32 2011 +0100
@@ -289,7 +289,7 @@
 
 		public Filter create(Path path, Options opts) {
 			if (matcher.accept(path)) {
-				return new KeywordFilter(repo, path, true);
+				return new KeywordFilter(repo, path, opts.getDirection() == Filter.Direction.FromRepo);
 			}
 			return null;
 		}
diff -r 6c0be854d149 -r 68ba22a2133a src/org/tmatesoft/hg/internal/NewlineFilter.java
--- a/src/org/tmatesoft/hg/internal/NewlineFilter.java	Fri Feb 04 02:12:30 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/NewlineFilter.java	Fri Feb 04 02:44:32 2011 +0100
@@ -167,7 +167,7 @@
 
 		public void initialize(HgRepository hgRepo, ConfigFile cfg) {
 			failIfInconsistent = cfg.getBoolean("eol", "only-consistent", true);
-			File cfgFile = new File(new HgInternals(hgRepo).getRepositoryDir(), ".hgeol");
+			File cfgFile = new File(new HgInternals(hgRepo).getRepositoryDir().getParentFile(), ".hgeol");
 			if (!cfgFile.canRead()) {
 				return;
 			}
diff -r 6c0be854d149 -r 68ba22a2133a src/org/tmatesoft/hg/internal/PathGlobMatcher.java
--- a/src/org/tmatesoft/hg/internal/PathGlobMatcher.java	Fri Feb 04 02:12:30 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/PathGlobMatcher.java	Fri Feb 04 02:44:32 2011 +0100
@@ -58,12 +58,16 @@
 		boolean needLineEndMatch = glob.charAt(end) != '*';
 		while (end > 0 && glob.charAt(end) == '*') end--; // remove trailing * that are useless for Pattern.find()
 		StringBuilder sb = new StringBuilder(end*2);
+		if (glob.charAt(0) != '*') {
+			sb.append('^');
+		}
 		for (int i = 0; i <= end; i++) {
 			char ch = glob.charAt(i);
 			if (ch == '*') {
 				if (glob.charAt(i+1) == '*') { // i < end because we've stripped any trailing * earlier
 					// any char, including path segment separator
 					sb.append(".*?");
+					i++;
 				} else {
 					// just path segments
 					sb.append("[^/]*?");