blob: 686f964547eb1c168fd860ad5ea060d29ddfa8e7 [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
Shawn Pearce12c8fab2016-05-15 16:55:21 -070066Java code in Gitiles follows the [Google Java Style Guide][java-style]
67with a 100-column limit.
Dave Borowitzaa12bb22015-09-17 13:21:39 -040068
Shawn Pearce12c8fab2016-05-15 16:55:21 -070069Code should be automatically formatted using [google-java-format][fmt]
70prior to sending a code review. There is currently no Eclipse
71formatter, but the tool can be run from the command line:
Dave Borowitzc92d4a22016-05-02 11:43:35 -040072
73```
74java -jar /path/to/google-java-format-1.0-all-deps.jar -i path/to/java/File.java
75```
76
Shawn Pearce12c8fab2016-05-15 16:55:21 -070077CSS in Gitiles follows the [SUIT CSS naming conventions][suit].
78
79[java-style]: https://google.github.io/styleguide/javaguide.html
80[fmt]: https://github.com/google/google-java-format
81[suit]: https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md
Dave Borowitzaa12bb22015-09-17 13:21:39 -040082
Shawn Pearcea9b9e992015-02-20 16:57:23 -080083Code Review
84-----------
Eric Seidel48816fb2013-06-11 17:17:50 -070085
86Gitiles uses Gerrit for code review:
87https://gerrit-review.googlesource.com/
88
Shawn Pearcea9b9e992015-02-20 16:57:23 -080089Gitiles uses the ["git push" workflow][1] with server
90https://gerrit.googlesource.com/gitiles. You will need a
91[generated cookie][2].
92
93[1]: https://gerrit-review.googlesource.com/Documentation/user-upload.html#_git_push
94[2]: https://gerrit.googlesource.com/new-password
Eric Seidel48816fb2013-06-11 17:17:50 -070095
96Gerrit depends on "Change-Id" annotations in your commit message.
97If you try to push a commit without one, it will explain how to
98install the proper git-hook:
99
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800100```
Eric Seidel48816fb2013-06-11 17:17:50 -0700101curl -Lo `git rev-parse --git-dir`/hooks/commit-msg \
102 https://gerrit-review.googlesource.com/tools/hooks/commit-msg
103chmod +x `git rev-parse --git-dir`/hooks/commit-msg
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800104```
Eric Seidel48816fb2013-06-11 17:17:50 -0700105
106Before you create your local commit (which you'll push to Gerrit)
107you will need to set your email to match your Gerrit account:
Eric Seidel48816fb2013-06-11 17:17:50 -0700108
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800109```
110git config --local --add user.email [email protected]
111```
112
113Normally you will create code reviews by pushing for master:
114
115```
Eric Seidel48816fb2013-06-11 17:17:50 -0700116git push origin HEAD:refs/for/master
Shawn Pearcea9b9e992015-02-20 16:57:23 -0800117```