Automatically submit git branch code review to review Board system

Source: Internet
Author: User

Background

In agile software development, the smaller the feedback loop, the more easily the software quality is guaranteed.

As a component team, our development tasks often have some features that involve dozens of function points, with a development cycle that lasts weeks or months. How to ensure the quality of software in the development process is a very important topic. Effective fine-grained code review is one of the common tools. But this hope, when landed, is more or less confronted with resistance from every aspect:

Review board does not support GIT branch code review submissions;

Git is not familiar, do not know how to produce the correct patch file to submit to review Board;

Review board will not use, do not know how to submit code review;

Review board will use, but the submission process cumbersome, a two days to submit once, I fear trouble;

I forgot to submit the code review.

The team's pain point is the direction of our efforts to improve, we want to have a plan to achieve the automatic submission of code review, the submission process to the developer transparent, to minimize the developer's mental burden, so that developers focus on functional development.

In fact, this automation tool and implementation has already been, this is the rbtool that this article shares. The user Manual of the official website has the detailed document explanation, the drawback is, did not provide a complete implementation case to the user reference, this article attempts to fill this blank, the omission place, also looks correct.

Installation

This article focuses on review Board code review automatic submission scheme implementation, so assume that you already have a usable review Board (later to RB abbreviation) server. RB Server installation, configuration, use is not in the repeat.

Deployment environment:

[Email protected]:~/git/team_dev$ lsb_release-aNo LSB modules is available. Distributor id:ubuntudescription:    10.04. 3 ltsrelease:         10.04 codename:       Lucid

Install Rbtool:

If your computer can access the extranet, the installation process is simple:

Sudo

If you cannot access the extranet, you need to manually download the following installation package, and then unpack and run the sudo python setup.py install.

Https://pypi.python.org/packages/source/a/argparse/argparse-1.4.0.tar.gz

Https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz

Https://pypi.python.org/packages/source/R/RBTools/RBTools-0.7.5.tar.gz

Run the following command to see if the installation was successful:

[Email protected]:~/git/team_15000_dev$ rbt-0.7. 5

Configuration

Configure git options Reviewboard.url for your RB server access link:

git config--global  reviewboard.url http://xxx.xxx.xxx.xxx/

In your Git workspace directory, create a rbtool configuration file. REVIEWBOARDRC, examples are as follows (personal information is replaced with XXX)

[Email protected]:~/git/team_dev$Cat. REVIEWBOARDRC REPOSITORY="XXX"Reviewboard_url="http://XXX.XXX.XXX.XXX/"USERNAME="XXX"PASSWORD="XXX"target_groups="Calabashbro"Tracking_branch="origin/xxx"

Repository: Specifies the Repository warehouse name already configured in the RB server;

Reviewboard_url: Specify the RB server access link;

USERNAME: Specifies the user login name of the RB server;

PASSWORD: Specify the user login password of the RB server;

Target_groups: Specifies the GROUPS of the Code review review request;

Tracking_branch: Specifies the work branch; if not specified, the default is Origin/master branch; (For git)

Configure a git commit hook script (this step can be skipped if you don't need to submit the Code Review feature automatically):

[Email protected]:~/git/team_dev/.git/hooks$ Touch Post-commit

[Email protected]:~/git/team_dev/.git/hooks$ chmod +x post-commit

[Email protected]:~/git/team_dev$ cat. Git/hooks/post-commit
#!/bin/sh

RBT Post-g-P

Parameter explanation:

-G: Summary information and description information of RB Review request are constructed automatically according to git commit log;

-P: Automatically constructs and publishes; If not specified, a RB Review request page is constructed, but not published.

Application

If the git commit hook script is configured, the commit code automatically triggers the submission of a RB Review request:

' Demo:auto to submit RB review request ' Review Request # 6140 posted.http: // 10.46.74.230/r/6140/http://10.46.74.230/r/6140/diff/26 Insertions (+)

Auto-submitted RB Review request:

If you do not configure a git commit hook script, you can use RBT to manually submit a RB Review request after commit, such as:

Specify revision to submit a code review for the modified record:

RBT Post REVISION

Specify (Startrev,stoprev] interval change record to submit code review:

RBT Post Startrev Stoprev

Update the current non-push modification to the submitted code review request:

RBT Post-r Review_request_num

Please refer to the user manual of the website for other commands.

Have a good time.

--eof--

Automatically submit git branch code review to review Board system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.