Introduction
gerrit-rust is a console client for gerrit written in rust. This is a rust
learner project. Have patience with me :-)
I'm happy about every PR, but I will ask questions about changes to learn from
your knowledge.
Dependency
- A installed
gitbinary in$PATH - gerrit server with installed download-plugin
Design
Some design considarations here.
-
semver at version 1.0.0. Before this version no semver!
-
remove external depency to host [ ] git binary [ ] gerrit with download plugin
-
0.1.5 Use of curl-rs as http client
-
0.1.0 Use a config file
.ggr.configin TOML format-
api: base url with schema (http) -
0.1.3 User authentication (deprecated since 0.1.9)
username: username for loginpassword: password for login [x] 0.1.9 only.netrcsettings are respected for username and password. u/p in config file are ignored
-
root: true if this is the uppermost project of all repositories underneath -
Authentication (e.g.: digest, basic)
-
digestandbasicare supported. Current implementation calls both. First on isbasicand second one isdigest.
-
-
Consider to configure via config file or put all settings into as entries in
.git/config.
The values are same for config file and git-config approach. For the git-config we useggr-as a prefix. -
provide a configuration frontend
-
ggr config set baseurl 'http://localhost': set newbaseurl -
ggr config unset -C project1 root: removerootin project1 repository -
ggr config set root: set root for current repository - 0.1.0
ggr config list: list all options- ... with origin of setting
-
ggr config generate --base <...> ...: generates a.ggr.configfile
-
-
0.1.9 Use
$HOME/.netrcfile to get username and password.
-
-
manage of topics over more than one repository (git submodules like)
-
0.1.0
ggr topic create <BRANCHNAME> [-r sub:rev]
Create branch at main folder and specified subfolders. If a branch with same name exists it isn't touched.revis the reference where branch should created Defaults toorign/master. For base folder use-r ..- execute in subfolders: create branch in this repo and in baserepo.
- Add
-Roption to create branch on base and all subrepositories.
-
0.1.0
ggr topic forget <BRANCHNAME> [-R]
Delete a branch at mainfolder and and with-Rin all subfolders.- Add option
-sin conjunction with-Rto remove all branches recursive which have no commit and the repositories are clean. Warn unclean repositories/branches.
- Add option
-
ggr topic list -s
List all development branches and the repositories. With-sit includes the commits in the branch likegit submodule summary. -
0.1.8
ggr topic checkout <BRANCHNAME>
Checkout a branch on all repositories.- 0.1.8 first check base folder if checkout happened sync all submodules than checkout changes for topic on subfolders
-
ggr topic push [-b] [<BRANCHNAME>]
Push changes to gerrit. Without-bits pushed to gerrit. With option-bits pushed to a build server. Without branchname the current branch is pushed. -
0.1.7
ggr topic pull ...
same asggr topic fetch. This sub function is renamed becausefetchis more in line with git speak thanpull. -
0.1.8
ggr topic fetch [-f] [-b branchname] <topicname>
fetch latest version of commits for a topic. Create for all changes a branch with the patch identifier as name, or with-bwith a given branchname. [x] 0.1.9 Add tracking information via--track <branch>option. -
ggr topic reviewer [<BRANCHNAME>] [-r <MAIL>] [-c <MAIL>] [-t <MAIL>]
Add reviewer (-r), CC: (-c) or TO: (-t) at topic push time. The information is put to branch config likeconfig.BRANCHNAME.ggr-re MAIL. Config lineentries start with ggr-[cc/to/re]. Without any options the current reviewer/to/cc showed for current branch. Without BRANCHNAME te current branch is taken. -
ggr topic verify [<TOPICNAME>] <LABEL> [<MESSAGE>]Verify all commits of a topic TOPICNAME with a label LABEL (-2|-1|0|+1|+2|=) and a optional message. Be aware the messages is appended as note on ALL commits in this topic.- Label
=means not changing the current review label value, only a append a message
- Label
-
-
Other Ideas
-
0.1.9 implement a log mechanism to get debugging information via loglevel switch
-
0.1.0
ggr changes query <QUERY>query a searchstring to gerrit server. Use asQUERYthe same syntax as in gerrit web frontend. eg-
0.1.7 Add
--regexp-selectorto show only keys selected by regular expression. This remove the --fields selector introduced in 0.1.4. -
0.1.6 Add a
--humanoption to print it in human readable format. -
Add
--headerto get a header line with field names -
0.1.4 Add
--field-listto get all selectable fields, usable for--fieldsoption on a second call. -
0.1.4 Add
--rawfor json in raw format. Usable for pretty printer over pipe -
0.1.4 Option
-o/--ofieldsto get additional information of changes back (like REVISION etc ...)
Examples:
ggr changes query status:open is:watched n:2: query open changes whichwatchedflag.
-
-
create a helper script for setup of development environment
- docker based gerrit server
found docker imagedocker pull docker.io/fabric8/gerrit:latest - setup password and username for gerrit
- autogenerate git repositrories and submodules
- setup gerrit for this repositories
- auto push master branches to gerrit
- docker based gerrit server
-
ggr stat [-F <date>] [-T <data>]
some statistics like opened and closed review since a week or between a timespan. via iso-8601 likedate -Is.Examples:
ggr stat -F 1w: last week to nowggr stat -F 2015-12-31 -T 2016-02-01: from 01.01.2016T00:00 till 01.02.2016T23:59:59ggr stat -F 2016-01-01: from 02.01.2016T00:00 till nowggr stat -T 2016-02-01: from begin of gerrit usage till 01.02.2016T23:59:59
-
reviewer per commit
-
reviewer per repository
-
status of branches
shows status of a branch (remote and local likegit remote show ...ggr status [<BRANCHNAME>]
-
Support for
.repofolder -
Consider to use https://github.com/gsingh93/trace
-
Consider to use https://github.com/ticki/termion
-
Document
gerritlib::callmodule -
0.1.5 Add .travis.yml
-
gerrit demo server local on your host via docker
This creates a dockercontainer which is connectable via http://localhost:8080.
The server is setup for development and all accounts can do all things.
It generate or use a DOCKER-FOR-GERRIT folder containing of settings,
repositories and ssh-keys.
docker run --rm -it \
-h localhost
-p 8080:8080 -p 29418:29418 \
-v /development/projects/DOCKER-FOR-GERRIT:/var/gerrit/review_site \
--name gerrit \
openfrontier/gerrit:latest
useful links
- gerrit api documentation: https://gerrit-review.googlesource.com/Documentation/rest-api.html
- request, response design from: https://github.com/gefolderstsentry/sentry-cli
License
Licensed under
- Mozilla Public License 2.0 (LICENSE-MPL-2.0 or https://www.mozilla.org/media/MPL/2.0/index.txt)