@Test
public void testFlagsInWorkingCopy() throws Exception {
File repoRoot = repo.getWorkingDir();
Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), repo.getToRepoPathHelper()));
FileWalker fw = new FileWalker(repo, repoRoot, pathSrc, null);
if (Internals.runningOnWindows()) {
System.out.println("Executing tests on Windows, no actual file flags in working area are checked");
assertFalse(fw.supportsExecFlag());
assertFalse(fw.supportsLinkFlag());
return;
} else {
assertTrue(fw.supportsExecFlag());
assertTrue(fw.supportsLinkFlag());
}
ExecHelper eh = new ExecHelper(new OutputParser.Stub(false), repo.getWorkingDir());
eh.run("hg", "checkout", "-C");
boolean exec, link, file;
exec = link = file = false;
while (fw.hasNext()) {
fw.next();
FileInfo fi = fw.file();
String fn = fw.name().toString();
if (fn.equals("file-link")) {
link = true;
errorCollector.assertTrue("Symlink shall exist despite the fact it points to nowhere", fi.exists());
errorCollector.assertFalse(fi.isExecutable());
errorCollector.assertTrue(fi.isSymlink());