From 5fe7df81eb38dc66f2cfc4bf1973863a19f55cf2 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 4 Apr 2011 09:10:51 -0400 Subject: Initial import of Git:Blit. Change-Id: Ifce000c85c8947c3a768e782c841e41a8953d314 --- .classpath | 19 + .gitignore | 6 + .project | 17 + build.xml | 92 ++++ gitblit.cmd | 1 + gitblit.properties | 96 ++++ makekeystore.cmd | 2 + makepassword.cmd | 12 + makerepository.cmd | 11 + resources/arrow_down.png | Bin 0 -> 189 bytes resources/arrow_off.png | Bin 0 -> 178 bytes resources/arrow_up.png | Bin 0 -> 189 bytes resources/git-favicon.png | Bin 0 -> 115 bytes resources/gitblit.css | 56 ++ resources/gitblt-logo.png | Bin 0 -> 3050 bytes resources/gitblt.png | Bin 0 -> 5427 bytes resources/gitblt2.png | Bin 0 -> 6543 bytes resources/gitblt3.png | Bin 0 -> 4464 bytes resources/gitblt_25.png | Bin 0 -> 3040 bytes resources/gitweb.css | 604 +++++++++++++++++++++ resources/prettify/lang-apollo.js | 2 + resources/prettify/lang-css.js | 2 + resources/prettify/lang-hs.js | 2 + resources/prettify/lang-lisp.js | 2 + resources/prettify/lang-lua.js | 2 + resources/prettify/lang-ml.js | 2 + resources/prettify/lang-proto.js | 1 + resources/prettify/lang-scala.js | 2 + resources/prettify/lang-sql.js | 2 + resources/prettify/lang-vb.js | 2 + resources/prettify/lang-vhdl.js | 3 + resources/prettify/lang-wiki.js | 2 + resources/prettify/lang-yaml.js | 2 + resources/prettify/prettify.css | 1 + resources/prettify/prettify.js | 33 ++ service/JavaService.exe | Bin 0 -> 65536 bytes service/JavaService64.exe | Bin 0 -> 139264 bytes service/UninstallService.bat | 1 + service/UninstallService64.bat | 1 + service/installService.bat | 2 + service/installService64.bat | 2 + src/com/gitblit/Build.java | 168 ++++++ src/com/gitblit/Constants.java | 12 + src/com/gitblit/GitBlitServer.java | 393 ++++++++++++++ src/com/gitblit/Launcher.java | 117 ++++ src/com/gitblit/MakeRepository.java | 51 ++ src/com/gitblit/StoredSettings.java | 130 +++++ src/com/gitblit/tests/JGitUtilsTest.java | 71 +++ src/com/gitblit/utils/ByteFormat.java | 82 +++ src/com/gitblit/utils/JGitUtils.java | 430 +++++++++++++++ src/com/gitblit/utils/Utils.java | 119 ++++ src/com/gitblit/wicket/BasePage.java | 69 +++ src/com/gitblit/wicket/GitBlitWebApp.java | 143 +++++ src/com/gitblit/wicket/GitBlitWebSession.java | 74 +++ src/com/gitblit/wicket/LinkPanel.html | 6 + src/com/gitblit/wicket/LinkPanel.java | 44 ++ src/com/gitblit/wicket/RepositoryPage.java | 118 ++++ src/com/gitblit/wicket/SecuredPage.java | 11 + src/com/gitblit/wicket/WicketUtils.java | 35 ++ src/com/gitblit/wicket/models/PathModel.java | 45 ++ src/com/gitblit/wicket/models/RefModel.java | 54 ++ src/com/gitblit/wicket/models/RepositoryModel.java | 20 + src/com/gitblit/wicket/pages/BlobPage.html | 31 ++ src/com/gitblit/wicket/pages/BlobPage.java | 94 ++++ src/com/gitblit/wicket/pages/CommitPage.html | 51 ++ src/com/gitblit/wicket/pages/CommitPage.java | 106 ++++ src/com/gitblit/wicket/pages/HeadsPage.html | 26 + src/com/gitblit/wicket/pages/HeadsPage.java | 63 +++ src/com/gitblit/wicket/pages/LogPage.html | 33 ++ src/com/gitblit/wicket/pages/LogPage.java | 69 +++ src/com/gitblit/wicket/pages/RepositoriesPage.html | 29 + src/com/gitblit/wicket/pages/RepositoriesPage.java | 151 ++++++ src/com/gitblit/wicket/pages/ShortLogPage.html | 31 ++ src/com/gitblit/wicket/pages/ShortLogPage.java | 76 +++ src/com/gitblit/wicket/pages/SummaryPage.html | 76 +++ src/com/gitblit/wicket/pages/SummaryPage.java | 149 +++++ src/com/gitblit/wicket/pages/TagPage.html | 28 + src/com/gitblit/wicket/pages/TagPage.java | 36 ++ src/com/gitblit/wicket/pages/TagsPage.html | 30 + src/com/gitblit/wicket/pages/TagsPage.java | 64 +++ src/com/gitblit/wicket/pages/TreePage.html | 35 ++ src/com/gitblit/wicket/pages/TreePage.java | 89 +++ src/com/gitblit/wicket/panels/HeadLinksPanel.html | 8 + src/com/gitblit/wicket/panels/HeadLinksPanel.java | 23 + src/com/gitblit/wicket/panels/PageFooter.html | 10 + src/com/gitblit/wicket/panels/PageFooter.java | 28 + src/com/gitblit/wicket/panels/PageHeader.html | 15 + src/com/gitblit/wicket/panels/PageHeader.java | 41 ++ src/com/gitblit/wicket/panels/PageLinksPanel.html | 9 + src/com/gitblit/wicket/panels/PageLinksPanel.java | 61 +++ .../wicket/panels/PathBreadcrumbsPanel.html | 11 + .../wicket/panels/PathBreadcrumbsPanel.java | 79 +++ src/com/gitblit/wicket/panels/PathLinksPanel.html | 8 + src/com/gitblit/wicket/panels/PathLinksPanel.java | 22 + src/com/gitblit/wicket/panels/RefsPanel.html | 8 + src/com/gitblit/wicket/panels/RefsPanel.java | 66 +++ .../gitblit/wicket/panels/ShortLogLinksPanel.html | 8 + .../gitblit/wicket/panels/ShortLogLinksPanel.java | 23 + src/com/gitblit/wicket/panels/TagLinksPanel.html | 8 + src/com/gitblit/wicket/panels/TagLinksPanel.java | 23 + src/com/gitblit/wicket/panels/TreeLinksPanel.html | 8 + src/com/gitblit/wicket/panels/TreeLinksPanel.java | 29 + src/log4j.properties | 12 + users.properties | 1 + 104 files changed, 4942 insertions(+) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 build.xml create mode 100644 gitblit.cmd create mode 100644 gitblit.properties create mode 100644 makekeystore.cmd create mode 100644 makepassword.cmd create mode 100644 makerepository.cmd create mode 100644 resources/arrow_down.png create mode 100644 resources/arrow_off.png create mode 100644 resources/arrow_up.png create mode 100644 resources/git-favicon.png create mode 100644 resources/gitblit.css create mode 100644 resources/gitblt-logo.png create mode 100644 resources/gitblt.png create mode 100644 resources/gitblt2.png create mode 100644 resources/gitblt3.png create mode 100644 resources/gitblt_25.png create mode 100644 resources/gitweb.css create mode 100644 resources/prettify/lang-apollo.js create mode 100644 resources/prettify/lang-css.js create mode 100644 resources/prettify/lang-hs.js create mode 100644 resources/prettify/lang-lisp.js create mode 100644 resources/prettify/lang-lua.js create mode 100644 resources/prettify/lang-ml.js create mode 100644 resources/prettify/lang-proto.js create mode 100644 resources/prettify/lang-scala.js create mode 100644 resources/prettify/lang-sql.js create mode 100644 resources/prettify/lang-vb.js create mode 100644 resources/prettify/lang-vhdl.js create mode 100644 resources/prettify/lang-wiki.js create mode 100644 resources/prettify/lang-yaml.js create mode 100644 resources/prettify/prettify.css create mode 100644 resources/prettify/prettify.js create mode 100644 service/JavaService.exe create mode 100644 service/JavaService64.exe create mode 100644 service/UninstallService.bat create mode 100644 service/UninstallService64.bat create mode 100644 service/installService.bat create mode 100644 service/installService64.bat create mode 100644 src/com/gitblit/Build.java create mode 100644 src/com/gitblit/Constants.java create mode 100644 src/com/gitblit/GitBlitServer.java create mode 100644 src/com/gitblit/Launcher.java create mode 100644 src/com/gitblit/MakeRepository.java create mode 100644 src/com/gitblit/StoredSettings.java create mode 100644 src/com/gitblit/tests/JGitUtilsTest.java create mode 100644 src/com/gitblit/utils/ByteFormat.java create mode 100644 src/com/gitblit/utils/JGitUtils.java create mode 100644 src/com/gitblit/utils/Utils.java create mode 100644 src/com/gitblit/wicket/BasePage.java create mode 100644 src/com/gitblit/wicket/GitBlitWebApp.java create mode 100644 src/com/gitblit/wicket/GitBlitWebSession.java create mode 100644 src/com/gitblit/wicket/LinkPanel.html create mode 100644 src/com/gitblit/wicket/LinkPanel.java create mode 100644 src/com/gitblit/wicket/RepositoryPage.java create mode 100644 src/com/gitblit/wicket/SecuredPage.java create mode 100644 src/com/gitblit/wicket/WicketUtils.java create mode 100644 src/com/gitblit/wicket/models/PathModel.java create mode 100644 src/com/gitblit/wicket/models/RefModel.java create mode 100644 src/com/gitblit/wicket/models/RepositoryModel.java create mode 100644 src/com/gitblit/wicket/pages/BlobPage.html create mode 100644 src/com/gitblit/wicket/pages/BlobPage.java create mode 100644 src/com/gitblit/wicket/pages/CommitPage.html create mode 100644 src/com/gitblit/wicket/pages/CommitPage.java create mode 100644 src/com/gitblit/wicket/pages/HeadsPage.html create mode 100644 src/com/gitblit/wicket/pages/HeadsPage.java create mode 100644 src/com/gitblit/wicket/pages/LogPage.html create mode 100644 src/com/gitblit/wicket/pages/LogPage.java create mode 100644 src/com/gitblit/wicket/pages/RepositoriesPage.html create mode 100644 src/com/gitblit/wicket/pages/RepositoriesPage.java create mode 100644 src/com/gitblit/wicket/pages/ShortLogPage.html create mode 100644 src/com/gitblit/wicket/pages/ShortLogPage.java create mode 100644 src/com/gitblit/wicket/pages/SummaryPage.html create mode 100644 src/com/gitblit/wicket/pages/SummaryPage.java create mode 100644 src/com/gitblit/wicket/pages/TagPage.html create mode 100644 src/com/gitblit/wicket/pages/TagPage.java create mode 100644 src/com/gitblit/wicket/pages/TagsPage.html create mode 100644 src/com/gitblit/wicket/pages/TagsPage.java create mode 100644 src/com/gitblit/wicket/pages/TreePage.html create mode 100644 src/com/gitblit/wicket/pages/TreePage.java create mode 100644 src/com/gitblit/wicket/panels/HeadLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/HeadLinksPanel.java create mode 100644 src/com/gitblit/wicket/panels/PageFooter.html create mode 100644 src/com/gitblit/wicket/panels/PageFooter.java create mode 100644 src/com/gitblit/wicket/panels/PageHeader.html create mode 100644 src/com/gitblit/wicket/panels/PageHeader.java create mode 100644 src/com/gitblit/wicket/panels/PageLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/PageLinksPanel.java create mode 100644 src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.html create mode 100644 src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java create mode 100644 src/com/gitblit/wicket/panels/PathLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/PathLinksPanel.java create mode 100644 src/com/gitblit/wicket/panels/RefsPanel.html create mode 100644 src/com/gitblit/wicket/panels/RefsPanel.java create mode 100644 src/com/gitblit/wicket/panels/ShortLogLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/ShortLogLinksPanel.java create mode 100644 src/com/gitblit/wicket/panels/TagLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/TagLinksPanel.java create mode 100644 src/com/gitblit/wicket/panels/TreeLinksPanel.html create mode 100644 src/com/gitblit/wicket/panels/TreeLinksPanel.java create mode 100644 src/log4j.properties create mode 100644 users.properties diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..c9073ae4 --- /dev/null +++ b/.classpath @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..10d4ae88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/temp +/lib +/ext +/build +/keystore +/gitblit.zip diff --git a/.project b/.project new file mode 100644 index 00000000..7bb83630 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + gitblit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..258f4f45 --- /dev/null +++ b/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitblit.cmd b/gitblit.cmd new file mode 100644 index 00000000..ce96a797 --- /dev/null +++ b/gitblit.cmd @@ -0,0 +1 @@ +@java -jar gitblit.jar diff --git a/gitblit.properties b/gitblit.properties new file mode 100644 index 00000000..815c646b --- /dev/null +++ b/gitblit.properties @@ -0,0 +1,96 @@ +# +# GIT Servlet Settings +# + +# Base folder for repositories +# Use forward slashes on Windows!! +repositoriesFolder = c:/projects/git + +# Export all repositories +# if false, each exported repository must have a .git/git-daemon-export-ok file +exportAll = true + +# Search repositories folder for nested repositories +nestedRepositories = true + +# The root clone url +cloneUrl = https://localhost/git/ + +# +# Authentication Settings +# + +# Require authentication for http push/pull of git repositories +authenticateAccess = true + +# Simple user realm file to authenticate users for push/pull +realmFile = users.properties + +# User roles for push/pull git repository access +# (* is the wildcard for any role) +gitRoles = * + +# User roles for administrative features such +# as create repository, edit repository description, +# and set repository owner. +# (* is the wildcard for any role) +adminRoles = * + +# +# Server Settings +# +debug = true +tempFolder = temp +log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n +# Aggressive garbage collection will run the collector on every generated page +# this slows down page generation but improves heap consumption +aggressiveGC = true + +# +# Git:Blit UI Settings +# +siteName = Git:Blit +allowAdministration = true +indexMessage = Welcome to Git:Blit!
A quick and easy way to host your own GIT repositories.
Built with JGit, Wicket, google-code-prettify, Jetty, SLF4J, Log4j, and JCommander. +timestampFormat = h:mm a + +datestampShortFormat = yyyy-MM-dd +datestampLongFormat = EEEE, MMMM d, yyyy + +datetimestampShortFormat = yyyy-MM-dd h:mm a +datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a + +# Registered extensions for google-code-prettify +prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb + +# Image extensions +imageExtensions = bmp jpg gif png + +# Registered extensions for binary blobs +binaryExtensions = jar pdf tar.gz zip + +# Example global regex substitutions +regex.global.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!Bug-Id: $3 +regex.global.changeid = \\b(Change-Id:\\s*)([A-Za-z0-9]*)\\b!!!Change-Id: $2 + +# Example per-repository regex substitutions overrides global +regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!Bug-Id: $3 + +# +# Jetty Settings +# + +# use NIO connectors. If false, socket connectors will be used. +useNio = true + +# Standard http port to serve. <= 0 disables this connector. +httpPort = 0 + +# Secure/SSL https port to serve. <= 0 disables this connector. +httpsPort = 443 + +# Password for SSL keystore (keystore password and certificate password must match) +storePassword = dosomegit + +# Port for shutdown monitor to listen on. +shutdownPort = 8081 diff --git a/makekeystore.cmd b/makekeystore.cmd new file mode 100644 index 00000000..34a11b21 --- /dev/null +++ b/makekeystore.cmd @@ -0,0 +1,2 @@ +@del keystore +@keytool -keystore keystore -alias localhost -genkey -keyalg RSA -dname "CN=localhost, OU=Git:Blit, O=Git:Blit, L=Some Town, ST=Some State, C=US" \ No newline at end of file diff --git a/makepassword.cmd b/makepassword.cmd new file mode 100644 index 00000000..0257e870 --- /dev/null +++ b/makepassword.cmd @@ -0,0 +1,12 @@ +@if [%1]==[] goto missingparameters +@if [%2]==[] goto missingparameters + +@java -cp "%CD%\ext\*" org.eclipse.jetty.http.security.Password %1 %2 +@goto end + +:missingparameters +@echo Usage: +@echo makepassword username password +@echo. + +:end \ No newline at end of file diff --git a/makerepository.cmd b/makerepository.cmd new file mode 100644 index 00000000..660e2d78 --- /dev/null +++ b/makerepository.cmd @@ -0,0 +1,11 @@ +@if [%1]==[] goto missingparameters + +@java -cp gitblit.jar;"%CD%\lib\*" com.gitblit.MakeRepository --create %1 +@goto end + +:missingparameters +@echo Usage: +@echo makerepository path_to_repository +@echo. + +:end \ No newline at end of file diff --git a/resources/arrow_down.png b/resources/arrow_down.png new file mode 100644 index 00000000..f31cc819 Binary files /dev/null and b/resources/arrow_down.png differ diff --git a/resources/arrow_off.png b/resources/arrow_off.png new file mode 100644 index 00000000..f9b1ced2 Binary files /dev/null and b/resources/arrow_off.png differ diff --git a/resources/arrow_up.png b/resources/arrow_up.png new file mode 100644 index 00000000..63031c33 Binary files /dev/null and b/resources/arrow_up.png differ diff --git a/resources/git-favicon.png b/resources/git-favicon.png new file mode 100644 index 00000000..aae35a70 Binary files /dev/null and b/resources/git-favicon.png differ diff --git a/resources/gitblit.css b/resources/gitblit.css new file mode 100644 index 00000000..d81c063d --- /dev/null +++ b/resources/gitblit.css @@ -0,0 +1,56 @@ +/* + JGitWeb css. +*/ +body, table, tr, th, td { font-size: 13px; } + +table.object_header td, div.page_body, table.diff_tree td { + font-size: 12px; +} + +table.diff_tree td div.link { + padding: 2px 5px; + font-family: sans-serif; + font-size: 9px; +} + +div.link { + padding: 2px 5px; + font-family: sans-serif; + font-size: 9px; +} + +pre.prettyprint, pre.plainprint { + font-size:12px; + border:0px; +} + +div.page_nav2 { + padding: 0px 8px 8px 8px; +} + +table.project_list tr th a { padding-right: 15px; background-position: right; background-repeat:no-repeat; } +table.project_list tr th.wicket_orderDown a {font-weight: bold; background-image: url(arrow_down.png); } +table.project_list tr th.wicket_orderUp a { font-weight: bold; background-image: url(arrow_up.png); } +table.project_list tr th.wicket_orderNone a { font-weight: normal; background-image: url(arrow_off.png); } + +/* age0: age < 60*60*2 */ +table.project_list .age0 { + color: #009900; + font-style: italic; + font-weight: bold; +} + +/* age1: 60*60*2 <= age < 60*60*24*2 */ +table.project_list .age1 { + color: #009900; + font-style: italic; +} + +/* age2: 60*60*24*2 <= age */ +table.project_list .age2 { + font-style: italic; +} + +table.diff_tree td.size { + width:80px; +} \ No newline at end of file diff --git a/resources/gitblt-logo.png b/resources/gitblt-logo.png new file mode 100644 index 00000000..7ec945b5 Binary files /dev/null and b/resources/gitblt-logo.png differ diff --git a/resources/gitblt.png b/resources/gitblt.png new file mode 100644 index 00000000..7535bc3c Binary files /dev/null and b/resources/gitblt.png differ diff --git a/resources/gitblt2.png b/resources/gitblt2.png new file mode 100644 index 00000000..c1642941 Binary files /dev/null and b/resources/gitblt2.png differ diff --git a/resources/gitblt3.png b/resources/gitblt3.png new file mode 100644 index 00000000..f178d03c Binary files /dev/null and b/resources/gitblt3.png differ diff --git a/resources/gitblt_25.png b/resources/gitblt_25.png new file mode 100644 index 00000000..ad580fad Binary files /dev/null and b/resources/gitblt_25.png differ diff --git a/resources/gitweb.css b/resources/gitweb.css new file mode 100644 index 00000000..4bf6e23a --- /dev/null +++ b/resources/gitweb.css @@ -0,0 +1,604 @@ +body { + font-family: sans-serif; + font-size: small; + border: solid #d9d8d1; + border-width: 1px; + margin: 10px; + background-color: #ffffff; + color: #000000; +} + +a { + color: #0000cc; +} + +a:hover, a:visited, a:active { + color: #880000; +} + +span.cntrl { + border: dashed #aaaaaa; + border-width: 1px; + padding: 0px 2px 0px 2px; + margin: 0px 2px 0px 2px; +} + +img.logo { + float: right; + border-width: 0px; +} + +img.avatar { + vertical-align: middle; +} + +a.list img.avatar { + border-style: none; +} + +div.page_header { + height: 25px; + padding: 8px; + font-size: 150%; + font-weight: bold; + background-color: #d9d8d1; +} + +div.page_header a:visited, a.header { + color: #0000cc; +} + +div.page_header a:hover { + color: #880000; +} + +div.page_nav { + padding: 8px; +} + +div.page_nav a:visited { + color: #0000cc; +} + +div.page_path { + padding: 8px; + font-weight: bold; + border: solid #d9d8d1; + border-width: 0px 0px 1px; +} + +div.cachetime { + float: left; + margin-right: 10px; + color: #555555; +} + +div.page_footer { + height: 17px; + padding: 4px 8px; + background-color: #d9d8d1; +} + +div.page_footer_text { + float: left; + color: #555555; + font-style: italic; +} + +div#generating_info { + margin: 4px; + font-size: smaller; + text-align: center; + color: #505050; +} + +div.page_body { + padding: 8px; + font-family: monospace; +} + +div.title, a.title { + display: block; + padding: 6px 8px; + font-weight: bold; + background-color: #edece6; + text-decoration: none; + color: #000000; +} + +div.readme { + padding: 8px; +} + +a.title:hover { + background-color: #d9d8d1; +} + +div.title_text { + padding: 6px 0px; + border: solid #d9d8d1; + border-width: 0px 0px 1px; + font-family: monospace; +} + +div.log_body { + padding: 8px 8px 8px 150px; +} + +span.age { + position: relative; + float: left; + width: 142px; + font-style: italic; +} + +span.signoff { + color: #888888; +} + +div.log_link { + padding: 0px 8px; + font-size: 70%; + font-family: sans-serif; + font-style: normal; + position: relative; + float: left; + width: 136px; +} + +div.list_head { + padding: 6px 8px 4px; + border: solid #d9d8d1; + border-width: 1px 0px 0px; + font-style: italic; +} + +.author_date, .author { + font-style: italic; +} + +div.author_date { + padding: 8px; + border: solid #d9d8d1; + border-width: 0px 0px 1px 0px; +} + +a.list { + text-decoration: none; + color: #000000; +} + +a.subject, a.name { + font-weight: bold; +} + +table.tags a.subject { + font-weight: normal; +} + +a.list:hover { + text-decoration: underline; + color: #880000; +} + +a.text { + text-decoration: none; + color: #0000cc; +} + +a.text:visited { + text-decoration: none; + color: #880000; +} + +a.text:hover { + text-decoration: underline; + color: #880000; +} + +table { + padding: 8px 4px; + border-spacing: 0; +} + +table.diff_tree { + font-family: monospace; +} + +table.combined.diff_tree th { + text-align: center; +} + +table.combined.diff_tree td { + padding-right: 24px; +} + +table.combined.diff_tree th.link, +table.combined.diff_tree td.link { + padding: 0px 2px; +} + +table.combined.diff_tree td.nochange a { + color: #6666ff; +} + +table.combined.diff_tree td.nochange a:hover, +table.combined.diff_tree td.nochange a:visited { + color: #d06666; +} + +table.blame { + border-collapse: collapse; +} + +table.blame td { + padding: 0px 5px; + font-size: 100%; + vertical-align: top; +} + +th { + padding: 2px 5px; + font-size: 100%; + text-align: left; +} + +/* do not change row style on hover for 'blame' view */ +tr.light, +table.blame .light:hover { + background-color: #ffffff; +} + +tr.dark, +table.blame .dark:hover { + background-color: #f6f6f0; +} + +/* currently both use the same, but it can change */ +tr.light:hover, +tr.dark:hover { + background-color: #edece6; +} + +/* boundary commits in 'blame' view */ +/* and commits without "previous" */ +tr.boundary td.sha1, +tr.no-previous td.linenr { + font-weight: bold; +} + +/* for 'blame_incremental', during processing */ +tr.color1 { background-color: #f6fff6; } +tr.color2 { background-color: #f6f6ff; } +tr.color3 { background-color: #fff6f6; } + +td { + padding: 2px 5px; + font-size: 100%; + vertical-align: top; +} + +td.link, td.selflink { + padding: 2px 5px; + font-family: sans-serif; + font-size: 70%; +} + +td.selflink { + padding-right: 0px; +} + +td.sha1 { + font-family: monospace; +} + +.error { + color: red; + background-color: yellow; +} + +td.current_head { + text-decoration: underline; +} + +table.diff_tree span.file_status.new { + color: #008000; +} + +table.diff_tree span.file_status.deleted { + color: #c00000; +} + +table.diff_tree span.file_status.moved, +table.diff_tree span.file_status.mode_chnge { + color: #777777; +} + +table.diff_tree span.file_status.copied { + color: #70a070; +} + +/* noage: "No commits" */ +table.project_list td.noage { + color: #808080; + font-style: italic; +} + +/* age2: 60*60*24*2 <= age */ +table.project_list td.age2, table.blame td.age2 { + font-style: italic; +} + +/* age1: 60*60*2 <= age < 60*60*24*2 */ +table.project_list td.age1 { + color: #009900; + font-style: italic; +} + +table.blame td.age1 { + color: #009900; + background: transparent; +} + +/* age0: age < 60*60*2 */ +table.project_list td.age0 { + color: #009900; + font-style: italic; + font-weight: bold; +} + +table.blame td.age0 { + color: #009900; + background: transparent; + font-weight: bold; +} + +td.pre, div.pre, div.diff { + font-family: monospace; + font-size: 12px; + white-space: pre; +} + +td.mode { + font-family: monospace; +} + +/* progress of blame_interactive */ +div#progress_bar { + height: 2px; + margin-bottom: -2px; + background-color: #d8d9d0; +} +div#progress_info { + float: right; + text-align: right; +} + +/* format of (optional) objects size in 'tree' view */ +td.size { + font-family: monospace; + text-align: right; +} + +/* styling of diffs (patchsets): commitdiff and blobdiff views */ +div.diff.header, +div.diff.extended_header { + white-space: normal; +} + +div.diff.header { + font-weight: bold; + + background-color: #edece6; + + margin-top: 4px; + padding: 4px 0px 2px 0px; + border: solid #d9d8d1; + border-width: 1px 0px 1px 0px; +} + +div.diff.header a.path { + text-decoration: underline; +} + +div.diff.extended_header, +div.diff.extended_header a.path, +div.diff.extended_header a.hash { + color: #777777; +} + +div.diff.extended_header .info { + color: #b0b0b0; +} + +div.diff.extended_header { + background-color: #f6f5ee; + padding: 2px 0px 2px 0px; +} + +div.diff a.list, +div.diff a.path, +div.diff a.hash { + text-decoration: none; +} + +div.diff a.list:hover, +div.diff a.path:hover, +div.diff a.hash:hover { + text-decoration: underline; +} + +div.diff.to_file a.path, +div.diff.to_file { + color: #007000; +} + +div.diff.add { + color: #008800; +} + +div.diff.from_file a.path, +div.diff.from_file { + color: #aa0000; +} + +div.diff.rem { + color: #cc0000; +} + +div.diff.chunk_header a, +div.diff.chunk_header { + color: #990099; +} + +div.diff.chunk_header { + border: dotted #ffe0ff; + border-width: 1px 0px 0px 0px; + margin-top: 2px; +} + +div.diff.chunk_header span.chunk_info { + background-color: #ffeeff; +} + +div.diff.chunk_header span.section { + color: #aa22aa; +} + +div.diff.incomplete { + color: #cccccc; +} + +div.diff.nodifferences { + font-weight: bold; + color: #600000; +} + +div.index_include { + border: solid #d9d8d1; + border-width: 0px 0px 1px; + padding: 12px 8px; +} + +div.search { + font-size: 100%; + font-weight: normal; + margin: 4px 8px; + float: right; + top: 56px; + right: 12px +} + +p.projsearch { + text-align: center; +} + +td.linenr { + text-align: right; +} + +a.linenr { + color: #999999; + text-decoration: none +} + +a.rss_logo { + float: right; + padding: 3px 0px; + width: 35px; + line-height: 10px; + border: 1px solid; + border-color: #fcc7a5 #7d3302 #3e1a01 #ff954e; + color: #ffffff; + background-color: #ff6600; + font-weight: bold; + font-family: sans-serif; + font-size: 70%; + text-align: center; + text-decoration: none; +} + +a.rss_logo:hover { + background-color: #ee5500; +} + +a.rss_logo.generic { + background-color: #ff8800; +} + +a.rss_logo.generic:hover { + background-color: #ee7700; +} + +span.refs span { + padding: 0px 4px; + font-size: 70%; + font-weight: normal; + border: 1px solid; + background-color: #ffaaff; + border-color: #ffccff #ff00ee #ff00ee #ffccff; +} + +span.refs span a { + text-decoration: none; + color: inherit; +} + +span.refs span a:hover { + text-decoration: underline; +} + +span.refs span.indirect { + font-style: italic; +} + +span.refs span.ref { + background-color: #aaaaff; + border-color: #ccccff #0033cc #0033cc #ccccff; +} + +span.refs span.tag { + background-color: #ffffaa; + border-color: #ffffcc #ffee00 #ffee00 #ffffcc; +} + +span.refs span.head { + background-color: #aaffaa; + border-color: #ccffcc #00cc33 #00cc33 #ccffcc; +} + +span.atnight { + color: #cc0000; +} + +span.match { + color: #e00000; +} + +div.binary { + font-style: italic; +} + +div.remote { + margin: .5em; + border: 1px solid #d9d8d1; + display: inline-block; +} + +/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */ + +/* Highlighting theme definition: */ + +.num { color:#2928ff; } +.esc { color:#ff00ff; } +.str { color:#ff0000; } +.dstr { color:#818100; } +.slc { color:#838183; font-style:italic; } +.com { color:#838183; font-style:italic; } +.dir { color:#008200; } +.sym { color:#000000; } +.line { color:#555555; } +.kwa { color:#000000; font-weight:bold; } +.kwb { color:#830000; } +.kwc { color:#000000; font-weight:bold; } +.kwd { color:#010181; } diff --git a/resources/prettify/lang-apollo.js b/resources/prettify/lang-apollo.js new file mode 100644 index 00000000..bfc0014c --- /dev/null +++ b/resources/prettify/lang-apollo.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\r\n]*/,null,"#"],["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, +null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["apollo","agc","aea"]) \ No newline at end of file diff --git a/resources/prettify/lang-css.js b/resources/prettify/lang-css.js new file mode 100644 index 00000000..61157f38 --- /dev/null +++ b/resources/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], +["com",/^(?: +
+ + +
+ + + + + +
+ + +
+ + +

+	
+	
+	
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java new file mode 100644 index 00000000..979bb261 --- /dev/null +++ b/src/com/gitblit/wicket/pages/BlobPage.java @@ -0,0 +1,94 @@ +package com.gitblit.wicket.pages; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.wicket.Component; +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.StoredSettings; +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.panels.PathBreadcrumbsPanel; + + +public class BlobPage extends RepositoryPage { + + public BlobPage(PageParameters params) { + super(params, "blob"); + + final String blobPath = params.getString("f", null); + + Repository r = getRepository(); + RevCommit commit = JGitUtils.getCommit(r, commitId); + + // blob page links + add(new Label("historyLink", "history")); + add(new Label("rawLink", "raw")); + add(new Label("headLink", "HEAD")); + + add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter())); + + add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, commitId)); + String extension = null; + if (blobPath.lastIndexOf('.') > -1) { + extension = blobPath.substring(blobPath.lastIndexOf('.') + 1); + } + + // Map the extensions to types + Map map = new HashMap(); + for (String ext : StoredSettings.getStrings("prettyPrintExtensions")) { + map.put(ext.toLowerCase(), 1); + } + for (String ext : StoredSettings.getStrings("imageExtensions")) { + map.put(ext.toLowerCase(), 2); + } + for (String ext : StoredSettings.getStrings("binaryExtensions")) { + map.put(ext.toLowerCase(), 3); + } + + if (extension != null) { + int type = 0; + if (map.containsKey(extension)) { + type = map.get(extension); + } + Component c = null; + switch (type) { + case 1: + // PrettyPrint blob text + c = new Label("blobText", JGitUtils.getRawContentAsString(r, commit, blobPath)); + WicketUtils.setCssClass(c, "prettyprint"); + break; + case 2: + // TODO image blobs + c = new Label("blobText", "Image File"); + break; + case 3: + // TODO binary blobs + c = new Label("blobText", "Binary File"); + break; + default: + // plain text + c = new Label("blobText", JGitUtils.getRawContentAsString(r, commit, blobPath)); + WicketUtils.setCssClass(c, "plainprint"); + } + add(c); + } else { + // plain text + Label blobLabel = new Label("blobText", JGitUtils.getRawContentAsString(r, commit, blobPath)); + WicketUtils.setCssClass(blobLabel, "plainprint"); + add(blobLabel); + } + + // close repository + r.close(); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/CommitPage.html b/src/com/gitblit/wicket/pages/CommitPage.html new file mode 100644 index 00000000..a493e047 --- /dev/null +++ b/src/com/gitblit/wicket/pages/CommitPage.html @@ -0,0 +1,51 @@ + + + + +
+ + +
+ + + + + +
+ + +
+ + +
+ + + + + + + + +
authorMessage goes here
Message goes here
committerMessage goes here
Message goes here
commitMessage goes here
treeMessage goes here
parent +
Message goes here
+
+ + +
+ + +
+ + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java new file mode 100644 index 00000000..ad1fce06 --- /dev/null +++ b/src/com/gitblit/wicket/pages/CommitPage.java @@ -0,0 +1,106 @@ +package com.gitblit.wicket.pages; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.GitBlitWebSession; +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.panels.PathLinksPanel; + + +public class CommitPage extends RepositoryPage { + + public CommitPage(PageParameters params) { + super(params, "commit"); + + final String commitId = params.getString("h", ""); + + Repository r = getRepository(); + RevCommit c = JGitUtils.getCommit(r, commitId); + + List parents = new ArrayList(); + if (c.getParentCount() > 0) { + for (RevCommit parent : c.getParents()) { + parents.add(parent.name()); + } + } + + // commit page links + if (parents.size() == 0) { + add(new Label("parentLink", "none")); + } else { + add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, newCommitParameter(parents.get(0)))); + } + add(new Label("patchLink", "patch")); + + add(new LinkPanel("shortlog", "title", c.getShortMessage(), ShortLogPage.class, newRepositoryParameter())); + + addRefs(r, c); + + add(new Label("commitAuthor", JGitUtils.getDisplayName(c.getAuthorIdent()))); + String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen()); + add(new Label("commitAuthorDate", authorDate)); + + add(new Label("commitCommitter", JGitUtils.getDisplayName(c.getCommitterIdent()))); + String comitterDate = GitBlitWebSession.get().formatDateTimeLong(c.getCommitterIdent().getWhen()); + add(new Label("commitCommitterDate", comitterDate)); + + add(new Label("commitId", c.getName())); + + add(new LinkPanel("commitTree", "list", c.getTree().getName(), TreePage.class, newCommitParameter())); + + // Parent Commits + ListDataProvider parentsDp = new ListDataProvider(parents); + DataView parentsView = new DataView("commitParents", parentsDp) { + private static final long serialVersionUID = 1L; + + public void populateItem(final Item item) { + String entry = item.getModelObject(); + item.add(new LinkPanel("commitParent", "list", entry, CommitPage.class, newCommitParameter(entry))); + } + }; + add(parentsView); + + addFullText("fullMessage", c.getFullMessage(), true); + + // changed paths list + List paths = JGitUtils.getCommitChangedPaths(r, c); + ListDataProvider pathsDp = new ListDataProvider(paths); + DataView pathsView = new DataView("changedPath", pathsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final PathModel entry = item.getModelObject(); + if (entry.isTree()) { + item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path))); + } else { + item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path))); + } + item.add(new PathLinksPanel("pathLinks", repositoryName, entry)); + String clazz = counter % 2 == 0 ? "dark" : "light"; + WicketUtils.setCssClass(item, clazz); + counter++; + } + }; + add(pathsView); + + // close repository + r.close(); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/HeadsPage.html b/src/com/gitblit/wicket/pages/HeadsPage.html new file mode 100644 index 00000000..cd914363 --- /dev/null +++ b/src/com/gitblit/wicket/pages/HeadsPage.html @@ -0,0 +1,26 @@ + + + + +
+ + +
+ + +
+ + + + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/HeadsPage.java b/src/com/gitblit/wicket/pages/HeadsPage.java new file mode 100644 index 00000000..df5e00f0 --- /dev/null +++ b/src/com/gitblit/wicket/pages/HeadsPage.java @@ -0,0 +1,63 @@ +package com.gitblit.wicket.pages; + +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.Repository; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.utils.Utils; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.models.RefModel; + + +public class HeadsPage extends RepositoryPage { + + public HeadsPage(PageParameters params) { + super(params, "heads"); + + Repository r = getRepository(); + List tags = JGitUtils.getHeads(r, -1); + r.close(); + + // shortlog + add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); + + ListDataProvider tagsDp = new ListDataProvider(tags); + DataView tagView = new DataView("head", tagsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RefModel entry = item.getModelObject(); + String date; + if (entry.getDate() != null) { + date = Utils.timeAgo(entry.getDate()); + } else { + date = ""; + } + Label headDateLabel = new Label("headDate", date); + item.add(headDateLabel); + WicketUtils.setCssClass(headDateLabel, Utils.timeAgoCss(entry.getDate())); + + item.add(new LinkPanel("headName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName()))); + + String clazz = counter % 2 == 0 ? "dark" : "light"; + WicketUtils.setCssClass(item, clazz); + counter++; + } + }; + tagView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT); + add(tagView); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/LogPage.html b/src/com/gitblit/wicket/pages/LogPage.html new file mode 100644 index 00000000..3c1b54b9 --- /dev/null +++ b/src/com/gitblit/wicket/pages/LogPage.html @@ -0,0 +1,33 @@ + + + + +
+ + +
+ + +
+ + +
+
+ + +
+
+
+ + + +
+
+
+ +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/LogPage.java b/src/com/gitblit/wicket/pages/LogPage.java new file mode 100644 index 00000000..325596ab --- /dev/null +++ b/src/com/gitblit/wicket/pages/LogPage.java @@ -0,0 +1,69 @@ +package com.gitblit.wicket.pages; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.navigation.paging.PagingNavigator; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.utils.Utils; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.GitBlitWebSession; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.panels.RefsPanel; + + +public class LogPage extends RepositoryPage { + + public LogPage(PageParameters params) { + super(params, "log"); + + Repository r = getRepository(); + final Map> allRefs = JGitUtils.getAllRefs(r); + List commits = JGitUtils.getRevLog(r, 100); + r.close(); + + add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); + + // log + ListDataProvider dp = new ListDataProvider(commits); + DataView logView = new DataView("commit", dp) { + private static final long serialVersionUID = 1L; + + public void populateItem(final Item item) { + final RevCommit entry = item.getModelObject(); + final Date date = JGitUtils.getCommitDate(entry); + + item.add(new Label("timeAgo", Utils.timeAgo(date))); + + item.add(new LinkPanel("link", "title", entry.getShortMessage(), CommitPage.class, newCommitParameter(entry.getName()))); + + item.add(new RefsPanel("commitRefs", entry, allRefs)); + + String author = entry.getAuthorIdent().getName(); + item.add(createAuthorLabel("commitAuthor", author)); + + item.add(new Label("commitDate", GitBlitWebSession.get().formatDateTimeLong(date))); + + item.add(new Label("fullMessage", WicketUtils.breakLines(entry.getFullMessage())).setEscapeModelStrings(false)); + } + }; + logView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT); + add(logView); + add(new PagingNavigator("navigator", logView)); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/RepositoriesPage.html b/src/com/gitblit/wicket/pages/RepositoriesPage.html new file mode 100644 index 00000000..6a3054f1 --- /dev/null +++ b/src/com/gitblit/wicket/pages/RepositoriesPage.html @@ -0,0 +1,29 @@ + + + +
+
+ + + + + + + + + + + + + + + + + + +
RepositoryDescriptionOwnerLast Change
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/RepositoriesPage.java b/src/com/gitblit/wicket/pages/RepositoriesPage.java new file mode 100644 index 00000000..1c880d9f --- /dev/null +++ b/src/com/gitblit/wicket/pages/RepositoriesPage.java @@ -0,0 +1,151 @@ +package com.gitblit.wicket.pages; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByBorder; +import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; +import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; + +import com.gitblit.StoredSettings; +import com.gitblit.utils.Utils; +import com.gitblit.wicket.BasePage; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.models.RepositoryModel; +import com.gitblit.wicket.panels.PageFooter; +import com.gitblit.wicket.panels.PageHeader; + + +public class RepositoriesPage extends BasePage { + + public RepositoriesPage() { + add(new PageHeader("pageHeader")); + + add(new Label("indexInclude", StoredSettings.getString("indexMessage", "")).setEscapeModelStrings(false)); + + List rows = GitBlitWebApp.get().getRepositories(getRequest()); + DataProvider dp = new DataProvider(rows); + DataView dataView = new DataView("repository", dp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RepositoryModel entry = item.getModelObject(); + PageParameters pp = new PageParameters("p=" + entry.name); + item.add(new LinkPanel("repositoryName", "list", entry.name, SummaryPage.class, pp)); + item.add(new LinkPanel("repositoryDescription", "list", entry.description, SummaryPage.class, pp)); + item.add(new Label("repositoryOwner", entry.owner)); + + String lastChange = Utils.timeAgo(entry.lastChange); + Label lastChangeLabel = new Label("repositoryLastChange", lastChange); + item.add(lastChangeLabel); + WicketUtils.setCssClass(lastChangeLabel, Utils.timeAgoCss(entry.lastChange)); + + String clazz = counter % 2 == 0 ? "dark" : "light"; + WicketUtils.setCssClass(item, clazz); + counter++; + } + }; + add(dataView); + + add(newSort("orderByRepository", SortBy.repository, dp, dataView)); + add(newSort("orderByDescription", SortBy.description, dp, dataView)); + add(newSort("orderByOwner", SortBy.owner, dp, dataView)); + add(newSort("orderByDate", SortBy.date, dp, dataView)); + + add(new PageFooter("pageFooter")); + } + + protected enum SortBy { + repository, description, owner, date; + } + + protected OrderByBorder newSort(String wicketId, SortBy field, SortableDataProvider dp, final DataView dataView) { + return new OrderByBorder(wicketId, field.name(), dp) { + private static final long serialVersionUID = 1L; + + @Override + protected void onSortChanged() { + dataView.setCurrentPage(0); + } + }; + } + + private class DataProvider extends SortableDataProvider { + private static final long serialVersionUID = 1L; + private List list = null; + + protected DataProvider(List list) { + this.list = list; + setSort(SortBy.date.name(), false); + } + + @Override + public int size() { + if (list == null) + return 0; + return list.size(); + } + + @Override + public IModel model(RepositoryModel header) { + return new Model(header); + } + + @Override + public Iterator iterator(int first, int count) { + SortParam sp = getSort(); + String prop = sp.getProperty(); + final boolean asc = sp.isAscending(); + + if (prop == null || prop.equals(SortBy.date.name())) { + Collections.sort(list, new Comparator() { + @Override + public int compare(RepositoryModel o1, RepositoryModel o2) { + if (asc) + return o1.lastChange.compareTo(o2.lastChange); + return o2.lastChange.compareTo(o1.lastChange); + } + }); + } else if (prop.equals(SortBy.repository.name())) { + Collections.sort(list, new Comparator() { + @Override + public int compare(RepositoryModel o1, RepositoryModel o2) { + if (asc) + return o1.name.compareTo(o2.name); + return o2.name.compareTo(o1.name); + } + }); + } else if (prop.equals(SortBy.owner.name())) { + Collections.sort(list, new Comparator() { + @Override + public int compare(RepositoryModel o1, RepositoryModel o2) { + if (asc) + return o1.owner.compareTo(o2.owner); + return o2.owner.compareTo(o1.owner); + } + }); + } else if (prop.equals(SortBy.description.name())) { + Collections.sort(list, new Comparator() { + @Override + public int compare(RepositoryModel o1, RepositoryModel o2) { + if (asc) + return o1.description.compareTo(o2.description); + return o2.description.compareTo(o1.description); + } + }); + } + return list.subList(first, first + count).iterator(); + } + } +} diff --git a/src/com/gitblit/wicket/pages/ShortLogPage.html b/src/com/gitblit/wicket/pages/ShortLogPage.html new file mode 100644 index 00000000..b10e90d6 --- /dev/null +++ b/src/com/gitblit/wicket/pages/ShortLogPage.html @@ -0,0 +1,31 @@ + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/ShortLogPage.java b/src/com/gitblit/wicket/pages/ShortLogPage.java new file mode 100644 index 00000000..220874e8 --- /dev/null +++ b/src/com/gitblit/wicket/pages/ShortLogPage.java @@ -0,0 +1,76 @@ +package com.gitblit.wicket.pages; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.navigation.paging.PagingNavigator; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.panels.RefsPanel; +import com.gitblit.wicket.panels.ShortLogLinksPanel; + + +public class ShortLogPage extends RepositoryPage { + + public ShortLogPage(PageParameters params) { + super(params, "shortlog"); + + Repository r = getRepository(); + final Map> allRefs = JGitUtils.getAllRefs(r); + List commits = JGitUtils.getRevLog(r, 100); + r.close(); + + // shortlog + add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); + + ListDataProvider dp = new ListDataProvider(commits); + DataView shortlogView = new DataView("commit", dp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RevCommit entry = item.getModelObject(); + final Date date = JGitUtils.getCommitDate(entry); + + item.add(createShortlogDateLabel("commitDate", date)); + + String author = entry.getAuthorIdent().getName(); + item.add(createAuthorLabel("commitAuthor", author)); + + String shortMessage = entry.getShortMessage(); + String trimmedMessage = trimShortLog(shortMessage); + LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, newCommitParameter(entry.getName())); + if (!shortMessage.equals(trimmedMessage)) { + WicketUtils.setHtmlTitle(shortlog, shortMessage); + } + item.add(shortlog); + + item.add(new RefsPanel("commitRefs", entry, allRefs)); + + item.add(new ShortLogLinksPanel("commitLinks", repositoryName, entry.getName())); + + String clazz = counter % 2 == 0 ? "dark" : "light"; + WicketUtils.setCssClass(item, clazz); + counter++; + } + }; + shortlogView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT); + add(shortlogView); + add(new PagingNavigator("navigator", shortlogView)); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/SummaryPage.html b/src/com/gitblit/wicket/pages/SummaryPage.html new file mode 100644 index 00000000..3eab0a1e --- /dev/null +++ b/src/com/gitblit/wicket/pages/SummaryPage.html @@ -0,0 +1,76 @@ + + + + +
+ + +
+ + +
 
+ + + + + +
descriptionMessage goes here
ownerMessage goes here
last changeMessage goes here
+ + + +
+ + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java new file mode 100644 index 00000000..84e78b4e --- /dev/null +++ b/src/com/gitblit/wicket/pages/SummaryPage.java @@ -0,0 +1,149 @@ +package com.gitblit.wicket.pages; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.GitBlitWebSession; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.models.RefModel; +import com.gitblit.wicket.panels.HeadLinksPanel; +import com.gitblit.wicket.panels.RefsPanel; +import com.gitblit.wicket.panels.ShortLogLinksPanel; +import com.gitblit.wicket.panels.TagLinksPanel; + + +public class SummaryPage extends RepositoryPage { + + public SummaryPage(PageParameters params) { + super(params, "summary"); + + Repository r = getRepository(); + final Map> allRefs = JGitUtils.getAllRefs(r); + + String owner = JGitUtils.getRepositoryOwner(r); + GitBlitWebSession session = GitBlitWebSession.get(); + String lastchange = session.formatDateTimeLong(JGitUtils.getLastChange(r)); + String cloneurl = GitBlitWebApp.get().getCloneUrl(repositoryName); + + // repository description + add(new Label("repositoryDescription", description)); + add(new Label("repositoryOwner", owner)); + add(new Label("repositoryLastChange", lastchange)); + add(new Label("repositoryCloneUrl", cloneurl)); + + int summaryCount = 16; + + // shortlog + add(new LinkPanel("shortlog", "title", "shortlog", ShortLogPage.class, newRepositoryParameter())); + + List commits = JGitUtils.getRevLog(r, summaryCount); + ListDataProvider dp = new ListDataProvider(commits); + DataView shortlogView = new DataView("commit", dp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + RevCommit entry = item.getModelObject(); + Date date = JGitUtils.getCommitDate(entry); + + item.add(createShortlogDateLabel("commitDate", date)); + + String author = entry.getAuthorIdent().getName(); + item.add(createAuthorLabel("commitAuthor", author)); + + String shortMessage = entry.getShortMessage(); + String trimmedMessage = trimShortLog(shortMessage); + LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, newCommitParameter(entry.getName())); + if (!shortMessage.equals(trimmedMessage)) { + WicketUtils.setHtmlTitle(shortlog, shortMessage); + } + item.add(shortlog); + + item.add(new RefsPanel("commitRefs", entry, allRefs)); + + item.add(new ShortLogLinksPanel("commitLinks", repositoryName, entry.getName())); + + setAlternatingBackground(item, counter); + counter++; + } + }; + add(shortlogView); + add(new LinkPanel("shortlogMore", "link", "...", ShortLogPage.class, newRepositoryParameter())); + + // tags + List tags = JGitUtils.getTags(r, summaryCount); + add(new LinkPanel("tags", "title", "tags", TagsPage.class, newRepositoryParameter())); + + ListDataProvider tagsDp = new ListDataProvider(tags); + DataView tagView = new DataView("tag", tagsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RefModel entry = item.getModelObject(); + + item.add(createDateLabel("tagDate", entry.getDate())); + + item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getCommitId().getName()))); + + if (entry.getCommitId().equals(entry.getObjectId())) { + // lightweight tag on commit object + item.add(new Label("tagDescription", "")); + } else { + // tag object + item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName()))); + } + + item.add(new TagLinksPanel("tagLinks", repositoryName, entry)); + + setAlternatingBackground(item, counter); + counter++; + } + }; + add(tagView); + add(new LinkPanel("tagsMore", "link", "...", TagsPage.class, newRepositoryParameter())); + // heads + List heads = JGitUtils.getHeads(r, summaryCount); + add(new LinkPanel("heads", "title", "heads", HeadsPage.class, newRepositoryParameter())); + + ListDataProvider headsDp = new ListDataProvider(heads); + DataView headsView = new DataView("head", headsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RefModel entry = item.getModelObject(); + + item.add(createDateLabel("headDate", entry.getDate())); + + item.add(new LinkPanel("headName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName()))); + + item.add(new HeadLinksPanel("headLinks", repositoryName, entry)); + + setAlternatingBackground(item, counter); + counter++; + } + }; + add(headsView); + + // close the repository + r.close(); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/TagPage.html b/src/com/gitblit/wicket/pages/TagPage.html new file mode 100644 index 00000000..ae2c99c2 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TagPage.html @@ -0,0 +1,28 @@ + + + + +
+ + +
+ + +
+ + +
+ + + + +
objectMessage goes here
authorMessage goes here
Message goes here
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TagPage.java b/src/com/gitblit/wicket/pages/TagPage.java new file mode 100644 index 00000000..f098c1e3 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TagPage.java @@ -0,0 +1,36 @@ +package com.gitblit.wicket.pages; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.GitBlitWebSession; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; + + +public class TagPage extends RepositoryPage { + + public TagPage(PageParameters params) { + super(params, "tag"); + + Repository r = getRepository(); + RevCommit c = JGitUtils.getCommit(r, commitId); + + add(new LinkPanel("commit", "title", c.getName(), CommitPage.class, newCommitParameter())); + + add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName()))); + add(new Label("tagAuthor", JGitUtils.getDisplayName(c.getAuthorIdent()))); + String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen()); + add(new Label("tagDate", authorDate)); + + addFullText("fullMessage", c.getFullMessage(), true); + + r.close(); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/TagsPage.html b/src/com/gitblit/wicket/pages/TagsPage.html new file mode 100644 index 00000000..314eec77 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TagsPage.html @@ -0,0 +1,30 @@ + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TagsPage.java b/src/com/gitblit/wicket/pages/TagsPage.java new file mode 100644 index 00000000..85c0455c --- /dev/null +++ b/src/com/gitblit/wicket/pages/TagsPage.java @@ -0,0 +1,64 @@ +package com.gitblit.wicket.pages; + +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.navigation.paging.PagingNavigator; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.Repository; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.GitBlitWebApp; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.models.RefModel; +import com.gitblit.wicket.panels.TagLinksPanel; + + +public class TagsPage extends RepositoryPage { + + public TagsPage(PageParameters params) { + super(params, "tags"); + Repository r = getRepository(); + List tags = JGitUtils.getTags(r, -1); + r.close(); + + // shortlog + add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); + + ListDataProvider tagsDp = new ListDataProvider(tags); + DataView tagView = new DataView("tag", tagsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final RefModel entry = item.getModelObject(); + item.add(createDateLabel("tagDate", entry.getDate())); + + item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getObjectId().getName()))); + + if (entry.getCommitId().equals(entry.getObjectId())) { + // lightweight tag on commit object + item.add(new Label("tagDescription", "")); + } else { + // tag object + item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName()))); + } + + item.add(new TagLinksPanel("tagLinks", repositoryName, entry)); + + setAlternatingBackground(item, counter); + counter++; + } + }; + tagView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT); + add(tagView); + add(new PagingNavigator("navigator", tagView)); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/pages/TreePage.html b/src/com/gitblit/wicket/pages/TreePage.html new file mode 100644 index 00000000..e01049c6 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TreePage.html @@ -0,0 +1,35 @@ + + + + +
+ + +
+ + + + + +
+ + +
+ + +
+ + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java new file mode 100644 index 00000000..a608bdda --- /dev/null +++ b/src/com/gitblit/wicket/pages/TreePage.java @@ -0,0 +1,89 @@ +package com.gitblit.wicket.pages; + +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.ByteFormat; +import com.gitblit.utils.JGitUtils; +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.panels.PathBreadcrumbsPanel; +import com.gitblit.wicket.panels.TreeLinksPanel; + + +public class TreePage extends RepositoryPage { + + public TreePage(PageParameters params) { + super(params, "tree"); + + final String basePath = params.getString("f", null); + + Repository r = getRepository(); + RevCommit commit = JGitUtils.getCommit(r, commitId); + List paths = JGitUtils.getFilesInPath(r, basePath, commit); + + // tree page links + add(new Label("historyLink", "history")); + add(new Label("headLink", "HEAD")); + + add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter())); + + // breadcrumbs + if (basePath == null || basePath.trim().length() == 0) { + add(new Label("breadcrumbs", "").setVisible(false)); + } else { + add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, basePath, commitId)); + paths.add(0, PathModel.getParentPath(basePath, commitId)); + } + + final ByteFormat byteFormat = new ByteFormat(); + + // changed paths list + ListDataProvider pathsDp = new ListDataProvider(paths); + DataView pathsView = new DataView("changedPath", pathsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + PathModel entry = item.getModelObject(); + item.add(new Label("pathPermissions", JGitUtils.getPermissionsFromMode(entry.mode))); + if (entry.isParentPath) { + // parent .. path + item.add(new Label("pathSize", "").setVisible(false)); + item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path))); + item.add(new Label("treeLinks", "").setVisible(false)); + } else { + if (entry.isTree()) { + // folder/tree link + item.add(new Label("pathSize", "-")); + item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path))); + } else { + // blob link + item.add(new Label("pathSize", byteFormat.format(entry.size))); + item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path))); + } + item.add(new TreeLinksPanel("treeLinks", repositoryName, entry)); + } + String clazz = counter % 2 == 0 ? "dark" : "light"; + WicketUtils.setCssClass(item, clazz); + counter++; + } + }; + add(pathsView); + + // close repository + r.close(); + + // footer + addFooter(); + } +} diff --git a/src/com/gitblit/wicket/panels/HeadLinksPanel.html b/src/com/gitblit/wicket/panels/HeadLinksPanel.html new file mode 100644 index 00000000..4849e8e2 --- /dev/null +++ b/src/com/gitblit/wicket/panels/HeadLinksPanel.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/HeadLinksPanel.java b/src/com/gitblit/wicket/panels/HeadLinksPanel.java new file mode 100644 index 00000000..4f4c9d7e --- /dev/null +++ b/src/com/gitblit/wicket/panels/HeadLinksPanel.java @@ -0,0 +1,23 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.models.RefModel; +import com.gitblit.wicket.pages.LogPage; +import com.gitblit.wicket.pages.ShortLogPage; + + +public class HeadLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public HeadLinksPanel(String id, String repositoryName, RefModel tag) { + super(id); + add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName()))); + add(new LinkPanel("log", null, "log", LogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName()))); + add(new Label("tree", "tree")); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageFooter.html b/src/com/gitblit/wicket/panels/PageFooter.html new file mode 100644 index 00000000..6eed4b3c --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageFooter.html @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageFooter.java b/src/com/gitblit/wicket/panels/PageFooter.java new file mode 100644 index 00000000..91a1f57c --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageFooter.java @@ -0,0 +1,28 @@ +package com.gitblit.wicket.panels; + +import java.util.Date; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.StoredSettings; +import com.gitblit.wicket.GitBlitWebSession; + + +public class PageFooter extends Panel { + + private static final long serialVersionUID = 1L; + + public PageFooter(String id) { + this(id, ""); + } + + public PageFooter(String id, String description) { + super(id); + add(new Label("cacheTime", "Page Last Updated: " + GitBlitWebSession.get().formatDateTimeLong(new Date()))); + add(new Label("footerText", description)); + if (StoredSettings.getBoolean("aggressiveGC", false)) { + System.gc(); + } + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageHeader.html b/src/com/gitblit/wicket/panels/PageHeader.html new file mode 100644 index 00000000..83edb994 --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageHeader.html @@ -0,0 +1,15 @@ + + + + + Message goes here + + + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageHeader.java b/src/com/gitblit/wicket/panels/PageHeader.java new file mode 100644 index 00000000..c375758c --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageHeader.java @@ -0,0 +1,41 @@ +package com.gitblit.wicket.panels; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.protocol.http.servlet.ServletWebRequest; + +import com.gitblit.Constants; +import com.gitblit.StoredSettings; +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.pages.SummaryPage; + + +public class PageHeader extends Panel { + + private static final long serialVersionUID = 1L; + + public PageHeader(String id) { + this(id, "", ""); + } + + public PageHeader(String id, String repositoryName, String page) { + super(id); + if (repositoryName != null && repositoryName.trim().length() > 0) { + add(new Label("title", getServerName() + " - " + repositoryName)); + } else { + add(new Label("title", getServerName())); + } + add(new Label("siteName", StoredSettings.getString("siteName", Constants.NAME))); + add(new LinkPanel("repositoryName", null, repositoryName, SummaryPage.class, new PageParameters("p=" + repositoryName))); + add(new Label("pageName", page)); + } + + protected String getServerName() { + ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest(); + HttpServletRequest req = servletWebRequest.getHttpServletRequest(); + return req.getServerName(); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageLinksPanel.html b/src/com/gitblit/wicket/panels/PageLinksPanel.html new file mode 100644 index 00000000..66c3ce7a --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageLinksPanel.html @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PageLinksPanel.java b/src/com/gitblit/wicket/panels/PageLinksPanel.java new file mode 100644 index 00000000..f72b8800 --- /dev/null +++ b/src/com/gitblit/wicket/panels/PageLinksPanel.java @@ -0,0 +1,61 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.pages.CommitPage; +import com.gitblit.wicket.pages.LogPage; +import com.gitblit.wicket.pages.ShortLogPage; +import com.gitblit.wicket.pages.SummaryPage; +import com.gitblit.wicket.pages.TreePage; + + +public class PageLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public PageLinksPanel(String id, String repositoryName, String pageName) { + super(id); + // summary + if (pageName.equals("summary")) { + add(new Label("summary", pageName)); + } else { + add(new LinkPanel("summary", null, "summary", SummaryPage.class, new PageParameters("p=" + repositoryName))); + } + + // shortlog + if (pageName.equals("shortlog")) { + add(new Label("shortlog", pageName)); + } else { + add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName))); + } + + // log + if (pageName.equals("log")) { + add(new Label("log", pageName)); + } else { + add(new LinkPanel("log", null, "log", LogPage.class, new PageParameters("p=" + repositoryName))); + } + + // commit + if (pageName.equals("commit")) { + add(new Label("commit", pageName)); + } else { + add(new LinkPanel("commit", null, "commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=HEAD"))); + } + // commitdiff + if (pageName.equals("commitdiff")) { + add(new Label("commitdiff", pageName)); + } else { + add(new Label("commitdiff", "commitdiff")); + } + // tree + if (pageName.equals("tree")) { + add(new Label("tree", pageName)); + } else { + add(new LinkPanel("tree", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=HEAD"))); + } + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.html b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.html new file mode 100644 index 00000000..ee8bca22 --- /dev/null +++ b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.html @@ -0,0 +1,11 @@ + + + + +
+ + + +
+
+ \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java new file mode 100644 index 00000000..5ce356a2 --- /dev/null +++ b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java @@ -0,0 +1,79 @@ +package com.gitblit.wicket.panels; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.pages.TreePage; + + +public class PathBreadcrumbsPanel extends Panel { + + private static final long serialVersionUID = 1L; + + private final String ROOT = "--ROOT--"; + + public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String commitId) { + super(id); + List crumbs = new ArrayList(); + crumbs.add(new BreadCrumb("[" + repositoryName + "]", ROOT, false)); + + String[] paths = pathName.split("/"); + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < paths.length; i++) { + String path = paths[i]; + sb.append(path); + crumbs.add(new BreadCrumb(path, sb.toString(), (i == (paths.length - 1)))); + sb.append("/"); + } + + ListDataProvider crumbsDp = new ListDataProvider(crumbs); + DataView pathsView = new DataView("path", crumbsDp) { + private static final long serialVersionUID = 1L; + + public void populateItem(final Item item) { + final BreadCrumb entry = item.getModelObject(); + String path = entry.getPath(); + String parameters = "p=" + repositoryName + ",h=" + commitId; + if (path != null) { + parameters += ",f=" + path; + } + + item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, new PageParameters(parameters))); + item.add(new Label("pathSeparator", entry.isLeaf ? "":"/")); + } + }; + add(pathsView); + } + + private class BreadCrumb implements Serializable { + + private static final long serialVersionUID = 1L; + + final String name; + final String path; + final boolean isLeaf; + + BreadCrumb(String name, String path, boolean isLeaf) { + this.name = name; + this.path = path; + this.isLeaf = isLeaf; + } + + String getPath() { + if (path.equals(ROOT)) { + return null; + } + return path; + } + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PathLinksPanel.html b/src/com/gitblit/wicket/panels/PathLinksPanel.html new file mode 100644 index 00000000..08327b1b --- /dev/null +++ b/src/com/gitblit/wicket/panels/PathLinksPanel.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/PathLinksPanel.java b/src/com/gitblit/wicket/panels/PathLinksPanel.java new file mode 100644 index 00000000..fa8bdca6 --- /dev/null +++ b/src/com/gitblit/wicket/panels/PathLinksPanel.java @@ -0,0 +1,22 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.models.PathModel; +import com.gitblit.wicket.pages.BlobPage; + + +public class PathLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public PathLinksPanel(String id, String repositoryName, PathModel path) { + super(id); + add(new Label("diff", "diff")); + add(new LinkPanel("blob", null, "blob", BlobPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path))); + add(new Label("history", "history")); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/RefsPanel.html b/src/com/gitblit/wicket/panels/RefsPanel.html new file mode 100644 index 00000000..e7be7c54 --- /dev/null +++ b/src/com/gitblit/wicket/panels/RefsPanel.html @@ -0,0 +1,8 @@ + + + + + ref + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/RefsPanel.java b/src/com/gitblit/wicket/panels/RefsPanel.java new file mode 100644 index 00000000..5dec57fe --- /dev/null +++ b/src/com/gitblit/wicket/panels/RefsPanel.java @@ -0,0 +1,66 @@ +package com.gitblit.wicket.panels; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.Component; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; + +import com.gitblit.utils.JGitUtils; +import com.gitblit.wicket.WicketUtils; + + +public class RefsPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public RefsPanel(String id, Repository r, RevCommit c) { + this(id, c, JGitUtils.getAllRefs(r)); + } + + public RefsPanel(String id, RevCommit c, Map> refs) { + super(id); + List refNames = refs.get(c.getId()); + if (refNames == null) { + refNames = new ArrayList(); + } + Collections.sort(refNames); + ListDataProvider refsDp = new ListDataProvider(refNames); + DataView refsView = new DataView("ref", refsDp) { + private static final long serialVersionUID = 1L; + public void populateItem(final Item item) { + String entry = item.getModelObject(); + Component c = null; + if (entry.startsWith(Constants.R_HEADS)) { + // local head + c = new Label("refName", entry.substring(Constants.R_HEADS.length())); + WicketUtils.setCssClass(c, "head"); + } else if (entry.startsWith(Constants.R_REMOTES)) { + // remote head + c = new Label("refName", entry.substring(Constants.R_REMOTES.length())); + WicketUtils.setCssClass(c, "ref"); + } else if (entry.startsWith(Constants.R_TAGS)) { + // tag + c = new Label("refName", entry.substring(Constants.R_TAGS.length())); + WicketUtils.setCssClass(c, "tag"); + } else { + // other + c = new Label("refName", entry); + } + WicketUtils.setHtmlTitle(c, entry); + item.add(c); + } + }; + add(refsView); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/ShortLogLinksPanel.html b/src/com/gitblit/wicket/panels/ShortLogLinksPanel.html new file mode 100644 index 00000000..75d6b1ca --- /dev/null +++ b/src/com/gitblit/wicket/panels/ShortLogLinksPanel.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/ShortLogLinksPanel.java b/src/com/gitblit/wicket/panels/ShortLogLinksPanel.java new file mode 100644 index 00000000..58ec37ac --- /dev/null +++ b/src/com/gitblit/wicket/panels/ShortLogLinksPanel.java @@ -0,0 +1,23 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.pages.CommitPage; +import com.gitblit.wicket.pages.TreePage; + + +public class ShortLogLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public ShortLogLinksPanel(String id, String repositoryName, String commitId) { + super(id); + + add(new LinkPanel("commit", null, "commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=" + commitId))); + add(new Label("commitdiff", "commitdiff")); + add(new LinkPanel("tree", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + commitId))); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/TagLinksPanel.html b/src/com/gitblit/wicket/panels/TagLinksPanel.html new file mode 100644 index 00000000..30934085 --- /dev/null +++ b/src/com/gitblit/wicket/panels/TagLinksPanel.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/TagLinksPanel.java b/src/com/gitblit/wicket/panels/TagLinksPanel.java new file mode 100644 index 00000000..73a9c3ae --- /dev/null +++ b/src/com/gitblit/wicket/panels/TagLinksPanel.java @@ -0,0 +1,23 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.models.RefModel; +import com.gitblit.wicket.pages.CommitPage; +import com.gitblit.wicket.pages.LogPage; +import com.gitblit.wicket.pages.ShortLogPage; + + +public class TagLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public TagLinksPanel(String id, String repositoryName, RefModel tag) { + super(id); + add(new LinkPanel("commit", null, "commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getCommitId().getName()))); + add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName()))); + add(new LinkPanel("log", null, "log", LogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName()))); + } +} \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/TreeLinksPanel.html b/src/com/gitblit/wicket/panels/TreeLinksPanel.html new file mode 100644 index 00000000..d0c3b7f3 --- /dev/null +++ b/src/com/gitblit/wicket/panels/TreeLinksPanel.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/com/gitblit/wicket/panels/TreeLinksPanel.java b/src/com/gitblit/wicket/panels/TreeLinksPanel.java new file mode 100644 index 00000000..21da66c9 --- /dev/null +++ b/src/com/gitblit/wicket/panels/TreeLinksPanel.java @@ -0,0 +1,29 @@ +package com.gitblit.wicket.panels; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; + +import com.gitblit.wicket.LinkPanel; +import com.gitblit.wicket.models.PathModel; +import com.gitblit.wicket.pages.BlobPage; +import com.gitblit.wicket.pages.TreePage; + + +public class TreeLinksPanel extends Panel { + + private static final long serialVersionUID = 1L; + + public TreeLinksPanel(String id, String repositoryName, PathModel path) { + super(id); + if (path.isTree()) { + add(new LinkPanel("link", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path))); + add(new Label("history", "history")); + add(new Label("raw", "").setVisible(false)); + } else { + add(new LinkPanel("link", null, "blob", BlobPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path))); + add(new Label("history", "history")); + add(new Label("raw", "raw")); + } + } +} \ No newline at end of file diff --git a/src/log4j.properties b/src/log4j.properties new file mode 100644 index 00000000..16f12363 --- /dev/null +++ b/src/log4j.properties @@ -0,0 +1,12 @@ +log4j.debug=false + +log4j.rootLogger=INFO +log4j.logger.org=INFO +log4j.logger.com=INFO +log4j.logger.net=INFO + +log4j.logger.com.gitblit=DEBUG + +log4j.logger.org.apache.wicket=INFO +log4j.logger.org.apache.wicket.RequestListenerInterface=WARN +log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=WARN diff --git a/users.properties b/users.properties new file mode 100644 index 00000000..7f4fd746 --- /dev/null +++ b/users.properties @@ -0,0 +1 @@ +test: test -- cgit v1.2.3