| | |
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | | import org.eclipse.jgit.treewalk.TreeWalk;
|
| | | import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.Keys;
|
| | |
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | private final Logger log = LoggerFactory.getLogger(getClass());
|
| | |
|
| | | private boolean hasMore;
|
| | |
|
| | | public HistoryPanel(String wicketId, final String repositoryName, final String objectId,
|
| | |
| | |
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | PathModel matchingPath = null;
|
| | | List<PathChangeModel> paths;
|
| | | Map<String, SubmoduleModel> submodules = new HashMap<String, SubmoduleModel>();
|
| | |
|
| | | if (commit == null) {
|
| | | // commit missing
|
| | | String msg = MessageFormat.format("Failed to find history of **{0}** *{1}*",
|
| | | path, objectId);
|
| | | log.error(msg + " " + repositoryName);
|
| | | paths = new ArrayList<PathChangeModel>();
|
| | | logger().error(msg + " " + repositoryName);
|
| | | add(new Label("commitHeader", MarkdownUtils.transformMarkdown(msg)).setEscapeModelStrings(false));
|
| | | add(new Label("breadcrumbs"));
|
| | | } else {
|
| | | // commit found
|
| | | paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
|
| | | add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId));
|
| | | for (SubmoduleModel model : JGitUtils.getSubmodules(r, 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
|
| | | matchingPath = new PathChangeModel(tw.getPathString(), tw.getPathString(), null, 0, tw
|
| | | .getRawMode(0), tw.getObjectId(0).getName(), commit.getId().getName(),
|
| | | ChangeType.MODIFY);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | } finally {
|
| | | tw.release();
|
| | | tw.close();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | @Override
|
| | | public void populateItem(final Item<RevCommit> item) {
|
| | | final RevCommit entry = item.getModelObject();
|
| | | final Date date = JGitUtils.getCommitDate(entry);
|
| | | final Date date = JGitUtils.getAuthorDate(entry);
|
| | |
|
| | | item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone(), getTimeUtils()));
|
| | |
|