RevisionSet secret = phaseHelper.allSecret();
outgoing = new RevisionSet(l).subtract(secret);
} else {
outgoing = new RevisionSet(l);
}
HgBundle b = null;
if (!outgoing.isEmpty()) {
//
// prepare bundle
BundleGenerator bg = new BundleGenerator(implRepo);
File bundleFile = bg.create(outgoing.asList());
progress.worked(20);
b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
//
// send changes
remoteRepo.unbundle(b, comparator.getRemoteHeads());
} // update phase information nevertheless
progress.worked(20);
//
// update phase information
if (phaseHelper.isCapableOfPhases()) {
HgRemoteRepository.Phases remotePhases = remoteRepo.getPhases();
RevisionSet remoteDraftsLocalPublic = phaseHelper.synchronizeWithRemote(remotePhases, outgoing);
if (!remoteDraftsLocalPublic.isEmpty()) {
// foreach remoteDraftsLocallyPublic.heads() do push Draft->Public
for (Nodeid n : remoteDraftsLocalPublic.heads(parentHelper)) {
try {
Outcome upo = remoteRepo.updatePhase(HgPhase.Draft, HgPhase.Public, n);
if (!upo.isOk()) {
implRepo.getLog().dump(getClass(), Severity.Info, "Failed to update remote phase, reason: %s", upo.getMessage());
}
} catch (HgRemoteConnectionException ex) {
implRepo.getLog().dump(getClass(), Severity.Error, ex, String.format("Failed to update phase of %s", n.shortNotation()));
}
}
}
}
progress.worked(5);
//
// update bookmark information
HgBookmarks localBookmarks = repo.getBookmarks();
if (!localBookmarks.getAllBookmarks().isEmpty()) {
for (Pair<String,Nodeid> bm : remoteRepo.getBookmarks()) {
Nodeid localRevision = localBookmarks.getRevision(bm.first());
if (localRevision == null || !parentHelper.knownNode(bm.second())) {
continue;
}
// we know both localRevision and revision of remote bookmark,
// need to make sure we don't push older revision than it's at the server
if (parentHelper.isChild(bm.second(), localRevision)) {
remoteRepo.updateBookmark(bm.first(), bm.second(), localRevision);
}
}
}
// XXX WTF is obsolete in namespaces key??
progress.worked(5);
if (b != null) {
b.unlink(); // keep the file only in case of failure
}
} catch (IOException ex) {
throw new HgIOException(ex.getMessage(), null); // XXX not a nice idea to throw IOException from BundleGenerator#create
} catch (HgRepositoryNotFoundException ex) {
final HgInvalidStateException e = new HgInvalidStateException("Failed to load a just-created bundle");