Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

link to other system issue number in gerrit code review page based on commit message

Tags:

gerrit

I used to write commit message to connect issue system like issue #9548, redmine start page is fixed, and wonder whether it can be written in hook or plugin in gerrit system.

So in the code review page, the issue #9548 can be automatically show the http link to my issues system (like redmine): => issue#9548,redmine start page is fixed

It will be easily for code review.

like image 810
Larry Cai Avatar asked Nov 10 '11 13:11

Larry Cai


People also ask

How to comment on code in Gerrit?

How to Comment, Review, and Merge. Anyone can review the code and comment on the code in Gerrit. Consider the following steps −. Step 1 − Login to Gerrit to open the Gerrit dashboard as specified in the previous chapter. Step 2 − Now, click any subject which contains Gerrit project, branch, updated date, etc. as shown in the following screenshot.

What is Gerrit and how to use it?

Gerrit is a code review system developed for the Git version control system. It is a web based code review system, facilitating online code reviews for projects. Gerrit is a Git server which adds a fine grained access control system and a code review system and workflow. The user interface of Gerrit is based on Google Web Toolkit .

How to change the access rights of the code in Gerrit?

You can change the access rights by clicking the dropdown menu. Click the Save Changes button as shown in the following screenshot. Anyone can review the code and comment on the code in Gerrit. Consider the following steps − Step 1 − Login to Gerrit to open the Gerrit dashboard as specified in the previous chapter.

What is the license for Gerrit?

Gerrit is licensed under the Apache 2.0 license. The Gerrit review system uses the term change, to define a code review / review request. Each change is based on one commit. 1.3. How does Gerrit work? Gerrit can prevent users from pushing directly to the Git repository.


Video Answer


2 Answers

Yes, it is possible. In your Gerrit configuration, you have to provide a regex expression for the string in the commit message and the link to your bugtracker with wildcards. See the Gerrit documentation. For your example, you would have a regex like (issue\s+#?)(\d+)

like image 110
dunni Avatar answered Oct 03 '22 18:10

dunni


If you use Jira and have your Jira case number first in the commit message, add the following to gerrit.config to get links when viewing change sets:

[commentlink "jira"]
    match = "^([A-Z]*-[0-9]*)"
    link = http://jira/browse/$1

Some supported commit message formats (paste into Rubular to test):

  • PRJ-123: This is my commit message
  • ABC-123 - Something: Yes yes
  • PROJ-123
  • ABCD-123 - Message

For more examples, see the Gerrit documentation on Section commentlink

like image 24
HNygard Avatar answered Oct 03 '22 18:10

HNygard