BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c8038dc2
Commit
c8038dc2
authored
Apr 01, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'memoize-pattern-methods' into 'master'
Memoize reference_pattern/link_reference_pattern Extracted from !3389 See merge request !3485
parents
64106865
e7849b0b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
13 deletions
+13
-13
commit.rb
app/models/commit.rb
+2
-2
commit_range.rb
app/models/commit_range.rb
+2
-2
external_issue.rb
app/models/external_issue.rb
+1
-1
issue.rb
app/models/issue.rb
+2
-2
label.rb
app/models/label.rb
+1
-1
merge_request.rb
app/models/merge_request.rb
+2
-2
milestone.rb
app/models/milestone.rb
+1
-1
snippet.rb
app/models/snippet.rb
+2
-2
No files found.
app/models/commit.rb
View file @
c8038dc2
...
@@ -74,14 +74,14 @@ class Commit
...
@@ -74,14 +74,14 @@ class Commit
#
#
# This pattern supports cross-project references.
# This pattern supports cross-project references.
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(?:
#{
Project
.
reference_pattern
}#{
reference_prefix
}
)?
(?:
#{
Project
.
reference_pattern
}#{
reference_prefix
}
)?
(?<commit>
\h
{7,40})
(?<commit>
\h
{7,40})
}x
}x
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"commit"
,
/(?<commit>\h{7,40})/
)
@link_reference_pattern
||=
super
(
"commit"
,
/(?<commit>\h{7,40})/
)
end
end
def
to_reference
(
from_project
=
nil
)
def
to_reference
(
from_project
=
nil
)
...
...
app/models/commit_range.rb
View file @
c8038dc2
...
@@ -43,14 +43,14 @@ class CommitRange
...
@@ -43,14 +43,14 @@ class CommitRange
#
#
# This pattern supports cross-project references.
# This pattern supports cross-project references.
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(?:
#{
Project
.
reference_pattern
}#{
reference_prefix
}
)?
(?:
#{
Project
.
reference_pattern
}#{
reference_prefix
}
)?
(?<commit_range>
#{
STRICT_PATTERN
}
)
(?<commit_range>
#{
STRICT_PATTERN
}
)
}x
}x
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"compare"
,
/(?<commit_range>
#{
PATTERN
}
)/
)
@link_reference_pattern
||=
super
(
"compare"
,
/(?<commit_range>
#{
PATTERN
}
)/
)
end
end
# Initialize a CommitRange
# Initialize a CommitRange
...
...
app/models/external_issue.rb
View file @
c8038dc2
...
@@ -31,7 +31,7 @@ class ExternalIssue
...
@@ -31,7 +31,7 @@ class ExternalIssue
# Pattern used to extract `JIRA-123` issue references from text
# Pattern used to extract `JIRA-123` issue references from text
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{(?<issue>
\b
([A-Z][A-Z0-9_]+-)
\d
+)}
@reference_pattern
||=
%r{(?<issue>
\b
([A-Z][A-Z0-9_]+-)
\d
+)}
end
end
def
to_reference
(
_from_project
=
nil
)
def
to_reference
(
_from_project
=
nil
)
...
...
app/models/issue.rb
View file @
c8038dc2
...
@@ -73,14 +73,14 @@ class Issue < ActiveRecord::Base
...
@@ -73,14 +73,14 @@ class Issue < ActiveRecord::Base
#
#
# This pattern supports cross-project references.
# This pattern supports cross-project references.
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(
#{
Project
.
reference_pattern
}
)?
(
#{
Project
.
reference_pattern
}
)?
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<issue>
\d
+)
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<issue>
\d
+)
}x
}x
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"issues"
,
/(?<issue>\d+)/
)
@link_reference_pattern
||=
super
(
"issues"
,
/(?<issue>\d+)/
)
end
end
def
to_reference
(
from_project
=
nil
)
def
to_reference
(
from_project
=
nil
)
...
...
app/models/label.rb
View file @
c8038dc2
...
@@ -56,7 +56,7 @@ class Label < ActiveRecord::Base
...
@@ -56,7 +56,7 @@ class Label < ActiveRecord::Base
# This pattern supports cross-project references.
# This pattern supports cross-project references.
#
#
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(
#{
Project
.
reference_pattern
}
)?
(
#{
Project
.
reference_pattern
}
)?
#{
Regexp
.
escape
(
reference_prefix
)
}
#{
Regexp
.
escape
(
reference_prefix
)
}
(?:
(?:
...
...
app/models/merge_request.rb
View file @
c8038dc2
...
@@ -149,14 +149,14 @@ class MergeRequest < ActiveRecord::Base
...
@@ -149,14 +149,14 @@ class MergeRequest < ActiveRecord::Base
#
#
# This pattern supports cross-project references.
# This pattern supports cross-project references.
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(
#{
Project
.
reference_pattern
}
)?
(
#{
Project
.
reference_pattern
}
)?
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<merge_request>
\d
+)
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<merge_request>
\d
+)
}x
}x
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"merge_requests"
,
/(?<merge_request>\d+)/
)
@link_reference_pattern
||=
super
(
"merge_requests"
,
/(?<merge_request>\d+)/
)
end
end
# Returns all the merge requests from an ActiveRecord:Relation.
# Returns all the merge requests from an ActiveRecord:Relation.
...
...
app/models/milestone.rb
View file @
c8038dc2
...
@@ -79,7 +79,7 @@ class Milestone < ActiveRecord::Base
...
@@ -79,7 +79,7 @@ class Milestone < ActiveRecord::Base
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"milestones"
,
/(?<milestone>\d+)/
)
@link_reference_pattern
||=
super
(
"milestones"
,
/(?<milestone>\d+)/
)
end
end
def
self
.
upcoming
def
self
.
upcoming
...
...
app/models/snippet.rb
View file @
c8038dc2
...
@@ -56,14 +56,14 @@ class Snippet < ActiveRecord::Base
...
@@ -56,14 +56,14 @@ class Snippet < ActiveRecord::Base
#
#
# This pattern supports cross-project references.
# This pattern supports cross-project references.
def
self
.
reference_pattern
def
self
.
reference_pattern
%r{
@reference_pattern
||=
%r{
(
#{
Project
.
reference_pattern
}
)?
(
#{
Project
.
reference_pattern
}
)?
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<snippet>
\d
+)
#{
Regexp
.
escape
(
reference_prefix
)
}
(?<snippet>
\d
+)
}x
}x
end
end
def
self
.
link_reference_pattern
def
self
.
link_reference_pattern
super
(
"snippets"
,
/(?<snippet>\d+)/
)
@link_reference_pattern
||=
super
(
"snippets"
,
/(?<snippet>\d+)/
)
end
end
def
to_reference
(
from_project
=
nil
)
def
to_reference
(
from_project
=
nil
)
...
...
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