// make sure pushed repository got same draft root
final Nodeid r4PublicHead = srcRepo.getChangelog().getRevision(r4);
final Nodeid r5DraftRoot = srcRepo.getChangelog().getRevision(r5);
HgRepository dstRepo = hgLookup.detect(dstRepoLoc);
final HgChangelog dstClog = dstRepo.getChangelog();
PhasesHelper dstPhase = new PhasesHelper(HgInternals.getImplementationRepo(dstRepo));
assertEquals(HgPhase.Public, dstPhase.getPhase(dstClog.getRevisionIndex(r4PublicHead), r4PublicHead));
assertEquals(HgPhase.Draft, dstPhase.getPhase(dstClog.getRevisionIndex(r5DraftRoot), r5DraftRoot));
//
// now, graduate some local revisions, r5:draft->public, r6:secret->public, r9: secret->draft
final ExecHelper srcRun = new ExecHelper(new OutputParser.Stub(), srcRepoLoc);
srcRun.exec("hg", "phase", "--public", String.valueOf(r5));
srcRun.exec("hg", "phase", "--public", String.valueOf(r6));
srcRun.exec("hg", "phase", "--draft", String.valueOf(r9));
// PhaseHelper shall be new for the command, and would pick up these external changes
new HgPushCommand(srcRepo).destination(dstRemote).execute();
final Nodeid r6Nodeid = srcRepo.getChangelog().getRevision(r6);
final Nodeid r9Nodeid = srcRepo.getChangelog().getRevision(r9);
// refresh
dstPhase = new PhasesHelper(HgInternals.getImplementationRepo(dstRepo));
// not errorCollector as subsequent code would fail if these secret revs didn't get into dst
assertTrue(dstClog.isKnown(r6Nodeid));
assertTrue(dstClog.isKnown(r9Nodeid));
errorCollector.assertEquals(HgPhase.Public, dstPhase.getPhase(dstClog.getRevisionIndex(r5DraftRoot), r5DraftRoot));
errorCollector.assertEquals(HgPhase.Public, dstPhase.getPhase(dstClog.getRevisionIndex(r6Nodeid), r6Nodeid));
errorCollector.assertEquals(HgPhase.Draft, dstPhase.getPhase(dstClog.getRevisionIndex(r9Nodeid), r9Nodeid));
} finally {
server.stop();
}
}