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
a4cbbfe4
Commit
a4cbbfe4
authored
Jun 28, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rubocop complaints
parent
bba5975a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
41 deletions
+15
-41
app/controllers/import/bitbucket_server_controller.rb
app/controllers/import/bitbucket_server_controller.rb
+2
-2
lib/bitbucket_server/client.rb
lib/bitbucket_server/client.rb
+1
-24
lib/bitbucket_server/representation/comment.rb
lib/bitbucket_server/representation/comment.rb
+1
-1
lib/bitbucket_server/representation/pull_request_comment.rb
lib/bitbucket_server/representation/pull_request_comment.rb
+9
-10
lib/bitbucket_server/representation/repo.rb
lib/bitbucket_server/representation/repo.rb
+0
-2
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+1
-1
lib/gitlab/bitbucket_server_import/project_creator.rb
lib/gitlab/bitbucket_server_import/project_creator.rb
+1
-1
No files found.
app/controllers/import/bitbucket_server_controller.rb
View file @
a4cbbfe4
...
@@ -60,8 +60,8 @@ class Import::BitbucketServerController < Import::BaseController
...
@@ -60,8 +60,8 @@ class Import::BitbucketServerController < Import::BaseController
def
bitbucket_auth
def
bitbucket_auth
unless
session
[
bitbucket_server_url_key
].
present?
&&
unless
session
[
bitbucket_server_url_key
].
present?
&&
session
[
bitbucket_server_username_key
].
present?
&&
session
[
bitbucket_server_username_key
].
present?
&&
session
[
personal_access_token_key
].
present?
session
[
personal_access_token_key
].
present?
redirect_to
new_import_bitbucket_server_path
redirect_to
new_import_bitbucket_server_path
end
end
end
end
...
...
lib/bitbucket_server/client.rb
View file @
a4cbbfe4
...
@@ -6,16 +6,6 @@ module BitbucketServer
...
@@ -6,16 +6,6 @@ module BitbucketServer
@connection
=
Connection
.
new
(
options
)
@connection
=
Connection
.
new
(
options
)
end
end
def
issues
(
repo
)
path
=
"/repositories/
#{
repo
}
/issues"
get_collection
(
path
,
:issue
)
end
def
issue_comments
(
repo
,
issue_id
)
path
=
"/repositories/
#{
repo
}
/issues/
#{
issue_id
}
/comments"
get_collection
(
path
,
:comment
)
end
def
pull_requests
(
project_key
,
repo
)
def
pull_requests
(
project_key
,
repo
)
path
=
"/projects/
#{
project_key
}
/repos/
#{
repo
}
/pull-requests?state=ALL"
path
=
"/projects/
#{
project_key
}
/repos/
#{
repo
}
/pull-requests?state=ALL"
get_collection
(
path
,
:pull_request
)
get_collection
(
path
,
:pull_request
)
...
@@ -23,13 +13,7 @@ module BitbucketServer
...
@@ -23,13 +13,7 @@ module BitbucketServer
def
activities
(
project_key
,
repo
,
pull_request
)
def
activities
(
project_key
,
repo
,
pull_request
)
path
=
"/projects/
#{
project_key
}
/repos/
#{
repo
}
/pull-requests/
#{
pull_request
}
/activities"
path
=
"/projects/
#{
project_key
}
/repos/
#{
repo
}
/pull-requests/
#{
pull_request
}
/activities"
get_collection
(
path
,
:activity
)
collection
=
get_collection
(
path
,
:activity
)
end
def
pull_request_diff
(
project_key
,
repo
,
pull_request
)
path
=
"/projects/
#{
project_key
}
/repos/
#{
repo
}
/pull-requests/
#{
pull_request
}
/diff"
connection
.
get
(
path
)
end
end
def
repo
(
project
,
repo_name
)
def
repo
(
project
,
repo_name
)
...
@@ -43,13 +27,6 @@ module BitbucketServer
...
@@ -43,13 +27,6 @@ module BitbucketServer
get_collection
(
path
,
:repo
)
get_collection
(
path
,
:repo
)
end
end
def
user
@user
||=
begin
parsed_response
=
connection
.
get
(
'/user'
)
BitbucketServer
::
Representation
::
User
.
new
(
parsed_response
)
end
end
private
private
def
get_collection
(
path
,
type
)
def
get_collection
(
path
,
type
)
...
...
lib/bitbucket_server/representation/comment.rb
View file @
a4cbbfe4
...
@@ -55,7 +55,7 @@ module BitbucketServer
...
@@ -55,7 +55,7 @@ module BitbucketServer
comments
.
each
do
|
comment
|
comments
.
each
do
|
comment
|
new_comments
=
comment
.
delete
(
'comments'
)
new_comments
=
comment
.
delete
(
'comments'
)
workset
<<
new_comments
if
new_comments
workset
<<
new_comments
if
new_comments
all_comments
<<
Comment
.
new
({
'comment'
=>
comment
})
all_comments
<<
Comment
.
new
({
'comment'
=>
comment
})
end
end
end
end
...
...
lib/bitbucket_server/representation/pull_request_comment.rb
View file @
a4cbbfe4
...
@@ -35,7 +35,7 @@ module BitbucketServer
...
@@ -35,7 +35,7 @@ module BitbucketServer
end
end
def
added?
def
added?
line_type
==
'ADDED'
line_type
==
'ADDED'
end
end
def
removed?
def
removed?
...
@@ -67,17 +67,16 @@ module BitbucketServer
...
@@ -67,17 +67,16 @@ module BitbucketServer
end
end
def
line_position
def
line_position
@line_position
||=
@line_position
||=
diff_hunks
.
each
do
|
hunk
|
diff_hunks
.
each
do
|
hunk
|
segments
=
hunk
.
fetch
(
'segments'
,
[])
segments
=
hunk
.
fetch
(
'segments'
,
[])
segments
.
each
do
|
segment
|
segments
.
each
do
|
segment
|
lines
=
segment
.
fetch
(
'lines'
,
[])
lines
=
segment
.
fetch
(
'lines'
,
[])
lines
.
each
do
|
line
|
lines
.
each
do
|
line
|
if
line
[
'commentIds'
]
&
.
include?
(
id
)
if
line
[
'commentIds'
]
&
.
include?
(
id
)
return
[
line
[
'source'
],
line
[
'destination'
]]
return
[
line
[
'source'
],
line
[
'destination'
]]
end
end
end
end
end
end
end
end
end
end
...
...
lib/bitbucket_server/representation/repo.rb
View file @
a4cbbfe4
module
BitbucketServer
module
BitbucketServer
module
Representation
module
Representation
class
Repo
<
Representation
::
Base
class
Repo
<
Representation
::
Base
attr_reader
:owner
,
:slug
def
initialize
(
raw
)
def
initialize
(
raw
)
super
(
raw
)
super
(
raw
)
end
end
...
...
lib/gitlab/bitbucket_server_import/importer.rb
View file @
a4cbbfe4
...
@@ -69,7 +69,7 @@ module Gitlab
...
@@ -69,7 +69,7 @@ module Gitlab
description:
description
,
description:
description
,
source_project:
project
,
source_project:
project
,
source_branch:
Gitlab
::
Git
.
ref_name
(
pull_request
.
source_branch_name
),
source_branch:
Gitlab
::
Git
.
ref_name
(
pull_request
.
source_branch_name
),
source_branch_sha:
pull_request
.
source_branch_sha
,
source_branch_sha:
source_branch_sha
,
target_project:
project
,
target_project:
project
,
target_branch:
Gitlab
::
Git
.
ref_name
(
pull_request
.
target_branch_name
),
target_branch:
Gitlab
::
Git
.
ref_name
(
pull_request
.
target_branch_name
),
target_branch_sha:
target_branch_sha
,
target_branch_sha:
target_branch_sha
,
...
...
lib/gitlab/bitbucket_server_import/project_creator.rb
View file @
a4cbbfe4
...
@@ -27,7 +27,7 @@ module Gitlab
...
@@ -27,7 +27,7 @@ module Gitlab
import_data:
{
import_data:
{
credentials:
session_data
,
credentials:
session_data
,
data:
{
project_key:
project_key
,
data:
{
project_key:
project_key
,
repo_slug:
repo_slug
}
,
repo_slug:
repo_slug
}
},
},
skip_wiki:
true
skip_wiki:
true
).
execute
).
execute
...
...
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