| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.HashMap;
|
| | |
| | |
|
| | | public RepositoryPage(PageParameters params) {
|
| | | super(params);
|
| | | if (!params.containsKey("r")) {
|
| | | error("Repository not specified!");
|
| | | redirectToInterceptPage(new RepositoriesPage());
|
| | | }
|
| | | repositoryName = WicketUtils.getRepositoryName(params);
|
| | | objectId = WicketUtils.getObject(params);
|
| | |
|
| | | if (StringUtils.isEmpty(repositoryName)) {
|
| | | error(MessageFormat.format("Repository not specified for {0}!", getPageName()), true);
|
| | | }
|
| | |
|
| | | Repository r = getRepository();
|
| | | if (r == null) {
|
| | | error(MessageFormat.format("Failed to open repository {0} for {1}!", repositoryName, getPageName()), true);
|
| | | }
|
| | |
|
| | | // standard page links
|
| | | add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | |
| | | return m;
|
| | | }
|
| | |
|
| | | protected RevCommit getCommit() {
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | if (commit == null) {
|
| | | error(MessageFormat.format("Failed to find commit \"{0}\" in {1} for {2} page!", objectId, repositoryName, getPageName()), true);
|
| | | }
|
| | | return commit;
|
| | | }
|
| | |
|
| | | protected void addRefs(Repository r, RevCommit c) {
|
| | | add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r)));
|
| | | }
|