return transferResult;
}
private TransferSummary callInternal(IRemoteRepo remoteRepo) {
final Remote remote = this.remote;
@Nullable
String localRefSpec;
@Nullable
String remoteRefSpec;
boolean force;
TransferSummary result = new TransferSummary();
for (TransferableRef ref : this.refsToPush) {
localRefSpec = ref.getLocalRef();
remoteRefSpec = ref.getRemoteRef();
force = ref.isForceUpdate();
if (ref.isDelete()) {
Optional<Ref> deleted = remoteRepo.deleteRef(remoteRefSpec);
if (deleted.isPresent()) {
ChangedRef deleteResult = new ChangedRef(deleted.get(), null, REMOVED_REF);
result.add(remote.getPushURL(), deleteResult);
}
} else {
Optional<Ref> localRef = refParse(localRefSpec);
checkState(localRef.isPresent(), "RefSpec %s does not exist", localRefSpec);
Optional<Ref> newRef = push(remoteRepo, remote, localRef.get(), remoteRefSpec);
if (newRef.isPresent()) {
ChangeTypes changeType = remoteRefSpec == null ? ADDED_REF : CHANGED_REF;
ChangedRef deleteResult = new ChangedRef(localRef.get(), newRef.get(),
changeType);
result.add(remote.getPushURL(), deleteResult);
}
}
}
return result;
}