Package com.gitblit.models.PathModel

Examples of com.gitblit.models.PathModel.PathChangeModel


      }
      return val;
    }

    public PathChangeModel getPath(String path) {
      PathChangeModel stat = null;
      for (PathChangeModel p : paths) {
        if (p.path.equals(path)) {
          stat = p;
          break;
        }
View Full Code Here


      private static final long serialVersionUID = 1L;
      int counter;

      @Override
      public void populateItem(final Item<PathChangeModel> item) {
        final PathChangeModel entry = item.getModelObject();
        Label changeType = new Label("changeType", "");
        WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);
        setChangeTypeTooltip(changeType, entry.changeType);
        item.add(changeType);
        item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true));

        boolean hasSubmodule = false;
        String submodulePath = null;
        if (entry.isTree()) {
          // tree
          item.add(new LinkPanel("pathName", null, entry.path, TreePage.class,
              WicketUtils
                  .newPathParameter(repositoryName, entry.commitId, entry.path)));
        } else if (entry.isSubmodule()) {
          // submodule
          String submoduleId = entry.objectId;
          SubmoduleModel submodule = getSubmodule(entry.path);
          submodulePath = submodule.gitblitPath;
          hasSubmodule = submodule.hasSubmodule;

          // add relative link
          item.add(new LinkPanel("pathName", "list", entry.path + " @ " + getShortObjectId(submoduleId), "#" + entry.path));
        } else {
          // add relative link
          item.add(new LinkPanel("pathName", "list", entry.path, "#" + entry.path));
        }

        // quick links
        if (entry.isSubmodule()) {
          item.add(new ExternalLink("raw", "").setEnabled(false));
          // submodule
          item.add(new ExternalLink("patch", "").setEnabled(false));
          item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
              .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));
View Full Code Here

        try {
          tw.addTree(commit.getTree());
          tw.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(path)));
          while (tw.next()) {
            if (tw.getPathString().equals(path)) {
              matchingPath = new PathChangeModel(tw.getPathString(), tw.getPathString(), 0, tw
                .getRawMode(0), tw.getObjectId(0).getName(), commit.getId().getName(),
                ChangeType.MODIFY);
            }
          }
        } catch (Exception e) {
View Full Code Here

        private static final long serialVersionUID = 1L;
        int counter;

        @Override
        public void populateItem(final Item<PathChangeModel> item) {
          final PathChangeModel entry = item.getModelObject();
          Label changeType = new Label("changeType", "");
          WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);
          setChangeTypeTooltip(changeType, entry.changeType);
          item.add(changeType);
          item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true));

          boolean hasSubmodule = false;
          String submodulePath = null;
          if (entry.isTree()) {
            // tree
            item.add(new LinkPanel("pathName", null, entry.path, TreePage.class,
                WicketUtils
                .newPathParameter(repositoryName, endId, entry.path)));
          } else if (entry.isSubmodule()) {
            // submodule
            String submoduleId = entry.objectId;
            SubmoduleModel submodule = getSubmodule(entry.path);
            submodulePath = submodule.gitblitPath;
            hasSubmodule = submodule.hasSubmodule;

            // add relative link
            item.add(new LinkPanel("pathName", "list", entry.path + " @ " + getShortObjectId(submoduleId), "#" + entry.path));
          } else {
            // add relative link
            item.add(new LinkPanel("pathName", "list", entry.path, "#" + entry.path));
          }

          // quick links
          if (entry.isSubmodule()) {
            // submodule
            item.add(new ExternalLink("patch", "").setEnabled(false));
            item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
                .newObjectParameter(submodulePath, entry.objectId)).setEnabled(hasSubmodule));
            item.add(new ExternalLink("raw", "").setEnabled(false));
View Full Code Here

        TreeWalk tw = new TreeWalk(repository);
        tw.reset();
        tw.setRecursive(true);
        tw.addTree(commit.getTree());
        while (tw.next()) {
          list.add(new PathChangeModel(tw.getPathString(), tw.getPathString(), 0, tw
              .getRawMode(0), tw.getObjectId(0).getName(), commit.getId().getName(),
              ChangeType.ADD));
        }
        tw.release();
      } else {
        RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
        DiffStatFormatter df = new DiffStatFormatter(commit.getName());
        df.setRepository(repository);
        df.setDiffComparator(RawTextComparator.DEFAULT);
        df.setDetectRenames(true);
        List<DiffEntry> diffs = df.scan(parent.getTree(), commit.getTree());
        for (DiffEntry diff : diffs) {
          // create the path change model
          PathChangeModel pcm = PathChangeModel.from(diff, commit.getName());

          if (calculateDiffStat) {
            // update file diffstats
            df.format(diff);
            PathChangeModel pathStat = df.getDiffStat().getPath(pcm.path);
            if (pathStat != null) {
              pcm.insertions = pathStat.insertions;
              pcm.deletions = pathStat.deletions;
            }
          }
View Full Code Here

      df.setDiffComparator(RawTextComparator.DEFAULT);
      df.setDetectRenames(true);

      List<DiffEntry> diffEntries = df.scan(startCommit.getTree(), endCommit.getTree());
      for (DiffEntry diff : diffEntries) {
        PathChangeModel pcm = PathChangeModel.from(diff,  endCommit.getName());
        list.add(pcm);
      }
      Collections.sort(list);
    } catch (Throwable t) {
      error(t, repository, "{0} failed to determine files in range {1}..{2}!", startCommit, endCommit);
View Full Code Here

TOP

Related Classes of com.gitblit.models.PathModel.PathChangeModel

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.