From 73f1adb2e84b8b9cd4045bcdd7d9afa72d3875b5 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 27 Nov 2012 17:13:03 -0500 Subject: [PATCH] Added short commit id column to log and history tables (issue 168) --- docs/04_releases.mkd | 1 + src/com/gitblit/wicket/panels/HistoryPanel.html | 1 + src/com/gitblit/wicket/panels/HistoryPanel.java | 9 +++++++++ src/com/gitblit/wicket/panels/LogPanel.html | 1 + src/com/gitblit/wicket/panels/LogPanel.java | 9 +++++++++ 5 files changed, 21 insertions(+) diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index b9fa3d38..cb4a51a2 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -70,6 +70,7 @@ This is extreme and should be considered carefully since it affects every https #### changes +- Added short commit id column to log and history tables (issue 168) - Teams can now specify the *admin*, *create*, and *fork* roles to simplify user administration - Use https Gravatar urls to avoid browser complaints - Added frm to default pretty print extensions (issue 156) diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.html b/src/com/gitblit/wicket/panels/HistoryPanel.html index d81d948b..2fe6f050 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.html +++ b/src/com/gitblit/wicket/panels/HistoryPanel.html @@ -19,6 +19,7 @@ [commit date] [commit author] + [commit hash]
[commit short message]
[commit refs]
[history links] diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java index dee5c25c..838f103e 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/com/gitblit/wicket/panels/HistoryPanel.java @@ -118,6 +118,7 @@ public class HistoryPanel extends BasePanel { // breadcrumbs add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId)); + final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6); ListDataProvider dp = new ListDataProvider(commits); DataView logView = new DataView("commit", dp) { private static final long serialVersionUID = 1L; @@ -138,6 +139,14 @@ public class HistoryPanel extends BasePanel { setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR); item.add(authorLink); + // commit hash link + LinkPanel commitHash = new LinkPanel("commitHash", null, entry.getName().substring(0, hashLen), + CommitPage.class, WicketUtils.newObjectParameter( + repositoryName, entry.getName())); + WicketUtils.setCssClass(commitHash, "sha1"); + WicketUtils.setHtmlTooltip(commitHash, entry.getName()); + item.add(commitHash); + // merge icon if (entry.getParentCount() > 1) { item.add(WicketUtils.newImage("commitIcon", "commit_merge_16x16.png")); diff --git a/src/com/gitblit/wicket/panels/LogPanel.html b/src/com/gitblit/wicket/panels/LogPanel.html index c5ae71cb..f6c2327e 100644 --- a/src/com/gitblit/wicket/panels/LogPanel.html +++ b/src/com/gitblit/wicket/panels/LogPanel.html @@ -14,6 +14,7 @@ [commit date] [commit author] + [commit hash]
[commit short message]
[commit refs]
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java index a31c3dfa..6d06e7b8 100644 --- a/src/com/gitblit/wicket/panels/LogPanel.java +++ b/src/com/gitblit/wicket/panels/LogPanel.java @@ -82,6 +82,7 @@ public class LogPanel extends BasePanel { WicketUtils.newRepositoryParameter(repositoryName))); } + final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6); ListDataProvider dp = new ListDataProvider(commits); DataView logView = new DataView("commit", dp) { private static final long serialVersionUID = 1L; @@ -100,6 +101,14 @@ public class LogPanel extends BasePanel { objectId, author, Constants.SearchType.AUTHOR)); setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR); item.add(authorLink); + + // commit hash link + LinkPanel commitHash = new LinkPanel("commitHash", null, entry.getName().substring(0, hashLen), + CommitPage.class, WicketUtils.newObjectParameter( + repositoryName, entry.getName())); + WicketUtils.setCssClass(commitHash, "sha1"); + WicketUtils.setHtmlTooltip(commitHash, entry.getName()); + item.add(commitHash); // merge icon if (entry.getParentCount() > 1) { -- 2.39.5