File testRepoLoc = cloneRepoToTempLocation("log-1", "test-checkout-clean", true);
repo = new HgLookup().detect(testRepoLoc);
// nothing but .hg dir
assertEquals("[sanity]", 0, testRepoLoc.listFiles(new FilesOnlyFilter()).length);
new HgCheckoutCommand(repo).clean(true).changeset(1).execute();
errorCollector.assertEquals(2, testRepoLoc.listFiles(new FilesOnlyFilter()).length);
Pair<Nodeid, Nodeid> workingCopyParents = repo.getWorkingCopyParents();
errorCollector.assertEquals("da3461cd828dae8eb5fd11189d40e9df1961f191", workingCopyParents.first().toString());
errorCollector.assertEquals(Nodeid.NULL, workingCopyParents.second());
errorCollector.assertEquals(HgRepository.DEFAULT_BRANCH_NAME, repo.getWorkingCopyBranchName());
StatusOutputParser statusOutputParser = new StatusOutputParser();
eh = new ExecHelper(statusOutputParser, testRepoLoc);
eh.run("hg", "status", "-A");
errorCollector.assertEquals(2, statusOutputParser.getClean().size());
errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("a")));
errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("b")));
new HgCheckoutCommand(repo).clean(true).changeset(3).execute();
statusOutputParser.reset();
eh.run("hg", "status", "-A");
errorCollector.assertEquals(3, statusOutputParser.getClean().size());
errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("b")));
errorCollector.assertTrue(statusOutputParser.getClean().contains(Path.create("d")));