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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
93c5033e
Commit
93c5033e
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix new offenses
parent
c7581179
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
66 additions
and
61 deletions
+66
-61
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
config/initializers/metrics.rb
config/initializers/metrics.rb
+7
-7
lib/gitlab/ci/config/entry/global.rb
lib/gitlab/ci/config/entry/global.rb
+1
-1
lib/gitlab/ci/config/entry/jobs.rb
lib/gitlab/ci/config/entry/jobs.rb
+1
-1
spec/lib/expand_variables_spec.rb
spec/lib/expand_variables_spec.rb
+7
-7
spec/lib/gitlab/bitbucket_import/importer_spec.rb
spec/lib/gitlab/bitbucket_import/importer_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/global_spec.rb
spec/lib/gitlab/ci/config/entry/global_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+5
-5
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+1
-1
spec/lib/gitlab/import_sources_spec.rb
spec/lib/gitlab/import_sources_spec.rb
+17
-15
spec/lib/gitlab/incoming_email_spec.rb
spec/lib/gitlab/incoming_email_spec.rb
+2
-2
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+4
-3
spec/requests/api/v3/labels_spec.rb
spec/requests/api/v3/labels_spec.rb
+4
-3
spec/services/merge_requests/resolve_service_spec.rb
spec/services/merge_requests/resolve_service_spec.rb
+3
-3
spec/support/repo_helpers.rb
spec/support/repo_helpers.rb
+7
-6
spec/support/stub_gitlab_calls.rb
spec/support/stub_gitlab_calls.rb
+1
-1
No files found.
app/models/project_services/pushover_service.rb
View file @
93c5033e
...
@@ -55,7 +55,7 @@ class PushoverService < Service
...
@@ -55,7 +55,7 @@ class PushoverService < Service
[
'Pushover Echo (long)'
,
'echo'
],
[
'Pushover Echo (long)'
,
'echo'
],
[
'Up Down (long)'
,
'updown'
],
[
'Up Down (long)'
,
'updown'
],
[
'None (silent)'
,
'none'
]
[
'None (silent)'
,
'none'
]
]},
]
},
]
]
end
end
...
...
app/models/user.rb
View file @
93c5033e
...
@@ -606,7 +606,7 @@ class User < ActiveRecord::Base
...
@@ -606,7 +606,7 @@ class User < ActiveRecord::Base
if
project
.
repository
.
branch_exists?
(
event
.
branch_name
)
if
project
.
repository
.
branch_exists?
(
event
.
branch_name
)
merge_requests
=
MergeRequest
.
where
(
"created_at >= ?"
,
event
.
created_at
)
merge_requests
=
MergeRequest
.
where
(
"created_at >= ?"
,
event
.
created_at
)
.
where
(
source_project_id:
project
.
id
,
.
where
(
source_project_id:
project
.
id
,
source_branch:
event
.
branch_name
)
source_branch:
event
.
branch_name
)
merge_requests
.
empty?
merge_requests
.
empty?
end
end
end
end
...
...
config/initializers/metrics.rb
View file @
93c5033e
...
@@ -20,13 +20,13 @@ def instrument_classes(instrumentation)
...
@@ -20,13 +20,13 @@ def instrument_classes(instrumentation)
# Path to search => prefix to strip from constant
# Path to search => prefix to strip from constant
paths_to_instrument
=
{
paths_to_instrument
=
{
%w(app finders)
=>
%w(app finders)
,
%w(app finders)
=>
%w(app finders)
,
%w(app mailers emails)
=>
%w(app mailers)
,
%w(app mailers emails)
=>
%w(app mailers)
,
[
'app'
,
'services'
,
'**'
]
=>
%w(app services)
,
%w(app services **)
=>
%w(app services)
,
%w(lib gitlab conflicts)
=>
[
'lib'
],
%w(lib gitlab conflicts)
=>
[
'lib'
],
%w(lib gitlab diff)
=>
[
'lib'
],
%w(lib gitlab diff)
=>
[
'lib'
],
%w(lib gitlab email message)
=>
[
'lib'
],
%w(lib gitlab email message)
=>
[
'lib'
],
%w(lib gitlab checks)
=>
[
'lib'
]
%w(lib gitlab checks)
=>
[
'lib'
]
}
}
paths_to_instrument
.
each
do
|
(
path
,
prefix
)
|
paths_to_instrument
.
each
do
|
(
path
,
prefix
)
|
...
...
lib/gitlab/ci/config/entry/global.rb
View file @
93c5033e
...
@@ -49,7 +49,7 @@ module Gitlab
...
@@ -49,7 +49,7 @@ module Gitlab
factory
=
Entry
::
Factory
.
new
(
Entry
::
Jobs
)
factory
=
Entry
::
Factory
.
new
(
Entry
::
Jobs
)
.
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
))
.
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
))
.
with
(
key: :jobs
,
parent:
self
,
.
with
(
key: :jobs
,
parent:
self
,
description:
'Jobs definition for this pipeline'
)
description:
'Jobs definition for this pipeline'
)
@entries
[
:jobs
]
=
factory
.
create!
@entries
[
:jobs
]
=
factory
.
create!
end
end
...
...
lib/gitlab/ci/config/entry/jobs.rb
View file @
93c5033e
...
@@ -35,7 +35,7 @@ module Gitlab
...
@@ -35,7 +35,7 @@ module Gitlab
.
value
(
config
||
{})
.
value
(
config
||
{})
.
metadata
(
name:
name
)
.
metadata
(
name:
name
)
.
with
(
key:
name
,
parent:
self
,
.
with
(
key:
name
,
parent:
self
,
description:
"
#{
name
}
job definition."
)
description:
"
#{
name
}
job definition."
)
@entries
[
name
]
=
factory
.
create!
@entries
[
name
]
=
factory
.
create!
end
end
...
...
spec/lib/expand_variables_spec.rb
View file @
93c5033e
...
@@ -15,41 +15,41 @@ describe ExpandVariables do
...
@@ -15,41 +15,41 @@ describe ExpandVariables do
result:
'keyvalue'
,
result:
'keyvalue'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
}
{
key:
'variable'
,
value:
'value'
}
]},
]
},
{
value:
'key${variable}'
,
{
value:
'key${variable}'
,
result:
'keyvalue'
,
result:
'keyvalue'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
}
{
key:
'variable'
,
value:
'value'
}
]},
]
},
{
value:
'key$variable$variable2'
,
{
value:
'key$variable$variable2'
,
result:
'keyvalueresult'
,
result:
'keyvalueresult'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
},
{
key:
'variable2'
,
value:
'result'
},
]},
]
},
{
value:
'key${variable}${variable2}'
,
{
value:
'key${variable}${variable2}'
,
result:
'keyvalueresult'
,
result:
'keyvalueresult'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
}
{
key:
'variable2'
,
value:
'result'
}
]},
]
},
{
value:
'key$variable2$variable'
,
{
value:
'key$variable2$variable'
,
result:
'keyresultvalue'
,
result:
'keyresultvalue'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
},
{
key:
'variable2'
,
value:
'result'
},
]},
]
},
{
value:
'key${variable2}${variable}'
,
{
value:
'key${variable2}${variable}'
,
result:
'keyresultvalue'
,
result:
'keyresultvalue'
,
variables:
[
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
}
{
key:
'variable2'
,
value:
'result'
}
]},
]
},
{
value:
'review/$CI_BUILD_REF_NAME'
,
{
value:
'review/$CI_BUILD_REF_NAME'
,
result:
'review/feature/add-review-apps'
,
result:
'review/feature/add-review-apps'
,
variables:
[
variables:
[
{
key:
'CI_BUILD_REF_NAME'
,
value:
'feature/add-review-apps'
}
{
key:
'CI_BUILD_REF_NAME'
,
value:
'feature/add-review-apps'
}
]},
]
},
]
]
tests
.
each
do
|
test
|
tests
.
each
do
|
test
|
...
...
spec/lib/gitlab/bitbucket_import/importer_spec.rb
View file @
93c5033e
...
@@ -89,8 +89,8 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -89,8 +89,8 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
stub_request
(
:get
,
"https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on"
)
stub_request
(
:get
,
"https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on"
)
.
with
(
headers:
{
'Accept'
=>
'*/*'
,
'Accept-Encoding'
=>
'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
,
'Authorization'
=>
'Bearer'
,
'User-Agent'
=>
'Faraday v0.9.2'
})
.
with
(
headers:
{
'Accept'
=>
'*/*'
,
'Accept-Encoding'
=>
'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
,
'Authorization'
=>
'Bearer'
,
'User-Agent'
=>
'Faraday v0.9.2'
})
.
to_return
(
status:
200
,
.
to_return
(
status:
200
,
body:
""
,
body:
""
,
headers:
{})
headers:
{})
sample_issues_statuses
.
each_with_index
do
|
issue
,
index
|
sample_issues_statuses
.
each_with_index
do
|
issue
,
index
|
stub_request
(
stub_request
(
...
...
spec/lib/gitlab/ci/config/entry/global_spec.rb
View file @
93c5033e
...
@@ -12,8 +12,8 @@ describe Gitlab::Ci::Config::Entry::Global do
...
@@ -12,8 +12,8 @@ describe Gitlab::Ci::Config::Entry::Global do
it
'contains the expected node names'
do
it
'contains the expected node names'
do
expect
(
described_class
.
nodes
.
keys
)
expect
(
described_class
.
nodes
.
keys
)
.
to
match_array
(
%i[before_script image services
.
to
match_array
(
%i[before_script image services
after_script variables stages
after_script variables stages
types cache]
)
types cache]
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
93c5033e
...
@@ -140,11 +140,11 @@ describe Gitlab::Ci::Config::Entry::Job do
...
@@ -140,11 +140,11 @@ describe Gitlab::Ci::Config::Entry::Job do
it
'returns correct value'
do
it
'returns correct value'
do
expect
(
entry
.
value
)
expect
(
entry
.
value
)
.
to
eq
(
name: :rspec
,
.
to
eq
(
name: :rspec
,
before_script:
%w[ls pwd]
,
before_script:
%w[ls pwd]
,
script:
%w[rspec]
,
script:
%w[rspec]
,
commands:
"ls
\n
pwd
\n
rspec"
,
commands:
"ls
\n
pwd
\n
rspec"
,
stage:
'test'
,
stage:
'test'
,
after_script:
%w[cleanup]
)
after_script:
%w[cleanup]
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
93c5033e
...
@@ -69,7 +69,7 @@ describe Gitlab::Ci::Status::Build::Factory do
...
@@ -69,7 +69,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it
'matches correct extended statuses'
do
it
'matches correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Retryable
,
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Build
::
Retryable
,
Gitlab
::
Ci
::
Status
::
Build
::
FailedAllowed
]
Gitlab
::
Ci
::
Status
::
Build
::
FailedAllowed
]
end
end
it
'fabricates a failed but allowed build status'
do
it
'fabricates a failed but allowed build status'
do
...
...
spec/lib/gitlab/import_sources_spec.rb
View file @
93c5033e
...
@@ -23,14 +23,15 @@ describe Gitlab::ImportSources do
...
@@ -23,14 +23,15 @@ describe Gitlab::ImportSources do
it
'returns an array'
do
it
'returns an array'
do
expected
=
expected
=
%w(
%w(
github
github
bitbucket
bitbucket
gitlab
gitlab
google_code
google_code
fogbugz
fogbugz
git
git
gitlab_project
gitlab_project
gitea)
gitea
)
expect
(
described_class
.
values
).
to
eq
(
expected
)
expect
(
described_class
.
values
).
to
eq
(
expected
)
end
end
...
@@ -40,13 +41,14 @@ gitea)
...
@@ -40,13 +41,14 @@ gitea)
it
'returns an array of importer names'
do
it
'returns an array of importer names'
do
expected
=
expected
=
%w(
%w(
github
github
bitbucket
bitbucket
gitlab
gitlab
google_code
google_code
fogbugz
fogbugz
gitlab_project
gitlab_project
gitea)
gitea
)
expect
(
described_class
.
importer_names
).
to
eq
(
expected
)
expect
(
described_class
.
importer_names
).
to
eq
(
expected
)
end
end
...
...
spec/lib/gitlab/incoming_email_spec.rb
View file @
93c5033e
...
@@ -101,8 +101,8 @@ describe Gitlab::IncomingEmail, lib: true do
...
@@ -101,8 +101,8 @@ describe Gitlab::IncomingEmail, lib: true do
it
'returns reply key'
do
it
'returns reply key'
do
expect
(
described_class
.
scan_fallback_references
(
references
))
expect
(
described_class
.
scan_fallback_references
(
references
))
.
to
eq
(
%w[issue_1@localhost
.
to
eq
(
%w[issue_1@localhost
reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost
reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost
exchange@microsoft.com]
)
exchange@microsoft.com]
)
end
end
end
end
end
end
spec/requests/api/labels_spec.rb
View file @
93c5033e
...
@@ -22,9 +22,10 @@ describe API::Labels, api: true do
...
@@ -22,9 +22,10 @@ describe API::Labels, api: true do
create
(
:labeled_merge_request
,
labels:
[
priority_label
],
author:
user
,
source_project:
project
)
create
(
:labeled_merge_request
,
labels:
[
priority_label
],
author:
user
,
source_project:
project
)
expected_keys
=
%w(
expected_keys
=
%w(
id name color description
id name color description
open_issues_count closed_issues_count open_merge_requests_count
open_issues_count closed_issues_count open_merge_requests_count
subscribed priority)
subscribed priority
)
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
...
...
spec/requests/api/v3/labels_spec.rb
View file @
93c5033e
...
@@ -22,9 +22,10 @@ describe API::V3::Labels, api: true do
...
@@ -22,9 +22,10 @@ describe API::V3::Labels, api: true do
create
(
:labeled_merge_request
,
labels:
[
priority_label
],
author:
user
,
source_project:
project
)
create
(
:labeled_merge_request
,
labels:
[
priority_label
],
author:
user
,
source_project:
project
)
expected_keys
=
%w(
expected_keys
=
%w(
id name color description
id name color description
open_issues_count closed_issues_count open_merge_requests_count
open_issues_count closed_issues_count open_merge_requests_count
subscribed priority)
subscribed priority
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
...
...
spec/services/merge_requests/resolve_service_spec.rb
View file @
93c5033e
...
@@ -60,7 +60,7 @@ describe MergeRequests::ResolveService do
...
@@ -60,7 +60,7 @@ describe MergeRequests::ResolveService do
it
'creates a commit with the correct parents'
do
it
'creates a commit with the correct parents'
do
expect
(
merge_request
.
source_branch_head
.
parents
.
map
(
&
:id
))
expect
(
merge_request
.
source_branch_head
.
parents
.
map
(
&
:id
))
.
to
eq
(
%w(1450cd639e0bc6721eb02800169e464f212cde06
.
to
eq
(
%w(1450cd639e0bc6721eb02800169e464f212cde06
824be604a34828eb682305f0d963056cfac87b2d)
)
824be604a34828eb682305f0d963056cfac87b2d)
)
end
end
end
end
...
@@ -86,7 +86,7 @@ describe MergeRequests::ResolveService do
...
@@ -86,7 +86,7 @@ describe MergeRequests::ResolveService do
it
'creates a commit with the correct parents'
do
it
'creates a commit with the correct parents'
do
expect
(
merge_request_from_fork
.
source_branch_head
.
parents
.
map
(
&
:id
))
expect
(
merge_request_from_fork
.
source_branch_head
.
parents
.
map
(
&
:id
))
.
to
eq
([
'404fa3fc7c2c9b5dacff102f353bdf55b1be2813'
,
.
to
eq
([
'404fa3fc7c2c9b5dacff102f353bdf55b1be2813'
,
target_head
])
target_head
])
end
end
end
end
end
end
...
@@ -126,7 +126,7 @@ describe MergeRequests::ResolveService do
...
@@ -126,7 +126,7 @@ describe MergeRequests::ResolveService do
it
'creates a commit with the correct parents'
do
it
'creates a commit with the correct parents'
do
expect
(
merge_request
.
source_branch_head
.
parents
.
map
(
&
:id
))
expect
(
merge_request
.
source_branch_head
.
parents
.
map
(
&
:id
))
.
to
eq
(
%w(1450cd639e0bc6721eb02800169e464f212cde06
.
to
eq
(
%w(1450cd639e0bc6721eb02800169e464f212cde06
824be604a34828eb682305f0d963056cfac87b2d)
)
824be604a34828eb682305f0d963056cfac87b2d)
)
end
end
it
'sets the content to the content given'
do
it
'sets the content to the content given'
do
...
...
spec/support/repo_helpers.rb
View file @
93c5033e
...
@@ -42,7 +42,7 @@ Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
...
@@ -42,7 +42,7 @@ Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
eos
eos
)
)
end
end
def
another_sample_commit
def
another_sample_commit
OpenStruct
.
new
(
OpenStruct
.
new
(
id:
"e56497bb5f03a90a51293fc6d516788730953899"
,
id:
"e56497bb5f03a90a51293fc6d516788730953899"
,
...
@@ -101,11 +101,12 @@ eos
...
@@ -101,11 +101,12 @@ eos
]
]
commits
=
%w(
commits
=
%w(
5937ac0a7beb003549fc5fd26fc247adbce4a52e
5937ac0a7beb003549fc5fd26fc247adbce4a52e
570e7b2abdd848b95f2f578043fc23bd6f6fd24d
570e7b2abdd848b95f2f578043fc23bd6f6fd24d
6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9
6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9
d14d6c0abdd253381df51a723d58691b2ee1ab08
d14d6c0abdd253381df51a723d58691b2ee1ab08
c1acaa58bbcbc3eafe538cb8274ba387047b69f8)
.
reverse
# last commit is recent one
c1acaa58bbcbc3eafe538cb8274ba387047b69f8
)
.
reverse
# last commit is recent one
OpenStruct
.
new
(
OpenStruct
.
new
(
source_branch:
'master'
,
source_branch:
'master'
,
...
...
spec/support/stub_gitlab_calls.rb
View file @
93c5033e
...
@@ -53,7 +53,7 @@ module StubGitlabCalls
...
@@ -53,7 +53,7 @@ module StubGitlabCalls
stub_request
(
:post
,
"
#{
gitlab_url
}
api/v3/session.json"
)
stub_request
(
:post
,
"
#{
gitlab_url
}
api/v3/session.json"
)
.
with
(
body:
"{
\"
email
\"
:
\"
test@test.com
\"
,
\"
password
\"
:
\"
123456
\"
}"
,
.
with
(
body:
"{
\"
email
\"
:
\"
test@test.com
\"
,
\"
password
\"
:
\"
123456
\"
}"
,
headers:
{
'Content-Type'
=>
'application/json'
})
headers:
{
'Content-Type'
=>
'application/json'
})
.
to_return
(
status:
201
,
body:
f
,
headers:
{
'Content-Type'
=>
'application/json'
})
.
to_return
(
status:
201
,
body:
f
,
headers:
{
'Content-Type'
=>
'application/json'
})
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