Git and Gerrit
Review tools for
Distributed Version Control Systems
Over The Air, Bletchley Park
Alex Blewitt @alblue
Slide 2
Slide 2 text
Git
Git is a Distributed Version Control System
Next Generation source code management
Used by Linux Kernel, Eclipse, Apache ...
Slide 3
Slide 3 text
Git Commits
Git Commits are represented by 40char hash
Uniquely identifies repository content
Stores authorship, commit message and times
Slide 4
Slide 4 text
Commits point to Trees
Similar to directories
Directories contain trees and blobs
Each tree identified by its own hash
Slide 5
Slide 5 text
Trees point to Blobs
Blobs represent content
Identity based on hash of contents
Same blob is used wherever used in tree
Only one blob for identical content
Slide 6
Slide 6 text
Commits, Trees, Blobs
Slide 7
Slide 7 text
Gerrit
Git-based review tool
Slide 8
Slide 8 text
Git Push/Pull
Moving data between repositories
Git has all-or-nothing ownership of data
Other tools exist to add control
Gitolite, Gitosis, Gerrit
Slide 9
Slide 9 text
Gerrit
Gerrit acts as a gatekeeper of a repository
Push your changes to Gerrit
Creates a temporary branch
Subsequent changes go to same branch
Slide 10
Slide 10 text
Review Tool
Can view pushed branch in a web browser
Can annotate specific lines
Can see diffs between any version of patch
Can reject or approve changes
Slide 11
Slide 11 text
Rejecting Changes
Add comments to source
On a per-line or summary basis
Mail gets sent out to developer
Developer can re-submit with fixes
Slide 12
Slide 12 text
Checking Changes
Changes can be compared with previous
Check that the changes are all done
Can check out the version of the branch
Gerrit provides ‘fetch’ spec to get data
Slide 13
Slide 13 text
Automated Build
Can hook up ‘Gerrit Triggers’ to kick off CI
Builds the exact version proposed
Runs all the tests
Can mark a change as ‘bad’ if failed
Slide 14
Slide 14 text
Approval
Each change can have required flags
Number of approvers (1, 2, ...)
Build success/failure
Code coverage thresholds
Slide 15
Slide 15 text
Submission
Change can be automatically brought in
Can use merge or cherry-picking
Can require user to re-submit rebase
Submits exactly the content reviewed
Slide 16
Slide 16 text
Workflow
Slide 17
Slide 17 text
Permissions
Can set up per-branch permissions
Release branches
Per-ticket branches
Only if in particular state
Slide 18
Slide 18 text
Team leads
Can ensure that team leads have approval
Anyone can push suggested changes
Only subset can review
Slide 19
Slide 19 text
Merge Nodes
Merge nodes combine two or more commits
Merge nodes can be specifically restricted
May encourage linear history
Slide 20
Slide 20 text
Git and Gerrit
Review tools for
Distributed Version Control Systems
Over The Air, Bletchley Park
Alex Blewitt @alblue