verifyProjectVisible("CC", ccId);
receive.addReviewers(reviewerId);
receive.addExtraCC(ccId);
final ReceivePack rp = receive.getReceivePack();
rp.setRefLogIdent(currentUser.newRefLogIdent());
rp.setTimeout(config.getTimeout());
rp.setMaxObjectSizeLimit(config.getMaxObjectSizeLimit());
try {
receive.advertiseHistory();
rp.receive(in, out, err);
} catch (UnpackException badStream) {
// In case this was caused by the user pushing an object whose size
// is larger than the receive.maxObjectSizeLimit gerrit.config parameter
// we want to present this error to the user
if (badStream.getCause() instanceof TooLargeObjectInPackException) {
StringBuilder msg = new StringBuilder();
msg.append("Receive error on project \""
+ projectControl.getProject().getName() + "\"");
msg.append(" (user ");
msg.append(currentUser.getAccount().getUserName());
msg.append(" account ");
msg.append(currentUser.getAccountId());
msg.append("): ");
msg.append(badStream.getCause().getMessage());
log.info(msg.toString());
throw new UnloggedFailure(128, "error: " + badStream.getCause().getMessage());
}
// This may have been triggered by branch level access controls.
// Log what the heck is going on, as detailed as we can.
//
StringBuilder msg = new StringBuilder();
msg.append("Unpack error on project \""
+ projectControl.getProject().getName() + "\":\n");
msg.append(" AdvertiseRefsHook: " + rp.getAdvertiseRefsHook());
if (rp.getAdvertiseRefsHook() == AdvertiseRefsHook.DEFAULT) {
msg.append("DEFAULT");
} else if (rp.getAdvertiseRefsHook() instanceof VisibleRefFilter) {
msg.append("VisibleRefFilter");
} else {
msg.append(rp.getAdvertiseRefsHook().getClass());
}
msg.append("\n");
if (rp.getAdvertiseRefsHook() instanceof VisibleRefFilter) {
Map<String, Ref> adv = rp.getAdvertisedRefs();
msg.append(" Visible references (" + adv.size() + "):\n");
for (Ref ref : adv.values()) {
msg.append(" - " + ref.getObjectId().abbreviate(8).name() + " "
+ ref.getName() + "\n");
}
List<Ref> hidden = new ArrayList<Ref>();
for (Ref ref : rp.getRepository().getAllRefs().values()) {
if (!adv.containsKey(ref.getName())) {
hidden.add(ref);
}
}