List of usage examples for org.eclipse.jgit.revwalk FooterLine matches
public boolean matches(FooterKey key)
From source file:com.google.gerrit.server.config.TrackingFooters.java
License:Apache License
public Multimap<String, String> extract(List<FooterLine> lines) { Multimap<String, String> r = ArrayListMultimap.create(); for (FooterLine footer : lines) { for (TrackingFooter config : trackingFooters) { if (footer.matches(config.footerKey())) { Matcher m = config.match().matcher(footer.getValue()); while (m.find()) { String id = m.groupCount() > 0 ? m.group(1) : m.group(); if (!id.isEmpty()) { r.put(config.system(), id); }/*from ww w . j a va 2s . co m*/ } } } } return r; }
From source file:com.google.gerrit.server.git.MergeUtil.java
License:Apache License
private static boolean contains(List<FooterLine> footers, FooterKey key, String val) { for (final FooterLine line : footers) { if (line.matches(key) && val.equals(line.getValue())) { return true; }//from w w w . j av a2 s .c om } return false; }
From source file:com.google.gerrit.server.git.MergeUtil.java
License:Apache License
private static boolean isSignedOffBy(List<FooterLine> footers, String email) { for (final FooterLine line : footers) { if (line.matches(FooterKey.SIGNED_OFF_BY) && email.equals(line.getEmailAddress())) { return true; }//from www . ja va 2 s. c o m } return false; }
From source file:com.google.gerrit.server.mail.MailUtil.java
License:Apache License
public static MailRecipients getRecipientsFromFooters(final AccountResolver accountResolver, final PatchSet ps, final List<FooterLine> footerLines) throws OrmException { final MailRecipients recipients = new MailRecipients(); if (!ps.isDraft()) { for (final FooterLine footerLine : footerLines) { try { if (isReviewer(footerLine)) { recipients.reviewers.add(toAccountId(accountResolver, footerLine.getValue().trim())); } else if (footerLine.matches(FooterKey.CC)) { recipients.cc.add(toAccountId(accountResolver, footerLine.getValue().trim())); }// w w w . j a va 2 s .co m } catch (NoSuchAccountException e) { continue; } } } return recipients; }
From source file:com.google.gerrit.server.mail.MailUtil.java
License:Apache License
private static boolean isReviewer(final FooterLine candidateFooterLine) { return candidateFooterLine.matches(FooterKey.SIGNED_OFF_BY) || candidateFooterLine.matches(FooterKey.ACKED_BY) || candidateFooterLine.matches(FooterConstants.REVIEWED_BY) || candidateFooterLine.matches(FooterConstants.TESTED_BY); }
From source file:org.eclipse.foundation.gerrit.validation.EclipseCommitValidationListener.java
License:Open Source License
/** * Answer <code>true</code> if the identified user has signed off on the commit, * or <code>false</code> otherwise. The user may use any of their identities to * sign off on the commit (i.e. they can use any email address that is registered * with Gerrit.//w w w . j av a2s . c o m * * @param author The Gerrit identity of the author of the commit. * @param commit The commit. * @return <code>true</code> if the author has signed off; <code>false</code> otherwise. */ private boolean hasSignedOff(IdentifiedUser author, RevCommit commit) { for (final FooterLine footer : commit.getFooterLines()) { if (footer.matches(FooterKey.SIGNED_OFF_BY)) { final String email = footer.getEmailAddress(); if (author.getEmailAddresses().contains(email)) return true; } } return false; }