Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
f9017a2b
Commit
f9017a2b
authored
Nov 30, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have ClosingIssueExtractor recognize all referenced issues
parent
d6a5b45c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-1
lib/gitlab/closing_issue_extractor.rb
lib/gitlab/closing_issue_extractor.rb
+10
-4
No files found.
config/initializers/1_settings.rb
View file @
f9017a2b
...
@@ -164,7 +164,7 @@ Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].
...
@@ -164,7 +164,7 @@ Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].
Settings
.
gitlab
[
'twitter_sharing_enabled'
]
||=
true
if
Settings
.
gitlab
[
'twitter_sharing_enabled'
].
nil?
Settings
.
gitlab
[
'twitter_sharing_enabled'
]
||=
true
if
Settings
.
gitlab
[
'twitter_sharing_enabled'
].
nil?
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing)) +(?:(?:issues? +)?
#\d+
(?:(?:, *| +and +)?))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing)) +(?:(?:issues? +)?
%{issue_ref}
(?:(?:, *| +and +)?))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
Settings
.
gitlab
[
'default_projects_features'
]
||=
{}
Settings
.
gitlab
[
'default_projects_features'
]
||=
{}
Settings
.
gitlab
[
'webhook_timeout'
]
||=
10
Settings
.
gitlab
[
'webhook_timeout'
]
||=
10
Settings
.
gitlab
[
'max_attachment_size'
]
||=
10
Settings
.
gitlab
[
'max_attachment_size'
]
||=
10
...
...
lib/gitlab/closing_issue_extractor.rb
View file @
f9017a2b
module
Gitlab
module
Gitlab
class
ClosingIssueExtractor
class
ClosingIssueExtractor
ISSUE_CLOSING_REGEX
=
Regexp
.
new
(
Gitlab
.
config
.
gitlab
.
issue_closing_pattern
)
ISSUE_CLOSING_REGEX
=
begin
pattern
=
Gitlab
.
config
.
gitlab
.
issue_closing_pattern
pattern
=
pattern
.
sub
(
'%{issue_ref}'
,
"(?:
#{
Issue
.
reference_pattern
}
)"
)
Regexp
.
new
(
pattern
).
freeze
end
def
initialize
(
project
,
current_user
=
nil
)
def
initialize
(
project
,
current_user
=
nil
)
@extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
project
,
current_user
)
@extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
project
,
current_user
)
...
@@ -9,10 +13,12 @@ module Gitlab
...
@@ -9,10 +13,12 @@ module Gitlab
def
closed_by_message
(
message
)
def
closed_by_message
(
message
)
return
[]
if
message
.
nil?
return
[]
if
message
.
nil?
closing_statements
=
message
.
scan
(
ISSUE_CLOSING_REGEX
).
closing_statements
=
[]
map
{
|
ref
|
ref
[
0
]
}.
join
(
" "
)
message
.
scan
(
ISSUE_CLOSING_REGEX
)
do
closing_statements
<<
Regexp
.
last_match
[
0
]
end
@extractor
.
analyze
(
closing_statements
)
@extractor
.
analyze
(
closing_statements
.
join
(
" "
)
)
@extractor
.
issues
@extractor
.
issues
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment