Codepro analyze dependencies. Documentation.
16 files renamed
3 files deleted
2 files added
54 files modified
| | |
| | | Gitblit
|
| | | =================
|
| | |
|
| | | Gitblit is an open source, pure Java Git solution.
|
| | | Gitblit is an open source, pure Java Git solution for creating, viewing, and serving [Git](http://git-scm.com) repositories.<br/>
|
| | | More information about Gitblit can be found [here](http://gitblit.com).
|
| | |
|
| | | Gitblit can be found at: http://gitblit.com and is licensed under
|
| | | the Apache Software Foundation license, version 2.0.
|
| | |
|
| | | Contents
|
| | | --------
|
| | | - License
|
| | | - Java/Application server requirements
|
| | | - Getting help
|
| | | - Building Gitblit
|
| | | |
| | | License
|
| | | -------
|
| | |
|
| | |
| | | Getting help
|
| | | ------------
|
| | |
|
| | | - Read the online documentation available on the Gitblit website
|
| | | (http://gitblit.com)
|
| | | Read the online documentation available at the [Gitblit website](http://gitblit.com)
|
| | |
|
| | | Building Gitblit
|
| | | ----------------
|
| | |
| | | 2. Using Ant, execute the `build.xml` script in the project root.<br/>
|
| | | *This will download all necessary build dependencies and will also generate the Keys class for accessing settings.*
|
| | | 3. Select your gitblit project root and **Refresh** the project, this should correct all build problems.
|
| | | 4. Review the settings in `gitblit.properties` in your project root.<br/>
|
| | | Make sure you set an appropriate value for *git.repositoriesFolder*. |
| | | 5. Execute the *com.gitblit.Launcher* class to start Gitblit. |
| | | |
| | | 4. Using JUnit, execute the `com.gitblit.tests.GitBlitSuite` test suite.<br/>
|
| | | *This will clone some repositories from the web and run through the unit tests.*
|
| | | 5. Execute the *com.gitblit.Launcher* class to start Gitblit. |
| | |
| | | <replacestring from="";" to="" />
|
| | | <trim />
|
| | | </tokenfilter>
|
| | | </filterchain> |
| | | </filterchain>
|
| | | </loadfile>
|
| | |
|
| | | <!-- extract JGit version number from source code -->
|
| | |
| | | </fileset>
|
| | | </copy>
|
| | |
|
| | | <!-- Copy google-code-prettify -->
|
| | | <mkdir dir="${basedir}/src/com/gitblit/wicket/pages/prettify" />
|
| | | <copy todir="${basedir}/site/prettify">
|
| | | <fileset dir="${basedir}/src/com/gitblit/wicket/pages/prettify">
|
| | | <exclude name="thumbs.db" />
|
| | | </fileset>
|
| | | </copy>
|
| | |
|
| | | <!-- Copy screenshot thumbnails -->
|
| | | <mkdir dir="${basedir}/site/thumbs" />
|
| | | <copy todir="${basedir}/site/thumbs">
|
| | |
| | |
|
| | | <arg value="--alias" />
|
| | | <arg value="index=overview" />
|
| | | |
| | | <arg value="--alias" />
|
| | | <arg value="properties=gitblit.properties" />
|
| | |
|
| | | <arg value="--substitute" />
|
| | | <arg value="%VERSION%=${gb.version}" />
|
| | |
| | |
|
| | | <arg value="--substitute" />
|
| | | <arg value="%JGIT%=${jgit.version}" />
|
| | |
|
| | | <arg value="--load" />
|
| | | <arg value="%PROPERTIES%=${basedir}/distrib/gitblit.properties" />
|
| | |
|
| | | </java>
|
| | |
|
| | | <!-- Cleanup --> |
| | | <!-- Cleanup -->
|
| | | <delete dir="${project.build.dir}" />
|
| | | </target>
|
| | | </project>
|
| | |
| | | #
|
| | |
|
| | | # Allow push/pull over http/https with JGit servlet
|
| | | # Changing this value requires a server restart.
|
| | | git.enableGitServlet = true
|
| | |
|
| | | # Base folder for repositories
|
| | | # Changing this value requires a server restart.
|
| | | # Use forward slashes even on Windows!!
|
| | | # e.g. c:/gitrepos
|
| | | git.repositoriesFolder = git
|
| | |
|
| | | # Export all repositories
|
| | | # Changing this value requires a server restart.
|
| | | # if false, each exported repository must have a .git/git-daemon-export-ok file
|
| | | git.exportAll = true
|
| | |
|
| | | # Search repositories folder for nested repositories
|
| | | # e.g. /libraries/mylibrary.git
|
| | | # e.g. c:/gitrepos/libraries/mylibrary.git
|
| | | git.nestedRepositories = true
|
| | |
|
| | | #
|
| | |
| | | #
|
| | |
|
| | | # Require authentication to see everything but the admin pages
|
| | | # Changing this value requires a server restart.
|
| | | web.authenticateViewPages = false
|
| | |
|
| | | # Require admin authentication for the admin functions and pages
|
| | | # Changing this value requires a server restart.
|
| | | web.authenticateAdminPages = true
|
| | |
|
| | | # Simple user realm file to authenticate users
|
| | | # Changing this value requires a server restart.
|
| | | realm.realmFile = users.properties
|
| | |
|
| | | # How to store passwords.
|
| | |
| | | # If blank Gitblit is displayed.
|
| | | web.siteName =
|
| | |
|
| | | # If web.authenticate=true, users with "admin" role can create repositories,
|
| | | # create users, and edit repository metadata (owner, description, etc)
|
| | | # If web.authenticateAdminPages=true, users with "admin" role can create
|
| | | # repositories, create users, and edit repository metadata.
|
| | | #
|
| | | # If web.authenticate=false, any user can execute the aforementioned functions. |
| | | # If web.authenticateAdminPages=false, any user can execute the aforementioned
|
| | | # functions. |
| | | web.allowAdministration = true
|
| | |
|
| | | # Allow dyanamic zip downloads.
|
| | |
| | |
|
| | | # Use the client timezone when formatting dates.
|
| | | # This uses AJAX to determine the browser's timezone.
|
| | | # Changing this value requires a server restart.
|
| | | web.useClientTimezone = false
|
| | |
|
| | | # Date and Time formats
|
| | | # http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
|
| | | web.datestampShortFormat = yyyy-MM-dd
|
| | | web.datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z
|
| | |
|
| | | # Show other URLs on the summary page for accessing your git repositories
|
| | | # Use spaces to separate urls. {0} is the token for the repository name.
|
| | | # e.g.
|
| | | # web.otherUrls = ssh://localhost/git/{0} git://localhost/git/{0}
|
| | | web.otherUrls =
|
| | |
|
| | | # Choose how to present the repositories list.
|
| | | # grouped = group nested/subfolder repositories together (no sorting)
|
| | | # flat = flat list of repositories (sorting allowed)
|
| | | # grouped = group nested/subfolder repositories together (no sorting)
|
| | | # flat = flat list of repositories (sorting allowed)
|
| | | web.repositoryListType = grouped
|
| | |
|
| | | # If using a grouped repository list and there are repositories at the
|
| | |
| | | web.showSearchTypeSelection = false
|
| | |
|
| | | # Generates a line graph of repository activity over time on the Summary page.
|
| | | # This is a real-time graph so generation may be expensive. |
| | | # This uses the Google Charts API. |
| | | web.generateActivityGraph = true
|
| | |
|
| | | # The number of commits to display on the summary page
|
| | |
| | | web.itemsPerPage = 50
|
| | |
|
| | | # Registered extensions for google-code-prettify
|
| | | # (case-insensitive)
|
| | | web.prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb
|
| | |
|
| | | # Registered extensions for markdown transformation
|
| | | web.markdownExtensions = md mkd markdown
|
| | | # (CASE-SENSITIVE)
|
| | | web.markdownExtensions = md mkd markdown MD MKD
|
| | |
|
| | | # Image extensions
|
| | | # (case-insensitive)
|
| | | web.imageExtensions = bmp jpg gif png
|
| | |
|
| | | # Registered extensions for binary blobs
|
| | | # (case-insensitive)
|
| | | web.binaryExtensions = jar pdf tar.gz zip
|
| | |
|
| | | # Aggressive heap management will run the garbage collector on every generated
|
| | | # page. This slows down page generation but improves heap consumption. |
| | | # page. This slows down page generation a little but improves heap consumption. |
| | | web.aggressiveHeapManagement = true
|
| | |
|
| | | # Run the webapp in debug mode
|
| | | # Changing this value requires a server restart.
|
| | | web.debugMode = false
|
| | |
|
| | | # Enable/disable global regex substitutions (i.e. shared across repositories)
|
| | |
| | | #
|
| | | # Server Settings
|
| | | #
|
| | | # Changing any of these values requires a server restart.
|
| | |
|
| | | # The temporary folder to decompress the gitblit webapp. |
| | | server.tempFolder = temp
|
| | |
|
| | | # The common log4j logging pattern
|
| | | # http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
|
| | | server.log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n
|
| | |
|
| | | # Alternatively, you may specify a logging pattern for your OS.
|
| | | # If the os pattern is blank, the common pattern is used.
|
| | |
|
| | | # This windows pattern fits (mostly) within the fixed bounds of a command prompt.
|
| | | server.log4jPattern.windows = %-5p %m%n
|
| | |
|
| | | server.log4jPattern.linux =
|
| | |
|
| | |
|
| | |
| | |
|
| | | # Specify the interface for Jetty to bind the standard connector.
|
| | | # You may specify an ip or an empty value to bind to all interfaces.
|
| | | # Specifying localhost will result in Git:Blit ONLY listening to requests to
|
| | | # Specifying localhost will result in Gitblit ONLY listening to requests to
|
| | | # localhost.
|
| | | server.httpBindInterface = localhost
|
| | |
|
| | | # Specify the interface for Jetty to bind the secure connector.
|
| | | # You may specify an ip or an empty value to bind to all interfaces.
|
| | | # Specifying localhost will result in Git:Blit ONLY listening to requests to
|
| | | # Specifying localhost will result in Gitblit ONLY listening to requests to
|
| | | # localhost.
|
| | | server.httpsBindInterface = localhost
|
| | |
|
| | |
| | | # Keystore password and certificate password must match.
|
| | | # This is provided for convenience, its probably more secure to set this value
|
| | | # using the --storePassword command line parameter.
|
| | | server.storePassword = dosomegit
|
| | | server.storePassword = gitblit
|
| | |
|
| | | # Port for shutdown monitor to listen on.
|
| | | server.shutdownPort = 8081
|
| | |
| | | - [JSch - Java Secure Channel](http://www.jcraft.com/jsch) (BSD)
|
| | | - [JUnit](http://junit.org) (Common Public License)
|
| | |
|
| | | ## Building
|
| | | ## Building from Source
|
| | | [Eclipse](http://eclipse.org) is recommended for development as the project settings are preconfigured.
|
| | |
|
| | | Additionally, [Google CodePro AnalytiX](http://code.google.com/javadevtools), [eclipse-cs](http://eclipse-cs.sourceforge.net), and [FindBugs](http://findbugs.sourceforge.net) are recommended development tools.
|
| | | Additionally, [Google CodePro AnalytiX](http://code.google.com/javadevtools), [eclipse-cs](http://eclipse-cs.sourceforge.net), [FindBugs](http://findbugs.sourceforge.net), and [EclEmma](http://www.eclemma.org) are recommended development tools.
|
| | |
|
| | | 1. Clone the git repository from [Github][gitbltsrc].
|
| | | 2. Import the gitblit project into your Eclipse workspace.<br/>
|
| | |
| | | 3. Using Ant, execute the `build.xml` script in the project root.<br/>
|
| | | *This will download all necessary build dependencies and will also generate the Keys class for accessing settings.*
|
| | | 4. Select your gitblit project root and **Refresh** the project, this should correct all build problems.
|
| | | 5. Review the settings in `gitblit.properties` in your project root.<br/>
|
| | | Make sure you set an appropriate value for *git.repositoriesFolder*. |
| | | 5. Using JUnit, execute the `com.gitblit.tests.GitBlitSuite` test suite.<br/>
|
| | | *This will clone some repositories from the web and run through the unit tests.*
|
| | | 5. Review the settings in `gitblit.properties` in your project root.
|
| | | - By default, the *git.repositoriesFolder* points to the repositories cloned by the test suite.<br/>
|
| | | - If running on Linux you may have to change the served port(s) to > 1024 unless you are developing as the root user. |
| | | 6. Execute the *com.gitblit.Launcher* class to start Gitblit.
|
| | |
|
| | | [jgit]: http://eclipse.org/jgit "Eclipse JGit Site"
|
| | |
| | | ## Setup and Configuration
|
| | | ## Server Setup and Configuration
|
| | |
|
| | | 1. Download and unzip [Gitblit %VERSION%](http://gitblit.com/%DISTRIBUTION%).<br/>
|
| | | *Its best to eliminate spaces in the path name as that can cause troubleshooting headaches.*
|
| | |
| | |
|
| | | **Example**
|
| | |
|
| | | java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something |
| | | java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something
|
| | | |
| | | ## Client Setup and Configuration
|
| | | ### Https with Self-Signed Certificates
|
| | | You must tell Git not to verify the self-signed certificate in order to perform any remote Git operations.
|
| | |
|
| | | - Eclipse/EGit
|
| | | 1. Window->Preferences->Team->Git->Configuration
|
| | | 2. Click the *New Entry* button
|
| | | 3. <pre>Key = *http.sslVerify* |
| | | Value = *false*</pre>
|
| | | - Command-line Git ([Git-Config Manual Page](http://www.kernel.org/pub/software/scm/git/docs/git-config.html))
|
| | | <pre>git-config --global --bool --add http.sslVerify false</pre>
|
| | |
|
| | | ### Cloning an Access Restricted Repository |
| | | - Eclipse/Egit<br/>Nothing special to configure, EGit figures out everything.
|
| | | <pre>https://yourserver/git/your/repository</pre>
|
| | | - Command-line Git<br/>*My testing indicates that your username must be embedded in the url. YMMV.*
|
| | | <pre>https://username@yourserver/git/your/repository</pre>
|
| | | |
| | |
| | | ## Frequently Asked Questions
|
| | | ## Troubleshooting
|
| | |
|
| | | ### Eclipse/Egit/Git complains that it "can't open upload pack"?
|
| | | There are a few ways this can occur:
|
| | |
|
| | | 1. You are using https with a self-signed certificate and you **did not** configure *http.sslVerify=false*
|
| | | 1. Window->Preferences->Team->Git->Configuration
|
| | | 2. Click the *New Entry* button
|
| | | 3. <pre>Key = *http.sslVerify* |
| | | Value = *false*</pre>
|
| | | 2. The repository is clone-restricted and you don't have access.
|
| | | 3. The repository is clone-restricted and your password changed.
|
| | | 4. A regression in Gitblit. :(
|
| | |
|
| | | ### Why can't I access Gitblit from another machine?
|
| | | Please check *server.httpBindInterface* and *server.httpsBindInterface* in `gitblit.properties`.
|
| | |
|
| | | ### How do I run Gitblit on port 80 or 443 in Linux?
|
| | | Linux requires root permissions to serve on ports < 1024.<br/>
|
| | | Run the server as *root* (security concern) or change the ports you are serving to 8080 (http) and/or 8443 (https). |
| | |
|
| | | ## General Interest Questions
|
| | |
|
| | | ### Gitblit? What kind of name is that?
|
| | | Its a phonetic play on [bitblt][bitblt] which is an image processing operation meaning *bit-block transfer*.
|
| | | It's a phonetic play on [bitblt][bitblt] which is an image processing operation meaning *bit-block transfer*.
|
| | |
|
| | | ### Why use Gitblit?
|
| | | Its small. Its portable. Its easy to manage.
|
| | | It's a small tool that allows you to easily manage shared repositories and doesn't require alot of setup or git kung-foo.
|
| | |
|
| | | ### Do I need real Git?
|
| | | No. Gitblit is based on [JGit][jgit] which is a pure Java implementation of the [Git version control system][git].<br/>
|
| | |
| | | ### Do I need a JDK or can I use a JRE?
|
| | | Gitblit will run just fine with a JRE. Gitblit can optionally use `keytool` from the JDK to generate self-signed certificates, but normally Gitblit uses [BouncyCastle][bouncycastle] for that need.
|
| | |
|
| | | ### I want to deploy Gitblit into my own servlet container. Where is the WAR?
|
| | | At this time there is no WAR build available.
|
| | |
|
| | | ### Does Gitblit use a database to store its data?
|
| | | No. Gitblit stores its repository configuration information within the `.git/config` file and its user information in `users.properties` or whatever filename is configured in `gitblit.properties`.
|
| | |
|
| | | ### I want to deploy Gitblit into my own servlet container. Where is the WAR?
|
| | | At this time there is no WAR build available.
|
| | | ### Can I manually edit users.properties, gitblit.properties, or .git/config?
|
| | | Yes. You can manually manipulate all of them and (most) changes will be immediately available to Gitblit.<br/>Exceptions to this are noted in `gitblit.properties`.
|
| | |
|
| | | *NOTE:* Care must be taken to preserve the relationship between user roles and repository names.<br/>Please see the [setup](/setup.html) page for details.
|
| | |
|
| | | ### Can I restrict access to paths within a repository?
|
| | | No. Access restrictions apply to the repository as a whole.
|
| | |
| | |
|
| | | ### Why doesn't Gitblit support SSH?
|
| | | Gitblit could integrate [Apache Mina][mina] to provide SSH access. However, doing so violates Gitblit's first design principle: [KISS](http://en.wikipedia.org/wiki/KISS_principle).<br/>
|
| | | SSH support requires creating, exchanging, and managing SSH keys. While this is possible, JGit's SmartHTTP implementation is a simpler and cleaner transport mechanism.
|
| | | SSH support requires creating, exchanging, and managing SSH keys. While this is possible, JGit's SmartHTTP implementation is a simpler and universal transport mechanism.
|
| | |
|
| | | You might consider running [Gerrit](http://gerrit.googlecode.org) which does integrate [Apache Mina][mina] and supports SSH or you might consider serving [Git][git] on Linux which would offer real SSH support and also allow use of [many other compelling Git solutions](https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools).
|
| | |
|
| | |
| | |
|
| | | Alternatively, you could enable the search type dropdown list in your `gitblit.properties` file.
|
| | |
|
| | | ### How do I run Gitblit on port 80 or 443 in Linux?
|
| | | Linux requires root permissions to serve on ports < 1024.<br/>
|
| | | Run the server as *root* (security concern) or change the ports you are serving to 8080 (http) and/or 8443 (https). |
| | | ### I see a disabled "blame" link. How do I enable it? |
| | | Currently blame is not implemented. Those links are placeholders to remind me where Gitweb offers blame.
|
| | |
|
| | | [bitblt]: http://en.wikipedia.org/wiki/Bit_blit "Wikipedia Bitblt"
|
| | | [jgit]: http://eclipse.org/jgit "Eclipse JGit Site"
|
New file |
| | |
| | | ## gitblit.properties
|
| | | <pre class='prettyprint'>
|
| | | %PROPERTIES%
|
| | | </pre> |
| | |
| | | <meta name="ROBOTS" content="INDEX, NOFOLLOW">
|
| | | <meta http-equiv="imagetoolbar" content="no" />
|
| | | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
| | | <meta name="keywords" content="java git server" />
|
| | |
|
| | | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
|
| | | <script>
|
| | |
| | | list-style: none;
|
| | | '}'
|
| | | </style>
|
| | | |
| | | <script type="text/javascript" src="prettify/prettify.js"></script>
|
| | | <link href="prettify/prettify.css" type="text/css" rel="stylesheet" /> |
| | | </head>
|
| | | <body>
|
| | | <body onload="prettyPrint()">
|
| | | <div class="page_header">
|
| | | <a title="gitblit homepage" href="http://gitblit.com/">
|
| | | <img src="./gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
|
| | |
| | | downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.COMPILETIME);
|
| | | downloadFromApache(MavenObject.BOUNCYCASTLE, BuildType.COMPILETIME);
|
| | | downloadFromApache(MavenObject.BOUNCYCASTLE_MAIL, BuildType.COMPILETIME);
|
| | | |
| | |
|
| | | downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);
|
| | | downloadFromApache(MavenObject.JSCH, BuildType.COMPILETIME);
|
| | |
|
| | |
| | | "384058ca906dffb8b8708c2db8849c9754359b28",
|
| | | "7b026658ed8de2eccc2d11d647d43d7c84a56911",
|
| | | "6c19e37b3caafd70c1b7b024ae1858c725181688");
|
| | | |
| | | public static final MavenObject JSCH = new MavenObject("JSch", "com/jcraft",
|
| | | "jsch", "0.1.44-1", 214000, 211000, 413000,
|
| | | "2e9ae08de5a71bd0e0d3ba2558598181bfa71d4e",
|
| | |
|
| | | public static final MavenObject JSCH = new MavenObject("JSch", "com/jcraft", "jsch",
|
| | | "0.1.44-1", 214000, 211000, 413000, "2e9ae08de5a71bd0e0d3ba2558598181bfa71d4e",
|
| | | "e528f593b19b04d500992606f58b87fcfded8883",
|
| | | "d0ffadd0a4ab909d94a577b5aad43c13b617ddcb");
|
| | |
|
| | |
| | | import com.beust.jcommander.ParameterException;
|
| | | import com.beust.jcommander.Parameters;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | public class BuildSite {
|
| | |
|
| | |
| | | sb.setLength(sb.length() - 3);
|
| | | sb.trimToSize();
|
| | |
|
| | | String htmlHeader = readContent(new File(params.pageHeader));
|
| | | String htmlFooter = readContent(new File(params.pageFooter));
|
| | | String htmlHeader = readContent(new File(params.pageHeader), "\n");
|
| | | String htmlFooter = readContent(new File(params.pageFooter), "\n");
|
| | | final String links = sb.toString();
|
| | | final String header = MessageFormat.format(htmlHeader, Constants.FULL_NAME, links);
|
| | | final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
| | |
| | | String[] kv = token.split("=");
|
| | | content = content.replace(kv[0], kv[1]);
|
| | | }
|
| | | for (String alias : params.loads) {
|
| | | String[] kv = alias.split("=");
|
| | | String loadedContent = readContent(new File(kv[1]), "\n");
|
| | | loadedContent = StringUtils.escapeForHtml(loadedContent, false);
|
| | | loadedContent = StringUtils.breakLinesForHtml(loadedContent);
|
| | | content = content.replace(kv[0], loadedContent);
|
| | | }
|
| | | OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(
|
| | | destinationFolder, fileName)), Charset.forName("UTF-8"));
|
| | | writer.write(header);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private static String readContent(File file) {
|
| | | private static String readContent(File file, String lineEnding) {
|
| | | StringBuilder sb = new StringBuilder();
|
| | | try {
|
| | | InputStreamReader is = new InputStreamReader(new FileInputStream(file),
|
| | |
| | | String line = null;
|
| | | while ((line = reader.readLine()) != null) {
|
| | | sb.append(line);
|
| | | if (lineEnding != null) {
|
| | | sb.append(lineEnding);
|
| | | }
|
| | | }
|
| | | reader.close();
|
| | | } catch (Throwable t) {
|
| | |
| | | @Parameter(names = { "--alias" }, description = "Filename=Linkname aliases", required = false)
|
| | | public List<String> aliases = new ArrayList<String>();
|
| | |
|
| | | @Parameter(names = { "--substitute" }, description = "@TOKEN@=value", required = false)
|
| | | @Parameter(names = { "--substitute" }, description = "%TOKEN%=value", required = false)
|
| | | public List<String> substitutions = new ArrayList<String>();
|
| | |
|
| | | @Parameter(names = { "--load" }, description = "%TOKEN%=filename", required = false)
|
| | | public List<String> loads = new ArrayList<String>();
|
| | |
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public static final String ZIP_SERVLET_PATH = "/zip/";
|
| | |
|
| | | public static final String BORDER = "***********************************************************";
|
| | | |
| | | public static enum AccessRestrictionType {
|
| | | NONE, PUSH, CLONE, VIEW;
|
| | |
|
| | |
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | |
|
| | | public class DownloadZipServlet extends HttpServlet {
|
| | |
|
| | |
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | |
|
| | | public class GitBlit implements ServletContextListener {
|
| | |
|
| | |
| | | r = repositoryResolver.open(null, repositoryName);
|
| | | } catch (RepositoryNotFoundException e) {
|
| | | r = null;
|
| | | logger.error("GitBlit.getRepository(String) failed to find repository "
|
| | | + repositoryName);
|
| | | logger.error("GitBlit.getRepository(String) failed to find "
|
| | | + new File(repositoriesFolder, repositoryName).getAbsolutePath());
|
| | | } catch (ServiceNotEnabledException e) {
|
| | | r = null;
|
| | | e.printStackTrace();
|
| | |
| | |
|
| | | public RepositoryModel getRepositoryModel(String repositoryName) {
|
| | | Repository r = getRepository(repositoryName);
|
| | | if (r == null) {
|
| | | return null;
|
| | | }
|
| | | RepositoryModel model = new RepositoryModel();
|
| | | model.name = repositoryName;
|
| | | model.hasCommits = JGitUtils.hasCommits(r);
|
| | |
| | | }
|
| | |
|
| | | public void configureContext(IStoredSettings settings) {
|
| | | logger.info("Using configuration from " + settings.toString());
|
| | | logger.info("Reading configuration from " + settings.toString());
|
| | | this.storedSettings = settings;
|
| | | repositoriesFolder = new File(settings.getString(Keys.git.repositoriesFolder, "repos"));
|
| | | exportAll = settings.getBoolean(Keys.git.exportAll, true);
|
| | |
| | |
|
| | | public class GitBlitServer {
|
| | |
|
| | | private static final String BORDER = "***********************************************************";
|
| | |
|
| | | private static Logger logger;
|
| | |
|
| | | private static final FileSettings FILESETTINGS = new FileSettings();
|
| | |
|
| | | public static void main(String[] args) {
|
| | | Params params = new Params();
|
| | |
| | | }
|
| | |
|
| | | private static void usage(JCommander jc, ParameterException t) {
|
| | | System.out.println(BORDER);
|
| | | System.out.println(Constants.BORDER);
|
| | | System.out.println(Constants.getGitBlitVersion());
|
| | | System.out.println(BORDER);
|
| | | System.out.println(Constants.BORDER);
|
| | | System.out.println();
|
| | | if (t != null) {
|
| | | System.out.println(t.getMessage());
|
| | |
| | | * Start Server.
|
| | | */
|
| | | private static void start(Params params) {
|
| | | String pattern = FILESETTINGS.getString(Keys.server.log4jPattern,
|
| | | FileSettings settings = params.FILESETTINGS;
|
| | | String pattern = settings.getString(Keys.server.log4jPattern,
|
| | | "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n");
|
| | |
|
| | | // allow os override of logging pattern
|
| | | String os = System.getProperty("os.name").toLowerCase();
|
| | | if (os.indexOf("windows") > -1) {
|
| | | String winPattern = FILESETTINGS.getString(Keys.server.log4jPattern_windows, pattern);
|
| | | String winPattern = settings.getString(Keys.server.log4jPattern_windows, pattern);
|
| | | if (!StringUtils.isEmpty(winPattern)) {
|
| | | pattern = winPattern;
|
| | | }
|
| | | } else if (os.indexOf("linux") > -1) {
|
| | | String linuxPattern = FILESETTINGS.getString(Keys.server.log4jPattern_linux, pattern);
|
| | | String linuxPattern = settings.getString(Keys.server.log4jPattern_linux, pattern);
|
| | | if (!StringUtils.isEmpty(linuxPattern)) {
|
| | | pattern = linuxPattern;
|
| | | }
|
| | |
| | | rootLogger.addAppender(new ConsoleAppender(layout));
|
| | |
|
| | | logger = LoggerFactory.getLogger(GitBlitServer.class);
|
| | | logger.info(BORDER);
|
| | | logger.info(Constants.BORDER);
|
| | | logger.info(Constants.getGitBlitVersion());
|
| | | logger.info(BORDER);
|
| | | logger.info(Constants.BORDER);
|
| | |
|
| | | String osname = System.getProperty("os.name");
|
| | | String osversion = System.getProperty("os.version");
|
| | |
| | | List<Connector> connectors = new ArrayList<Connector>();
|
| | | if (params.port > 0) {
|
| | | Connector httpConnector = createConnector(params.useNIO, params.port);
|
| | | String bindInterface = FILESETTINGS.getString(Keys.server.httpBindInterface, null);
|
| | | String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
|
| | | if (!StringUtils.isEmpty(bindInterface)) {
|
| | | logger.warn(MessageFormat.format("Binding connector on port {0} to {1}",
|
| | | params.port, bindInterface));
|
| | |
| | | if (keystore.exists()) {
|
| | | Connector secureConnector = createSSLConnector(keystore, params.storePassword,
|
| | | params.useNIO, params.securePort);
|
| | | String bindInterface = FILESETTINGS.getString(Keys.server.httpsBindInterface, null);
|
| | | String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
|
| | | if (!StringUtils.isEmpty(bindInterface)) {
|
| | | logger.warn(MessageFormat.format("Binding ssl connector on port {0} to {1}",
|
| | | params.securePort, bindInterface));
|
| | |
| | | // Git Servlet
|
| | | ServletHolder gitServlet = null;
|
| | | String gitServletPathSpec = Constants.GIT_SERVLET_PATH + "*";
|
| | | if (FILESETTINGS.getBoolean(Keys.git.enableGitServlet, true)) {
|
| | | if (settings.getBoolean(Keys.git.enableGitServlet, true)) {
|
| | | gitServlet = rootContext.addServlet(GitBlitServlet.class, gitServletPathSpec);
|
| | | gitServlet.setInitParameter("base-path", params.repositoriesFolder);
|
| | | gitServlet.setInitParameter("export-all",
|
| | | FILESETTINGS.getBoolean(Keys.git.exportAll, true) ? "1" : "0");
|
| | | settings.getBoolean(Keys.git.exportAll, true) ? "1" : "0");
|
| | | }
|
| | |
|
| | | // Login Service
|
| | |
| | | handler = rootContext;
|
| | | }
|
| | |
|
| | | logger.info("Git repositories folder " + new File(params.repositoriesFolder).getAbsolutePath());
|
| | | |
| | | // Set the server's contexts
|
| | | server.setHandler(handler);
|
| | |
|
| | | // Setup the GitBlit context
|
| | | GitBlit gitblit = GitBlit.self();
|
| | | gitblit.configureContext(FILESETTINGS);
|
| | | gitblit.configureContext(settings);
|
| | | rootContext.addEventListener(gitblit);
|
| | |
|
| | | // Start the Server
|
| | |
| | | private final ServerSocket socket;
|
| | |
|
| | | private final Server server;
|
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(ShutdownMonitorThread.class);
|
| | |
|
| | | public ShutdownMonitorThread(Server server, Params params) {
|
| | | this.server = server;
|
| | |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(
|
| | | accept.getInputStream()));
|
| | | reader.readLine();
|
| | | logger.info(BORDER);
|
| | | logger.info(Constants.BORDER);
|
| | | logger.info("Stopping " + Constants.NAME);
|
| | | logger.info(BORDER);
|
| | | logger.info(Constants.BORDER);
|
| | | server.stop();
|
| | | server.setStopAtShutdown(false);
|
| | | accept.close();
|
| | |
| | |
|
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | | |
| | | private static final FileSettings FILESETTINGS = new FileSettings();
|
| | |
|
| | | /*
|
| | | * Server parameters
|
| | |
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | |
|
| | | public class GitBlitServlet extends GitServlet {
|
| | |
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | |
|
| | | public interface ILoginService {
|
| | |
|
| | |
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | |
|
| | | public class JettyLoginService extends MappedLoginService implements ILoginService {
|
| | |
|
| | |
| | | import com.gitblit.utils.TimeUtils;
|
| | |
|
| | | public class MakeCertificate {
|
| | |
|
| | | private static final FileSettings FILESETTINGS = new FileSettings();
|
| | |
|
| | | |
| | | private static final String BC = org.bouncycastle.jce.provider.BouncyCastleProvider.PROVIDER_NAME;
|
| | |
|
| | | public static void main(String... args) {
|
| | |
| | | @Parameters(separators = " ")
|
| | | private static class Params {
|
| | |
|
| | | private static final FileSettings FILESETTINGS = new FileSettings();
|
| | | |
| | | @Parameter(names = { "--alias" }, description = "Server alias", required = true)
|
| | | public String alias;
|
| | |
|
File was renamed from src/com/gitblit/wicket/models/Metric.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
File was renamed from src/com/gitblit/wicket/models/PathModel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import org.eclipse.jgit.lib.FileMode;
|
| | |
|
| | | public class PathModel implements Serializable, Comparable<PathModel> {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public boolean isTree() {
|
| | | return JGitUtils.isTreeFromMode(mode);
|
| | | return FileMode.TREE.equals(mode);
|
| | | }
|
| | |
|
| | | public static PathModel getParentPath(String basePath, String commitId) {
|
File was renamed from src/com/gitblit/wicket/models/RefModel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
| | | import org.eclipse.jgit.lib.ObjectId;
|
| | | import org.eclipse.jgit.lib.Ref;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | |
|
| | | public class RefModel implements Serializable, Comparable<RefModel> {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public Date getDate() {
|
| | | return JGitUtils.getCommitDate(commit);
|
| | | return new Date(commit.getCommitTime() * 1000L);
|
| | | }
|
| | |
|
| | | public String getName() {
|
File was renamed from src/com/gitblit/wicket/models/RepositoryModel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
| | | public class RepositoryModel implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | |
|
| | | // field names are reflectively mapped in EditRepository page
|
| | | public String name;
|
| | | public String description;
|
File was renamed from src/com/gitblit/wicket/models/TicketModel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.text.ParseException;
|
| | |
| | | public String author;
|
| | | public List<Comment> comments;
|
| | | public List<String> tags;
|
| | |
|
| | | public TicketModel() {
|
| | | state = "open";
|
| | | comments = new ArrayList<Comment>();
|
| | | tags = new ArrayList<String>();
|
| | | }
|
| | |
|
| | | public TicketModel(String ticketName) throws ParseException {
|
| | | state = "";
|
File was renamed from src/com/gitblit/wicket/models/UserModel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket.models;
|
| | | package com.gitblit.models;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.ArrayList;
|
New file |
| | |
| | | package com.gitblit.utils;
|
| | |
|
| | | import java.io.ByteArrayOutputStream;
|
| | | import java.util.List;
|
| | |
|
| | | import org.eclipse.jgit.diff.DiffEntry;
|
| | | import org.eclipse.jgit.diff.DiffFormatter;
|
| | | import org.eclipse.jgit.diff.RawTextComparator;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | | import org.eclipse.jgit.revwalk.RevTree;
|
| | | import org.eclipse.jgit.revwalk.RevWalk;
|
| | | import org.eclipse.jgit.treewalk.TreeWalk;
|
| | | import org.eclipse.jgit.treewalk.filter.TreeFilter;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils.DiffOutputType;
|
| | |
|
| | | public class DiffUtils {
|
| | |
|
| | | private static final Logger LOGGER = LoggerFactory.getLogger(DiffUtils.class);
|
| | | |
| | | public static String getCommitDiff(Repository r, RevCommit commit, DiffOutputType outputType) {
|
| | | return getCommitDiff(r, null, commit, null, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit commit, String path,
|
| | | DiffOutputType outputType) {
|
| | | return getCommitDiff(r, null, commit, path, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | DiffOutputType outputType) {
|
| | | return getCommitDiff(r, baseCommit, commit, null, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | String path, DiffOutputType outputType) {
|
| | | try {
|
| | | RevTree baseTree;
|
| | | if (baseCommit == null) {
|
| | | final RevWalk rw = new RevWalk(r);
|
| | | RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
|
| | | rw.dispose();
|
| | | baseTree = parent.getTree();
|
| | | } else {
|
| | | baseTree = baseCommit.getTree();
|
| | | }
|
| | |
|
| | | RevTree commitTree = commit.getTree();
|
| | |
|
| | | final TreeWalk walk = new TreeWalk(r);
|
| | | walk.reset();
|
| | | walk.setRecursive(true);
|
| | | walk.addTree(baseTree);
|
| | | walk.addTree(commitTree);
|
| | | walk.setFilter(TreeFilter.ANY_DIFF);
|
| | |
|
| | | final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
| | | RawTextComparator cmp = RawTextComparator.DEFAULT;
|
| | | DiffFormatter df;
|
| | | switch (outputType) {
|
| | | case GITWEB:
|
| | | df = new GitWebDiffFormatter(os);
|
| | | break;
|
| | | case GITBLIT:
|
| | | df = new GitBlitDiffFormatter(os);
|
| | | break;
|
| | | case PLAIN:
|
| | | default:
|
| | | df = new DiffFormatter(os);
|
| | | break;
|
| | | }
|
| | | df.setRepository(r);
|
| | | df.setDiffComparator(cmp);
|
| | | df.setDetectRenames(true);
|
| | | List<DiffEntry> diffs = df.scan(baseTree, commitTree);
|
| | | if (path != null && path.length() > 0) {
|
| | | for (DiffEntry diff : diffs) {
|
| | | if (diff.getNewPath().equalsIgnoreCase(path)) {
|
| | | df.format(diff);
|
| | | break;
|
| | | }
|
| | | }
|
| | | } else {
|
| | | df.format(diffs);
|
| | | }
|
| | | String diff;
|
| | | if (df instanceof GitWebDiffFormatter) {
|
| | | // workaround for complex private methods in DiffFormatter
|
| | | diff = ((GitWebDiffFormatter) df).getHtml();
|
| | | } else {
|
| | | diff = os.toString();
|
| | | }
|
| | | df.flush();
|
| | | return diff;
|
| | | } catch (Throwable t) {
|
| | | LOGGER.error("failed to generate commit diff!", t);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static String getCommitPatch(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | String path) {
|
| | | try {
|
| | | RevTree baseTree;
|
| | | if (baseCommit == null) {
|
| | | final RevWalk rw = new RevWalk(r);
|
| | | RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
|
| | | baseTree = parent.getTree();
|
| | | } else {
|
| | | baseTree = baseCommit.getTree();
|
| | | }
|
| | | RevTree commitTree = commit.getTree();
|
| | |
|
| | | final TreeWalk walk = new TreeWalk(r);
|
| | | walk.reset();
|
| | | walk.setRecursive(true);
|
| | | walk.addTree(baseTree);
|
| | | walk.addTree(commitTree);
|
| | | walk.setFilter(TreeFilter.ANY_DIFF);
|
| | |
|
| | | final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
| | | RawTextComparator cmp = RawTextComparator.DEFAULT;
|
| | | PatchFormatter df = new PatchFormatter(os);
|
| | | df.setRepository(r);
|
| | | df.setDiffComparator(cmp);
|
| | | df.setDetectRenames(true);
|
| | | List<DiffEntry> diffs = df.scan(baseTree, commitTree);
|
| | | if (path != null && path.length() > 0) {
|
| | | for (DiffEntry diff : diffs) {
|
| | | if (diff.getNewPath().equalsIgnoreCase(path)) {
|
| | | df.format(diff);
|
| | | break;
|
| | | }
|
| | | }
|
| | | } else {
|
| | | df.format(diffs);
|
| | | }
|
| | | String diff = df.getPatch(commit);
|
| | | df.flush();
|
| | | return diff;
|
| | | } catch (Throwable t) {
|
| | | LOGGER.error("failed to generate commit diff!", t);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | 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;
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.models.PathModel;
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.models.TicketModel;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.TicketModel.Comment;
|
| | |
|
| | | public class JGitUtils {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public static boolean hasCommits(Repository r) {
|
| | | return new File(r.getDirectory(), Constants.R_HEADS).list().length > 0;
|
| | | if (r != null && r.getDirectory().exists()) {
|
| | | return new File(r.getDirectory(), Constants.R_HEADS).list().length > 0;
|
| | | }
|
| | | return false; |
| | | }
|
| | |
|
| | | public static Date getLastChange(Repository r) {
|
| | | if (!hasCommits(r)) {
|
| | | // null repository
|
| | | if (r == null) {
|
| | | return new Date(0);
|
| | | }
|
| | | // fresh repository
|
| | | return new Date(r.getDirectory().lastModified());
|
| | | }
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit commit, DiffOutputType outputType) {
|
| | | return getCommitDiff(r, null, commit, null, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit commit, String path,
|
| | | DiffOutputType outputType) {
|
| | | return getCommitDiff(r, null, commit, path, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | DiffOutputType outputType) {
|
| | | return getCommitDiff(r, baseCommit, commit, null, outputType);
|
| | | }
|
| | |
|
| | | public static String getCommitDiff(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | String path, DiffOutputType outputType) {
|
| | | try {
|
| | | RevTree baseTree;
|
| | | if (baseCommit == null) {
|
| | | final RevWalk rw = new RevWalk(r);
|
| | | RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
|
| | | rw.dispose();
|
| | | baseTree = parent.getTree();
|
| | | } else {
|
| | | baseTree = baseCommit.getTree();
|
| | | }
|
| | |
|
| | | RevTree commitTree = commit.getTree();
|
| | |
|
| | | final TreeWalk walk = new TreeWalk(r);
|
| | | walk.reset();
|
| | | walk.setRecursive(true);
|
| | | walk.addTree(baseTree);
|
| | | walk.addTree(commitTree);
|
| | | walk.setFilter(TreeFilter.ANY_DIFF);
|
| | |
|
| | | final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
| | | RawTextComparator cmp = RawTextComparator.DEFAULT;
|
| | | DiffFormatter df;
|
| | | switch (outputType) {
|
| | | case GITWEB:
|
| | | df = new GitWebDiffFormatter(os);
|
| | | break;
|
| | | case GITBLIT:
|
| | | df = new GitBlitDiffFormatter(os);
|
| | | break;
|
| | | case PLAIN:
|
| | | default:
|
| | | df = new DiffFormatter(os);
|
| | | break;
|
| | | }
|
| | | df.setRepository(r);
|
| | | df.setDiffComparator(cmp);
|
| | | df.setDetectRenames(true);
|
| | | List<DiffEntry> diffs = df.scan(baseTree, commitTree);
|
| | | if (path != null && path.length() > 0) {
|
| | | for (DiffEntry diff : diffs) {
|
| | | if (diff.getNewPath().equalsIgnoreCase(path)) {
|
| | | df.format(diff);
|
| | | break;
|
| | | }
|
| | | }
|
| | | } else {
|
| | | df.format(diffs);
|
| | | }
|
| | | String diff;
|
| | | if (df instanceof GitWebDiffFormatter) {
|
| | | // workaround for complex private methods in DiffFormatter
|
| | | diff = ((GitWebDiffFormatter) df).getHtml();
|
| | | } else {
|
| | | diff = os.toString();
|
| | | }
|
| | | df.flush();
|
| | | return diff;
|
| | | } catch (Throwable t) {
|
| | | LOGGER.error("failed to generate commit diff!", t);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static String getCommitPatch(Repository r, RevCommit baseCommit, RevCommit commit,
|
| | | String path) {
|
| | | try {
|
| | | RevTree baseTree;
|
| | | if (baseCommit == null) {
|
| | | final RevWalk rw = new RevWalk(r);
|
| | | RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
|
| | | baseTree = parent.getTree();
|
| | | } else {
|
| | | baseTree = baseCommit.getTree();
|
| | | }
|
| | | RevTree commitTree = commit.getTree();
|
| | |
|
| | | final TreeWalk walk = new TreeWalk(r);
|
| | | walk.reset();
|
| | | walk.setRecursive(true);
|
| | | walk.addTree(baseTree);
|
| | | walk.addTree(commitTree);
|
| | | walk.setFilter(TreeFilter.ANY_DIFF);
|
| | |
|
| | | final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
| | | RawTextComparator cmp = RawTextComparator.DEFAULT;
|
| | | PatchFormatter df = new PatchFormatter(os);
|
| | | df.setRepository(r);
|
| | | df.setDiffComparator(cmp);
|
| | | df.setDetectRenames(true);
|
| | | List<DiffEntry> diffs = df.scan(baseTree, commitTree);
|
| | | if (path != null && path.length() > 0) {
|
| | | for (DiffEntry diff : diffs) {
|
| | | if (diff.getNewPath().equalsIgnoreCase(path)) {
|
| | | df.format(diff);
|
| | | break;
|
| | | }
|
| | | }
|
| | | } else {
|
| | | df.format(diffs);
|
| | | }
|
| | | String diff = df.getPatch(commit);
|
| | | df.flush();
|
| | | return diff;
|
| | | } catch (Throwable t) {
|
| | | LOGGER.error("failed to generate commit diff!", t);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static PathModel getPathModel(TreeWalk walk, String basePath, RevCommit commit) {
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.LoginPage;
|
| | | import com.gitblit.wicket.pages.RepositoriesPage;
|
| | |
|
| | | public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
|
| | |
| | | }
|
| | |
|
| | | UserModel user = session.getUser();
|
| | | if (pageClass.isAnnotationPresent(AdminPage.class)) {
|
| | | if (pageClass.isAnnotationPresent(RequiresAdminRole.class)) {
|
| | | // admin page
|
| | | if (allowAdmin) {
|
| | | if (authenticateAdmin) {
|
| | |
| | | import com.gitblit.wicket.pages.DocsPage;
|
| | | import com.gitblit.wicket.pages.HistoryPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.LoginPage;
|
| | | import com.gitblit.wicket.pages.LogoutPage;
|
| | | import com.gitblit.wicket.pages.MarkdownPage;
|
| | | import com.gitblit.wicket.pages.PatchPage;
|
| | | import com.gitblit.wicket.pages.RawPage;
|
| | |
| | | import org.apache.wicket.protocol.http.WebSession;
|
| | | import org.apache.wicket.protocol.http.request.WebClientInfo;
|
| | |
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | |
|
| | | public final class GitBlitWebSession extends WebSession {
|
| | |
|
File was renamed from src/com/gitblit/wicket/AdminPage.java |
| | |
| | |
|
| | | @Retention(RetentionPolicy.RUNTIME)
|
| | | @Target(ElementType.TYPE)
|
| | | public @interface AdminPage {
|
| | | public @interface RequiresAdminRole {
|
| | | }
|
File was renamed from src/com/gitblit/wicket/BasePage.html |
| | |
| | | <wicket:head>
|
| | | <title wicket:id="title">[page title]</title>
|
| | | <wicket:link>
|
| | | <link rel="stylesheet" type="text/css" href="resources/gitblit.css"/>
|
| | | <link rel="shortcut icon" href="resources/gitblt-favicon.png" type="image/png" />
|
| | | <link rel="stylesheet" type="text/css" href="/com/gitblit/wicket/resources/gitblit.css"/>
|
| | | <link rel="shortcut icon" href="/com/gitblit/wicket/resources/gitblt-favicon.png" type="image/png" />
|
| | | </wicket:link>
|
| | | </wicket:head>
|
| | |
|
| | |
| | | <div class="page_header">
|
| | | <a title="gitblit homepage" href="http://gitblit.com/">
|
| | | <wicket:link>
|
| | | <img src="resources/gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
|
| | | <img src="/com/gitblit/wicket/resources/gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
|
| | | </wicket:link>
|
| | | </a>
|
| | | <span>
|
File was renamed from src/com/gitblit/wicket/BasePage.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.util.LinkedHashMap;
|
| | | import java.util.Map;
|
| | |
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | |
|
| | | public abstract class BasePage extends WebPage {
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.DiffOutputType;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
| | | String diff;
|
| | | if (StringUtils.isEmpty(baseObjectId)) {
|
| | | // use first parent
|
| | | diff = JGitUtils.getCommitDiff(r, commit, blobPath, diffType);
|
| | | diff = DiffUtils.getCommitDiff(r, commit, blobPath, diffType);
|
| | | add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
|
| | | } else {
|
| | | // base commit specified
|
| | | RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
|
| | | diff = JGitUtils.getCommitDiff(r, baseCommit, commit, blobPath, diffType);
|
| | | diff = DiffUtils.getCommitDiff(r, baseCommit, commit, blobPath, diffType);
|
| | | add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
|
| | | WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
|
| | | blobPath)));
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | |
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | |
|
| | | public class BranchesPage extends RepositoryPage {
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.DiffOutputType;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.CommitLegendPanel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | |
|
| | | public class CommitDiffPage extends RepositoryPage {
|
| | |
|
| | |
| | | RevCommit commit = getCommit();
|
| | | DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
|
| | | DiffOutputType.GITBLIT.name()));
|
| | | String diff = JGitUtils.getCommitDiff(r, commit, diffType);
|
| | | String diff = DiffUtils.getCommitDiff(r, commit, diffType);
|
| | |
|
| | | List<String> parents = new ArrayList<String>();
|
| | | if (commit.getParentCount() > 0) {
|
| | |
| | | import com.gitblit.DownloadZipServlet;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.CommitLegendPanel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | |
|
| | | public class CommitPage extends RepositoryPage {
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.PathModel;
|
| | | 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.LinkPanel;
|
| | |
|
| | | public class DocsPage extends RepositoryPage {
|
| | |
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.BasePage;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | |
|
| | | public class EditRepositoryPage extends BasePage {
|
| | |
|
| | |
| | | // create constructor
|
| | | super();
|
| | | isCreate = true;
|
| | | setupPage(new RepositoryModel("", "", "", new Date()));
|
| | | setupPage(new RepositoryModel());
|
| | | }
|
| | |
|
| | | public EditRepositoryPage(PageParameters params) {
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.AdminPage;
|
| | | import com.gitblit.wicket.BasePage;
|
| | | import com.gitblit.wicket.RequiresAdminRole;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | |
|
| | | @AdminPage
|
| | | @RequiresAdminRole
|
| | | public class EditUserPage extends BasePage {
|
| | |
|
| | | private final boolean isCreate;
|
| | |
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | |
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.HistoryPanel;
|
| | |
|
| | |
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | |
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.LogPanel;
|
| | |
|
File was renamed from src/com/gitblit/wicket/LoginPage.html |
| | |
| | | <wicket:head>
|
| | | <title wicket:id="title">[page title]</title>
|
| | | <wicket:link>
|
| | | <link rel="stylesheet" type="text/css" href="resources/gitblit.css"/>
|
| | | <link rel="shortcut icon" href="resources/gitblt-favicon.png" type="image/png" />
|
| | | <link rel="stylesheet" type="text/css" href="/com/gitblit/wicket/resources/gitblit.css"/>
|
| | | <link rel="shortcut icon" href="/com/gitblit/wicket/resources/gitblt-favicon.png" type="image/png" />
|
| | | </wicket:link>
|
| | | </wicket:head>
|
| | |
|
| | |
| | | <div>
|
| | | <div style="padding-top: 10px;text-align:center;">
|
| | | <wicket:link>
|
| | | <img src="resources/gitblt_25.png" alt="Git:Blit"/><br/>
|
| | | <img src="/com/gitblit/wicket/resources/gitblt_25.png" alt="Git:Blit"/><br/>
|
| | | </wicket:link>
|
| | | <div style="padding-top:30px;font-weight:bold;" wicket:id="name">[name]</div>
|
| | | </div>
|
File was renamed from src/com/gitblit/wicket/LoginPage.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.WebPage;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.form.Form;
|
| | | import org.apache.wicket.markup.html.form.PasswordTextField;
|
| | | import org.apache.wicket.markup.html.form.StatelessForm;
|
| | | import org.apache.wicket.markup.html.form.TextField;
|
| | |
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | |
|
| | | public class LoginPage extends WebPage {
|
| | |
|
| | |
| | | public LoginPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | // If we are already logged in because user directly accessed
|
| | | // the login url, redirect to the home page
|
| | | if (GitBlitWebSession.get().isLoggedIn()) {
|
| | | setRedirect(true);
|
| | | setResponsePage(getApplication().getHomePage());
|
| | | }
|
| | | |
| | | add(new Label("title", GitBlit.getString(Keys.web.siteName, Constants.NAME)));
|
| | | add(new Label("name", Constants.NAME));
|
| | |
|
| | | Form<Void> loginForm = new LoginForm("loginForm");
|
| | | StatelessForm<Void> loginForm = new StatelessForm<Void>("loginForm") {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Override
|
| | | public void onSubmit() {
|
| | | String username = LoginPage.this.username.getObject();
|
| | | char[] password = LoginPage.this.password.getObject().toCharArray();
|
| | |
|
| | | UserModel user = GitBlit.self().authenticate(username, password);
|
| | | if (user == null) {
|
| | | error("Invalid username or password!");
|
| | | } else {
|
| | | loginUser(user);
|
| | | }
|
| | | }
|
| | | };
|
| | | loginForm.add(new TextField<String>("username", username));
|
| | | loginForm.add(new PasswordTextField("password", password));
|
| | | loginForm.add(new FeedbackPanel("feedback"));
|
| | | add(loginForm);
|
| | | }
|
| | |
|
| | | class LoginForm extends StatelessForm<Void> {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public LoginForm(String id) {
|
| | | super(id);
|
| | |
|
| | | // If we are already logged in because user directly accessed
|
| | | // the login url, redirect to the home page
|
| | | if (GitBlitWebSession.get().isLoggedIn()) {
|
| | | setRedirect(true);
|
| | | setResponsePage(getApplication().getHomePage());
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onSubmit() {
|
| | | String username = LoginPage.this.username.getObject();
|
| | | char[] password = LoginPage.this.password.getObject().toCharArray();
|
| | |
|
| | | UserModel user = GitBlit.self().authenticate(username, password);
|
| | | if (user == null) {
|
| | | error("Invalid username or password!");
|
| | | } else {
|
| | | loginUser(user);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void loginUser(UserModel user) {
|
File was renamed from src/com/gitblit/wicket/LogoutPage.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import org.apache.wicket.markup.html.WebPage;
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
|
| | | public class MarkdownPage extends RepositoryPage {
|
| | |
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | |
| | | if (!StringUtils.isEmpty(baseObjectId)) {
|
| | | baseCommit = JGitUtils.getCommit(r, baseObjectId);
|
| | | }
|
| | | String patch = JGitUtils.getCommitPatch(r, baseCommit, commit, blobPath);
|
| | | String patch = DiffUtils.getCommitPatch(r, baseCommit, commit, blobPath);
|
| | | add(new Label("patchText", patch));
|
| | | r.close();
|
| | | }
|
| | |
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.BasePage;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.RepositoriesPanel;
|
File was renamed from src/com/gitblit/wicket/RepositoryPage.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.pages.BranchesPage;
|
| | | import com.gitblit.wicket.pages.DocsPage;
|
| | | import com.gitblit.wicket.pages.EditRepositoryPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SearchPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TagsPage;
|
| | | import com.gitblit.wicket.pages.TicketsPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | | import com.gitblit.wicket.panels.RefsPanel;
|
| | |
|
| | | public abstract class RepositoryPage extends BasePage {
|
| | |
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.SearchPanel;
|
| | |
|
| | |
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.Metric;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | | import com.gitblit.wicket.panels.LogPanel;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | 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.LinkPanel;
|
| | |
|
| | | public class TagPage extends RepositoryPage {
|
| | |
|
| | |
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | |
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
|
| | | public class TagsPage extends RepositoryPage {
|
| | |
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.models.TicketModel;
|
| | | import com.gitblit.models.TicketModel.Comment;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.TicketModel;
|
| | | import com.gitblit.wicket.models.TicketModel.Comment;
|
| | |
|
| | | public class TicketPage extends RepositoryPage {
|
| | |
|
| | |
| | | import org.apache.wicket.markup.repeater.data.DataView;
|
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | |
|
| | | import com.gitblit.models.TicketModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | 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.TicketModel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | |
|
| | | public class TicketsPage extends RepositoryPage {
|
| | |
|
| | |
| | | import com.gitblit.DownloadZipServlet;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.PathModel;
|
| | | 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.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
|
| | | public class TreePage extends RepositoryPage {
|
| | |
| | | import org.eclipse.jgit.lib.Constants;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.pages.BranchesPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | |
|
| | |
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | | import org.eclipse.jgit.diff.DiffEntry.ChangeType;
|
| | |
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | |
|
| | | public class CommitLegendPanel extends Panel {
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.PathModel;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | 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;
|
File was renamed from src/com/gitblit/wicket/LinkPanel.java |
| | |
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package com.gitblit.wicket;
|
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.SimpleAttributeModifier;
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | 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.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | |
| | | 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.WicketUtils;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | |
| | |
|
| | | public void populateItem(final Item<BreadCrumb> item) {
|
| | | final BreadCrumb entry = item.getModelObject();
|
| | | String path = entry.getPath();
|
| | | String path = entry.path;
|
| | | if (path.equals(ROOT)) {
|
| | | path = null;
|
| | | }
|
| | | if (entry.isLeaf) {
|
| | | item.add(new Label("pathLink", entry.name));
|
| | | item.add(new Label("pathSeparator", "").setVisible(false));
|
| | |
| | | this.name = name;
|
| | | this.path = path;
|
| | | this.isLeaf = isLeaf;
|
| | | }
|
| | |
|
| | | String getPath() {
|
| | | if (path.equals(ROOT)) {
|
| | | return null;
|
| | | }
|
| | | return path;
|
| | | }
|
| | | } |
| | | }
|
| | | } |
| | |
| | | import org.eclipse.jgit.lib.ObjectId;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | |
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | | import com.gitblit.wicket.pages.EditRepositoryPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | 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.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | |
| | | import org.apache.wicket.model.StringResourceModel;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.EditUserPage;
|
| | |
|
| | |
| | | suite.addTestSuite(JGitUtilsTest.class);
|
| | | return new GitBlitSuite(suite);
|
| | | }
|
| | | |
| | |
|
| | | public static Repository getHelloworldRepository() throws Exception {
|
| | | return new FileRepository(new File(REPOSITORIES, "helloworld.git"));
|
| | | }
|
| | |
| | | import org.eclipse.jgit.revwalk.RevObject;
|
| | | import org.eclipse.jgit.revwalk.RevTree;
|
| | |
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.models.TicketModel;
|
| | | import com.gitblit.utils.DiffUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.DiffOutputType;
|
| | | import com.gitblit.wicket.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.models.TicketModel;
|
| | |
|
| | | public class JGitUtilsTest extends TestCase {
|
| | |
|
| | |
| | | Repository repository = GitBlitSuite.getHelloworldRepository();
|
| | | RevCommit commit = JGitUtils.getCommit(repository,
|
| | | "1d0c2933a4ae69c362f76797d42d6bd182d05176");
|
| | | String diff = JGitUtils.getCommitDiff(repository, commit, DiffOutputType.PLAIN);
|
| | | String diff = DiffUtils.getCommitDiff(repository, commit, DiffOutputType.PLAIN);
|
| | | repository.close();
|
| | | assertTrue("Failed to generate diff!", diff != null && diff.length() > 0);
|
| | | String expected = "- system.out.println(\"Hello World\");\n+ System.out.println(\"Hello World\"";
|