Project

General

Profile

issue id referencing to SVN revisions - add other separator character or work with regex

Added by Bart Stuyckens over 13 years ago

we use a structure commit message, separated with colons (:). E.g.

WP:#10373:F:description of change.

the link between revisions and tickets is not working.

In http://www.redmine.org/wiki/redmine/RedmineSettings#Referencing-issues-in-commit-messages, the last line states:

"After a keyword issue IDs can be separated with a space, a comma or &."

I guess this is the reason why the referencing is not working for us.

Would it be possible to add a colon as a separator ?

or, if you are using regex, use \d+ to extract number from the commit message ? That should work in practically all possible cases.


Replies (1)

RE: issue id referencing to SVN revisions - add other separator character or work with regex - Added by Bart Stuyckens over 13 years ago

after quite some investigation (I am newbie in ruby), this did the trick for me:

in app\models\changeset.rb modify line 95
from

comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } 

to
comments.scan(%r{#(\d+)}).each { |m| target_issue_ids << m[0] }

then in mysql db
delete FROM changesets ;
delete FROM changes;
delete FROM changesets_issues;

and run

ruby script/runner "Repository.fetch_changesets" -e production

It will create the relationships between issues and revisions. The redmine GUI will not hyperlink the issue in the commit message:
WP:#10:F:description of change: there is no hyperlink on #10373

if there would be a space in front and punctuation or space after, then it would work:
WP: #10,:F:description of change

So my conclusion is that the only reason to make the regex so complicated is to match the behaviour of the redmine wiki engine (textile?).

For the moment we are happy with the solution.

    (1-1/1)