// execute the merge using the ticket service
app().tickets().exec(new Runnable() {
@Override
public void run() {
PatchsetReceivePack rp = new PatchsetReceivePack(
app().gitblit(),
getRepository(),
getRepositoryModel(),
GitBlitWebSession.get().getUser());
MergeStatus result = rp.merge(refreshedTicket);
if (MergeStatus.MERGED == result) {
// notify participants and watchers
rp.sendAll();
} else {
// merge failure
String msg = MessageFormat.format("Failed to merge ticket {0,number,0}: {1}", ticket.number, result.name());
logger.error(msg);
GitBlitWebSession.get().cacheErrorMessage(msg);