diff src/org/tmatesoft/hg/repo/HgRepository.java @ 141:8248aae33f7d

Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 17 Feb 2011 04:08:34 +0100
parents 4a948ec83980
children 37a34044e6bd
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Wed Feb 16 22:33:04 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Feb 17 04:08:34 2011 +0100
@@ -27,8 +27,10 @@
 import org.tmatesoft.hg.internal.ConfigFile;
 import org.tmatesoft.hg.internal.DataAccessProvider;
 import org.tmatesoft.hg.internal.Filter;
+import org.tmatesoft.hg.internal.RelativePathRewrite;
 import org.tmatesoft.hg.internal.RequiresFile;
 import org.tmatesoft.hg.internal.RevlogStream;
+import org.tmatesoft.hg.util.FileIterator;
 import org.tmatesoft.hg.util.FileWalker;
 import org.tmatesoft.hg.util.Path;
 import org.tmatesoft.hg.util.PathRewrite;
@@ -190,8 +192,13 @@
 	}
 
 	// FIXME not sure repository shall create walkers
-	/*package-local*/ FileWalker createWorkingDirWalker() {
-		return new FileWalker(repoDir.getParentFile());
+	/*package-local*/ FileIterator createWorkingDirWalker() {
+		File repoRoot = repoDir.getParentFile();
+		Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), getPathHelper()));
+		// Impl note: simple source is enough as files in the working dir are all unique
+		// even if they might get reused (i.e. after FileIterator#reset() and walking once again),
+		// path caching is better to be done in the code which knows that path are being reused 
+		return new FileWalker(repoRoot, pathSrc);
 	}
 
 	/**