當前位置: 首頁>>代碼示例>>Java>>正文


Java PersonIdent.getName方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.lib.PersonIdent.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java PersonIdent.getName方法的具體用法?Java PersonIdent.getName怎麽用?Java PersonIdent.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.lib.PersonIdent的用法示例。


在下文中一共展示了PersonIdent.getName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toCommit

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
private static Commit toCommit(RevCommit revCommit) {
    final Author author;
    final PersonIdent committerIdent = revCommit.getCommitterIdent();
    if (committerIdent == null) {
        author = Author.UNKNOWN;
    } else {
        author = new Author(committerIdent.getName(), committerIdent.getEmailAddress());
    }
    long when = committerIdent.getWhen().getTime();

    try {
        return CommitUtil.newCommit(author, when, revCommit.getFullMessage());
    } catch (Exception e) {
        throw new StorageException("failed to create a Commit", e);
    }
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:17,代碼來源:GitRepository.java

示例2: createCommitInfo

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public CommitInfo createCommitInfo(RevCommit entry) {
    final Date date = GitUtils.getCommitDate(entry);
    PersonIdent authorIdent = entry.getAuthorIdent();
    String author = null;
    String name = null;
    String email = null;
    String avatarUrl = null;
    if (authorIdent != null) {
        author = authorIdent.getName();
        name = authorIdent.getName();
        email = authorIdent.getEmailAddress();

        // lets try default the avatar
        if (Strings.isNotBlank(email)) {
            avatarUrl = getAvatarUrl(email);
        }
    }
    boolean merge = entry.getParentCount() > 1;
    String shortMessage = entry.getShortMessage();
    String sha = entry.getName();
    return new CommitInfo(sha, author, name, email, avatarUrl, date, merge, shortMessage);
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:23,代碼來源:RepositoryResource.java

示例3: getAuthors

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
/**
 * Gets a set of authors for a path in a given repository
 * @param repo The git repository
 * @param path The path to get commits for
 * @return An iterable of commits
 * @throws GitAPIException Any API errors which may occur
 * @throws URISyntaxException Error constructing mailto link
 */
public Set<HashableAgent> getAuthors(Git repo, String path) throws GitAPIException, URISyntaxException {
    Iterable<RevCommit> logs = repo.log().addPath(path).call();
    Set<HashableAgent> fileAuthors = new HashSet<>();
    for (RevCommit rev : logs) {
        // Use author first with backup of committer
        PersonIdent author = rev.getAuthorIdent();
        if (author == null) {
            author = rev.getCommitterIdent();
        }
        // Create a new agent and add as much detail as possible
        if (author != null) {
            HashableAgent newAgent = new HashableAgent();
            String name = author.getName();
            if (name != null && name.length() > 0) {
                newAgent.setName(author.getName());
            }
            String email = author.getEmailAddress();
            if (email != null && email.length() > 0) {
                newAgent.setUri(new URI("mailto:" + author.getEmailAddress()));
            }
            fileAuthors.add(newAgent);
        }
    }
    return fileAuthors;
}
 
開發者ID:common-workflow-language,項目名稱:cwlviewer,代碼行數:34,代碼來源:GitService.java

示例4: getRevisionData

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
@Override
public FileVersion[] getRevisionData(String label, File... files) {
  // Workaround for CachingPage
  if (label == null) {
    return persistence.getRevisionData(null, files);
  }
  RevCommit revCommit;
  Repository repository = getRepository(files[0]);
  FileVersion[] versions = new FileVersion[files.length];

  try {
    ObjectId rev = repository.resolve(label);
    RevWalk walk = new RevWalk(repository);
    revCommit = walk.parseCommit(rev);
    PersonIdent author = revCommit.getAuthorIdent();
    int counter = 0;
    for (File file : files) {
      String path = getPath(file, repository);
      byte[] content = getRepositoryContent(repository, revCommit, path);
      versions[counter++] = new GitFileVersion(file, content, author.getName(), author.getWhen());
    }
  } catch (IOException e) {
    throw new RuntimeException("Unable to get data for revision " + label, e);
  }
  return versions;
}
 
開發者ID:fitnesse,項目名稱:fitnesse-git-plugin,代碼行數:27,代碼來源:GitFileVersionsController.java

示例5: appendPersonIdent

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
private static void appendPersonIdent(StringBuilder b, String field, PersonIdent person) {
  if (person != null) {
    b.append(field).append(":    ");
    if (person.getName() != null) {
      b.append(" ");
      b.append(person.getName());
    }
    if (person.getEmailAddress() != null) {
      b.append(" <");
      b.append(person.getEmailAddress());
      b.append(">");
    }
    b.append("\n");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZ");
    sdf.setTimeZone(person.getTimeZone());
    b.append(field).append("Date: ");
    b.append(sdf.format(person.getWhen()));
    b.append("\n");
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:Text.java

示例6: commit

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的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

示例7: fromHEAD

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public static GitCommit fromHEAD(Git git) throws Exception {
    ObjectId head = git.getRepository().resolve("HEAD");
    if (head != null) {
        RevCommit mostRecentCommit;
        try (RevWalk walk = new RevWalk(git.getRepository())) {
            mostRecentCommit = walk.parseCommit(head);
        }
        Date commitDate = new Date(1000L * mostRecentCommit.getCommitTime());
        String id = mostRecentCommit.getId().name();
        PersonIdent author = mostRecentCommit.getAuthorIdent();
        return new GitCommit(id, commitDate, author.getName(), mostRecentCommit.getFullMessage());
    } else {
        return null;
    }
}
 
開發者ID:danielflower,項目名稱:app-runner,代碼行數:16,代碼來源:GitCommit.java

示例8: toGitPerson

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public static GitPerson toGitPerson(PersonIdent ident) {
  GitPerson result = new GitPerson();
  result.name = ident.getName();
  result.email = ident.getEmailAddress();
  result.date = new Timestamp(ident.getWhen().getTime());
  result.tz = ident.getTimeZoneOffset();
  return result;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:9,代碼來源:CommonConverters.java

示例9: asAccountAttribute

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
/**
 * Create an AuthorAttribute for the given person ident suitable for serialization to JSON.
 *
 * @param ident
 * @return object suitable for serialization to JSON
 */
public AccountAttribute asAccountAttribute(PersonIdent ident) {
  AccountAttribute who = new AccountAttribute();
  who.name = ident.getName();
  who.email = ident.getEmailAddress();
  return who;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:13,代碼來源:EventFactory.java

示例10: toBlameInfo

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
private static BlameInfo toBlameInfo(RevCommit commit, PersonIdent sourceAuthor) {
  BlameInfo blameInfo = new BlameInfo();
  blameInfo.author = sourceAuthor.getName();
  blameInfo.id = commit.getName();
  blameInfo.commitMsg = commit.getFullMessage();
  blameInfo.time = commit.getCommitTime();
  return blameInfo;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:9,代碼來源:GetBlame.java

示例11: NameAndEmail

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public NameAndEmail(PersonIdent person) {
	this(person.getName(), person.getEmailAddress());
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:4,代碼來源:NameAndEmail.java

示例12: author

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public String author() {
    PersonIdent ident = commit.getAuthorIdent();
    return ident.getName() + " " + ident.getEmailAddress();
}
 
開發者ID:kszatan,項目名稱:gocd-phabricator-staging-material,代碼行數:5,代碼來源:Commit.java

示例13: PersonIdentDTO

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
public PersonIdentDTO(PersonIdent ident) {
    this.name = ident.getName();
    this.emailAddress = ident.getEmailAddress();
    this.timeZone = ident.getTimeZone().getID();
    this.when = ident.getWhen();
}
 
開發者ID:fabric8io,項目名稱:fabric8-devops,代碼行數:7,代碼來源:PersonIdentDTO.java

示例14: makeVersionInfo

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
private GitVersionInfo makeVersionInfo(RevCommit revCommit) {
  PersonIdent authorIdent = revCommit.getAuthorIdent();
  return new GitVersionInfo(revCommit.name(), authorIdent.getName(), authorIdent.getWhen(), revCommit.getShortMessage());
}
 
開發者ID:fitnesse,項目名稱:fitnesse-git-plugin,代碼行數:5,代碼來源:GitFileVersionsController.java

示例15: toAddress

import org.eclipse.jgit.lib.PersonIdent; //導入方法依賴的package包/類
private static Address toAddress(PersonIdent myIdent) {
  return new Address(myIdent.getName(), myIdent.getEmailAddress());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:4,代碼來源:FromAddressGeneratorProvider.java


注:本文中的org.eclipse.jgit.lib.PersonIdent.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。