blob: 21bb4732d408efda947c9c1b924341517ae229e4 [file] [log] [blame] [view]
Dave Borowitzeb794ea2012-11-12 14:48:15 -08001Gitiles - A simple JGit repository browser
2==========================================
3
4Gitiles is a simple repository browser for Git repositories, built on JGit. Its
5guiding principle is simplicity: it has no formal access controls, no write
6access, no fancy Javascript, etc.
Eric Seidel48816fb2013-06-11 17:17:50 -07007
8
Shawn Pearcea9b9e992015-02-20 16:57:23 -08009Building
10--------
Eric Seidel48816fb2013-06-11 17:17:50 -070011
Shawn Pearcea9b9e992015-02-20 16:57:23 -080012Gitiles requires [Buck](http://facebook.github.io/buck/) to build.
Eric Seidel48816fb2013-06-11 17:17:50 -070013
Shawn Pearcea9b9e992015-02-20 16:57:23 -080014```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050015sudo apt-get install ant
16cd ${HOME}
17git clone https://github.com/facebook/buck.git
18cd buck
19ant
20sudo ln -s ${PWD}/bin/buck /usr/bin/buck
21cd /path/to/gitiles
22git submodule update --init
23buck build all
24buck test
Shawn Pearcea9b9e992015-02-20 16:57:23 -080025```
Eric Seidel48816fb2013-06-11 17:17:50 -070026
27
Shawn Pearcea9b9e992015-02-20 16:57:23 -080028Testing
29-------
Eric Seidel48816fb2013-06-11 17:17:50 -070030
Shawn Pearcea9b9e992015-02-20 16:57:23 -080031```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050032cd /path/to/repositories # Don't run from the gitiles repo.
33/path/to/gitiles/tools/run_dev.sh
Shawn Pearcea9b9e992015-02-20 16:57:23 -080034```
Dave Borowitz4cecfb02014-03-21 09:49:57 -070035
Shawn Pearcea9b9e992015-02-20 16:57:23 -080036This will recompile and start a development server. Open
37http://localhost:8080/ to view your local copy of gitiles, which
38will serve any repositories under `/path/to/repositories`.
Eric Seidel48816fb2013-06-11 17:17:50 -070039
Jonathan Niederb3dabb12015-10-22 14:12:18 -070040To run unit tests, run `buck test`.
41
Eric Seidel48816fb2013-06-11 17:17:50 -070042
Shawn Pearcea9b9e992015-02-20 16:57:23 -080043Eclipse IDE
44-----------
Eric Seidel48816fb2013-06-11 17:17:50 -070045
Dave Borowitz4cecfb02014-03-21 09:49:57 -070046If you'd like to use Eclipse to edit Gitiles, first generate a project file:
Shawn Pearcea9b9e992015-02-20 16:57:23 -080047
48```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050049./bucklets/tools/eclipse.py --src
Shawn Pearcea9b9e992015-02-20 16:57:23 -080050```
Eric Seidel48816fb2013-06-11 17:17:50 -070051
Dave Borowitz4cecfb02014-03-21 09:49:57 -070052Import the project in Eclipse:
Shawn Pearcea9b9e992015-02-20 16:57:23 -080053
54```
Timothy Cyrus416c81c2016-01-28 22:53:20 -050055File -> Import -> Existing Projects into Workpace
Shawn Pearcea9b9e992015-02-20 16:57:23 -080056```
Eric Seidel48816fb2013-06-11 17:17:50 -070057
Dave Borowitz4cecfb02014-03-21 09:49:57 -070058The project only needs to be rebuilt if the source roots or third-party
59libraries have changed. For best results, ensure the project is closed in
60Eclipse before rebuilding.
Eric Seidel48816fb2013-06-11 17:17:50 -070061
62
Dave Borowitzaa12bb22015-09-17 13:21:39 -040063Code Style
64----------
65
66Java code in Gitiles follows the [Google Java Style Guide]
67(https://google.github.io/styleguide/javaguide.html) with a 100-column limit.
68
Dave Borowitzc92d4a22016-05-02 11:43:35 -040069Code should be automatically formatted using [google-java-format]
70(https://github.com/google/google-java-format) prior to sending a code review.
71There is currently no Eclipse formatter, but the tool can be run from the
72command line:
73
74```
75java -jar /path/to/google-java-format-1.0-all-deps.jar -i path/to/java/File.java
76```
77
Dave Borowitzaa12bb22015-09-17 13:21:39 -040078CSS in Gitiles follows the [SUIT CSS naming conventions]
79(https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md).
80
Shawn Pearcea9b9e992015-02-20 16:57:23 -080081Code Review
82-----------
Eric Seidel48816fb2013-06-11 17:17:50 -070083
84Gitiles uses Gerrit for code review:
85https://gerrit-review.googlesource.com/
86
Shawn Pearcea9b9e992015-02-20 16:57:23 -080087Gitiles uses the ["git push" workflow][1] with server
88https://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 Seidel48816fb2013-06-11 17:17:50 -070093
94Gerrit depends on "Change-Id" annotations in your commit message.
95If you try to push a commit without one, it will explain how to
96install the proper git-hook:
97
Shawn Pearcea9b9e992015-02-20 16:57:23 -080098```
Eric Seidel48816fb2013-06-11 17:17:50 -070099curl -Lo `git rev-parse --git-dir`/hooks/commit-msg \
100 https://gerrit-review.googlesource.com/tools/hooks/commit-msg
101chmod +x `git rev-parse --git-dir`/hooks/commit-msg
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800102```
Eric Seidel48816fb2013-06-11 17:17:50 -0700103
104Before you create your local commit (which you'll push to Gerrit)
105you will need to set your email to match your Gerrit account:
Eric Seidel48816fb2013-06-11 17:17:50 -0700106
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800107```
108git config --local --add user.email [email protected]
109```
110
111Normally you will create code reviews by pushing for master:
112
113```
Eric Seidel48816fb2013-06-11 17:17:50 -0700114git push origin HEAD:refs/for/master
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800115```