Successfully reported this slideshow.
Your SlideShare is downloading. ×

Gerrit Code Review - The Introduction

Ad

Introduction to Gerrit


    Dariusz Łuksza
     dariusz@luksza.org
          @dluksza

Ad

Git?!
    Copyright © 2012 Dariusz Łuksza

Ad

What is Gerrit?


      Git server

      Gerrit
HTTP serverSSH server




                     Copyright © 2012 Dariusz Ł...

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Upcoming SlideShare
Prototyping in the cloud
Prototyping in the cloud
Loading in …3
×

Check these out next

1 of 34 Ad
1 of 34 Ad

More Related Content

Gerrit Code Review - The Introduction

  1. 1. Introduction to Gerrit Dariusz Łuksza dariusz@luksza.org @dluksza
  2. 2. Git?! Copyright © 2012 Dariusz Łuksza
  3. 3. What is Gerrit? Git server Gerrit HTTP serverSSH server Copyright © 2012 Dariusz Łuksza
  4. 4. Why use code view? ● Early catch of common errors: – NullPoinerException – Code duplication – Deprecated code use – Typos ● Code design review ● Improve team knowledge about project ● Can be used as knowledge base Copyright © 2012 Dariusz Łuksza
  5. 5. Who uses Gerrit? Copyright © 2012 Dariusz Łuksza
  6. 6. Gerrit @ Eclipse Foundation Copyright © 2012 Dariusz Łuksza
  7. 7. What is needed to use it? ● Gerrit server ● git – with additional configuration – proper refspec – commit message hook ● or EGit Copyright © 2012 Dariusz Łuksza
  8. 8. What is “refspec”? $ git push <repo_name> <src_branch>:<dst_branch> example: ● $ git push origin fix-npe:master ● $ git push origin fix-npe:refs/for/master or configure this as default push action for repository: $ git configure remote.origin.push HEAD:refs/for/master Or use EGit and “Push to Gerrit” action. Copyright © 2012 Dariusz Łuksza
  9. 9. What is “commit hook”? ● Script executed by git after commit operation ● Gerrit commit hook adds Change-Id meta data ● It is project independent so after fetching from server for one project you can copy it locally ● Or use EGit and don't bother about hooks. Copyright © 2012 Dariusz Łuksza
  10. 10. Lets create first review request $ git init $ scp -p -P 29418 <host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit 0a60797abd716298c6f6f8eb641451ae507eb9bf Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I871f6b4c500c96f4f7a91abf236f76b00d9057ca $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  11. 11. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit 0a60797abd716298c6f6f8eb641451ae507eb9bf Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I871f6b4c500c96f4f7a91abf236f76b00d9057ca $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  12. 12. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit 0a60797abd716298c6f6f8eb641451ae507eb9bf Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I871f6b4c500c96f4f7a91abf236f76b00d9057ca $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  13. 13. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit 0a60797abd716298c6f6f8eb641451ae507eb9bf Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I871f6b4c500c96f4f7a91abf236f76b00d9057ca $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  14. 14. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit 0a60797abd716298c6f6f8eb641451ae507eb9bf Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I871f6b4c500c96f4f7a91abf236f76b00d9057ca $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  15. 15. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  16. 16. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  17. 17. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  18. 18. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  19. 19. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push origin HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  20. 20. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  21. 21. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  22. 22. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  23. 23. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  24. 24. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  25. 25. Lets create first review request $ git init $ scp -p -P 29418 <login>@<host>:hooks/commit-msg .git/hooks/ $ echo 'first review' > readme.txt $ git add readme.txt $ git commit -m 'my first commit' $ git log commit e6762c9a59c1bda7118633e4c2ddabf4ecca2152 Author: Dariusz Luksza <dariusz@luksza.org> Date: Tue Nov 20 11:20:13 2012 +0100 my first commit Change-Id: I5e9f2d410fdf37d2e20bedc162b2fb9565988a56 $ git push ssh://<login>@<host>:29418/<proj> HEAD:refs/for/master Copyright © 2012 Dariusz Łuksza
  26. 26. Review change in Web UI m o d e iv e L Copyright © 2012 Dariusz Łuksza
  27. 27. Add inline comments mo d e ive L Copyright © 2012 Dariusz Łuksza
  28. 28. Amend change mo d e ive L Copyright © 2012 Dariusz Łuksza
  29. 29. Vote on change mo d e ive L Copyright © 2012 Dariusz Łuksza
  30. 30. Submit change mo d e ive L Copyright © 2012 Dariusz Łuksza
  31. 31. Gerrit ACL ● Read ● Push ● Push merge commit ● Push annotated tag ● Label code review (-2 to +2) ● Label verified (-1 to +1) ● Create reference (aka create branch) ● Abandon ● Edit topic ● Forge author identity ● Forge committer identity ● Forge server identity ● Rebase ● Remove reviewer Copyright © 2012 Dariusz Łuksza
  32. 32. Gerrit Plugability ● Plugins – Plugins – Extensions ● Prolog rules for change validation Copyright © 2012 Dariusz Łuksza
  33. 33. Review from Eclipse Copyright © 2012 Dariusz Łuksza
  34. 34. Introduction to Gerrit Dariusz Łuksza dariusz@luksza.org @dluksza Useful links: ● Git – http://git-scm.com/ ● EGit – http://eclipse.org/egit/ ● Gerrit – http://gerrit.googlecode.com/ ● Mylyn reviews – http://eclipse.org/reviews/gerrit/

×