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