HgDataFile dfD = hgRepo.getFileNode("d");
assertTrue("[sanity]", dfD.exists());
File fileD = new File(repoLoc, "d");
assertTrue("[sanity]", fileD.canRead());
final int parentCsetRevIndex = hgRepo.getChangelog().getLastRevision();
HgChangeset parentCset = new HgLogCommand(hgRepo).range(parentCsetRevIndex, parentCsetRevIndex).execute().get(0);
assertEquals("[sanity]", DEFAULT_BRANCH_NAME, parentCset.getBranch());
assertEquals("[sanity]", DEFAULT_BRANCH_NAME, hgRepo.getWorkingCopyBranchName());
//
RepoUtils.modifyFileAppend(fileD, "A CHANGE\n");
CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), parentCsetRevIndex);
FileContentSupplier contentProvider = new FileContentSupplier(hgRepo, fileD);
cf.add(dfD, contentProvider);
cf.branch("branch1");
Transaction tr = newTransaction(hgRepo);
Nodeid commitRev1 = cf.commit("FIRST", tr);
tr.commit();
//
List<HgChangeset> commits = new HgLogCommand(hgRepo).range(parentCsetRevIndex+1, TIP).execute();
assertEquals(1, commits.size());
HgChangeset c1 = commits.get(0);
errorCollector.assertEquals(c1.getNodeid(), commitRev1);
errorCollector.assertEquals("branch1", c1.getBranch());
errorCollector.assertEquals("FIRST", c1.getComment());
//
// check if cached value in hgRepo got updated
errorCollector.assertEquals("branch1", hgRepo.getWorkingCopyBranchName());
//
RepoUtils.assertHgVerifyOk(errorCollector, repoLoc);