srcRun.exec("hg", "bookmark", "-r", String.valueOf(bm_4_5), bm5);
//
HgServer server = new HgServer().start(dstRepoLoc);
try {
final HgLookup hgLookup = new HgLookup();
final HgRepository srcRepo = hgLookup.detect(srcRepoLoc);
final HgRemoteRepository dstRemote = hgLookup.detect(server.getURL());
RepoUtils.modifyFileAppend(f1, "change1");
final HgCommitCommand commitCmd = new HgCommitCommand(srcRepo).message("Commit 1");
assertTrue(commitCmd.execute().isOk());
assertEquals(bm1, srcRepo.getBookmarks().getActiveBookmarkName());
assertEquals(commitCmd.getCommittedRevision(), srcRepo.getBookmarks().getRevision(bm1));
//
new HgPushCommand(srcRepo).destination(dstRemote).execute();
Thread.sleep(300); // let the server perform the update
//
HgBookmarks srcBookmarks = srcRepo.getBookmarks();
final HgChangelog srcClog = srcRepo.getChangelog();
// first, check local bookmarks are intact
errorCollector.assertEquals(srcClog.getRevision(bm2Local), srcBookmarks.getRevision(bm2));
errorCollector.assertEquals(srcClog.getRevision(bm3Local), srcBookmarks.getRevision(bm3));
errorCollector.assertEquals(null, srcBookmarks.getRevision(bm4));
errorCollector.assertEquals(srcClog.getRevision(bm_4_5), srcBookmarks.getRevision(bm5));
// now, check remote bookmarks were touched
HgRepository dstRepo = hgLookup.detect(dstRepoLoc);
HgBookmarks dstBookmarks = dstRepo.getBookmarks();
final HgChangelog dstClog = dstRepo.getChangelog();
// bm1 changed and points to newly pushed commit.
// if the test fails (bm1 points to r8), chances are server didn't manage to update
// bookmarks yet (there's Thread.sleep() above to give it a chance).
errorCollector.assertEquals(commitCmd.getCommittedRevision(), dstBookmarks.getRevision(bm1));
// bm2 didn't change