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
Boxiang Sun
gitlab-ce
Commits
5ae49398
Commit
5ae49398
authored
Apr 01, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.com/gitlab-org/gitlab-ce
parents
8df0653e
5627542f
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
47 additions
and
34 deletions
+47
-34
app/models/commit.rb
app/models/commit.rb
+2
-2
app/models/commit_range.rb
app/models/commit_range.rb
+2
-2
app/models/external_issue.rb
app/models/external_issue.rb
+1
-1
app/models/issue.rb
app/models/issue.rb
+2
-2
app/models/label.rb
app/models/label.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
app/models/milestone.rb
app/models/milestone.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+1
-1
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+1
-1
app/models/snippet.rb
app/models/snippet.rb
+2
-2
app/services/system_note_service.rb
app/services/system_note_service.rb
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+2
-2
lib/banzai/filter/commit_range_reference_filter.rb
lib/banzai/filter/commit_range_reference_filter.rb
+1
-1
lib/banzai/filter/commit_reference_filter.rb
lib/banzai/filter/commit_reference_filter.rb
+1
-1
lib/banzai/filter/label_reference_filter.rb
lib/banzai/filter/label_reference_filter.rb
+1
-1
lib/banzai/filter/merge_request_reference_filter.rb
lib/banzai/filter/merge_request_reference_filter.rb
+1
-1
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+1
-1
lib/banzai/filter/snippet_reference_filter.rb
lib/banzai/filter/snippet_reference_filter.rb
+1
-1
lib/banzai/filter/user_reference_filter.rb
lib/banzai/filter/user_reference_filter.rb
+1
-1
lib/gitlab/email/message/repository_push.rb
lib/gitlab/email/message/repository_push.rb
+1
-1
lib/gitlab/routing.rb
lib/gitlab/routing.rb
+13
-0
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+1
-1
spec/lib/extracts_path_spec.rb
spec/lib/extracts_path_spec.rb
+1
-1
spec/lib/gitlab/closing_issue_extractor_spec.rb
spec/lib/gitlab/closing_issue_extractor_spec.rb
+1
-1
spec/support/filter_spec_helper.rb
spec/support/filter_spec_helper.rb
+1
-1
spec/support/markdown_feature.rb
spec/support/markdown_feature.rb
+1
-1
No files found.
app/models/commit.rb
View file @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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 @
5ae49398
...
@@ -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
...
@@ -89,7 +89,7 @@ class Milestone < ActiveRecord::Base
...
@@ -89,7 +89,7 @@ class Milestone < ActiveRecord::Base
def
to_reference
(
from_project
=
nil
)
def
to_reference
(
from_project
=
nil
)
escaped_title
=
self
.
title
.
gsub
(
"]"
,
"
\\
]"
)
escaped_title
=
self
.
title
.
gsub
(
"]"
,
"
\\
]"
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
url
=
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
url
=
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
"[
#{
escaped_title
}
](
#{
url
}
)"
"[
#{
escaped_title
}
](
#{
url
}
)"
...
...
app/models/project.rb
View file @
5ae49398
...
@@ -471,7 +471,7 @@ class Project < ActiveRecord::Base
...
@@ -471,7 +471,7 @@ class Project < ActiveRecord::Base
end
end
def
web_url
def
web_url
Gitlab
::
Application
.
routes
.
url_helpers
.
namespace_project_url
(
self
.
namespace
,
self
)
Gitlab
::
Routing
.
url_helpers
.
namespace_project_url
(
self
.
namespace
,
self
)
end
end
def
web_url_without_protocol
def
web_url_without_protocol
...
@@ -592,7 +592,7 @@ class Project < ActiveRecord::Base
...
@@ -592,7 +592,7 @@ class Project < ActiveRecord::Base
if
avatar
.
present?
if
avatar
.
present?
[
gitlab_config
.
url
,
avatar
.
url
].
join
[
gitlab_config
.
url
,
avatar
.
url
].
join
elsif
avatar_in_git
elsif
avatar_in_git
Gitlab
::
Application
.
routes
.
url_helpers
.
namespace_project_avatar_url
(
namespace
,
self
)
Gitlab
::
Routing
.
url_helpers
.
namespace_project_avatar_url
(
namespace
,
self
)
end
end
end
end
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
5ae49398
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#
#
class
GitlabIssueTrackerService
<
IssueTrackerService
class
GitlabIssueTrackerService
<
IssueTrackerService
include
Gitlab
::
Application
.
routes
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
...
...
app/models/project_services/jira_service.rb
View file @
5ae49398
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
class
JiraService
<
IssueTrackerService
class
JiraService
<
IssueTrackerService
include
HTTParty
include
HTTParty
include
Gitlab
::
Application
.
routes
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
DEFAULT_API_VERSION
=
2
DEFAULT_API_VERSION
=
2
...
...
app/models/snippet.rb
View file @
5ae49398
...
@@ -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
)
...
...
app/services/system_note_service.rb
View file @
5ae49398
...
@@ -224,7 +224,7 @@ class SystemNoteService
...
@@ -224,7 +224,7 @@ class SystemNoteService
#
#
# "Started branch `issue-branch-button-201`"
# "Started branch `issue-branch-button-201`"
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
body
=
"Started branch [`
#{
branch
}
`](
#{
link
}
)"
body
=
"Started branch [`
#{
branch
}
`](
#{
link
}
)"
...
...
lib/api/entities.rb
View file @
5ae49398
...
@@ -8,7 +8,7 @@ module API
...
@@ -8,7 +8,7 @@ module API
expose
:id
,
:state
,
:avatar_url
expose
:id
,
:state
,
:avatar_url
expose
:web_url
do
|
user
,
options
|
expose
:web_url
do
|
user
,
options
|
Gitlab
::
Application
.
routes
.
url_helpers
.
user_url
(
user
)
Gitlab
::
Routing
.
url_helpers
.
user_url
(
user
)
end
end
end
end
...
@@ -89,7 +89,7 @@ module API
...
@@ -89,7 +89,7 @@ module API
expose
:avatar_url
expose
:avatar_url
expose
:web_url
do
|
group
,
options
|
expose
:web_url
do
|
group
,
options
|
Gitlab
::
Application
.
routes
.
url_helpers
.
group_url
(
group
)
Gitlab
::
Routing
.
url_helpers
.
group_url
(
group
)
end
end
end
end
...
...
lib/banzai/filter/commit_range_reference_filter.rb
View file @
5ae49398
...
@@ -43,7 +43,7 @@ module Banzai
...
@@ -43,7 +43,7 @@ module Banzai
end
end
def
url_for_object
(
range
,
project
)
def
url_for_object
(
range
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
range
.
to_param
.
merge
(
only_path:
context
[
:only_path
]))
range
.
to_param
.
merge
(
only_path:
context
[
:only_path
]))
end
end
...
...
lib/banzai/filter/commit_reference_filter.rb
View file @
5ae49398
...
@@ -37,7 +37,7 @@ module Banzai
...
@@ -37,7 +37,7 @@ module Banzai
end
end
def
url_for_object
(
commit
,
project
)
def
url_for_object
(
commit
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_commit_url
(
project
.
namespace
,
project
,
commit
,
h
.
namespace_project_commit_url
(
project
.
namespace
,
project
,
commit
,
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
...
...
lib/banzai/filter/label_reference_filter.rb
View file @
5ae49398
...
@@ -31,7 +31,7 @@ module Banzai
...
@@ -31,7 +31,7 @@ module Banzai
end
end
def
url_for_object
(
label
,
project
)
def
url_for_object
(
label
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
label
.
name
,
h
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
label
.
name
,
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
...
...
lib/banzai/filter/merge_request_reference_filter.rb
View file @
5ae49398
...
@@ -14,7 +14,7 @@ module Banzai
...
@@ -14,7 +14,7 @@ module Banzai
end
end
def
url_for_object
(
mr
,
project
)
def
url_for_object
(
mr
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_merge_request_url
(
project
.
namespace
,
project
,
mr
,
h
.
namespace_project_merge_request_url
(
project
.
namespace
,
project
,
mr
,
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
...
...
lib/banzai/filter/milestone_reference_filter.rb
View file @
5ae49398
...
@@ -11,7 +11,7 @@ module Banzai
...
@@ -11,7 +11,7 @@ module Banzai
end
end
def
url_for_object
(
issue
,
project
)
def
url_for_object
(
issue
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_milestone_url
(
project
.
namespace
,
project
,
milestone
,
h
.
namespace_project_milestone_url
(
project
.
namespace
,
project
,
milestone
,
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
...
...
lib/banzai/filter/snippet_reference_filter.rb
View file @
5ae49398
...
@@ -14,7 +14,7 @@ module Banzai
...
@@ -14,7 +14,7 @@ module Banzai
end
end
def
url_for_object
(
snippet
,
project
)
def
url_for_object
(
snippet
,
project
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_snippet_url
(
project
.
namespace
,
project
,
snippet
,
h
.
namespace_project_snippet_url
(
project
.
namespace
,
project
,
snippet
,
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
...
...
lib/banzai/filter/user_reference_filter.rb
View file @
5ae49398
...
@@ -90,7 +90,7 @@ module Banzai
...
@@ -90,7 +90,7 @@ module Banzai
private
private
def
urls
def
urls
Gitlab
::
Application
.
routes
.
url_helpers
Gitlab
::
Routing
.
url_helpers
end
end
def
link_class
def
link_class
...
...
lib/gitlab/email/message/repository_push.rb
View file @
5ae49398
...
@@ -5,7 +5,7 @@ module Gitlab
...
@@ -5,7 +5,7 @@ module Gitlab
attr_accessor
:recipient
attr_accessor
:recipient
attr_reader
:author_id
,
:ref
,
:action
attr_reader
:author_id
,
:ref
,
:action
include
Gitlab
::
Application
.
routes
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
delegate
:namespace
,
:name_with_namespace
,
to: :project
,
prefix: :project
delegate
:namespace
,
:name_with_namespace
,
to: :project
,
prefix: :project
delegate
:name
,
to: :author
,
prefix: :author
delegate
:name
,
to: :author
,
prefix: :author
...
...
lib/gitlab/routing.rb
0 → 100644
View file @
5ae49398
module
Gitlab
module
Routing
# Returns the URL helpers Module.
#
# This method caches the output as Rails' "url_helpers" method creates an
# anonymous module every time it's called.
#
# Returns a Module.
def
self
.
url_helpers
@url_helpers
||=
Gitlab
::
Application
.
routes
.
url_helpers
end
end
end
lib/gitlab/url_builder.rb
View file @
5ae49398
module
Gitlab
module
Gitlab
class
UrlBuilder
class
UrlBuilder
include
Gitlab
::
Application
.
routes
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
include
GitlabRoutingHelper
include
GitlabRoutingHelper
include
ActionView
::
RecordIdentifier
include
ActionView
::
RecordIdentifier
...
...
spec/lib/extracts_path_spec.rb
View file @
5ae49398
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
ExtractsPath
,
lib:
true
do
describe
ExtractsPath
,
lib:
true
do
include
ExtractsPath
include
ExtractsPath
include
RepoHelpers
include
RepoHelpers
include
Gitlab
::
Application
.
routes
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
let
(
:project
)
{
double
(
'project'
)
}
let
(
:project
)
{
double
(
'project'
)
}
...
...
spec/lib/gitlab/closing_issue_extractor_spec.rb
View file @
5ae49398
...
@@ -236,6 +236,6 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
...
@@ -236,6 +236,6 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
end
end
def
urls
def
urls
Gitlab
::
Application
.
routes
.
url_helpers
Gitlab
::
Routing
.
url_helpers
end
end
end
end
spec/support/filter_spec_helper.rb
View file @
5ae49398
...
@@ -78,6 +78,6 @@ module FilterSpecHelper
...
@@ -78,6 +78,6 @@ module FilterSpecHelper
# Shortcut to Rails' auto-generated routes helpers, to avoid including the
# Shortcut to Rails' auto-generated routes helpers, to avoid including the
# module
# module
def
urls
def
urls
Gitlab
::
Application
.
routes
.
url_helpers
Gitlab
::
Routing
.
url_helpers
end
end
end
end
spec/support/markdown_feature.rb
View file @
5ae49398
...
@@ -106,7 +106,7 @@ class MarkdownFeature
...
@@ -106,7 +106,7 @@ class MarkdownFeature
end
end
def
urls
def
urls
Gitlab
::
Application
.
routes
.
url_helpers
Gitlab
::
Routing
.
url_helpers
end
end
def
raw_markdown
def
raw_markdown
...
...
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