final HgChangelog clog = repo.getChangelog();
byte[] parent1 = new byte[Nodeid.SIZE], parent2 = new byte[Nodeid.SIZE];
int[] parentRevs = new int[2];
for (Nodeid n : elements) {
assert clog.isKnown(n);
clog.parents(clog.getRevisionIndex(n), parentRevs, parent1, parent2);
if (parentRevs[0] != NO_REVISION && elements.contains(new Nodeid(parent1, false))) {
copy.remove(n);
continue;
}
if (parentRevs[1] != NO_REVISION && elements.contains(new Nodeid(parent2, false))) {