private @Nullable HgRevisionNumber findCommonParent(HgRevisionNumber newHead, HgRevisionNumber parentBeforeUpdate) {
    // hg log -r 0:source --prune dest --limit 1
    final List<HgRevisionNumber> pulledRevisions = new HgMergePreviewCommand(project, newHead, parentBeforeUpdate, 1).executeInCurrentThread(repoRoot);
    if (pulledRevisions == null || pulledRevisions.isEmpty()) {
      return null;
    }
    HgRevisionNumber pulledRevision = pulledRevisions.get(0);
    final List<HgRevisionNumber> parentRevisions = new HgWorkingCopyRevisionsCommand(project).getRevisions(repoRoot, "parent", null, pulledRevision, true);
    if (parentRevisions.isEmpty()) {
      return null;
    }
    return parentRevisions.get(0);
  }
private @Nullable HgRevisionNumber findCommonParent(HgRevisionNumber newHead, HgRevisionNumber parentBeforeUpdate)