| Dave Borowitz | eb794ea | 2012-11-12 14:48:15 -0800 | [diff] [blame] | 1 | Gitiles - A simple JGit repository browser |
| 2 | ========================================== |
| 3 | |
| 4 | Gitiles is a simple repository browser for Git repositories, built on JGit. Its |
| 5 | guiding principle is simplicity: it has no formal access controls, no write |
| 6 | access, no fancy Javascript, etc. |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 7 | |
| 8 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 9 | Building |
| 10 | -------- |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 11 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 12 | Gitiles requires [Buck](http://facebook.github.io/buck/) to build. |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 13 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 14 | ``` |
| Timothy Cyrus | 416c81c | 2016-01-28 22:53:20 -0500 | [diff] [blame] | 15 | sudo apt-get install ant |
| 16 | cd ${HOME} |
| 17 | git clone https://github.com/facebook/buck.git |
| 18 | cd buck |
| 19 | ant |
| 20 | sudo ln -s ${PWD}/bin/buck /usr/bin/buck |
| 21 | cd /path/to/gitiles |
| 22 | git submodule update --init |
| 23 | buck build all |
| 24 | buck test |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 25 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 26 | |
| 27 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 28 | Testing |
| 29 | ------- |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 30 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 31 | ``` |
| Timothy Cyrus | 416c81c | 2016-01-28 22:53:20 -0500 | [diff] [blame] | 32 | cd /path/to/repositories # Don't run from the gitiles repo. |
| 33 | /path/to/gitiles/tools/run_dev.sh |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 34 | ``` |
| Dave Borowitz | 4cecfb0 | 2014-03-21 09:49:57 -0700 | [diff] [blame] | 35 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 36 | This will recompile and start a development server. Open |
| 37 | http://localhost:8080/ to view your local copy of gitiles, which |
| 38 | will serve any repositories under `/path/to/repositories`. |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 39 | |
| Jonathan Nieder | b3dabb1 | 2015-10-22 14:12:18 -0700 | [diff] [blame] | 40 | To run unit tests, run `buck test`. |
| 41 | |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 42 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 43 | Eclipse IDE |
| 44 | ----------- |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 45 | |
| Dave Borowitz | 4cecfb0 | 2014-03-21 09:49:57 -0700 | [diff] [blame] | 46 | If you'd like to use Eclipse to edit Gitiles, first generate a project file: |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 47 | |
| 48 | ``` |
| Timothy Cyrus | 416c81c | 2016-01-28 22:53:20 -0500 | [diff] [blame] | 49 | ./bucklets/tools/eclipse.py --src |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 50 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 51 | |
| Dave Borowitz | 4cecfb0 | 2014-03-21 09:49:57 -0700 | [diff] [blame] | 52 | Import the project in Eclipse: |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 53 | |
| 54 | ``` |
| Timothy Cyrus | 416c81c | 2016-01-28 22:53:20 -0500 | [diff] [blame] | 55 | File -> Import -> Existing Projects into Workpace |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 56 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 57 | |
| Dave Borowitz | 4cecfb0 | 2014-03-21 09:49:57 -0700 | [diff] [blame] | 58 | The project only needs to be rebuilt if the source roots or third-party |
| 59 | libraries have changed. For best results, ensure the project is closed in |
| 60 | Eclipse before rebuilding. |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 61 | |
| 62 | |
| Dave Borowitz | aa12bb2 | 2015-09-17 13:21:39 -0400 | [diff] [blame] | 63 | Code Style |
| 64 | ---------- |
| 65 | |
| 66 | Java code in Gitiles follows the [Google Java Style Guide] |
| 67 | (https://google.github.io/styleguide/javaguide.html) with a 100-column limit. |
| 68 | |
| Dave Borowitz | c92d4a2 | 2016-05-02 11:43:35 -0400 | [diff] [blame] | 69 | Code should be automatically formatted using [google-java-format] |
| 70 | (https://github.com/google/google-java-format) prior to sending a code review. |
| 71 | There is currently no Eclipse formatter, but the tool can be run from the |
| 72 | command line: |
| 73 | |
| 74 | ``` |
| 75 | java -jar /path/to/google-java-format-1.0-all-deps.jar -i path/to/java/File.java |
| 76 | ``` |
| 77 | |
| Dave Borowitz | aa12bb2 | 2015-09-17 13:21:39 -0400 | [diff] [blame] | 78 | CSS in Gitiles follows the [SUIT CSS naming conventions] |
| 79 | (https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md). |
| 80 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 81 | Code Review |
| 82 | ----------- |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 83 | |
| 84 | Gitiles uses Gerrit for code review: |
| 85 | https://gerrit-review.googlesource.com/ |
| 86 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 87 | Gitiles uses the ["git push" workflow][1] with server |
| 88 | https://gerrit.googlesource.com/gitiles. You will need a |
| 89 | [generated cookie][2]. |
| 90 | |
| 91 | [1]: https://gerrit-review.googlesource.com/Documentation/user-upload.html#_git_push |
| 92 | [2]: https://gerrit.googlesource.com/new-password |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 93 | |
| 94 | Gerrit depends on "Change-Id" annotations in your commit message. |
| 95 | If you try to push a commit without one, it will explain how to |
| 96 | install the proper git-hook: |
| 97 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 98 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 99 | curl -Lo `git rev-parse --git-dir`/hooks/commit-msg \ |
| 100 | https://gerrit-review.googlesource.com/tools/hooks/commit-msg |
| 101 | chmod +x `git rev-parse --git-dir`/hooks/commit-msg |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 102 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 103 | |
| 104 | Before you create your local commit (which you'll push to Gerrit) |
| 105 | you will need to set your email to match your Gerrit account: |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 106 | |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 107 | ``` |
| 108 | git config --local --add user.email [email protected] |
| 109 | ``` |
| 110 | |
| 111 | Normally you will create code reviews by pushing for master: |
| 112 | |
| 113 | ``` |
| Eric Seidel | 48816fb | 2013-06-11 17:17:50 -0700 | [diff] [blame] | 114 | git push origin HEAD:refs/for/master |
| Shawn Pearce | a9b9e99 | 2015-02-20 16:57:23 -0800 | [diff] [blame] | 115 | ``` |