Gerrit is a web based code review system, facilitating online code reviews for projects using the Git version control system.
PandaGerrit is using gerrit with github authentication.
LogIn to panda gerrit for the first time
- ) Open https://panda-gerrit.cern.ch:443/
in a webbrower.
- ) Fill in your 'Full Name' and then click 'Save Changes'
- ) In https://panda-gerrit.cern.ch/#/settings/http-password
, click 'Generate Password'.
- ) In https://panda-gerrit.cern.ch/#/dashboard/self
, click 'GitHub', then click 'Repositories' to import repositories from github to gerrit. Follow the steps in gerrit to import repos.
configure gerrit
- ) In https://panda-gerrit.cern.ch/#/dashboard/self
, click 'Projects' -> 'List', select a project to start.
- ) Under the project, you will find a line starting with 'git clone https://panda-gerrit.cern.ch/ProjectName'
, copy it. If you have some ssl errors, add 'GIT_SSL_NO_VERIFY=false'
GIT_SSL_NO_VERIFY=false git clone https://panda-gerrit.cern.ch/ProjectName
- ) go to your local clone directory. follow this example to update your .git/config. The 'password' is generated from 'https://panda-gerrit.cern.ch/#/settings/http-password'.
[wguan@lxplus0234 testcore]$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[http]
sslVerify = false
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://username:password@panda-gerrit.cern.ch/ProjectName
[branch "master"]
remote = origin
merge = refs/heads/master
[wguan@lxplus0234 testcore]$
- ) add these tools to your project https://github.com/wguanicedew/GerritTools/tree/master/tools
- ) run this command below which is download from tools ./tools/configure_git.sh
Development using gerrit
- ) refresh to the latest master/main-dev branch
- ) create a new local branch: It's not good to work on the master or main-dev branch. Because some others may update these branches.
- ) develop your code
- ) add your code
- ) commit your code
- ) submit review
git checkout master
git fetch; git pull
git checkout -b localdev
vi mycode
git add mycode
git commit -a -m 'desc of my code'
./tools/submit-review-main-dev
Fix conflicts
If you get an error message from gerrit like “Please merge (or rebase) the change locally and upload the resolution for review.”, then that means that someone got a change approved for a file while you were working on the same file. This means that you need to fix your commit:
- ) Make sure you are working on the master branch.
git checkout master or main-dev
- ) Get the newest changesets from origin/master:
git fetch; git pull
- ) Switch to your feature branch and merge in the changes:
git checkout your-branch
git rebase master
- ) This will break at some point at the problematic file(s). Edit them and mark them as resolved:
git diff
emacs file1
emacs file2
git add file1
git add file2
- ) Finish the merge:
git rebase --continue
- ) Submit for review:
git commit --amend
./tools/submit-review-master
Review the codes
- ) From https://panda-gerrit.cern.ch/#/dashboard/self
, click 'All' --> 'Open'. You will find all open patches. Click the one you want to review.
- ) Click to open the updated file, you can click the line number to comment. you can also select par the code to comment. (These comment are draft and will not publish until you click reply).
- ) go back to patch review page. Click 'Reply...', you can put the score here. score '2' means 'can be approved'.
--
WenGuan - 2015-04-27
Topic revision: r1 - 2015-04-27
- WenGuan