blob: eab94898beb1d863cbedb342d6bcf8c063ce2aa8 [file] [log] [blame] [view]
David Pursehouseb5ee6742016-08-24 12:49:26 +09001# Gitiles - A simple JGit repository browser
Dave Borowitzeb794ea2012-11-12 14:48:15 -08002
3Gitiles is a simple repository browser for Git repositories, built on JGit. Its
4guiding principle is simplicity: it has no formal access controls, no write
5access, no fancy Javascript, etc.
Eric Seidel48816fb2013-06-11 17:17:50 -07006
David Pursehouseb5ee6742016-08-24 12:49:26 +09007## Building
Eric Seidel48816fb2013-06-11 17:17:50 -07008
Shawn Pearcea9b9e992015-02-20 16:57:23 -08009Gitiles requires [Buck](http://facebook.github.io/buck/) to build.
Eric Seidel48816fb2013-06-11 17:17:50 -070010
Shawn Pearcea9b9e992015-02-20 16:57:23 -080011```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050012sudo apt-get install ant
13cd ${HOME}
14git clone https://github.com/facebook/buck.git
15cd buck
16ant
17sudo ln -s ${PWD}/bin/buck /usr/bin/buck
18cd /path/to/gitiles
19git submodule update --init
20buck build all
21buck test
Shawn Pearcea9b9e992015-02-20 16:57:23 -080022```
Eric Seidel48816fb2013-06-11 17:17:50 -070023
24
David Pursehouseb5ee6742016-08-24 12:49:26 +090025## Testing
Eric Seidel48816fb2013-06-11 17:17:50 -070026
Shawn Pearcea9b9e992015-02-20 16:57:23 -080027```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050028cd /path/to/repositories # Don't run from the gitiles repo.
29/path/to/gitiles/tools/run_dev.sh
Shawn Pearcea9b9e992015-02-20 16:57:23 -080030```
Dave Borowitz4cecfb02014-03-21 09:49:57 -070031
Shawn Pearcea9b9e992015-02-20 16:57:23 -080032This will recompile and start a development server. Open
33http://localhost:8080/ to view your local copy of gitiles, which
34will serve any repositories under `/path/to/repositories`.
Eric Seidel48816fb2013-06-11 17:17:50 -070035
Jonathan Niederb3dabb12015-10-22 14:12:18 -070036To run unit tests, run `buck test`.
37
Eric Seidel48816fb2013-06-11 17:17:50 -070038
David Pursehouseb5ee6742016-08-24 12:49:26 +090039## Eclipse IDE
Eric Seidel48816fb2013-06-11 17:17:50 -070040
Dave Borowitz4cecfb02014-03-21 09:49:57 -070041If you'd like to use Eclipse to edit Gitiles, first generate a project file:
Shawn Pearcea9b9e992015-02-20 16:57:23 -080042
43```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050044./bucklets/tools/eclipse.py --src
Shawn Pearcea9b9e992015-02-20 16:57:23 -080045```
Eric Seidel48816fb2013-06-11 17:17:50 -070046
Dave Borowitz4cecfb02014-03-21 09:49:57 -070047Import the project in Eclipse:
Shawn Pearcea9b9e992015-02-20 16:57:23 -080048
49```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050050File -> Import -> Existing Projects into Workpace
Shawn Pearcea9b9e992015-02-20 16:57:23 -080051```
Eric Seidel48816fb2013-06-11 17:17:50 -070052
Dave Borowitz4cecfb02014-03-21 09:49:57 -070053The project only needs to be rebuilt if the source roots or third-party
54libraries have changed. For best results, ensure the project is closed in
55Eclipse before rebuilding.
Eric Seidel48816fb2013-06-11 17:17:50 -070056
57
David Pursehouseb5ee6742016-08-24 12:49:26 +090058## Code Style
Dave Borowitzaa12bb22015-09-17 13:21:39 -040059
Shawn Pearce12c8fab2016-05-15 16:55:21 -070060Java code in Gitiles follows the [Google Java Style Guide][java-style]
61with a 100-column limit.
Dave Borowitzaa12bb22015-09-17 13:21:39 -040062
Shawn Pearce12c8fab2016-05-15 16:55:21 -070063Code should be automatically formatted using [google-java-format][fmt]
64prior to sending a code review. There is currently no Eclipse
65formatter, but the tool can be run from the command line:
Dave Borowitzc92d4a22016-05-02 11:43:35 -040066
67```
68java -jar /path/to/google-java-format-1.0-all-deps.jar -i path/to/java/File.java
69```
70
Shawn Pearce12c8fab2016-05-15 16:55:21 -070071CSS 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 Borowitzaa12bb22015-09-17 13:21:39 -040076
David Pursehouseb5ee6742016-08-24 12:49:26 +090077## Code Review
Eric Seidel48816fb2013-06-11 17:17:50 -070078
79Gitiles uses Gerrit for code review:
80https://gerrit-review.googlesource.com/
81
Shawn Pearcea9b9e992015-02-20 16:57:23 -080082Gitiles uses the ["git push" workflow][1] with server
83https://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 Seidel48816fb2013-06-11 17:17:50 -070088
89Gerrit depends on "Change-Id" annotations in your commit message.
90If you try to push a commit without one, it will explain how to
91install the proper git-hook:
92
Shawn Pearcea9b9e992015-02-20 16:57:23 -080093```
Eric Seidel48816fb2013-06-11 17:17:50 -070094curl -Lo `git rev-parse --git-dir`/hooks/commit-msg \
95 https://gerrit-review.googlesource.com/tools/hooks/commit-msg
96chmod +x `git rev-parse --git-dir`/hooks/commit-msg
Shawn Pearcea9b9e992015-02-20 16:57:23 -080097```
Eric Seidel48816fb2013-06-11 17:17:50 -070098
99Before you create your local commit (which you'll push to Gerrit)
100you will need to set your email to match your Gerrit account:
Eric Seidel48816fb2013-06-11 17:17:50 -0700101
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800102```
103git config --local --add user.email [email protected]
104```
105
106Normally you will create code reviews by pushing for master:
107
108```
Eric Seidel48816fb2013-06-11 17:17:50 -0700109git push origin HEAD:refs/for/master
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800110```