commentlink scope

61 views
Skip to first unread message

Golan Davidovits

unread,
Apr 4, 2017, 4:21:01 PM4/4/17
to Repo and Gerrit Discussion
Hi,

I'm using Gerrit 2.11.3
In a project config i'm setting this rule:

[commentlink "Title"]
    match = "([A-Z]+-\\d+)"

However, i see that it works only if the qualified string is the first one written in the commit message.
I would appreciate your lead for resolution.

Thanks,
Golan
 
  

Golan Davidovits

unread,
Apr 5, 2017, 2:42:19 PM4/5/17
to Repo and Gerrit Discussion
On further tests:

My aim is to find any bug reference in the commit message and transform it to link in Gerrit.
If i write only the match criteria: match = "([A-Z]+-[0-9]+)"  (such as issue-123) it only works if issue-123 is the first word in the comment.

If i add prefix to the match criteria: match = "[Jj][Ii][Rr][Aa]:([A-Z]+-[0-9]+)" (such as JIRA:issue-123) then it works but i would be an overhead in case multiple bugs will be added. 

I'm trying to understand if i miss something in the regexp configuration or there is some bug.
Any help will be appreciated.

Thanks,
Golan

Jonathan Nieder

unread,
Apr 5, 2017, 2:54:48 PM4/5/17
to Golan Davidovits, Repo and Gerrit Discussion
"([A-Z]+-[0-9]+)" would match a sequence of capital letters followed by a dash and a sequence of digits. It wouldn't match "Issue-123", since the 's'es, 'u', and 'e' are lowercase.

Did you mean "([A-Z][A-Za-z]*-[0-9]+)"?

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Golan Davidovits

unread,
Apr 5, 2017, 3:00:52 PM4/5/17
to Repo and Gerrit Discussion, gol...@gmail.com
Sorry, it's just a typo. I indeed mean to find ISSUE-123. The problem, as mentioned, is that it only finds it as first word in the comment unless i write some prefix such as JIRA:ISSUE-123

Golan

Golan Davidovits

unread,
Apr 6, 2017, 3:38:50 PM4/6/17
to Repo and Gerrit Discussion, gol...@gmail.com
Update:

This is the manual reference I use:

It feels like there is a bug.

if I use this rule:
match = "([A-Z]+-[0-9]+)"
The link is created only if the match is the first word in the comment.

I suspected white spaces issue so i changed the rule like that: 

match = "\\s*([A-Z]+-[0-9]+)"

This time the match is found anywhere in the comment, the link is pointing to the right destination (due to the $1)
but the link title shows the whole match (not just the $1).
Meaning: it shows the match with all the white spaces that may come before it with one underline.
For example:              BUG-123
I'm setting this configuration in the project level so according to the manual i should use link rule and not html.


Any insight will be appreciated.
 
Thanks,
Golan

Luca Milanesio

unread,
Apr 6, 2017, 5:38:13 PM4/6/17
to Golan Davidovits, Repo and Gerrit Discussion
Hi Golan,
I can't reach https://android.intel.com, is it an in-house Gerrit?

What version are you running?

Luca.

Golan Davidovits

unread,
Apr 7, 2017, 5:42:27 AM4/7/17
to Repo and Gerrit Discussion, gol...@gmail.com

I'm using Gerrit 2.11.3

Thanks,
Golan
Reply all
Reply to author
Forward
0 new messages