diff src/org/tmatesoft/hg/repo/HgInternals.java @ 269:7af843ecc378

Respect glob pattern with alternatives {a,b}
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 23 Aug 2011 23:47:38 +0200
parents 6e1373b54e9b
children 7232b94f2ae3
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgInternals.java	Tue Aug 23 22:30:56 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgInternals.java	Tue Aug 23 23:47:38 2011 +0200
@@ -18,7 +18,10 @@
 
 import static org.tmatesoft.hg.repo.HgRepository.*;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -69,6 +72,14 @@
 	public ConfigFile getRepoConfig() {
 		return repo.getConfigFile();
 	}
+	
+	public static HgIgnore newHgIgnore(Reader source) throws IOException {
+		HgIgnore hgIgnore = new HgIgnore();
+		BufferedReader br = source instanceof BufferedReader ? (BufferedReader) source : new BufferedReader(source);
+		hgIgnore.read(br);
+		br.close();
+		return hgIgnore;
+	}
 
 	// in fact, need a setter for this anyway, shall move to internal.Internals perhaps?
 	public String getNextCommitUsername() {