comparison 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
comparison
equal deleted inserted replaced
295:981f9f50bb6c 296:02f2963c70fa
53 public HgInternals(HgRepository hgRepo) { 53 public HgInternals(HgRepository hgRepo) {
54 repo = hgRepo; 54 repo = hgRepo;
55 } 55 }
56 56
57 public void dumpDirstate() { 57 public void dumpDirstate() {
58 repo.loadDirstate(new PathPool(new PathRewrite.Empty())).dump(); 58 getDirstate().dump();
59 }
60
61 public HgDirstate getDirstate() {
62 return repo.loadDirstate(new PathPool(new PathRewrite.Empty()));
63 }
64
65 // tests
66 public HgDirstate createDirstate(boolean caseSensitiveFileSystem) {
67 PathRewrite canonicalPath = null;
68 if (!caseSensitiveFileSystem) {
69 canonicalPath = new PathRewrite() {
70
71 public CharSequence rewrite(CharSequence path) {
72 return path.toString().toLowerCase();
73 }
74 };
75 }
76 return new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath);
77 }
78
79 public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) {
80 Path[] rv = new Path[toCheck.length];
81 for (int i = 0; i < toCheck.length; i++) {
82 rv[i] = dirstate.known(toCheck[i]);
83 }
84 return rv;
59 } 85 }
60 86
61 public boolean[] checkIgnored(String... toCheck) { 87 public boolean[] checkIgnored(String... toCheck) {
62 HgIgnore ignore = repo.getIgnore(); 88 HgIgnore ignore = repo.getIgnore();
63 boolean[] rv = new boolean[toCheck.length]; 89 boolean[] rv = new boolean[toCheck.length];