/** * Turns collected information of an error into a new (offline) GitHub issue * * @param details A map of the information. Note that I remove items from there when they should not go in the issue * body as well. When creating the body, all remaining items are iterated. * @return The new issue */ private static Issue createNewGibHubIssue(LinkedHashMap<String, String> details) { String errorMessage = details.get("error.message"); if (errorMessage == null || errorMessage.isEmpty()) { errorMessage = "Unspecified error"; } details.remove("error.message"); String errorHash = details.get("error.hash"); if (errorHash == null) { errorHash = ""; } details.remove("error.hash"); final Issue gitHubIssue = new Issue(); final String body = generateGitHubIssueBody(details, true); gitHubIssue.setTitle(ErrorReportBundle.message("git.issue.title", errorHash, errorMessage)); gitHubIssue.setBody(body); Label label = new Label(); label.setName(issueLabel); gitHubIssue.setLabels(Collections.singletonList(label)); return gitHubIssue; }
private Vertex getOrCreateIssueLabel(final Label label) { return getOrCreateVertexHelper(IdCols.LABEL, label.getName(), VertexType.LABEL, issuelabelidx); }
/** * Edit the given label in the given repository * * @param repository * @param label * @return edited label * @throws IOException */ public Label editLabel(IRepositoryIdProvider repository, Label label) throws IOException { String repoId = getId(repository); if (label == null) throw new IllegalArgumentException("Label cannot be null"); //$NON-NLS-1$ String name = label.getName(); if (name == null) throw new IllegalArgumentException("Label name cannot be null"); //$NON-NLS-1$ if (name.length() == 0) throw new IllegalArgumentException("Label name cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(repoId); uri.append(SEGMENT_LABELS); uri.append('/').append(name); return client.post(uri.toString(), label, Label.class); } }
List<String> labelNames = new ArrayList<String>(labels.size()); for (Label label : labels) labelNames.add(label.getName()); params.put(FILTER_LABELS, labelNames);