Color-coded change type indicator with tooltip for changed paths.
Also fixed /dev/null reference due to deletion change.
| | |
| | |
|
| | | # Specify the interface for Jetty to bind the standard connector.
|
| | | # You may specify an ip or an empty value to bind to all interfaces.
|
| | | server.httpBindInterface = localhost
|
| | | server.httpBindInterface = |
| | |
|
| | | # Specify the interface for Jetty to bind the secure connector.
|
| | | # You may specify an ip or an empty value to bind to all interfaces.
|
| | | server.httpsBindInterface = localhost
|
| | | server.httpsBindInterface = |
| | |
|
| | | # Password for SSL keystore (keystore password and certificate password must match)
|
| | | server.storePassword = dosomegit
|
| | |
| | | import org.eclipse.jgit.storage.file.FileRepository;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.models.TicketModel;
|
| | |
|
| | |
| | | public void testFilesInCommit() throws Exception {
|
| | | Repository r = getRepository();
|
| | | RevCommit commit = JGitUtils.getCommit(r, Constants.HEAD);
|
| | | List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | r.close();
|
| | | assertTrue("No changed paths found!", paths.size() > 0);
|
| | | }
|
| | |
| | | import org.eclipse.jgit.diff.DiffEntry;
|
| | | import org.eclipse.jgit.diff.DiffFormatter;
|
| | | import org.eclipse.jgit.diff.RawTextComparator;
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | | import org.eclipse.jgit.errors.ConfigInvalidException;
|
| | | import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
| | | import org.eclipse.jgit.errors.MissingObjectException;
|
| | |
| | |
|
| | | import com.gitblit.wicket.models.Metric;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.models.TicketModel;
|
| | | import com.gitblit.wicket.models.TicketModel.Comment;
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | public static List<PathModel> getFilesInCommit(Repository r, String commitId) {
|
| | | public static List<PathChangeModel> getFilesInCommit(Repository r, String commitId) {
|
| | | RevCommit commit = getCommit(r, commitId);
|
| | | return getFilesInCommit(r, commit);
|
| | | }
|
| | |
|
| | | public static List<PathModel> getFilesInCommit(Repository r, RevCommit commit) {
|
| | | List<PathModel> list = new ArrayList<PathModel>();
|
| | | public static List<PathChangeModel> getFilesInCommit(Repository r, RevCommit commit) {
|
| | | List<PathChangeModel> list = new ArrayList<PathChangeModel>();
|
| | | try {
|
| | | final RevWalk rw = new RevWalk(r);
|
| | | RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
|
| | |
| | | df.setDetectRenames(true);
|
| | | List<DiffEntry> diffs = df.scan(parentTree, commitTree);
|
| | | for (DiffEntry diff : diffs) {
|
| | | list.add(new PathModel(diff.getNewPath(), diff.getNewPath(), 0, diff.getNewMode().getBits(), commit.getId().getName()));
|
| | | if (diff.getChangeType().equals(ChangeType.DELETE)) {
|
| | | list.add(new PathChangeModel(diff.getOldPath(), diff.getOldPath(), 0, diff.getNewMode().getBits(), commit.getId().getName(), diff.getChangeType()));
|
| | | } else {
|
| | | list.add(new PathChangeModel(diff.getNewPath(), diff.getNewPath(), 0, diff.getNewMode().getBits(), commit.getId().getName(), diff.getChangeType()));
|
| | | }
|
| | | }
|
| | | } catch (Throwable t) {
|
| | | LOGGER.error("failed to determine files in commit!", t);
|
| | |
| | | gb.search = search
|
| | | gb.searchForAuthor = Search for commits authored by
|
| | | gb.searchForCommitter = Search for commits committed by |
| | | gb.addition = addition
|
| | | gb.modification = modification
|
| | | gb.deletion = deletion
|
| | | gb.rename = rename |
| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.panel.Fragment;
|
| | | import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | | import org.eclipse.jgit.lib.PersonIdent;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
| | | WicketUtils.setHtmlTitle(component, getString("gb.searchForCommitter") + " " + value);
|
| | | }
|
| | | }
|
| | | |
| | | protected void setChangeTypeTooltip(Component container, ChangeType type) {
|
| | | switch (type) {
|
| | | case ADD:
|
| | | WicketUtils.setHtmlTitle(container, getString("gb.addition"));
|
| | | break;
|
| | | case COPY:
|
| | | case RENAME:
|
| | | WicketUtils.setHtmlTitle(container, getString("gb.rename"));
|
| | | break;
|
| | | case DELETE:
|
| | | WicketUtils.setHtmlTitle(container, getString("gb.deletion"));
|
| | | break;
|
| | | case MODIFY:
|
| | | WicketUtils.setHtmlTitle(container, getString("gb.modification"));
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | protected void onBeforeRender() {
|
| | | // dispose of repository object
|
| | |
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.SimpleAttributeModifier;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | | import org.eclipse.jgit.lib.Constants;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | |
| | | container.add(new SimpleAttributeModifier("title", value));
|
| | | }
|
| | |
|
| | | public static void setChangeTypeCssClass(Component container, ChangeType type) {
|
| | | switch (type) {
|
| | | case ADD:
|
| | | setCssClass(container, "addition");
|
| | | break;
|
| | | case COPY:
|
| | | case RENAME:
|
| | | setCssClass(container, "rename");
|
| | | break;
|
| | | case DELETE:
|
| | | setCssClass(container, "deletion");
|
| | | break;
|
| | | case MODIFY:
|
| | | setCssClass(container, "modification");
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | public static void setTicketCssClass(Component container, String state) {
|
| | | String css = null;
|
| | | if (state.equals("open")) {
|
| | |
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | |
|
| | | public class PathModel implements Serializable, Comparable<PathModel> {
|
| | |
| | | }
|
| | | return 1;
|
| | | }
|
| | |
|
| | | public static class PathChangeModel extends PathModel {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public final ChangeType changeType;
|
| | |
|
| | | public PathChangeModel(String name, String path, long size, int mode, String commitId, ChangeType type) {
|
| | | super(name, path, size, mode, commitId);
|
| | | this.changeType = type;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | <!-- changed paths -->
|
| | | <table style="margin-top:10px;border-top:1px solid #bbb;" class="pretty">
|
| | | <tr wicket:id="changedPath">
|
| | | <td><span wicket:id="changeType">[change type]</span></td> |
| | | <td class="path"><span wicket:id="pathName">[commit path]</span></td>
|
| | | <td>
|
| | | <span class="link">
|
| | |
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | |
|
| | | public class CommitDiffPage extends RepositoryPage {
|
| | |
|
| | |
| | | add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));
|
| | |
|
| | | // changed paths list
|
| | | List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
|
| | | DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
|
| | | DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<PathModel> item) {
|
| | | final PathModel entry = item.getModelObject();
|
| | | 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);
|
| | |
|
| | | if (entry.isTree()) {
|
| | | item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));
|
| | | } else {
|
| | |
| | | <!-- changed paths -->
|
| | | <table style="border-top:1px solid #bbb;" class="pretty">
|
| | | <tr wicket:id="changedPath">
|
| | | <td><span wicket:id="changeType">[change type]</span></td>
|
| | | <td class="path"><span wicket:id="pathName">[commit path]</span></td>
|
| | | <td>
|
| | | <span class="link">
|
| | |
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | |
|
| | | public class CommitPage extends RepositoryPage {
|
| | |
|
| | |
| | | addFullText("fullMessage", c.getFullMessage(), true);
|
| | |
|
| | | // changed paths list
|
| | | List<PathModel> paths = JGitUtils.getFilesInCommit(r, c);
|
| | | ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
|
| | | DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
|
| | | ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
|
| | | DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<PathModel> item) {
|
| | | final PathModel entry = item.getModelObject();
|
| | | 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);
|
| | | if (entry.isTree()) {
|
| | | item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));
|
| | | } else {
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.pages.BlobDiffPage;
|
| | | import com.gitblit.wicket.pages.BlobPage;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | |
| | | }
|
| | |
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
|
| | |
|
| | | PathModel matchingPath = null;
|
| | | for (PathModel p : paths) {
|
| | |
| | | color:yellow;
|
| | | text-align:right;
|
| | | float:right;
|
| | | padding:3px;
|
| | | padding:3px 4px 3px 3px; |
| | | }
|
| | |
|
| | | .repositories_message {
|
| | |
| | | font-family: inherit;
|
| | | }
|
| | |
|
| | | span.addition, span.modification, span.deletion, span.rename {
|
| | | border: 1px solid #888;
|
| | | float: left;
|
| | | height: 0.8em;
|
| | | margin: 0.2em 0.5em 0 0;
|
| | | overflow: hidden;
|
| | | width: 0.8em;
|
| | | }
|
| | |
|
| | | span.addition {
|
| | | background-color: #bbffbb;
|
| | | }
|
| | |
|
| | | span.modification {
|
| | | background-color: #ffdd88;
|
| | | }
|
| | |
|
| | | span.deletion {
|
| | | background-color: #ff8888;
|
| | | }
|
| | |
|
| | | span.rename {
|
| | | background-color: #8888ff;
|
| | | }
|
| | |
|
| | | a.list {
|
| | | text-decoration: none;
|
| | | color: #000000;
|