| | |
| | |
|
| | | /** Extracts the ticket id from the ref name */
|
| | | private long getTicketId(String refName) {
|
| | | if (refName.indexOf('%') > -1) {
|
| | | refName = refName.substring(0, refName.indexOf('%'));
|
| | | }
|
| | | if (refName.startsWith(Constants.R_FOR)) {
|
| | | String ref = refName.substring(Constants.R_FOR.length());
|
| | | if (ref.indexOf('%') > -1) {
|
| | | ref = ref.substring(0, ref.indexOf('%'));
|
| | | }
|
| | | try {
|
| | | return Long.parseLong(ref);
|
| | | } catch (Exception e) {
|
| | |
| | | * @return the patchset command
|
| | | */
|
| | | private PatchsetCommand preparePatchset(ReceiveCommand cmd) {
|
| | | LOGGER.info(MessageFormat.format("Preparing {0} patchset command for \"{1}\" received from {2}",
|
| | | repository.name, cmd.getRefName(), user.username));
|
| | | String branch = getIntegrationBranch(cmd.getRefName());
|
| | | long number = getTicketId(cmd.getRefName());
|
| | |
|
| | |
| | | sendError(" 1. you created the ticket");
|
| | | sendError(" 2. you created the first patchset");
|
| | | sendError(" 3. you are specified as responsible for the ticket");
|
| | | sendError(" 4. you are listed as a reviewer for the ticket");
|
| | | sendError(" 5. you have push (RW) permission to {0}", repository.name);
|
| | | sendError(" 4. you have push (RW) permissions to {0}", repository.name);
|
| | | sendError("");
|
| | | sendRejection(cmd, "not permitted to push to ticket {0,number,0}", ticket.number);
|
| | | return null;
|