Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.PersonIdent


    if (oldRef != null) {
      // rename old ref to refs/meta/gitblit/reflog
      RefRename cmd;
      try {
        cmd = repository.renameRef(oldRef.getName(), GB_REFLOG);
        cmd.setRefLogIdent(new PersonIdent("Gitblit", "gitblit@localhost"));
        cmd.setRefLogMessage("renamed " + oldRef.getName() + " => " + GB_REFLOG);
        Result res = cmd.rename();
        switch (res) {
        case RENAMED:
          LOGGER.info(repository.getDirectory() + " " + cmd.getRefLogMessage());
View Full Code Here


      try {
        // Create the in-memory index of the reflog log entry
        DirCache index = createIndex(repository, headId, commands);
        ObjectId indexTreeId = index.writeTree(odi);

        PersonIdent ident;
        if (UserModel.ANONYMOUS.equals(user)) {
          // anonymous push
          ident = new PersonIdent(user.username + "/" + user.username, user.username);
        } else {
          // construct real pushing account
          ident =  new PersonIdent(MessageFormat.format("{0}/{1}", user.getDisplayName(), user.username),
            user.emailAddress == null ? user.username : user.emailAddress);
        }

        // Create a commit object
        CommitBuilder commit = new CommitBuilder();
View Full Code Here

        }
        logItem.add(changeIcon);

                if (isTag) {
                  // tags are special
                  PersonIdent ident = change.getCommits().get(0).getAuthorIdent();
                  if (!StringUtils.isEmpty(ident.getName())) {
                    logItem.add(new Label("whoChanged", ident.getName()));
                  } else {
                    logItem.add(new Label("whoChanged", ident.getEmailAddress()));
                  }
                } else {
                  logItem.add(new Label("whoChanged").setVisible(false));
                }
View Full Code Here

          UserModel user = app().users().getUserModel(repository.projectPath.substring(1));
          if (user == null) {
            // user account no longer exists
            user = new UserModel(repository.projectPath.substring(1));
          }
          PersonIdent ident = new PersonIdent(user.getDisplayName(), user.emailAddress == null ? user.getDisplayName() : user.emailAddress);
          item.add(new GravatarImage("anAvatar", ident, 20));
          if (pageRepository.equals(repository)) {
            // do not link to self
            item.add(new Label("aProject", user.getDisplayName()));
          } else {
View Full Code Here

                      firstParent = null;
            } else {
              firstParent = commit.getParents()[0].getId().getName();
            }

            PersonIdent committer = commit.getCommitterIdent();
            if (!user.is(committer.getName(), committer.getEmailAddress())) {
              // verification failed
              String reason = MessageFormat.format("{0} by {1} <{2}> was not committed by {3} ({4}) <{5}>",
                  commit.getId().name(), committer.getName(), StringUtils.isEmpty(committer.getEmailAddress()) ? "?":committer.getEmailAddress(), user.getDisplayName(), user.username, user.emailAddress);
              LOGGER.warn(reason);
              cmd.setResult(Result.REJECTED_OTHER_REASON, reason);
              allRejected &= true;
              break;
            } else {
View Full Code Here

      return;
    }

    // tag each pushed branch tip
    String emailAddress = user.emailAddress == null ? getRefLogIdent().getEmailAddress() : user.emailAddress;
    PersonIdent userIdent = new PersonIdent(user.getDisplayName(), emailAddress);

    for (ReceiveCommand cmd : commands) {
      if (!cmd.getRefName().startsWith(Constants.R_HEADS)) {
        // only tag branch ref changes
        continue;
View Full Code Here

    Collections.sort(list);
    return list;
  }

  public PersonIdent getCommitterIdent() {
    return new PersonIdent(user.getDisplayName(), user.emailAddress == null ? user.username : user.emailAddress);
  }
View Full Code Here

public class JGitUtilsTest extends GitblitUnitTest {

  @Test
  public void testDisplayName() throws Exception {
    assertEquals("Napoleon Bonaparte",
        JGitUtils.getDisplayName(new PersonIdent("Napoleon Bonaparte", "")));
    assertEquals("<someone@somewhere.com>",
        JGitUtils.getDisplayName(new PersonIdent("", "someone@somewhere.com")));
    assertEquals("Napoleon Bonaparte <someone@somewhere.com>",
        JGitUtils.getDisplayName(new PersonIdent("Napoleon Bonaparte",
            "someone@somewhere.com")));
  }
View Full Code Here

  public Date getDate() {
    Date date = new Date(0);
    if (referencedObject != null) {
      if (referencedObject instanceof RevTag) {
        RevTag tag = (RevTag) referencedObject;
        PersonIdent tagger = tag.getTaggerIdent();
        if (tagger != null) {
          date = tagger.getWhen();
        }
      } else if (referencedObject instanceof RevCommit) {
        RevCommit commit = (RevCommit) referencedObject;
        PersonIdent committer = commit.getCommitterIdent();
        if (committer != null) {
          date = committer.getWhen();
        } else {
          date = JGitUtils.getCommitDate(commit);
        }
      }
    }
View Full Code Here

    } else {
      rp = new GitblitReceivePack(gitblit, db, repository, user);
    }

    rp.setGitblitUrl(url);
    rp.setRefLogIdent(new PersonIdent(user.username, user.username + "@" + origin));
    rp.setTimeout(timeout);

    return rp;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.PersonIdent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.