Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-06-13 18:19:08 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-06-13 19:25:44 +0400
commit3f1ece26909f90e538a50cd724b64da28f0b7308 (patch)
tree1f10f7efef48602ef910d71b0f3411d34654e57a /lib/gitlab/closing_issue_extractor.rb
parent5fdcaadf347e41109f20a4dee733f5b51030feda (diff)
Detect closing issues in Merge Request description
Diffstat (limited to 'lib/gitlab/closing_issue_extractor.rb')
-rw-r--r--lib/gitlab/closing_issue_extractor.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/closing_issue_extractor.rb b/lib/gitlab/closing_issue_extractor.rb
new file mode 100644
index 00000000000..90f1370c209
--- /dev/null
+++ b/lib/gitlab/closing_issue_extractor.rb
@@ -0,0 +1,16 @@
+module Gitlab
+ module ClosingIssueExtractor
+ ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern)
+
+ def self.closed_by_message_in_project(message, project)
+ md = ISSUE_CLOSING_REGEX.match(message)
+ if md
+ extractor = Gitlab::ReferenceExtractor.new
+ extractor.analyze(md[0])
+ extractor.issues_for(project)
+ else
+ []
+ end
+ end
+ end
+end