Mercurial > jhg
diff src/org/tmatesoft/hg/repo/HgInternals.java @ 296:02f2963c70fa
Issue 13: Tests for mixed-cased filenames in case-insensitive FS
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Sep 2011 21:00:29 +0200 |
parents | 981f9f50bb6c |
children | 650b45d290b1 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgInternals.java Fri Sep 16 05:35:32 2011 +0200 +++ b/src/org/tmatesoft/hg/repo/HgInternals.java Fri Sep 16 21:00:29 2011 +0200 @@ -55,7 +55,33 @@ } public void dumpDirstate() { - repo.loadDirstate(new PathPool(new PathRewrite.Empty())).dump(); + getDirstate().dump(); + } + + public HgDirstate getDirstate() { + return repo.loadDirstate(new PathPool(new PathRewrite.Empty())); + } + + // tests + public HgDirstate createDirstate(boolean caseSensitiveFileSystem) { + PathRewrite canonicalPath = null; + if (!caseSensitiveFileSystem) { + canonicalPath = new PathRewrite() { + + public CharSequence rewrite(CharSequence path) { + return path.toString().toLowerCase(); + } + }; + } + return new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath); + } + + public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) { + Path[] rv = new Path[toCheck.length]; + for (int i = 0; i < toCheck.length; i++) { + rv[i] = dirstate.known(toCheck[i]); + } + return rv; } public boolean[] checkIgnored(String... toCheck) {