SVN integrates reviewboard to run post-commit hook in the background

Source: Internet
Author: User

Code review not only improves the quality, but also provides an excellent means of knowledge sharing and guidance.

Code review generally has two forms: Pre-commit-Review and post-commit-review.

Pre-commit-review refers to the Code submitted to the code library.BeforeCode review;

Post-commit-review refers to the Code submitted to the code library.AfterPerform code review.


Reviewboard is an open-source Web-based code review tool that supports subversion, CVS, git, and mercurial version control systems.

SVN can be integrated with reviewboard through the post-commit hook to implement post-commit-review.


The implementation principle is as follows:

The user triggers the post-commit hook script after the code is submitted to SVN.

Call the rbt post command of rbtools in SVN post-commit hook to connect to the reviewboard and automatically submit the code reviewrequest)

Note: rbtools is a python command line tool officially provided by reviewboard. It uses the python API to interact with the reviewboard.


The following problems occur during use:

The user must wait until the post-commit hook is executed to complete the submission.

In this wayThis results in a long wait time for the user to submit code., Affects the user experience

Therefore, the rbt post command called in post-commit should be executed in the background.

In this way, the post-commit command does not need to wait until the RBT post is executed. After the rbt post command is sent, the system directly returns


We know that in Linux, The & command can put the job to the background for execution.

However, the RBT command in the Post-commit hook is followed and does not work.

Search by Google

Finally, I found this article on stackoverflow and finally solved the problem.

In the past, we still needed to use 2> & 1 to convert all error output to standard output, so that both the error output and standard output are redirected to an out. File file.

2 indicates the error output, and 1 indicates the standard output.

RBT Post "$ ARGs" 2> & 1 &


I have to say that Google and stackoverflow are very powerful @!



Others:

For details about how to write SVN post-commit scripts, refer to the example of user contribution in reviewboard source code.

Rbt post command official guide



SVN integrates reviewboard to run post-commit hook in the background

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.