/** * Get the values of all footer lines with the given key. * * @param keyName * footer key to find values of, case insensitive. * @return values of footers with key of {@code keyName}, ordered by their * order of appearance. Duplicates may be returned if the same * footer appeared more than once. Empty list if no footers appear * with the specified key, or there are no footers at all. * @see #getFooterLines() */ public final List<String> getFooterLines(String keyName) { return getFooterLines(new FooterKey(keyName)); }
private String message(Proposal p) { StringBuilder m = new StringBuilder(); String msg = p.getMessage(); if (msg != null && !msg.isEmpty()) { m.append(msg); while (m.length() < 2 || m.charAt(m.length() - 2) != '\n' || m.charAt(m.length() - 1) != '\n') { m.append('\n'); } } m.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(leader.getTerm()); return m.toString(); }
/** * Get the values of all footer lines with the given key. * * @param keyName * footer key to find values of, case insensitive. * @return values of footers with key of {@code keyName}, ordered by their * order of appearance. Duplicates may be returned if the same * footer appeared more than once. Empty list if no footers appear * with the specified key, or there are no footers at all. * @see #getFooterLines() */ public final List<String> getFooterLines(String keyName) { return getFooterLines(new FooterKey(keyName)); }
msg.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(term);
/** * Get the values of all footer lines with the given key. * * @param keyName * footer key to find values of, case insensitive. * @return values of footers with key of {@code keyName}, ordered by their * order of appearance. Duplicates may be returned if the same * footer appeared more than once. Empty list if no footers appear * with the specified key, or there are no footers at all. * @see #getFooterLines() */ public final List<String> getFooterLines(final String keyName) { return getFooterLines(new FooterKey(keyName)); }
private String message(Proposal p) { StringBuilder m = new StringBuilder(); String msg = p.getMessage(); if (msg != null && !msg.isEmpty()) { m.append(msg); while (m.length() < 2 || m.charAt(m.length() - 2) != '\n' || m.charAt(m.length() - 1) != '\n') { m.append('\n'); } } m.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(leader.getTerm()); return m.toString(); }
/** * Get the values of all footer lines with the given key. * * @param keyName * footer key to find values of, case insensitive. * @return values of footers with key of {@code keyName}, ordered by their * order of appearance. Duplicates may be returned if the same * footer appeared more than once. Empty list if no footers appear * with the specified key, or there are no footers at all. * @see #getFooterLines() */ public final List<String> getFooterLines(String keyName) { return getFooterLines(new FooterKey(keyName)); }
private String message(Proposal p) { StringBuilder m = new StringBuilder(); String msg = p.getMessage(); if (msg != null && !msg.isEmpty()) { m.append(msg); while (m.length() < 2 || m.charAt(m.length() - 2) != '\n' || m.charAt(m.length() - 1) != '\n') { m.append('\n'); } } m.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(leader.getTerm()); return m.toString(); }
private ObjectId bumpTerm(Repository git, ObjectInserter inserter) throws IOException { CommitBuilder b = new CommitBuilder(); if (!ObjectId.zeroId().equals(acceptedOldIndex)) { try (RevWalk rw = new RevWalk(git)) { RevCommit c = rw.parseCommit(acceptedOldIndex); b.setTreeId(c.getTree()); b.setParentId(acceptedOldIndex); term = parseTerm(c.getFooterLines(TERM)) + 1; } } else { term = 1; b.setTreeId(inserter.insert(new TreeFormatter())); } StringBuilder msg = new StringBuilder(); msg.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(term); String tag = leader.getSystem().newLeaderTag(); if (tag != null && !tag.isEmpty()) { msg.append(' ').append(tag); } b.setAuthor(leader.getSystem().newCommitter()); b.setCommitter(b.getAuthor()); b.setMessage(msg.toString()); if (log.isDebugEnabled()) { log.debug("Trying to elect myself " + b.getMessage()); //$NON-NLS-1$ } return inserter.insert(b); }
msg.append(KetchConstants.TERM.getName()) .append(": ") //$NON-NLS-1$ .append(term);