当前位置: 首页>>代码示例>>Java>>正文


Java RawParseUtils.parsePersonIdent方法代码示例

本文整理汇总了Java中org.eclipse.jgit.util.RawParseUtils.parsePersonIdent方法的典型用法代码示例。如果您正苦于以下问题:Java RawParseUtils.parsePersonIdent方法的具体用法?Java RawParseUtils.parsePersonIdent怎么用?Java RawParseUtils.parsePersonIdent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.util.RawParseUtils的用法示例。


在下文中一共展示了RawParseUtils.parsePersonIdent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseAssignee

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private void parseAssignee(ChangeNotesCommit commit) throws ConfigInvalidException {
  if (pastAssignees == null) {
    pastAssignees = Lists.newArrayList();
  }
  String assigneeValue = parseOneFooter(commit, FOOTER_ASSIGNEE);
  if (assigneeValue != null) {
    Optional<Account.Id> parsedAssignee;
    if (assigneeValue.equals("")) {
      // Empty footer found, assignee deleted
      parsedAssignee = Optional.empty();
    } else {
      PersonIdent ident = RawParseUtils.parsePersonIdent(assigneeValue);
      parsedAssignee = Optional.ofNullable(noteUtil.parseIdent(ident, id));
    }
    if (assignee == null) {
      assignee = parsedAssignee;
    }
    if (parsedAssignee.isPresent()) {
      pastAssignees.add(parsedAssignee.get());
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ChangeNotesParser.java

示例2: commit

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
@Override
public boolean commit( String authorName, String message ) {
  PersonIdent author = RawParseUtils.parsePersonIdent( authorName );
  // Set the local time
  PersonIdent author2 = new PersonIdent( author.getName(), author.getEmailAddress(),
      SystemReader.getInstance().getCurrentTime(),
      SystemReader.getInstance().getTimezone( SystemReader.getInstance().getCurrentTime() ) );
  try {
    git.commit().setAuthor( author2 ).setMessage( message ).call();
    return true;
  } catch ( Exception e ) {
    showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() );
    return false;
  }
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:16,代码来源:UIGit.java

示例3: parseRealAccountId

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private Account.Id parseRealAccountId(ChangeNotesCommit commit, Account.Id effectiveAccountId)
    throws ConfigInvalidException {
  String realUser = parseOneFooter(commit, FOOTER_REAL_USER);
  if (realUser == null) {
    return effectiveAccountId;
  }
  PersonIdent ident = RawParseUtils.parsePersonIdent(realUser);
  return noteUtil.parseIdent(ident, id);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:ChangeNotesParser.java

示例4: parseReviewer

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private void parseReviewer(Timestamp ts, ReviewerStateInternal state, String line)
    throws ConfigInvalidException {
  PersonIdent ident = RawParseUtils.parsePersonIdent(line);
  if (ident == null) {
    throw invalidFooter(state.getFooterKey(), line);
  }
  Account.Id accountId = noteUtil.parseIdent(ident, id);
  reviewerUpdates.add(ReviewerStatusUpdate.create(ts, ownerId, accountId, state));
  if (!reviewers.containsRow(accountId)) {
    reviewers.put(accountId, state, ts);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:ChangeNotesParser.java

示例5: parseAuthor

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private Account.Id parseAuthor(
    byte[] note, MutableInteger curr, Change.Id changeId, String fieldName)
    throws ConfigInvalidException {
  checkHeaderLineFormat(note, curr, fieldName, changeId);
  int startOfAccountId = RawParseUtils.endOfFooterLineKey(note, curr.value) + 2;
  PersonIdent ident = RawParseUtils.parsePersonIdent(note, startOfAccountId);
  Account.Id aId = parseIdent(ident, changeId);
  curr.value = RawParseUtils.nextLF(note, curr.value);
  return checkResult(aId, fieldName, changeId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeNoteUtil.java

示例6: parseAddApproval

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private PatchSetApproval parseAddApproval(
    PatchSet.Id psId, Account.Id committerId, Account.Id realAccountId, Timestamp ts, String line)
    throws ConfigInvalidException {
  // There are potentially 3 accounts involved here:
  //  1. The account from the commit, which is the effective IdentifiedUser
  //     that produced the update.
  //  2. The account in the label footer itself, which is used during submit
  //     to copy other users' labels to a new patch set.
  //  3. The account in the Real-user footer, indicating that the whole
  //     update operation was executed by this user on behalf of the effective
  //     user.
  Account.Id effectiveAccountId;
  String labelVoteStr;
  int s = line.indexOf(' ');
  if (s > 0) {
    // Account in the label line (2) becomes the effective ID of the
    // approval. If there is a real user (3) different from the commit user
    // (2), we actually don't store that anywhere in this case; it's more
    // important to record that the real user (3) actually initiated submit.
    labelVoteStr = line.substring(0, s);
    PersonIdent ident = RawParseUtils.parsePersonIdent(line.substring(s + 1));
    checkFooter(ident != null, FOOTER_LABEL, line);
    effectiveAccountId = noteUtil.parseIdent(ident, id);
  } else {
    labelVoteStr = line;
    effectiveAccountId = committerId;
  }

  LabelVote l;
  try {
    l = LabelVote.parseWithEquals(labelVoteStr);
  } catch (IllegalArgumentException e) {
    ConfigInvalidException pe = parseException("invalid %s: %s", FOOTER_LABEL, line);
    pe.initCause(e);
    throw pe;
  }

  PatchSetApproval psa =
      new PatchSetApproval(
          new PatchSetApproval.Key(psId, effectiveAccountId, new LabelId(l.label())),
          l.value(),
          ts);
  psa.setTag(tag);
  if (!Objects.equals(realAccountId, committerId)) {
    psa.setRealAccountId(realAccountId);
  }
  ApprovalKey k = ApprovalKey.create(psId, effectiveAccountId, l.label());
  if (!approvals.containsKey(k)) {
    approvals.put(k, psa);
  }
  return psa;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:53,代码来源:ChangeNotesParser.java

示例7: parseRemoveApproval

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
private PatchSetApproval parseRemoveApproval(
    PatchSet.Id psId, Account.Id committerId, Account.Id realAccountId, Timestamp ts, String line)
    throws ConfigInvalidException {
  // See comments in parseAddApproval about the various users involved.
  Account.Id effectiveAccountId;
  String label;
  int s = line.indexOf(' ');
  if (s > 0) {
    label = line.substring(1, s);
    PersonIdent ident = RawParseUtils.parsePersonIdent(line.substring(s + 1));
    checkFooter(ident != null, FOOTER_LABEL, line);
    effectiveAccountId = noteUtil.parseIdent(ident, id);
  } else {
    label = line.substring(1);
    effectiveAccountId = committerId;
  }

  try {
    LabelType.checkNameInternal(label);
  } catch (IllegalArgumentException e) {
    ConfigInvalidException pe = parseException("invalid %s: %s", FOOTER_LABEL, line);
    pe.initCause(e);
    throw pe;
  }

  // Store an actual 0-vote approval in the map for a removed approval, for
  // several reasons:
  //  - This is closer to the ReviewDb representation, which leads to less
  //    confusion and special-casing of NoteDb.
  //  - More importantly, ApprovalCopier needs an actual approval in order to
  //    block copying an earlier approval over a later delete.
  PatchSetApproval remove =
      new PatchSetApproval(
          new PatchSetApproval.Key(psId, effectiveAccountId, new LabelId(label)), (short) 0, ts);
  if (!Objects.equals(realAccountId, committerId)) {
    remove.setRealAccountId(realAccountId);
  }
  ApprovalKey k = ApprovalKey.create(psId, effectiveAccountId, label);
  if (!approvals.containsKey(k)) {
    approvals.put(k, remove);
  }
  return remove;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:44,代码来源:ChangeNotesParser.java

示例8: getTaggerIdent

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
 * Parse the tagger identity from the raw buffer.
 * <p>
 * This method parses and returns the content of the tagger line, after
 * taking the tag's character set into user and decoding the tagger
 * name and email address. This method is fairly expensive and produces a
 * new PersonIdent instance on each invocation. Callers should invoke this
 * method only if they are certain they will be outputting the result, and
 * should cache the return value for as long as necessary to use all
 * information from it.
 *
 * @return identity of the tagger (name, email) and the time the tag
 *         was made by the tagger; null if no tagger line was found.
 */
public final PersonIdent getTaggerIdent() {
	final byte[] raw = buffer;
	final int nameB = RawParseUtils.tagger(raw, 0);
	if (nameB < 0)
		return null;
	return RawParseUtils.parsePersonIdent(raw, nameB);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:RevTag.java

示例9: getAuthorIdent

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
 * Parse the author identity from the raw buffer.
 * <p>
 * This method parses and returns the content of the author line, after
 * taking the commit's character set into user and decoding the author
 * name and email address. This method is fairly expensive and produces a
 * new PersonIdent instance on each invocation. Callers should invoke this
 * method only if they are certain they will be outputting the result, and
 * should cache the return value for as long as necessary to use all
 * information from it.
 * <p>
 * RevFilter implementations should try to use {@link RawParseUtils} to scan
 * the {@link #getRawBuffer()} instead, as this will allow faster evaluation
 * of commits.
 *
 * @return identity of the author (name, email) and the time the commit was
 *         made by the author; null if no author line was found.
 */
public final PersonIdent getAuthorIdent() {
	final byte[] raw = buffer;
	final int nameB = RawParseUtils.author(raw, 0);
	if (nameB < 0)
		return null;
	return RawParseUtils.parsePersonIdent(raw, nameB);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:26,代码来源:RevCommit.java

示例10: getCommitterIdent

import org.eclipse.jgit.util.RawParseUtils; //导入方法依赖的package包/类
/**
 * Parse the committer identity from the raw buffer.
 * <p>
 * This method parses and returns the content of the committer line, after
 * taking the commit's character set into user and decoding the committer
 * name and email address. This method is fairly expensive and produces a
 * new PersonIdent instance on each invocation. Callers should invoke this
 * method only if they are certain they will be outputting the result, and
 * should cache the return value for as long as necessary to use all
 * information from it.
 * <p>
 * RevFilter implementations should try to use {@link RawParseUtils} to scan
 * the {@link #getRawBuffer()} instead, as this will allow faster evaluation
 * of commits.
 *
 * @return identity of the committer (name, email) and the time the commit
 *         was made by the committer; null if no committer line was found.
 */
public final PersonIdent getCommitterIdent() {
	final byte[] raw = buffer;
	final int nameB = RawParseUtils.committer(raw, 0);
	if (nameB < 0)
		return null;
	return RawParseUtils.parsePersonIdent(raw, nameB);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:26,代码来源:RevCommit.java


注:本文中的org.eclipse.jgit.util.RawParseUtils.parsePersonIdent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。