Package com.gitblit.models

Examples of com.gitblit.models.RepositoryCommit


            continue;
          }
          try {
            List<RevCommit> pushedCommits = JGitUtils.getRevLog(repository, oldId, newId);
            for (RevCommit pushedCommit : pushedCommits) {
              RepositoryCommit repoCommit = log.addCommit(change.path, pushedCommit);
              if (repoCommit != null) {
                repoCommit.setRefs(allRefs.get(pushedCommit.getId()));
              }
            }
          } catch (Exception e) {

          }
View Full Code Here


                } else {
                  linearParent = commit.getParents()[0].getId().getName();
                  digest.updateRef(branch, ReceiveCommand.Type.UPDATE, linearParent, commit.getName());
                }

                RepositoryCommit repoCommit = digest.addCommit(commit);
                if (repoCommit != null) {
                  List<RefModel> matchedRefs = allRefs.get(commit.getId());
                    repoCommit.setRefs(matchedRefs);

                    if (!ArrayUtils.isEmpty(matchedRefs)) {
                        for (RefModel ref : matchedRefs) {
                            if (ref.getName().startsWith(Constants.R_TAGS)) {
                                // treat tags as special events in the log
                                if (!tags.containsKey(dateStr)) {
                              UserModel tagUser = newUserModelFrom(ref.getAuthorIdent());
                              Date tagDate = commit.getAuthorIdent().getWhen();
                              tags.put(dateStr, new DailyLogEntry(repositoryName, tagDate, tagUser));
                                }
                                RefLogEntry tagEntry = tags.get(dateStr);
                                tagEntry.updateRef(ref.getName(), ReceiveCommand.Type.CREATE);
                                RepositoryCommit rc = repoCommit.clone(ref.getName());
                                tagEntry.addCommit(rc);
                            } else if (ref.getName().startsWith(Constants.R_PULL)) {
                                // treat pull requests as special events in the log
                                if (!pulls.containsKey(dateStr)) {
                              UserModel commitUser = newUserModelFrom(ref.getAuthorIdent());
                              Date commitDate = commit.getAuthorIdent().getWhen();
                              pulls.put(dateStr, new DailyLogEntry(repositoryName, commitDate, commitUser));
                                }
                                RefLogEntry pullEntry = pulls.get(dateStr);
                                pullEntry.updateRef(ref.getName(), ReceiveCommand.Type.CREATE);
                                RepositoryCommit rc = repoCommit.clone(ref.getName());
                                pullEntry.addCommit(rc);
                            }
                        }
                    }
                }
View Full Code Here

        DataView<RepositoryCommit> commitsView = new DataView<RepositoryCommit>("commit", cdp) {
          private static final long serialVersionUID = 1L;

          @Override
          public void populateItem(final Item<RepositoryCommit> commitItem) {
            final RepositoryCommit commit = commitItem.getModelObject();

            // author gravatar
            commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent(), null, 16, false));

            // merge icon
            if (commit.getParentCount() > 1) {
              commitItem.add(WicketUtils.newImage("commitIcon", "commit_merge_16x16.png"));
            } else {
              commitItem.add(WicketUtils.newBlankImage("commitIcon"));
            }

            // short message
            String shortMessage = commit.getShortMessage();
            String trimmedMessage = shortMessage;
            if (commit.getRefs() != null && commit.getRefs().size() > 0) {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
            } else {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
            }
            LinkPanel shortlog = new LinkPanel("commitShortMessage", "list",
                trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
                    change.repository, commit.getName()));
            if (!shortMessage.equals(trimmedMessage)) {
              WicketUtils.setHtmlTooltip(shortlog, shortMessage);
            }
            commitItem.add(shortlog);

            // commit hash link
            int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);
            LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen),
                CommitPage.class, WicketUtils.newObjectParameter(
                    change.repository, commit.getName()));
            WicketUtils.setCssClass(commitHash, "shortsha1");
            WicketUtils.setHtmlTooltip(commitHash, commit.getName());
            commitItem.add(commitHash);

            if (showSwatch) {
              // set repository color
              String color = StringUtils.getColor(StringUtils.stripDotGit(change.repository));
View Full Code Here

   */
  protected List<RepositoryCommit> get(String repositoryName, Repository repository, String branch, Date sinceDate) {
    Map<ObjectId, List<RefModel>> allRefs = JGitUtils.getAllRefs(repository, false);
    List<RepositoryCommit> commits = new ArrayList<RepositoryCommit>();
    for (RevCommit commit : JGitUtils.getRevLog(repository, branch, sinceDate)) {
      RepositoryCommit commitModel = new RepositoryCommit(repositoryName, branch, commit);
      List<RefModel> commitRefs = allRefs.get(commitModel.getId());
      commitModel.setRefs(commitRefs);
      commits.add(commitModel);
    }
    return commits;
  }
View Full Code Here

   */
  protected List<RepositoryCommit> get(String repositoryName, Repository repository, String branch, ObjectId sinceCommit) {
    Map<ObjectId, List<RefModel>> allRefs = JGitUtils.getAllRefs(repository, false);
    List<RepositoryCommit> commits = new ArrayList<RepositoryCommit>();
    for (RevCommit commit : JGitUtils.getRevLog(repository, sinceCommit.getName(), branch)) {
      RepositoryCommit commitModel = new RepositoryCommit(repositoryName, branch, commit);
      List<RefModel> commitRefs = allRefs.get(commitModel.getId());
      commitModel.setRefs(commitRefs);
      commits.add(commitModel);
    }
    return commits;
  }
View Full Code Here

        DataView<RepositoryCommit> commitsView = new DataView<RepositoryCommit>("commit", cdp) {
          private static final long serialVersionUID = 1L;

          @Override
          public void populateItem(final Item<RepositoryCommit> commitItem) {
            final RepositoryCommit commit = commitItem.getModelObject();

            // author gravatar
            commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent(), null, 16, false));

            // merge icon
            if (commit.getParentCount() > 1) {
              commitItem.add(WicketUtils.newImage("commitIcon", "commit_merge_16x16.png"));
            } else {
              commitItem.add(WicketUtils.newBlankImage("commitIcon"));
            }

            // short message
            String shortMessage = commit.getShortMessage();
            String trimmedMessage = shortMessage;
            if (commit.getRefs() != null && commit.getRefs().size() > 0) {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
            } else {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
            }
            LinkPanel shortlog = new LinkPanel("commitShortMessage", "list",
                trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
                    change.repository, commit.getName()));
            if (!shortMessage.equals(trimmedMessage)) {
              WicketUtils.setHtmlTooltip(shortlog, shortMessage);
            }
            commitItem.add(shortlog);

            // commit hash link
            int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);
            LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen),
                CommitPage.class, WicketUtils.newObjectParameter(
                    change.repository, commit.getName()));
            WicketUtils.setCssClass(commitHash, "shortsha1");
            WicketUtils.setHtmlTooltip(commitHash, commit.getName());
            commitItem.add(commitHash);
          }
        };

        changeItem.add(commitsView);
View Full Code Here

            new ListDataProvider<RepositoryCommit>(entry.getCommits())) {
          private static final long serialVersionUID = 1L;

          @Override
          public void populateItem(final Item<RepositoryCommit> commitItem) {
            final RepositoryCommit commit = commitItem.getModelObject();

            // commit time of day
            commitItem.add(WicketUtils.createTimeLabel("time", commit.getCommitterIdent()
                .getWhen(), getTimeZone(), getTimeUtils()));

            // avatar
            commitItem.add(new GravatarImage("avatar", commit.getAuthorIdent(), 40));

            // merge icon
            if (commit.getParentCount() > 1) {
              commitItem.add(WicketUtils.newImage("commitIcon",
                  "commit_merge_16x16.png"));
            } else {
              commitItem.add(WicketUtils.newBlankImage("commitIcon").setVisible(false));
            }

            // author search link
            String author = commit.getAuthorIdent().getName();
            LinkPanel authorLink = new LinkPanel("author", "list", author,
                GitSearchPage.class, WicketUtils.newSearchParameter(commit.repository,
                    null, author, Constants.SearchType.AUTHOR), true);
            setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
            commitItem.add(authorLink);

            // repository
            String repoName = StringUtils.stripDotGit(commit.repository);
            LinkPanel repositoryLink = new LinkPanel("repository", null,
                repoName, SummaryPage.class,
                WicketUtils.newRepositoryParameter(commit.repository), true);
            WicketUtils.setCssBackground(repositoryLink, repoName);
            commitItem.add(repositoryLink);

            // repository branch
            LinkPanel branchLink = new LinkPanel("branch", "list", Repository.shortenRefName(commit.branch),
                LogPage.class, WicketUtils.newObjectParameter(commit.repository,
                    commit.branch), true);
            WicketUtils.setCssStyle(branchLink, "color: #008000;");
            commitItem.add(branchLink);

            LinkPanel commitid = new LinkPanel("commitid", "list subject",
                commit.getName().substring(0,  shortHashLen), CommitPage.class,
                WicketUtils.newObjectParameter(commit.repository, commit.getName()), true);
            commitItem.add(commitid);

            // message/commit link
            String shortMessage = commit.getShortMessage();
            String trimmedMessage = shortMessage;
            if (commit.getRefs() != null && commit.getRefs().size() > 0) {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
            } else {
              trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
            }
            LinkPanel shortlog = new LinkPanel("message", "list subject",
                trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
                    commit.repository, commit.getName()), true);
            if (!shortMessage.equals(trimmedMessage)) {
              WicketUtils.setHtmlTooltip(shortlog, shortMessage);
            }
            commitItem.add(shortlog);

            // refs
            commitItem.add(new RefsPanel("commitRefs", commit.repository, commit
                .getRefs()));

            // diff, tree links
            commitItem.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class,
                WicketUtils.newObjectParameter(commit.repository, commit.getName()))
                .setEnabled(commit.getParentCount() > 0));
            commitItem.add(new BookmarkablePageLink<Void>("tree", TreePage.class,
                WicketUtils.newObjectParameter(commit.repository, commit.getName())));
          }
        };
        activityItem.add(commits);
      }
    };
View Full Code Here

TOP

Related Classes of com.gitblit.models.RepositoryCommit

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.