Show indicators for Sparkleshared repositories
4 files added
15 files modified
| | |
| | | <resource file="${basedir}/resources/commit_changes_16x16.png" />
|
| | | <resource file="${basedir}/resources/commit_merge_16x16.png" />
|
| | | <resource file="${basedir}/resources/commit_divide_16x16.png" />
|
| | | <resource file="${basedir}/resources/star_16x16.png" />
|
| | | <resource file="${basedir}/resources/blank.png" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_es.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ja.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ko.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_nl.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pl.properties" />
|
| | | <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pt_BR.properties" />
|
| | |
|
| | | <class name="com.gitblit.client.GitblitManagerLauncher" />
|
| | | <classfilter>
|
| | |
| | | }
|
| | | model.HEAD = JGitUtils.getHEADRef(r);
|
| | | model.availableRefs = JGitUtils.getAvailableHeadTargets(r);
|
| | | model.sparkleshareId = JGitUtils.getSparkleshareId(r);
|
| | | r.close();
|
| | |
|
| | | if (model.origin != null && model.origin.startsWith("file://")) {
|
| | |
| | | content = JGitUtils.getStringContent(r, tree, resource, encodings).getBytes(
|
| | | Constants.ENCODING);
|
| | | } else {
|
| | | content = JGitUtils.getByteContent(r, tree, resource);
|
| | | content = JGitUtils.getByteContent(r, tree, resource, false);
|
| | | }
|
| | | response.setContentType(contentType);
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | | private final ImageIcon forkIcon;
|
| | |
|
| | | private final ImageIcon sparkleshareIcon;
|
| | |
|
| | | public IndicatorsRenderer() {
|
| | | super(new FlowLayout(FlowLayout.RIGHT, 1, 0));
|
| | | blankIcon = new ImageIcon(getClass().getResource("/blank.png"));
|
| | |
| | | frozenIcon = new ImageIcon(getClass().getResource("/cold_16x16.png"));
|
| | | federatedIcon = new ImageIcon(getClass().getResource("/federated_16x16.png"));
|
| | | forkIcon = new ImageIcon(getClass().getResource("/commit_divide_16x16.png"));
|
| | | sparkleshareIcon = new ImageIcon(getClass().getResource("/star_16x16.png"));
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | if (value instanceof RepositoryModel) {
|
| | | StringBuilder tooltip = new StringBuilder();
|
| | | RepositoryModel model = (RepositoryModel) value;
|
| | | if (model.isSparkleshared()) {
|
| | | JLabel icon = new JLabel(sparkleshareIcon);
|
| | | tooltip.append(Translation.get("gb.isSparkleshared")).append("<br/>");
|
| | | add(icon);
|
| | | }
|
| | | if (model.isFork()) {
|
| | | JLabel icon = new JLabel(forkIcon);
|
| | | tooltip.append(Translation.get("gb.isFork")).append("<br/>");
|
| | |
| | |
|
| | | public transient boolean isCollectingGarbage;
|
| | | public Date lastGC;
|
| | | public String sparkleshareId;
|
| | |
|
| | | public RepositoryModel() {
|
| | | this("", "", "", new Date(0));
|
| | |
| | | return !accessRestriction.atLeast(AccessRestrictionType.VIEW);
|
| | | }
|
| | |
|
| | | public boolean isSparkleshared() {
|
| | | return !StringUtils.isEmpty(sparkleshareId);
|
| | | }
|
| | | |
| | | public RepositoryModel cloneAs(String cloneName) {
|
| | | RepositoryModel clone = new RepositoryModel();
|
| | | clone.originRepository = name;
|
| | |
| | | clone.useTickets = useTickets;
|
| | | clone.skipSizeCalculation = skipSizeCalculation;
|
| | | clone.skipSummaryMetrics = skipSummaryMetrics;
|
| | | clone.sparkleshareId = sparkleshareId; |
| | | return clone;
|
| | | }
|
| | | } |
| | |
| | | String issuePath = getIssuePath(issueId);
|
| | | RevTree tree = JGitUtils.getCommit(repository, GB_ISSUES).getTree();
|
| | | byte[] content = JGitUtils
|
| | | .getByteContent(repository, tree, issuePath + "/" + attachment.id);
|
| | | .getByteContent(repository, tree, issuePath + "/" + attachment.id, false);
|
| | | attachment.content = content;
|
| | | attachment.size = content.length;
|
| | | return attachment;
|
| | |
| | | * @param path
|
| | | * @return content as a byte []
|
| | | */
|
| | | public static byte[] getByteContent(Repository repository, RevTree tree, final String path) {
|
| | | public static byte[] getByteContent(Repository repository, RevTree tree, final String path, boolean throwError) {
|
| | | RevWalk rw = new RevWalk(repository);
|
| | | TreeWalk tw = new TreeWalk(repository);
|
| | | tw.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(path)));
|
| | |
| | | }
|
| | | }
|
| | | } catch (Throwable t) {
|
| | | if (throwError) {
|
| | | error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name());
|
| | | }
|
| | | } finally {
|
| | | rw.dispose();
|
| | | tw.release();
|
| | |
| | | * @return UTF-8 string content
|
| | | */
|
| | | public static String getStringContent(Repository repository, RevTree tree, String blobPath, String... charsets) {
|
| | | byte[] content = getByteContent(repository, tree, blobPath);
|
| | | byte[] content = getByteContent(repository, tree, blobPath, true);
|
| | | if (content == null) {
|
| | | return null;
|
| | | }
|
| | |
| | | */
|
| | | public static List<SubmoduleModel> getSubmodules(Repository repository, RevTree tree) {
|
| | | List<SubmoduleModel> list = new ArrayList<SubmoduleModel>();
|
| | | byte [] blob = getByteContent(repository, tree, ".gitmodules");
|
| | | byte [] blob = getByteContent(repository, tree, ".gitmodules", false);
|
| | | if (blob == null) {
|
| | | return list;
|
| | | }
|
| | |
| | | }
|
| | | return success;
|
| | | }
|
| | | |
| | | /**
|
| | | * Reads the sparkleshare id, if present, from the repository.
|
| | | * |
| | | * @param repository
|
| | | * @return an id or null
|
| | | */
|
| | | public static String getSparkleshareId(Repository repository) {
|
| | | byte[] content = getByteContent(repository, null, ".sparkleshare", false);
|
| | | if (content == null) {
|
| | | return null;
|
| | | }
|
| | | return StringUtils.decodeString(content);
|
| | | }
|
| | | }
|
| | |
| | | gb.siteName = site name
|
| | | gb.siteNameDescription = short, descriptive name of your server
|
| | | gb.excludeFromActivity = exclude from activity page |
| | | gb.isSparkleshared = repository is Sparkleshared |
| | |
| | | switch (type) {
|
| | | case 2:
|
| | | // image blobs
|
| | | byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath);
|
| | | byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);
|
| | | response.setContentType("image/" + extension.toLowerCase());
|
| | | response.setContentLength(image.length);
|
| | | try {
|
| | |
| | | break;
|
| | | case 3:
|
| | | // binary blobs (download)
|
| | | byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath);
|
| | | byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);
|
| | | response.setContentLength(binary.length);
|
| | | response.setContentType("application/octet-stream");
|
| | | response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
|
| | |
| | | </div>
|
| | | </div>
|
| | | <div class="span7">
|
| | | <div><span class="project" wicket:id="projectTitle">[project title]</span>/<span class="repository" wicket:id="repositoryName">[repository name]</span> <span class="hidden-phone"><span wicket:id="pageName">[page name]</span></span></div>
|
| | | <div><span class="project" wicket:id="projectTitle">[project title]</span>/<img wicket:id="repositoryIcon" style="padding-left: 10px;"></img><span class="repository" wicket:id="repositoryName">[repository name]</span> <span class="hidden-phone"><span wicket:id="pageName">[page name]</span></span></div>
|
| | | <span wicket:id="originRepository">[origin repository]</span>
|
| | | </div>
|
| | | </div>
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // show sparkleshare folder icon
|
| | | if (model.isSparkleshared()) {
|
| | | add(WicketUtils.newImage("repositoryIcon", "folder_star_32x32.png",
|
| | | getString("gb.isSparkleshared")));
|
| | | } else {
|
| | | add(WicketUtils.newClearPixel("repositoryIcon").setVisible(false));
|
| | | }
|
| | | |
| | | if (getRepositoryModel().isBare) {
|
| | | add(new Label("workingCopyIndicator").setVisible(false));
|
| | | } else {
|
| | |
| | | <div class="pull-right" style="text-align:right;padding-right:15px;">
|
| | | <span wicket:id="repositoryLinks"></span>
|
| | | <div>
|
| | | <img class="inlineIcon" wicket:id="sparkleshareIcon" />
|
| | | <img class="inlineIcon" wicket:id="frozenIcon" />
|
| | | <img class="inlineIcon" wicket:id="federatedIcon" />
|
| | |
|
| | |
| | | add(forkFrag);
|
| | | }
|
| | |
|
| | | if (entry.isSparkleshared()) {
|
| | | add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png", localizer.getString("gb.isSparkleshared", parent)));
|
| | | } else {
|
| | | add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false));
|
| | | }
|
| | |
|
| | | add(new BookmarkablePageLink<Void>("tickets", TicketsPage.class, pp).setVisible(entry.useTickets));
|
| | | add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp).setVisible(entry.useDocs));
|
| | |
|
| | |
| | | <td class="left" style="padding-left:3px;" ><b><span class="repositorySwatch" wicket:id="repositorySwatch"></span></b> <span style="padding-left:3px;" wicket:id="repositoryName">[repository name]</span></td>
|
| | | <td class="hidden-phone"><span class="list" wicket:id="repositoryDescription">[repository description]</span></td>
|
| | | <td class="hidden-tablet hidden-phone author"><span wicket:id="repositoryOwner">[repository owner]</span></td>
|
| | | <td class="hidden-phone" style="text-align: right;padding-right:10px;"><img class="inlineIcon" wicket:id="forkIcon" /><img class="inlineIcon" wicket:id="ticketsIcon" /><img class="inlineIcon" wicket:id="docsIcon" /><img class="inlineIcon" wicket:id="frozenIcon" /><img class="inlineIcon" wicket:id="federatedIcon" /><img class="inlineIcon" wicket:id="accessRestrictionIcon" /></td>
|
| | | <td class="hidden-phone" style="text-align: right;padding-right:10px;"><img class="inlineIcon" wicket:id="sparkleshareIcon" /><img class="inlineIcon" wicket:id="forkIcon" /><img class="inlineIcon" wicket:id="ticketsIcon" /><img class="inlineIcon" wicket:id="docsIcon" /><img class="inlineIcon" wicket:id="frozenIcon" /><img class="inlineIcon" wicket:id="federatedIcon" /><img class="inlineIcon" wicket:id="accessRestrictionIcon" /></td>
|
| | | <td><span wicket:id="repositoryLastChange">[last change]</span></td>
|
| | | <td class="hidden-phone" style="text-align: right;padding-right:15px;"><span style="font-size:0.8em;" wicket:id="repositorySize">[repository size]</span></td>
|
| | | <td class="rightAlign">
|
| | |
| | | .setEscapeModelStrings(false));
|
| | | }
|
| | |
|
| | | if (entry.isSparkleshared()) {
|
| | | row.add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png",
|
| | | getString("gb.isSparkleshared")));
|
| | | } else {
|
| | | row.add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false));
|
| | | }
|
| | | |
| | | if (entry.isFork()) {
|
| | | row.add(WicketUtils.newImage("forkIcon", "commit_divide_16x16.png",
|
| | | getString("gb.isFork")));
|