congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ChangeIdUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
ChangeIdUtil
in
org.eclipse.jgit.util

Best Java code snippets using org.eclipse.jgit.util.ChangeIdUtil (Showing top 20 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

int indexOfChangeId = indexOfChangeId(message, "\n"); //$NON-NLS-1$
if (indexOfChangeId > 0) {
  if (!replaceExisting)
int footerFirstLine = indexOfFirstFooterLine(lines);
int insertAfter = footerFirstLine;
for (int i = footerFirstLine; i < lines.length; ++i) {
origin: org.eclipse.jgit/org.eclipse.jgit

private void insertChangeId(ObjectId treeId) {
  ObjectId firstParentId = null;
  if (!parents.isEmpty())
    firstParentId = parents.get(0);
  ObjectId changeId = ChangeIdUtil.computeChangeId(treeId, firstParentId,
      author, committer, message);
  message = ChangeIdUtil.insertId(message, changeId);
  if (changeId != null)
    message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$
        + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$
        + changeId.getName() + "\n"); //$NON-NLS-1$
}
origin: org.eclipse.jgit/org.eclipse.jgit

  final ObjectId firstParentId, final PersonIdent author,
  final PersonIdent committer, final String message) {
String cleanMessage = clean(message);
if (cleanMessage.length() == 0)
  return null;
origin: org.eclipse.jgit/org.eclipse.jgit

boolean inFooter = false;
for (int i = lines.length - 1; i >= 0; --i) {
  if (!inFooter && isEmptyLine(lines[i]))
    continue;
  inFooter = true;
  if (changeIdPattern.matcher(trimRight(lines[i])).matches()) {
    indexOfChangeIdLine = i;
    break;
  } else if (isEmptyLine(lines[i]) || i == 0)
    return -1;
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Find the right place to insert a Change-Id and return it.
 * <p>
 * The Change-Id is inserted before the first footer line but after a Bug
 * line.
 *
 * @param message
 *            a message.
 * @param changeId
 *            a Change-Id.
 * @return a commit message with an inserted Change-Id line
 */
public static String insertId(String message, ObjectId changeId) {
  return insertId(message, changeId, false);
}
origin: org.eclipse.egit/ui

private int findOffsetOfChangeIdLine(String message) {
  return ChangeIdUtil.indexOfChangeId(message, Text.DELIMITER);
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Add section with conflicting paths to merge message.
 *
 * @param message
 *            the original merge message
 * @param conflictingPaths
 *            the paths with conflicts
 * @return merge message with conflicting paths added
 */
public String formatWithConflicts(String message,
    List<String> conflictingPaths) {
  StringBuilder sb = new StringBuilder();
  String[] lines = message.split("\n"); //$NON-NLS-1$
  int firstFooterLine = ChangeIdUtil.indexOfFirstFooterLine(lines);
  for (int i = 0; i < firstFooterLine; i++)
    sb.append(lines[i]).append('\n');
  if (firstFooterLine == lines.length && message.length() != 0)
    sb.append('\n');
  addConflictsMessage(conflictingPaths, sb);
  if (firstFooterLine < lines.length)
    sb.append('\n');
  for (int i = firstFooterLine; i < lines.length; i++)
    sb.append(lines[i]).append('\n');
  return sb.toString();
}
origin: sonia.jgit/org.eclipse.jgit

boolean inFooter = false;
for (int i = lines.length - 1; i >= 0; --i) {
  if (!inFooter && isEmptyLine(lines[i]))
    continue;
  inFooter = true;
  if (changeIdPattern.matcher(trimRight(lines[i])).matches()) {
    indexOfChangeIdLine = i;
    break;
  } else if (isEmptyLine(lines[i]) || i == 0)
    return -1;
origin: sonia.jgit/org.eclipse.jgit

/**
 * Find the right place to insert a Change-Id and return it.
 * <p>
 * The Change-Id is inserted before the first footer line but after a Bug
 * line.
 *
 * @param message
 * @param changeId
 * @return a commit message with an inserted Change-Id line
 */
public static String insertId(String message, ObjectId changeId) {
  return insertId(message, changeId, false);
}
origin: sonia.jgit/org.eclipse.jgit

/**
 * Add section with conflicting paths to merge message.
 *
 * @param message
 *            the original merge message
 * @param conflictingPaths
 *            the paths with conflicts
 * @return merge message with conflicting paths added
 */
public String formatWithConflicts(String message,
    List<String> conflictingPaths) {
  StringBuilder sb = new StringBuilder();
  String[] lines = message.split("\n"); //$NON-NLS-1$
  int firstFooterLine = ChangeIdUtil.indexOfFirstFooterLine(lines);
  for (int i = 0; i < firstFooterLine; i++)
    sb.append(lines[i]).append('\n');
  if (firstFooterLine == lines.length && message.length() != 0)
    sb.append('\n');
  addConflictsMessage(conflictingPaths, sb);
  if (firstFooterLine < lines.length)
    sb.append('\n');
  for (int i = firstFooterLine; i < lines.length; i++)
    sb.append(lines[i]).append('\n');
  return sb.toString();
}
origin: sonia.jgit/org.eclipse.jgit

private void insertChangeId(ObjectId treeId) {
  ObjectId firstParentId = null;
  if (!parents.isEmpty())
    firstParentId = parents.get(0);
  ObjectId changeId = ChangeIdUtil.computeChangeId(treeId, firstParentId,
      author, committer, message);
  message = ChangeIdUtil.insertId(message, changeId);
  if (changeId != null)
    message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$
        + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$
        + changeId.getName() + "\n"); //$NON-NLS-1$
}
origin: sonia.jgit/org.eclipse.jgit

int indexOfChangeId = indexOfChangeId(message, "\n"); //$NON-NLS-1$
if (indexOfChangeId > 0) {
  if (!replaceExisting)
int footerFirstLine = indexOfFirstFooterLine(lines);
int insertAfter = footerFirstLine;
for (int i = footerFirstLine; i < lines.length; ++i) {
origin: berlam/github-bucket

boolean inFooter = false;
for (int i = lines.length - 1; i >= 0; --i) {
  if (!inFooter && isEmptyLine(lines[i]))
    continue;
  inFooter = true;
  if (changeIdPattern.matcher(trimRight(lines[i])).matches()) {
    indexOfChangeIdLine = i;
    break;
  } else if (isEmptyLine(lines[i]) || i == 0)
    return -1;
origin: berlam/github-bucket

/**
 * Find the right place to insert a Change-Id and return it.
 * <p>
 * The Change-Id is inserted before the first footer line but after a Bug
 * line.
 *
 * @param message
 *            a message.
 * @param changeId
 *            a Change-Id.
 * @return a commit message with an inserted Change-Id line
 */
public static String insertId(String message, ObjectId changeId) {
  return insertId(message, changeId, false);
}
origin: berlam/github-bucket

/**
 * Add section with conflicting paths to merge message.
 *
 * @param message
 *            the original merge message
 * @param conflictingPaths
 *            the paths with conflicts
 * @return merge message with conflicting paths added
 */
public String formatWithConflicts(String message,
    List<String> conflictingPaths) {
  StringBuilder sb = new StringBuilder();
  String[] lines = message.split("\n"); //$NON-NLS-1$
  int firstFooterLine = ChangeIdUtil.indexOfFirstFooterLine(lines);
  for (int i = 0; i < firstFooterLine; i++)
    sb.append(lines[i]).append('\n');
  if (firstFooterLine == lines.length && message.length() != 0)
    sb.append('\n');
  addConflictsMessage(conflictingPaths, sb);
  if (firstFooterLine < lines.length)
    sb.append('\n');
  for (int i = firstFooterLine; i < lines.length; i++)
    sb.append(lines[i]).append('\n');
  return sb.toString();
}
origin: sonia.jgit/org.eclipse.jgit

  final ObjectId firstParentId, final PersonIdent author,
  final PersonIdent committer, final String message) {
String cleanMessage = clean(message);
if (cleanMessage.length() == 0)
  return null;
origin: berlam/github-bucket

private void insertChangeId(ObjectId treeId) {
  ObjectId firstParentId = null;
  if (!parents.isEmpty())
    firstParentId = parents.get(0);
  ObjectId changeId = ChangeIdUtil.computeChangeId(treeId, firstParentId,
      author, committer, message);
  message = ChangeIdUtil.insertId(message, changeId);
  if (changeId != null)
    message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$
        + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$
        + changeId.getName() + "\n"); //$NON-NLS-1$
}
origin: berlam/github-bucket

int indexOfChangeId = indexOfChangeId(message, "\n"); //$NON-NLS-1$
if (indexOfChangeId > 0) {
  if (!replaceExisting)
int footerFirstLine = indexOfFirstFooterLine(lines);
int insertAfter = footerFirstLine;
for (int i = footerFirstLine; i < lines.length; ++i) {
origin: org.eclipse.egit/ui

private void refreshChangeIdText() {
  if (createChangeId) {
    // ChangeIdUtil uses \n line endings
    String text = commitText.getText().replaceAll(Text.DELIMITER, "\n"); //$NON-NLS-1$
    String changedText = ChangeIdUtil.insertId(
        text,
        originalChangeId != null ? originalChangeId : ObjectId
            .zeroId(), true);
    if (!text.equals(changedText)) {
      changedText = changedText.replaceAll("\n", Text.DELIMITER); //$NON-NLS-1$
      commitText.setText(changedText);
    }
  } else {
    String text = commitText.getText();
    int changeIdOffset = findOffsetOfChangeIdLine(text);
    if (changeIdOffset > 0) {
      String cleanedText;
      int endOfChangeId = findNextEOL(changeIdOffset, text);
      if (endOfChangeId == -1)
        cleanedText = text.substring(0, changeIdOffset);
      else
        cleanedText = text.substring(0, changeIdOffset)
            + text.substring(endOfChangeId + 1);
      commitText.setText(cleanedText);
    }
  }
}
origin: berlam/github-bucket

  final ObjectId firstParentId, final PersonIdent author,
  final PersonIdent committer, final String message) {
String cleanMessage = clean(message);
if (cleanMessage.length() == 0)
  return null;
org.eclipse.jgit.utilChangeIdUtil

Javadoc

Utilities for creating and working with Change-Id's, like the one used by Gerrit Code Review.

A Change-Id is a SHA-1 computed from the content of a commit, in a similar fashion to how the commit id is computed. Unlike the commit id a Change-Id is retained in the commit and subsequent revised commits in the footer of the commit text.

Most used methods

  • indexOfChangeId
    Return the index in the String message where the Change-Id entry in the footer begins. If there are
  • insertId
    Find the right place to insert a Change-Id and return it. If no Change-Id is found the Change-Id is
  • clean
  • computeChangeId
    Compute a Change-Id.
  • indexOfFirstFooterLine
    Find the index of the first line of the footer paragraph in an array of the lines, or lines.length i
  • isEmptyLine
  • trimRight

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JButton (javax.swing)
  • JComboBox (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now