Mercurial > hg4j
diff src/org/tmatesoft/hg/repo/HgInternals.java @ 229:1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 31 May 2011 05:23:07 +0200 |
parents | 1a7a9a20e1f9 |
children | 6e1373b54e9b |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgInternals.java Fri May 27 03:01:26 2011 +0200 +++ b/src/org/tmatesoft/hg/repo/HgInternals.java Tue May 31 05:23:07 2011 +0200 @@ -23,18 +23,24 @@ import java.net.UnknownHostException; import org.tmatesoft.hg.internal.ConfigFile; +import org.tmatesoft.hg.internal.Experimental; +import org.tmatesoft.hg.internal.RelativePathRewrite; +import org.tmatesoft.hg.util.FileIterator; +import org.tmatesoft.hg.util.FileWalker; import org.tmatesoft.hg.util.Path; +import org.tmatesoft.hg.util.PathRewrite; /** * DO NOT USE THIS CLASS, INTENDED FOR TESTING PURPOSES. * + * This class gives access to repository internals, and holds methods that I'm not confident have to be widely accessible * Debug helper, to access otherwise restricted (package-local) methods * * @author Artem Tikhomirov * @author TMate Software Ltd. - */ +@Experimental(reason="Perhaps, shall split methods with debug purpose from methods that are experimental API") public class HgInternals { private final HgRepository repo; @@ -86,6 +92,17 @@ return username; } } + + @Experimental(reason="Don't want to expose io.File from HgRepository; need to create FileIterator for working dir. Need a place to keep that code") + /*package-local*/ FileIterator createWorkingDirWalker(Path.Matcher workindDirScope) { + File repoRoot = repo.getRepositoryRoot().getParentFile(); + Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), repo.getToRepoPathHelper())); + // 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, workindDirScope); + } + // Convenient check of local revision number for validity (not all negative values are wrong as long as we use negative constants) public static boolean wrongLocalRevision(int rev) {